summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/shared.cc
Commit message (Collapse)AuthorAgeFilesLines
* * shared.cc (shared_info::heap_chunk_size): Use correct variable when readingChristopher Faylor2003-01-311-1/+1
| | | | HKLM.
* spaceChristopher Faylor2002-11-021-1/+1
|
* * shared.cc (shared_info::initialize): Use correct value for versionChristopher Faylor2002-10-231-1/+1
| | | | | | comparison. * include/cygwin/version.h (CYGWIN_VERSION_MAGIC): Use all of a DWORD for magic calculation.
* * cygheap.cc (cygheap_fixup_in_child): Use user_heap element in cygheap.Christopher Faylor2002-10-221-35/+35
| | | | | | | | | | | | | | | | (init_cheap): Ditto for declaration. * fork.cc (fork_parent): Use user_heap element in cygheap. * heap.h (inheap): Ditto. * heap.cc (sbrk): Ditto. (heap_init): Ditto. Reorganize to shrink heap chunk as required and record new value in cygheap. * dcrt0.cc (dll_crt0_1): More "move the cygthread init" games. * shared.cc (open_shared): Rework memory protection to properly deal with relocated shared segment. (shared_info::heap_chunk_size): Rename element to 'heap_chunk'. * shared_info.h (shared_info): Ditto for declaration. * strace.cc (strace::hello): Report on heap chunk size from cygheap since it may shrink.
* Change _function() to function() throughout.Christopher Faylor2002-10-211-4/+4
| | | | | | | | | | | | | | | | | | * cygwin.din: Remove last vestiges (?) of newlib wrappers. * cygthread.cc (cygthread::detach): Always wait for event or suffer an apparently inavoidable race. * dcrt0.cc (dll_crt0_1): Allocate threads after stack has been relocated. * debub.cc (lock_debug): Don't acquire lock on exit. * fork.cc (fork_child): Recreate mmaps before doing anything else since Windows has a habit of using blocks of memory in the child that could previously have been occupied by shared memory in the parent. * mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here and provide some details about what went wrong. (fixup_mmaps_after_fork): Remove error message. * shared.cc (open_shared): Move warning message so that more detail is possible. * sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a race. (sigproc_terminate): Specifically wait for process thread to terminate.
* Rename _kill() to kill() throughout. Rename _raise() to raise() throughout.Christopher Faylor2002-10-201-1/+2
| | | | | | | | | Rename _pid() to pid() throughout. * Makefile.in: Compile some objects with -fomit-frame-pointer. * cygwin.din: Reverse aliasing for _kill. * syscalls.cc (_getpid_r): New function, implemented for newlib compatibility. * shared.cc (open_shared): Remove reserving of memory since previous change eliminate the need for this hack.
* * dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not forking.Christopher Faylor2002-10-191-0/+4
| | | | | | * fork.cc (fork_child): Initialize cygwin thread later in process to avoid allocating memory for thread stacks. * shared.cc (open_shared): Issue warning if NT and shared segment is relocated.
* * fork.cc (fork_child): Move mmap initialization.Christopher Faylor2002-10-181-8/+16
| | | | | | | | * shared.cc (shared_info::heap_chunk_size): Store info as megabytes. Search HKEY_LOCAL_MACHINE as well as HKEY_CURRENT_USER. * shared_info.h (shared_info::initial_heap_size): Change element name to reflect new functionality. * strace.cc (strace::hello): Report on initial heap size.
* * shared.cc (open_shared): Revert to "old" method for shared memory location ifChristopher Faylor2002-10-151-11/+22
| | | | | | !wincap.needs_memory_protection. * wincap.cc: Implement needs_memory_protection throughout. * wincap.h: Ditto.
* * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.Christopher Faylor2002-10-151-8/+47
| | | | | | | | | | | | | | | | | | (child_info_fork::mount_table): Remove. (child_info_fork::myself_addr): Remove. * fork.cc (fork_child): Don't set either of the above. * dcrt0.cc (dll_crt0_1): Call memory_init as early as possible. * fhandler_console.cc (console_state): Move to shared_info.h. (fhandler_console::get_tty_stuff): Reflect open_shared arg change. * pinfo.cc (myself_addr): Remove definition. (pinfo::init): Get myself address from open_shared. * pinfo.h (myself_addr): Remove declaration. * shared.cc (open_shared): Rework so that known shared memory locations are protected. Take shared memory type as fifth argument. (memory_init): Reflect open_shared arg change. * shared_info.h (shared_locations): New enum. (console_state): Move here. (open_shared): Reflect open_shared arg change in declaration.
* * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.Christopher Faylor2002-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (child_info_fork::heaptop): Remove obsolete element. (child_info_fork::heabbase): Ditto. (child_info_fork::heapptr): Ditto. (child_info_fork::mount_table): New element. (child_info_fork::myself_addr): Ditto. * dcrt0.cc (dll_crt0_1): Set mount_table and myself_addr when forking. (initial_env): Add newline to "sleeping" message. * dll_init.cc (reserve_upto): Accommodate cygwin heap when freeing memory. Make debugging output a little more descriptive. * fork.cc (fork_parent): Save mount_table and myself_addr. * pinfo.cc (myself_addr): New variable. (set_myself): Pass PID_MYSELF flag to init. (pinfo::Init): Honor PID_MYSELF. Save address where myself shared memory resides in myself_addr, for fork. * pinfo.h (myself_addr): Declare. * shared.cc (memory_init): On fork, use previously saved address for location of mount table. * include/sys/cygwin.h (PID_MYSELF): New value. * dtable.cc (dtable::stdio_init): Don't pass access type to init_std_file_from_handle. It's always the same. (dtable::init_std_file_from_handle): Remove access type argument. Assume read/write. * dtable.h (dtable::init_std_file_from_handle): Ditto for declaration. * exceptions.cc (try_to_debug): Don't try to debug if already being debugged. * fhandler_console.cc (shared_console_info_save): New variable. (fhandler_console::get_tty_stuff): Save address of shared console stuff for fork.
* * cygthread.cc (cygthread::stub): Don't create event for long-running threads.Christopher Faylor2002-10-131-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Initialize thread_sync event here which is used to Suspend using an event rather than relying on SuspendThread/ResumeThread. (cygthread::init): Save handle to runner thread for future termination. (cygthread::cygthread): Only resume thread when it is actually suspended. Otherwise signal thread completion event. (cygthread::terminate): Forcibly terminate runner thread and any helper threads. Call DisableThreadLibrary calls if execing. * cygthread.h (cygthread::thread_sync): Declare. * dcrt0.cc (do_exit): Eliminate calls to obsolete window_terminate and shared_terminate. * exceptions.cc (events_terminate): Don't bother closing title_mutex since it is going away anyway. * pinfo.cc (_pinfo::exit): Call cygthread::terminate to ensure that threads are shut down before process exit or otherwise strange races seem to occur. * shared.cc (shared_terminate): Eliminate. * shared.h (shared_terminate): Eliminate declaration. * winsup.h (window_terminate): Eliminate declaration. * spawn.cc (spawn_guts): Call cygthread::terminate early in process if execing. Call DisableThreadLibrary calls if execing. * window.cc (Winmain): Call ExitThread to force exit. (window_terminate): Eliminate. * dcrt0.cc (do_exit): Track exit state more closely.
* Cleanup calls to CreateFile throughout.Christopher Faylor2002-09-191-7/+3
| | | | | | | * dcrt0.cc (__api_fatal): Correctly check for failing return from CreateFile. * assert.cc (__assert): Don't check return value from CreateFile for NULL. * fhandler_console.cc (set_console_state_for_spawn): Ditto. * fork.cc (fork_parent): Ditto.
* * dcrt0.cc (dll_crt0_1): Remove getpagesize() call.Christopher Faylor2002-09-021-0/+1
| | | | * shared.cc (memory_init): Move it here.
* * Makefile.in (cygcheck.exe): Make a -mno-cygwin program.Christopher Faylor2002-08-261-1/+1
| | | | | | * cygrun.c (main): Export CYGWIN=ntsec unless otherwise set. * shared.cc (shared_name): Only add build date to shared name when *testing*.
* Conrad Scott <conrad.scott@dsl.pipex.comChristopher Faylor2002-08-061-1/+1
| | | | | * cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously add sbrk amount to returned value in initial case.
* * dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a compilerChristopher Faylor2002-07-141-2/+0
| | | | | | | | | | | | | | | warning. * shared.cc (memory_init): Remove debug_init call. * debug.h (handle_list): Change "clexec" to "inherited". * debug.cc: Remove a spurious declaration. (setclexec): Conditionalize away since it is currently unused. (add_handle): Use inherited field rather than clexec. (debug_fixup_after_fork_exec): Ditto. Move debugging output to delete_handle. (delete_handle): Add debugging output. * fhandler.cc (fhandler_base::set_inheritance): Don't bother setting inheritance in debugging table since the handle was never protected anyway. (fhandler_base::fork_fixup): Ditto. * exceptions.cc (debugger_command): Revert.
* * debug.h (handle_list): Move here from debug.cc. Add "inherit" flagChristopher Faylor2002-07-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functionality. * cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk. (_csbrk): Reorganize to not assume first allocation is <= 1 page. (cygheap_setup_for_child): Mark protected handle as inheritable. * cygheap.h (cygheap_debug): New struct. (init_cygheap): Add new structure when debugging. * dcrt0.cc (dll_crt0_1): Remove call to debug_init. Close ppid_handle here, if appropriate. Don't protect subproc_ready, since it is already protected in the parent. Call memory_init prior to ProtectHandle to ensure that cygheap is set up. Call debug_fixup_after_fork_exec when appropriate. (_dll_crt0): Don't close ppid_handle here. * debug.cc: Use cygheap debug structure rather than static elements throughout. (add_handle): Don't issue a warning if attempt to protect handle in exactly the same way from exactly the same place. Add pid info to warning output. Accept additional argument controlling whether handle is to be inherited. Add pid to stored information. (debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork. Reorganize to avoid erroneously skipping handles. (mark_closed): Add pid info to warning output. (setclexec): Rename from setclexec_pid. * fhandler.cc (fhandler_base::get_default_fmode): Minor reorg. (fhandler_base::fstat): Add debugging output. (fhandler_base::set_inheritance): Call setclexec rather than setclexec_pid. (fhandler_base::fork_fixup): Ditto. * fhandler_console.cc (get_tty_stuff): Mark protected handle as inheritable. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * tty.cc (tty::make_pipes): Ditto. (tty::common_init): Ditto. * fork.cc (fork_parent): Ditto. (fork_child): Close protected handles with correct name. Remove debug_fixup_after_fork call. * fhandler_socket.cc (fhandler_socket::create_secret_event): Mark protected handle as inheritable/non-inheritable, as appropriate. * shared.cc (memory_init): Mark protected handle as inheritable. Call debug_init here. * sigproc.cc (wait_sig): Close protected handle with correct name. * spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as inheritable. * exceptions.cc (debugger_command): Try to run dumper.exe, if found. * syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup since path is already resolved.
* * shared.cc (sec_none): Move to sec_helper.cc.Corinna Vinschen2002-07-011-96/+0
| | | | | | | | | | | | | | | | (sec_none_nih): Ditto. (sec_all): Ditto. (sec_all_nih): Ditto. (get_null_sd): Ditto. (sec_acl): Ditto. (__sec_user): Ditto. * sec_helper.cc (sec_none): Move from shared.cc to here. (sec_none_nih): Ditto. (sec_all): Ditto. (sec_all_nih): Ditto. (get_null_sd): Ditto. (sec_acl): Ditto. (__sec_user): Ditto.
* * dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote shares.Christopher Faylor2002-06-051-1/+1
| | | | | | * path.cc (mount_info::conv_to_win32_path): Set flags to binary when mount entry is not found. (mount_info::set_flags_from_win32_path): Ditto.
* Remove unneeded sigproc.h includes throughout.Christopher Faylor2002-06-021-1/+0
| | | | | | | | | | | | | * fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument. * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search for given pid. (fhandler_proc::readdir): Assume that pid exists if it shows up in the winpid list. * fhandler_process.cc (fhandler_process::open): Simplify search for given pid. Call fill_filebuf with pinfo argument. (fhandler_process::fill_filebuf): Pass pinfo here and assume that it exists. * pinfo.h (pinfo::remember): Define differently if sigproc.h is not included. * dll_init.cc (dll_list::detach): Don't run destructor on exit.
* Remove unneeded sync.h, where appropriate, throughout. Remove unneeded heap.h,Christopher Faylor2002-05-251-1/+0
| | | | | | where appropriate, throughout. Remove unneeded exceptions.h, where appropriate, throughout. Remove unneeded perprocess.h, where appropriate, throughout.
* * shared.cc (__sec_user): Split into sec_acl() and call orig_sid().Corinna Vinschen2002-05-131-42/+35
| | | | | (sec_acl): Create from part of __sec_user(), except creator/owner. * security.h: Define sec_acl() and MAX_DACL_LEN.
* * fork.cc (fork_parent): Use sec_user_nih to control process/threadChristopher Faylor2002-02-191-10/+1
| | | | | | | | | | | | | | | | | inheritance/permission. * spawn.cc (spawn_guts): Ditto. * security.cc (create_token): Initialize token so that it is not tested for bogus value later. Use sec_user to control process/thread creation. * security.h (__sec_user): Rename declaration from sec_user. (sec_user_nih): Declare here as inline function wrapper for __sec_user. (sec_user): Ditto. * sigproc.cc (czombies): Allocate a character array for zombies to avoid constructor overhead (extremely hackish, I know). (cpchildren): Ditto. (pchildren): New define. (zombies): Ditto. (getsem): Use sec_user_nih to control semaphore inheritance/permission.
* * times.cc (hires::prime): Restore thread priority on failure condition.Christopher Faylor2002-02-171-2/+2
| | | | | | | | | | | | | | | | | | | * uinfo.cc (uinfo_init): Use more robust method for determining if process was invoked from a non-cygwin process. * sync.h (muto::init): Eliminate "inheritance" parameter. (new_muto): Reflect removal of parameter. * sync.cc (muto::init): Ditto. * cygheap.cc (cygheap_init): Ditto. * debug.cc (threadname_init): Ditto. * exceptions.cc (events_init): Ditto. * malloc.cc (malloc_init): Ditto. * path.cc (cwdstuff::init): Ditto. * sigproc.cc (sigproc_init): Ditto. * grp.cc (group_lock): Use different method for locking with static member. (read_etc_group): REALLY ensure that read lock mutex is released. * passwd.cc (passwd_lock): Use different method for locking with static member. (read_etc_passwd): REALLY ensure that read lock mutex is released. * shared.cc (sec_user): Correct reversed inheritance test.
* whitespace cleanupChristopher Faylor2002-02-161-22/+21
|
* * cygmagic: Add define name to warning.Christopher Faylor2001-12-261-4/+16
| | | | | | | | | | | | | | | | * dcrt0.cc (_dll_crt0): Check for changes in child_info size. (multiple_cygwin_problem): Avoid "proc" errors when testing. Just assume new cygwin proc. * shared_info.h (mount_info): Add 'cb' element for sanity checks. (shared_info): Ditto. * child_info.h (child_info): Add fhandler_union_size element for sanity checking. * shared.cc (open_shared): Detect shared region size mismatch between parent and child. (shared_info::initialize): Detect shared region size mismatch with expectation. (memory_Init): Ditto. * sigproc.cc (init_child_info): Correctly set cb in passed structure. * shared.cc (open_shared):
* * Makefile.in: Autogenerate some header files which provide magic numbers.Christopher Faylor2001-12-261-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Force dependencies for files which depend on autogenerated headers to ensure that they are always built. * child_info.h (child_info): Add new fields to accommodate new magic number header stuff. * dcrt0.cc: Rely on "child_info_magic.h" to ensure that correct child_info magic numbers are used. (dll_crt0_1): Temporarily remove _cygwin_testing_magic test. (_dll_crt0): Do more testing on magic numbers from fork_info structure. Call "multiple_cygwin_problem" where appropriate. (multiple_cygwin_problem): Rename from multiple_cygwin_die. Issue a warning or die, as appropriate based on cygwin version/magic number mismatch. * pinfo.cc (pinfo::exit): Don't attempt to dereference `this' if it doesn't exist. This can happen when a fatal error occurs early in process initialization. * shared.cc: Rely on "shared_info_magic.h" to accommodate that new magic number header stuff. (shared_info::initialize): Use new magic number stuff, for shared region. (memory_init): Ditto, for mount table. * shared_info.h: Accomodate new magic number stuff for shared region and mount table. * sigproc.cc: Rely on "child_info_magic.h" to accommodate new magic number header stuff. (init_child_info): Initialize new fields in child_info) to accomodate magic numbers. * winsup.h: Rename multiple_cygwin_die to multiple_cygwin_problem. * include/cygwin/version.h: Define macros for manipulating version magic. * cygmagic: New shell script for generating magic numbers.
* Eliminate excess whitespace.Christopher Faylor2001-11-051-1/+1
|
* * Makefile.in: Only build testsuite directory on first 'make check'.Christopher Faylor2001-10-241-3/+8
| | | | | * configure.in: Remove testsuite from SUBDIRS. * configure: Regenerate.
* * fhandler.cc (fhandler_base::fork_fixup): Don't protect handle.Christopher Faylor2001-10-151-0/+2
| | | | | | | | | | | | | | | | | | | * dlfcn.cc: Fix to confirm to coding standards. Reorganize includes throughout to accomodate new cygheap.h usage. * cygheap.h (cygheap_fdmanip): New class: simplifies locking and retrieval of fds from cygheap->fdtab. (cygheap_fdget): Ditto. (cygheap_fdnew): Ditto. * fcntl.cc (_fcntl): Use new method to lock fdtab and retrieve info. * ioctl.cc (ioctl): Ditto. * mmap.cc (mmap): Ditto. * net.cc: Ditto, throughout. * passwd.cc (getpass): Ditto. * path.cc (fchdir): Ditto. * pipe.cc (make_pipe): Ditto. * sec_acl.cc (facl): Ditto. * syscalls.cc: Ditto, throughout. * termios.cc: Ditto, throughout.
* * uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in defaultChristopher Faylor2001-10-091-4/+1
| | | | condition.
* Add "path.h" include throughout, where needed. Use new path_conv methods andChristopher Faylor2001-10-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | operators to simplify testing for directory and attributes, throughout. * path.h (path_conv::exists): New method. (path_conv::has_attribute): Ditto. (path_conv::isdir): Ditto. (path_conv::DWORD &): New operator. (path_conv::int &): Ditto. * dir.cc (rmdir): Eliminate a goto. * dtable.cc (dtable::build_fhandler): Accept opt and suffix info for path_conv.check. Return fh == NULL on path_conv error. Pass unit to set_name as appropriate. (dtable::reset_unix_path_name): New method. * dtable.h (dtable): Declare new method. Reflect arg changes to build_fhandler. * fhandler.cc (fhandler_disk_dummy_name): Eliminate. (fhandler_base::set_name): Expect paths to be NULL. Build unix_path_name from win32_path_name when it is a device. (fhandler_base::reset_unix_path_name): New method. (fhandler_base::raw_read): Report EISDIR when ERROR_INVALID_FUNCTION or ERROR_INVALID_PARAMETER and reading a directory. (fhandler_disk_file::fstat): Don't call stat_dev since we should now never be calling fhandler_disk_file methods with devices. (fhandler_base::fhandler_base): Clear {unix,win32}_path_name. (fhandler_base::~fhandler_base): Always free {unix,win32}_path_name. (fhandler_disk_file::fhandler_disk_file): Remove set_no_free_names kludge. (fhandler_disk_file::open): Ditto. * fhandler.h (fhandler_base::no_free_names): Eliminate. (fhandler_base::set_no_free_names): Ditto. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Don't set unix_path_name here. * path.cc (fchdir): Lock fd table throughout. Use new dtable::reset_unix_path_name method to reset path. * syscalls.cc (stat_worker): Reorganize to always call fstat method. Pass path_conv method to fhandler_*::open. (chroot): Elminate a goto.
* * cygwin.din: Remove cygwin_getshared.Christopher Faylor2001-09-111-8/+0
| | | | | | * shared.cc: Ditto. * include/cygwin/version.h: Bump API minor number. * dtable.cc (dtable::build_fhandler): Fix incorrect test for socket.
* * cygheap.cc (cygheap_fixup_in_child): Clear cygheap->base so that heap is notChristopher Faylor2001-09-091-19/+19
| | | | | | | | | | | forced to start at the same place in execed process. * heap.cc: Remove brk* macros for clarity throughout. * heap.h: Ditto. * shared.cc (shared_info::initialize): Move heap_chunk test into heap_chunk_size(). (heap_chunk_size): Check for chunk size here. Don't go to registry if heap_chunk_in_mb is already set. * smallprint.c (console_printf): Add Windows 95 concessions.
* * cygheap.h (init_cygheap): Move heap pointers here.Christopher Faylor2001-09-071-7/+9
| | | | | | | | | | | | | | | | | | | * include/sys/cygwin.h (perprocess): Remove heap pointers. * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff. (_dll_crt0): Don't initialize heap pointers. (cygwin_dll_init): Ditto. (release_upto): Use heap pointers from cygheap. * heap.h: Ditto. * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch. (fork_child): Remove obsolete sigproc_fixup_after_fork. * shared.cc (memory_init): Reorganize so that cygheap initialization is called prior to regular heap since regular heap uses cygheap now. * sigproc.cc (proc_subproc): Eliminate zombies allocation. (sigproc_init): Move zombies alloation here. Don't free up array on fork, just reuse it. (sigproc_fixup_after_fork): Eliminate. * sigproc.h: Ditto. * include/cygwin/version.h: Reflect change to perprocess structure.
* Remove initialization of static or global values to zero, throughout. ThisChristopher Faylor2001-09-061-1/+1
| | | | | | just needlessly grows the size of the DLL. * tty.cc (tty::alive): Make inuse handle non-inheriting on open, just for thread safety.
* * child_info.h: Modify magic number.Christopher Faylor2001-09-031-2/+2
| | | | | | | | | * dcrt0.cc (_cygwin_testing): Define. (_dll_crt0): Set _cygwin_testing if CYGWIN_TESTING environment variable exists. Don't issue "conflicting versions" error if _cygwin_testing is true. * shared.cc (shared_name): Use _cygwin_testing global rather than testing the environment. * syscalls.cc (_write): Remove debugging info.
* Throughout, reorganize header file inclusion to put security.h prior toChristopher Faylor2001-07-261-1/+1
| | | | | | | | fhandler.h. * fhandler.h (fhandler_base::get_inheritance): New method. * fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper close-on-exec inheritance when creating. (fhandler_socket::check_peer_secret_event): Create handle as non-inheritable.
* * child_info.h: Bump magic number.Christopher Faylor2001-07-171-1/+1
| | | | | | | | | | | | | | | | (class child_info): Add an element. * cygheap.cc (init_cheap): Allocate cygwin heap in shared memory area. (cygheap_fixup_in_child): Map cygwin heap, passed from parent via shared memory into correct address. (cygheap_setup_for_child): New function. * cygheap.h: Declare new functions. * dcrt0.cc (dll_crt0_1): Accomodate new cygheap_fixup_in_child arguments. Avoid protecting subproc_ready unless it is spawn/nowait. * fork.cc (fork_parent): Use new cygheap_setup_for_child function to setup cygwin heap info. Close passed cygheap shared memory handle. * spawn.cc (spawn_guts): Ditto. Also, reorganize to avoid synchronization between parent and child in non-P_OVERLAY case. * sigproc.cc (wait_sig): Only signal subproc_ready when execing.
* Change well_known_admin_sid to well_known_admins_sid throughout.Corinna Vinschen2001-07-151-2/+2
| | | | | | | | | | | | | * sec_acl.cc (setacl): Never set DELETE permission. Set FILE_DELETE_CHILD only on readable and executable directories. * sec_helper.cc: Add constructor for `well_known_null_sid'. * security.cc (get_nt_attribute): Set S_ISVTX for directories if FILE_WRITE_DATA and FILE_EXECUTE but not FILE_DELETE_CHILD is set. Add evaluation of S_ISVTX, S_ISGID and S_ISUID from NULL ACE. (alloc_sd): Never set DELETE permission. Set FILE_DELETE_CHILD only on readable and executable directories. Add creation of NULL ACE for S_ISVTX, S_ISGID and S_ISUID permissions. * security.h: Add extern declaration for `well_known_null_sid'.
* * fork.cc (fork): Eliminate superfluous call to getuid().Corinna Vinschen2001-05-151-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * security.h: New define `NO_SID'. Remove declarations of functions moved to methods into class cygsid. (class cygsid): Declare new methods `getfromstr', `get_sid', `getfrompw', `getfromgr', `get_rid', `get_uid', `get_gid', `string' and new constructors and operators =, == and !=. Declare new global cygsids `well_known_XXX_sid' substituting the corresponding `get_XXX_sid' functions. Remove declarations of these functions. * sec_helper.cc (well_known_admin_sid): New global variable. (well_known_system_sid): Ditto (well_known_creator_owner_sid): Ditto (well_known_world_sid): Ditto (cygsid::string): New method, substituting `convert_sid_to_string_sid'. (cygsid::get_sid): New method, substituting `get_sid'. (cygsid::getfromstr): New method, substituting `convert_string_sid_to_sid'. (cygsid::getfrompw): New method, substituting `get_pw_sid'. (cygsid::getfromgr): New method, substituting `get_gr_sid'. (cygsid::get_id): New method, substituting `get_id_from_sid'. (get_admin_sid): Eliminated. (get_system_sid): Ditto. (get_creator_owner_sid): Ditto. (get_world_sid): Ditto. * grp.cc: Use new cygsid methods and well known sids throughout. * registry.cc: Ditto. * sec_acl.cc: Ditto. * security.cc: Ditto. * shared.cc: Ditto. * syscalls.cc (seteuid): Ditto. Eliminate redundant conditional. * uinfo.cc (internal_getlogin): Ditto. * spawn.cc (spawn_guts) Revert previous patch.
* * grp.cc: Eliminate MAX_DOMAIN_NAME define.Corinna Vinschen2001-04-301-2/+2
| | | | | | | | | | | | | | | | | | | (read_etc_group): Substitute MAX_DOMAIN_NAME by INTERNET_MAX_HOST_NAME_LENGTH. * passwd.cc (parse_pwd): Don't force pw_name to be lower case. * sec_helper.cc: Substitute MAX_USER_NAME by UNLEN, MAX_COMPUTERNAME_LENGTH by INTERNET_MAX_HOST_NAME_LENGTH throughout. (lookup_name): Slight cleanup. * security.cc (alloc_sd): Substitute MAX_USER_NAME by UNLEN. * security.h: Define DEFAULT_UID as DOMAIN_USER_RID_ADMIN and DEFAULT_GID as DOMAIN_ALIAS_RID_ADMINS. * shared.cc (memory_init): Substitute MAX_USER_NAME by UNLEN. * thread.h: Ditto. * uinfo.cc (internal_getlogin): Substitute MAX_USER_NAME by UNLEN. Substitute MAX_COMPUTERNAME_LENGTH and MAX_HOST_NAME by INTERNET_MAX_HOST_NAME_LENGTH. * winsup.h: Include lmcons.h. Eliminate MAX_USER_NAME and MAX_HOST_NAME. Move DEFAULT_UID and DEFAULT_GID to security.h.
* * autoload.cc: Add LoadDLLfunc statements for SetTokenInformation@16.Corinna Vinschen2001-04-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygheap.cc: Include security.h. * grp.cc (internal_getgrent): New function. (getgroups): Rearranged using `internal_getgrent' and the new `cygsid' class. * passwd.cc (internal_getpwent): New function. * sec_acl.cc: Use new `cygsid' class throughout. (acl_access): Use `internal_getgrent' instead of `getgrent'. * sec_helper.cc: Use new `cygsid' class throughout. (get_id_from_sid): Use `internal_getgrent' instead of `getgrent'. Use `internal_getpwent' instead of `getpwent'. * security.cc: Use new `cygsid' class throughout. * security.h: Move `MAX_SID_LEN' from winsup.h to here. Add extern declarations for `internal_getgrent' and `internal_getpwent'. (class cygsid): New class. * shared.cc (sec_user): Use new `cygsid' class. * syscalls.cc (seteuid): Try to set owner to user and primary group to current group in impersonation token before performing impersonation. (setegid): Try to set primary group in process token to the new group if ntsec is on. * uinfo.cc (internal_getlogin): Use new `cygsid' class. Try to set owner to user and primary group to current group in process token if the process has been started from a non cygwin process. (uinfo_init): Set primary group only if the process has been started from a non cygwin process. * winsup.h: Move define for `MAX_SID_LEN' to security.h.
* * security.cc (alloc_sd): Reformat comment.Corinna Vinschen2001-04-221-4/+0
| | | | * shared.cc: Drop function declarations already in security.h.
* Throughout, change fdtab references to cygheap->fdtab.Christopher Faylor2001-04-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | * child_info.h (cygheap_exec_info): Eliminate special fdtab stuff. * spawn.cc (spawn_guts): Ditto. * cygheap.cc (cygheap_init): Initialize fdtab, if appropriate. * cygheap.h (CYGHEAPSIZE): Include size of init_cygheap. (_cmalloc_entry): Include fdtab here. * dtable.h (dtable): Declare/define new methods. * dtable.cc (dtable::vfork_child_fixup): New method. (dtable::fixup_after_exec): Remove unneeded extra arguments. * dcrt0.cc (dll_crt0_1): Ditto. * environ.cc (getwinenv): Use case sensitive comparison. (winenv): Make a copy of environment cache to avoid realloc problems when duplicate environment variables exist in the environment. (From Egor Duda) * net.cc (cygwin_socket): Revert Apr 14 change. * include/sys/file.h: Protect against previous X_OK definition. * passwd.cc: Eliminate passwd_sem throughout. * security.cc: Ditto. * cygwin.din: Export New functions. * passwd.cc (read_etc_passwd): Make race safe. (getpwuid_r): New function. (getpwnam_r): New function.
* Fix spacing, copyrights.Christopher Faylor2001-03-181-11/+11
|
* Update copyrights.Christopher Faylor2001-03-181-1/+1
|
* * shared.cc (shared_info::initialize): Reduce size of heap.Christopher Faylor2001-01-311-1/+1
|
* * pinfo.cc (pinfo::init): Use INVALID_HANDLE_VALUE instead ofCorinna Vinschen2001-01-301-1/+1
| | | | | explicit cast (HANDLE) 0xffffffff. * shared.cc (open_shared): Ditto.