Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2002 12:10:03 -0700 (PDT)
From:      Archie Cobbs <archie@packetdesign.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/37658: libc_r: poll(2) does not wake up when thread canceled
Message-ID:  <200205021910.g42JA3d89718@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/37658; it has been noted by GNATS.

From: Archie Cobbs <archie@packetdesign.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/37658: libc_r: poll(2) does not wake up when thread canceled
Date: Thu, 2 May 2002 12:03:00 -0700 (PDT)

 Here is the corresponding patch for -current.
 
 -Archie
 
 __________________________________________________________________________
 Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
 
 Index: uthread_poll.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_poll.c,v
 retrieving revision 1.11
 diff -u -r1.11 uthread_poll.c
 --- uthread_poll.c	10 Apr 2001 04:19:20 -0000	1.11
 +++ uthread_poll.c	2 May 2002 18:58:14 -0000
 @@ -41,7 +41,7 @@
  #include <pthread.h>
  #include "pthread_private.h"
  
 -__weak_reference(_poll, poll);
 +__weak_reference(__poll, poll);
  
  int 
  _poll(struct pollfd *fds, unsigned int nfds, int timeout)
 @@ -96,4 +96,16 @@
  	}
  
  	return (ret);
 +}
 +
 +int
 +__poll(struct pollfd *fds, unsigned int nfds, int timeout)
 +{
 +	int ret;
 +
 +	_thread_enter_cancellation_point();
 +	ret = _poll(fds, nfds, timeout);
 +	_thread_leave_cancellation_point();
 +
 +	return ret;
  }
 Index: uthread_readv.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_readv.c,v
 retrieving revision 1.13
 diff -u -r1.13 uthread_readv.c
 --- uthread_readv.c	10 Apr 2001 04:19:20 -0000	1.13
 +++ uthread_readv.c	2 May 2002 18:58:14 -0000
 @@ -40,7 +40,7 @@
  #include <pthread.h>
  #include "pthread_private.h"
  
 -__weak_reference(_readv, readv);
 +__weak_reference(__readv, readv);
  
  ssize_t
  _readv(int fd, const struct iovec * iov, int iovcnt)
 @@ -91,4 +91,16 @@
  		_FD_UNLOCK(fd, FD_READ);
  	}
  	return (ret);
 +}
 +
 +ssize_t
 +__readv(int fd, const struct iovec *iov, int iovcnt)
 +{
 +	ssize_t ret;
 +
 +	_thread_enter_cancellation_point();
 +	ret = _readv(fd, iov, iovcnt);
 +	_thread_leave_cancellation_point();
 +
 +	return ret;
  }
 Index: uthread_select.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_select.c,v
 retrieving revision 1.19
 diff -u -r1.19 uthread_select.c
 --- uthread_select.c	9 Apr 2002 05:41:00 -0000	1.19
 +++ uthread_select.c	2 May 2002 18:58:14 -0000
 @@ -43,7 +43,7 @@
  #include <pthread.h>
  #include "pthread_private.h"
  
 -__weak_reference(_select, select);
 +__weak_reference(__select, select);
  
  int 
  _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
 @@ -213,4 +213,17 @@
  	}
  
  	return (ret);
 +}
 +
 +int 
 +__select(int numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
 +	struct timeval *timeout)
 +{
 +	int ret;
 +
 +	_thread_enter_cancellation_point();
 +	ret = _select(numfds, readfds, writefds, exceptfds, timeout);
 +	_thread_leave_cancellation_point();
 +
 +	return ret;
  }
 Index: uthread_wait4.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_wait4.c,v
 retrieving revision 1.13
 diff -u -r1.13 uthread_wait4.c
 --- uthread_wait4.c	10 Apr 2001 04:19:20 -0000	1.13
 +++ uthread_wait4.c	2 May 2002 18:58:14 -0000
 @@ -38,7 +38,7 @@
  #include <pthread.h>
  #include "pthread_private.h"
  
 -__weak_reference(_wait4, wait4);
 +__weak_reference(__wait4, wait4);
  
  pid_t
  _wait4(pid_t pid, int *istat, int options, struct rusage * rusage)
 @@ -67,4 +67,16 @@
  	_thread_kern_sig_undefer();
  
  	return (ret);
 +}
 +
 +pid_t
 +__wait4(pid_t pid, int *istat, int options, struct rusage *rusage)
 +{
 +	pid_t ret;
 +
 +	_thread_enter_cancellation_point();
 +	ret = _wait4(pid, istat, options, rusage);
 +	_thread_leave_cancellation_point();
 +
 +	return ret;
  }
 Index: uthread_writev.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_writev.c,v
 retrieving revision 1.18
 diff -u -r1.18 uthread_writev.c
 --- uthread_writev.c	10 Apr 2001 04:19:20 -0000	1.18
 +++ uthread_writev.c	2 May 2002 18:58:14 -0000
 @@ -42,7 +42,7 @@
  #include <pthread.h>
  #include "pthread_private.h"
  
 -__weak_reference(_writev, writev);
 +__weak_reference(__writev, writev);
  
  ssize_t
  _writev(int fd, const struct iovec * iov, int iovcnt)
 @@ -201,4 +201,16 @@
  		free(p_iov);
  
  	return (ret);
 +}
 +
 +ssize_t
 +__writev(int fd, const struct iovec *iov, int iovcnt)
 +{
 +	ssize_t ret;
 +
 +	_thread_enter_cancellation_point();
 +	ret = _writev(fd, iov, iovcnt);
 +	_thread_leave_cancellation_point();
 +
 +	return ret;
  }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205021910.g42JA3d89718>