]> Zhao Yanbai Git Server - minix.git/commitdiff
Added dummy readlink() call that returns an error (we don't have symlinks
authorBen Gras <ben@minix3.org>
Fri, 17 Jun 2005 11:43:24 +0000 (11:43 +0000)
committerBen Gras <ben@minix3.org>
Fri, 17 Jun 2005 11:43:24 +0000 (11:43 +0000)
yet)

also select() stub

lib/posix/Makefile
lib/posix/_select.c
lib/posix/readlink.c [new file with mode: 0644]

index cd8f68f8b141be5e2cd71d4a79251c5e24a6f148..64d2c27c9ec63f13ab97a2da1dafaef4490b2c82 100755 (executable)
@@ -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
 
index 5d4cef4f163b486b156760d817a2d7c44f097b48..d84808b40c95557a0939d0da8e897663f7e23cf1 100755 (executable)
@@ -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 (file)
index 0000000..819c7ee
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+readlink.c
+*/
+
+#define readlink _readlink
+
+#include <unistd.h>
+#include <errno.h>
+
+int readlink(const char *path, char *buf, int bufsiz)
+{
+       errno = EINVAL; /* "The named file is not a symbolic link" */
+       return -1;
+}