added getxidtype.c
[util-vserver.git] / util-vserver / ensc_wrappers / wrappers-unistd.hc
index 5d7213a..9cd29a8 100644 (file)
@@ -46,13 +46,25 @@ Echroot(char const path[])
 inline static WRAPPER_DECL NORETURN void
 Eexecv(char const *path, char *argv[])
 {
-  FatalErrnoError(execv(path,argv)==-1, "execv()");
+  execv(path,argv);
+  FatalErrnoErrorFail("execv()");
 }
 
 inline static WRAPPER_DECL NORETURN void
 Eexecvp(char const *path, char *argv[])
 {
-  FatalErrnoError(execvp(path,argv)==-1, "execvp()");
+  execvp(path,argv);
+  FatalErrnoErrorFail("execvp()");
+}
+
+inline static WRAPPER_DECL NORETURN void
+EexecvpD(char const *path, char *argv[])
+{
+  execvp(path,argv);
+  {
+    ENSC_DETAIL1(msg, "execvp", path, 1);
+    FatalErrnoErrorFail(msg);
+  }
 }
 
 inline static WRAPPER_DECL void
@@ -88,10 +100,23 @@ Ewrite(int fd, void const *ptr, size_t len)
   return res;
 }
 
-inline static WRAPPER_DECL void
+inline static WRAPPER_DECL size_t
 Ereadlink(const char *path, char *buf, size_t bufsiz)
 {
-  FatalErrnoError(readlink(path, buf, bufsiz)==-1, "readlink()");
+  size_t       res = readlink(path, buf, bufsiz);
+  FatalErrnoError((ssize_t)(res)==-1, "readlink()");
+
+  return res;
+}
+
+inline static WRAPPER_DECL size_t
+EreadlinkD(const char *path, char *buf, size_t bufsiz)
+{
+  size_t       res = readlink(path, buf, bufsiz);
+  ENSC_DETAIL1(msg, "readlink", path, 1);
+  FatalErrnoError((ssize_t)(res)==-1, msg);
+
+  return res;
 }
 
 inline static WRAPPER_DECL void
@@ -101,6 +126,13 @@ Esymlink(const char *oldpath, const char *newpath)
 }
 
 inline static WRAPPER_DECL void
+EsymlinkD(const char *oldpath, const char *newpath)
+{
+  ENSC_DETAIL2(msg, "symlink", oldpath, newpath, 1, 1);
+  FatalErrnoError(symlink(oldpath, newpath)==-1, msg);
+}
+
+inline static WRAPPER_DECL void
 Eunlink(char const *pathname)
 {
   FatalErrnoError(unlink(pathname)==-1, "unlink()");
@@ -135,6 +167,15 @@ Edup2(int oldfd, int newfd)
   return res;
 }
 
+inline static WRAPPER_DECL int
+Edup(int fd)
+{
+  register int          res = dup(fd);
+  FatalErrnoError(res==-1, "dup()");
+
+  return res;
+}
+
 inline static WRAPPER_DECL pid_t
 Esetsid()
 {
@@ -159,3 +200,9 @@ Elseek(int fildes, off_t offset, int whence)
   FatalErrnoError(res==(off_t)-1, "lseek()");
   return res;
 }
+
+inline static WRAPPER_DECL void
+Enice(int n)
+{
+  FatalErrnoError(nice(n)==-1, "nice()");
+}