diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-06-14 00:19:35 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-06-14 00:19:35 +0000 |
commit | 89edef7b390ab25fc0d41ef6fc618f5e22c7551b (patch) | |
tree | fd3e571f336520b5d83255489abde6400660986b /sysdeps/mach/hurd/recvfrom.c | |
parent | 146fea07640387c78e334933de24b6353e1f0eba (diff) | |
download | glibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.zip glibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.tar.gz glibc-89edef7b390ab25fc0d41ef6fc618f5e22c7551b.tar.bz2 |
hurd: Make recv* cancellation points
* sysdeps/mach/hurd/recv.c (__recv): Make the __socket_recv call
cancellable.
* sysdeps/mach/hurd/recvfrom.c (__recvfrom): Make the __socket_recv and
__socket_whatis_address calls cancellable.
* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Make the __socket_recv,
__socket_whatis_address, __io_reauthenticate, and __auth_user_authenticate calls
cancellable.
Diffstat (limited to 'sysdeps/mach/hurd/recvfrom.c')
-rw-r--r-- | sysdeps/mach/hurd/recvfrom.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c index 4479158..ed3d970 100644 --- a/sysdeps/mach/hurd/recvfrom.c +++ b/sysdeps/mach/hurd/recvfrom.c @@ -21,6 +21,7 @@ #include <hurd.h> #include <hurd/fd.h> #include <hurd/socket.h> +#include <sysdep-cancel.h> /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of @@ -39,13 +40,18 @@ __recvfrom (int fd, void *buf, size_t n, int flags, __SOCKADDR_ARG addrarg, char *cdata = NULL; mach_msg_type_number_t clen = 0; struct sockaddr *addr = addrarg.__sockaddr__; - - if (err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport, - flags, &bufp, &nread, - &ports, &nports, - &cdata, &clen, - &flags, - n))) + int cancel_oldtype; + + cancel_oldtype = LIBC_CANCEL_ASYNC(); + err = HURD_DPORT_USE (fd, __socket_recv (port, &addrport, + flags, &bufp, &nread, + &ports, &nports, + &cdata, &clen, + &flags, + n)); + LIBC_CANCEL_RESET (cancel_oldtype); + + if (err) return __hurd_sockfail (fd, flags, err); /* Get address data for the returned address port if requested. */ @@ -55,7 +61,9 @@ __recvfrom (int fd, void *buf, size_t n, int flags, __SOCKADDR_ARG addrarg, mach_msg_type_number_t buflen = *addr_len; int type; + cancel_oldtype = LIBC_CANCEL_ASYNC(); err = __socket_whatis_address (addrport, &type, &buf, &buflen); + LIBC_CANCEL_RESET (cancel_oldtype); if (err == EOPNOTSUPP) /* If the protocol server can't tell us the address, just return a zero-length one. */ |