aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/resource.cc
AgeCommit message (Collapse)AuthorFilesLines
2022-12-04Cygwin: fix a few comments mentioning Windows 7 or 8Corinna Vinschen1-2/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-06-06Cygwin: remove most occurrences of __stdcall and __cdeclKen Brown1-2/+2
These have no effect on x86_64. Retain a few occurrences of __cdecl in files imported from other sources. Also retain all occurrences of WINAPI, even though the latter is simply a macro that expands to __stdcall. Most of these occurrences are associated with Windows API functions, and removing them might make the code confusing instead of simpler.
2021-11-30Cygwin: get/setrlimit: move RLIMIT_AS handling into static functionsCorinna Vinschen1-73/+84
To keep getrlimit/setrlimit clean, move the RLIMIT_AS code into local static functions __set_rlimit_as and __get_rlimit_as. Also, make adding process to the job the last step, to be able to close and release the job resources if anything failed. Add matching comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-30Cygwin: setrlimit: Add a permission checkCorinna Vinschen1-0/+6
If the incoming soft limit is less restrictive than the current hard limit, bail out with EPERM. Given the previous sanity check, this implies trying to raise the hard limit. While, theoretically, this should be allowed for privileged processes, Windows has no matching concept in terms of job limits Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-30Cygwin: get_rlimit_stack: add a commentCorinna Vinschen1-0/+2
...just to see what it's used for. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-26Cygwin: get/setrlimit: implement RLIMIT_ASCorinna Vinschen1-0/+86
Code based on the idea implemented by the oneTBB project, see https://github.com/oneapi-src/oneTBB Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-09Cygwin: Define PSAPI_VERSION as 1 before including psapi.hJon Turney1-1/+0
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to 0x0a00 when building utils since 48a76190 (and is the default in w32api >= 9.0.0) In order for the built executables to run on Windows Vista, we must also define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA K32GetModuleFileNameExA' causes a 'The procedure entry point K32GetModuleFilenameExA could not be located in the dynamic link library kernel32.dll' error at run time). Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc (34a6eeab) and ps.cc (1def2148).
2021-02-01Cygwin: remove the OPEN_MAX_MAX macroKen Brown1-1/+1
Replace all occurrences of OPEN_MAX_MAX by OPEN_MAX, and define the latter to be 3200, which was the value of the former. In view of the recent change to getdtablesize, there is no longer a need to distinguish between these two macros.
2021-02-01Cygwin: sysconf, getrlimit: don't call getdtablesizeKen Brown1-4/+1
Now that getdtablesize always returns OPEN_MAX_MAX, we can simplify sysconf(_SC_OPEN_MAX) and getrlimit(RLIMIT_NOFILE) to just use that same constant instead of calling getdtablesize.
2018-02-07Cygwin: Cleanup time handlingCorinna Vinschen1-2/+2
* Redefine NSPERSEC to NS100PERSEC * Define NSPERSEC as nanosecs per second * Define USPERSEC as microsecs per second * Use above constants throughout where appropriate * Rename to_us to timespec_to_us and inline * Rename it_bad to timespec_bad and inline Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen1-3/+0
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-29cygwin: Fix copyright datesCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-05Implement correct RLIMIT_STACK handlingCorinna Vinschen1-26/+59
* miscfuncs.cc (struct pthread_wrapper_arg): Add member guardsize. (pthread_wrapper): Set thread stack guarantee according to guardsize. Tweak assembler code so that $rax/$eax is not required by GCC to prepare the wrapper_arg value. (CygwinCreateThread): Fix deadzone handling. Drop setting a "POSIX" guardpage (aka page w/ PAGE_NOACCESS). Always use Windows guard pages instead. On post-XP systems (providing SetThreadStackGuarantee) always set up stack Windows like with reserved/commited areas and movable guard pages. Only on XP set up stack fully commited if the guardpage size is not the default system guardpage size. Fill out pthread_wrapper_arg::guardsize. Improve comments. * resource.cc: Implement RSTACK_LIMIT Linux-like. (DEFAULT_STACKSIZE): New macro. (DEFAULT_STACKGUARD): Ditto. (rlimit_stack_guard): New muto. (rlimit_stack): New global variable holding current RSTACK_LIMIT values. (__set_rlimit_stack): Set rlimit_stack under lock. (__get_rlimit_stack): Initialize rlimit_stack from executable header and return rlimit_stack values under lock. (get_rlimit_stack): Filtering function to return useful default stacksize from rlimit_stack.rlim_cur value. (getrlimit): Call __get_rlimit_stack in RLIMIT_STACK case. (setrlimit): Call __set_rlimit_stack in RLIMIT_STACK case. * thread.cc (pthread::create): Fetch default stacksize calling get_rlimit_stack. (pthread_attr::pthread_attr): Fetch default guardsize calling wincap.def_guard_page_size. (pthread_attr_getstacksize): Fetch default stacksize calling get_rlimit_stack. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Remove. (PTHREAD_DEFAULT_GUARDSIZE): Remove. (get_rlimit_stack): Declare. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-26Fix values returned by getrlimit(RLIMIT_STACK)Corinna Vinschen1-10/+26
* resource.cc (getrlimit): Fix values returned by RLIMIT_STACK. Explain why this had to be changed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2014-08-22 * Throughout, use __try/__except/__endtry blocks, rather than myfaultCorinna Vinschen1-61/+65
handler. * cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs has been moved from _local_storage to _cygtls. * cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage of counters. Change type of counters to uint32_t for clarity. Remove _cygtls as friend class. (struct _local_storage): Move pathbufs from here... (struct _cygtls): ...to here, allowing to access it from _sigbe. (class san): Only define on 32 bit. Remove errno, _c_cnt and _w_cnt members. (san::setup): Drop parameter. Don't initialize removed members. (san::leave): Don't set removed members. (class myfault): Only define on 32 bit. (myfault::faulted): Only keep implementation not taking any parameter. Drop argument in call to sebastian.setup. (__try/__leave/__except/__endtry): Implement to support real SEH. For now stick to SJLJ on 32 bit. * dcrt0.cc (dll_crt0_0): Drop 64 bit call to exception::install_myfault_handler. * exception.h (exception_handler): Define with EXCEPTION_DISPOSITION as return type. (PDISPATCHER_CONTEXT): Define as void * on 32 bit. Define as pointer to _DISPATCHER_CONTEXT on 64 bit. (class exception): Define separately for 32 and 64 bit. (exception::myfault): Add handler for myfault SEH handling on 64 bit. (exception::exception): Fix mangled method name to account for change in type of last parameter. (exception::install_myfault_handler): Remove. * exceptions.cc (exception::myfault_handle): Remove. (exception::myfault): New SEH handler for 64 bit. * gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when returning to the caller. * ntdll.h: Move a comment to a better place. (struct _SCOPE_TABLE): Define on 64 bit. * thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround. * tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs. (tls_pathbuf::destroy): Change type of loop variables to uint32_t. * tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to uint32_t. Accommodate new place of pathbufs. * tlsoffsets.h: Regenerate. * tlsoffsets64.h: Regenerate.
2013-06-14 Streamline time/times functionality. Remove last remains of formerCorinna Vinschen1-8/+6
Windows 9x compatibility. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Drop now unneeded casts in calls to_timestruc_t. (fhandler_base::utimens_fs): Ditto for timespec_to_filetime. * fhandler_proc.cc (format_proc_stat): Ditto for to_time_t. * hires.h (class hires_ms): Remove unused member initime_ns. Remove declarations for timeGetTime_ns and prime. (hires_ms::uptime): Remove. * posix_ipc.cc (ipc_cond_timedwait): Ditto for timespec_to_filetime. * fhandler_registry.cc (fhandler_registry::fstat): Add cast. * resource.cc (fill_rusage): Call NtQueryInformationProcess rather than GetProcessTimes to deal with LARGE_INTEGER rather than FILETIME. * times.cc: Simplify time handling. Throughout, use LARGE_INTEGER rather than FILETIME to simplify computations. Throughout use {u}int64_t rather than {unsigned} long long. Drop unneeded casts since NSPERSEC is 64 bit anyway. (systime_ns): Remove. (times): Call NtQuerySystemInformation to fetch boot time. Call NtQueryInformationProcess rather than GetProcessTimes to deal with LARGE_INTEGER rather than FILETIME. Call GetSystemTimeAsFileTime. (totimeval): Use constant 1000000 as in other functions. (time_t_to_filetime): Remove. (to_time_t): Change return type to time_t. (time_as_timestruc_t): Rename filetime to systime. (time): Ditto. Add cast. (hires_ns::nsecs): Fix return type cast. (hires_ms::timeGetTime_ns): Remove. (hires_ns::prime): Remove. (hires_ms::nsecs): Drop call to prime. Call GetSystemTimeAsFileTime directly. Subtract FACTOR here since it's the only function needing to do so. (minperiod): Cosmetically change to ULONG. (hires_ns::resolution): Fix return type cast. (hires_ms::resolution): Simplify, rely on NtQueryTimerResolution. * winsup.h: Align time related prototypes to above changes.
2013-05-01* resource.cc (setrlimit): Use consistent commenting style. Return EINVAL whenChristopher Faylor1-5/+10
rlim_cur > rlim_max.
2013-04-23 * Merge in cygwin-64bit-branch.Corinna Vinschen1-4/+4
2013-01-21Throughout, update copyrights to reflect dates which correspond to main-branchChristopher Faylor1-1/+2
checkins. Regularize copyright format.
2011-12-03Throughout, remove extra space after function name from debugging output.Christopher Faylor1-1/+1
Throughout, change syscalls to report on return values using new %R format option. * smallprint.cc (__small_vsprintf): Add parsing for %R to report on return values and possible errno from syscalls. * errno.cc (errmap): Add PRIVILEGE_NOT_HELD. * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use shorter name to reduce debuggging output. * select.cc (start_thread_pipe): Ditto. (start_thread_serial): Ditto. (start_thread_socket): Ditto. (start_thread_mailslot): Ditto. * sigproc.cc (talktome): Ditto.
2011-08-07 * resource.cc (getrlimit): Just return RLIM_INFINITY in a request forCorinna Vinschen1-4/+2
RLIMIT_AS.
2011-05-11 * autoload.cc (GetProcessMemoryInfo): Remove.Corinna Vinschen1-7/+8
* resource.cc (fill_rusage): Call NtQueryInformationProcess rather than GetProcessMemoryInfo to drop a psapi dependency.
2010-04-20 * cygheap.h (struct init_cygheap): Add rlim_core member.Corinna Vinschen1-5/+4
* cygheap.cc (cygheap_init): Initialize rlim_core to RLIM_INFINITY. * exceptions.cc (stackdump): Drop extern declaration of rlim_core. Refer to cygheap->rlim_core instead. (exception::handle): Disable stackdumping if cygheap->rlim_core is 0. Don't set WCOREDUMP flag in exit code, if cygheap->rlim_core is 0. (sigpacket::process): Ditto. * resource.cc (rlim_core): Remove. (getrlimit): Fetch RLIMIT_CORE value from cygheap->rlim_core. (setrlimit): Store RLIMIT_CORE value in cygheap->rlim_core.
2009-12-18 Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcessCorinna Vinschen1-1/+1
according to context. Throughout, replace hMainThread with GetCurrentThread/NtCurrentThread according to context. * dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to hMainProc. Drop duplication of GetCurrentThread to hMainThread. * dtable.cc (dtable::stdio_init): Remove useless comment. * globals.cc (hMainProc): Remove. (hMainThread): Remove. * ntdll.h (NtCurrentProcess): Define. (NtCurrentThread: Define.
2009-09-22Match dup2 and fcntl error values to POSIX.Eric Blake1-1/+1
* dtable.h (OPEN_MAX_MAX): New macro. * resource.cc (getrlimit) [RLIMIT_NOFILE]: Use it. * dtable.cc (dtable::extend): Likewise. * fcntl.cc (fcntl64): Obey POSIX rule with too-large F_DUPFD. * syscalls.cc (dup2): Likewise.
2009-01-17 * fhandler_proc.cc: Reorganize global proc content data into a newCorinna Vinschen1-1/+6
struct proc_tab_t. Accommodate throughout. (format_proc_version): New function. (format_proc_loadavg): New function. (format_proc_self): New function. * resource.cc (getrlimit): Return correct rlim_max value for RLIMIT_NOFILE.
2008-04-07Remove unneeded header files from source files throughout.Christopher Faylor1-2/+0
2005-07-03Replace valid memory checks with new myfault class "exception handling", almostChristopher Faylor1-2/+5
everywhere. Leave some thread.cc stuff alone for now. * cygtls.h: Kludge some definitions to avoid including a problematic windows header. (_cygtls::_myfault): New entry. (_cygtls::_myfault_errno): Ditto. (_cygtls::fault_guarded): New function. (_cygtls::setup_fault): Ditto. (_cygtls::return_from_fault): Ditto. (_cygtls::clear_fault): Ditto. (myfault): New class. * exceptions.cc (handle_exceptions): Handle case of guarded fault in system routine. * gendef: Add another entry point for setjmp that the compiler doesn't know about and won't complain about. * gentls_offsets: Just include windows.h rather than kludging a HANDLE def. * miscfuncs.cc (check_null_str): Delete. (check_null_empty_str): Ditto. (check_null_empty_str_errno): Ditto. (check_null_str_errno): Ditto. (__check_null_invalid_struct): Ditto. (__check_null_invalid_struct_errno): Ditto. (__check_invalid_read_ptr): Ditto. (__check_invalid_read_ptr_errno): Ditto. (dummytest): New function. (check_iovec_for_read): Delete. (chec_iovec): Rename from check_iovec_for_write. Take a read/write parameter. * tlsoffsets.h: Regenerate. * winsup.h: Remove check_* declarations. (check_iovec_for_read): Delete declaration. Turn into a define instead. (check_iovec_for_write): Ditto. (check_iovec): New declaration. * thread.h: Use ifdef guard name consistent with other header files.
2003-07-09* cygheap.cc (creturn): Set appropriate errno when out of memory.Christopher Faylor1-0/+2
(ccalloc): Only issue system_printf when debugging. * dtable.cc (dtable::extend): Only allocate 100 * the incremental growth size max. Set errno appropriately. (dtable::build_fhandler): Check for error from set_name. * fhandler.cc (fhandler_base::set_name): Set errno and return error on OOM. * fhandler.h (fhandler_base::set_name): Change to bool. * fhandler_process.cc (format_process_stat): Fix formatting. * resource.cc (getrlimit): Return greater of OPEN_MAX or fd table size. * sysconf.cc (sysconf): Ditto.
2003-06-16Throughout, remove "include <errno.h>" from files which already includeChristopher Faylor1-1/+0
cygerrno.h. * include/cygwin/config.h (__DYNAMIC_REENT__): Define. * include/cygwin/version.h: Bump API minor version. * cygwin.din: Export __getreent * cygerrno.h: Include errno.h. Fix places where _impure_ptr is used directly to store the errno value. * debug.cc (__set_errno): Ditto. * errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled. * signal.cc: Rename _reent_clib to _REENT throughout. * thread.h (reent_clib): Remove prototype. * thread.cc (reent_clib): Rename reent_clib to __getreent. Return _impure_ptr until MTinterface is initialized. (reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL instead. * MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep signal handling running when fork is called from a thread other than the mainthread.
2002-10-07* dtable.cc (unknown_file): New variable.Christopher Faylor1-2/+1
(dtable::init_std_file_from_handle): Don't set binmode if we couldn't determine the actual file name on stdin/stdout/stderr. (handle_to_fn): Return unknown_file when can't determine filename.
2002-09-22* fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller hasChristopher Faylor1-2/+2
already taken care of that. * fhandler_console.cc (fhandler_console::open): Initialize handles to NULL. (fhandler_console::close): Ditto. GNUify non-GNU formatted functions calls throughout.
2002-08-08 * winsup.h (__check_null_invalid_struct): Make ptr argument non-const.Conrad Scott1-1/+1
(__check_null_invalid_struct_errno): Ditto. * miscfuncs.cc (__check_null_invalid_struct): Ditto. (__check_null_invalid_struct_errno): Ditto. (__check_invalid_read_ptr_errno): Remove superfluous cast. * net.cc (get): Set appropriate errno if fd is not a socket. (cygwin_sendto): Fix parameter checking. (cygwin_recvfrom): Ditto. (cygwin_setsockopt): Ditto. (cygwin_getsockopt): Ditto. (cygwin_connect): Ditto. (cygwin_gethostbyaddr): Ditto. (cygwin_accept): Ditto. (cygwin_bind): Ditto. (cygwin_getsockname): Ditto. (cygwin_listen): Ditto. (cygwin_getpeername): Ditto. (cygwin_send): Ditto. (cygwin_shutdown): Ditto. Move sigframe to fhandler_socket. (cygwin_recvmsg): Fix parameter checking. Add tracing. (cygwin_sendmsg): Ditto. * fhandler_socket.cc (fhandler_socket::shutdown): Add sigframe. * resource.cc (setrlimit): Fix parameter checking.
2002-06-05* dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote shares.Christopher Faylor1-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.
2002-06-02Remove unneeded sigproc.h includes throughout.Christopher Faylor1-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.
2002-05-25Remove unneeded sync.h, where appropriate, throughout. Remove unneeded heap.h,Christopher Faylor1-1/+0
where appropriate, throughout. Remove unneeded exceptions.h, where appropriate, throughout. Remove unneeded perprocess.h, where appropriate, throughout.
2001-10-22* resource.cc (fill_rusage): Perform paranoid zero structure passed toChristopher Faylor1-4/+3
GetProcessMemoryInfo.
2001-10-21* autoload.cc: Autoload GetProcessMemoryInfo.Christopher Faylor1-0/+9
* resource.cc (fill_rusage): Calculate ru_maxrss and ru_majflt entries. (Bug report on this from Guido Serassio in the squid project). This requires including psapi.h.
2001-09-11Update copyrights.Christopher Faylor1-1/+1
2001-09-07* cygheap.h (init_cygheap): Move heap pointers here.Christopher Faylor1-2/+2
* 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.
2001-08-28 * resource.cc (getrlimit): Return actual values on RLIMIT_STACK.Corinna Vinschen1-0/+11
2001-08-16 * resource.cc (getrlimit): Return getdtablesize () as current limitCorinna Vinschen1-1/+1
on RLIMIT_NOFILE. * syscalls.cc (getdtablesize): Return OPEN_MAX if current dtable size is less than OPEN_MAX, the current dtable size otherwise. * sysconf.cc (sysconf): Return getdtablesize () on _SC_OPEN_MAX.
2001-08-16 * resource.cc (getrlimit): Return OPEN_MAX as current limitCorinna Vinschen1-0/+3
on RLIMIT_NOFILE. * syscalls.cc (getdtablesize): Return OPEN_MAX. * sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX. * include/limits.h (OPEN_MAX): Define as 256.
2001-06-28Change check_null_empty_path* to check_null_empty_str* throughout.Christopher Faylor1-12/+4
* path.cc (path_conv::check): Add signal protection here since retrieving info about remote shares can take some time. * path.h (check_null_empty_str_errno): Convert to a function prototype. * path.cc (check_null_empty_str): Move to miscfuncs.cc. * miscfuncs.cc (check_null_empty_str_errno): New function. (__check_null_invalid_struct): Ditto. (__check_null_invalid_struct_errno): Ditto. (check_null_empty_str): Change from VirtualQuery to IsBadWritePtr. * thread.cc (check_valid_pointer): Ditto. * resource.cc (getrlimit): Use check_null_invalid_struct macro for checking validity of pointer. (setrlimit): Ditto.
2001-01-18 * resource.cc (setrlimit): Support RLIMIT_NOFILE.Corinna Vinschen1-0/+5
2001-01-05 * resource.cc (getrlimit): Set errno on EFAULT instead of returning it.Corinna Vinschen1-3/+22
(setrlimit): Ditto. Patch by David Sainty <David.Sainty@optimation.co.nz>: * resource.cc (setrlimit): Prevent failing with an error when the operation would not have changed anything.
2000-12-27 * cygwin.din: Add symbols for `getrlimit' and `setrlimit'.Corinna Vinschen1-0/+55
* exceptions.cc (stackdump): Avoid creating stackdump when `rlim_core' is 0. * resource.cc: New global variable `rlim_core'. (getrlimit): New function. (setrlimit): Ditto. include/cygwin/version.h: Bump minor API version to 32 due to adding `getrlimit' and `setrlimit'. include/sys/resource.h: Add defines, types and prototypes for `getrlimit' and `setrlimit'.
2000-10-15* exceptions.cc (set_console_handler): Don't allocateChristopher Faylor1-0/+1
console_handler_thread_waiter. It is obsolete. (ctrl_c_handler): Don't use console_handler_thread_waiter. * path.cc (hash_path_name): Fix handling of relative names. Make case insensitive. * path.h (suffix_info): Use initializers. * pinfo.h (_pinfo): Avoid initializers for null case. * resource.cc (fill_rusage): Zero rest of rusage structure. * security.cc (set_process_privileges): Don't reopen parent process. Just use hMainProc. * signal.cc (signal): Track when a signal handler has been used. (sigaction): Ditto. * sigproc.cc (pchildren): Use default initializer. (zombies): Ditto. (sigproc_terminate): Avoid closing handles that will be closed on exit anyway. (wait_sig): Send signal to "parent" on EXECing, not FORKing. (wait_subproc): Send SIGCHLD here rather than in proc_wait to avoid potential muto conflicts. * sigproc.h (sigthread): Don't initialize to zero. It's the default. * spawn.cc (spawn_guts): Fill in resources from exec parent prior to termination. * sync.h (muto): Don't initialize to zero. * syscalls.cc (close_all_files): Use one lock around entire loop and call fhandler close/release stuff directly. (_read): Don't use ready_for_read if there are not signal handlers active. * dcrt0.cc (dll_crt0_1): Fix display of "title". (do_exit): Use pinfo exit method to exit. (__api_fatal): Ditto. * exceptions.cc (signal_exit): Ditto. * fork.cc (fork_child): Remove debugging stuff. Use pinfo_fixup_after fork in place of exec_fixup_after_fork. * pinfo.cc (pinfo_fixup_after_fork): New method. (pinfo_fixup_in_spawned_child): Ditto. (_pinfo::exit): New method. (_pinfo::init): Remove recursion. Detect pathological case where pinfo structure already exists for new pid. * pinfo.h (_pinfo): Reorganize slightly. Add new method and new function declarations. * sigproc.cc (proc_exists): Previous simplification was a little to simple. Try harder to detect if a process exists. (proc_terminate): Use PID_EXITED setting to determine if process is still around. (WFSO): Remove debugging statement. (WFMO): Ditto. * spawn.cc (exec_fixup_after_fork): Eliminate. (spawn_guts): Always set old_title to NULL. Is it really needed? Move hexec_proc to pinfo.cc. Call pinfo_fixup_in_spawned_child to eliminate handle link after a spawn. * include/sys/cygwin.h: Remove PID_NOT_IN_USE. Add PID_EXITED.
2000-08-22* winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h filesChristopher Faylor1-1/+3
only in sources which require them. * Makefile.in: Generate dependencies with -MD option.
2000-08-22* cygerrno.h: New file. Use this throughout whenever errno manipulation isChristopher Faylor1-0/+1
required. * errno.cc: Use DWORD to hold Windows errors. (geterrno_from_win_error): New function. (seterrno_from_win_error): Use geterrno_from_win_error to convert supplied windows error (suggested by Corinna Vinschen). * path.cc (symlink_info): Add error element. * path.cc (path_conv::check): Remove errno setting. Use new symlink_info errno element to set path_conv error, where appropriate. (symlink_info::check): Set error element rather than attempting to manipulate errno. Add more checks for trailing / and /.. even though they are currently useless. Avoid setting EINVAL. * path.cc (normalize_posix_path): Correct check for trailing /.