X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=2d0a7e4a37e002453b3e98bb0d0198e51ebe8b64;hb=8cf9dc88c488ba959a211f1ec653a366d16e1531;hp=7cfb71abd00f8d4091b14864ce24e2e3514b672a;hpb=c34752b7ccc945a70a2d9b1e505aa4a4de43163b;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 7cfb71ab..2d0a7e4a 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -42,7 +42,9 @@ int open(const char *path, int openmode, ...) if( openmode & O_NONBLOCK ) openflags |= OPENFLAG_NONBLOCK; - return _SysOpen(path, openflags, create_mode); + int ret = _SysOpen(path, openflags, create_mode); + _SysDebug("open('%s', 0%o, 0%o) = %i", path, openmode, create_mode, ret); + return ret; } int creat(const char *path, mode_t mode) @@ -94,14 +96,16 @@ int dup(int oldfd) { _SysDebug("libposix: dup() does not share offsets/flags"); // NOTE: Acess's CopyFD doesn't cause offset sharing - // TODO: Check that -1 does cause a new allocation - return _SysCopyFD(oldfd, -1); + int ret = _SysCopyFD(oldfd, -1); + _SysDebug("dup(%i) = %i", oldfd, ret); + return ret; } int dup2(int oldfd, int newfd) { _SysDebug("libposix: dup2() does not share offsets/flags"); // NOTE: Acess's CopyFD doesn't cause offset sharing + _SysDebug("dup2(%i,%i)", oldfd, newfd); return _SysCopyFD(oldfd, newfd); } @@ -139,18 +143,17 @@ int kill(pid_t pid, int signal) int select(int nfd, fd_set *rfd, fd_set *wfd, fd_set *efd, struct timeval *timeout) { - + long long int ltimeout = 0, *ltimeoutp = NULL; if( timeout ) { - long long int ltimeout = 0; ltimeout = timeout->tv_sec*1000 + timeout->tv_usec / 1000; - int ret = _SysSelect(nfd, rfd, wfd, efd, <imeout, 0); - return ret; - } - else - { - return _SysSelect(nfd, rfd, wfd, efd, NULL, 0); + ltimeoutp = <imeout; } + _SysDebug("select(%i,{0x%x},{0x%x},{0x%x},%lli)", + nfd, (rfd?rfd->flags[0]:0), (wfd?wfd->flags[0]:0), (efd?efd->flags[0]:0), + (ltimeoutp ? *ltimeoutp : -1) + ); + return _SysSelect(nfd, rfd, wfd, efd, ltimeoutp, 0); } int pipe(int pipefd[2]) @@ -158,6 +161,7 @@ int pipe(int pipefd[2]) pipefd[0] = _SysOpen("/Devices/fifo/anon", OPENFLAG_READ|OPENFLAG_WRITE); pipefd[1] = _SysCopyFD(pipefd[0], -1); _SysFDFlags(pipefd[1], OPENFLAG_READ|OPENFLAG_WRITE, OPENFLAG_WRITE); + _SysDebug("pipe({%i,%i})", pipefd[0], pipefd[1]); return 0; }