$(LIBRARY)(_write.o) \
$(LIBRARY)(gettimeofday.o) \
$(LIBRARY)(lstat.o) \
+ $(LIBRARY)(readlink.o) \
$(LIBRARY)(symlink.o) \
$(LIBRARY): $(OBJECTS)
$(LIBRARY)(gettimeofday.o): gettimeofday.c
$(CC1) gettimeofday.c
+$(LIBRARY)(readlink.o): readlink.c
+ $(CC1) readlink.c
+
$(LIBRARY)(lstat.o): lstat.c
$(CC1) lstat.c
{
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;
+}
+
--- /dev/null
+/*
+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;
+}