X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fensc_wrappers%2Fwrappers-unistd.hc;h=6b21fc3040585f176498b08b9a4fcfaaa9c2702e;hb=842a918cb9bcdd3b1c79dd980d2f9638b0cd6742;hp=5d7213a966ca227ab749bbd6d28aef3bed37c3ba;hpb=f8047b034083d7a4870e85b738415ae35c000e7c;p=util-vserver.git diff --git a/util-vserver/ensc_wrappers/wrappers-unistd.hc b/util-vserver/ensc_wrappers/wrappers-unistd.hc index 5d7213a..6b21fc3 100644 --- a/util-vserver/ensc_wrappers/wrappers-unistd.hc +++ b/util-vserver/ensc_wrappers/wrappers-unistd.hc @@ -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 @@ -73,8 +85,8 @@ Efork() inline static WRAPPER_DECL size_t Eread(int fd, void *ptr, size_t len) { - size_t res = read(fd, ptr, len); - FatalErrnoError((ssize_t)(res)==-1, "read()"); + ssize_t res = read(fd, ptr, len); + FatalErrnoError(res==-1, "read()"); return res; } @@ -82,16 +94,29 @@ Eread(int fd, void *ptr, size_t len) inline static WRAPPER_DECL size_t Ewrite(int fd, void const *ptr, size_t len) { - size_t res = write(fd, ptr, len); - FatalErrnoError((ssize_t)(res)==-1, "write()"); + ssize_t res = write(fd, ptr, len); + FatalErrnoError(res==-1, "write()"); 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()"); + ssize_t res = readlink(path, buf, bufsiz); + FatalErrnoError(res==-1, "readlink()"); + + return res; +} + +inline static WRAPPER_DECL size_t +EreadlinkD(const char *path, char *buf, size_t bufsiz) +{ + ssize_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,21 @@ 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()"); +} + +inline static WRAPPER_DECL void +Etruncate(const char *path, off_t length) +{ + FatalErrnoError(truncate(path,length)==-1, "truncate()"); +} + +inline static WRAPPER_DECL void +Eftruncate(int fd, off_t length) +{ + FatalErrnoError(ftruncate(fd,length)==-1, "ftruncate()"); +}