Make accept(), connect(), recvfrom(), recvmsg(), sendmsg(),

and sendto() cancelation points, as required by POSIX.1-2001.

Reviewed by:	deischen
This commit is contained in:
Ruslan Ermilov 2002-12-19 11:39:20 +00:00
parent c0dd63a8a8
commit 8d436e783f
6 changed files with 80 additions and 6 deletions

View File

@ -39,7 +39,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_accept, accept);
__weak_reference(__accept, accept);
int
_accept(int fd, struct sockaddr * name, socklen_t *namelen)
@ -109,3 +109,15 @@ _accept(int fd, struct sockaddr * name, socklen_t *namelen)
/* Return the socket file descriptor or -1 on error: */
return (ret);
}
int
__accept(int fd, struct sockaddr * name, socklen_t *namelen)
{
int ret;
_thread_enter_cancellation_point();
ret = _accept(fd, name, namelen);
_thread_leave_cancellation_point();
return (ret);
}

View File

@ -38,7 +38,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_connect, connect);
__weak_reference(__connect, connect);
int
_connect(int fd, const struct sockaddr * name, socklen_t namelen)
@ -77,3 +77,15 @@ _connect(int fd, const struct sockaddr * name, socklen_t namelen)
}
return (ret);
}
int
__connect(int fd, const struct sockaddr * name, socklen_t namelen)
{
int ret;
_thread_enter_cancellation_point();
ret = _connect(fd, name, namelen);
_thread_leave_cancellation_point();
return (ret);
}

View File

@ -38,7 +38,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_recvfrom, recvfrom);
__weak_reference(__recvfrom, recvfrom);
ssize_t
_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from,
@ -74,3 +74,16 @@ _recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from,
}
return (ret);
}
ssize_t
__recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr * from,
socklen_t *from_len)
{
int ret;
_thread_enter_cancellation_point();
ret = _recvfrom(fd, buf, len, flags, from, from_len);
_thread_leave_cancellation_point();
return (ret);
}

View File

@ -38,7 +38,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_recvmsg, recvmsg);
__weak_reference(__recvmsg, recvmsg);
ssize_t
_recvmsg(int fd, struct msghdr *msg, int flags)
@ -73,3 +73,15 @@ _recvmsg(int fd, struct msghdr *msg, int flags)
}
return (ret);
}
ssize_t
__recvmsg(int fd, struct msghdr *msg, int flags)
{
int ret;
_thread_enter_cancellation_point();
ret = _recvmsg(fd, msg, flags);
_thread_leave_cancellation_point();
return (ret);
}

View File

@ -38,7 +38,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_sendmsg, sendmsg);
__weak_reference(__sendmsg, sendmsg);
ssize_t
_sendmsg(int fd, const struct msghdr *msg, int flags)
@ -72,3 +72,15 @@ _sendmsg(int fd, const struct msghdr *msg, int flags)
}
return (ret);
}
ssize_t
__sendmsg(int fd, const struct msghdr *msg, int flags)
{
int ret;
_thread_enter_cancellation_point();
ret = _sendmsg(fd, msg, flags);
_thread_leave_cancellation_point();
return (ret);
}

View File

@ -38,7 +38,7 @@
#include <pthread.h>
#include "pthread_private.h"
__weak_reference(_sendto, sendto);
__weak_reference(__sendto, sendto);
ssize_t
_sendto(int fd, const void *msg, size_t len, int flags, const struct
@ -73,3 +73,16 @@ _sendto(int fd, const void *msg, size_t len, int flags, const struct
}
return (ret);
}
ssize_t
__sendto(int fd, const void *msg, size_t len, int flags, const struct
sockaddr * to, socklen_t to_len)
{
int ret;
_thread_enter_cancellation_point();
ret = _sendto(fd, msg, len, flags, to, to_len);
_thread_leave_cancellation_point();
return (ret);
}