diff options
author | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-22 10:46:59 +0000 |
---|---|---|
committer | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-22 10:46:59 +0000 |
commit | 1dfa52bc2a08fd6abce250b86ed676ed75e7f9a7 (patch) | |
tree | 552e94cccaeaddcf88e37c344c473b6fe12596fa /lib/libpthread/pthreads | |
parent | 55fc30f96bf26fbc4ef03930e5ba827c3304c58a (diff) |
o removed more unused or old, left over files
o general changes so that now the library compiles and many of the
tests run correctly
o pthreads/Makefile.inc rebuilt using libc/sys/Makefile.inc as a template.
this should be kept in sync in case of new syscalls
soon TODO:
figure out why remaining tests fail and fix
look at building .so version of library
tidy up arch/i386 directory - no longer uses syscall-template.S
port other arch's from libc syscall templates
Diffstat (limited to 'lib/libpthread/pthreads')
-rw-r--r-- | lib/libpthread/pthreads/Makefile.inc | 133 | ||||
-rw-r--r-- | lib/libpthread/pthreads/fd_kern.c | 78 | ||||
-rw-r--r-- | lib/libpthread/pthreads/readv.c | 85 | ||||
-rw-r--r-- | lib/libpthread/pthreads/signal.c | 12 | ||||
-rw-r--r-- | lib/libpthread/pthreads/stat.c | 4 | ||||
-rw-r--r-- | lib/libpthread/pthreads/writev.c | 89 |
6 files changed, 90 insertions, 311 deletions
diff --git a/lib/libpthread/pthreads/Makefile.inc b/lib/libpthread/pthreads/Makefile.inc index 4e3f7d41df6..6e4d8a39d49 100644 --- a/lib/libpthread/pthreads/Makefile.inc +++ b/lib/libpthread/pthreads/Makefile.inc @@ -9,62 +9,99 @@ SRCS+= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c \ pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \ dump_state.c pthread_kill.c condattr.c pthread_cancel.c panic.c -OBJS+= syscalls.o +# glue to provide compatibility between GCC 1.X and 2.X and for compat +# with old syscall interfaces. +#SRCS+= ftruncate.c lseek.c mmap.c semctl.c truncate.c \ +# timer_create.c timer_delete.c timer_getoverrun.c timer_gettime.c \ +# timer_settime.c -AVAILABLE_SYSCALLS = open write read creat close fcntl lseek dup pipe fchmod fchown execve fstat lstat link unlink chdir chown chmod stat rename ioctl fstatfs sigsuspend sigaction sigprocmask getdents waitsys poll putmsg getmsg pgrpsys exit readv writev fork +# modules with default implementations on all architectures: +ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ + chown.o chroot.o clock_gettime.o clock_settime.o clock_getres.o \ + close.o connect.o dup.o dup2.o execve.o fchdir.o \ + fchflags.o fchmod.o fchown.o fcntl.o flock.o fpathconf.o fstat.o \ + fstatfs.o fsync.o futimes.o getdirentries.o getegid.o geteuid.o \ + getfh.o getfsstat.o getgid.o getgroups.o getitimer.o getpeername.o \ + getpgid.o \ + getpgrp.o getpid.o getppid.o getpriority.o getrlimit.o getrusage.o \ + getsid.o \ + getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \ + ioctl.o kill.o \ + ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \ + link.o listen.o lstat.o madvise.o mincore.o minherit.o mkdir.o \ + mkfifo.o mknod.o mlock.o \ + mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \ + munlock.o munmap.o nanosleep.o nfssvc.o \ + ntp_gettime.o ntp_adjtime.o \ + open.o pathconf.o poll.o profil.o quotactl.o \ + read.o readlink.o readv.o reboot.o recvfrom.o recvmsg.o rename.o \ + revoke.o rfork.o \ + rmdir.o select.o semconfig.o semget.o semop.o sendmsg.o sendto.o \ + setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \ + setpriority.o setrlimit.o setsid.o setsockopt.o settimeofday.o \ + setuid.o shmat.o shmctl.o shmdt.o shmget.o shutdown.o sigaction.o \ + sigaltstack.o socket.o socketpair.o stat.o statfs.o swapon.o \ + symlink.o sync.o sysarch.o umask.o undelete.o unlink.o unmount.o \ + utimes.o vadvise.o wait4.o write.o writev.o __semctl.o \ + __sysctl.o -SYSCALL_TEMPLATE = ${.CURDIR}/arch/${MACHINE}/syscall-template.S -SYSCALL_S = ${.CURDIR}/arch/${MACHINE}/syscall.S +PASM= ${ASM:.o=.po} +SASM= ${ASM:.o=.so} -.if !defined(NOPIC) -SOBJS+= syscalls.so -SYSCALL_PIC_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -DPIC -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.so -.else -SYSCALL_PIC_COMPILE= true -.endif +PSEUDO= _exit.o _getlogin.o +PPSEUDO=${PSEUDO:.o=.po} +SPSEUDO=${PSEUDO:.o=.so} -.if !defined(NOPROFILE) -POBJS+= syscalls.po -SYSCALL_PROF_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -pg -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.po -.else -SYSCALL_PROF_COMPILE= true -.endif +OBJS+= ${ASM} ${PSEUDO} -syscalls.o syscalls.so syscalls.po : ${SYSCALL_TEMPLATE} - -rm -rf ${.OBJDIR}/syscalls - mkdir ${.OBJDIR}/syscalls - for syscall in $(AVAILABLE_SYSCALLS) ; do \ - case " $(SYSCALL_EXCEPTIONS) " in \ - *" "$$syscall" "*) ;; \ - *) echo $$syscall ; \ - $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.o ; \ - $(SYSCALL_PIC_COMPILE) ; \ - $(SYSCALL_PROF_COMPILE) ;; \ - esac ; \ - done - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.o *.o && cd $$x -.if !defined(NOPIC) - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.so *.so && cd $$x -.endif +${PASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -.if !defined(NOPROFILE) - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.po *.po && cd $$x +.if (${MACHINE_ARCH} != "mips") +${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET} +.else +${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET} .endif - rm -r ${.OBJDIR}/syscalls - -syscall.o: syscall.S - cpp ${CPPFLAGS} ${SYSCALL_S} > syscall.i - as syscall.i - rm syscall.i - mv a.out syscall.o -syscall.po: syscall.S - cpp ${CPPFLAGS} ${SYSCALL_S} > syscall.i - as syscall.i - rm syscall.i - mv a.out syscall.po +${ASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -MAN2+= +${PPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -MAN3+= +.if (${MACHINE_ARCH} != "mips") +${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET} +.else +${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET} +.endif +${PSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o diff --git a/lib/libpthread/pthreads/fd_kern.c b/lib/libpthread/pthreads/fd_kern.c index be2fc5ec90f..23b7b074e21 100644 --- a/lib/libpthread/pthreads/fd_kern.c +++ b/lib/libpthread/pthreads/fd_kern.c @@ -39,7 +39,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: fd_kern.c,v 1.2 1998/07/21 19:48:02 peter Exp $"; +static const char rcsid[] = "$Id: fd_kern.c,v 1.3 1998/07/22 10:46:51 peter Exp $"; #endif #include <pthread.h> @@ -57,8 +57,6 @@ static const char rcsid[] = "$Id: fd_kern.c,v 1.2 1998/07/21 19:48:02 peter Exp #include <pthread/posix.h> #include <string.h> -#if defined (HAVE_SYSCALL_SENDTO) && !defined (HAVE_SYSCALL_SEND) - pthread_ssize_t machdep_sys_send (int fd, const void *msg, size_t len, int flags) { @@ -66,18 +64,12 @@ pthread_ssize_t machdep_sys_send (int fd, const void *msg, size_t len, (const struct sockaddr *) 0, 0); } -#endif - -#if defined (HAVE_SYSCALL_RECVFROM) && !defined (HAVE_SYSCALL_RECV) - pthread_ssize_t machdep_sys_recv (int fd, void *buf, size_t len, int flags) { return machdep_sys_recvfrom (fd, buf, len, flags, (struct sockaddr *) 0, (int *) 0); } -#endif - /* ========================================================================== * Check if there is any signal with must be handled. Added by Monty * This could be somewhat system dependent but it should work. @@ -722,7 +714,6 @@ int ftruncate(int fd, off_t length) return(ret); } -#if defined (HAVE_SYSCALL_FLOCK) /* ========================================================================== * flock() * @@ -742,7 +733,6 @@ int flock(int fd, int operation) } return(ret); } -#endif /* ========================================================================== * pipe() @@ -1056,8 +1046,6 @@ void fd_kern_fork() * Here are the berkeley socket functions. These are not POSIX. * ======================================================================= */ -#if defined (HAVE_SYSCALL_SOCKET) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * socket() */ @@ -1087,10 +1075,6 @@ int socket(int af, int type, int protocol) return(NOTOK); } -#endif - -#if defined (HAVE_SYSCALL_BIND) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * bind() */ @@ -1109,10 +1093,6 @@ int bind(int fd, const struct sockaddr *name, int namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_CONNECT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * connect() */ @@ -1161,10 +1141,6 @@ int connect(int fd, const struct sockaddr *name, int namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_ACCEPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * accept() */ @@ -1210,10 +1186,6 @@ int accept(int fd, struct sockaddr *name, int *namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_LISTEN) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * listen() */ @@ -1231,10 +1203,7 @@ int listen(int fd, int backlog) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_SEND) || defined (HAVE_SYSCALL_SOCKETCALL) - +#if 0 /* ========================================================================== * send_timedwait() */ @@ -1308,8 +1277,6 @@ ssize_t send(int fd, const void * msg, size_t len, int flags) #endif -#if defined (HAVE_SYSCALL_SENDTO) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * sendto_timedwait() */ @@ -1381,10 +1348,6 @@ ssize_t sendto(int fd, const void * msg, size_t len, int flags, return(sendto_timedwait(fd, msg, len, flags, to, to_len, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_SENDMSG) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * sendmsg_timedwait() */ @@ -1483,10 +1446,7 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) return(sendmsg_timedwait(fd, msg, flags, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_RECV) || defined (HAVE_SYSCALL_SOCKETCALL) - +#if 0 /* ========================================================================== * recv_timedwait() */ @@ -1559,8 +1519,6 @@ ssize_t recv(int fd, void * buf, size_t len, int flags) #endif -#if defined (HAVE_SYSCALL_RECVFROM) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * recvfrom_timedwait() */ @@ -1633,10 +1591,6 @@ ssize_t recvfrom(int fd, void * buf, size_t len, int flags, return(recvfrom_timedwait(fd, buf, len, flags, from, from_len, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_RECVMSG) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * recvmsg_timedwait() */ @@ -1735,10 +1689,6 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags) return(recvmsg_timedwait(fd, msg, flags, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_SHUTDOWN) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * shutdown() */ @@ -1779,10 +1729,6 @@ int shutdown(int fd, int how) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_SETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * setsockopt() */ @@ -1801,10 +1747,6 @@ int setsockopt(int fd, int level, int optname, const void * optval, int optlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getsockopt() */ @@ -1823,10 +1765,6 @@ int getsockopt(int fd, int level, int optname, void * optval, int * optlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getsockname() */ @@ -1845,10 +1783,6 @@ int getsockname(int fd, struct sockaddr * name, int * naddrlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETPEERNAME) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getpeername() */ @@ -1867,10 +1801,6 @@ int getpeername(int fd, struct sockaddr * peer, int * paddrlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_SOCKETPAIR) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * socketpair() */ @@ -1906,5 +1836,3 @@ int socketpair(int af, int type, int protocol, int pair[2]) } return(NOTOK); } - -#endif diff --git a/lib/libpthread/pthreads/readv.c b/lib/libpthread/pthreads/readv.c deleted file mode 100644 index 64ec8704f44..00000000000 --- a/lib/libpthread/pthreads/readv.c +++ /dev/null @@ -1,85 +0,0 @@ -/* ==== readv.c ============================================================ - * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Chris Provenzano. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Description : Implementation of readv(). - * - * 1.00 95/06/19 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "$Id: readv.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; -#endif - -#include "config.h" - -#ifndef HAVE_SYSCALL_READV - -#include <errno.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/types.h> - -/* ========================================================================== - * machdep_sys_readv() - */ -int machdep_sys_readv(int fd, struct iovec * vector, int count) -{ - size_t bytes, i; - char *buffer; - int ret = 0; - - /* Find the total number of bytes to be read. */ - for (bytes = 0, i = 0; i < count; ++i) - bytes += vector[i].iov_len; - - if (bytes) { - /* - * Allocate a temporary buffer to hold the data. - * Don't use alloca because threads tend to have smaller stacks. - */ - if ((buffer = (char *)malloc(bytes)) == NULL) { - return(-ENOMEM); - } - ret = (int)machdep_sys_read(fd, buffer, bytes); - - /* Copy the data from memory specified by VECTOR to BUFFER */ - for (i = 0, bytes = 0; ret > 0; ret -= vector[i].iov_len) { - memcpy(vector[i].iov_base, buffer + bytes, - ret > vector[i].iov_len ? vector[i].iov_len : ret); - bytes += vector[i].iov_len; - } - free(buffer); - } - return(ret); -} - -#endif diff --git a/lib/libpthread/pthreads/signal.c b/lib/libpthread/pthreads/signal.c index b96bee7e38f..df0cf153145 100644 --- a/lib/libpthread/pthreads/signal.c +++ b/lib/libpthread/pthreads/signal.c @@ -36,7 +36,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: signal.c,v 1.2 1998/07/21 19:48:04 peter Exp $"; +static const char rcsid[] = "$Id: signal.c,v 1.3 1998/07/22 10:46:54 peter Exp $"; #endif #include <pthread.h> @@ -600,22 +600,16 @@ void sig_init(void) static const int signum_to_ignore[] = { SIGKILL, SIGSTOP, 0 }; int i, j; -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) struct sigaction act; act.sa_handler = sig_handler_real; sigemptyset(&(act.sa_mask)); act.sa_flags = 0; -#endif /* Initialize the important signals */ for (i = 0; signum_to_initialize[i]; i++) { -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) if (sigaction(signum_to_initialize[i], &act, NULL)) { -#else - if (signal(signum_to_initialize[i], sig_handler_real)) { -#endif PANIC(); } } @@ -635,11 +629,7 @@ void sig_init(void) } pthread_signal(j, SIG_DFL); -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) sigaction(j, &act, NULL); -#else - signal(j, sig_handler_real); -#endif sig_next:; } diff --git a/lib/libpthread/pthreads/stat.c b/lib/libpthread/pthreads/stat.c index 56e65a48c60..3d5872187bf 100644 --- a/lib/libpthread/pthreads/stat.c +++ b/lib/libpthread/pthreads/stat.c @@ -36,7 +36,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: stat.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +static const char rcsid[] = "$Id: stat.c,v 1.2 1998/07/22 10:46:55 peter Exp $"; #endif #include <pthread.h> @@ -94,7 +94,6 @@ int lstat(const char * path, struct stat * buf) } -#ifdef HAVE_SYSCALL_FSTATFS /* ========================================================================== * fstatfs() * @@ -113,4 +112,3 @@ int fstatfs(int fd, struct statfs *buf) } return(ret); } -#endif diff --git a/lib/libpthread/pthreads/writev.c b/lib/libpthread/pthreads/writev.c deleted file mode 100644 index 9bc3cba870d..00000000000 --- a/lib/libpthread/pthreads/writev.c +++ /dev/null @@ -1,89 +0,0 @@ -/* ==== writev.c ============================================================ - * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Chris Provenzano. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Description : Implementation of writev(). - * - * 1.00 95/06/19 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "$Id: writev.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; -#endif - -#include "config.h" - -#ifndef HAVE_SYSCALL_WRITEV - -#include <errno.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/types.h> - -/* ========================================================================== - * machdep_sys_writev() - * - * modified from the GNU C Library posix/writev.c - */ -int machdep_sys_writev(int fd, struct iovec * vector, int count) -{ - size_t bytes, i; - char *buffer; - int ret; - - /* Find the total number of bytes to be written. */ - for (bytes = 0, i = 0; i < count; ++i) - bytes += vector[i].iov_len; - - if (bytes) { - /* - * Allocate a temporary buffer to hold the data. - * Don't use alloca because threads tend to have smaller stacks. - */ - if ((buffer = (char *)malloc(bytes)) == NULL) { - return(-ENOMEM); - } - /* Copy the data from memory specified by VECTOR to BUFFER */ - for (ret = 0, i = 0; i < count; ++i) { - memcpy(buffer + ret, vector[i].iov_base, vector[i].iov_len); - ret += vector[i].iov_len; - } - } else { - buffer = NULL; - } - - ret = (int)machdep_sys_write(fd, buffer, bytes); - if (buffer) - free(buffer); - return(ret); -} - -#endif |