From 92e61d6a978299bbca165acac07e24739d5f12ca Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Sat, 1 Jun 2024 23:16:35 +0200 Subject: [PATCH] local-exec_filename Keep compatibility with experimental implementation Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name local-exec_filename.diff --- hurd/Makefile | 4 ++-- hurd/Versions | 4 ++++ hurd/hurdexec.c | 28 +++++++++++++++++++++++++++ sysdeps/mach/hurd/i386/libc.abilist | 1 + sysdeps/mach/hurd/spawni.c | 13 +++++++++++++ sysdeps/mach/hurd/x86_64/libc.abilist | 1 + 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/hurd/Makefile b/hurd/Makefile index 991b2ca15..58962dfa3 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -32,8 +32,8 @@ user-interfaces := $(addprefix hurd/,\ auth auth_request auth_reply startup \ process process_request \ msg msg_reply msg_request \ - exec exec_startup crash interrupt \ - fs fsys io io_reply io_request \ + exec exec_experimental exec_startup crash interrupt \ + fs fs_experimental fsys io io_reply io_request \ term tioctl socket ifsock \ login password pfinet pci \ ) diff --git a/hurd/Versions b/hurd/Versions index 439e8abf3..d3410232e 100644 --- a/hurd/Versions +++ b/hurd/Versions @@ -117,6 +117,10 @@ libc { # functions used in macros & inline functions __errno_location; } + GLIBC_2.21 { + # "quasi-internal" functions + _hurd_exec_file_name; + } GLIBC_2.26 { # "quasi-internal" functions _hurd_exec_paths; diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c index 3d75d1a1f..ebd9884a9 100644 --- a/hurd/hurdexec.c +++ b/hurd/hurdexec.c @@ -25,9 +25,12 @@ #include #include #include +#include #include #include +#include + /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP. If TASK == mach_task_self (), some ports are dealloc'd by the exec server. ARGV and ENVP are terminated by NULL pointers. @@ -39,6 +42,13 @@ _hurd_exec (task_t task, file_t file, return _hurd_exec_paths (task, file, NULL, NULL, argv, envp); } +error_t +__hurd_exec_file_name (task_t task, file_t file, const char *filename, + char *const argv[], char *const envp[]) +{ + return _hurd_exec_paths (task, file, filename, filename, argv, envp); +} + link_warning (_hurd_exec, "_hurd_exec is deprecated, use _hurd_exec_paths instead"); @@ -441,6 +451,18 @@ retry: portnames, nportnames); /* Fall back for backwards compatibility. This can just be removed when __file_exec goes away. */ + if (err == MIG_BAD_ID) + err = __file_exec_file_name (file, task, flags, + path ? path : "", + args, argslen, env, envlen, + dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize, + ports, MACH_MSG_TYPE_COPY_SEND, + _hurd_nports, + ints, INIT_INT_MAX, + please_dealloc, pdp - please_dealloc, + portnames, nportnames); + /* Fall back for backwards compatibility. This can just be removed + when __file_exec goes away. */ if (err == MIG_BAD_ID) err = __file_exec (file, task, flags, args, argslen, env, envlen, @@ -489,3 +511,9 @@ retry: return err; } libc_hidden_def (_hurd_exec_paths) +extern error_t _hurd_exec_file_name (task_t task, + file_t file, + const char *filename, + char *const argv[], + char *const envp[]); +versioned_symbol (libc, __hurd_exec_file_name, _hurd_exec_file_name, GLIBC_2_21); diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index a03fcc5b8..a90ba8ce8 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -1975,6 +1975,7 @@ GLIBC_2.2.6 xprt_register F GLIBC_2.2.6 xprt_unregister F GLIBC_2.21 __mach_host_self_ D 0x4 GLIBC_2.21 __pthread_get_cleanup_stack F +GLIBC_2.21 _hurd_exec_file_name F GLIBC_2.21 pthread_attr_destroy F GLIBC_2.21 pthread_attr_getdetachstate F GLIBC_2.21 pthread_attr_getinheritsched F diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c index 63afe4a0c..e3ea31ad9 100644 --- a/sysdeps/mach/hurd/spawni.c +++ b/sysdeps/mach/hurd/spawni.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "spawn_int.h" @@ -826,6 +827,18 @@ retry: ints, INIT_INT_MAX, NULL, 0, NULL, 0); + /* Fallback for backwards compatibility. This can just be removed + when __file_exec goes away. */ + if (err == MIG_BAD_ID) + err = __file_exec_file_name + (file, task, + __sigismember (&_hurdsig_traced, SIGKILL) ? EXEC_SIGTRAP : 0, + relpath, args, argslen, env, envlen, + dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize, + ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports, + ints, INIT_INT_MAX, + NULL, 0, NULL, 0); + /* Fallback for backwards compatibility. This can just be removed when __file_exec goes away. */ if (err == MIG_BAD_ID) diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index d01adceb2..d4fc6dc9f 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -572,6 +572,7 @@ GLIBC_2.38 _hurd_dtable_lock D 0x28 GLIBC_2.38 _hurd_dtablesize D 0x4 GLIBC_2.38 _hurd_exception2signal F GLIBC_2.38 _hurd_exec F +GLIBC_2.38 _hurd_exec_file_name F GLIBC_2.38 _hurd_exec_paths F GLIBC_2.38 _hurd_fd_error F GLIBC_2.38 _hurd_fd_error_signal F -- 2.30.2