diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-09 00:31:24 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-10 02:43:01 +0200 |
commit | f8e6af9f326c5c0c37f2daf351fe3a34a65db7c6 (patch) | |
tree | eff81eb593d696bf98dbb9976a78eff3c3f56257 /pflocal | |
parent | ce0ae22d02f286c5a0ef61b5dd8e6ee9b56620d7 (diff) | |
download | hurd-f8e6af9f326c5c0c37f2daf351fe3a34a65db7c6.tar.gz hurd-f8e6af9f326c5c0c37f2daf351fe3a34a65db7c6.tar.bz2 hurd-f8e6af9f326c5c0c37f2daf351fe3a34a65db7c6.zip |
pflocal: Port to x86_64
Message-Id: <20230508213136.608575-30-bugaevc@gmail.com>
Diffstat (limited to 'pflocal')
-rw-r--r-- | pflocal/io.c | 12 | ||||
-rw-r--r-- | pflocal/pf.c | 6 | ||||
-rw-r--r-- | pflocal/socket.c | 21 |
3 files changed, 27 insertions, 12 deletions
diff --git a/pflocal/io.c b/pflocal/io.c index 06749756..f621bbb3 100644 --- a/pflocal/io.c +++ b/pflocal/io.c @@ -48,6 +48,7 @@ S_io_read (struct sock_user *user, { error_t err; struct pipe *pipe; + size_t data_size = *data_len; if (!user) return EOPNOTSUPP; @@ -63,8 +64,9 @@ S_io_read (struct sock_user *user, { err = pipe_read (pipe, user->sock->flags & PFLOCAL_SOCK_NONBLOCK, NULL, - data, data_len, amount); + data, &data_size, amount); pipe_release_reader (pipe); + *data_len = data_size; } return err; @@ -434,8 +436,8 @@ S_io_reauthenticate (struct sock_user *user, mach_port_t rendezvous) uid_t *uids = uids_buf, *aux_uids = aux_uids_buf; gid_t gids_buf[NIDS], aux_gids_buf[NIDS]; gid_t *gids = gids_buf, *aux_gids = aux_gids_buf; - size_t num_uids = NIDS, num_aux_uids = NIDS; - size_t num_gids = NIDS, num_aux_gids = NIDS; + mach_msg_type_number_t num_uids = NIDS, num_aux_uids = NIDS; + mach_msg_type_number_t num_gids = NIDS, num_aux_gids = NIDS; if (!user) return EOPNOTSUPP; @@ -479,8 +481,8 @@ error_t S_io_restrict_auth (struct sock_user *user, mach_port_t *new_port, mach_msg_type_name_t *new_port_type, - const uid_t *uids, size_t num_uids, - const uid_t *gids, size_t num_gids) + const uid_t *uids, mach_msg_type_number_t num_uids, + const uid_t *gids, mach_msg_type_number_t num_gids) { if (!user) return EOPNOTSUPP; diff --git a/pflocal/pf.c b/pflocal/pf.c index 290c0b3f..45b132eb 100644 --- a/pflocal/pf.c +++ b/pflocal/pf.c @@ -92,7 +92,8 @@ S_socket_create (trivfs_protid_t pf, error_t S_socket_create_address (mach_port_t pf, int sockaddr_type, - const_data_t data, size_t data_len, + const_data_t data, + mach_msg_type_number_t data_len, mach_port_t *addr_port, mach_msg_type_name_t *addr_port_type) { @@ -130,7 +131,8 @@ S_socket_fabricate_address (mach_port_t pf, error_t S_socket_whatis_address (struct addr *addr, int *sockaddr_type, - data_t *sockaddr, size_t *sockaddr_len) + data_t *sockaddr, + mach_msg_type_number_t *sockaddr_len) { socklen_t addr_len = (offsetof (struct sockaddr, sa_data) + 1); diff --git a/pflocal/socket.c b/pflocal/socket.c index 8c240e09..625980b9 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -380,7 +380,7 @@ S_socket_recv (struct sock_user *user, int in_flags, data_t *data, mach_msg_type_name_t *data_len, mach_port_t **ports, mach_msg_type_name_t *ports_type, - size_t *num_ports, + mach_msg_type_name_t *num_ports, data_t *control, mach_msg_type_name_t *control_len, int *out_flags, vm_size_t amount) { @@ -412,12 +412,21 @@ S_socket_recv (struct sock_user *user, } else if (!err) { + size_t data_size = *data_len; + size_t control_size = *control_len; + size_t ports_size = *num_ports; noblock = (user->sock->flags & PFLOCAL_SOCK_NONBLOCK) || (in_flags & MSG_DONTWAIT); err = - pipe_recv (pipe, noblock, &flags, &source_addr, data, data_len, - amount, control, control_len, ports, num_ports); + pipe_recv (pipe, noblock, &flags, &source_addr, data, &data_size, + amount, control, &control_size, ports, &ports_size); pipe_release_reader (pipe); + if (!err) + { + *data_len = data_size; + *control_len = control_size; + *num_ports = ports_size; + } } if (!err) @@ -442,7 +451,8 @@ S_socket_recv (struct sock_user *user, error_t S_socket_getopt (struct sock_user *user, int level, int opt, - data_t *value, size_t *value_len) + data_t *value, + mach_msg_type_name_t *value_len) { int ret = 0; struct pipe *pipe; @@ -531,7 +541,8 @@ S_socket_getopt (struct sock_user *user, error_t S_socket_setopt (struct sock_user *user, - int level, int opt, const_data_t value, size_t value_len) + int level, int opt, const_data_t value, + mach_msg_type_name_t value_len) { int ret = 0; struct pipe *pipe; |