Commit Graph

3873 Commits

Author SHA1 Message Date
Corinna Vinschen a25d71a899 * fhandler.h (fhandler_socket::wait): Reset default timeout to 10ms. 2006-07-05 15:39:08 +00:00
Corinna Vinschen 7bfe2409a0 * path.cc (path_conv::check): Ignore has_ea setting, it's always unset
at this point anyway.
	(get_symlink_ea): Remove.
	(set_symlink_ea): Remove.
	(symlink_worker): Drop writing symlink into NTFS extended attributes.
	(symlink_info::check): Drop reading symlinks from NTFS extended
	attributes.
2006-07-05 08:35:51 +00:00
Christopher Faylor 49bd27c47c * libc/rexec.cc (cygwin_rexec): Obvious (?) fix to correct a gcc warning - set
port to zero first thing in the function.
2006-07-05 00:14:42 +00:00
Christopher Faylor a16597363f * signal.cc (signal): Set sa_mask to sig. 2006-07-04 23:57:43 +00:00
Corinna Vinschen fa48cf5325 * Makefile.in (DLL_OFILES): Add rexec.o.
* autoload.cc (inet_network): Drop definition.
	(rexec): Ditto.
	* net.cc (rexec): Drop extern declaration.
	(inet_network): Ditto.
	(cygwin_inet_network): Implement using inet_addr.
	(cygwin_rexec): Remove.
	* libc/rexec.cc: New file.
2006-07-04 20:24:27 +00:00
Corinna Vinschen c2ab308c81 * fhandler_socket.cc (fhandler_socket::listen): Allow listening on
unbound INET socket.
2006-07-04 20:10:43 +00:00
Corinna Vinschen 6dbfd8f9ba * fhandler.h (fhandler_socket::wait): Set default timeout to INFINITE. 2006-07-04 09:26:49 +00:00
Corinna Vinschen 4635b6ebd8 * autoload.cc (NtQueryEaFile): Define.
(NtSetEaFile): Define.
	* fhandler.cc (fhandler_base::open): Use appropriate open flags
	in query case when allow_ntea is set.
	* ntdll.h (struct _FILE_GET_EA_INFORMATION): Define.
	(struct _FILE_FULL_EA_INFORMATION): Define.
	(NtQueryEaFile): Declare.
	(NtSetEaFile): Declare.
	* ntea.cc (read_ea): Rename from NTReadEA and rewrite using
	NtQueryEaFile.
	(write_ea): Rename from NTWriteEA and rewrite using NtSetEaFile.
	* path.cc (get_symlink_ea): Make static.  Add handle parameter to
	accomodate new read_ea call.
	(set_symlink_ea): Make static.  Add handle parameter to accomodate new
	write_ea call.
	(symlink_worker): Call set_symlink_ea while file is still open.
	(symlink_info::check): Call get_symlink_ea after file has been opened.
	* security.cc (get_file_attribute): Accomodate new read_ea call.
	(set_file_attribute): Accomodate new write_ea call.
	* security.h (read_ea): Change declaration accordingly.
	(write_ea): Ditto.
2006-07-03 18:30:08 +00:00
Corinna Vinschen 6258d96af8 * fhandler.h (class dev_console): Add `metabit' indicating the
current meta key mode.
	* fhandler_console.cc (fhandler_console::read): Set the top bit of
	the character if metabit is true.
	* fhandler_console.cc (fhandler_console::ioctl): Implement
	KDGKBMETA and KDSKBMETA commands.
	* fhandler_tty.cc (process_ioctl): Support KDSKBMETA.
	(fhandler_tty_slave::ioctl): Send KDGKBMETA and KDSKBMETA to the
	master.
	* include/cygwin/kd.h: New file for the meta key mode.
	* include/sys/kd.h: New file.
2006-07-03 15:29:10 +00:00
Corinna Vinschen 61aea27d90 * include/stdint.h (UINT8_C, UINT16_C): Unsigned types smaller
than int promote to signed int.
2006-07-03 12:30:04 +00:00
Corinna Vinschen 78db7dff2c * net.cc (cygwin_sendto): Define appropriate parameters using
socklen_t type according to SUSv3.
	(cygwin_recvfrom): Ditto.
	(cygwin_setsockopt): Ditto.
	(cygwin_getsockopt): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_bind): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_recv): Ditto.
	(cygwin_send): Ditto.
	* include/cygwin/socket.h (socklen_t): Typedef and define.
	* include/sys/socket.h: Declare socket functions using socklen_t type.
2006-07-03 11:31:56 +00:00
Christopher Faylor d42e28b57a * include/cygwin/version.h: Bump DLL minor version number to 21. 2006-07-02 16:22:59 +00:00
Corinna Vinschen e0d8706d8f * net.cc (cygwin_sendto): Allow zero-sized packets.
(cygwin_sendmsg): Ditto.
2006-06-30 11:04:13 +00:00
Corinna Vinschen 8b46f03c8d Revert patches from 2005-10-22 and 2006-06-14 to use event driven
accept and connect back to using select:
	* fhandler.h (class fhandler_socket): Remove accept_mtx.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
	initializing accept_mtx.
	(fhandler_socket::accept): Drop event handling.
	(fhandler_socket.cc (fhandler_socket::connect): Ditto.
	(fhandler_socket::dup): Drop accept_mtx handling.
	(fhandler_socket::listen): Ditto.
	(fhandler_socket::prepare): Ditto.
	(fhandler_socket::release): Ditto.
	(fhandler_socket::close): Ditto.
	* net.cc (cygwin_accept): Revert to calling cygwin_select to
	implement interuptible accept.
	(cygwin_connect): Ditto for connect.
2006-06-26 12:12:11 +00:00
Christopher Faylor 4470d66ddc * fhandler_fifo.cc (fhandler_fifo::open): Release process lock and grab a
system-wide mutex to prevent a deadlock and a race.
* sync.h (lock_process): Make fhandler_fifo a friend.
* smallprint.c (__small_vsprintf): Cosmetic change.
2006-06-23 00:19:39 +00:00
Corinna Vinschen 82a044a520 * cygwin.din: Export __srget_r, __swbuf_r.
* include/cygwin/version.h: Bump API minor number to 156.
2006-06-15 17:22:56 +00:00
Corinna Vinschen 1b9cba59c3 * fhandler.h (class fhandler_socket): Add private mutex handle
accept_mtx.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	accept_mtx to NULL.
	(fhandler_socket::dup): Duplicate accept_mtx, if available.
	(fhandler_socket::listen): Create accept_mtx before trying to listen.
	(fhandler_socket::prepare): Wait for accept_mtx if available to
	serialize accepts on the same socket.
	(fhandler_socket::release): Release accept_mtx.
	(fhandler_socket::close): Close accept_mtx on successful closesocket.
2006-06-14 20:19:10 +00:00
Christopher Faylor 313b51e6c1 * fhandler_tty.cc (fhandler_pty_master::close): Always close
from_master/to_master since we always have copies of these handles.
2006-06-12 14:56:31 +00:00
Corinna Vinschen 184574d61c * include/sys/wait.h: Move definition of wait constants from here...
* include/cygwin/wait.h: ...to here.  New file.
	* include/cygwin/stdlib.h: Include cygwin/wait.h to conform with SUSv3.
2006-06-12 14:25:05 +00:00
Corinna Vinschen 730f10974a * heap.cc (heap_init): Only commit if allocsize is not zero. 2006-06-12 13:59:17 +00:00
Corinna Vinschen 8f56da762a * net.cc (fdsock): Disable raising buffer sizes. Add comment to
explain why.
2006-06-12 13:13:52 +00:00
Christopher Faylor c0ac34fda0 * ioctl.cc (ioctl): Accommodate change in reported pty master device number.
* select.cc (peek_pipe): Ditto.
2006-06-04 20:32:58 +00:00
Christopher Faylor d97183b48e * cygtls.h (CYGTLS_PADSIZE): Reset to a size that XP SP1 seems to like.
* tlsoffsets.h: Regenerate.
2006-06-04 05:12:38 +00:00
Christopher Faylor 0c58e0b303 fix wording 2006-06-03 22:13:28 +00:00
Christopher Faylor c76ca04746 * cygthread.cc (cygthread::terminate_thread): In debugging output, use name of
thread being terminated rather than thread doing terminating.
* fhandler.h (fhandler_pty_master::slave): Delete.
(fhandler_pty_master::get_unit): Ditto.
(fhandler_pty_master::setup): Change argument declaration to accommodate new
usage.
* fhandler_tty.cc (fhandler_tty_master::init): Remove obsolete slave
assignment.  Pass argument to setup indicating that this is a tty.
(fhandler_tty_slave::open): Use dev() method rather than referencing pc.dev
directly.
(fhandler_pty_master::open): Don't create archetype based on ptym device
number.  Set device number to use DEV_TTYM_MAJOR and tty number.  Pass argument
to setup indicating that this is a pty.
(fhandler_pty_master::setup): Change single argument to a flag indicating
whether we're creating a pty and use appropriately.  Calculate 't' variable
here rather than in caller.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Use dev() method rather than
referencing pc.dev directly.
2006-06-03 21:44:01 +00:00
Christopher Faylor 71d59a926f * dcrt0.cc (dll_crt0_0): Call tty_list::init_session here.
(dll_crt0_1): Reflect renaming from tty_init to tty::init_session.
(do_exit): Reflect moving of tty_terminate into tty_list.
* exceptions.cc (events_init): Move tty_mutex stuff elsewhere.
* fhandler_console.cc (set_console_title): Use lock_ttys class.
* fhandler_termios.cc (fhandler_termios::bg_check): Make debug output more
accurate.
* fhandler_tty.cc (fhandler_tty_slave::open): Reflect move of attach_tty into
tty_list class.  Don't attempt to grab master end of pty if master doesn't
exist.
(fhandler_pty_master::open): Reflect move of allocate_tty into tty_list class.
Use lock_ttys::release to release mutex.  Improve debugging output.
(fhandler_pty_master::setup): Remove if 0'ed block.  Fix argument to
SetNamedPipeHandleState.
* pinfo.cc (_pinfo::set_ctty): Lock ttys before setting sid/pgid.  Improve
debugging.  Add temporary debugging.
* tty.cc (tty_list::init_session): New function.
(tty::init_session): Rename from tty_init.  Reflect move of attach_tty to
tty_list class.
(tty::create_master): Rename from create_tty_master.
(tty_list::attach): Rename from attach_tty.  Reflect renaming of connect_tty to
connect.  Ditto for allocate_tty.
(tty_terminate): Delete.
(tty_list::terminate): Subsume tty_terminate.  Use lock_ttys rather than
manipulating mutex directly.
(tty_list::allocate): Rename from allocate_tty.  Use lock_ttys rather than
manipulating mutex directly.  Don't set sid here since linux apparently doesn't
do this.  Reflect move of create_tty_master into tty.
(lock_ttys::lock_ttys): Define new constructor.
(lock_ttys::release): New function.
* tty.h (tty::exists): Return false immediately if !master_pid.
(tty::set_master_closed): Define new function.
(tty::create_master): Ditto.
(tty::init_session): Ditto.
(tty_list::mutex): New field.
(tty_list::allocate): Define new function.
(tty_list::connect): Ditto.
(tty_list::attach): Ditto.
(tty_list::init_session): Ditto.
(lock_ttys): New class.
(tty_init): Delete declaration.
(tty_terminate): Ditto.
(attach_tty): Ditto.
(create_tty_master): Ditto.
2006-06-03 20:32:07 +00:00
Christopher Faylor bc78e8bc6a * Makefile.in (libdl.a): New library. 2006-06-03 15:48:30 +00:00
Christopher Faylor daff15870e * fhandler_tty.cc (fhandler_pty_master::close): Don't close handles if we don't
own them.
(fhandler_pty_master::setup): Make sure that original handle is closed when
changing inheritance.
(fhandler_pty_master::fixup_after_fork): Set from_master/to_master to arch
value always.
(fhandler_pty_master::fixup_after_exec): Clear from_master/to_master when
close_on_exec.
2006-06-03 07:17:53 +00:00
Christopher Faylor 578e142a2b * cygheap.cc (init_cygheap::close_ctty): Remove obsolete code.
* dcrt0.cc (child_info_spawn::handle_spawn): Signal ready after we've run
fixup_after_exec.
* dtable.cc (dtable::fixup_after_exec): Add debugging output.
* fhandler_tty.cc (fhandler_pty_master::doecho): Use class version of
to_master.
(fhandler_tty_common::close): Remove obsolete code.
(fhandler_tty_slave::fixup_after_exec): Don't close, since this is done in
dtable's fixup_after_exec.  (revisit later?)
(fhandler_pty_master::fixup_after_exec): Ditto.
2006-06-03 06:35:10 +00:00
Christopher Faylor 6210ee96ec (check in missing ChangeLog lines)
* tlsoffsets.h: Regenerate.
* dcrt0.cc (break_here): Define unconditionally for use elsewhere.  Call
DebugBreak, if appropriate.
(initial_env): Rely on break_here() to call DebugBreak.
* exceptions.cc (try_to_debug): Ditto.
2006-06-03 03:01:28 +00:00
Christopher Faylor 35016286da * cygtls.h (CYGTLS_PADSIZE): Bump up or suffer a regrettable collision with the
call chain.
2006-06-03 02:58:59 +00:00
Christopher Faylor 3378bdfc0a * fhandler.cc (fhandler_base::fixup_after_exec): Declare here.
* fhandler.h (fhandler_base::fixup_after_exec): Make non-inline.
(fhandler_termios::fixup_after_fork): Delete declaration.
(fhandler_termios::fixup_after_exec): Ditto.
(fhandler_tty_common::inuse): Remove.
(fhandler_tty_common::dup): Delete declaration.
(fhandler_tty_common::fixup_after_fork): Ditto.
(fhandler_tty_slave::fixup_after_exec): Declare new function.
(fhandler_pty_master::dwProcessId): New variable.
(fhandler_pty_master::from_master): Ditto.
(fhandler_pty_master::to_master): Ditto.
(fhandler_pty_master::setup): New function.
(fhandler_pty_master::fixup_after_fork): Ditto.
(fhandler_pty_master::fixup_after_exec): Ditto.
* fhandler_termios.cc (fhandler_termios::fixup_after_exec): Delete definition.
(fhandler_termios::fixup_after_fork): Ditto.
* fhandler_tty.cc (fhandler_tty_master::init): Use fhandler_pty_master setup
function rather than obsolete tty::common_init.  Delete obsolete inuse setting.
(fhandler_tty_slave::fhandler_tty_slave): Set inuse to NULL here.
(fhandler_tty_slave::open): Change debugging output for clarity.  Check for
different things when doing a sanity check on the tty.  Reflect the fact that
master_pid now is the cygwin pid rather than the windows pid.  Use "arch"
rather than "archetype" for consistency.
(fhandler_tty_slave::close): Close inuse here.
(fhandler_tty_slave::dup): Remove old if 0'ed code.
(fhandler_pty_master::dup): New function.  Handles pty master archetype.
(fhandler_pty_master::fhandler_pty_master): Zero pty_master specific fields.
(fhandler_pty_master::open): Implement using archetypes, similar to slave.  Use
fhandler_pty_master setup function rather than obsolete tty::common_init.
Don't set inuse.
(fhandler_tty_common::close): Don't deal with inuse.  Delete old if 0'ed code.
(fhandler_pty_master::close): Implement using archetypes.  Close from_master
and to_master.
(fhandler_tty_common::set_close_on_exec): Just set close_on_exec flag here
since everything uses archetypes now.
(fhandler_tty_common::fixup_after_fork): Delete definition.
(fhandler_tty_slave::fixup_after_exec): Define new function.
(fhandler_pty_master::setup): New function, derived from tty::common_init.
(fhandler_pty_master::fixup_after_fork): New function.
(shared_info.h): Reset SHARED_INFO_CB to reflect new tty size.
* tty.cc (tty_list::terminate): Close individual handles from tty_master.
(tty::master_alive): Delete.
(tty::make_pipes): Ditto.
(tty::common_init): Ditto.
* tty.h (tty::from_slave): Delete.
(tty::to_slave): Ditto.
(tty::common_init): Delete declaration.
(tty::make_pipes): Ditto.
(tty::master_pid): Define as pid_t since it is now a cygwin pid.
2006-06-02 15:41:34 +00:00
Christopher Faylor 2346864a45 * cygheap.cc (cygheap_fixup_in_child): Don't close parent handle here. Let the
caller do that.
* dcrt0.cc (child_info_spawn::handle_spawn): Close parent handle here to allow
fixup_after_exec functions to use it.
* cygtls.cc (_cygtls::call2): Avoid calling exit thread if called with
*crt0_1 functions.
* cygtls.h (_cygtls::isinitialized): Check that we actually have a tls before
seeing if it is initialized.
* gendef (_sigfe_maybe): Ditto.
* dcrt0.cc (dll_crt0_1): Remove static, use just one argument.
* dll_init.cc (dllcrt0_info): New structure.
(dll_dllcrt0): Change into a front-end to renamed dll_dllcrt0_1 so that we'll
always be assured of having something like a tls.
(dll_dllcrt0_1): New function, basically renamed from from dll_dllcrt0.
Unconditionally call _my_tls.init_exception_handler now that we are assured of
having a tls.  Change variable name from "linking" to "linked".
* winsup.h (dll_crt0_1): Declare.
(dll_dllcrt0_1): Ditto.
2006-06-02 00:09:50 +00:00
Christopher Faylor a2b6c06546 * cygtls.cc (_cygtls::call2): Don't call ExitThread on the main thread. 2006-05-31 02:14:17 +00:00
Christopher Faylor 56057f0394 * winf.h (MAXCYGWINCMDLEN): Set down size to 30000 or suffer fork errors. 2006-05-29 15:51:18 +00:00
Christopher Faylor eb285e115c * sigproc.cc (child_info::proc_retry): Mask all of the bits we're interested
in, which includes bits above and below 0xc0000000.
2006-05-29 00:21:58 +00:00
Christopher Faylor 67ffc3c415 Put an underscore in front of the "active" in "strace.active". 2006-05-28 21:39:37 +00:00
Christopher Faylor 34f5d0879c white space 2006-05-28 15:50:14 +00:00
Christopher Faylor 29d1e62ed2 * dll_init.cc (dll_dllcrt0): Previous change didn't work very well with fork.
Semi-revert it but change name of variable to something that makes better
sense.
2006-05-27 22:55:58 +00:00
Christopher Faylor 17fed6fefc * thread.cc (verifyable_object_isvalid): Check for NULL specifically. 2006-05-27 19:00:36 +00:00
Christopher Faylor 939f16acf2 add missing comment 2006-05-27 18:53:36 +00:00
Christopher Faylor 344be4a719 * dll_init.cc (dll_dllcrt0): Call _my_tls.init_exception_handler if we've
finished initializing (Thanks to Gary Zablackis for noticing this problem).
Just use cygwin_finished_initializing rather than defining a separate variable.
2006-05-27 18:50:04 +00:00
Christopher Faylor 3cd94e0c0a * debug.h (ModifyHandle): Define new macro.
(modify_handle): Declare new function.
* debug.cc (modify_handle): Define new function.
* fhandler.h (fhandler_base::fork_fixup): Change return value from void to
bool.
* fhandler.cc (fhandler_base::fork_fixup): Return true if fork fixup has been
done.
* pipe.cc (fhandler_pipe::set_close_on_exec): Set inheritance of protected
handle via ModifyHandle if DEBUGGING.
(fhandler_pipe::fixup_after_fork): Protect guard handle if fork fixup has been
done.
2006-05-25 05:40:51 +00:00
Christopher Faylor 38229bcdcf * cygtls.cc (_cygtls::call): Call call2 using _my_tls.
(_cygtls::init_exception_handler): Always replace existing exception handler
with cygwin exception handler.
* cygtls.h (_cygtls::call2): Remove static designation.
* dcrto.cc (dll_crt0_1): Define in a way that allows calling via _cygtls::call.
(_initialize_main_tls): Delete.
(_dll_crt0): Call dll_crt0_1 via cygtls::call.  Set _main_tls here.
* external.cc (cygwin_internal): Implement CW_CYGTLS_PADSIZE.
* include/sys/cygwin.h (CW_CYGTLS_PADSIZE): Define.
* tlsoffsets.h: Regenerate.
2006-05-25 02:33:13 +00:00
Christopher Faylor 99fc5e10f3 update to newer autoconf 2006-05-24 16:59:03 +00:00
Christopher Faylor 8b08133112 * fhandler.cc (readv): Remove nonsensical assert. 2006-05-24 03:43:54 +00:00
Christopher Faylor 12a7d844b9 * select.cc (start_thread_socket): Delay setting thread local exitsock until we
know it's correct.  Return correct value on error.
2006-05-24 03:39:29 +00:00
Christopher Faylor 9905786a04 * select.cc (start_thread_socket): Clean up exitsock in case of error. Use
si->exitcode consistently.
2006-05-24 00:56:24 +00:00
Christopher Faylor 6813f009ba * child_info.h (_CI_SAW_CTRL_C): New enum.
(CURR_CHILD_INFO_MAGIC): Reset.
(saw_ctrl_c): New function.
(set_saw_ctrl_c): Ditto.
* sigproc.cc (child_info::proc_retry): Return EXITCODE_OK if we get
STATUS_CONTROL_C_EXIT and we actually saw a CTRL-C.
* spawn.cc (dwExeced): Delete.
(chExeced): New variable.
(spawn_guts): Set chExeced;
* exceptions.cc (dwExeced): Delete declaration.
(chExeced): Declare.
(ctrl_c_handler): Detect if we're an exec stub process and set a flag, if so.
* fhandler_tty.cc (fhandler_tty_common::__release_output_mutex): Add extra
DEBUGGING test.
* pinfo.cc: Fix comment.
2006-05-22 04:50:54 +00:00
Christopher Faylor 8ae1d98d8e * fhandle.h (fhandler_pipe::create_guard): Revert change which eliminated
SECURITY_ATTRIBUTES argument.
* pipe.cc (fhandler_pipe::open): Duplicate guard from other process and protect
it appropriately.  Eliminate unneeded writepipe_exists temporary variable.  Set
inheritance appropriately.
(fhandler_pipe::set_close_on_exec): Revert change which eliminated handling
guard inheritance.
(fhandler_pipe::fixup_after_fork): Ditto.  Use correct name of entity being
checked by fork_fixup.
(fhandler_pipe::fixup_after_exec): Don't bother with guard here.
(fhandler_pipe::dup): Cosmetic changes and revert creation of writepipe_exists
as noninheritable.
(fhandler_pipe::create): Revert change which eliminated SECURITY_ATTRIBUTES
argument.  Revert change which always made writepipe_exists noninheritable.
2006-05-21 21:02:52 +00:00