From: Ben Gras Date: Fri, 17 Jun 2005 11:43:24 +0000 (+0000) Subject: Added dummy readlink() call that returns an error (we don't have symlinks X-Git-Tag: v3.1.0~746 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=b7c75fab5b4387779ab31dd4bdc2c6ca82bbb6f2;p=minix.git Added dummy readlink() call that returns an error (we don't have symlinks yet) also select() stub --- diff --git a/lib/posix/Makefile b/lib/posix/Makefile index cd8f68f8b..64d2c27c9 100755 --- a/lib/posix/Makefile +++ b/lib/posix/Makefile @@ -97,6 +97,7 @@ OBJECTS = \ $(LIBRARY)(_write.o) \ $(LIBRARY)(gettimeofday.o) \ $(LIBRARY)(lstat.o) \ + $(LIBRARY)(readlink.o) \ $(LIBRARY)(symlink.o) \ $(LIBRARY): $(OBJECTS) @@ -370,6 +371,9 @@ $(LIBRARY)(_write.o): _write.c $(LIBRARY)(gettimeofday.o): gettimeofday.c $(CC1) gettimeofday.c +$(LIBRARY)(readlink.o): readlink.c + $(CC1) readlink.c + $(LIBRARY)(lstat.o): lstat.c $(CC1) lstat.c diff --git a/lib/posix/_select.c b/lib/posix/_select.c index 5d4cef4f1..d84808b40 100755 --- a/lib/posix/_select.c +++ b/lib/posix/_select.c @@ -8,11 +8,47 @@ PUBLIC int select(int nfds, { message m; - m.m8_i1 = nfds; - m.m8_p1 = (char *) readfds; - m.m8_p2 = (char *) writefds; - m.m8_p3 = (char *) errorfds; - m.m8_p4 = (char *) timeout; + m.SEL_NFDS = nfds; + m.SEL_READFDS = (char *) readfds; + m.SEL_WRITEFDS = (char *) writefds; + m.SEL_ERRORFDS = (char *) errorfds; + m.SEL_TIMEOUT = (char *) timeout; return (_syscall(FS, SELECT, &m)); } + +#define FD_BITMASK(b) (1L << ((b) % _FDSETBITSPERWORD)) +#define FD_BITWORD(b) ((b)/_FDSETBITSPERWORD) + +PUBLIC void FD_CLR(int fd, fd_set *fdset) +{ + if(fd < 0 || fd >= FD_SETSIZE) return; + fdset->_fdsetval[FD_BITWORD(fd)] &= ~(FD_BITMASK(fd)); + return; +} + +PUBLIC int FD_ISSET(int fd, fd_set *fdset) +{ + if(fd < 0 || fd >= FD_SETSIZE) + return 0; + if(fdset->_fdsetval[FD_BITWORD(fd)] & FD_BITMASK(fd)) + return 1; + return 0; +} + +PUBLIC void FD_SET(int fd, fd_set *fdset) +{ + if(fd < 0 || fd >= FD_SETSIZE) + return; + fdset->_fdsetval[FD_BITWORD(fd)] |= FD_BITMASK(fd); + return; +} + +PUBLIC void FD_ZERO(fd_set *fdset) +{ + int i; + for(i = 0; i < _FDSETWORDS; i++) + fdset->_fdsetval[i] = 0; + return; +} + diff --git a/lib/posix/readlink.c b/lib/posix/readlink.c new file mode 100644 index 000000000..819c7eee1 --- /dev/null +++ b/lib/posix/readlink.c @@ -0,0 +1,14 @@ +/* +readlink.c +*/ + +#define readlink _readlink + +#include +#include + +int readlink(const char *path, char *buf, int bufsiz) +{ + errno = EINVAL; /* "The named file is not a symbolic link" */ + return -1; +}