2003-08-17 Marcus Brinkmann * proc.h: Include . (struct proc): Change type of members p_pidhashloc and p_taskhashloc to hurd_ihash_locp_t. (struct pgrp): Likewise for pg_hashloc. (struct session): Likewise for s_hashloc. * hash.c: Change type of pghash, pidhash, taskhash and sidhash to struct hurd_ihash and initialize them with HURD_IHASH_INITIALIZER. Include stddef.h. (pid_find): Call hurd_ihash_find instead ihash_find. (pid_find_allow_zombie): Likewise. (task_find): Likewise. (task_find_nocreate): Likewise. (pgrp_find): Likewise. (session_find): Likewise. (add_proc_to_hash): Call hurd_ihash_add instead ihash_add. (add_pgrp_to_hash): Likewise. (add_session_to_hash): Likewise. (remove_pgrp_from_hash): Call hurd_ihash_locp_remove instead ihash_locp_remove, and provide hash table pointer. (remove_proc_from_hash): Likewise. (remove_session_from_hash): Likewise. (prociterate): Use HURD_IHASH_ITERATE instead ihash_iterate. 2003-08-17 Marcus Brinkmann * mgt.c (S_proc_dostop): Revert last change. 2003-06-16 Ognyan Kulev * mgt.c (S_proc_dostop): Instead of suspending all threads except CONTTHREAD, first suspend all threads, and then resume CONTTHREAD. 2002-06-05 Roland McGrath * info.c (S_proc_getprocinfo): If PI_FETCH_TASKEVENTS is set in *FLAGS, fill in PI->taskevents using task_info with TASK_EVENTS_INFO. 2002-05-07 Roland McGrath * host.c (S_proc_setexecdata, S_proc_getexecdata): u_int -> size_t (initialize_version_info): Likewise. Fix cast in host_info arg. (get_string_array): Likewise. * info.c (get_string, S_proc_getprocargs, S_proc_getprocenv): Likewise. (S_proc_getprocinfo, S_proc_getloginpids): Likewise. (S_proc_getprocinfo): int -> size_t; fix casts in *_info argument. * mgt.c (S_proc_reauthenticate, S_proc_getallpids): Likewise. (add_tasks, S_proc_dostop): Likewise. (S_proc_exception_raise): int -> integer_t * pgrp.c (S_proc_getsessionpids, S_proc_getsessionpgids): Likewise. (S_proc_getpgrppids): Likewise. 2002-02-17 Roland McGrath * info.c (S_proc_getprocinfo) [TASK_SCHED_TIMESHARE_INFO]: Do a second task_info call to fill in PI->timeshare_base_info. 2001-12-22 Roland McGrath * proc.h (check_owner): Move this extern inline function ... * info.c (check_owner): ... to here, made static inline. 2001-08-14 Marcus Brinkmann * mgt.c (S_proc_dostop): If task_threads fails, resume the suspended task. 2001-08-06 Roland McGrath * wait.c (S_proc_wait: reap): Set *PID_STATUS to CHILD->p_pid. Reported by Neal H Walfield . * mgt.c (allocate_proc): Don't zero P->p_pi. Reported by Neal H Walfield . 2001-08-05 Roland McGrath * wait.c (sample_rusage): New function. (S_proc_mark_exit): Call it. 2001-08-04 Roland McGrath * proc.h (struct proc): New members p_rusage, p_child_rusage. * wait.c (rusage_add): New static function. (alert_parent): Use it to add dead child's p_rusage into parent's p_child_rusage. (S_proc_wait): Fill *RU out param with CHILD->p_rusage, not just zeros. Rewrote subfunction child_ready and its two callers into new subfunction reap to reduce duplicated code. * mgt.c (process_has_exited): Call ports_interrupt_rpcs last thing. * mgt.c (S_proc_reauthenticate): Release global_lock while making RPC. Don't mach_port_deallocate an argument port when returning an error, because mig does it for us. 2001-08-03 Roland McGrath * mgt.c (allocate_proc): Use memset instead of lots of 0 initializers. 2001-08-01 Roland McGrath * mgt.c (genpid): Rewritten. 2001-08-02 Marcus Brinkmann * mgt.c (genpid): Before checking if NEXTPID is free, check if it is greater than WRAP, and if yes, start over. 2001-07-13 Marcus Brinkmann * host.c (S_proc_getexecdata): New variable PORTS_ALLOCATED. Set it if we allocated a new buffer for PORTS. If it is set, and allocation of a new buffer for INTS fails, unmap the buffer for PORTS. * host.c (S_proc_getexecdata): New variable I. Go over all standard ports and increase the send right user reference by one. Set *PORTSPOLY to MACH_MSG_TYPE_MOVE_SEND. 2001-06-27 Marcus Brinkmann * info.c (S_proc_getprocinfo): If we return because mmap failed for *PIARRAY, be sure to munmap THDS if necessary. 2001-05-12 Marcus Brinkmann * host.c (initialize_version_info): Clear last byte of KV to make sure that the string is null-terminated. 2000-04-03 Neal H Walfield * proc.h (struct ids): Drop gids and ngids, we never use them. Turn uids into a zero length array. * mgt.c (make_ids): Conform to new semantics. (ids_free): Removed. Rendered obsolete by ids_rele. (ids_rele): New function. Drop a reference to the given ids. (ids_ref): Add a reference to the given ids. (S_proc_reauthenticate): Use ids_rele and new make_ids semantics. (S_proc_child): Use ids_rele and ids_ref. (create_startup_proc): Conform to new make_ids semantics. (complete_proc): Use ids_ref. (process_has_exited): Use ids_rele. * host.c: Doc fix: ``Implement foo as described in '' => ``Implement foo as described in '' * info.c: Likewise. * mgt.c: Likewise. * pgrp.c: Likewise. * wait.c: Likewise. * mgt.c (S_proc_reauthenticate): Calculate the value of NGEN_UIDS, NAUX_UIDS, NGEN_GIDS AND NAUX_GIDS; do not use a constant. (create_startup_proc): Add asserts. * host.c (S_proc_setexecdata): Check for memory allocation errors. Use memcpy, not bcopy. (S_proc_getexecdata): Likewise. (S_proc_execdata_notify): Check return of malloc. (S_proc_register_version): Likewise. (initialize_version_info): Add asserts. * info.c (S_proc_pid2task): Do not bother searching for the pid if we do not have a valid caller. (S_proc_pid2proc): Likewise. Use memcpy, not bcopy. (S_proc_getprocinfo): Doc fixes. Use MAP_FAILED not -1. Use memcpy, not bcopy. (S_proc_getloginpids): Check return value of malloc. Use realloc correctly. (S_proc_setlogin): Check return value of malloc. * main.c (main): Assert allocate_proc. * mgt.c (make_ids): Check return value of malloc and fail accordingly. (S_proc_reauthenticate): Check return value of make_ids and fail accordingly. (S_proc_child): Call task_find after we know that we were passed a valid child. (S_proc_reassign): Likewise. (S_proc_handle_exceptions): Use memcpy, not bcopy. (allocate_proc): Check return value of ports_create_port and fail accordingly. (create_startup_proc): Add asserts. (complete_proc): Do not assume the length of "". * msg.c (S_proc_getmsgport): Call pid_find_allow_zombie after we know we were passed a valid caller. * pgrp.c: Include assert.h. (new_pgrp): Check return value of malloc and fail accordingly. (new_session): Likewise. (boot_setsid): Assert sess. (S_proc_getsessionpids): Use MAP_FAILED not -1. (S_proc_getsessionppids): Likewise. (S_proc_getpgrppids): Likewise. * wait.c (S_proc_wait): Use memset, not bzero. 2000-03-17 Roland McGrath * main.c (main): Use ports_get_send_right. 2000-03-13 Roland McGrath * mgt.c (S_proc_exception_raise): Check for MACH_SEND_NOTIFY_IN_PROGRESS rather than MACH_SEND_INVALID_NOTIFY. Don't deallocate THREAD and TASK ports before the switch, since the successful case uses THREAD again and the failure case uses TASK again. Instead, deallocate them at the end of the successful case. At the end of the error case, use mach_port_destroy on THREAD only. * stubs.c (struct msg_sig_post_request): New type, broken out of send_signal, where it was anonymous. (struct msg_spec): Type removed. (blocking_message_send): Change type to any_t -> any_t. Don't call cthread_wire; it's a no-op in GNU anyway. Just return instead of calling cthread_exit. Argument is now a pointer to struct msg_sig_post_request. Check mach_msg return value for sanity assert. (send_signal): Make MESSAGE auto instead of static, use new type name. This problem tracked down by Mark Kettenis . 2000-03-12 Roland McGrath * mgt.c (allocate_proc): Don't do mach_port_request_notification here. (proc_death_notify): New function, do it here instead. (complete_proc): Call proc_death_notify. * main.c (main): Call proc_death_notify on STARTUP_PROC after we have set its task port. * proc.h: Declare proc_death_notify. 2000-01-23 Roland McGrath * info.c (get_string): New arg, pass back length of string. (get_string_array): Use it, rather than repeating strlen. When increasing NEWSIZE to fit, round it to page size. Diddle a few casts to be prettier. 2000-01-06 Roland McGrath * primes.c: File removed (long obsolete). * proc.h: Don't declare nextprime. 1999-07-11 Roland McGrath * proc.h: Add #include . 1999-07-10 Roland McGrath * info.c: Add #include for munmap decl. * mgt.c: Likewise. 1999-07-09 Thomas Bushnell, BSG * info.c (get_string_array): Use mmap instead of vm_allocate. (S_proc_getprocinfo): Likewise. (S_proc_getloginpids): Likewise. * mgt.c (S_proc_getallpids): Likewise. * pgrp.c (S_proc_getsessionpids): Likewise. (S_proc_getsessionpgids): Likewise. (S_proc_getpgrppids): Likewise. 1999-07-03 Thomas Bushnell, BSG * info.c (get_string): Use munmap instead of vm_deallocate. (get_vector): Likewise. (get_string_array): Likewise. (S_proc_getprocinfo): Likewise. * mgt.c (S_proc_reauthenticate): Likewise. (S_proc_dostop): Likewise. (add_tasks): Likewise. 1999-06-19 Roland McGrath * main.c (main): Remove commented-out wire_task_self call, #include. 1999-06-05 Roland McGrath * mgt.c (create_startup_proc): Don't call add_proc_to_hash here. * main.c (main): Do it here instead, after we have the task port. 1999-06-04 Roland McGrath * proc.h (struct proc): Use unsigned int for flag bitfields. * mgt.c (allocate_proc, complete_proc): New functions, broken out of new_proc. Remove magic handling of PIDs 0 and 1. (new_proc): Now just call those two. Made static. (create_startup_proc): New function, also broken out of old new_proc. Do special setup for PID 1 (init) proc structure here. * proc.h: Update decls. * main.c (main): Use create_startup_proc for startup_proc, and allocate_proc + complete_proc (with PID 0) for self_proc. * mgt.c (make_ids): Add const to arguments. 1999-05-29 Roland McGrath * mgt.c (add_tasks): Skip invalid (null) rights in tasks array. * info.c (S_proc_pid2task): Add assert for p_task right validity. * main.c: Include . 1999-05-23 Roland McGrath * main.c (main): Set up console on stderr. 1999-05-01 Mark Kettenis * msg.c (check_msgport_death): New function. (S_proc_getmsgport): Use it. * proc.h (check_msgport_death): Provide prototype. * info.c (S_proc_getprocinfo): Call check_msgport_death to make sure that our knowledge about P's message port is up to date. 1999-05-02 Roland McGrath * main.c: Include . 1999-05-01 Roland McGrath * main.c (main): Use assert_perror. Give diagnostic for lack of bootstrap port. 1999-03-14 Roland McGrath * mgt.c (S_proc_reassign): Remove unused variable FOO. 1999-03-11 Mark Kettenis * notify.c (do_mach_notify_dead_name): Remove unnecessary braces. * msg.c (S_proc_setmsgport): Remove unused variable FOO. (S_proc_getmsgport): Only check if the message port is still alive if it is not MACH_PORT_NULL. Use mach_port_type instead of mach_port_get_refs to check if the port is dead. * mgt.c (S_proc_reassign): Use mach_port_destroy to release the old task port. Tue Mar 9 13:11:43 1999 Thomas Bushnell, BSG * notify.c (do_mach_notify_dead_name): Don't check against P->p_msgport anymore. * msg.c (message_port_dead): Delete function. (S_proc_setmsgport): Don't request a dead-name notification anymore. (S_proc_getmsgport): Check to see if P->p_msgport is dead before returning it. * mgt.c (S_proc_reassign): Only use mach_port_deallocate to release P->msgport. (process_has_exited): Likewise. * proc.h (message_port_dead): Delete prototype. * mgt.c (S_proc_reassign): It's not necessary to re-request the task-death notification; we've moved both the task right and the proc port that gets the notification, so delete that. * mgt.c (S_proc_reassign): Use mach_port_destroy instead of mach_port_deallocate to release P->p_msgport, for the same reasons as the changes below. Sun Mar 7 18:19:07 1999 Thomas Bushnell, BSG * mgt.c (process_has_exited): Use mach_port_destroy instead of mach_port_deallocate to release P->p_msgport. (complete_exit): Likewise for P->p_task. These changes eliminate a race; we are destroying the receiver of the dead-name notifications on these ports, but if that means we lose a notification, then the ref-count on the name will get incremented and we can't re-decrement it since we never hear the notification. 1999-03-06 Mark Kettenis * notify.c (do_mach_notify_dead_name): Deallocate reference to DEADPORT. Sat Feb 20 06:26:17 1999 Thomas Bushnell, BSG * stubs.c (send_signal): Typo in comment. 1998-07-20 Roland McGrath * cpu-types.c: Test with #ifdef for CPU_TYPE_I486, CPU_TYPE_PENTIUM, CPU_TYPE_PENTIUMPRO, CPU_TYPE_POWERPC, since not all versions have them. Tue Sep 16 15:26:04 1997 Thomas Bushnell, n/BSG * host.c (hostid, hostname, hostnamelen): Delete variables. (S_proc_sethostid, S_proc_gethostid, S_proc_sethostname, S_proc_gethostname): Delete functions. Wed Aug 20 14:06:46 1997 Thomas Bushnell, n/BSG * main.c (main): New args for ports_manage_port_operations_multithread. 1997-06-30 Miles Bader * main.c (main): Arg parsing added. HOLD variable removed. (argp_program_version): New variable. Include and . Thu Jun 26 14:03:16 1997 Thomas Bushnell, n/BSG * cpu-types.c (mach_cpu_types): Add entries for 486, 586, 686, and powerpc. (mach_cpu_subtypes): Add subtypes for new x86 subtypes. (None added for powerpc yet.) Mon Feb 3 16:52:14 1997 Miles Bader * hash.c (pid_find, task_find, task_find_nocreate, reqport_find): Don't dereference P if it's 0. Fri Oct 25 20:30:22 1996 Thomas Bushnell, n/BSG * host.c: Include . Thu Oct 24 16:13:40 1996 Thomas Bushnell, n/BSG * host.c (initialize_version_info): Construct UNAME_INFO.machine with a dash instead of a slash so that it can be used as a file name component. * host.c (initialize_version_info): Copy our version into element 0 of server_versions, not element 1. Use HURD_VERSION instead of OUR_VERSION. Use literal "proc" instead of OUR_SERVER_NAME. * proc.h (OUR_SERVER_NAME, OUR_VERSION): Delete macro. Thu Sep 12 16:33:49 1996 Thomas Bushnell, n/BSG * Makefile (HURDLIBS): New variable. (proc): Delete special dependency. Thu Sep 5 10:43:39 1996 Thomas Bushnell, n/BSG * host.c (struct server_version): Delete member `release'. (kernel_name, kernel_version): New variables. (rebuild_uname): Do the voting on versions, not releases. (initialize_version_info): Store kernel information in kernel_name and kernel_version, not as an entry in the server_versions array. Don't fill in a release for ourselves. (S_proc_register_version): Ignore RELEASE arg. Sun Jul 28 22:57:03 1996 Miles Bader * info.c (get_string_array): Correctly adjust NEWSIZE when reallocating to add very long strings. Sat Jul 20 10:08:05 1996 Miles Bader * msg.c (S_proc_getmsgport): Deal with PID dying while we're waiting. Fri Jul 19 18:22:46 1996 Michael I. Bushnell, p/BSG * msg.c (S_proc_setmsgport): Bother to request DEAD_NAME notification on new message port being installed. Thu Jul 18 13:23:51 1996 Michael I. Bushnell, p/BSG * msg.c (S_proc_setmsgport): Use MOVE_SEND, not COPY_SEND, to return the old message port to the caller. * mgt.c (S_proc_handle_exceptions): Release newly created reference on E when we are done with it. (S_proc_child): Deallocate our ref on childt once we know we will return success. (S_proc_reassign): Likewise for NEWT. * main.c (main): Don't wire proc anymore. It's not necessary or useful. Thu Jul 18 04:15:49 1996 Roland McGrath * mgt.c (add_tasks): Fix vm_deallocate call to use mach_task_self () instead of mach_host_self (). Tue Jul 16 11:34:34 1996 Michael I. Bushnell, p/BSG * wait.c (EWOULDBLOCK): Define to work around new libc bug. Sun Jul 7 21:04:03 1996 Michael I. Bushnell, p/BSG * mgt.c (S_proc_reauthenticate): Don't use unsafe MOVE_SEND in user-side interruptible RPC. Wed Jul 3 14:44:00 1996 Michael I. Bushnell, p/BSG * mgt.c (process_has_exited): When reparenting children to init, if one of them is dead, alert init. Fri Jun 28 11:54:21 1996 Michael I. Bushnell, p/BSG * proc.h (check_owner): Return true any time PROC1 has root. Thu May 30 19:11:31 1996 Michael I. Bushnell, p/BSG * pgrp.c (S_proc_getsidport): MAKE_SEND_ONCE -> MAKE_SEND. Wed May 29 11:35:37 1996 Miles Bader * info.c (S_proc_getprocinfo): Get rid of temp hack for strnlen. Fri May 24 15:50:14 1996 Michael I. Bushnell, p/BSG * info.c (S_proc_getprocinfo): Set PI->exitstatus and PI->sigcode. * mgt.c (process_has_exited): Don't call alert_parent if P->p_task is null (which happens only if this is the stub process in proc_reassign). This because the parent is uninvolved in the death of stubp. Wed May 22 17:47:15 1996 Miles Bader * stubs.c (send_signal): Send sigcode in message. * msg.c (S_proc_setmsgport): Add OLDMSGPORT_TYPE param. Tue May 14 22:50:49 1996 Miles Bader * proc.h (check_owner): New inline function. * info.c (S_proc_pid2task, S_proc_pid2proc): Use check_owner. Sun May 12 13:22:04 1996 Miles Bader * info.c (PI_FETCH_THREAD_DETAILS): New macro. (S_proc_getprocinfo): Only allocate thread detail storage if we're actually returning thread details (a lone PI_FETCH_THREADS simply means "number of threads"). React to errors somewhat more gracefully. * info.c (S_proc_getprocinfo): Add comment. Fri May 10 16:32:17 1996 Miles Bader * info.c (S_proc_get_tty): New function. Fri May 10 09:26:53 1996 Michael I. Bushnell, p/BSG * mgt.c (S_proc_exception_raise): Fetch sigcode from correctly named member of HSD. Thu May 9 19:13:14 1996 Michael I. Bushnell, p/BSG * mgt.c (S_proc_reauthenticate): Use new authentication interface. * mgt.c (S_proc_setowner): Expect and interpret new CLEAR parm. * info.c (S_proc_getprocinfo): FLAGS is now an in-out parameter. * proc.h (struct proc): Add p_sigcode. * wait.c (S_proc_wait): New parm SIGCODE; return p_sigcode in it. (S_proc_mark_stop): New parm SIGCODE; record it. (S_proc_mark_exit): Likewise. (alert_parent): Set P->p_sigcode if process is dying irregularly. * mgt.c (S_proc_exception_raise): Set P->p_sigcode; use new _hurd_exception2signal args. Mon May 6 14:23:11 1996 Michael I. Bushnell, p/BSG * proc.h (OUR_VERSION): Upgrade to 0.0. Tue Apr 30 16:48:49 1996 Miles Bader * info.c (S_proc_getprocinfo): Release GLOBAL_LOCK around time consuming bits, and more importantly, potential calls to P's msgport, which can block. Fix test when appending to WAITS. Mon Apr 29 16:58:24 1996 Michael I. Bushnell, p/BSG * info.c (S_proc_getprocinfo): Install temporary hack so things at least compile. Turned on thread_waits code. Mon Apr 15 13:51:41 1996 Michael I. Bushnell, p/BSG * mgt.c (process_has_exited): Clear p->p_waited. Fri Mar 29 09:38:28 1996 Michael I. Bushnell, p/BSG * wait.c (S_proc_wait): When looking for a specific pid, use pid_find_allow_zombie, not ordinary pid_find. * mgt.c (S_proc_reassign): Use new ports_transfer_right call instead of claim/install sequence; the latter has leaves the port out of any hash table for a time, which produces a race with incoming messages. Thu Mar 28 09:21:16 1996 Michael I. Bushnell, p/BSG * mgt.c (S_proc_reassign): Make send once right directly from value in P->p_pi, don't use ports_get_right. * mgt.c (process_has_exited): Inhibit this call from happening twice. * info.c (S_proc_pid2task): Return MACH_PORT_NULL for a zombie. (S_proc_pid2proc): Likewise. * Makefile (mutated_ourmsg_U.h): New target. * mgt.c: Include mutated_ourmsg_U.h instead of ourmsg_U.h. * pgrp.c: Likewise. * wait.c: Don't include ourmsg_U.h or process_reply_U.h. * msg.c: Don't include process_reply_U.h. * msg.c (S_proc_getmsgport): Allow call to be made for dead processes; they'll return null. Thank you, Mr. Posix. * mgt.c (process_has_exited): Null out P->p_msgport and drop reference. * wait.c (S_proc_wait): Return EOPNOTSUPP if RPC destination is not a valid process. (S_proc_mark_stop): Likewise. (S_proc_mark_exit): Likewise. (S_proc_mark_cont): Likewise. (S_proc_mark_traced): Likewise. (S_proc_mod_stopchild): Likewise. * msg.c (S_proc_setmsgport): Likewise. (S_proc_getmsgport): Likewise. * pgrp.c (S_proc_setsid): Likewise. (S_proc_getsidport): Likewise. (S_proc_setpgrp): Likewise. (S_proc_mark_exec): Likewise. * mgt.c (S_proc_reauthenticate): Likewise. (S_proc_child): Likewise. (S_proc_reassign): Likewise. (S_proc_setowner): Likewise. (S_proc_getpids): Likewise. (S_proc_set_arg_locations): Likewise. (S_proc_dostop): Likewise. * info.c (S_proc_pid2task): Likewise. (S_proc_proc2task): Likewise. (S_proc_pid2proc): Likewise. (S_proc_make_login_coll): Likewise. (S_proc_setlogin): Likewise. (S_proc_getlogin): Likewise. * host.c (S_proc_sethostid): Likewise. (S_proc_sethostname): Likewise. (S_proc_getprivports): Likewise. (S_proc_setexecdata): Likewise. * proc.h (process_drop): New (inline) function. * hash.c (reqport_find): Only deallocate newly found reference if process is dead. * Makefile (MIGSTUBS): Delete process_replyUser.c. (MIGSFLAGS): Provide new definition. * msg.c (S_proc_setmsgport): Spawn thread to tickle init instead of sending reply here. (tickle_init): New function. Mon Mar 25 17:02:04 1996 Michael I. Bushnell, p/BSG * Makefile (proc): Add libshouldbeinlibc.a. * main.c: Include . (main): Use wire_task_self instead of doing it ourselves. Thu Mar 21 11:59:29 1996 Michael I. Bushnell, p/BSG * wait.c (S_proc_wait) [child_ready]: Flip test of waited flag. * mgt.c (new_proc): Oops, reinstall code to request dead name notification on the task port. Wed Mar 20 10:41:01 1996 Michael I. Bushnell, p/BSG * pgrp.c (S_proc_setpgrp): Delete bletcherous hack from July 22, 1995. -- All these changes get rid of zombies and integrate them into the regular process tables. -- * proc.h (struct zombie): Delete type. (zombie_list): Delete variable. * hash.c (pid_find): Return 0 if process is dead. (task_find): Likewise. (task_find_nocreate): Likewise. (pidfree): Don't call zombie_check_pid. Call pid_find_allow_zombie instead of pid_find. (pid_find_allow_zombie): New function. (prociterate): Don't call FUN for dead processes. * mgt.c (new_proc): Initialize P->p_dead. (process_has_exited): Don't call reparent_zombies. Set P->p_dead. Don't remove from hash tables here, delete ref to task port or remove from parent's list of children (now in complete_exit). Don't remove from pgrp here. (complete_exit): New function. * wait.c (alert_parent): Don't create zombie. (reparent_zombies): Delete function. (S_proc_wait): Don't scan zombie list; check dead children at the same time as stopped children. When completing wait on a dead child, call complete_exit after we've finished work. (zombie_check_pid): Delete function. * proc.h (complete_exit): Provide prototype. -- All these changes make proc multithreaded and use the ports library in the usual fashion (well, almost the usual fashion) -- * Makefile (proc): Mention ../libports/libports.a. * hash.c (porthash, exchash): Delete variables. (reqport_find): Use ports library instead of porthash. (add_proc_to_hash): Don't add to porthash. (remove_proc_from_hash): Don't remove from porthash. (exc_find, remove_exc_from_hash): Delete functions. * mgt.c (new_proc): Allocate new proc structure with ports_create_port. Don't frob P->p_reqport. (process_has_exited): Don't frob P->p_reqport, cal ports_destry_right instead. * proc.h (proc_bucket, proc_class): New variables. (request_portset): Delete variable. * proc.h (struct proc): Delete members `p_reqport' and p_porthashloc. Add member `p_pi'. * Makefile (MIGSFLAGS): Delete variable. * proc.h (global_lock): New variable. * main.c (global_lock): Provide definition. (message_demuxer): Lock global_lock around work. (main): Initialize proc_bucket and proc_class instead of request_portset. Initialize generic_port through ports library calls. Fetch startup procserver port through ports library instead of reading p_reqport. Initialize exc_class. * mgt.c (S_proc_reauthenticate) Likewise. * proc.h: Include and . * info.c (S_proc_task2proc): Use ports_get_right instead of p_reqport. (S_proc_pid2proc): Likewise. * proc.h (exc_port_class): New variable. (struct exc): Add member `pi'. Remove member `excport'. * mgt.c (S_proc_handle_exceptions): Allocate using ports library. (S_proc_exception_raise): Use ports library to manage structure. (exc_clean): New function. *** -- All these changes switch to using condition variables for wakeup instead of explicit block code -- * mgt.c (new_proc): Initialize P->p_wakeup. * wait.c (waiting_parent_cares): Delete function. * Makefile (MIGSTUBS): Delete interruptServer.o. * main.c (message_demuxer): Remove call to interrupt_server. Add call to ports_interrupt_server. * wait.c: Don't include "interrupt_S.h". (alent_parent): Unconditionally enqueue zombie. (S_interrupt_operation): Delete function. (abort_wait): Delete function. * msg.c (abort_getmsgport): Delete function. * wait.c (alert_parent): Use condition_broadcast instead of continuation stuff. (reparent_zombies): Likewise. (S_proc_mark_stop): Likewise. * msg.c (check_message_return): Likewise. (check_message_dying): Likewise. * wait.c (S_proc_wait): Use condition_wait instead of continuation stuff; never return EBUSY. * msg.c (S_proc_getmsgport): Likewise. * proc.h (struct proc): New member `p_wakeup'. Delete member `p_continuation'. Mon Feb 12 14:13:55 1996 Miles Bader * info.c (S_proc_getprocinfo): Fail reasonably for #ifdef'd-out thread waits code. Fri Feb 9 15:45:07 1996 Miles Bader * info.c (S_proc_getprocinfo): Support returning wait strings. Fri Feb 9 15:19:14 1996 Roland McGrath * mgt.c (S_proc_exception_raise): Rewritten. (S_proc_handle_exceptions): Don't set E->replyport. (S_proc_exception_raise_reply): Function removed. * main.c (message_demuxer): Don't call proc_excrepl_server. * proc_excrepl.defs: File removed. * Makefile (DIST_FILES): Remove proc_excrepl.defs. (MIGSTUBS): Remove its objects. * proc_exc.defs: Add msgoption arg. Use integer_t where appropriate. * notify.c (do_mach_notify_no_senders): Don't use E->replyport. * proc.h (struct exc): Removed useless members `replyport', `replyporttype'. Wed Dec 20 17:29:13 1995 Miles Bader * mgt.c (S_proc_reassign): Have notifications sent to the correct request port. Once we've given STUBP's request port to P, don't leave it in STUBP, so process_has_exited() doesn't dealloc it. * pgrp.c (S_proc_getsidport): Add and use new arg sessport_type. Wed Dec 20 13:31:01 1995 Michael I. Bushnell, p/BSG * mgt.c (new_proc): Don't set P->p_noowner for processes 0 and 1. Wed Dec 20 13:09:04 1995 Roland McGrath * info.c (get_vector): Rewritten without arbitrary limits. Tue Dec 19 18:14:30 1995 Miles Bader * pgrp.c (free_session): Correctly get rid of the receive right we're holding. (S_proc_getsidport): Return errors. Tue Dec 19 13:58:59 1995 Roland McGrath * info.c (get_string_array): Fix stupid bug in copying to newly allocated space. Tue Dec 19 13:17:46 1995 Michael I. Bushnell, p/BSG * mgt.c (S_proc_reauthenticate): Reverse miles' last change. Mon Dec 18 19:56:03 1995 Miles Bader * mgt.c (S_proc_reauthenticate): Don't return 0 for the new port. Tue Nov 21 13:50:30 1995 Michael I. Bushnell, p/BSG * wait.c (S_interrupt_operation): Include new seqno parameter. Tue Nov 14 13:15:55 1995 Michael I. Bushnell, p/BSG * wait.c (S_proc_wait): `p->msgportwait' ==> `p->p_msgportwait' typo fix. Thu Nov 9 13:01:28 1995 Michael I. Bushnell, p/BSG * msg.c (S_proc_setmsgport): Only do the RPC reply by hand for init. Also, return the correct port in that by-hand reply. * msg.c (S_proc_getmsgport): Also return EBUSY if P->waiting, because both share the same memory in the proc structure. * wait.c (S_proc_wait): Likewise, mutatis mutandis. Wed Nov 8 13:10:27 1995 Michael I. Bushnell, p/BSG * info.c (S_proc_getprocinfo): Don't attempt msg_report_wait if P->p_msgport is not valid. * info.c (S_proc_getprocinfo): Inhibit PI_FETCH_THREAD_WAITS for now. Tue Nov 7 19:49:32 1995 Miles Bader * info.c (S_proc_getprocinfo): Calculate the size of the returned structure correctly. Sun Nov 5 02:05:10 1995 Miles Bader * proc.h: Include . * info.c (S_proc_getprocinfo): Add NOISE and NOISE_LEN args. Fix various typos. Initialize ERR. Tue Oct 31 14:19:04 1995 Michael I. Bushnell, p/BSG * wait.c (struct zombie): Deleted; now in proc.h. (zombie_list): Likewise. * proc.h (struct zombie): New type. (zombie_list): New variable. * info.c (S_proc_getprocinfo): Implement all the rest of the PI flags except PI_ZOMBIE. Mon Oct 30 16:22:49 1995 Michael I. Bushnell, p/BSG * info.c (S_proc_getprocinfo): Support new FETCH flags; support new msg_report_wait call; improve organization. * info.c (S_proc_getprocenv): Removed #ifdef notyet; fixed args to get_string_array. Sat Sep 16 12:57:31 1995 Roland McGrath * ourmsg.defs: New file. * Makefile (DIST_FILES): Added ourmsg.defs. (ourmsg_U.h ourmsgUser.c, ourmsg.defs): Targets removed. Thu Aug 24 10:38:58 1995 Miles Bader * Makefile (MIGSTUBS): New variable. (OBJS): Get the mig stubs from $(MIGSTUBS). Wed Aug 23 14:25:30 1995 Miles Bader * Makefile (proc): Put all dependencies here. (HURDLIBS, REMHDRS): Removed. (OBJS): Calculate the appropiate bits from $(SRCS). Sat Jul 22 15:04:52 1995 Michael I Bushnell * wait.c (zombie_check_pid): Examine Z->pgrp too. * pgrp.c (S_proc_setpgrp): Install bletcherous hack. Thu Jul 6 15:41:22 1995 Michael I Bushnell * hash.c: "ihash.h" -> . * Makefile (ourmsg_U.h ourmsgUser.c): Use local ourmsg.defs instead of include file directly. (ourmsg.defs): New target. * Makefile: Removed dependencies that are now automatically generated. Tue Jun 27 12:02:47 1995 Michael I Bushnell * mgt.c (S_proc_dostop): Remove assigments from inside if tests. Tue Jun 6 13:24:51 1995 Michael I Bushnell * Makefile (OBJS): Removed ihash.o and primes.o. (CPPFLAGS): Deleted addition of -I../lib. (vpath): Deleted spec. (REMHDRS): Added ../libihash/ihash.h. (HURDLIBS): Added libihash. Wed Apr 26 14:32:19 1995 Michael I Bushnell * wait.c (S_proc_wait): Use `waiter_cares', not `waiting_parent_cares' in zombie check. Tue Apr 18 09:30:13 1995 Michael I Bushnell * wait.c (reparent_zombies): Send SIGCHLD signal to init. * wait.c (S_proc_wait): Don't return ESRCH; return ECHILD. Wed Apr 12 14:36:30 1995 Michael I Bushnell * Makefile (SRCS): Omit primes.c (it's moved to the lib dir). Thu Apr 6 14:29:06 1995 Michael I Bushnell * info.c (S_proc_getprocinfo): New var `tp'. Bother to set PI->logincollection. Wed Apr 5 20:32:02 1995 Roland McGrath * wait.c (waiter_cares, waiting_parent_cares): New functions. (alert_parent, reparent_zombies, S_proc_wait, S_proc_mark_stop): Use them. Tue Apr 4 14:36:36 1995 Michael I Bushnell * main.c (main): Wire text and data segment on startup to avoid failure mode during non-standalone pseudo-crash. Tue Mar 14 11:55:00 1995 Miles Bader * hash.c (addhash, findhash): Moved to ihash.c (which is has a more generic interface) and renamed ihash_add & ihash_find; all callers changed. Other changes: struct htable becomes struct ihash, and all routines that previously deleted things explicitly use ihash_locp_remove instead. Thu Jan 19 02:01:14 1995 Roland McGrath * pgrp.c (S_proc_setpgrp): Use nowait_msg_proc_newids instead of nowait_proc_newids. * mgt.c (S_proc_child): Likewise. Tue Jan 17 17:48:32 1995 Roland McGrath * mgt.c (check_uid): Return true if P has root. * proc.h (struct proc): Make `argv' and `envp' members `vm_address_t'. Thu Nov 3 12:13:49 1994 Michael I Bushnell * mgt.c (S_proc_getallpids): Don't dereference PIDS in call to vm_allocate. * info.c (S_proc_getprocinfo): Don't take address of PIARRAY in call to vm_allocate. Dereference PIARRAY in call to vm_deallocate. Fri Oct 14 04:54:46 1994 Roland McGrath * mgt.c (new_proc): Don't assume MACH_PORT_NULL is zero. (genpid): Deal with all pids between STAR_OVER and WRAP_AROUND being used. Mon Oct 10 14:23:00 1994 Jim Blandy * primes.c (nextprime): Doc fix. Mon Oct 10 02:18:02 1994 Roland McGrath * host.c (rebuild_uname): If all the server versions after [0] (the microkernel) match, merge them all into one "Hurd-VERSION" element in the uname version string. Sun Oct 2 20:36:57 1994 Roland McGrath * host.c (S_proc_sethostname): Don't write off end of uname_info.nodename. (rebuild_uname): Rewritten. (initialize_version_info): Write Mach version info as first element of server_versions. (machversion): Variable removed. Sat Sep 10 11:37:32 1994 Roland McGrath * mgt.c (make_ids): Copy from UIDS and GIDS into newly allocated space, not vice versa. Wed Aug 31 11:03:13 1994 Michael I Bushnell * mgt.c (S_proc_reassign): Rather than getting a new request port, preserve STUBP's request port. This is more convenient for users (and equally good security), and it's what the protocol spec says anyway. Tue Aug 30 12:44:37 1994 Michael I Bushnell * primes.c: Replaced file with new version from Jim Blandy (jimb@gnu.ai.mit.edu), David Carlton (carlton@math.mit.edu). * proc.h (check_dead_execdata_notify): Add prototype. Mon Aug 29 12:53:27 1994 Michael I Bushnell * mgt.c (S_proc_reauthenticate): Use new authentication protocol. Tue Aug 23 11:41:26 1994 Michael I Bushnell * pgrp.c (S_proc_setpgrp): If we don't actually change the pgrp, still send proc_newids; the library depends on always getting it. Mon Aug 22 17:09:21 1994 Michael I Bushnell * wait.c (S_proc_mark_stop): Removed now meaningless assert. * info.c (S_proc_getloginpids): Compute size in realloc correctly. Mon Aug 22 13:29:21 1994 Roland McGrath * wait.c (S_proc_mod_stopchild): Negate VALUE; sense of p_nostopcld flag is opposite of flag value described in process.defs. Fri Aug 19 10:21:57 1994 Michael I Bushnell * pgrp.c (S_proc_getpgrppids): Understand PGID of zero as meaning caller's pgrp. * mgt.c (S_proc_child): Check CHILDP->p_msgport against MACH_PORT_NULL explicitly. * pgrp.c (join_pgrp): If pg->pg_orphcnt has significantly changed, then notify all the processes in the pgrp. (leave_pgrp): Only send newids message if ip->p_msgport is set. * mgt.c (S_proc_child): Becase join_pgrp now always sends newids; don't do it here if we called join_pgrp. Fri Aug 19 04:53:04 1994 Roland McGrath * pgrp.c (leave_pgrp): Fix swapped args to nowait_proc_newids. (join_pgrp): Call nowait_proc_newids to notify the process. Thu Aug 18 10:40:13 1994 Michael I Bushnell * mgt.c (S_proc_reauthenticate): Use MACH_MSG_TYPE_MAKE_SEND to create a send right from P->p_reqport. * main.c (main): Removed var `authhandle'. Use global `authserver' instead. Wed Aug 17 14:02:31 1994 Michael I Bushnell * host.c (init_stdarrays): Removed function. (S_proc_execdata_notify): Never call init_stdarrays. Only call exec_setexecdata if std_port_array is set. (S_proc_getexecdata): Return error if there is no std_port_array. Mon Aug 15 16:12:22 1994 Michael I Bushnell * host.c (check_dead_execdata_notify): New function. * notify.c (do_mach_notify_dead_name): For notifications sent to GENERIC_PORT, call check_dead_execdata_notify. * main.c (main): Create GENERIC_PORT and put it in REQUEST_PORTSET. * host.c (init_stdarrays): New function. (S_proc_execdata_notify): Call init_stdarrays the first time. (S_proc_getexecdata): Likewise. * host.c: Include for various frobs. Include for getpid. Fri Jul 22 11:01:53 1994 Michael I Bushnell * Makefile: Rewritten in accord with new scheme. * wait.c: Include "ourmsg_U.h" instead of "msg.h". Include "process_reply_U.h" instead of "process_reply.h". Include "process_S.h" instead of "proc_S.h". * mgt.c: Include "proc_exc_U.h" instead of "proc_exc.h". Include "proc_excrepl_U.h" insted of "proc_excrepl.h". Include "ourmsg_U.h" instead of "msg.h". Include "process_S.h" instead of "proc_S.h". * pgrp.c: Include "process_S.h" instead of "proc_S.h". Include "ourmsg_U.h" instead of "msg.h". * msg.c: Include "process_reply_U.h" instead of "process_reply.h". * host.c: Include "process_S.h" instead of "proc_S.h". * info.c: Likewise. Wed Jul 20 16:18:31 1994 Michael I Bushnell * wait.c (alert_parent): Delete unused variable `err'. Tue Jul 19 12:45:43 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * Makefile (proc): Don't use variable $(link) anymore. Mon Jul 11 14:32:17 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * pgrp.c (leave_pgrp): When pulling process off of pgrp list, mutate *both* links. (free_pgrp): When pulling pgrp off of session list, mutate *both* links. Tue Jul 5 14:23:21 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * Makefile (TAGSLIBS, TAGSHDRS): New variables. Fri Jul 1 10:57:07 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * stubs.c (send_signal): Rewrote to be machine independent and cleaner. Thu Jun 30 14:05:21 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * stubs.c: New file. * wait.c (alert_parent): Call send_signal instead of nowait_sig_post. (S_proc_mark_stop): Likewise. * pgrp.c (leave_pgrp): Likewise. * proc.h (send_signal): New prototype. * Makefile (OBJS): Added stubs.o. (SRCS): Added stubs.c. (LIBS): New var to get cthreads library. * wait.c (alert_parent): Eliminate pointless assert with confusingly incorrect comment. * hash.c (findhash): If we find a slot with ID matching the one we're looking for, but it has been deleted, then return 0 rather than HASH_DEL. * wait.c (S_proc_wait, reparent_zombies, alert_parent): Use macros WAIT_ANY and WAIT_MYPGRP instead of magic values -1 and 0. * wait.c (S_proc_wait): Implement correct interpretation of PID argument: -1 means any child; 0 means child in the same pgrp. [Incorrect semantics were in loop to search zombies, and loop looking for stopped children] (reparent_zombies): Likewise. [Incorrect semantics were in PID check before returning startup_proc's wait.] (alert_parent): Likewise. [Incorrect semantics were in PID check before returning P->p_parent's wait.] * wait.c (S_proc_wait): Only return wait on stopped child if it passes the PID test. * pgrp.c (S_proc_setpgrp): Don't do process group change if we are changing into our own process group. * mgt.c (S_proc_child): Likewise. * pgrp.c (S_proc_setpgrp): When PID is zero, act on calling process; when PGID is zero, use pid of affected process. (S_proc_setpgrp): EPERM check should succeed if pgid is the affected process's *pid*, not pgrp. Thu Jun 30 08:40:35 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * mgt.c (S_proc_dostop): Use the proper allocation for task_threads. Check for errors. Deallocate the send right from CONTTHREAD too. * wait.c (alert_parent): Send SIGCHLD to the parent. Tue Jun 28 18:12:43 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * primes.c: Include . (nextprime): Use calloc instead of alloca, bzero. P might be bigger than will fit on the stack. Assert non-null return from calloc and realloc. Tue Jun 28 13:57:08 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * main.c (main): Set priority of proc server to 2 so that we get more CPU than ordinary programs. Fri Jun 24 17:29:55 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * hash.c (struct htable): New member `locps'. (addhash): Store LOCP into hash table for use during rehash. During rehash, then provide correct LOCP parm for old elements. Allocate and free HT->locps as appropriate. Fri Jun 24 04:15:16 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * mgt.c (S_proc_setprocargs): Renamed to S_proc_set_arg_locations. (S_proc_get_arg_locations): New function. Mon Jun 20 15:07:00 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * Makefile (install): Use $(INSTALL_BIN) instead of cp. Fri Jun 17 13:00:27 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu) * mgt.c (S_proc_child): Reverse Roland's change of June 11. Sat Jun 11 11:20:16 1994 Roland McGrath (roland@geech.gnu.ai.mit.edu) * mgt.c (S_proc_child): Inherit the argv and envp values from the parent. Fri May 27 16:03:53 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu) * primes.c: Doc fix, with appreciation to Jim Blandy. Fri May 13 16:58:13 1994 Michael I Bushnell (mib@churchy.gnu.ai.mit.edu) * info.c (S_proc_getprocinfo): Only scan through the threads if task_info succeeds. * info.c (S_proc_getprocinfo): Behave properly if one of the threads has died in between the call to task_threads and the calls to thread_info (just pretend it never existed). * info.c (get_string, get_vector, S_proc_getprocinfo): If the task has died (there's a race between pending requests and processing of dead-name notifications) then convert MACH_SEND_INVALID_DEST to ESRCH. Thu May 12 00:59:03 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * main.c (main): Take three args. Store ARGV and ENVP in SELF_PROC. * info.c (S_proc_getprocargs): Remove `#ifdef notyet's. (get_string, get_vector, get_string_array): Functions exposed. (get_string_array): Set BP before the loop. Use a for loop that iterates over elts in VECTOR. Fix check of LEN to reallocate buffer. (S_proc_getprocargs): Cast BUF to vm_address_t * for get_string_array. (get_vector): Fix pointer arithmetic; break out of loop when done. Check for error from malloc. (get_string): Use memchr for scanning. Check for error from malloc. Pass READLEN correctly to vm_deallocate. * msg.c (S_proc_setmsgport): Take new reply port args. Send reply before trying startup_essential_task. Include to declare startup_essential_task. * cpu-types.c: New file. * Makefile (SRCS, OBJS): Add it. * host.c: Include for sprintf. (rebuild_uname): Removed unused variable J. (S_proc_register_version): Fix arg types. Use master_host_port, not host_priv. Remove unused variable J. (server_versions): Fix syntax errors in struct definition. (S_proc_uname): Fixed type of first arg. (rebuild_uname): Fix typo. (initialize_version_info): Cast args to host_info. (initialize_version_info): Allocate space for machversion. Mon May 9 14:32:37 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu) * mgt.c (new_proc): Regard init as having a dead message port initially. * msg.c (S_proc_setmsgport): When init chimes in, tell it we are essential. * proc.h (OUR_VERSION, OUR_SERVER_NAME): New macros. * host.c (uname_info, machversion, server_versions, nserver_versions, server_version_nalloc): New variables. (S_proc_register_version, rebuild_uname, initialize_version_info, S_proc_uname): New functions. (S_proc_sethostname): Also set uname_info.nodename. * main.c (main): Call initialize_version_info. Fri May 6 13:00:36 1994 Michael I Bushnell (mib@geech.gnu.ai.mit.edu) * host.c (S_proc_gethostname): If HOSTNAME is null, return an empty hostname instead of crashing. (S_proc_gethostname): Test buffer length properly; allocate space for the null too. * mgt.c (process_has_exited): delete unused variable LAST. * msg.c (check_message_return): delete unused variables I, MSGPORTS, and CP. Changed type of second arg to `void *' so that the function type is appropriate for the first arg to prociterate. (check_message_dying): delete unused variable I. * wait.c, host.c, info.c, mgt.c, notify.c, pgrp.c: Changed MiG server stubs' return types from error_t to kern_return_t; the types are incompatible right now. Thu May 5 07:50:24 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Makefile: Change uses of $(headers) to $(includedir).