Make these functions cancellation points like they should be:

poll(2), readv(2), select(2), wait4(2), writev(2).

PR:		bin/37658
Reviewed by:	deischen
MFC after:	1 week
This commit is contained in:
Archie Cobbs 2002-05-02 19:58:43 +00:00
parent ca0989d865
commit 663fc9cc7c
15 changed files with 198 additions and 15 deletions

View File

@ -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)
@ -97,3 +97,15 @@ _poll(struct pollfd *fds, unsigned int nfds, int timeout)
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;
}

View File

@ -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)
@ -92,3 +92,15 @@ _readv(int fd, const struct iovec * iov, int iovcnt)
}
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;
}

View File

@ -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,
@ -214,3 +214,16 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
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;
}

View File

@ -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)
@ -68,3 +68,15 @@ _wait4(pid_t pid, int *istat, int options, struct rusage * rusage)
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;
}

View File

@ -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)
@ -202,3 +202,15 @@ _writev(int fd, const struct iovec * iov, int iovcnt)
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;
}

View File

@ -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)
@ -97,3 +97,15 @@ _poll(struct pollfd *fds, unsigned int nfds, int timeout)
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;
}

View File

@ -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)
@ -92,3 +92,15 @@ _readv(int fd, const struct iovec * iov, int iovcnt)
}
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;
}

View File

@ -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,
@ -214,3 +214,16 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
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;
}

View File

@ -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)
@ -68,3 +68,15 @@ _wait4(pid_t pid, int *istat, int options, struct rusage * rusage)
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;
}

View File

@ -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)
@ -202,3 +202,15 @@ _writev(int fd, const struct iovec * iov, int iovcnt)
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;
}

View File

@ -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)
@ -97,3 +97,15 @@ _poll(struct pollfd *fds, unsigned int nfds, int timeout)
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;
}

View File

@ -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)
@ -92,3 +92,15 @@ _readv(int fd, const struct iovec * iov, int iovcnt)
}
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;
}

View File

@ -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,
@ -214,3 +214,16 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
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;
}

View File

@ -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)
@ -68,3 +68,15 @@ _wait4(pid_t pid, int *istat, int options, struct rusage * rusage)
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;
}

View File

@ -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)
@ -202,3 +202,15 @@ _writev(int fd, const struct iovec * iov, int iovcnt)
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;
}