138847683d
* shared_info.h (class user_info): New. (cygwin_user_h): New. (user_shared): New. (enum shared_locations): Replace SH_MOUNT_TABLE by SH_USER_SHARED; (mount_table): Change from variable to macro. * shared.cc: Use sizeof(user_info) in "offsets". (user_shared_initialize): Add "reinit" argument to indicate need to reinitialize the mapping. Replace "mount_table" by "user_shared" throughout. Call user_shared->mountinfo.init and user_shared->delqueue.init. (shared_info::initialize): Do not call delqueue.init. (memory_init): Add argument to user_shared_initialize. * child_info.h (child_info::mount_h): Delete. (child_info::user_h): New. * sigpproc.cc (init_child_info): Use user_h instead of mount_h. * dcrt0.cc (_dll_crt0): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::close): Use user_shared->delqueue instead of cygwin_shared->delqueue. * fhandler_virtual.cc (fhandler_virtual::close): Ditto. * syscalls.cc (close_all_files): Ditto. (unlink): Ditto. (seteuid32): Add argument to user_shared_initialize.
114 lines
2.6 KiB
C++
114 lines
2.6 KiB
C++
/* child_info.h: shared child info for cygwin
|
|
|
|
Copyright 2000, 2001, 2002 Red Hat, Inc.
|
|
|
|
This file is part of Cygwin.
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
details. */
|
|
|
|
#include <setjmp.h>
|
|
|
|
enum
|
|
{
|
|
_PROC_EXEC,
|
|
_PROC_SPAWN,
|
|
_PROC_FORK,
|
|
_PROC_WHOOPS
|
|
};
|
|
|
|
#define OPROC_MAGIC_MASK 0xff00ff00
|
|
#define OPROC_MAGIC_GENERIC 0xaf00f000
|
|
|
|
#define PROC_MAGIC_GENERIC 0xaf00fa00
|
|
|
|
#define PROC_EXEC (_PROC_EXEC)
|
|
#define PROC_SPAWN (_PROC_SPAWN)
|
|
#define PROC_FORK (_PROC_FORK)
|
|
|
|
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
|
|
|
#define CURR_CHILD_INFO_MAGIC 0x8e0899faU
|
|
|
|
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
|
below class. The layout is checksummed to determine compatibility between
|
|
different cygwin versions. */
|
|
class child_info
|
|
{
|
|
public:
|
|
DWORD zero[4]; // must be zeroed
|
|
DWORD cb; // size of this record
|
|
DWORD intro; // improbable string
|
|
unsigned long magic; // magic number unique to child_info
|
|
unsigned short type; // type of record, exec, spawn, fork
|
|
int cygpid; // cygwin pid of child process
|
|
HANDLE subproc_ready; // used for synchronization with parent
|
|
HANDLE user_h;
|
|
HANDLE parent;
|
|
HANDLE pppid_handle;
|
|
init_cygheap *cygheap;
|
|
void *cygheap_max;
|
|
HANDLE cygheap_h;
|
|
unsigned fhandler_union_cb;
|
|
};
|
|
|
|
class mount_info;
|
|
class _pinfo;
|
|
|
|
class child_info_fork: public child_info
|
|
{
|
|
public:
|
|
HANDLE forker_finished;// for synchronization with child
|
|
DWORD stacksize; // size of parent stack
|
|
jmp_buf jmp; // where child will jump to
|
|
void *stacktop; // location of top of parent stack
|
|
void *stackbottom; // location of bottom of parent stack
|
|
};
|
|
|
|
class fhandler_base;
|
|
|
|
class cygheap_exec_info
|
|
{
|
|
public:
|
|
char *old_title;
|
|
int argc;
|
|
char **argv;
|
|
int envc;
|
|
char **envp;
|
|
HANDLE myself_pinfo;
|
|
};
|
|
|
|
class child_info_spawn: public child_info
|
|
{
|
|
public:
|
|
cygheap_exec_info *moreinfo;
|
|
HANDLE hexec_proc;
|
|
|
|
child_info_spawn (): moreinfo (NULL) {}
|
|
~child_info_spawn ()
|
|
{
|
|
if (parent)
|
|
CloseHandle (parent);
|
|
if (moreinfo)
|
|
{
|
|
if (moreinfo->old_title)
|
|
cfree (moreinfo->old_title);
|
|
if (moreinfo->envp)
|
|
{
|
|
for (char **e = moreinfo->envp; *e; e++)
|
|
cfree (*e);
|
|
cfree (moreinfo->envp);
|
|
}
|
|
CloseHandle (moreinfo->myself_pinfo);
|
|
cfree (moreinfo);
|
|
}
|
|
}
|
|
};
|
|
|
|
void __stdcall init_child_info (DWORD, child_info *, int, HANDLE);
|
|
|
|
extern child_info *child_proc_info;
|
|
extern child_info_spawn *spawn_info __attribute__ ((alias ("child_proc_info")));
|
|
extern child_info_fork *fork_info __attribute__ ((alias ("child_proc_info")));
|