added vps
[util-vserver.git] / util-vserver / src / wrappers.h
index 8800e19..ee8542c 100644 (file)
@@ -219,6 +219,35 @@ Esetgroups(size_t size, const gid_t *list)
   FatalErrnoError(setgroups(size, list)==-1, "setgroups()");
 }
 
+inline static WRAPPER_DECL int
+Edup2(int oldfd, int newfd)
+{
+  register int          res = dup2(oldfd, newfd);
+  FatalErrnoError(res==-1, "dup2()");
+
+  return res;
+}
+
+inline static UNUSED void *
+Emalloc(size_t size)
+{
+  register void               *res = malloc(size);
+  FatalErrnoError(res==0 && size!=0, "malloc()");
+  return res;
+}
+
+/*@unused@*/
+inline static /*@null@*//*@only@*/ void *
+Erealloc(/*@only@*//*@out@*//*@null@*/ void *ptr,
+         size_t new_size)
+    /*@ensures maxSet(result) == new_size@*/
+    /*@modifies *ptr@*/
+{
+  register void         *res = realloc(ptr, new_size);
+  FatalErrnoError(res==0 && new_size!=0, "realloc()");
+
+  return res;
+}
 
 #undef WRAPPER_DECL