Added dummy readlink() call that returns an error (we don't have symlinks

yet)

also select() stub
This commit is contained in:
Ben Gras 2005-06-17 11:43:24 +00:00
parent ae018feae2
commit b7c75fab5b
3 changed files with 59 additions and 5 deletions

View file

@ -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

View file

@ -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;
}

14
lib/posix/readlink.c Normal file
View file

@ -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;
}