aboutsummaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-05-09 00:31:02 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-10 02:14:15 +0200
commitedc6fe07c5a7f9ade000b3bfc17c030fe2086e21 (patch)
treeb1d82a445b67a5bbe06635cbe3e648953c9199de /libnetfs
parent955c2e609c71575ab9e66cd0f451a0f18a1329ee (diff)
downloadhurd-edc6fe07c5a7f9ade000b3bfc17c030fe2086e21.tar.gz
hurd-edc6fe07c5a7f9ade000b3bfc17c030fe2086e21.tar.bz2
hurd-edc6fe07c5a7f9ade000b3bfc17c030fe2086e21.zip
libnetfs: Port to x86_64
Message-Id: <20230508213136.608575-8-bugaevc@gmail.com>
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/file-exec.c33
-rw-r--r--libnetfs/io-read.c22
2 files changed, 29 insertions, 26 deletions
diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index da49ac36..b5293afc 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -36,19 +36,19 @@ netfs_S_file_exec (struct protid *cred,
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 (cred,
task,
@@ -71,19 +71,19 @@ netfs_S_file_exec_paths (struct protid *cred,
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)
{
struct node *np;
error_t err;
@@ -141,7 +141,8 @@ netfs_S_file_exec_paths (struct protid *cred,
err =
fshelp_exec_reauth (suid, uid, sgid, gid,
netfs_auth_server_port, get_file_ids,
- portarray, portarraylen, fds, fdslen, &secure);
+ (mach_port_t *) portarray, portarraylen,
+ (mach_port_t *) fds, fdslen, &secure);
if (secure)
flags |= EXEC_SECURE | EXEC_NEWTASK;
}
@@ -213,7 +214,7 @@ netfs_S_file_exec_paths (struct protid *cred,
if (! err)
{
- unsigned int i;
+ mach_msg_type_number_t i;
mach_port_deallocate (mach_task_self (), task);
for (i = 0; i < fdslen; i++)
diff --git a/libnetfs/io-read.c b/libnetfs/io-read.c
index 688da1f6..2ee49c5d 100644
--- a/libnetfs/io-read.c
+++ b/libnetfs/io-read.c
@@ -34,6 +34,7 @@ netfs_S_io_read (struct protid *user,
off_t start;
struct node *node;
int alloced = 0;
+ size_t data_size = *datalen;
if (!user)
return EOPNOTSUPP;
@@ -47,12 +48,12 @@ netfs_S_io_read (struct protid *user,
return EBADF;
}
- if (amount > *datalen)
+ if (amount > data_size)
{
alloced = 1;
*data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
}
- *datalen = amount;
+ data_size = amount;
start = (offset == -1 ? user->po->filepointer : offset);
@@ -70,7 +71,7 @@ netfs_S_io_read (struct protid *user,
if (start >= size)
{
- *datalen = 0;
+ data_size = 0;
err = 0;
}
else if (amount < size || start > 0)
@@ -80,30 +81,31 @@ netfs_S_io_read (struct protid *user,
if (! err)
{
memcpy (*data, whole_link + start, amount);
- *datalen = amount;
+ data_size = amount;
}
}
else
{
err = netfs_attempt_readlink (user->user, node, *data);
- *datalen = amount;
+ data_size = amount;
}
}
else
/* Read from a normal file. */
- err = netfs_attempt_read (user->user, node, start, datalen, *data);
+ err = netfs_attempt_read (user->user, node, start, &data_size, *data);
if (offset == -1 && !err)
- user->po->filepointer += *datalen;
+ user->po->filepointer += data_size;
pthread_mutex_unlock (&node->lock);
if (err && alloced)
munmap (*data, amount);
- if (!err && alloced && (round_page (*datalen) < round_page (amount)))
- munmap (*data + round_page (*datalen),
- round_page (amount) - round_page (*datalen));
+ if (!err && alloced && (round_page (data_size) < round_page (amount)))
+ munmap (*data + round_page (data_size),
+ round_page (amount) - round_page (data_size));
+ *datalen = data_size;
return err;
}