cvs diff: Diffing . Index: FAQ RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/FAQ,v retrieving revision 1.51 diff -r1.51 FAQ 34d33 < draft to contain the pthread_detach() function (draft 7). Index: Whats_New RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/Whats_New,v retrieving revision 1.58 diff -r1.58 Whats_New 0a1,71 > For the 95/09/01 release version 1_60_beta4 > > Bug Fixes > stdio/fwalk.c, stdio/refill.c : Use flockfile() instead of > ftrylockfile()/pthread_yield(), for traversing FILE list. > > For the 95/06/xx release version 1_60_beta3 > > Additions > Add exec variants execl, execlp, execv, execvp (Ken Raeburn) > pthreads/fd_sysv.c : Added routines setsockopt() and getsockname(). > Added include/endian.h : For machine dependent endian junk. (YUCK) > Added socketpair() > Added ttyname_r() > > Bug Fixes > config/Makefile.in : Need $$ to reference shell variables in make. > config/configure, config/configure.in : Redo freebsd2.* machine. > machdep/sunos-4.1.3/__stdlib.h : typedef pthread_size_t size_t > pthreads/fd.c : Fix bug with fd_free(), dup(), dup2(), and close() > where a fd gets lost after a dup() then close(). > pthreads/fd_kern.c : The fd_table[fd]->flags of the fd that accept() > returns should be the same as those of the fd passed to accept(). > stdio/fclose.c : Don't call funlockfile(fp) after fp->_file has been > closed. > pthreads/select.c : Move pthread_sched_prevent() inside the statement. > if (machdep_sys_select(...) == OK) > pthreads/machdep/linux-1.0/cdefs.h : moved the include_next outside > of the ifdef so that it would eventually find the system cdefs.h > pthreads/signal.c : Check sig_to_process before and after fd_kern_wait() > . It is possible for sig_handler_fake() to registered one. > pthreads/signal.c : Unset pthread_run temporarily around the call to > sig_handler(0). places where this causes core dumps should check > pthread_run. > include/stdlib.h : Fix prototype for bsearch(). > machdep/syscall-i386-freebsd-2.0.S syscall-template-i386-freebsd2.0.S: > Fix macro expansion problems for FreeBSD-2.0 > machdep/engine-sparc-sunos-5.3.c : Fix machdep_sys_select() to return > machdep_sys_poll() errors and not the number of entries found. > gen/getcwd.c : Use strlen(dp->d_name) not dp->d_namlen because there > may be extra data associated with dp->d_namelen. > machdep/freebsd-2.0/__unistd.h: Change #define _POSIX_VDISABLE to 0xff > include/pthread.h : Added prototypes pthread_kill(), pthread_signal() > machdep/linux-1.0/__signal.h : Added #define __sigmask() and > #define sigmask, and fixed other SIG macros to use __sigmask. > machdep/linux-1.0/dirent.h : #include > machdep/linux-1.0/wait.h : Fix #define WIFSTOPPED(x) to use __WSTATUS(x) > machdep/syscall-i386-linux-1.0.S : Added elf support. (NOT TESTED) > pthreads/stat.c : Added to separate linux stat calls. > (SGI will need this too) > pthreads/signal.c : Whereever #ifdef (SA_RESETHAND) is used then > #ifdef (SA_RESTART) also > gen/isatty.c : isatty_basic() is called with the KFD not UFD. > machdep/sunos-4.1.3/__stdlib.h : #include > config/sun4os4.mk : Added pipe to SYSCALL_EXCEPTIONS > machdep/syscall-sparc-sunos-4.1.3.S : Add machdep_sys_pipe(). > include/stdio.h : Remove __getc() and __putc(), because they really > shouldn't be inlined. > machdep/sunos-4.1.3/stat.h : Added __BEGIN_DECLS and __END_DECLS. > machdep/alpha-osf1/cdefs.h, machdep/hpux-9.03/cdefs.h > machdep/linux-1.0/cdefs.h, machdep/sunos-4.1.3/cdefs.h > machdep/sunos-5.3/cdefs.h, machdep/ultrix-4.2/cdefs.h : > #define __INLINE static inline and don't #define > __CAN_DO_EXTERN_INLINE if __cplusplus and __GCC__ is defined. > pthreads/fd_sysv.c : Fix so that only systems without socket systemcalls > compile this file. > machdep/engine-i386-linux-1.0.c : Fix linux machdep_sys_getdirentries() > pthreads/gen : Nuke the signal-blocking code in pclose(). It doesn't do > any good in a threaded program; some other thread would just get > the signal. > Index: configure RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/configure,v retrieving revision 1.60 diff -r1.60 configure 9a10,13 > if test ! -d obj ; then > mkdir obj > fi > 14a19 > cvs diff: Diffing bin cvs diff: Diffing bin/finger cvs diff: Diffing bin/finger.working cvs diff: Diffing book cvs diff: Diffing book/chapter7_example1 cvs diff: Diffing config Index: config/configure RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/config/configure,v retrieving revision 1.36 diff -r1.36 configure 887,889c887,891 < i386-*-netbsd0.9*) < name=i386-netbsd-0.9 < sysincludes=netbsd-0.9 --- > i386-*-netbsd1.0A*) > name=i386-netbsd-1.0 > sysincludes=netbsd-1.0 > syscall=i386-netbsd-1.0a > makefile_frag=netbsd-1.0a.mk 896a899,902 > i386-*-netbsd0.9*) > name=i386-netbsd-0.9 > sysincludes=netbsd-0.9 > ;; 2157c2163 < ../machdep/engine-$name.c ../machdep/syscall-$name.S" --- > ../machdep/engine-$name.c ../machdep/syscall-$syscall.S" cvs diff: Diffing datalib cvs diff: Diffing dce_compat cvs diff: Diffing doc cvs diff: Diffing gen Index: gen/isatty.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/gen/isatty.c,v retrieving revision 1.5 diff -r1.5 isatty.c 36c36 < static char *rcsid = "$Id: isatty.c,v 1.5 95/06/14 07:09:35 proven Exp $"; --- > static char *rcsid = "$Id: isatty.c,v 1.5 1995/06/14 07:09:35 proven Exp $"; 59a60 > /* fd is the real fd to pass to the kernel */ 67,76c68 < int real_fd; < < if (fd < 0 || fd >= dtablesize || < fd_table[fd]->fd.i == NOTOK || < fd_table[fd]->type == FD_NT || < fd_table[fd]->type == FD_NIU) < real_fd = fd; < else < real_fd = fd_table[fd]->fd.i; < return (machdep_sys_ioctl(real_fd, --- > return (machdep_sys_ioctl(fd, 90c82 < ret = isatty_basic(fd); --- > ret = isatty_basic(fd_table[fd]->fd.i); Index: gen/popen.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/gen/popen.c,v retrieving revision 1.52 diff -r1.52 popen.c 23c23 < return NULL; --- > return NULL; 27c27 < return NULL; --- > return NULL; 34,45c34,47 < new_size = getdtablesize(); < new_pids = malloc(new_size * sizeof(pid_t)); < if (new_pids == NULL) { < close(parent_fd); < close(child_fd); < return NULL; < } < while (pids_size < new_size) < new_pids[pids_size++] = -1; < if (pids) < free(pids); < pids = new_pids; --- > new_size = parent_fd + 1; > if ((new_pids = malloc(new_size * sizeof(pid_t))) == NULL) { > pthread_mutex_unlock(&pids_lock); > close(parent_fd); > close(child_fd); > return NULL; > } > if (pids) { > memcpy(new_pids, pids, pids_size * sizeof(pid_t)); > free(pids); > } > while (pids_size < new_size) > new_pids[pids_size++] = -1; > pids = new_pids; 50,56c52,68 < pid = fork(); < if (pid < 0) { < /* Failed to fork. */ < close(parent_fd); < close(child_fd); < return NULL; < } --- > switch (pid = fork()) { > case -1: /* Failed to fork. */ > close(parent_fd); > close(child_fd); > return NULL; > break; > case 0: /* Child */ > /* > * Set the child fd to stdout or stdin as appropriate, > * and close the parent fd. > */ > child_target = (*mode == 'r') ? STDOUT_FILENO : STDIN_FILENO; > if (child_fd != child_target) { > dup2(child_fd, child_target); > close(child_fd); > } > close(parent_fd); 58,66c70,74 < if (pid == 0) { < /* Child. Set the child fd to stdout or stdin as appropriate, < * and close the parent fd. */ < child_target = (*mode == 'r') ? STDOUT_FILENO : STDIN_FILENO; < if (child_fd != child_target) { < dup2(child_fd, (*mode == 'r') ? 1 : 0); < close(child_fd); < } < close(parent_fd); --- > /* Close all parent fds from previous popens(). */ > for (i = 0; i < pids_top; i++) { > if (pids[i] != -1) > close(i); > } 68,71c76,79 < /* Close all parent fds from previous popens(). */ < for (i = 0; i < pids_top; i++) { < if (pids[i] != -1) < close(i); --- > execl("/bin/sh", "sh", "-c", cmd, NULL); > exit(1); > default: > break; 74,76d81 < execl("/bin/sh", "sh", "-c", cmd, NULL); < } < 81c86 < pids_top = parent_fd + 1; --- > pids_top = parent_fd + 1; 92,93d96 < int fd; < int pstat; 94a98 > int fd, pstat; 96,97d99 < /* Make sure this is a popened file. */ < pthread_mutex_lock(&pids_lock); 99,109d100 < if (pids_top <= fd || pids[fd] == -1) < return -1; < pid = pids[fd]; < pthread_mutex_unlock(&pids_lock); < < /* Wait for the subprocess to quit. */ < do { < result = waitpid(pid, &pstat, 0); < } while (result == -1 && errno == EINTR); < < /* Remove the pid entry from the table. */ 110a102,106 > /* Make sure this is a popened file. */ > if ((pids_top <= fd) || ((pid = pids[fd]) == -1)) { > pthread_mutex_unlock(&pids_lock); > return -1; > } 113c109 < pids_top--; --- > pids_top--; 116,117d111 < /* Close the file. (This releases fd, which could allow a popen(), so < * do it last.) */ 120c114,115 < return (result == -1) ? -1 : pstat; --- > /* Wait for the subprocess to quit. */ > return (((result = waitpid(pid, &pstat, 0)) == -1) ? -1 : pstat); cvs diff: Diffing include cvs diff: Diffing include/arpa cvs diff: Diffing include/pthread Index: include/pthread/cond.h RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/include/pthread/cond.h,v retrieving revision 1.52 diff -r1.52 cond.h 32c32 < * $Id: cond.h,v 1.52 95/06/14 07:20:45 proven Exp $ --- > * $Id: cond.h,v 1.52 1995/06/14 07:20:45 proven Exp $ 45c45 < enum pthread_cond_type { --- > enum pthread_condtype { 47a48 > COND_TYPE_COUNTING_FAST, /* Used with MUTEX_TYPE_COUNTING_FAST */ 49c50 < COND_TYPE_DEBUG, /* Debug conds will have lots of options */ --- > COND_TYPE_DEBUG, /* Debug conds will have lots of options */ 52a54,57 > #define PTHREAD_CONDTYPE_FAST 1 > #define PTHREAD_CONDTYPE_DEBUG 4 > #define PTHREAD_CONDTYPE_RECURSIVE 2 > 54c59 < enum pthread_cond_type c_type; --- > enum pthread_condtype c_type; 61,62c66,67 < typedef struct pthread_cond_attr { < enum pthread_cond_type c_type; --- > typedef struct pthread_condattr { > enum pthread_condtype c_type; Index: include/pthread/mutex.h RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/include/pthread/mutex.h,v retrieving revision 1.53 diff -r1.53 mutex.h 32c32 < * $Id: mutex.h,v 1.53 94/11/08 15:37:48 proven Exp $ --- > * $Id: mutex.h,v 1.53 1994/11/08 15:37:48 proven Exp $ 70c70 < typedef struct pthread_mutex_attr { --- > typedef struct pthread_mutexattr { cvs diff: Diffing lib cvs diff: Diffing lib/libc cvs diff: Diffing lib/libc/net cvs diff: Diffing lib/libc/stdio cvs diff: Diffing lib/libc/stdlib cvs diff: Diffing machdep cvs diff: cannot find syscall-i386-netbsd-1.0.S cvs diff: cannot find syscall-template-i386-netbsd1.0.S cvs diff: Diffing machdep/alpha-osf1 cvs diff: Diffing machdep/bsdi-1.1 cvs diff: Diffing machdep/freebsd-1.1 cvs diff: Diffing machdep/freebsd-2.0 cvs diff: Diffing machdep/hpux-9.03 cvs diff: Diffing machdep/linux-1.0 cvs diff: Diffing machdep/netbsd-0.9 cvs diff: Diffing machdep/netbsd-1.0 cvs diff: Diffing machdep/sunos-4.1.3 cvs diff: Diffing machdep/sunos-5.3 cvs diff: Diffing machdep/ultrix-4.2 cvs diff: Diffing net cvs diff: Diffing pthreads Index: pthreads/GNUmakefile.inc RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/GNUmakefile.inc,v retrieving revision 1.9 diff -r1.9 GNUmakefile.inc 11c11 < dump_state.c pthread_kill.c stat.c $(SRCS) --- > dump_state.c pthread_kill.c stat.c condattr.c $(SRCS) Index: pthreads/Makefile.inc RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/Makefile.inc,v retrieving revision 1.64 diff -r1.64 Makefile.inc 10,11c10,11 < pthread_init.c init.cc sig.c info.c mutexattr.c wrapper.c dump_state.c \ < pthread_kill.c --- > pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \ > dump_state.c pthread_kill.c condattr.c Index: pthreads/cond.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/cond.c,v retrieving revision 1.65 diff -r1.65 cond.c 39c39 < static const char rcsid[] = "$Id: cond.c,v 1.65 95/06/14 07:28:28 proven Exp $"; --- > static const char rcsid[] = "$Id: cond.c,v 1.65 1995/06/14 07:28:28 proven Exp $"; 78c78 < enum pthread_cond_type type; --- > enum pthread_condtype type; 91a92 > case COND_TYPE_COUNTING_FAST: 133a135 > case COND_TYPE_COUNTING_FAST: 194a197,213 > case COND_TYPE_COUNTING_FAST: > { > int count = mutex->m_data.m_count; > > pthread_queue_enq(&cond->c_queue, pthread_run); > pthread_mutex_unlock(mutex); > mutex->m_data.m_count = 1; > > SET_PF_WAIT_EVENT(pthread_run); > /* Reschedule will unlock pthread_run */ > pthread_resched_resume(PS_COND_WAIT); > CLEAR_PF_DONE_EVENT(pthread_run); > rval = pthread_mutex_lock(mutex); > mutex->m_data.m_count = count; > return(rval); > break; > } 253a273,302 > case COND_TYPE_COUNTING_FAST: > { > int count = mutex->m_data.m_count; > > /* Set pthread wakeup time*/ > pthread_run->wakeup_time.ts_sec = abstime->ts_sec; > pthread_run->wakeup_time.ts_nsec = abstime->ts_nsec; > > /* Install us on the sleep queue */ > sleep_schedule (¤t_time, &(pthread_run->wakeup_time)); > > pthread_queue_enq(&cond->c_queue, pthread_run); > SET_PF_WAIT_EVENT(pthread_run); > pthread_mutex_unlock(mutex); > > /* Reschedule will unlock pthread_run */ > pthread_resched_resume(PS_COND_WAIT); > > /* Remove ourselves from sleep queue. If we fail then we timedout */ > if (sleep_cancel(pthread_run) == NOTOK) { > SET_ERRNO(ETIMEDOUT); > rval = ETIMEDOUT; > } > > CLEAR_PF_DONE_EVENT(pthread_run); > pthread_mutex_lock(mutex); > mutex->m_data.m_count = count; > return(rval); > break; > } Index: pthreads/sig.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/sig.c,v retrieving revision 1.62 diff -r1.62 sig.c 39c39 < static const char rcsid[] = "$Id: sig.c,v 1.62 95/04/02 10:45:02 gsstark Exp $"; --- > static const char rcsid[] = "$Id: sig.c,v 1.62 1995/04/02 10:45:02 gsstark Exp $"; 123a124 > sigset_t mask, omask; 138a140,142 > sigemptyset(&mask); > sigaddset(&mask, i); > machdep_sys_sigprocmask(SIG_UNBLOCK, &mask, &omask); cvs diff: Diffing scripts cvs diff: Diffing stdio Index: stdio/fclose.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdio/fclose.c,v retrieving revision 1.52 diff -r1.52 fclose.c 40c40 < static char *rcsid = "$Id: fclose.c,v 1.52 95/04/18 02:39:47 proven Exp $"; --- > static char *rcsid = "$Id: fclose.c,v 1.52 1995/04/18 02:39:47 proven Exp $"; 58,59d57 < if (__sclose(fp) < 0) < r = EOF; 66c64,66 < /* funlockfile(fp); */ --- > if (__sclose(fp) < 0) > r = EOF; > /* funlockfile(fp); Don't unlock. The close() already has. */ Index: stdio/fwalk.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdio/fwalk.c,v retrieving revision 1.51 diff -r1.51 fwalk.c 40c40 < static char *rcsid = "$Id: fwalk.c,v 1.51 94/09/04 02:57:49 proven Exp $"; --- > static char *rcsid = "$Id: fwalk.c,v 1.51 1994/09/04 02:57:49 proven Exp $"; 95c95 < if (!saven) { /* No, save first fp we can't flush */ --- > if (!saven) { /* No, save first fp we can't flush */ 115,118c115 < while (ftrylockfile(fp)) { /* Can we flush it */ < pthread_yield(); < continue; < } --- > flockfile(fp); Index: stdio/refill.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdio/refill.c,v retrieving revision 1.55 diff -r1.55 refill.c 40c40 < static char *rcsid = "$Id: refill.c,v 1.55 95/03/10 04:07:45 snl Exp $"; --- > static char *rcsid = "$Id: refill.c,v 1.55 1995/03/10 04:07:45 snl Exp $"; 96,102c96,98 < if (ftrylockfile(fp)) { /* Can we flush it */ < pthread_yield(); < continue; < } else { < (void) __sflush(fp); < funlockfile(fp); < } --- > ftrylockfile(fp); > (void) __sflush(fp); > funlockfile(fp); cvs diff: Diffing stdlib Index: stdlib/strtod.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdlib/strtod.c,v retrieving revision 1.50 diff -r1.50 strtod.c 3c3 < static char *rcsid = "$Id: strtod.c,v 1.50 94/08/08 03:49:06 proven Exp $"; --- > static char *rcsid = "$Id: strtod.c,v 1.50 1994/08/08 03:49:06 proven Exp $"; Index: stdlib/strtol.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdlib/strtol.c,v retrieving revision 1.1 diff -r1.1 strtol.c 36c36 < static char *rcsid = "$Id: strtol.c,v 1.1 94/09/08 02:55:02 proven Exp $"; --- > static char *rcsid = "$Id: strtol.c,v 1.1 1994/09/08 02:55:02 proven Exp $"; Index: stdlib/strtoul.c RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/stdlib/strtoul.c,v retrieving revision 1.1 diff -r1.1 strtoul.c 36c36 < static char *rcsid = "$Id: strtoul.c,v 1.1 94/09/08 02:55:05 proven Exp $"; --- > static char *rcsid = "$Id: strtoul.c,v 1.1 1994/09/08 02:55:05 proven Exp $"; cvs diff: Diffing syslog cvs diff: Diffing tests