[PATCH hurd] Use c_string for default_pager_filename_t to define a new default_pager_paging_storage RPC.

2023-04-23 Thread Flavio Cruz
This brings us a bit closer to having all types' msgt_size representable with a single byte. We will be able to avoid mach_msg_type_long_t entirely for x86_64 since mach_msg_type_t can represent long types using a separate field. --- hurd/default_pager.defs | 15 ++- mach-defpager/setu

[PATCH hurd] Improve portability for rpctrace on x86_64

2023-04-23 Thread Flavio Cruz
Defined alignment as __alignof__(uintptr_t) to match MiG. Also used char* instead of void* during the message iteration since it's more portable as pointer arithmetic on void* is a GNU extension. --- utils/rpctrace.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/util

[PATCH 3/4] hurd: Microoptimize mmap ()

2023-04-23 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/mmap.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c index 790eb238..d570be24 100644 --- a/sysdeps/mach/hurd/mmap.c +++ b/sysdeps/mach/hurd/mmap.c @@ -42,7 +42,8 @@

[PATCH 1/4] hurd: Implement MAP_32BIT

2023-04-23 Thread Sergey Bugaev
This is a flag that can be passed to mmap () to request that the mapping being established should be located in the lower 2 GB area of the address space, so only the lower 31 (not 32) bits can be set in its address, and the address can be represented as a 32-bit integer without truncating it. This

[PATCH 2/4] hurd: Don't attempt to deallocate MACH_PORT_DEAD

2023-04-23 Thread Sergey Bugaev
...in some more places. Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/dl-sysdep.c | 2 +- sysdeps/mach/hurd/mmap.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index d7b309e0..25a12774 100644 --

[RFC PATCH 4/4] hurd: Implement prefer_map_32bit_exec tunable

2023-04-23 Thread Sergey Bugaev
This makes the prefer_map_32bit_exec tunable no longer Linux-specific. Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/dl-sysdep.c | 5 sysdeps/mach/hurd/mmap.c | 6 + sysdeps/unix/sysv/linux/x86_64/64/Makefile| 23 --- sysde

[PATCH v2 2/4] hurd: Implement MSG_CMSG_CLOEXEC

2023-04-23 Thread Sergey Bugaev
This is a new flag that can be passed to recvmsg () to make it atomically set the CLOEXEC flag on all the file descriptors received using the SCM_RIGHTS mechanism. This is useful for all the same reasons that the other XXX_CLOEXEC flags are useful: namely, it provides atomicity with respect to anot

[PATCH v2 4/4] socket: Add a test for MSG_CMSG_CLOEXEC

2023-04-23 Thread Sergey Bugaev
This checks that: * We can send and receive fds over Unix domain sockets using SCM_RIGHTS; * msg_controllen, cmsg_level, cmsg_type, cmsg_len are all filled in correctly on receive; * Most importantly, the received fd has or has not the close-on-exec flag set depending on whether we pass MSG_CMS

[PATCH v2 3/4] hurd: Only deallocate addrport when it's valid

2023-04-23 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/recv.c | 3 ++- sysdeps/mach/hurd/recvfrom.c | 3 ++- sysdeps/mach/hurd/recvmsg.c | 3 ++- sysdeps/mach/hurd/sendmsg.c | 5 +++-- sysdeps/mach/hurd/sendto.c | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sysdeps/m

[PATCH v2 1/4] hurd: Don't pass FD_CLOEXEC in CMSG_DATA

2023-04-23 Thread Sergey Bugaev
It is of no concern to the receiving process whether or not the sender process wants to close its copy of sent file descriptor upon exec, and it should not influence whether or not the received file descriptor gets the FD_CLOEXEC flag set in the receiving process. The latter should in fact be depe