diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-09 00:31:33 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-10 02:49:49 +0200 |
commit | 98a20b8ba468d47c098d067f089b27c5c89815d9 (patch) | |
tree | f136727e672c6186005835d944022166dcdfeb1c /trans | |
parent | e4b867954d2683bc93d25d6d781017c6e382d03e (diff) | |
download | hurd-98a20b8ba468d47c098d067f089b27c5c89815d9.tar.gz hurd-98a20b8ba468d47c098d067f089b27c5c89815d9.tar.bz2 hurd-98a20b8ba468d47c098d067f089b27c5c89815d9.zip |
trans: Port to x86_64
Message-Id: <20230508213136.608575-39-bugaevc@gmail.com>
Diffstat (limited to 'trans')
-rw-r--r-- | trans/crash.c | 2 | ||||
-rw-r--r-- | trans/fakeroot.c | 36 | ||||
-rw-r--r-- | trans/fifo.c | 4 | ||||
-rw-r--r-- | trans/magic.c | 8 | ||||
-rw-r--r-- | trans/mtab.c | 11 | ||||
-rw-r--r-- | trans/new-fifo.c | 7 | ||||
-rw-r--r-- | trans/streamio.c | 7 | ||||
-rw-r--r-- | trans/symlink.c | 6 |
8 files changed, 47 insertions, 34 deletions
diff --git a/trans/crash.c b/trans/crash.c index f4a21176..8b624f3a 100644 --- a/trans/crash.c +++ b/trans/crash.c @@ -213,7 +213,7 @@ stop_pgrp (process_t userproc, mach_port_t cttyid) pid_t pid, ppid, pgrp; int orphaned; error_t err; - size_t numpids = 20; + mach_msg_type_number_t numpids = 20; pid_t pids_[numpids], *pids = pids_; int i; diff --git a/trans/fakeroot.c b/trans/fakeroot.c index df8d27d5..5ae0c8b1 100644 --- a/trans/fakeroot.c +++ b/trans/fakeroot.c @@ -351,7 +351,7 @@ netfs_S_dir_lookup (struct protid *diruser, { char buf[1024]; /* XXX */ char *trans = buf; - size_t translen = sizeof buf; + mach_msg_type_number_t translen = sizeof buf; err = file_get_translator (file, &trans, &translen); if (!err @@ -824,7 +824,7 @@ netfs_attempt_readlink (struct iouser *user, struct node *np, char *buf) { char transbuf[sizeof _HURD_SYMLINK + np->nn_stat.st_size + 1]; char *trans = transbuf; - size_t translen = sizeof transbuf; + mach_msg_type_number_t translen = sizeof transbuf; error_t err = file_get_translator (netfs_node_netnode (np)->file, &trans, &translen); if (err == 0) @@ -849,8 +849,10 @@ netfs_attempt_read (struct iouser *cred, struct node *np, off_t offset, size_t *len, void *data) { char *buf = data; + mach_msg_type_number_t size = *len; error_t err = io_read (netfs_node_netnode (np)->file, - &buf, len, offset, *len); + &buf, &size, offset, size); + *len = size; if (err == 0 && buf != data) { memcpy (data, buf, *len); @@ -910,19 +912,19 @@ netfs_S_file_exec_paths (struct protid *user, const_string_t path, const_string_t abspath, const char *argv, - size_t argvlen, + mach_msg_type_number_t argvlen, const char *envp, - size_t envplen, + mach_msg_type_number_t envplen, const mach_port_t *fds, - size_t fdslen, + mach_msg_type_number_t fdslen, const mach_port_t *portarray, - size_t portarraylen, + mach_msg_type_number_t portarraylen, const int *intarray, - size_t intarraylen, + mach_msg_type_number_t intarraylen, const mach_port_t *deallocnames, - size_t deallocnameslen, + mach_msg_type_number_t deallocnameslen, const mach_port_t *destroynames, - size_t destroynameslen) + mach_msg_type_number_t destroynameslen) { error_t err; file_t file; @@ -992,19 +994,19 @@ netfs_S_file_exec (struct protid *user, task_t task, int flags, const_data_t argv, - size_t argvlen, + mach_msg_type_number_t argvlen, const_data_t envp, - size_t envplen, + mach_msg_type_number_t envplen, const mach_port_t *fds, - size_t fdslen, + mach_msg_type_number_t fdslen, const mach_port_t *portarray, - size_t portarraylen, + mach_msg_type_number_t portarraylen, const int *intarray, - size_t intarraylen, + mach_msg_type_number_t intarraylen, const mach_port_t *deallocnames, - size_t deallocnameslen, + mach_msg_type_number_t deallocnameslen, const mach_port_t *destroynames, - size_t destroynameslen) + mach_msg_type_number_t destroynameslen) { return netfs_S_file_exec_paths (user, task, diff --git a/trans/fifo.c b/trans/fifo.c index 894565f6..2f199112 100644 --- a/trans/fifo.c +++ b/trans/fifo.c @@ -343,6 +343,7 @@ trivfs_S_io_read (struct trivfs_protid *cred, off_t offs, vm_size_t amount) { error_t err; + size_t data_size = *data_len; if (!cred) err = EOPNOTSUPP; @@ -353,8 +354,9 @@ trivfs_S_io_read (struct trivfs_protid *cred, struct pipe *pipe = cred->po->hook; pthread_mutex_lock (&pipe->lock); err = pipe_read (pipe, cred->po->openmodes & O_NONBLOCK, NULL, - data, data_len, amount); + data, &data_size, amount); pthread_mutex_unlock (&pipe->lock); + *data_len = data_size; } return err; diff --git a/trans/magic.c b/trans/magic.c index 4e534e7a..93e69921 100644 --- a/trans/magic.c +++ b/trans/magic.c @@ -189,7 +189,7 @@ magic_open (struct trivfs_control *cntl, if (!err) { /* We consume the reference for DOTDOT. */ - (*cred)->po->hook = (void *) dotdot; + (*cred)->po->hook = (void *) (uintptr_t) dotdot; struct magic *const m = cntl->hook; m->nusers++; } @@ -199,7 +199,7 @@ magic_open (struct trivfs_control *cntl, static void magic_peropen_destroy (struct trivfs_peropen *po) { - mach_port_deallocate (mach_task_self (), (mach_port_t) po->hook); + mach_port_deallocate (mach_task_self (), (mach_port_t)(uintptr_t) po->hook); } @@ -261,7 +261,7 @@ trivfs_S_dir_lookup (struct trivfs_protid *cred, ++name; strcpy (retry_name, name); *retry_type = FS_RETRY_REAUTH; - *retrypt = (mach_port_t) cred->po->hook; + *retrypt = (mach_port_t)(uintptr_t) cred->po->hook; *retrypt_type = MACH_MSG_TYPE_COPY_SEND; return 0; } @@ -300,7 +300,7 @@ trivfs_S_dir_lookup (struct trivfs_protid *cred, /* Execute the open */ - dotdot = (mach_port_t) cred->po->hook; + dotdot = (mach_port_t)(uintptr_t) cred->po->hook; err = iohelp_dup_iouser (&user, cred->user); if (err) return err; diff --git a/trans/mtab.c b/trans/mtab.c index a2feee7d..e1d7d1c7 100644 --- a/trans/mtab.c +++ b/trans/mtab.c @@ -324,7 +324,8 @@ mtab_mark_as_seen (struct mtab *mtab, mach_port_t control) return TRUE; hurd_ihash_add (&mtab->ports_seen, - (hurd_ihash_key_t) control, (hurd_ihash_value_t) control); + (hurd_ihash_key_t) control, + (hurd_ihash_value_t)(uintptr_t) control); return FALSE; } @@ -341,7 +342,7 @@ mtab_populate (struct mtab *mtab, const char *path, mach_port_t control, /* These resources are freed in the epilogue. */ file_t node = MACH_PORT_NULL; char *argz = NULL; - size_t argz_len = 0; + mach_msg_type_number_t argz_len = 0; char **argv = NULL; char *type = NULL; char *options = NULL; @@ -350,9 +351,9 @@ mtab_populate (struct mtab *mtab, const char *path, mach_port_t control, char *entry = NULL; size_t entry_len = 0; char *children = NULL; - size_t children_len = 0; + mach_msg_type_number_t children_len = 0; mach_port_t *controls = NULL; - size_t controls_count = 0; + mach_msg_type_number_t controls_count = 0; size_t i; if (depth < 0) @@ -645,7 +646,7 @@ close_hook (struct trivfs_peropen *peropen) pthread_mutex_destroy (&op->lock); free (op->contents); HURD_IHASH_ITERATE (&op->ports_seen, p) - mach_port_deallocate (mach_task_self (), (mach_port_t) p); + mach_port_deallocate (mach_task_self (), (mach_port_t)(uintptr_t) p); hurd_ihash_destroy (&op->ports_seen); free (op); } diff --git a/trans/new-fifo.c b/trans/new-fifo.c index 3e9a886c..88059983 100644 --- a/trans/new-fifo.c +++ b/trans/new-fifo.c @@ -536,11 +536,13 @@ trivfs_S_io_read (struct trivfs_protid *cred, else { struct pipe *pipe = cred->po->hook; + size_t data_size = *data_len; assert_backtrace (pipe); pthread_mutex_lock (&pipe->lock); err = pipe_read (pipe, cred->po->openmodes & O_NONBLOCK, NULL, - data, data_len, amount); + data, &data_size, amount); pthread_mutex_unlock (&pipe->lock); + *data_len = data_size; } return err; @@ -821,7 +823,8 @@ trivfs_S_fsys_forward (mach_port_t server, mach_port_t reply, mach_msg_type_name_t replytype, mach_port_t requestor, - const_data_t argz, size_t argz_len) + const_data_t argz, + mach_msg_type_number_t argz_len) { error_t err; struct fifo_trans *server_trans, *trans; diff --git a/trans/streamio.c b/trans/streamio.c index acd5d674..2d40a5d3 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -485,6 +485,7 @@ trivfs_S_io_read (struct trivfs_protid *cred, off_t offs, vm_size_t amount) { error_t err; + size_t data_size = *data_len; if (!cred) return EOPNOTSUPP; @@ -493,8 +494,10 @@ trivfs_S_io_read (struct trivfs_protid *cred, return EBADF; pthread_mutex_lock (&global_lock); - err = dev_read (amount, (void **)data, data_len, cred->po->openmodes & O_NONBLOCK); + err = dev_read (amount, (void **)data, &data_size, + cred->po->openmodes & O_NONBLOCK); pthread_mutex_unlock (&global_lock); + *data_len = data_size; return err; } @@ -830,7 +833,7 @@ kern_return_t device_open_reply (mach_port_t reply, int returncode, mach_port_t device) { int sizes[DEV_GET_SIZE_COUNT]; - size_t sizes_len = DEV_GET_SIZE_COUNT; + mach_msg_type_number_t sizes_len = DEV_GET_SIZE_COUNT; int amount; if (reply != phys_reply) diff --git a/trans/symlink.c b/trans/symlink.c index 06e962cf..68f056c4 100644 --- a/trans/symlink.c +++ b/trans/symlink.c @@ -125,8 +125,10 @@ main (int argc, char **argv) error_t S_fsys_getroot (mach_port_t fsys_t, mach_port_t dotdotnode, - const id_t *uids, size_t nuids, - const id_t *gids, size_t ngids, + const id_t *uids, + mach_msg_type_number_t nuids, + const id_t *gids, + mach_msg_type_number_t ngids, int flags, retry_type *do_retry, string_t retry_name, |