* include/cygwin/version.h: Bump DLL minor version number to 5 due to all of

the changes below.  Redefine process structure to avoid a fixed size table.
Redefine pinfo/_pinfo classes.  Use these throughout.
* dcrt0.cc (dll_crt0_1): Accomodate set_myself argument change.
(__api_fatal): Accomodate _pinfo::record_death argument change.
* exceptions.cc (really_exit): Ditto.
(sig_handle_tty_stop): Use pinfo constructor to access process info.
(events_init): Don't create pinfo_mutex since it is no longer required.
* external.cc (fillout_pinfo): Use winpids class to iterate over all system
pids.
(cygwin_internal): lock_pinfo_for_update and unlock_pinfo are now noops.
* fhandler_termios.cc (fhandler_termios::set_ctty): Use pinfo constructor to
access process info.
* fork.cc (fork): Reorganize to initialize child info after the child has
started since that is when we know the child's winpid, which is necessary to
allocate the pinfo shared memory.
* mmap.cc (recreate_mmaps_after_fork): Change arg type to _pinfo.
* pinfo.cc: Rename pinfo methods to _pinfo throughout.  Eliminate pinfo_list
stuff.
(set_myself): Accept a pid argument now.  Call pinfo initializer to initialize
myself.  Detect when this is an "execed" process and create an "indirect" pid
block.
(pinfo_init): Accomodate set_myself arg change.
(procinfo): Remove.
(pinfo::lock_pinfo): Remove.
(pinfo::unlock_pinfo): Remove.
(pinfo::init): New method.  Allocates shared memory space for process pinfo
structure.
(pinfo::record_death): Don't call locking functions.
(cygwin_winpid_to_pid): Simplify by using new pinfo constructor.
(EnumProcessesW95): New function for iterating over processes on Windows 95.
(winpids::winpids): New constructor for winpids class.  Sets up a list of
process ids.
(enum_init): Initialize w95/wnt pid enumerators.
* shared.cc (shared-info::initialize): Remove pid initialization.
* shared.h: Move pinfo stuff into pinfo.h.
(class shared_info): Remove pinfo_list element.
* signal.cc (kill_worker): Use pinfo constructor to access process info.
(kill_pgrp): Ditto.  Use winpids methods to access list of processes.
* sigproc.cc: Throughout, modify to use _pinfo where appropriate.
(proc_exists (pid_t)): New function.  Determines if a process exists based on
the pid.
(proc_exists (_pinfo *p): Use new proc_exists function above.
(proc_subproc): Copy pinfo stuff around rather than _pinfo pointers.  Try to be
careful about releasing shared memory when we don't need it anymore.  Remove
pinfo locks.
(remove_zombies): Remove pinfo memory when zombie is going away.
* sigproc.h: Reflect _pinfo/pinfo changes in sigproc.cc.
* spawn.cc (spawn_guts): Eliminate pinfo *child argument.  Reorganize to only
initialize child pinfo after process has been started and we know the windows
pid.
(_spawnve): Reflect spawn_guts changes.
* syscalls.cc (setpgid): Use pinfo constructor to access process info.
(getpgid): Ditto.
(internal_getlogin): Use _pinfo.
* winsup.h: Eliminate pinfo_mutex.  Eliminate spawn_guts declaration since it
is static now.  Reflect set_myself argument change.
* include/sys/cygwin.h: Add some PID_* enums to accomodate new pinfo stuff.
* include/cygwin/version.h: Update minor version for cygdrive changes below.
This commit is contained in:
Christopher Faylor
2000-07-29 16:24:59 +00:00
parent 53211514a0
commit 84c7d40932
29 changed files with 774 additions and 646 deletions

View File

@@ -178,11 +178,8 @@ class host_dependent_constants
extern host_dependent_constants host_dependent;
/* Events/mutexes */
extern HANDLE pinfo_mutex;
extern HANDLE title_mutex;
/*************************** Per Thread ******************************/
#define PER_THREAD_FORK_CLEAR ((void *)0xffffffff)
@@ -283,7 +280,7 @@ extern unsigned int signal_shift_subtract;
#endif
#define api_fatal(fmt, args...) \
__api_fatal ("%P: *** " fmt, ## args)
__api_fatal ("%P: *** " fmt,##args)
#undef issep
#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
@@ -378,13 +375,12 @@ void __stdcall mark (const char *, int);
extern "C" int _spawnve (HANDLE hToken, int mode, const char *path,
const char *const *argv, const char *const *envp);
int __stdcall spawn_guts (HANDLE hToken, const char *prog_arg,
const char *const *argv, const char *const envp[],
pinfo *child, int mode);
extern void __stdcall exec_fixup_after_fork ();
/* For mmaps across fork(). */
int __stdcall recreate_mmaps_after_fork (void *);
void __stdcall set_child_mmap_ptr (pinfo *);
void __stdcall set_child_mmap_ptr (_pinfo *);
/* String manipulation */
char *__stdcall strccpy (char *s1, const char **s2, char c);
@@ -401,7 +397,7 @@ long __stdcall to_time_t (FILETIME * ptr);
int __stdcall lock_pinfo_for_update (DWORD timeout);
#endif
void unlock_pinfo (void);
pinfo *__stdcall set_myself (pinfo *);
void _stdcall set_myself (pid_t pid);
/* Retrieve a security descriptor that allows all access */
SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
@@ -500,7 +496,7 @@ win_env * __stdcall getwinenv (const char *name, const char *posix = NULL);
void __stdcall update_envptrs ();
char * __stdcall winenv (const char * const *, int);
extern char **__cygwin_environ, ***main_environ;
extern char __stdcall **cur_environ ();
extern "C" char __stdcall **cur_environ ();
#define environ (cur_environ ())
/* The title on program start. */