Commit Graph

2790 Commits

Author SHA1 Message Date
Corinna Vinschen b832c4cf21 * fhandler.h (fhandler_socket::secret_event): Remove.
(fhandler_socket::af_local_set_secret): New function combining former
	set_connect_secret and get_connect_secret into one function.
	(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
	(fhandler_socket::af_local_unsetblocking): Rename from
	eid_unsetblocking.
	(fhandler_socket::af_local_set_cred): New method.
	(fhandler_socket::af_local_copy): New method.
	(fhandler_socket::af_local_recv_secret): New method.
	(fhandler_socket::af_local_send_secret): New method.
	(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
	(fhandler_socket::af_local_send_cred): Rename from eid_send.
	(fhandler_socket::af_local_accept): New method.
	(fhandler_socket::af_local_set_sockpair_cred): Rename from
	set_socketpair_eids.
	(fhandler_socket::eid_accept): Remove.
	(fhandler_socket::eid_connect): Remove.
	(fhandler_socket::set_connect_secret): Remove.
	(fhandler_socket::get_connect_secret): Remove.
	(fhandler_socket::create_secret_event): Remove.
	(fhandler_socket::check_peer_secret_event): Remove.
	(fhandler_socket::signal_secret_event): Remove.
	(fhandler_socket::close_secret_event): Remove.
	(fhandler_socket::sec_event_accept): Remove.
	(fhandler_socket::sec_event_connect): Remove.
	* fhandler_socket.cc (secret_event_name): Remove.
	(fhandler_socket::af_local_set_sockpair_cred): Rename from
	set_socketpair_eids.
	(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
	(fhandler_socket::af_local_unsetblocking): Rename from
	eid_unsetblocking.
	(fhandler_socket::af_local_recv_secret): New function to receive
	AF_LOCAL connect secret over socket itself.
	(fhandler_socket::af_local_send_secret): New function to send AF_LOCAL
	connect secret over socket itself.
	(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
	(fhandler_socket::af_local_send_cred): Rename from eid_send.
	(fhandler_socket::eid_connect): Remove.
	(fhandler_socket::af_local_connect): Take over connect side handling
	of AF_LOCAL secret and credential handshake.
	(fhandler_socket::eid_accept): Remove.
	(fhandler_socket::af_local_accept): New method, take over accept side
	handling of AF_LOCAL secret and credential handshake.
	(fhandler_socket::af_local_set_cred): New method, set eid credentials
	to start values.
	(fhandler_socket::af_local_copy): New method, copy secret and
	credentials to another socket.
	(fhandler_socket::af_local_set_secret): New function combining former
	set_connect_secret and get_connect_secret into one function.
	(fhandler_socket::create_secret_event): Remove.
	(fhandler_socket::signal_secret_event): Remove.
	(fhandler_socket::close_secret_event): Remove.
	(fhandler_socket::check_peer_secret_event): Remove.
	(fhandler_socket::sec_event_connect): Remove.
	(fhandler_socket::sec_event_accept): Remove.
	(fhandler_socket::fixup_after_fork): Drop secret_event handling.
	(fhandler_socket::bind): Call af_local_set_secret.
	(fhandler_socket::connect): Call af_local_set_cred and af_local_connect.
	(fhandler_socket::listen): Call af_local_set_cred.
	(fhandler_socket::accept): Call af_local_copy and af_local_accept on
	accepted socket.
	(fhandler_socket::close): Don't call close_secret_event.
	(fhandler_socket::set_close_on_exec): Don't set secret_event
	inheritance.
	* net.cc (cygwin_getsockopt): Add debug output.
	(socketpair): Call af_local_set_sockpair_cred instead of
	set_socketpair_eids.
	* select.cc (set_bits): Drop AF_LOCAL special handling in case
	of except bit set.
2005-03-24 14:04:06 +00:00
Christopher Faylor c6190209b3 * include/ctype.h: Always define macros when inside cygwin.
(isblank): New macro.
2005-03-23 21:04:00 +00:00
Christopher Faylor ffd9d72a80 fix comment 2005-03-23 17:43:51 +00:00
Corinna Vinschen a6099ff810 * fhandler.h (fhandler_socket::eid_connect): Make private.
(fhandler_socket::set_connect_secret): Ditto.
	(fhandler_socket::get_connect_secret): Ditto.
	(fhandler_socket::create_secret_event): Ditto. Remove secret argument.
	(fhandler_socket::check_peer_secret_event): Ditto.
	(fhandler_socket::signal_secret_event): Make private.
	(fhandler_socket::close_secret_event): Ditto.
	(fhandler_socket::sec_event_accept): New private method.
	(fhandler_socket::sec_event_connect): Ditto.
	(fhandler_socket::af_local_connect): New public method.
	* fhandler_socket.cc: Use 'struct sockaddr' and 'struct sockaddr_in'
	rather than just 'sockaddr' and 'sockaddr_in' throughout.
	(fhandler_socket::eid_connect): Drop AF_LOCAL/SOCK_STREAM test.
	(fhandler_socket::create_secret_event): Remove secret argument.
	Always use connect_secret instead.
	(fhandler_socket::check_peer_secret_event): Ditto.
	(fhandler_socket::sec_event_connect): New method, combining entire
	secret event handshake on connect side.
	(fhandler_socket::af_local_connect): New method, combining secret
	event handshake and eid credential transaction on connect side, to
	be called from select.
	(fhandler_socket::sec_event_accept): New method, combining entire
	secret event handshake on accept side.
	(fhandler_socket::connect): Drop secret, use connect_secret instead.
	Move entire secret event handshake to sec_event_connect.
	(fhandler_socket::accept): Move entire secret event handshake to
	sec_event_accept.
	* select.cc (set_bits): Just call af_local_connect here.
2005-03-23 17:27:18 +00:00
Christopher Faylor bc3f9e29d0 * include/cygwin/version.h: Change coment for most recent API version bump to
reflect new additions to the DLL and to remove change obsoleted by the previous
checkin.
2005-03-23 17:16:16 +00:00
Christopher Faylor 6d89e9dd43 * include/ctype.h: New file.
* ctype.cc: Ditto.
* Makefile.in: Add ctype.o to DLL_OFILES.
* cygwin.din: Remove _ctype_ptr (for now?).
2005-03-23 17:11:24 +00:00
Christopher Faylor b1d9a0bd41 * Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.
* cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK.
(hook_chain): New struct.
(init_cygheap::hooks): Define new element.
* cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec.
* dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function.
* external.cc (cygwin_internal): Implement CW_HOOK.
* fork.cc (fork_child): Call fixup_hooks_after_fork.
* init.cc (cygwin_hmodule): Reinstate after a long absence.
* include/sys/cygwin.h: Define CW_HOOK.
* hookapi.cc: New file.
* select.cc (start_thread_socket): Add debugging output.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x accommodation.
* fhandler_socket.cc (fhandler_socket::connect): Make sure that err is
initialized.
2005-03-22 19:00:31 +00:00
Corinna Vinschen 3b5f210520 * cygwin.din (__ctype_ptr): Export.
* include/cygwin/version.h: Bump API minor version.
2005-03-22 11:37:55 +00:00
Corinna Vinschen 257e3d8e89 * fhandler.h (class cygthread): Remove forward declaration. 2005-03-21 19:10:45 +00:00
Corinna Vinschen ef82f76c30 * fhandler.h (class cygthread): Forward declare.
(fhandler_socket::sec_pipe): Remove.
	(fhandler_socket::eid_pipe_name): Remove.
	(fhandler_socket::eid_setblocking): New private method.
	(fhandler_socket::eid_unsetblocking): Ditto
	(fhandler_socket::eid_recv): Ditto
	(fhandler_socket::eid_send): Ditto
	(fhandler_socket::eid_accept): Ditto
	(fhandler_socket::eid_connect): New public method.
	* fhandler_socket.cc (ASYNC_MASK): Move to beginning of file.
	(fhandler_socket::eid_pipe_name): Remove.
	(fhandler_socket::set_socketpair_eids): Move down to fhandler_socket
	methods.
	(fhandler_socket::fhandler_socket): Drop initializing sec_pipe.
	(fhandler_socket::~fhandler_socket): Drop closing sec_pipe.
	(fhandler_socket::eid_setblocking): New method.
	(fhandler_socket::eid_unsetblocking): New method.
	(fhandler_socket::eid_recv): New method.
	(fhandler_socket::eid_send): New method.
	(fhandler_socket::eid_connect): New method.
	(fhandler_socket::eid_accept): New method.
	(fhandler_socket::dup): Drop sec_pipe handling.
	(fhandler_socket::connect): Fix WinSock error handling. Prepare
	eid credential transaction. Call eid_connect on successful connect.
	(fhandler_socket::listen): Drop creating sec_pipe.
	(fhandler_socket::accept): Slightly simplify code. Call eid_accept
	on accepted socket.
	(fhandler_socket::getpeereid): Reshuffle code for readability. Fix
	test for invalid pid.
	* select.cc (set_bits): Call eid_connect on successfully connected
	socket.
2005-03-21 18:56:50 +00:00
Christopher Faylor f580813771 * child_info.h (fork_info): Use different method to alias variable.
(spawn_info): Ditto.
* cxx.cc (__cxa_guard_acquire): New function (needed for gcc 4.x).
(__cxa_guard_release): Ditto.
* devices.in: Make sure stuff is correctly bracketed (for gcc 4.x).
* devices.cc: Regenerate.
* fhandler.h (fhandler_disk_file::fchmod): Avoid left coercion (for gcc 4.x).
* smallprint.c (__rn): Declare as __fastcall since gcc 4.x complains about use
of regparm, for some reason.
* sync.h (sync::init_lock): Remove.
* sync.cc (sync::init_lock): Ditto.
2005-03-19 21:45:15 +00:00
Christopher Faylor cfaf367058 * net.cc (cygwin_getprotobyname): Don't try to be fancy with return values.
(cygwin_getprotobynumber): Ditto.
2005-03-18 22:42:51 +00:00
Corinna Vinschen 993317d0ed * fhandler_disk_file.cc (fhandler_disk_file::utimes): Handle opening
directories under 9x gracefully.
2005-03-17 12:53:47 +00:00
Corinna Vinschen 2e7c4a2ab1 * fhandler_socket.cc (fhandler_socket::connect): Always set sun_path
in case of a successful or pending connect.
	(fhandler_socket::accept): Don't run secret event and eid credential
	transactions if OS accept returned WSAEWOULDBLOCK.
2005-03-17 11:56:30 +00:00
Christopher Faylor 294a7d2a66 complete a sentenc 2005-03-16 22:08:33 +00:00
Christopher Faylor 29acee4020 * fhandler_tape.cc (get_ll): This is a generally useful function so move it
* winsup.h (get_ll): to here
* security.cc (get_token_group_sidlist): Use get_ll to figure out the long long
version of the luid since QuadPart is not part of the standard Windows API.
2005-03-16 21:52:06 +00:00
Christopher Faylor 2693c1ac56 * dir.cc: Rename opendir_* to dirent_* throughout.
(opendir_states): Move and rename.
* fhandler.h (dirent_states): to here.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir when
skipping through entries since it is keeping track of "." and "..".
(fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do everything.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating that we
provide .  and ..
(fhandler_virtual::seekdir): Ditto.
(fhandler_virtual::rewinddir): Ditto.
* fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.
2005-03-16 21:20:56 +00:00
Christopher Faylor fe83647073 * cygtls.cc (free_local): New macro.
(_cygtls::remove): Use free_local to free known-malloced local variables.
* cygtls.h: Mark some variables as "malloced".
* net.cc (enum struct_type): Rename from is_* to t_* for clarity.
(dump_protoent): Delete.
(dup_ent): New macro.
(__dup_ent): Renamed from dup_ent.  Change arguments for convenience.  Replace
first argument with newly alloced value.  Allocate a rounded number of bytes in
an attempt to try to reuse space.  Subsume "dump_protent".
(cygwin_getprotobyname): Simplify using new dup_ent functionality.
(cygwin_getprotobynumber): Ditto.
(cygwin_getservbyname): Ditto.
(cygwin_getservbyport): Ditto.
(cygwin_gethostname): Ditto.
(cygwin_gethostbyname): Ditto.
* tlsoffsets.h: Regenerate.
* syslog.cc (openlog): Use NULL rather than 0, for consistency with the rest of
cygwin.
(pass_handler::initialize): Use unbuffered I/O in pass one.
2005-03-16 17:07:32 +00:00
Christopher Faylor a53953b070 * errno.cc (errmap): Correct typo in previous change. 2005-03-16 01:00:05 +00:00
Christopher Faylor 9d387e73b8 * cygtls.cc (_cygtls::remove): Free process_ident, if it exists.
* errno.cc (errmap): ERROR_DISK_CORRUPT -> EIO.
2005-03-15 21:58:44 +00:00
Christopher Faylor ac7bc2d470 * path.h (pathconv_arg): Define PC_NO_ACCESS_CHECK.
(path_types): Define PATH_NO_ACCESS_CHECK == PC_NO_ACCESS_CHECK.
* path.cc (symlink_info::check_sysfile): Move to symlink_info class and
eliminate arguments that are part of class.  Use set_error.
(symlink_info::check_shortcut): Ditto.
(symlink_info::set_error): New function.
(path_conv::check): Pass PC_NO_ACCESS_CHECK to symlink_info::check.
(symlink_info::check): Preserve PC_NO_ACCESS_CHECK in pflags.  Use set_error.
2005-03-12 02:33:00 +00:00
Corinna Vinschen 640c3ce5df * path.cc (is_floppy): New function.
(setmntent): Drop floppy drives on A: and B: from logical drive DWORD.
	* syscalls.cc (sync): Don't sync floppies on A: and B:.
2005-03-10 17:02:52 +00:00
Christopher Faylor 542afc349c * autoload.cc (LoadDLLprime): Use nocopy segment or forked processes will not
initialize properly.
* autoload.cc (LoadDLLprime): Scrap use of .linkonce and just use an
2005-03-10 16:59:55 +00:00
Christopher Faylor 491e84c601 * autoload.cc (LoadDllprime): Scrap use of .linkonce and just use an ifdef
guard to load .foo_init into data segment.
* dcrt0.cc (initial_env): Allow colon or space as CYGWIN_DEBUG separator for
consistency.
2005-03-10 14:41:50 +00:00
Christopher Faylor 35b4534efe * pinfo.h (pinfo::pinfo): Clear more elements in the constructor. 2005-03-10 01:50:09 +00:00
Christopher Faylor 8b59143fcd * net.cc (dup_ent): Revert older stupid test for null. Don't copy name if it
is NULL.
2005-03-09 23:46:51 +00:00
Corinna Vinschen 7d243cd43b * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
string.
	(fhandler_socket::connect): Set sun_path before running eid credential
	transaction.  Run transaction only if OS connect was successful.
	(fhandler_socket::accept): Run transaction only if OS accept was
	successful.
2005-03-09 23:00:20 +00:00
Christopher Faylor 8b7de010ab * net.cc (dup_ent): Revert previous stupid change. 2005-03-09 22:38:09 +00:00
Corinna Vinschen fa4b5b03c0 * signal.cc (sigprocmask): Rename first parameter to "how".
(handle_sigprocmask): Ditto.  Check "how" for being a valid "how" value.
	Fix call order in case of wrong "how" value.
2005-03-09 21:07:56 +00:00
Christopher Faylor b364b39867 * net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf. 2005-03-09 20:56:44 +00:00
Christopher Faylor f5394c9560 * path.cc (path_conv::check): Treat ENOSHARE similarly to ENOENT when
determining if there was a problem with a symlink.
2005-03-09 20:33:21 +00:00
Corinna Vinschen 1e2ce19b96 * fhandler_socket.cc (fhandler_socket::listen): Don't limit the number
of pipe instances.
2005-03-08 16:33:17 +00:00
Christopher Faylor efdc312d12 * pinfo.cc (pinfo::exit): Right shift exit value by eight when not started in a
cygwin environment.
2005-03-08 14:31:21 +00:00
Corinna Vinschen d2428633a6 * mmap.cc (mmap64): Handle MAP_AUTOGROW flag.
(fhandler_disk_file::mmap): Ditto. Clean conditional for readability.
	* include/sys/mman.h: Add MAP_AUTOGROW flag.
	* include/cygwin/version.h: Bump API minor version.
2005-03-08 09:18:47 +00:00
Christopher Faylor 18edcecfbf * dcrt0.cc (dll_crt0_0): Eliminate muto::init call.
* sync.h (locker): New, currently unused class.
(muto::init): Eliminate.
* sync.cc (muto::init): Ditto.
(muto::init): Eliminate critical section lock and instead use name as a guard
to prevent against multiple attempts to initialize the same muto.
* pinfo.cc (pinfo::init): Set myself procinfo when not execing and pid matches
windows pid or cygwin pid.
2005-03-08 05:05:02 +00:00
Christopher Faylor fe7b4e0306 * path.cc (mount_info::read_cygdrive_info_from_registry): Use the user prefix
if it exists.
* sync.h (sync::init_lock): Declare new static member.
(sync::init()): Declare new static function.
* sync.cc (sync::init): Define.
(sync::init): Lock attempt to initialize a muto to stop multiple threads from
colliding.
* dcrt0.cc (dll_crt0_0): Initialize muto environment.
2005-03-06 21:28:28 +00:00
Christopher Faylor a50b6b2dcd * path.cc (special_name): Reorganize to always detect the use of special names
first, before detecting special characters.
2005-03-06 20:15:07 +00:00
Christopher Faylor 3016669b4b * fhandler_clipboard.cc: Use int for cygnativeformat rather than UINT as that
is what is returned by GetPriorityClipboardFormat.
(fhandler_dev_clipboard::read): Ditto for the format variable.
2005-03-04 18:04:11 +00:00
Corinna Vinschen 0f63e6247d * fhandler.cc (fhandler_base::open_9x): Satisfy query_open values. 2005-03-04 13:54:59 +00:00
Corinna Vinschen f317a917bc * fhandler_socket.cc (fhandler_socket::ioctl): Only cancel
WSAAsyncSelect when async mode is on.
2005-03-04 08:36:43 +00:00
Corinna Vinschen 6b76b0c5d4 * cygwin.din (utmpxname): Export.
* syscalls.cc (utmpxname): Create export alias to utmpname.
	* include/utmpx.h: Define ut_name and ut_xtime if not already defined.
	(utmpxname): Add prototype.
	* include/sys/utmp.h: Only define ut_name if not already defined.
	* include/cygwin/version.h: Bump API minor version.
2005-03-03 22:08:12 +00:00
Christopher Faylor 33aca56322 * cygthread.cc (cygthread::detach): Use a slightly higher priority when waiting
for thread signalling.
2005-03-03 16:53:52 +00:00
Christopher Faylor 410b2bc211 fix changelog garbling 2005-03-03 01:06:30 +00:00
Christopher Faylor 608b0ce960 * autoload.cc (std_dll_init): Save and restore fpu control register around
LoadAddress to prevent loaded dlls (like msvcrt.dll) from setting unwanted
stuff.
2005-03-03 00:49:53 +00:00
Christopher Faylor 55b670024c * cygtls.cc (_cygtls::remove): Don't attempt any removal activities if exitsock
is zero.
2005-03-03 00:36:49 +00:00
Christopher Faylor d845acc8d2 * cygtls.cc (_cygtls::init_thread): Move exitsock setting later. It should
always be set.
(_cygtls::remove): Detect zero exitsock.  Not quite sure why this is needed.
2005-03-03 00:32:57 +00:00
Christopher Faylor d0f0ea3034 * autoload.cc (LoadDLLprime): Mask error code to low-order 16 bits.
(noload): Preserve sign when returning error code.
2005-03-02 16:13:24 +00:00
Christopher Faylor d83eb0c7d0 * spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they had
previously been SIG_DFL.
2005-03-02 15:32:34 +00:00
Corinna Vinschen e04c777cc6 * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace
GetSystemTime/SystemTimeToFileTime with GetSystemTimeAsFileTime.
	* times.cc (time_as_timestruc_t): Ditto.
	(time): Ditto.
2005-03-02 08:28:54 +00:00
Christopher Faylor b9b8c930c3 * include/cygwin/version.h: Bump DLL minor number to 14. 2005-03-01 20:20:45 +00:00