This is an automated email from the git hooks/post-receive script. sthibault pushed a commit to branch master in repository hurd.
commit 1c963dfcc63edc6335c38de80ae0ccf17cdb8cd0 Author: Samuel Thibault <[email protected]> Date: Mon Jan 2 17:37:00 2017 +0000 New upstream snapshot --- hurd/hurd_types.h | 3 ++ hurd/paths.h | 1 + libnetfs/netfs.h | 2 ++ libps/spec.c | 2 +- mach-defpager/default_pager.c | 34 +++++++++++++--------- mach-defpager/kalloc.c | 2 -- mach-defpager/wiring.c | 67 +++++++++---------------------------------- mach-defpager/wiring.h | 1 - procfs/main.c | 24 ---------------- procfs/main.h | 1 - procfs/rootdir.c | 23 +++------------ 11 files changed, 44 insertions(+), 116 deletions(-) diff --git a/hurd/hurd_types.h b/hurd/hurd_types.h index 4341177..2960a29 100644 --- a/hurd/hurd_types.h +++ b/hurd/hurd_types.h @@ -114,6 +114,9 @@ enum retry_type as for FS_RETRY_NORMAL. "/..." means retry "...", but starting from the users root directory. + + "pid/..." means replace `pid' with the PID of the current process in %u + format and then retry as for FS_RETRY_NORMAL. */ }; typedef enum retry_type retry_type; diff --git a/hurd/paths.h b/hurd/paths.h index a13ba9b..e1b00e9 100644 --- a/hurd/paths.h +++ b/hurd/paths.h @@ -54,6 +54,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define _HURD_IFSOCK _HURD "ifsock" /* S_IFSOCK */ /* Symbolic names for all non-essential translators. */ +#define _HURD_MAGIC _HURD "magic" #define _HURD_MTAB _HURD "mtab" #endif /* hurd/paths.h */ diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h index 6c989a4..e988d90 100644 --- a/libnetfs/netfs.h +++ b/libnetfs/netfs.h @@ -70,6 +70,8 @@ struct peropen /* A unique one of these exists for each node currently in use. */ struct node { + struct node *next, **prevp; + /* Protocol specific stuff; defined by user. */ struct netnode *nn; diff --git a/libps/spec.c b/libps/spec.c index d8188d6..bfee34e 100644 --- a/libps/spec.c +++ b/libps/spec.c @@ -880,7 +880,7 @@ ps_cmp_times (struct proc_stat *ps1, struct proc_stat *ps2, tv1.tv_sec > tv2.tv_sec ? 1 : tv1.tv_sec < tv2.tv_sec ? -1 : tv1.tv_usec > tv2.tv_usec ? 1 - : tv2.tv_usec < tv2.tv_usec ? -1 + : tv1.tv_usec < tv2.tv_usec ? -1 : 0; } diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 787ba5b..aafa2cf 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -2388,12 +2388,11 @@ ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: <%p>[s:%d,r:% return (KERN_SUCCESS); } -void default_pager_no_senders(pager, seqno, mscount) - memory_object_t pager; +void default_pager_no_senders(ds, seqno, mscount) + default_pager_t ds; mach_port_seqno_t seqno; mach_port_mscount_t mscount; { - default_pager_t ds; kern_return_t kr; static char here[] = "%sno_senders"; @@ -2406,9 +2405,6 @@ void default_pager_no_senders(pager, seqno, mscount) */ - ds = begin_using_default_pager(pager); - if (ds == DEFAULT_PAGER_NULL) - panic(here,my_name); pager_port_lock(ds, seqno); /* @@ -2435,7 +2431,7 @@ void default_pager_no_senders(pager, seqno, mscount) pager_port_list_delete(ds); pager_dealloc(&ds->dpager); - kr = mach_port_mod_refs(default_pager_self, pager, + kr = mach_port_mod_refs(default_pager_self, ds->pager, MACH_PORT_RIGHT_RECEIVE, -1); if (kr != KERN_SUCCESS) panic(here,my_name); @@ -2784,6 +2780,8 @@ seqnos_memory_object_change_completed(ds, seqno, may_cache, copy_strategy) boolean_t default_pager_notify_server(in, out) mach_msg_header_t *in, *out; { + default_pager_t ds; + mach_no_senders_notification_t *n = (mach_no_senders_notification_t *) in; @@ -2795,10 +2793,21 @@ boolean_t default_pager_notify_server(in, out) * a genuine no-senders notification from the kernel. */ - if ((n->not_header.msgh_bits != - MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND_ONCE)) || - (n->not_header.msgh_id != MACH_NOTIFY_NO_SENDERS)) + if (n->not_header.msgh_id != MACH_NOTIFY_NO_SENDERS) { return FALSE; + } + + if (n->not_header.msgh_bits + == MACH_MSGH_BITS(0, MACH_MSG_TYPE_PROTECTED_PAYLOAD)) { + ds = begin_using_default_pager_payload(n->not_header.msgh_protected_payload); + } else if (n->not_header.msgh_bits + == MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND_ONCE)) { + ds = begin_using_default_pager(n->not_header.msgh_local_port); + } else { + return FALSE; + } + + assert(ds != DEFAULT_PAGER_NULL); assert(n->not_header.msgh_size == sizeof *n); assert(n->not_header.msgh_remote_port == MACH_PORT_NULL); @@ -2809,8 +2818,7 @@ boolean_t default_pager_notify_server(in, out) assert(n->not_type.msgt_inline); assert(! n->not_type.msgt_longform); - default_pager_no_senders(n->not_header.msgh_local_port, - n->not_header.msgh_seqno, n->not_count); + default_pager_no_senders(ds, n->not_header.msgh_seqno, n->not_count); out->msgh_remote_port = MACH_PORT_NULL; return TRUE; @@ -3011,8 +3019,6 @@ start_default_pager_thread(internal) vm_page_size, TRUE); if (kr != KERN_SUCCESS) panic(my_name); - wire_memory(ndpt->dpt_buffer, vm_page_size, - VM_PROT_READ|VM_PROT_WRITE); err = pthread_create(&ndpt->dpt_thread, NULL, default_pager_thread, ndpt); diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c index e4ed12f..3356643 100644 --- a/mach-defpager/kalloc.c +++ b/mach-defpager/kalloc.c @@ -150,8 +150,6 @@ vm_offset_t kget_space(vm_offset_t size) VM_PROT_DEFAULT, VM_PROT_ALL, VM_INHERIT_DEFAULT) != KERN_SUCCESS) return 0; - wire_memory(new_space, space_to_add, - VM_PROT_READ|VM_PROT_WRITE); pthread_spin_lock(&kget_space_lock); continue; } diff --git a/mach-defpager/wiring.c b/mach-defpager/wiring.c index a0a608d..ac20dda 100644 --- a/mach-defpager/wiring.c +++ b/mach-defpager/wiring.c @@ -28,6 +28,7 @@ */ #include <mach.h> #include <mach_init.h> +#include <mach/gnumach.h> #include <mach/machine/vm_param.h> #include "default_pager.h" @@ -44,24 +45,6 @@ wire_setup(host_priv) } void -wire_memory(start, size, prot) - vm_address_t start; - vm_size_t size; - vm_prot_t prot; -{ - kern_return_t kr; - - if (priv_host_port == MACH_PORT_NULL) - return; - - kr = vm_wire(priv_host_port, - this_task, - start, size, prot); - if (kr != KERN_SUCCESS) - panic("mem_wire: %d", kr); -} - -void wire_thread() { kern_return_t kr; @@ -125,7 +108,10 @@ wire_all_memory() page += vm_page_size) *(volatile int *) page = *(int *) page; - wire_memory(address, size, protection); + kr = vm_wire(priv_host_port, this_task, + address, size, protection); + if (kr != KERN_SUCCESS) + panic("vm_wire: %d", kr); if (!(protection & VM_PROT_WRITE)) { @@ -135,42 +121,15 @@ wire_all_memory() } address += size; } -} -/* - * Alias for vm_allocate to return wired memory. - */ -kern_return_t -vm_allocate(task, address, size, anywhere) - task_t task; - vm_address_t *address; - vm_size_t size; - boolean_t anywhere; -{ - kern_return_t kr; + /* + * Automatically wire down future mappings, including those + * that are currently PROT_NONE but become accessible. + */ - if (anywhere) - *address = VM_MIN_ADDRESS; - kr = vm_map(task, - address, size, (vm_offset_t) 0, anywhere, - MEMORY_OBJECT_NULL, (vm_offset_t)0, FALSE, - VM_PROT_DEFAULT, VM_PROT_ALL, VM_INHERIT_DEFAULT); - if (kr != KERN_SUCCESS) - return kr; + kr = vm_wire_all(priv_host_port, this_task, VM_WIRE_ALL); - if (task == this_task) - (void) vm_wire(priv_host_port, task, *address, size, - VM_PROT_DEFAULT); - return KERN_SUCCESS; -} - -/* Other versions of this function in libc... */ -kern_return_t -__vm_allocate (task, address, size, anywhere) - task_t task; - vm_address_t *address; - vm_size_t size; - boolean_t anywhere; -{ - return vm_allocate (task, address, size, anywhere); + if (kr != KERN_SUCCESS) { + panic("wire_all_memory: %d", kr); + } } diff --git a/mach-defpager/wiring.h b/mach-defpager/wiring.h index b5f8e53..e545834 100644 --- a/mach-defpager/wiring.h +++ b/mach-defpager/wiring.h @@ -30,6 +30,5 @@ #include <mach_init.h> extern void wire_setup(/* mach_port_t host_priv */); -extern void wire_memory(/* vm_address_t, vm_size_t, vm_prot_t */); extern void wire_thread(); extern void wire_all_memory(); diff --git a/procfs/main.c b/procfs/main.c index 857eac4..87c726f 100644 --- a/procfs/main.c +++ b/procfs/main.c @@ -35,14 +35,12 @@ /* Command-line options */ int opt_clk_tck; mode_t opt_stat_mode; -pid_t opt_fake_self; pid_t opt_kernel_pid; uid_t opt_anon_owner; /* Default values */ #define OPT_CLK_TCK sysconf(_SC_CLK_TCK) #define OPT_STAT_MODE 0400 -#define OPT_FAKE_SELF -1 #define OPT_KERNEL_PID HURD_PID_KERNEL #define OPT_ANON_OWNER 0 @@ -54,7 +52,6 @@ static void set_compatibility_options (void) { opt_clk_tck = 100; opt_stat_mode = 0444; - opt_fake_self = 1; } static error_t @@ -82,19 +79,6 @@ argp_parser (int key, char *arg, struct argp_state *state) opt_stat_mode = v; break; - case 'S': - if (arg) - { - v = strtol (arg, &endp, 0); - if (*endp || ! *arg) - argp_error (state, "--fake-self: PID must be an integer"); - else - opt_fake_self = v; - } - else - opt_fake_self = 1; - break; - case 'k': v = strtol (arg, &endp, 0); if (*endp || ! *arg || (signed) opt_kernel_pid < 0) @@ -160,10 +144,6 @@ struct argp_option common_options[] = { "You can use this option to override its mode to be more permissive " "for compatibility purposes. " "(default: " STR (OPT_STAT_MODE) ")" }, - { "fake-self", 'S', "PID", OPTION_ARG_OPTIONAL, - "Provide a fake \"self\" symlink to the given PID, for compatibility " - "purposes. If PID is omitted, \"self\" will point to init. " - "(default: no self link)" }, { "kernel-process", 'k', "PID", 0, "Process identifier for the kernel, used to retrieve its command " "line, as well as the global up and idle times. " @@ -259,9 +239,6 @@ netfs_append_args (char **argz, size_t *argz_len) FOPT (opt_stat_mode, OPT_STAT_MODE, "--stat-mode=%o", opt_stat_mode); - FOPT (opt_fake_self, OPT_FAKE_SELF, - "--fake-self=%d", opt_fake_self); - FOPT (opt_anon_owner, OPT_ANON_OWNER, "--anonymous-owner=%d", opt_anon_owner); @@ -315,7 +292,6 @@ int main (int argc, char **argv) opt_clk_tck = OPT_CLK_TCK; opt_stat_mode = OPT_STAT_MODE; - opt_fake_self = OPT_FAKE_SELF; opt_kernel_pid = OPT_KERNEL_PID; opt_anon_owner = OPT_ANON_OWNER; err = argp_parse (&argp, argc, argv, 0, 0, 0); diff --git a/procfs/main.h b/procfs/main.h index 4e28b7e..051db95 100644 --- a/procfs/main.h +++ b/procfs/main.h @@ -20,6 +20,5 @@ /* Startup options */ extern int opt_clk_tck; extern mode_t opt_stat_mode; -extern pid_t opt_fake_self; extern pid_t opt_kernel_pid; extern uid_t opt_anon_owner; diff --git a/procfs/rootdir.c b/procfs/rootdir.c index 748805e..4f4a142 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -416,19 +416,7 @@ out: return err; } -static int -rootdir_fakeself_exists (void *dir_hook, const void *entry_hook) -{ - return opt_fake_self >= 0; -} - -static error_t -rootdir_gc_fakeself (void *hook, char **contents, ssize_t *contents_len) -{ - *contents_len = asprintf (contents, "%d", opt_fake_self); - return 0; -} - +static struct node *rootdir_self_node; static struct node *rootdir_mounts_node; static error_t @@ -694,13 +682,10 @@ rootdir_translated_node_get_translator (void *hook, char **argz, static const struct procfs_dir_entry rootdir_entries[] = { { .name = "self", - .hook = & (struct procfs_node_ops) { - .get_contents = rootdir_gc_fakeself, - .cleanup_contents = procfs_cleanup_contents_with_free, - }, + .hook = ROOTDIR_DEFINE_TRANSLATED_NODE (&rootdir_self_node, + _HURD_MAGIC "\0pid"), .ops = { - .make_node = rootdir_symlink_make_node, - .exists = rootdir_fakeself_exists, + .make_node = rootdir_make_translated_node, } }, { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hurd/hurd.git
