Commit Graph

1805 Commits

Author SHA1 Message Date
Corinna Vinschen dae01cb624 * grp.cc (getgroups32): Don't use access token of current user when
retrieving group info for another user.
2002-11-14 10:28:55 +00:00
Christopher Faylor 052990e6b3 * dll_init.cc (dll_list::detach): Eliminate reliance on passed in dll address.
Infer from module of caller instead.
(cygwin_detach_dll): Ignore dll_index argument.
* dll_init.h (dll_list::detach): Reflect argument change above.
2002-11-14 04:29:39 +00:00
Christopher Faylor a2dea5c333 * ioctl.cc (ioctl): Always print ioctl results, even when it's a tty.
* winsup.h (low_priority_sleep): Declare.
2002-11-14 02:15:23 +00:00
Christopher Faylor 40e4147f4e * winsup.h (low_priority_sleep): Declare. 2002-11-13 22:08:05 +00:00
Christopher Faylor c0a02a4b42 * miscfuncs.cc (low_priority_sleep): New function. Use throughout where code
is supposed to be giving up time slice.
* fhandler_console.cc (fhandler_console::read): Switch button 2/3 output escape
sequences to be consistent with xterm.
2002-11-13 19:36:12 +00:00
Corinna Vinschen 7a11fe607e * syscalls.cc (chmod): Simplify conditional.
* sec_helper (cygsid::getfromstr): Reorganize to remove
	calls to strcpy and strtok_r.
	(cygsid::getfromgr): Change type to __uid32_t instead of int.
	Keep only the allow_ntsec branch. Never call LookupAccountSid
	which calls PDCs, simply return -1 in case of failure.
	Use cygsid == instead of calling EqualSid and remove test
	for NULL psid.
	* security.h: Declare cygsid::getfromgr as __uid32_t.
2002-11-12 15:51:11 +00:00
Corinna Vinschen 7922485391 * net.cc: Run indent.
* autoload.cc (GetIfEntry): Add symbol.
	* net.cc (get_2k_ifconf): Get the interface entries with the GetIfEntry
	call intead of the GetIfTable call. Clean-up multiple IP address naming.
2002-11-10 13:43:26 +00:00
Christopher Faylor ec61cd7268 correct date 2002-11-10 00:51:25 +00:00
Christopher Faylor 49f7ea1675 * fhandler.h (class fhandler_pipe): New ioctl() method.
* pipe.cc (fhandler_pipe::ioctl): New.
2002-11-09 03:17:40 +00:00
Christopher Faylor 783747919d * fhandler_serial.cc (fhandler_serial::ioctl): Fix typo. 2002-11-07 18:47:21 +00:00
Corinna Vinschen cad2c685b4 * include/cygwin/fs.h: New file.
* include/cygwin/hdreg.h: New file.
	* fhandler_floppy.cc (fhandler_floppy::ioctl): Add implementation for
	HDIO_GETGEO, BLKGETSIZE, BLKGETSIZE64, BLKRRPART and BLKSSZGET ioctls.
2002-11-07 14:16:29 +00:00
Corinna Vinschen 59ba222ca2 * fhandler_socket.cc (fhandler_socket::ioctl): Return correct flags
for loopback interface when name is given on input instead of address.
2002-11-07 10:22:26 +00:00
Corinna Vinschen 0be1147408 * cygwin.din: Export fseeko() and ftello().
* include/cygwin/version.h: Bump API minor version.
2002-11-07 09:08:40 +00:00
Christopher Faylor f7618386af minor reformat 2002-11-07 03:41:16 +00:00
Christopher Faylor c8fae3c17b * fhandler_console.cc (keytable[]): Revert previous change. It would break too
many things.
2002-11-07 03:35:02 +00:00
Christopher Faylor 6c2d501195 * fhandler_console.cc (keytable[]): Redefine F1 - F5 to something a little more
sensical.
2002-11-07 03:16:08 +00:00
Christopher Faylor c759d297b2 * syscalls.cc (getutid): Use UT_IDLEN where appropriate. 2002-11-07 02:50:50 +00:00
Christopher Faylor 4248a1d7f8 * include/cygwin/version.h: Bump API minor number for below export.
* cygwin.din (pututline): New exported function.
* syscalls.cc (login): Use pututiline().
(setutent): Open utmp as read/write.
(endutent): Check if utmp file is open.
(utmpname): call endutent() to close current utmp file.
(getutid): Enable all cases, use strncmp() to compare ut_id fields.
(pututline): New.
* tty.cc (create_tty_master): Set ut_pid to current pid.
2002-11-07 02:19:52 +00:00
Christopher Faylor 2035f402e4 * fhandler_serial.cc (fhandler_serial::ioctl): Don't try to figure out if OS
has the capability to retrieve RTS/CTS.  Just set default values if
DeviceIoControl fails.  (suggested by Sergey Okhapkin)
2002-11-06 01:50:32 +00:00
Christopher Faylor 087a28bf5e * fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for
minchars.
(fhandler_serial::ioctl): Set errno if the ClearCommError fails.
(fhandler_serial::tcsetattr): Use correct value for vmin_.
(fhandler_serial::tcgetattr): Ditto.
2002-11-05 23:15:04 +00:00
Christopher Faylor 2f5e9ace2e * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
WSARecvFrom with fromlen = NULL.
2002-11-05 16:49:58 +00:00
Christopher Faylor ef1bf288df * pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin. 2002-11-05 04:52:52 +00:00
Christopher Faylor d263732238 * pinfo.cc (_pinfo::commune_send): Set priority low when sleeping, waiting for
commune completion so that we don't spin waiting for lower priority processes.
2002-11-05 04:43:02 +00:00
Christopher Faylor 73f7245be2 revert erroneous checkins 2002-11-05 04:24:48 +00:00
Christopher Faylor 5806add291 * sigproc.cc (WAIT_SIG_PRIORITY): Bump to THREAD_PRIORITY_TIME_CRITICAL. 2002-11-05 04:23:41 +00:00
Christopher Faylor f57289609b * pinfo.cc (_pinfo::commune_send): Initialize buffer or suffer random crashes. 2002-11-05 03:39:25 +00:00
Christopher Faylor 8948b6585d * fhandler_process.cc (fhandler_process::fill_filebuf): Deal with error
condition from cmdline retrieval.
2002-11-05 03:21:32 +00:00
Christopher Faylor 43a299881f * sigproc.cc (WAIT_SIG_PRIORITY): Bump to highest priority. 2002-11-05 02:58:10 +00:00
Christopher Faylor d4e7dfae8e * include/cygwin/version.h: Bump DLL minor number. 2002-11-04 05:08:15 +00:00
Christopher Faylor b6183403ae * fhandler_serial.cc (fhandler_serial::ioctl): Reformat. Set errno
appropriately.  Exit from the bottom.  Correctly deal with third argument for
TCFLSH.  (Suggested by Sergey Okhapkin)
2002-11-04 04:09:14 +00:00
Christopher Faylor 2601ab5778 * fhandler_tty.cc (fhandler_tty_slave::ioctl): Do nothing if the new window
size is equal to the old one.  Send SIGWINCH if slave connected to a pseudo
tty.
(fhandler_pty_master::ioctl): Do nothing if the new window size is equal to the
old one.
2002-11-04 01:10:38 +00:00
Christopher Faylor 3593c18730 space 2002-11-02 03:31:15 +00:00
Pierre Humblet fe5ba95245 2002-10-31 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.cc (fhandler_base::open): Verify pc isn't NULL.
2002-11-01 01:47:29 +00:00
Christopher Faylor bfb1f3e04f * include/cygwin/version.h: Bump DLL minor number. 2002-10-30 21:06:21 +00:00
Christopher Faylor 831d6fa520 * external.cc (cygwin_internal): Implement CW_CMDLINE.
* pinfo.h (SIGCOMMUNE): New signal type.
(commune_result): New structure for commune functions.
(picom): New enum for commune functions.
(_pinfo::hello_pid): New.  Pid who's communicating with me.
(_pinfo::tothem): New.  Handle of communicating pipe.
(_pinfo::fromthem): Ditto.
(_pinfo::commune_recv): Declare.
(_pinfo::commune_send): Declare.
(_pinfo::alive): Declare.
(_pinfo::cmdline): Declare.
(_pinfo::lock): Declare.
* pinfo.cc (set_myself): Initialize new _pinfo lock.
(_pinfo::alive): Define.  Determines if process still exists.
(_pinfo::commune_recv): Define.  Receive info from another cooperating process.
(_pinfo::commune_send): Define.  Send info to another cooperating process.
(_pinfo::cmdline): Define.  Determine command line of a given process.
* include/sys/cygwin.h (CW_CMDLINE): Define.
*sigproc.cc (talktome): Communicate with any processes who want to talk to me.
(wait_sig): Honor __SIGCOMMUNE.
* fhandler.cc (fhandler_virtual::fixup_after_exec): Declare.
* fhandler_proc.cc: Use malloc/free/realloc throughout rather than cmalloc
since buffers don't need to be propagated to subprocesses.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
(fhandler_virtual::fixup_after_exec): Define.
* fhandler_process.cc: Ditto for malloc/free/realloc.
(process_listin): Add "cmdline".
(fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE.
* miscfuncs.cc (isalpha_array): New array populated with xor values for alpha
characters to switch from one case to another.
* string.h (cygwin_strcasematch): New asm implementation of case match.
* string.h (cygwin_nstrcasematch): New asm implementation of counted case
match.
2002-10-30 21:05:18 +00:00
Christopher Faylor 950a7601d1 * pwdgrp.h (pwdgrp_read::open): Compare fh to INVALID_HANDLE_VALUE. 2002-10-24 14:33:13 +00:00
Christopher Faylor 281e3b2423 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Nevermind. Revert
everything to previous state wrt ntsec and exec bits.
2002-10-23 02:32:34 +00:00
Christopher Faylor 082512aea1 * shared.cc (shared_info::initialize): Use correct value for version
comparison.
* include/cygwin/version.h (CYGWIN_VERSION_MAGIC): Use all of a DWORD for magic
calculation.
2002-10-23 02:20:38 +00:00
Christopher Faylor 046a4e718e * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only do the
executable thing for #! scripts since .exe files wouldn't be executable in
ntsec case regardless.
2002-10-22 21:35:21 +00:00
Christopher Faylor 7dcbb978e0 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always consider
.exe files and '#!' shell scripts to be executable.
2002-10-22 20:41:31 +00:00
Christopher Faylor d525130f04 * cygthread.cc (cygthread::exiting): New variable.
(cygthread::initialized): Delete.
(cygthread::stub): Use exiting variable to determine when to exit.
(cygthread::runner): Delete.
(cygthread_protect): New variable.
(cygthread::init): Don't start runner thread.  Initialize muto for list
protection.
(cygthread::freerange): Return pointer to cygthread.
(cygthread::operator new): Change logic to start threads on an as-needed basis.
(cygthread::detach): Don't zero id.
(cygthread::terminate): Don't kill any executing threads.  Just set exiting
flag.
* cygthread.h (cygthread): Reflect above changes.
* dcrt0.cc (dll_crt0_1): Move cygthread initialization later.
* fork.cc (fork_child): Do fdtab fixup after dll fixup or (apparently) winsock
may allocate memory in dll load address.
2002-10-22 20:16:31 +00:00
Christopher Faylor 329b9ead3e * sec_helper.cc (cygsid::get_id): If the sid matches a sid stored in
cygheap->user, return the uid or gid from myself.
* security.cc (alloc_sd): If gid == myself->gid, return the group sid from
cygheap->user.  Remove the test for uid == original_uid, which is
counter-productive.
2002-10-22 16:22:10 +00:00
Christopher Faylor 1cc651ecaf * cygheap.cc (cygheap_fixup_in_child): Use user_heap element in cygheap.
(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.
2002-10-22 16:18:55 +00:00
Christopher Faylor 5ec14fe40a Change _function() to function() throughout.
* 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.
2002-10-21 01:00:58 +00:00
Christopher Faylor ccefaab1d5 * cygthread.cc (cygthread::stub): Fix typo.
(cygthread::terminate): Don't zero thread handle prior to using it.
2002-10-20 18:17:43 +00:00
Christopher Faylor cf70a7e372 fix typo 2002-10-20 04:53:30 +00:00
Christopher Faylor 818089d9c8 missed checkin 2002-10-20 04:46:31 +00:00
Christopher Faylor da17f96378 fix typo 2002-10-20 04:42:13 +00:00
Christopher Faylor bfda61d419 * sigproc.cc (wait_sig): Remove obsolete sigchld logic. 2002-10-20 04:17:59 +00:00
Christopher Faylor d25c187f12 Rename _kill() to kill() throughout. Rename _raise() to raise() throughout.
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.
2002-10-20 04:15:50 +00:00
Christopher Faylor 1fc4df5a69 * fork.cc (fork_child): Move pinfo fixup later to attempt some minor gains from
concurrency from cythread::init.
2002-10-19 18:29:37 +00:00
Christopher Faylor a85860b5c8 * dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not forking.
* 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.
2002-10-19 00:57:06 +00:00
Christopher Faylor 824166e620 * cygthread.cc: Bump number of cygthreads up to accommodate applications which
use ttys.
2002-10-19 00:35:20 +00:00
Christopher Faylor 60bc7b5977 * fork.cc (fork_child): Move mmap initialization.
* 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.
2002-10-18 23:52:59 +00:00
Christopher Faylor 5d8c2b592d * thread.cc (verifyable_object_isvalid): Test for a valid object pointer before
testing for static ptr.
2002-10-18 14:02:40 +00:00
Christopher Faylor abb58a6d3f * dtable.cc (dtable::init_std_file_from_handle): Force "devices" to always be
in binary mode.  Temporary fix until ssh is rebuilt?
2002-10-18 01:28:48 +00:00
Christopher Faylor fef1edbc9a * dtable.cc (dtable::set_file_pointers_for_exec): New function.
* dtable.h (dtable::set_file_pointers_for_exec): Declare new function.
* spawn.cc (spawn_guts): Call dtable::set_file_pointers_for_exec to set
pointers to EOF when execing non-cygwin applications.
2002-10-17 17:45:09 +00:00
Robert Collins e9350b6575 2002-10-17 Robert Collins <rbtcollins@hotmail.com>
* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare.
        * thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement.
        (pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid
        unneeded SEGV's during debugging.
2002-10-17 08:44:18 +00:00
Robert Collins 841cf30bc3 2002-10-17 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (verifyable_object_isvalid): Test for static object first.
2002-10-17 08:31:30 +00:00
Christopher Faylor 207daf0f11 * fhandler_tty.cc (fhandler_tty_slave::read): Attempt #527 to properly
implement VMIN/VTIME.
2002-10-16 04:54:08 +00:00
Christopher Faylor 6c6c3b90e9 * shared.cc (open_shared): Revert to "old" method for shared memory location if
!wincap.needs_memory_protection.
* wincap.cc: Implement needs_memory_protection throughout.
* wincap.h: Ditto.
2002-10-15 17:04:20 +00:00
Christopher Faylor fdb28b5e5f * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(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.
2002-10-15 07:03:45 +00:00
Christopher Faylor 54030e2146 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(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.
2002-10-14 20:25:52 +00:00
Christopher Faylor 969203ce91 * cygthread.cc (cygthread::stub): Reintroduce clearing of __name but do it
before SetEvent to eliminate a race.
(cygthread::terminate): Accumulate list of threads to check for termination and
call WaitForMultipleObjects on list rather than waiting for each thread
individually.
* sigproc.cc (subproc_init): Zap hwait_subproc thread handle since it is no
longer used.
* spawn.cc (spawn_guts): Fix so that cygthread::terminate is *really* called
only for exec.
2002-10-14 03:51:44 +00:00
Christopher Faylor a7a5d0ba37 * cygthread.cc (cygthread::stub): Don't zero __name here. That introduces a
race.
2002-10-14 02:37:49 +00:00
Christopher Faylor bac610ad86 * include/cygwin/version.h: Bump DLL minor number. 2002-10-14 00:06:33 +00:00
Christopher Faylor 3f5046a540 * cygthread.cc (cygthread::stub): Don't create event for long-running threads.
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.
2002-10-13 18:16:33 +00:00
Christopher Faylor b01ff453d9 * window.cc (gethwnd): Use SetThreadPriority method. 2002-10-10 05:31:43 +00:00
Christopher Faylor 2a3bf3e2ce * Makefile.in (new-cygwin1.dll): Reorganize library order.
* dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads are
terminated during vfork.
* sigproc.cc (proc_terminate): Grab proc lock prior to signalling subproc
thread exit to avoid an extra "wait-for-thread-to-exit".
2002-10-10 05:23:23 +00:00
Christopher Faylor c4ec64d76b * cygthread.cc (cygthread::stub): Don't create an event for "cygself" threads.
Assume that they exit via an ExitThread call.
* cygthread.h (cygthread::SetThreadPriority): New function.
(cygthread::zap_h): New function.
* dcrt0.cc (do_exit): Move cygthread::terminate earlier and establish
exit_state guard.
* fhandler.h (fhandler_tty_master::output_thread): Delete.
* fhandler_tty.cc (fhandler_tty_master::init): Set priority for threads via
method.  Zap handles when done.  Don't treat process_output specially.
(process_output): Call ExitThread directly.
(fhandler_tty_master::fixup_after_fork): Don't worry about output_thread.
(fhandler_tty_master::fixup_after_exec): Ditto.
* sigproc.cc (proc_terminate): Don't detach from hwait_subproc.  Just let it
exit.
(sigproc_init): Close thread handle after initialization.
(wait_sig): Use GetCurrentThread() as SetThreadPriority call rather than
*event* handle.  Call ExitThread directly on termination.
(wait_subproc): Call ExitThread directly on termination.
* tty.cc (tty_list::terminate): Don't attempt t detach from output_thread.
2002-10-09 05:55:40 +00:00
Christopher Faylor 7da53596cf * cygheap.cc (dup_now): Make fatal error a little more informative.
(cygheap_setup_for_child): Detect when default size of shared region is less
than the current size and allocate that much.
(_cbrk): Just return NULL on inability to allocate.
(_cmalloc): Ditto.
* cygheap.h (CYGHEAPSIZE): Change size to reflect newer, tinier fhandler sizes.
* spawn.cc (av::error): New element, reflects potential errno from cmalloc.
(av::~av): Don't free NULL pointers.
(av::replace0_maybe): Detect out-of-memory conditions.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): Set errno and return if argv creation ran into problems.
* fhandler.h (fhandler_union): Change member names to something safer.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Always set
fhandler_console::dev_state regardless of whether shared region is initialized.
* cygthread.cc (cygthread::runner): Use ExitThread rather than return
(planning for future).
2002-10-09 04:08:05 +00:00
Christopher Faylor 3c66c0707c * fhandler.h (dev_console): New class.
(fhandler_console::dev_state): New class element.
(fhandler_console::mouse_aware): Use dev_state element.
(fhandler_console::get_tty_stuff): Declare new function.
* fhandler_console.cc: Use dev_state fhandler_console element, throughout.
(fhandler_console::get_tty_stuff): Move to fhandler_console class.  Incorporate
dev_console information.  Move constructor stuff here.
2002-10-08 06:16:16 +00:00
Christopher Faylor 9655ff2680 * dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard open
behavior with files redirected from stdin/stdout/stderr, i.e., fmode settings
take precedence over mount settings.
2002-10-08 02:44:35 +00:00
Christopher Faylor dd76747b8e * dtable.cc (unknown_file): New variable.
(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-10-07 20:06:16 +00:00
Christopher Faylor bc63ea872c * dcrt0.cc (do_exit): Call DisableThreadLibraryCalls since we don't need to
track thread detaches.
* init.cc (dll_entry): Reorganize slightly.  Fix api_fatal message.
2002-10-07 04:12:54 +00:00
Christopher Faylor 09663d31bb * cygthread.cc (cygthread::stub): Very minor cleanup.
(cygthread::stub): Report overflows in cygwin thread pool when DEBUGGING is on
and special environment variable is not set.
(cygthread::terminate): Set event only when event actually exists.
* exceptions.cc (signal_exit): Set priority of main thread to low before
setting current thread to high.
2002-10-06 01:01:58 +00:00
Christopher Faylor f8f63f9bc1 whitespace 2002-10-05 17:47:25 +00:00
Robert Collins 404f35cb5c 2002-10-01 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining
        why.
        (pthreadNull::_instance): Copy on fork. Absolutely no state exists
        in pthreadNull.
2002-09-30 21:06:05 +00:00
Conrad Scott 18be975d30 * cygserver_transport_pipes.cc (transport_layer_pipes::accept):
Remove trailing \n from debug_printf.
2002-09-30 18:31:56 +00:00
Christopher Faylor 6cae97d5dc whitespace 2002-09-30 15:17:44 +00:00
Christopher Faylor 66dca8bb0d * thread.cc (pthread_mutex::initMutex): Remove \n from api_fatal. 2002-09-30 15:11:55 +00:00
Christopher Faylor bd2b5664a1 * thread.cc (pthread::precreate): Use explicit "no inherit" option when
creating mutex.
(pthread_mutex::nativeMutex::init): Ditto.
(semaphore::semaphore): Ditto.
2002-09-30 15:05:00 +00:00
Christopher Faylor e58273df45 * thread.cc (pthread_key::keys): Do not copy on fork.
(pthread_mutex::mutexInitializationLock): Ditto.
(pthreadNull::_instance): Ditto.
2002-09-30 15:00:52 +00:00
Christopher Faylor 63e5f2006d * exceptions.cc (unused_sig_wrapper): Still need additional level of
indirection when setting errno.
2002-09-30 14:18:43 +00:00
Robert Collins 06175d0acd 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_mutex::initMutex): Use the wrapper init call.
        (pthread_mutex::nativeMutex::init): Implement.
        (pthread_mutex::nativeMutex::lock): Ditto.
        (pthread_mutex::nativeMutex::unlock): Ditto.
        (pthread_mutex::init): Use the wrapper lock and unlockcalls.
        * thread.h (pthread_mutex): Move mutexInitializationLock into a
        nativeMutex wrapper class.
2002-09-30 11:43:43 +00:00
Christopher Faylor f70389b541 Remove \n from calls to strace class printfs throughout. 2002-09-30 04:35:18 +00:00
Christopher Faylor da77b2c84c remove newline 2002-09-30 04:27:32 +00:00
Christopher Faylor e7733defb9 * exceptions.cc (unused_sig_wrapper): Accommodate newer compilers. 2002-09-30 04:26:52 +00:00
Christopher Faylor f789fbbf35 * security.cc (allow_ntsec): Default to zero.
* environ.cc (environ_init): Set allow_ntsec to TRUE by default, assuming OS
allows it.
2002-09-30 03:05:13 +00:00
Christopher Faylor 9d1e72a175 * environ.cc (environ_init): Avoid a compiler warning.
* path.cc (path_conv::check): Ditto.
* path.h (path_conv::operator int): Ditto.
* regex/engine.c: Ditto throughout.
* regex/regcomp.c: Ditto throughout.
* regex/regexec.c: Ditto throughout.
2002-09-30 02:51:22 +00:00
Christopher Faylor 79ed43004f * thread.cc: Use "%E" in *_printf throughout rather than calling GetLastError.
GNUify comments.
(__pthread_mutex_lock): Don't return error on EBUSY since that just means that
the mutex has already been initialized.
2002-09-30 01:19:45 +00:00
Christopher Faylor 881ffcb478 GNUify slightly. 2002-09-29 23:56:57 +00:00
Robert Collins eb208df05a 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc (pthread_mutex_init): Use new pthread_mutex::init.
        * thread.cc: Change __pthread_mutex_init to pthread_mutex::init
        throughout.
        (MTinterface::Init): Initialise pthread_mutex support.
        (pthread_mutex::mutexInitializationLock): Instantiate.
        (pthread_mutex::initMutex): New method.
        (__pthread_cond_dowait): Don't dereference untrusted pointers.
        Use the new pthread_mutex::init method.
        (__pthread_condattr_init): Don't dereference untrusted pointers.
        (__pthread_mutex_init): Rename to pthread_mutex::init.
        Lock and release mutexInitializationLock to prevent races on
        mutex initialisation.
        * thread.h (pthread_mutex::initMutex): New method, initialise
        pthread_mutex supporting state on process initialisation.
        (pthread_mutex::init): Initialise a single mutex.
        (pthread_mutex::mutexInitializationLock): A win32 mutex for
        syncronising pthread mutex initialisation.
        (__pthread_mutex_init): Remove this.
2002-09-29 23:47:45 +00:00
Christopher Faylor 4d8eba164f Add missing ChangeLog entry. 2002-09-29 03:15:55 +00:00
Christopher Faylor aea1f301fc * cygthread.h (cygthread::terminate): Declare new function.
(cygthread::initialized): Change to 'int'.
* cygthread.cc (cygthread::stub): Exit thread if initialized < 0.
(cygthread::new): Ditto.
(cygthread::runner): Ditto.  Set initialized using xor to preserve sign.
(cygthread::terminate): New function.
* dcrt0.cc (do_exit): Call cygthread::terminate.
2002-09-29 02:19:35 +00:00
Robert Collins da6a08decb 2002-09-27 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::run_destructor): Run_destructor is not
       const as it needs to set the key value.
       * thread.h (pthread_key::run_destructor): Ditto.

2002-09-27  Robert Collins <rbtcollins@hotmail.com>

       * thread.cc (pthread_key::run_destructor): Follow opengroup algorithm.
       I.e. only run the destructor NON-NULL key values, and reset the key
       to NULL before running the destructor. Reported by Thomas Pfaff.
2002-09-27 15:08:50 +00:00
Christopher Faylor 961973e7a4 * cygrun.c (main): Fix setting of CYGWIN environment variable.
* Makefile.in: Remove linking of unnecessary libraries.
2002-09-25 13:53:46 +00:00
Christopher Faylor 38c77307c5 * fhandler_proc.cc (format_process_stat): make ctty a real device number.
(format_process_status): use effective uid/gid as real and saved uid/gid.
2002-09-25 12:24:23 +00:00
Corinna Vinschen f4b098d95e * errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
EOVERFLOW.
	(_sys_errlist): Add entries for EILSEQ and EOVERFLOW.
	(strerror): Ditto.
	* mmap.cc (map_map): Set errno in case of error.
	(mmap64): Remove setting errno explicitely to ENOMEM.
2002-09-24 14:17:50 +00:00
Corinna Vinschen 6b579509ea * mmap.cc (map_map): Add debug output.
(mmap64): Evaluate gran_len correctly even if offset isn't 0.
2002-09-24 13:48:07 +00:00