From 426351562d55a06e490fad6a87cd7d0106280ab6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 30 Dec 1998 06:50:40 +0000 Subject: 1998-12-27 Roland McGrath Use a struct hurd_port for the cached exec server port, so it is properly reference-counted and locked. * boot-start.c (diskfs_exec): Variable removed. (diskfs_start_bootstrap): Make it a local here. Install that port in _diskfs_exec_portcell. (diskfs_S_fsys_init): Use _diskfs_exec_portcell instead of diskfs_exec. * init-init.c (_diskfs_exec_portcell): New variable. (diskfs_init_diskfs): Initialize it. * priv.h: Declare it. * diskfs.h (diskfs_exec, diskfs_exec_ctl): Remove decls. * file-exec.c (diskfs_S_file_exec): Use _diskfs_exec_portcell instead of diskfs_exec. --- libdiskfs/boot-start.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libdiskfs/boot-start.c') diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c index 21fc9656..c968cf31 100644 --- a/libdiskfs/boot-start.c +++ b/libdiskfs/boot-start.c @@ -36,7 +36,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "fsys_reply_U.h" static mach_port_t diskfs_exec_ctl; -mach_port_t diskfs_exec = MACH_PORT_NULL; extern task_t diskfs_exec_server_task; static task_t parent_task = MACH_PORT_NULL; @@ -101,6 +100,7 @@ diskfs_start_bootstrap () size_t exec_argvlen; struct port_info *bootinfo; struct protid *rootpi; + mach_port_t diskfs_exec; /* Create the port for current and root directory. */ err = diskfs_create_protid (diskfs_make_peropen (diskfs_root_node, @@ -295,6 +295,9 @@ diskfs_start_bootstrap () mach_port_deallocate (mach_task_self (), startup_pt); mach_port_deallocate (mach_task_self (), bootpt); assert_perror (err); + + /* Cache the exec server port for file_exec to use. */ + _hurd_port_set (&_diskfs_exec_portcell, diskfs_exec); } /* We look like an execserver to the execserver itself; it makes this @@ -503,8 +506,9 @@ diskfs_S_fsys_init (mach_port_t port, /* Don't start this until now so that exec is fully authenticated with proc. */ - exec_init (diskfs_exec, authhandle, - execprocess, MACH_MSG_TYPE_COPY_SEND); + HURD_PORT_USE (&_diskfs_exec_portcell, + exec_init (port, authhandle, + execprocess, MACH_MSG_TYPE_COPY_SEND)); mach_port_deallocate (mach_task_self (), execprocess); /* We don't need this anymore. */ -- cgit v1.2.3