aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/pinfo.cc
AgeCommit message (Collapse)AuthorFilesLines
2005-06-07 * pinfo.cc (pinfo::init): Define sa_buf as PSECURITY_ATTRIBUTES andCorinna Vinschen1-4/+4
allocate dynamically. (pinfo::set_acl): Replace sa_buf by dynamically allocated acl_buf. * sec_acl.cc (setacl): Allocate acl dynamically. * sec_helper.cc (sec_acl): Add test for alignment of acl when DEBUGGING is defined. (__sec_user): Same for sa_buf. * security.cc (verify_token): Define sd_buf as PSECURITY_DESCRIPTOR and allocate dynamically. (alloc_sd): Allocate acl dynamically. security.h (sec_user_nih): Change first parameter to SECURITY_ATTRIBUTES *. (sec_user): Ditto. * sigproc.cc (wait_sig): Define sa_buf as PSECURITY_ATTRIBUTES and allocate dynamically. * syscalls.cc (seteuid32): Define dacl_buf as PACL and allocate dynamically. * uinfo.cc (cygheap_user::init): Define sa_buf as PSECURITY_ATTRIBUTES and allocate dynamically. * winbase.h (ilockincr): Mark first argument of inline assembly as earlyclobber. (ilockdecr): Ditto.
2005-05-02white space and minor comment cleanup.Christopher Faylor1-9/+9
2005-04-28* shared_info.h (cygwin_shared_address): Bump to a higher value to avoidChristopher Faylor1-39/+28
collision with large data areas. * fhandler_console.cc (fhandler_console::get_tty_stuff): Accommodate changes to open_shared arguments. * fhandler_tape.cc (mtinfo_init): Ditto. * pinfo.cc (pinfo::init): Use open_shared rather than win32 mmap calls. * shared.cc (user_shared_initialize): Ditto. (memory_init): Ditto. (open_shared): Change to allow use a smore general mmap handler. * shared_info.h (shared_locations): Add SH_JUSTCREATE, SH_JUSTOPEN. (open_shared): Change declaration to match new usage. * autoload.cc (LoadDLLfuncEx2): Define in terms of LoadDLLfuncEx3. (LoadDLLfuncEx3): New macro.
2005-04-22* fhandler.cc (fhandler_base::read): Remove unused signal state tweaks.Christopher Faylor1-0/+1
* fhandler.h (fhandler_pipe::create_selectable): Declare. (fhandler_fifo::close_one_end): Declare. * fhandler_fifo.cc (fhandler_fifo::close_one_end): Define. (fhandler_fifo::open_not_mine): Use close_one_end to close appropriate end of pipe. * pinfo.cc (_pinfo::commune_recv): Ditto. * pipe.cc (fhandler_pipe::create_selectable): Rename from create_selectable_pipe. Reorganize. (fhandler_pipe::create): Use create_selectable.
2005-04-17Actually check in files.Christopher Faylor1-0/+1
2005-04-03 Unify usage of CYG_MAX_PATH throughout. Change buffers fromCorinna Vinschen1-2/+2
size CYG_MAX_PATH + 1 to CYG_MAX_PATH. Change length tests accordingly.
2005-03-08* pinfo.cc (pinfo::exit): Right shift exit value by eight when not started in aChristopher Faylor1-2/+4
cygwin environment.
2005-03-08* dcrt0.cc (dll_crt0_0): Eliminate muto::init call.Christopher Faylor1-1/+2
* sync.h (locker): New, currently unused class. (muto::init): Eliminate. * sync.cc (muto::init): Ditto. (muto::init): Eliminate critical section lock and instead use name as a guard to prevent against multiple attempts to initialize the same muto. * pinfo.cc (pinfo::init): Set myself procinfo when not execing and pid matches windows pid or cygwin pid.
2005-02-27* sigproc.cc (_pinfo::set_ctty): Move functionChristopher Faylor1-0/+8
* pinfo.cc (_pinfo::set_ctty): to here. * fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure if this is an on-disk device rather than an "auto" device. * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. * path.cc (normalize_posix_path): Don't treat a standalone '//' as introducing a UNC path. (normalize_win32_path): Ditto.
2005-02-26* debug.cc (delete_handle): Report on handle value in debugging output.Christopher Faylor1-10/+9
* pinfo.h (_pinfo::exists): Declare "new" function. (_pinfo::kill): Ditto. * fhandler_termios.cc (tty_min::kill_pgrp): Use _pinfo::exists rather than proc_exists. * pinfo.cc (pinfo::init): Ditto. Don't do a low_priority_sleep(0) when looping to find exec'ed procinfo. (pinfo::release): Be more careful about unmapping and closing. * signal.cc (_pinfo::kill): Rename from kill_worker. Accommodate entry into _pinfo class. (kill0): Use _pinfo::kill rather than kill_worker. (kill_pgrp): Ditto. Use _pinfo::exists rather than proc_exists. * sigproc.cc (_pinfo::exists): Rename from proc_exists. (pid_exists): Use _pinfo::exists rather than proc_exists. (remove_proc): Ditto. * sigproc.h (proc_exists): Delete declaration.
2005-02-13white spaceChristopher Faylor1-1/+1
2005-02-11* cygthread.cc (cygthread::release): Reset ev here if it exists.Christopher Faylor1-5/+11
(cygthread::terminate_thread): Eliminat racy code which reset ev and thread_sync. Remove a few nonsensical inuse checks. Exit at the bottom. (cygthread::detach): Rewrite to again try to ensure that we don't say we're signalled when we are not signalled. * fhandler.cc (fhandler_base::raw_read): Revert to signalling read success quickly. * pipe.cc (fhandler_pipe::close): Use base method to close handle. * sigproc.h (WAIT_SIG_PRIORITY): Just trundle along at normal priority to allow the pipe thread to do its thing if possible. * pinfo.h (pinfo::zap_cwd): Declare new function. (pinfo::zap_cwd): Move 'cd out of the way code' here. (pinfo::exit): Use it here. * spawn.cc (spawn_guts): And here.
2005-02-07* exceptions.cc: Make windows_system_directory non-static.Christopher Faylor1-5/+5
* pinfo.cc (pinfo::exit): Change innocuous cd'ed location to one that is more likely to exist.
2005-02-06 * path.cc (path_conv::check): Leave symlink expansion loop in caseCorinna Vinschen1-11/+68
a not-ENOENT error happens. * cygheap.h (cygheap_fdmanip::fhandler_pipe *): New cast operator. * pinfo.cc (_pinfo::commune_recv): Add PICOM_PIPE_FHANDLER handling. (_pinfo::commune_send): Ditto. (_pinfo::pipe_fhandler): New method. * pinfo.h (enum picom): Add PICOM_PIPE_FHANDLER. (_pinfo::pipe_fhandler): Declare. * pipe.cc (fhandler_pipe::open): Rewrite. Allow to open foreign pipe handles.
2005-02-01 * fhandler.cc (fhandler_base::get_proc_fd_name): Don't generateCorinna Vinschen1-2/+2
"device:" entry. * fhandler.h (fhandler_socket::open): New method. (fhandler_pipe::open): New method. * fhandler_proc.cc (fhandler_proc::exists): Return -2 in case of /proc/self. * fhandler_process.cc (fhandler_process::exists): Return -2 in case of symlinks, -3 for pipes and -4 for sockets. (fhandler_process::fstat): Handle pipes and sockets. (fhandler_process::open): Handle opening /proc/<pid>/fd. (fhandler_process::fill_filebuf): Generate empty names for non exisiting file descriptors. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Always generate "socket:[number]" strings as on Linux. (fhandler_socket::open): New method. (fhandler_socket::fstat): Always return socket type. * path.cc (symlink_info::set): Remove unused second parameter. (path_conv::check): Handle pipes and sockets in /proc. Set correct device type for AF_LOCAL sockets. * pinfo.cc (_pinfo::commune_recv): Generate empty names for non exisiting file descriptors. (_pinfo::fd): Ditto. * pipe.cc (fhandler_pipe::open): New method.
2005-01-31* pinfo.cc (pinfo::exit): Only return low-order 16 bits when exiting.Christopher Faylor1-1/+1
2005-01-31 * cygheap.h (class cygheap_fdenum): New class to enumerate usedCorinna Vinschen1-12/+121
fhandlers. * dtable.h (class dtable): Add cygheap_fdenum as friend class. * fhandler.h (fhandler_base::get_proc_fd_name): New virtual method to return a name for /proc/<pid>/fd. (fhandler_socket::get_proc_fd_name): Ditto. (fhandler_pipe::get_proc_fd_name): Ditto. (fhandler_virtual::opendir): Make virtual method. (fhandler_process::opendir): New method. * fhandler.cc (fhandler_base::get_proc_fd_name): New method. * fhandler_process.cc: Include ctype.h. (PROCESS_FD): Define. (process_listing): Add "fd". (fhandler_process::exists): Fix comment. Return 1 in case of "fd" directory. Handle files below "fd". (fhandler_process::fstat): Drop "self" handling. Set correct link count for directories. (fhandler_process::opendir): New method to handle "fd" directory. (fhandler_process::readdir): Add "fd" handling. (fhandler_process::open): Drop "self" handling. (fhandler_process::fill_filebuf): Ditto. Add "fd" handling. Fix "maps" output string. * fhandler_registry.cc (fhandler_registry::fstat): Set correct link count for directories. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): New method. * path.cc (symlink_info::set): Fix thinko. * pinfo.cc (_pinfo::commune_recv): Rename pathbuf to path throughout. Drop local path variable in PICOM_FIFO case. Fix debug output. Close handles as early as possible. Add PICOM_FDS and PICOM_FD handling. (_pinfo::commune_send): Add PICOM_FDS and PICOM_FD handling. (_pinfo::fd): New method. (_pinfo::fds): New method. * pinfo.h (enum picom): Add PICOM_FDS and PICOM_FD. (_pinfo::fd): Declare. (_pinfo::fds): Declare. * pipe.cc (fhandler_pipe::get_proc_fd_name): New method.
2005-01-29 * autoload.cc (GetModuleFileNameExA): Add.Corinna Vinschen1-0/+73
(GetModuleInformation): Add. (QueryWorkingSet): Add. * fhandler.h (fhandler_virtual::get_filebuf): New method. * fhandler_proc.cc (PROC_SELF): Define. (proc_fhandlers): Change type of self to FH_PROC. (fhandler_proc::exists): Return -3 if self. (fhandler_proc::fstat): Handle self as symlink. (fhandler_proc::fill_filebuf): Handle self. * fhandler_process.cc: Include psapi.h. (PROCESS_EXENAME): Remove. (PROCESS_MAPS): Define. (PROCESS_ROOT): Define. (PROCESS_EXE): Define. (PROCESS_CWD): Define. (process_listing): Remove "exename", add "maps, "root", "exe" and "cwd" elements. (fhandler_process::exists): Return -2 for symlinks. (fhandler_process::fstat): Handle symlinks. (fill_filebuf): Evaluate pid if pid is 0. Use exename handling for exe. Handle maps, root and cwd. (format_process_maps): New function evaluating "maps". * path.cc (symlink_info::set): New method to fill symlink_info with data matching virtual symlinks. (path_conv::check): Handle virtual symlinks. * pinfo.cc (_pinfo::commune_recv): Add PICOM_CWD and PICOM_ROOT handling. (_pinfo::commune_send): Ditto. (_pinfo::root): New function. (_pinfo::cwd): New function. * pinfo.h (enum picom): Add PICOM_CWD and PICOM_ROOT. (_pinfo::root): Declare. (_pinfo::cwd): Declare.
2005-01-28.Christopher Faylor1-3/+0
2005-01-26* pinfo.cc (pinfo::init): Avoid a compiler warning.Christopher Faylor1-2/+1
2005-01-26* pinfo.h (pinfo::init): Make third parameter non-optional and propagate changeChristopher Faylor1-54/+56
throughout. * pinfo.cc (set_myself): Pass INVALID_HANDLE_POINTER if h is NULL. (pinfo::init): Make third parameter non-optional. Eliminate use of PID_EXECED as an argument. Put setting of handle back inside loop but reorganize to try to open it only when necessary.
2005-01-25 * cygwin.din: Export getpriority and setpriority.Corinna Vinschen1-0/+2
* fork.cc (fork_parent): Copy parent's nice value into child. * spawn.cc (spawn_guts): Ditto. * miscfuncs.cc (winprio_to_nice): New function. (nice_to_winprio): Ditto. * pinfo.cc (pinfo_init): If parent is not a Cygwin process, set default nice value according to current Win32 priority class. * pinfo.h (class _pinfo): Add nice member. * syscalls.cc (setpriority): New function, only implementing PRIO_PROCESS for now. (getpriority): Ditto. (nice): Just call setpriority. * wincap.h (wincaps::has_extended_priority_class): New element. * wincap.cc: Implement above element throughout. * winsup.h: Add prototypes for winprio_to_nice and nice_to_winprio. * include/limits.h (NZERO): New define. * include/cygwin/types.h (id_t): New datatype. * include/cygwin/version.h: Bump API minor version. * include/sys/resource.h: Add PRIO_XXX defines and prototypes for getpriority and setpriority.
2005-01-22* spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to make sureChristopher Faylor1-8/+10
that a stub process does not keep the current working directory busy after the "execed" process has exited.
2005-01-22* pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out of theChristopher Faylor1-57/+68
loop since trying multiple times to call CreateFileMapping doesn't make much sense. Try to structure the loop a little better so that exiting with a break does the right thing. (pinfo::release): Release shared memory area if it exists and close handle if it exists.
2005-01-22* pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Make sure that processChristopher Faylor1-1/+7
has exited before getting an error code. (pinfo::exit): "cd" to innocuous location before exiting to make sure that process does not keep the current working directory busy while it is in the process of really exiting.
2005-01-17* pinfo.h (maybe_set_exit_code_from_windows): Renamed from set_exit_state.Christopher Faylor1-5/+9
* pinfo.cc (pinfo::exit): Use renamed function. (proc_waiter): Ditto. Make a copy of input argument to avoid problems when procs array is shuffled. Flag when copy is made so that remove_proc knows when it is safe to reshuffle. * sigproc.cc (proc_terminate): Don't flag process_state as PID_EXITED. (remove_proc): Wait for waiter to finish copying pinfo element before moving it (an actual wait should be an extremely rare event).
2005-01-16* init.cc (dll_entry): Remove unused extern.Christopher Faylor1-15/+11
* include/sys/cygwin.h: Remove PID_ZOMBIE. * pinfo.h: Rename EXITCODE_* defines. (pinfo::set_exit_state): Remove parameter. * pinfo.cc (set_exit_state): Remove parameter. Reverse sense of test so that exitcode is checked for having been set rather than not having been set. Set flag when exitcode has been established. Don't set PID_STATE here. (pinfo::init): Remove exitcode initialization. (pinfo::exit): Reflect change in EXITCODE_* naming. Set flag when exitcode has been established. Reflect change in arguments to set_process_state. (proc_waiter): Reflect change in arguments to set_process_state. Set process_state here and only here. * fhandler_process.cc (fhandler_process::fill_filebuf): Reflect removal of PID_ZOMBIE define. (format_process_stat): Ditto. (format_process_status): Ditto. * sigproc.cc (pid_exists): Ditto. (stopped_or_terminated): Ditto. Make sure that only low-order 16 bits of exitcode are used. * spawn.cc (spawn_guts): Reflect change in EXITCODE_* naming.
2005-01-13 * pinfo.cc (pinfo::exit): Don't access self after releasing it.Corinna Vinschen1-2/+3
* path.h (path_conv::path_conv): Fill path with native device name in case of device argument.
2005-01-13* init.cc (dll_entry): Nuke attempt to set exit code since parent will useChristopher Faylor1-0/+1
windows exit code if needed. * pinfo.cc (pinfo::exit): Move release() here to minimize pid creation race (suggested by Pierre Humblet).
2005-01-12Reorganize header file inclusion throughout so that cygerrno.h comes first.Christopher Faylor1-1/+1
* fhandler.h (select_record::thread_errno): Save any encountered errno here. (select_record::set_select_errno): New function. (select_record::saw_error): New function. (select_record::select_record): Initialize thread_errno to zero. * select.cc (set_handle_or_return_if_not_open): Set thread_errno on failure. (select_stuff::wait): Record errno for later resurrection in calling thread. (peek_serial): Ditto.
2005-01-12* pinfo.cc (pinfo::exit): Don't assume that this == myself.Christopher Faylor1-5/+1
2005-01-11* pinfo.cc (pinfo::init): Don't close input handle on temporary (?) failure.Christopher Faylor1-1/+2
2005-01-11* pinfo.h (_pinfo::set_exit_state): Declare new function.Christopher Faylor1-34/+46
(pinfo::exit): Move here from _pinfo::exit. * sigproc.cc (child_info::sync): Use new function to set exitcode and process_state. * pinfo.cc (_pinfo::exit): Ditto. (proc_waiter): Ditto. (_pinfo::set_exit_state): Define new function. (_pinfo::dup_proc_pipe): Close handle when there is no parent process around to care about the exit value. * dcrt0.cc (dll_crt0_0): Move subproc_ready synchronization later to make sure that myself is still mapped in parent. (do_exit): Reflect movement to pinfo::exit. (__api_fatal): Ditto. * exceptions.cc (signal_exit): Ditto. * errno.cc (errmap): Map PROC_NOT_FOUND. * init.cc (dll_entry): Release myself before exiting. * sigproc.cc (proc_can_be_signalled): Set errno appropriately. (sig_send): Ditto. Also remove ill-advised test for !myself->sendsig since this is an indication of a process which is still initializating -- it is not an error. (child_info::sync): Don't set exitcode here. Assume that will happen in proc_waiter, if necessary. * spawn.cc (spawn_guts): Delay "wait_for_myself" logic until later. Don't wait at all if the process has already exited. Reflect movement to pinfo::exit.
2005-01-06update copyrightChristopher Faylor1-1/+2
2005-01-04* pinfo.cc (_pinfo::dup_proc_pipe): Can't close proc pipe when execing or weChristopher Faylor1-2/+7
will suffer an exit code race.
2004-12-28* pinfo.cc (_pinfo::dup_proc_pipe): DUPLICATE_CLOSE_SOURCE closes the handleChristopher Faylor1-5/+1
regardless, so revert previous change.
2004-12-28* cygthread.cc (cygthread::stub): Add better debug output.Christopher Faylor1-2/+6
(cygthread::cygthread): Ditto. (cygthread::terminate_thread): Ditto. Move inuse test earlier or suffer infinite loop. * pinfo.cc (_pinfo::dup_proc_pipe): Close handle if DuplicateHandle fails and process no longer exists. * spawn.cc (spawn_guts): Create process in suspended state if OS demands it. * wincap.cc: Add "start_proc_suspended" throughout. * wincap.h (wincaps): Ditto. (wincapc): Ditto.
2004-12-27* pinfo.cc (_pinfo::exit): Beef up debugging output.Christopher Faylor1-4/+4
* sigproc.cc (proc_subproc): Detached children apparently need a ppid of 1.
2004-12-27* init.cc (dll_entry): Previous code reversion was ill-advised. Revert it.Christopher Faylor1-1/+0
* sigproc.cc (child_info::sync): Ditto. * pinfo.cc (_pinfo::exit): Don't set myself.procinfo to NULL since it is no longer required.
2004-12-27* init.cc (dll_entry): Remove exit code setting.Christopher Faylor1-1/+7
* pinfo.cc (pinfo::init): Initialize exitcode to unset state rather than SIGTERM. (proc_waiter): Detect if exit code is unset and use status from GetExitCodeProcess. * sigproc.cc (child_info::sync): Remove exit code detection here since proc_waiter now (again) detects it.
2004-12-26* fhandler.cc (fhandler_base::fchmod): Do the right thing when changing an "onChristopher Faylor1-1/+0
disk" device or fifo. (fhandler_base::fchown): Ditto for changing ownership. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Accommodate device files on ntfs partitions. * path.cc (path_conv::check): Use isfs function to figure out if a path exists on a filesystem to make sure that device files are caught.
2004-12-24* child_info.h (CURR_CHILD_INFO_MAGIC): Update.Christopher Faylor1-45/+58
(child_info::parent_wr_proc_pipe): Eliminate. * pinfo.h (_pinfo::alert_parent): Move here from pinfo class. (_pinfo::dup_proc_pipe): New method. (_pinfo::sync_proc_pipe): Ditto. * exceptions.cc (sig_handle_tty_stop): Reflect move of alert_parent. * init.cc (dll_entry): Exit with status one if main process called ExitProcess. * pinfo.cc (set_myself): Remove handling of parent_wr_proc_pipe. (_pinfo::exit): Reflect move of alert_parent. Set procinfo to NULL to flag that we are exiting normally. Always use exitcode when exiting (although this could be a little racy). (pinfo::init): Set default exit to SIGTERM. This will be the exit code reported if process is terminated. (_pinfo::dup_proc_pipe): New function. (pinfo::wait): Duplicate wr_proc_pipe to the right place. Use dup_proc_pipe to move the pipe to the child. (_pinfo::sync_proc_pipe): New function. (_pinfo::alert_parent): Move to _pinfo. Make sure that wr_proc_pipe is ours before using it. * sigproc.cc (child_info::child_info): Remove handling of parent_wr_proc_pipe. * spawn.cc (spawn_guts): Pass our wr_proc_pipe to the child when execing. Ensure that exit code of cygwin process started from windows is correctly set.
2004-12-23* cygthread.cc (cygthread::stub): Detect if thread function wants to releaseChristopher Faylor1-6/+6
itself here, to avoid a race. (cygthread::release): Clear more stuff. Add a diagnostic for an internal error. * cygthread.h (auto_release): New function. * pinfo.h (pinfo::remember): Add an argument to denote whether child is detached. * fork.cc (fork_parent): Reflect change in arguments to pinfo::remember. * pinfo.cc (_pinfo::exit): Signal exit more forcibly. (proc_waiter): Use cygthread::auto_release to signify that cygthread::stub should release the thread. This should avoid a race. (pinfo::alert_parent): Don't signify an error when wr_proc_pipe == NULL. * sigproc.cc (proc_subproc): Add support for PROC_DETACHED_CHILD. * sigproc.h: Ditto. * spawn.cc (spawn_guts): Specify whether child is detached or not when calling pinfo::remember.
2004-12-22* cygheap.cc (cygheap_setup_for_child): Add api_fatal to catch failingChristopher Faylor1-1/+1
MapViewOfFileEx. * cygthread.cc (cygthread::stub): Previous change to make diagnostic output more informative was really a bust. Try again. Capture previous name in a new field in cygthread for diagnostic purposes. (cygthread::cygthread): Ditto. (cygthread::release): Add an argument to control whether h should be cleared or not. (cygthread::terminate_thread): Use 'inuse' for tests rather than 'h'. (cygthread): Add some diagnostic fields. (cygthread::release): Add an argument. * pinfo.cc (proc_waiter): Accommodate change to cygthread::release.
2004-12-22* pinfo.cc (proc_waiter): Zero wait_thread in child to avoid races with processChristopher Faylor1-0/+1
termination. * cygthread.cc (cygthread::terminate): Clumsily detect when h has gone away and attempt no further action.
2004-12-06* pinfo.h (proc_pipe::*): Delete class.Christopher Faylor1-34/+0
* pinfo.cc (proc_pipe::*): Ditto.
2004-12-06* fork.cc (fork_parent): Reinstate "childhProc" protection. Don't closeChristopher Faylor1-1/+1
hProcess handle here since it is used to ensure that a new process isn't created with the old pid after the old pid exits. * spawn.cc (spawn_guts): Ditto. * pinfo.cc (proc_waiter): Don't send any signals if we've execed since this process doesn't officially exist. * pinfo.h (pinfo::pid_handle): Eliminate. Just use hProc. * sigproc.cc (sig_send): Don't send any signals if our sendsig doesn't exist. That's a sign that we are execing. (remove_proc): Eliminate pid_handle close.
2004-12-05* cygthread.cc (cygthread::terminate_thread): Make public.Christopher Faylor1-1/+1
* pinfo.h (pinfo::wait_thread): New element. * pinfo.cc (pinfo::wait): Store "handle" to started thread in pinfo. * sigproc.cc (proc_terminate): Kill any threads waiting for a process pipe.
2004-12-05* sigproc.cc (mychild): Reimplement as list scan.Christopher Faylor1-35/+46
(proc_subproc): Don't mess with pinfo if it's myself. * child_info.h (child_info_types): Label enum for _PROC constants. (child_info::child_info): New constructor. (child_info::~child_info): New destructor. (child_info::sync): Declare new function. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): Remove old constructor. (child_info_spawn::child_info_spawn): New constructor. * dcrt0.cc (dll_crt0_0): Use correct sizeof when doing sanity check on passed in child_info. Signal readiness to parent when not forking (and not spawning). * fork.cc (sync_with_child): Delete. (resume_child): Remove extra argument. (sync_with_parent): Use child_info method to sync with parent. (fork_child): Don't close fork_info->subproc_ready since that is now handled by the destructor. (fork_parent): Remove subproc_ready stuff. Use child_info sync method for waiting.. Set start time here for child. Rename "forked" to "child". (fork): Check ch.subproc_ready for validity here. * pinfo.h (_pinfo::exec_sendsig): Temp storage for exec stub which may be staying around to handle non-cygwin captive process. (_pinfo::exec_dwProcessId): Ditto. (_pinfo::_lock): Renamed from lock. (_pinfo::lock): New method. (_pinfo::unlock): Ditto. (_pinfo::initialize_lock): Ditto. * pinfo.cc (set_myself): Use initialize_lock method to initialize myself lock. Set "exec" fields in _pinfo to zero to indicate that we've started successfully. Set start time here when appropriate. (_pinfo::commune_send): Use pinfo lock/unlock methods. (proc_waiter): Remove special case for non-cywin processes. Reinstitute handling for PID_NOCLDSTOP. * sigproc.cc (proc_subproc): Set proper EAGAIN errno when process table is filled. (sig_send): Use exec_* fields from _pinfo for sending signals if the the _pinfo sendsig never materializes. (child_info::child_info): New constructor, renamed from init_child_info. Zeroes child_info structure and sets appropriate fields in structure based on chtype. (child_info::~child_info): New destructor. Closes subproc_ready if it exists. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): New constructor. (child_info::ready): New function. Signals parent when child is ready. (child_info::sync): New function. Wait for child to signal us or process to die. (remove_proc): Remove closing of hProcess since this should now be handled shortly after process creation. * spawn.cc (spawn_guts): Use child_info_spawn constructor rather than init_child_info. Save exec_sendsig and exec_dwProcessId in execing _pinfo. Rely on child_info constructor to properly set parent_wr_proc_pipe in ciresrv. Revert to previous determination on whether to start a process in suspended mode. Remove reparenting stuff. Just keep a stub around if starting a non-cygwin process.
2004-12-03* child_info.h (child_info_fork::parent_wr_proc_pipe): New element.Christopher Faylor1-14/+19
* fork.cc (fork_parent): Set parent_wr_proc. * pinfo.cc (set_myself): Close child_proc_info->parent_wr_proc if it exists rather than trying to get value from parent _pinfo. * pinfo.h (enum parent_aleter): New enum. (pinfo::alert_parent): Declare as returning a value. (pinfo::parent_alive): New function. * pinfo.cc (pinfo::alert_parent): Set wr_proc_pipe to invalid non-NULL value when parent disappears. Return success of operation. (proc_waiter): Use __ALERT_* enum for control since these are not really signals. Implement __ALERT_ALIVE. * sigproc.cc (my_parent_is_alive): Eliminate. * sigproc.h (my_parent_is_alive): Ditto for declaration. (__SIGREPARENT): Eliminate.