Commit Graph

3497 Commits

Author SHA1 Message Date
Christopher Faylor 5a0826c3f8 * fhandler.h (fhandler_console::fixup_after_fork_exec): Declare new function.
(fhandler_console::fixup_after_fork): Use fixup_after_fork_exec.
(fhandler_console::fixup_after_exec): Ditto.
* fhandler_console.cc (fhandler_console::fixup_after_fork): Delete definition.
(fhandler_console::fixup_after_fork_exec): Rename from fixup_after_exec.
* pinfo.cc (_pinfo::set_ctty): Don't play with console count here.
* syscalls.cc (close_all_files): Don't close cygheap ctty if hExeced since the
child will be copying information from us.
(setsid): Use myctty() rather than raw ctty #.
2005-11-14 05:36:16 +00:00
Christopher Faylor 59297e0464 * cygheap.h (init_cygheap::manage_console_count): Declare new function.
(init_cygheap::console_count): Renamed from open_fhs.  Make private.
* cygheap.cc (init_cygheap::manage_console_count): Define new function.
* dtable.cc (dtable::fixup_after_exec): Always call fixup_after_exec on
elements of fd even when they are about to be closed.
* fhandler.h (report_tty_counts): Remove open_fhs from debugging output.
* fhandler_console.cc (fhandler_console::open): Use manage_console_count rather
than manipulating count directly.
(fhandler_console::close): Ditto.
(fhandler_console::fixup_after_fork): Ditto.
(fhandler_console::fixup_after_exec): Ditto.  Don't close handles if
close_on_exec.
* fhandler_tty.cc (fhandler_tty_slave::open): Use manage_console_count() rather
than manipulating count directly.  Reflect change in arguments to
report_tty_counts().
(fhandler_tty_slave::close): Ditto for both.
(fhandler_tty_slave::dup): Ditto for both.
(fhandler_tty_slave::ioctl): Use myctty() rather than raw ctty #.
(fhandler_tty_slave::fixup_after_fork): Reflect change in arguments to
report_tty_counts().
(fhandler_tty_master::init_console): Use manage_console_count() rather than
manipulating count directly.
* fhandler_clipboard.cc (fhandler_dev_clipboard::fixup_after_exec): Don't
perform any operations if close_on_exec.
* fhandler_dsp.cc (fhandler_dev_dsp::fixup_after_exec): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::fixup_after_exec): Ditto.
* fhandler_serial.cc (fhandler_serial::fixup_after_exec): Ditto.
* pinfo.h (_pinfo::_ctty): Declare new function.
(myctty): Declare new macro.
(__ctty): Declare new macro.
* pinfo.cc (_pinfo::_ctty): Define new function.
(_pinfo::set_ctty): Use manage_console_count() rather than manipulating count
directly.
* signal.cc (kill_pgrp): Use myctty() and __ctty() macros rather than raw ctty
#.
* syscalls.cc (setsid): Ditto.  Use manage_console_count() rather than
manipulating count directly.
2005-11-14 04:28:45 +00:00
Corinna Vinschen 6ba3f6bb2d * fhandler_socket.cc (fhandler_socket::recvfrom): Just return 0 (EOF)
in case of WSAESHUTDOWN.
	(fhandler_socket::recvmsg): Ditto.
	* poll.cc (poll): Set revents to POLLIN instead of POLLHUP. Add comment.
2005-11-13 16:24:40 +00:00
Christopher Faylor ecb908f699 * cygheap.h (init_cygheap::_gtod): Remove.
* cygwin.din: Export clock_getres and clock_setres.
* hires.h (hires_ms::minperiod): Delete declaration.
(hires_ms::began_period): Ditto.
(hires_ms::prime): Make void.
(hires_ms::resolution): Just define here.
(hires_ms::usecs): Remove unneeded argument.
(gtod): Redeclare as a variable.
* timer.cc (timer_thread): Eliminate argument to gtod.usecs().
(timer_tracker::gettime): Ditto.
(timer_tracker::settime): Ditto.
* times.cc (gettimeofday): Ditto.
(hires_ms::began_period): Delete declaration.
(hires_us::prime): Remove debugging.
(hires_ms::prime): Make void.  Eliminate period stuff.
(hires_ms::usecs): Eliminate argument to gtod.usecs().
(hires_ms::resolution): New function.
(clock_getres): Ditto.
(clock_setres): Ditto.
* version.h: Bump API version to 143.
* include/cygwin/time.h: New file.
2005-11-11 16:42:15 +00:00
Christopher Faylor b600843ae4 * times.cc (hires_ms::prime): Comment out call to timeBeginPeriod for now.
(hires_ms::usecs): Call prime if haven't called began_period().
* param.h: Don't define stuff that is already defined in endian.h.
2005-11-11 04:07:30 +00:00
Christopher Faylor c845f0c182 * include/endian.h: Remove USE_BSD ifdef since it is never defined on Cygwin. 2005-11-10 21:17:15 +00:00
Corinna Vinschen 11b2d6cf16 Fix dates. 2005-11-10 10:36:45 +00:00
Corinna Vinschen 2d5067835e * syslog.cc (setlogmask): Don't mask the mask.
(vsyslog): Fix priority check.
2005-11-10 10:34:49 +00:00
Corinna Vinschen 03ea3f832e * include/cygwin/signal.h: Add missing sigrelse prototype. 2005-11-10 09:12:22 +00:00
Christopher Faylor 8eb445cfd3 * fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into the
middle of buf.
2005-11-08 23:25:55 +00:00
Christopher Faylor 14f7b567cc fix entry 2005-11-08 22:08:59 +00:00
Christopher Faylor 42cd8528aa * memmem.cc: New file.
* include/cygwin/version.h: Bump API version number to 142.
* cygwin.din: Export memmem.
2005-11-08 22:08:39 +00:00
Christopher Faylor 1f99dd3ecf * environ.cc (spenvs): Make "SYSTEMDRIVE" an "always export". 2005-11-08 16:32:09 +00:00
Corinna Vinschen 39f7ae0616 * times.cc (futimes): Redirect to utimes_worker if given file
descriptor is opened R/O.
2005-11-07 17:08:08 +00:00
Christopher Faylor 2b91e0dac4 * dcrt0.cc (dll_crt0_0): Initialize security data first so that it can be used
by subsequent handle creation.
2005-11-06 14:02:33 +00:00
Christopher Faylor 72319550c1 * cygheap.h (init_cygheap::_gtod): New hires_ms element.
* hires.h (hires_ms::minperiod): Remove static designation.
(hires::began_period): New field.
* signal.cc: Include headers required for cygheap.h now that gtod lives in the
cygheap.
* timer.c: Ditto.
* times.cc (gtod): Delete variable.
(gtod::minperiod): Ditto.
(gtod::began_period): Define.
(hires_ms::prime): Add more debugging output.  Call timeBeginPeriod only when
!began_period.
2005-11-04 20:45:56 +00:00
Christopher Faylor f359a29fc8 * times.cc (hires_ms::prime): More debugging.
(hires_ms::usecs): Ditto.
2005-11-04 17:38:32 +00:00
Christopher Faylor 86548162b0 * times.cc (stupid_printf): Define and use throughout -- temporarily. 2005-11-04 02:01:45 +00:00
Christopher Faylor 314f743e1e * times.cc (hires_ms::prime): Add lots of temporary debugging output. 2005-11-03 14:59:23 +00:00
Christopher Faylor 369adcf72f * times.cc (hires_ms::minperiod): Make copy-on-fork.
(gettimeofday): Remove temporary debugging.
(hires_us::prime): Add lots of temporary debugging output.
2005-11-03 02:41:51 +00:00
Christopher Faylor 1c2812f80e * times.cc (gettimeofday): Add temporary debugging output. 2005-11-02 18:28:40 +00:00
Christopher Faylor b7bb9f5fde * include/sys/cygwin.h: Define CYGWIN_SIGNAL_STRING.
* exceptins.cc (sigpacket::process): Send a _CYGWIN_SIGNAL_STRING to gdb if the
process is being debugged.  A WIP.
2005-11-01 05:55:30 +00:00
Christopher Faylor 0dc249751d * exceptions.cc (signal_exit): Eliminate setting of main thread priority since
process lock should make that unnecessary.
* fork.cc (stack_base): Eliminate.
(frok::parent): Subsume stack_base and just set stack stuff here.  Report on
priority class in debugging output.
* spawn.cc (spawn_guts): Report on priority class in debugging output.
2005-10-29 20:33:59 +00:00
Christopher Faylor f02b22dcee * fork.cc (frok::child): Change order of cleanup prior to return.
(fork): Save more of the stack.
* gendef: Fix some comments.
* sigproc.cc (wait_sig): Clarify debug output.
2005-10-29 15:19:34 +00:00
Christopher Faylor c85263884a * child_info.h (CHILD_INFO_MAGIC): Reset. 2005-10-29 15:05:55 +00:00
Christopher Faylor 6573722005 * pinfo.cc (_pinfo::fds): Lock fdtab while enumerating. 2005-10-24 15:42:14 +00:00
Corinna Vinschen 6485bf0b33 * spawn.cc (spawn_guts): Don't leave the function with return inside
pthread cleanup brackets.
2005-10-24 15:17:54 +00:00
Christopher Faylor 16bbf0cc57 * cygheap.h (cygheap_fdenum): Remove start_fd stuff.
(cygheap_fdenum::rewind): Ditto.
* pipe.cc (fhandler_pipe::open): Lock fdtab while enumerating.
* times.cc (utimes_worker): Ditto.
2005-10-24 15:09:07 +00:00
Christopher Faylor 0f9a8fc652 add missing ChangeLog entry 2005-10-24 00:02:05 +00:00
Christopher Faylor 82c925af80 * cygheap.h (cygheap_fdenum::cygheap_fdenum): Record locked state or suffer
deadlocks.
(class locked_process): Move to another header.
* sync.h (lock_process): Define here.
* cygtls.cc (_cygtls::fixup_after_fork): Reset spinning state as well as
stacklock state.
* dcrt0.cc (lock_process::locker): Define.
(dtable::lock_cs): Delete.
* dtable.cc (dtable_init): Eliminate call to init_lock().
(dtable::fixup_after_fork): Ditto.
(dtable::init_lock): Delete definition.
* dtable.h (dtable::init_lock): Delete declaration.
(dtable::lock): Use process lock rather than dtable-specific lock.
(dtable::unlock): Ditto.
* sigproc.cc (sigproc_init): Minor change to debugging output.
* times.cc (utime_worker): Use build_fh_pc rather than reinterpreting the posix
path name again.  Return any error from path_conv immediately.
2005-10-23 23:47:45 +00:00
Corinna Vinschen c2c020d1fb * fhandler_socket.cc (fhandler_socket::connect): Don't restrict
WSAEINVAL -> WSAEISCONN conversion to nonblocking sockets.
	(fhandler_socket::accept): Use event driven technique to implement
	interuptible accept.
	(fhandler_socket::wait): Allow FD_ACCEPT handling.
	* net.cc (cygwin_accept): Remove workaround for allowing blocking
	accept.  That's entirely in fhandler_socket::accept now.
2005-10-22 16:02:15 +00:00
Corinna Vinschen 152a9caf58 * fhandler.h (class fhandler_socket): Add timeout parameter to wait()
method.
	* fhandler_socket.cc (fhandler_socket::connect): Use event driven
	technique (prepare/wait/release) to implement interuptible connect.
	(fhandler_socket::wait): Add timeout parameter.  Allow FD_CONNECT
	handling.
	* net.cc (cygwin_connect): Remove braindead workaround for allowing
	blocking connect.  That's entirely in fhandler_socket::connect now.
2005-10-22 15:11:49 +00:00
Corinna Vinschen 88d30f0b2f * include/cygwin/version.h: Fix typo. 2005-10-22 10:28:02 +00:00
Christopher Faylor a591389de3 * dir.cc (rmdir): Eliminate nonsensical code.
* fork.cc (fork): Move exit debug_printf to last statement.
2005-10-21 14:08:19 +00:00
Corinna Vinschen 81bd1ca723 * cygwin.din (futimes): Export.
(lutimes): Export.
	* times.cc (utimes_worker): Created from utimes, add nofollow flag
	to implement utimes and lutimes.
	(utimes): Just call utimes_worker.
	(lutimes): New function.
	(futimes): Ditto.
	* include/cygwin/version.h: Bump API minor version.
2005-10-20 14:26:23 +00:00
Christopher Faylor 0cdcb2345a * sigproc.cc (child_info::sync): Move check for !wr_proc_pipe lower.
* spawn.cc (spawn_guts): Correct check for top-level process.
2005-10-19 22:25:46 +00:00
Christopher Faylor fece95f7f3 * sigproc.cc (child_info::sync): Move check for !wr_proc_pipe lower.
* spawn.cc (spawn_guts): Correct check for top-level process.
2005-10-19 22:13:04 +00:00
Corinna Vinschen c928a06464 * autoload.cc: Revert loading rcmd, rexec, rresvport and inet_network
from wsock32.dll since these symbols are not exported from ws2_32.dll.
2005-10-19 19:55:31 +00:00
Christopher Faylor b27f0b2cf9 * times.cc (utimes): Only consider fds opened with write access. 2005-10-19 17:11:25 +00:00
Christopher Faylor 5a90915d41 * fhandler_disk_file.cc (fhandler_base::utimes_fs): Use existing handle if
fhandler has one.
* times.cc (utimes): Scan open fds for matching paths and use existing fhandler
if one exists.
2005-10-19 16:50:43 +00:00
Christopher Faylor b3982520d3 * pinfo.cc (_pinfo::dup_proc_pipe): Make warning more severe by actually
printing it.
(_pinfo::alert_parent): Fix comment.  Don't send to parent if we are in an exec
stub.
2005-10-19 14:19:37 +00:00
Christopher Faylor b72a5c0767 * cygtls.cc (handle_threadlist_exception): Improve diagnostic output.
* sigproc.cc (child_info::sync): Only clear hProcess when execing.
(wait_sig): Protect readsig handle.
2005-10-19 00:22:08 +00:00
Corinna Vinschen 1f5c3042d5 * autoload.cc (NtLockVirtualMemory): Import.
(NtUnlockVirtualMemory): Import.
	(GetProcessWorkingSetSize): Import.
	(SetProcessWorkingSetSize): Import.
	* cygwin.din (mlock): Export.
	(munlock): Export.
	* mmap.cc (mlock): New function.
	(munlock): Ditto.
	* ntdll.h (STATUS_WORKING_SET_QUOTA): Define.
	(LOCK_VM_IN_WSL): Define.
	(LOCK_VM_IN_RAM): Define.
	(NtLockVirtualMemory): Declare.
	(NtUnlockVirtualMemory): Declare.
	* sysconf.cc (sysconf): Implement _SC_MEMLOCK_RANGE.
	* wincap.h: Implement has_working_virtual_lock throughout.
	* wincap.cc: Ditto.
	* include/cygwin/version.h: Bump API minor version.
	* include/sys/mman.h (mlock): Declare,
	(munlock): Declare.
2005-10-18 18:51:33 +00:00
Christopher Faylor a93b4154f1 * sigproc.cc (child_info::sync): Use correct name when closing to prevent
warnings when DEBUGGING.
* spawn.cc (spawn_guts): Set myself.hProcess to pi.hProcess since this may have
been zeroed by the previous sync.
2005-10-18 15:13:13 +00:00
Christopher Faylor 4116609aca * sigproc.cc (child_info::sync): Fix typo which caused hProcess to never be
cleared.  Only clear hProcess when not forking.
2005-10-18 04:20:46 +00:00
Christopher Faylor 267e201dae Change process_lock to lock_process throughout. Change all calls to new
cygthread to handle extra argument, throughout.
* cygthread.h (cygthread::callproc): Declare new method.
(cygthread::cygthread): Add optional length argument to allow copying arguments
to executing thread.
* cygthread.cc (cygthread::callproc): Define new method.
(cygthread::stub): Use callfunc to invoke thread func to allow potentially
allocating stack memory which will be returned.
(cygthread::simplestub): Ditto.
(cygthread::cygthread): Accept arglen argument.  Reset ev here prior to
activating thread.  Wait for ev after activating thread if we're copying
contents to the thread.  Wait until the end before setting h, to allow thread
synchronization.
(cygthread::release): Don't reset ev here.  Rely on that happening the next
time the thread is activated.
* pinfo.h (commune_process): Rename declaration from _pinfo::commune_process.
* pinfo.cc (commune_process): Ditto for definition.  Modify slightly to allow
running as a separate cygthread.
* sigproc.cc (child_info::sync): Always wait for both subproc_ready and any
hProcess if we have a cygwin parent.
(talktome): Change argument to be a pointer to siginfo_t.  Contiguously
allocate whole siginfo_t structure + any needed extra for eventual passing to
commune_process thread.
(wait_sig): Accommodate change in talktome argument.
* pipe.cc (fhandler_pipe::fixup_after_exec): Remove debugging.
2005-10-17 23:27:00 +00:00
Corinna Vinschen 8b00a766ff * autoload.cc: Never load wsock32.dll. Load all wsock32 function
from ws2_32.  Rearrange symbol order accordingly.  None of the ws2_32
	functions is optional right now.
	(wsadata): Move from net.cc here.  Define NO_COPY.
	(wsock_init): Drop unused symbols ws2_32_handle and wsock32_handle.
	(load_wsock32): Remove.
	(WSACleanup): Remove.
	* fhandler_socket.cc: Drop Winsock 1 accommodations throughout.
	(fhandler_socket::readv): Accomodate new POSIX style struct msghdr.
	(fhandler_socket::writev): Ditto.
	(fhandler_socket::recvmsg): Ditto. Handle "old" applications using
	former struct msghdr correctly.
	* net.cc: Drop Winsock 1 accommodations throughout.
	(wsadata): Move definition to autoload.cc.
	(set_socket_inheritance): Remove.
	(convert_ws1_ip_optname): New static function to convert Winsock1
	IPPROTO_IP option values into Winsock2 IPPROTO_IP option values.
	(cygwin_setsockopt): Remove wrong and incomplete cleartext printing
	of optname.  For "old" applications, convert optname from Winsock1
	to Winsock2 values before using them.  Add comment to describe the
	IP_TOS weirdness on W2K and above.
	(cygwin_getsockopt): Remove wrong and incomplete cleartext printing
	of optname.  For "old" applications, convert optname from Winsock1
	to Winsock2 values before using them.
	* select.cc (start_thread_socket): Forget about winsock2_active.
	* winsup.h (wsock32_handle): Remove declaration.
	(ws2_32_handle): Ditto.
	(netapi32_handle): Ditto.
	(wsadata): Ditto.
	(winsock2_active): Remove definition.
	* include/cygwin/socket.h: Change formatting slightly.
	(socklen_t): Move definition up in file.
	(struct msghdr): Convert to POSIX style.
	(struct cmsghdr): New type.
	(CMSG_ALIGN): New macro.
	(CMSG_LEN): Ditto.
	(CMSG_SPACE): Ditto.
	(CMSG_FIRSTHDR): Ditto.
	(CMSG_NXTHDR): Ditto.
	(CMSG_DATA): Ditto.
	(SCM_RIGHTS): Ditto.
	(struct OLD_msghdr): Define old msghdr structure for Cygwin internal
	purposes.
	(MSG_TRUNC): New macro.
	(MSG_CTRUNC): Ditto.
	(IP_OPTIONS): Redefine IPPROTO_IP option values to Winsock2 values.
	Keep Winsock1 values for Cygwin internal purposes.
	* include/cygwin/version.h: Bump API minor version.
	(CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR): Define to check for
	applications using old struct msghdr.
	(CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES): Define to check for
	applications using old Winsock1 IPPROTO_IP values.
2005-10-17 21:22:18 +00:00
Christopher Faylor 0fa52a6cdf Check in previously ChangeLoged entry. 2005-10-17 03:20:20 +00:00
Christopher Faylor fd1165e29a * Makefile.in (MKDIRP): Just use raw $(INSTALL) rather than $(INSTALL_DATA).
Create directories with 755 permissions.
2005-10-14 02:15:12 +00:00
Christopher Faylor bf1550b6f8 * dir.cc (mkdir): Abandon use of PC_WRITABLE.
(rmdir): Ditto.
* path.h (PC_WRITABLE): Delete.
* path.cc (path_conv::check): Remove PC_WRITABLE accommodations.  Revisit
later.
2005-10-12 20:38:38 +00:00