Commit Graph

1744 Commits

Author SHA1 Message Date
Robert Collins 20b94ee904 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Partial refactoring of pthread_key destructor
        handling. Loosely based on Thomas Pfaff's work.
        (pthread_key_destructor_list::Insert): Remove.
        (pthread_key_destructor_list::Pop): Remove.
        (pthread_key_destructor_list::IterateNull): Call the key's
        run_destructor method.
        (pthread_key::pthread_key): Initialize new member.
        (pthread_key::get): Mark as const for correctness.
        (pthread_key::run_destructor): Implement.
        * thread.h (pthread_key::get): Mark as const for correctness.
        (pthread_key::run_destructor): Declare.
        (List): New template class that implements a generic list.
        (pthread_key_destructor_list): Inherit from List, and remove
        now duplicate functions.
2002-09-21 01:59:46 +00:00
Robert Collins 8b1978c30c 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Change verifyable_object_isvalid calls with
        PTHREAD_CONDATTR_MAGIC, PTHREAD_MUTEXATTR_MAGIC, PTHREAD_COND_MAGIC,
        SEM_MAGIC to objecttype::isGoodObject() calls throughout.
        (pthread_condattr::isGoodObject): Implement.
        (pthread_mutex::isGoodInitializer): Implement.
        (pthread_mutex::isGoodInitializerOrObject): Minor bugfix in the
        check for verifyable_object_isvalid result.
        (pthread_mutexattr::isGoodObject): Implement.
        (pthread_cond::isGoodObject): Ditto.
        (pthread_cond::isGoodInitializer): Ditto.
        (pthread_cond::isGoodInitializerOrObject): Ditto.
        (semaphore::isGoodObject): Ditto.
        * thread.h (pthread_mutex::isGoodInitializer): Declare.
        (pthread_condattr::isGoodObject): Ditto.
        (pthread_cond::isGoodObject): Const correctness.
        (pthread_cond::isGoodInitializer): Declare.
        (pthread_cond::isGoodInitializerOrObject): Ditto.
        (semaphore::isGoodObject): Const correctness.
2002-09-20 23:46:12 +00:00
Robert Collins 4e2822f160 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Change verifyable_object_isvalid calls with
        PTHREAD_MUTEX_MAGIC and PTHREAD_KEY_MAGIC and PTHREAD_ATTR_MAGIC to
        ::isGoodObject() calls throughout.
        (MTinterface::Init): Remove dead code.
        (pthread_attr::isGoodObject): Implement.
        (pthread_key::isGoodObject): Implement.
        (pthread_mutex::isGoodObject): Implement.
        (pthread_mutex::isGoodInitializerOrObject): Implement.
        (pthread::isGoodObject): Update signature.
        * thread.h (pthread_key::isGoodObject): Declare.
        (pthread_attr::isGoodObject): Ditto.
        (pthread_mutex::isGoodObject): Ditto.
        (pthread_mutex::isGoodInitializerOrObject): Ditto.
        (pthread::isGoodObject): Change to a const parameter for const
        correctness.
        (pthread_mutexattr::isGoodObject): Declare.
        (pthread_condattr::isGoodObject): Ditto.
        (pthread_cond::isGoodObject): Ditto.
        (semaphore::isGoodObject): Ditto.
2002-09-20 22:34:05 +00:00
Christopher Faylor 580e99a151 Cleanup calls to CreateFile throughout.
* dcrt0.cc (__api_fatal): Correctly check for failing return from CreateFile.
* assert.cc (__assert): Don't check return value from CreateFile for NULL.
* fhandler_console.cc (set_console_state_for_spawn): Ditto.
* fork.cc (fork_parent): Ditto.
2002-09-19 15:12:48 +00:00
Christopher Faylor 5bf785a017 * cygthread.cc (cygthread::initialized): Avoid copying on fork or some threads
may not end up in the pool.
(cygthread::new): Avoid race when checking for initialized.  Add debugging
code.
* fhandler.cc (fhandler_base::raw_read): Add case for ERROR_INVALID_HANDLE due
to Win95 directories.
(fhandler_base::open): Handle errors due to Win95 directories.
(fhandler_base::close): Add get_nohandle () test.
(fhandler_base::set_close_on_exec): Ditto.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::lock): Change error code to Posix EINVAL.
(fhandler_base::dup): If get_nohandle (), set new value to INVALID_HANDLE_VALUE
instead of NULL.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name if
get_nohandle ().  Remove extraneous element from strpbrk.
(fhandler_disk_file::open): Remove test for Win95 directory.
* fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle ().
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
(fhandler_dev_zero::close): Delete.
* fhandler.h (class fhandler_dev_zero): Ditto.
2002-09-19 03:30:20 +00:00
Robert Collins 9f06b64aa9 2002-09-17 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::set): Preserve GetLastError(). Reported
        by Thomas Pffaf.
2002-09-17 10:01:49 +00:00
Robert Collins f1f1379560 2002-09-17 Robert Collins <rbtcollins@hotmail.com>
This work inspires by Thomas Pfaff's pthread_fork patch (1).
        * fork.cc (fork_child): Remove MTinterface fixup call, it's
        adsorbed by pthread::atforkchild.
        Rename __pthread_atforkchild to pthread::atforkchild to give
        access to private members.
        (fork_parent): Rename __pthread_atforkparent to
        pthread::atforkparent to give it access to private members.
        Ditto for __pthread_atforkprepare.
        * thread.cc: Fix some formatting problems throughout.
        (MTinterface::fixup_before_fork): Implement.
        (MTinterface::fixup_after_fork): Fix pthread_keys.
        (pthread_key::keys): Implement.
        (pthread_key::fixup_before_fork): Ditto.
        (pthread_key::fixup_after_fork): Ditto.
        (pthread_key::pthread_key): Add to pthread_key::keys.
        (pthread_key::~pthread_key): Remove from pthread_key::keys.
        (pthread_key::saveKeyToBuffer): Implement.
        (pthread_key::recreateKeyFromBuffer): Ditto.
        (pthread::atforkprepare): Prepare all MT classes for fork.
        (pthread::atforkchild): And fix them up afterwards.
        * thread.h (pthread_key): Buffer the key value during
        fork in fork_buf.
        List the keys needing to be fixed up in a linked list with
        head pthread_key::keys.
        (pthread): Move atfork cygwin internal calls into the class.
        (MTInterface): Provide a fixup_before_fork for objecst that
        need to save state.
        (__pthread_atforkprepare): Remove.
        (__pthread_atforkparent): Remove.
        (__pthread_atforkchild): Remove.
2002-09-17 09:12:36 +00:00
Christopher Faylor d04cf16c52 * init.cc: Cleanup slightly and remove obsolete code. 2002-09-16 16:09:54 +00:00
Robert Collins 4e78617321 2002-09-11 Robert Collins <rbtcollins@hotmail.com>
* init.cc (dll_entry): On thread detach, if the thread hasn't
        exit()ed, do so.
        * pthread.cc (pthread_getsequence_np): Remove the
        __pthread_getsequence_np wrapper. This requires errno.h.
        * thread.cc (pthread::self): Instantiate a new pthread object
        when called and none exists. return a NULL object if instantiation
        fails.
        (pthread::precreate): Factor out common code.
        (pthread::postcreate): Ditto.
        (pthread::create): Ditto.
        (pthread::exit): Remove the TLS value when we exit to prevent
        double exits.
        (MTinterface::Init): Bugfix - don't mark the TLS index as created
        if one was not allocated.
        Apply Extract Method to move pthread specific initialisation into
        pthread.
        (pthread::initMainThread): Extracted method from MTinterface::Init.
        (pthread::setTlsSelfPointer): Extracted method from various pthread
        calls, to make reading those functions easier.
        (pthread::setThreadIdtoCurrent): Ditto.
        (pthread::cancel_self): Bring into the .cc file, it's only used
        within the class.
        (pthread::getThreadId): Ditto.
        (pthread::thread_init_wrapper): Apply Extract Method to the TLS
        setting logic.
        (pthread::isGoodObject): Extracted method from various pthread
        wrapper calls, for clarity of reading.
        (pthread::getsequence_np): Converted from __pthread_getsquence_np.
        (__pthread_create): Apply Extract Method to the object validation.
        (__pthread_cancel): Ditto.
        (__pthread_join): Ditto.
        (__pthread_detach): Ditto.
        (__pthread_suspend): Ditto.
        (__pthread_continue): Ditto.
        (__pthread_getschedparam): Ditto.
        (__pthread_getsequence_np): Remove.
        (__pthread_setschedparam): Apply Extract Method to the object
        validation.
        (pthreadNull::getNullpthread): New method, return the pthreadNull
        object.
        (pthreadNull::pthreadNull): Private constructor to prevent accidental
        use.
        (pthreadNull::~pthreadNull): Prevent compile warnings.
        (pthreadNull::create): Override pthread behaviour.
        (pthreadNull::exit): Ditto.
        (pthreadNull::cancel): Ditto.
        (pthreadNull::testcancel): Ditto.
        (pthreadNull::setcancelstate): Ditto.
        (pthreadNull::setcanceltype): Ditto.
        (pthreadNull::push_cleanup_handler): Ditto.
        (pthreadNull::pop_cleanup_handler): Ditto.
        (pthreadNull::getsequence_np): Ditto.
        (pthreadNull::_instance): Ditto.
        * thread.h (pthread): Declare pre- and post-create.
        Move GetThreadId to private scope and rename to getThreadId.
        Move setThreadIdtoCurrent to private scope.
        Make create virtual.
        Make ~pthread virtual.
        Declare initMainThread.
        Declare isGoodObject.
        Make exit virtual.
        Make cancel virtual.
        Make testcancel virtual.
        Make setcancelstate virtual.
        Make setcanceltype virtual.
        Make push_cleanup_handler virtual.
        Make pop_cleanup_handler virtual.
        Declare getsequence_np.
        Declare setTlsSelfPointer.
        (pthreadNull): New null object class for pthread.
        (__pthread_getsequence_np): Remove.
2002-09-16 10:53:29 +00:00
Christopher Faylor 53217744a3 fix typo 2002-09-13 13:05:52 +00:00
Christopher Faylor 3e6ae531dd fix typo 2002-09-13 13:01:28 +00:00
Corinna Vinschen 8934e4707d * syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid.
(setegid32): Treat ILLEGAL_GID invalid.
2002-09-13 09:00:28 +00:00
Corinna Vinschen 5a8746b732 * grp.cc (initgroups): Call groups::clear_supp to free the
supplementary group sids that may have been set by setgroups.
	* security.cc (cygsidlist::free_sids): Also zero the class members.
	* security.h (groups::clear_supp): New.
	Rename cygsidlist_unknown to cygsidlist_empty.
2002-09-11 10:37:11 +00:00
Christopher Faylor 02fa38279f * fhandler_tty.cc (fhandler_tty_slave::open): Don't protect input/output
handles since they are not properly manipulated later.
* tty.cc (tty::make_pipes): Ditto.
2002-09-08 19:35:41 +00:00
Christopher Faylor 788d78be79 whitespace 2002-09-06 04:39:49 +00:00
Christopher Faylor 4898f75e37 * winsup.h (_WIN32_WINNT): Protect. 2002-09-06 04:30:46 +00:00
Christopher Faylor 5c0469b45c * winsup.h (_WIN32_WINNT): Define. 2002-09-06 04:21:30 +00:00
Christopher Faylor ca558bf047 some edits 2002-09-04 15:17:24 +00:00
Christopher Faylor 090b3abf87 first draft 2002-09-04 15:14:14 +00:00
Christopher Faylor 3947b56661 fix typo 2002-09-04 14:56:56 +00:00
Corinna Vinschen 03dc3df581 * Makefile.in (DLL_OFILES): Drop shortcut.o.
* path.cc: Move all shortcut functions from shortcut.c to here.
	(check_shortcut): Implement without using COM interface.
	* path.h: Move definition of SHORTCUT_HDR_SIZE to here.
	* shortcut.c: Remove.
	* shortcut.h: Ditto.
2002-09-04 13:11:29 +00:00
Corinna Vinschen 4d147a03bd * fhandler.h (fhandler_socket::read): Remove method.
(fhandler_socket::write): Ditto.
	(fhandler_socket::readv): New method.
	(fhandler_socket::writev): Ditto.
	(fhandler_socket::recvmsg): Add new optional argument.
	(fhandler_socket::sendmsg): Ditto.
	* fhandler.cc (fhandler_socket::read): Remove method.
	(fhandler_socket::write): Ditto.
	(fhandler_socket::readv): New method.
	(fhandler_socket::writev): Ditto.
	(fhandler_socket::recvmsg): Use win32's scatter/gather IO where
	possible.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (cygwin_recvmsg): Check the msghdr's iovec fields.
	(cygwin_sendmsg): Ditto.  Add omitted sigframe.
2002-09-04 09:39:35 +00:00
Corinna Vinschen 4a311951a5 * cygwin.din: Revert exporting new wchar functions.
* include/cygwin/version.h: Change comment for API minor 62.
2002-09-03 12:26:51 +00:00
Christopher Faylor bdfeb17915 * dcrt0.cc (dll_crt0_1): Remove getpagesize() call.
* shared.cc (memory_init): Move it here.
2002-09-02 06:00:59 +00:00
Christopher Faylor c8bef40026 * fhandler_proc.cc: Add <sys/param.h> include.
(format_proc_uptime): Use KernelTime and UserTime only as they include the
other counters.
(format_proc_stat): KernelTime includes IdleTime, so subtract IdleTime from
KernelTime.  Make number of 'jiffies' per second same as HZ define.
* fhandler_process.cc: Add <sys/param.h> include.
(format_process_stat): Make number of 'jiffies' per second same as HZ define.
Use KernelTime and UserTime only to calculate start_time.
2002-08-31 16:37:51 +00:00
Christopher Faylor af598a3b09 * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Set "don't need
ready for read" flag.
(fhandler_tty_slave::read): Don't do anything special with vtime when vmin ==
0.
2002-08-31 03:41:43 +00:00
Christopher Faylor 7a1174dcf2 (inspired by a patch from Egor Duda)
* select.cc (fhandler_tty_slave::ready_for_read): Remove.
* fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration.
* fhandler_tty.cc (fhandler_tty_slave::read): Don't do anything special with
vtime when vmin == 0.
* autoload.cc (GetConsoleWindow): Correct parameter count.
2002-08-31 03:35:50 +00:00
Christopher Faylor f80e156de9 Christopher Faylor <cgf@redhat.com>
* tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available.  Call
FindWindow in a loop.
2002-08-30 16:03:52 +00:00
Christopher Faylor ab7f9b938f * miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero length
iov_len.
(check_iovec_for_write): Ditto.
* fhandler.h (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* fhandler.cc (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* syscalls.cc (_read): Delegate to readv(2).
(_write): Ditto, mutatis mutandi.
(readv): Rewrite, based on the old _read code, to use the new
fhandler_base::readv method.  Improve access mode handling and ensure all calls
reach the final strace statement.
(writev): Ditto, mutatis mutandi.
* include/sys/uio.h (struct iovec): Change field types to match SUSv3.
* winsup.h (check_iovec_for_read): New function.
(check_iovec_for_write): Ditto.
* miscfuncs.cc (check_iovec_for_read): Ditto.
(check_iovec_for_write): Ditto.
2002-08-30 15:47:10 +00:00
Corinna Vinschen 70c306d781 Sigh, mbsrtowcs was still missing... 2002-08-30 13:30:26 +00:00
Corinna Vinschen aabdc97a4c * cygwin.din: Add more prototypes for new wchar functions in newlib. 2002-08-30 13:01:58 +00:00
Corinna Vinschen b50a2f29aa * cygwin.din: Add prototypes for new wchar functions in newlib.
* include/cygwin/version.h: Bump API minor number.
2002-08-30 12:18:56 +00:00
Corinna Vinschen 7382e593a0 * poll.cc (poll): Peek sockets ready for read to see if there's
actually data.
2002-08-29 09:41:00 +00:00
Christopher Faylor d4d59223ed * cygthread.cc (hthreads): Remove unneeded global.
(cygthread::simplestub): New static member function.
(cygthread::runner): Don't set hthreads.
(cygthread::freerange): New member function.
(cygthread::operator new): Call freerange if all cygwin slots are used up.
(cygthread::exit_thread): Don't mess with event if freerange thread.
(cygthread::detach): Ditto.
* cygthread.h (class cygthread): Declare new member functions and variables.
2002-08-29 03:33:50 +00:00
Christopher Faylor 64508b36f9 remove 2002-08-29 02:15:26 +00:00
Christopher Faylor 4053143834 remove 2002-08-28 18:24:57 +00:00
Christopher Faylor 78dd8bdd12 * malloc.cc: Protect some definitions to avoid a compile time warning. 2002-08-28 16:08:09 +00:00
Corinna Vinschen 75d01d9e3b * cygwin.din: Export getc_unlocked, getchar_unlocked,
putc_unlocked, putchar_unlocked functions.
	* include/cygwin/version.h: Bump api minor.
2002-08-28 10:50:27 +00:00
Corinna Vinschen 281d8a3232 * fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
not understood by WinSock.
	(fhandler_socket::sendto): Ditto.  If WinSock sendto() returns
	WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL
	isn't set in flags.
	* include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL.
	* include/cygwin/version.h: Bump API minor number.
2002-08-28 10:18:20 +00:00
Corinna Vinschen 667599f478 * poll.cc (poll): Eliminate erroneous POLLERR conditional. 2002-08-28 09:29:42 +00:00
Christopher Faylor 09df858c35 fragging mumble bruggum newlib 2002-08-28 00:30:49 +00:00
Corinna Vinschen 0a64232525 * fhandler_socket.cc (fhandler_socket::check_peer_secret_event):
Fix strace message.
	(fhandler_socket::connect): Remove sigframe.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::getsockname): Ditto.
	(fhandler_socket::getpeername): Ditto.
	(fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	(fhandler_socket::close): Ditto.
	(fhandler_socket::ioctl): Ditto.
	* ioctl.cc (ioctl): Add sigframe.
	*net.cc (cygwin_sendto): Ditto.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvfrom): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_shutdown): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_accept): Ditto.  Improve strace message.
	(cygwin_getsockname): Ditto.  Ditto.
	(cygwin_recvmsg): Ditto.  Ditto.
	(cygwin_sendmsg): Fix strace message.
2002-08-27 09:24:50 +00:00
Christopher Faylor 6d8bd861e2 * child_info.h: Add _PROC_WHOOPS enum value.
(CURR_CHILD_INFO_MAGIC): Update.
(child_info::magic): Make 'long'.
* cygheap.h: Export _cygheap_start.
* cygheap.cc: Don't declare _cygheap_start.
* cygmagic: Use cksum to produce checksums.  Append 'U' to end of checksum.
* dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer.
(_dll_crt0): Detect cygheap mismatch as indicative of different cygwin version.
Set child_proc_info to NULL when _PROC_WHOOPS.
(multiple_cygwin_problem): If child_info specific problem, then set
child_proc_info type to _PROC_WHOOPS.
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(CURR_SHARED_MAGIC): Ditto.
2002-08-27 04:10:54 +00:00
Corinna Vinschen c250f9145b * fhandler.h (fhandler_socket::recvfrom): Fix prototype.
(fhandler_socket::sendto): Ditto.
	* fhandler_socket.cc (fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::sendto): Ditto.
	* include/sys/socket.h (recv): Fix prototype.
	(recvfrom): Ditto.
	(send): Ditto.
	(sendto): Ditto.
	* net.cc (cygwin_sendto): Ditto. Improve strace message
	(cygwin_recvfrom): Ditto.  Ditto.
	(cygwin_setsockopt): Improve strace message.
	(cygwin_getsockopt): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_bind): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_recv): Fix prototype.
	(cygwin_send): Ditto.
	(cygwin_recvmsg): Improve strace message.
	(cygwin_sendmsg): Ditto.
2002-08-26 09:57:27 +00:00
Corinna Vinschen 38170b13ea * sec_acl.cc (getacl): Check ace_sid == well_known_world_sid
before owner_sid and group_sid so that well_known_world_sid
	means "other" even when owner_sid and/or group_sid are Everyone.
	* security.cc (get_attribute_from_acl): Created from code common
	to get_nt_attribute() and get_nt_object_attribute(), with same
	reordering as in getacl() above.
	(get_nt_attribute): Call get_attribute_from_acl().
	(get_nt_object_attribute): Ditto.
2002-08-26 09:56:06 +00:00
Christopher Faylor 7200557403 * Makefile.in (cygcheck.exe): Make a -mno-cygwin program.
* cygrun.c (main): Export CYGWIN=ntsec unless otherwise set.
* shared.cc (shared_name): Only add build date to shared name when
*testing*.
2002-08-26 04:30:11 +00:00
Christopher Faylor f77cd63642 * Makefile.in (DLL_IMPORTS): Move libuuid.a and libshell32.a to list rather
than referring to them via -l.  Add DLL imports last in link line for
new-cygwin.dll and cygrun.exe.
2002-08-25 00:07:10 +00:00
Christopher Faylor 3bacc423cf * pinfo.h (pinfo::remember): Arrange for destructor call if proc_subproc
returns error.
* sigproc.cc (zombies): Store 1 + total zombies since proc_subproc uses
NZOMBIES element.
2002-08-19 14:59:27 +00:00
Corinna Vinschen 34f7289475 * pwdgrp.h (pwdgrp_read::pwdgrp_read): Remove.
(pwdgrp_read::~pwdgrp_read): Ditto.
	(pwdgrp_read::open): Reset fh to NULL instead of INVALID_HANDLE_VALUE.
	(pwdgrp_read::close): Ditto.
2002-08-19 11:27:18 +00:00
Christopher Faylor c060edba34 * fhandler.h (fhandler_console::send_winch_maybe): New method.
* fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed code.
(fhandler_console::send_winch_maybe): Define new method.
(fhandler_console::read): Use send_winch_maybe where appropriate.
(fhandler_console::init): Just call all tcsetattr rather than output_tcsetattr.
* select.cc (peek_console): Reorganize so that send_winch_maybe is called for
everything but keyboard input.
2002-08-19 04:43:58 +00:00
Christopher Faylor 8dca9e2302 * perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
(vfork_save::restore_pid): New method.
(vfork_save::restore_exit): New method.
* fork.cc (vfork): Save ctty, sid, pgid and restore them when returning to
"parent".  Use exitval field if exiting but never created a new process.
* syscalls.cc (setsid): Detect when in "vfork" and force an actual fork so that
pid will be allocated (UGLY!).
(getsid): New function.
* dcrt0.cc (do_exit): Use vfork_save::restore_exit method for returning from a
vfork.
* spawn.cc (spawnve): Use vfork_save::{restore_pid,restore_exit} methods for
returning from vfork.
* cygwin.din: Export getsid.
* include/cygwin/version.h: Bump api minor number.
* malloc.cc: #ifdef sYSTRIm for when MORECORE_CANNOT_TRIM is true.
2002-08-18 05:49:26 +00:00
Christopher Faylor d17ba05c1c * cygmalloc.h (MORECORE_CANNOT_TRIM): Define. 2002-08-18 04:14:59 +00:00
Christopher Faylor 0428827b0e * sigproc.cc (sigCONT): Define.
* sigproc.h (sigCONT): Declare.
(wait_sig): Create sigCONT event here.
* exceptions.cc (sig_handle_tty_stop): Wait for sigCONT event rather than
stopping thread.
(sig_handle): Set sigCONT event as appropriate on SIGCONT rather than calling
ResumeThread.
2002-08-18 04:13:57 +00:00
Christopher Faylor a80add95d9 * malloc.cc: Update to 2.7.2.
* malloc_wrapper.cc (malloc_init): Call user level mallocs to determine if the
malloc has been wrapped.
2002-08-18 03:28:52 +00:00
Christopher Faylor 0763513767 fix typo 2002-08-17 02:16:25 +00:00
Christopher Faylor e0f61e607c Missed this commit in last checkin. 2002-08-16 19:50:22 +00:00
Christopher Faylor 98c9c4569b * winsup.h: Remove malloc_*lock functions. 2002-08-16 19:49:54 +00:00
Christopher Faylor c7e2187a60 * Makefile.in: Add support for new malloc.o and renamed malloc_wrapper.o. Use
-fomit-frame-pointer for malloc.o compilation.
* malloc_wrapper.cc: New file.  Rename from malloc.cc.  Add support for more
malloc functions.  Eliminate export_* calls.  Just use straight malloc names.
Remove unused argument from malloc lock functions.
* cygwin.din: Just export straight malloc names.  Add malloc_stats,
malloc_trim, malloc_usable_size, mallopt, memalign, valloc.
* dcrt0.cc (__cygwin_user): Eliminate export_* malloc entries.
* fork.cc (fork_parent): Remove unused argument from malloc_lock argument.
* malloc.cc: New file.  Doug Lea's malloc v2.7.1.
* cygmalloc.h: New file.
* include/cygwin/version.h: Bump API_MINOR.
* sync.h (muto::acquire): Use appropriate number for regparm attribute.
(muto::reset): Ditto.
(muto::release): Ditto.
2002-08-16 19:41:39 +00:00
Christopher Faylor 775275aac7 * exceptions.cc (interrupt_setup): Ensure that the previous signal mask is
properly saved.
2002-08-16 19:07:28 +00:00
Christopher Faylor a54ad580fc * dcrt0.cc: Modify define for CYGWIN_GUARD.
(alloc_stack_hard_way): Just use CYGWIN_GUARD in VirtualAlloc call.
2002-08-15 20:34:49 +00:00
Christopher Faylor bb55ce4cc1 present tense 2002-08-15 20:24:16 +00:00
Christopher Faylor 052e90e9a9 make comment more accurate. 2002-08-15 15:46:27 +00:00
Conrad Scott e120995086 * fhandler.h (fhandler_socket::recv): Remove method.
(fhandler_socket::send): Ditto.
	* fhandler_socket.cc (fhandler_socket::recv): Ditto.
	(fhandler_socket::send): Ditto.
	(fhandler_socket::read): Delegate to fhandler_socket::recvfrom.
	(fhandler_socket::write): Delegate to fhandler_socket::sendto.
	(fhandler_socket::sendto): Check for null `to' address.
	* net.cc (cygwin_sendto): Check for zero request length.
	(cygwin_recvfrom): Ditto.  Fix signature, use void *buf.
	(cygwin_recv): Delegate to cygwin_recvfrom.
	(cygwin_send): Delegate to cygwin_sendto.
2002-08-12 13:54:12 +00:00
Christopher Faylor 5ffec1d16d * cygthread.cc (cygthread::cygthread): Close another race. 2002-08-11 19:31:24 +00:00
Christopher Faylor 3cb62bd614 * assert.cc (__assert): Call debugger on assertion failure if debugging.
* dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather than
going through the overhead of invoking it.
* fork.cc (fork_child): Ditto.
* exceptions.cc (signal_fixup_after_fork): Call sigproc_init here.
* sigproc.cc (proc_can_be_signalled): Assume that the signal thread is live.
(sig_dispatch): Ditto.
(sig_send): Ditto.
(wait_for_sigthread): Renamed from "wait_for_me".  Assume that wait_sig_inited
has been set and that this function is only called from the main thread.
* winsup.h (wait_for_sigthread): Declare new function.
2002-08-11 19:19:29 +00:00
Christopher Faylor 25859d7ca1 * environ.cc (parse_options): Remember the "no" part of any options for later
export.
2002-08-08 18:02:09 +00:00
Conrad Scott b4f06520f4 * winsup.h (__check_null_invalid_struct): Make ptr argument non-const.
(__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-08-08 17:03:20 +00:00
Corinna Vinschen b7e664540b Patch by Joe Buehler <jbuehler@hekimian.com>:
* sec_helper.cc (sec_acl): remove extraneous arg to debug_printf.
2002-08-08 14:16:14 +00:00
Corinna Vinschen 235d9fdadc Fix by Conrad Scott <conrad.scott@dsl.pipex.com>:
* fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
2002-08-07 10:08:17 +00:00
Christopher Faylor 88de60e449 one more change 2002-08-07 01:22:56 +00:00
Christopher Faylor 772f6c3e12 * cygheap.cc (_csbrk): Avoid !cygheap considerations.
(cygheap_init): Deal with unintialized cygheap issues here.
2002-08-07 01:20:59 +00:00
Christopher Faylor e851d2fe43 Conrad Scott <conrad.scott@dsl.pipex.com
* cygheap.cc (_csbrk): Allocate some slop initially.  Don't erroneously add
sbrk amount to returned value in initial case.
2002-08-06 22:05:53 +00:00
Christopher Faylor 115a0885bc * spawn.cc (spawn_guts): Don't set mount_h here.
* sigproc.cc (init_child_info): Set it here instead.
* shared.cc (cygwin_mount_h): Make NO_COPY.
2002-08-06 05:48:33 +00:00
Christopher Faylor 1524ae42cf * cygthread.cc (cygthread::stub): Accept flag to pass info structure to thread
function.
(cygthread::operator new): Add defense debugging output.
(cygthread::cygthread): Add debugging output.  Set name after thread has been
awakened to avoid a race.
(cygthread::exit_thread): Use handle operator rather than using ev directly.
(cygthread::exit_thread): Reorganize to provide debugging.  Set __name to NULL.
* cygthread.h (cygself): Define.
* fhandler_tty.cc (fhandler_tty_master::init): Use cygself as argument so that
invoked thread can access its own info.
(process_output): Derive cygthread info of thread from thread argument.
* sigproc.cc (sigproc_init): Use cygself as argument so that invoked thread can
access its own info.
(wait_sig): Derive cygthread info of thread from thread argument.
2002-08-06 05:08:55 +00:00
Conrad Scott ffebb4fe0c * debug.h (handle_list::allocated): Remove field.
* debug.cc (newh): Don't malloc extra entries.
	(add_handle): Downgrade strace message level.
	(delete_handle): Remove case for `allocated' entries.
2002-08-06 03:40:40 +00:00
Christopher Faylor 8d0bc156ef * cygthread.cc (cygthread::stub): Change event creation to manual reset. Set
__name after calling SetEvent to prevent races.
(cygthread::detach): Always reset event here to prevent races.
2002-08-05 16:15:46 +00:00
Conrad Scott 245e4e8734 * debug.h (WaitForMultipleObjects): Correct typo. 2002-08-03 23:43:42 +00:00
Christopher Faylor 2389d0af46 update 2002-08-03 23:34:01 +00:00
Corinna Vinschen 23d93d8db7 * security.cc (verify_token): Do not reject a token just because
the supplementary group list is missing Everyone or a groupsid
	equal to usersid, or because the primary group is not in the token,
	as long as it is equal to the usersid.
	* syscalls.cc (seteuid32): Use common code for all successful returns.
	* grp.cc (getgroups32): Never includes Everyone in the output.
2002-08-02 11:00:18 +00:00
Christopher Faylor 6b2a9a2fdf * cygthread.cc (cygthread::exit_thread): Define new method.
* cygthread.h (cygthread::exit_thread): Declare new method.
* fhandler.h (fhandler_tty_master::hThread): Delete.
(fhandler_tty_master::output_thread): Define.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Adjust
constructor.
(fhandler_tty_master::init): Use cygthread rather than handle.
(process_output): Use cygthread method to exit.
(fhandler_tty_master::fixup_after_fork): Set output_thread to NULL after fork.
(fhandler_tty_master::fixup_after_exec): Set output_thread to NULL after
spawn/exec.
* tty.cc (tty_list::terminate): Detach from output_thread using cygthread
method.
2002-08-02 02:10:24 +00:00
Christopher Faylor 8a19897f17 * syscalls.cc (_link): Revert previous change and just always dereference the
oldpath.
2002-08-01 23:53:07 +00:00
Christopher Faylor e51cfd3116 * syscalls.cc (link): Properly deal with a link to a symlink. 2002-08-01 21:29:31 +00:00
Christopher Faylor 92655eab17 * cygthread.cc: Remove cruft. 2002-08-01 16:27:29 +00:00
Christopher Faylor b6bd703781 * Makefile.in (DLL_OFILES): Add cygthread.o.
* dcrt0.cc (dll_crt0_1): Eliminate various thread initialization functions in
favor of new cygthread class.
* debug.cc: Remove thread manipulation functions.
* debug.h: Ditto.
* external.cc (cygwin_internal): Use cygthread method for determining thread
name.  Remove capability for setting thread name.
* fhandler_console.cc (fhandler_console::read): Use cygthread method rather
than iscygthread function.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Use cygthread
methods to create threads.
(fhandler_tty_common::__acquire_output_mutex): Use cygthread method to retrieve
thread name.
* select.cc (pipeinf): Use cygthread pointer rather than handle.
(start_thread_pipe): Ditto.
(pipe_cleanup): Ditto.
(serialinf): Ditto.
(start_thread_serial): Ditto.
(serial_cleanup): Ditto.
(socketinf): Ditto.
(start_thread_socket): Ditto.
(socket_cleanup): Ditto.
* sigproc.cc (hwait_sig): Ditto.
(hwait_subproc): Ditto.
(proc_terminate): Ditto.
(sigproc_terminate): Ditto.
(sigproc_init): Initialize cygthread hwait_sig pointer.
(subproc_init): Initialize cygthread hwait_subproc pointer.
(wait_sig): Rely on cygthread HANDLE operator.
* strace.cc (strace::vsprntf): Use cygthread::name rather than threadname.
* window.cc (gethwnd): Use cygthread method to initialize thread.
2002-08-01 16:20:31 +00:00
Corinna Vinschen afcd48e61b * fhandler.h (fhandler_base::get_r_no_interrupt): Make non-virtual.
* net.cc (fdsock): Call set_r_no_interrupt.
2002-07-31 13:18:51 +00:00
Christopher Faylor deaa100bae * syscalls.cc (_read): Clarify debugging output. 2002-07-31 00:57:40 +00:00
Christopher Faylor c91a9a9b58 * fhandler.h (fhandler_base::get_r_no_interrupt): Make virtual. 2002-07-31 00:26:36 +00:00
Christopher Faylor 5ba08a9238 * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate . and ..
processing here.
(fhandler_cygdrive::readdir): Assume .  and ..  are already in pdrive.
(fhandler_cygdrive::seekdir): Ditto.
2002-07-30 14:17:17 +00:00
Christopher Faylor 4f9cdc9378 fix typo 2002-07-30 04:14:49 +00:00
Christopher Faylor c6ed5790b4 * dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec.
* cygheap.cc (cygheap_fixup_in_child): Call debug_fixup_after_fork_exec
immediately after cygheap has ben set up.
2002-07-30 01:31:51 +00:00
Corinna Vinschen 5519d54352 * security.cc: Change some formatting.
* include/cygwin/version.h: Bump API minor version.

        * cygheap.h (class cygheap_user): Add member groups.
        * security.h (class cygsidlist): Add members type and maxcount,
        methods position, addfromgr, alloc_sids and free_sids and
        operator+= (const PSID psid). Modify contains () to call
        position () and optimize add () to use maxcount.
        (class user_groups): Create.
        Update declarations of verify_token and create_token.
        * security.cc (cygsidlist::alloc_sids): New.
        (cygsidlist::free_sids): New.
        (get_token_group_sidlist): Create from get_group_sidlist.
        (get_initgroups_sidlist): Create from get_group_sidlist.
        (get_group_sidlist): Suppress.
        (get_setgroups_sidlist): Create.
        (verify_token): Modify arguments. Add setgroups case.
        (create_token): Modify arguments. Call get_initgroups_sidlist and
        get_setgroups_sidlist as needed. Set SE_GROUP_LOGON_ID from auth_pos
        outside of the loop. Rename the various group sid lists consistently.
        * syscalls.cc (seteuid32): Modify to use cygheap->user.groups.
        (setegid32): Call cygheap->user.groups.update_pgrp.
        * grp.cc (setgroups): Create.
        (setgroups32): Create.
        * uinfo.cc (internal_getlogin): Initialize and update user.groups.pgsid.
        * cygwin.din: Add setgroups and setgroups32.
2002-07-29 12:51:52 +00:00
Christopher Faylor eb5720f255 * fhandler_console.cc (fhandler_console::read): Use appropriate kill_pgrp
method.
* select.cc (peek_console): Ditto.
* fhandler_termios.cc (fhandler_termios::bg_check): Send "stopped" signal to
entire process group as dictated by SUSv3.
* termios.cc (tcsetattr): Detect when stopped signal sent and force a stop
before setting anything.
2002-07-29 03:18:41 +00:00
Christopher Faylor 667f875d17 * include/cygwin/version.h: Bump API version to indicate that ntsec is on by
default now.
2002-07-27 01:52:05 +00:00
Christopher Faylor 6b3c247d07 * fhandler_registry.cc (fhandler_registry::close): Return any error result to
the caller.
* syscalls.cc (_close): Return result of fhandler::close to the caller.
2002-07-26 19:58:00 +00:00
Christopher Faylor 68fb3cca64 * security.cc (allow_ntsec): Default to on.
(allow_smbntsec): Default to off.
2002-07-25 17:04:13 +00:00
Christopher Faylor be18721ec4 * times.cc (to_time_t): Always round time_t down to nearest second. 2002-07-25 15:59:49 +00:00
Egor Duda b9e8058df3 * Makefile.in: Check if API version is updated when exports are
changed and stop if not so.
2002-07-25 09:09:34 +00:00
Corinna Vinschen bf47141f36 * include/cygwin/version.h: Bump minor API version. 2002-07-24 11:06:46 +00:00
Corinna Vinschen 0a73fce00c * fhandler_serial.cc: Change 'must_init_serial_line capability'
to 'supports_reading_modem_output_lines' throughout (negated meaning).
	* wincap.cc: Ditto.
	* wincap.h: Ditto.
2002-07-24 11:01:37 +00:00
Corinna Vinschen f72a851fc7 * cygwin.din (fcloseall): Add symbol for export.
(fcloseall_r): Ditto.
2002-07-24 07:38:03 +00:00
Christopher Faylor 99138976d9 * path.cc (path_conv::check): Always set fileattr when component == 0.
(readlink): Use path_conv method rather than field.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto, throughout.
* path.h (path_conv): Make fileattr private.
* exceptions.cc (try_to_debug): Default to idle priority when looping.
2002-07-24 05:37:47 +00:00
Corinna Vinschen 010bb8a4a1 * fhandler_serial.cc: Use must_init_serial_line capability throughout.
* wincap.cc: Set flag must_init_serial_line appropriately.
	* wincap.h: Add flag must_init_serial_line.
2002-07-23 14:47:17 +00:00
Corinna Vinschen fdb93cd2e1 * security.cc (get_group_sidlist): Create group list from /etc files
even if DC is available but access fails.
2002-07-23 14:34:27 +00:00
Christopher Faylor 08e2551c20 * fhandler_serial.cc: Fix formatting problems introduced by below changes. 2002-07-22 14:30:30 +00:00
Corinna Vinschen 780c42b43a * fhandler.h (class fhandler_serial): Add new members of
the class - rts,dtr and method ioctl(). Variables rts and dtr
	important for Win 9x only.
	* fhandler_serial.cc (fhandler_serial::open): Add initial setting
	of dtr and rts. Important for Win 9x only.
	(fhandler_serial::ioctl): New function. Implements commands TIOCMGET,
	TIOCMSET and TIOCINQ.
	(fhandler_serial::tcflush): Fixed found error.
	(fhandler_serial::tcsetattr): Add settings of rts and dtr. Important
	for Win 9x only.
	* termios.h: Add new defines as a support for ioctl() function
	on serial device.
2002-07-22 09:11:45 +00:00
Christopher Faylor 5ec1dcc5bf * autoload.cc (LoadDLLprime): Add jmp call to allow streamlining of later jmp
rewrite.
(doit): Avoid use of cx register.  Just change one word to avoid races.
2002-07-20 04:59:15 +00:00
Christopher Faylor 44480f46ea white space 2002-07-19 23:48:17 +00:00
Corinna Vinschen 095a1272e8 * security.cc (get_unix_group_sidlist): Create.
(get_supplementary_group_sidlist): Evolve into get_unix_group_sidlist.
	(get_user_local_groups): Add check for duplicates.
	(get_user_primary_group): Suppress.
	(get_group_sidlist): Silently ignore PDC unavailability.
	Call get_unix_group_sidlist() before get_user_local_groups().
	Remove call to get_supplementary_group_sidlist(). Never call
	get_user_primary_group() as the passwd group is always included.
	Add well_known_authenticated_users_sid in only one statement.
2002-07-19 15:04:18 +00:00
Christopher Faylor 86620e8f92 * fhandler_serial.cc (fhandler_serial::tcflush): Fix typo. 2002-07-19 14:17:11 +00:00
Corinna Vinschen 315fb3afb0 * security.cc (get_group_sidlist): Fix formatting. 2002-07-15 09:06:44 +00:00
Christopher Faylor 56a42791a3 * dcrt0.cc (initial_env): Force path and CYGWIN_DEBUG contents to lower case.
* exceptions.cc (error_start_init): Use the name derived from GetModuleName
rather than myself->progname.
2002-07-15 03:48:52 +00:00
Christopher Faylor 3d0ba393df * dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a compiler
warning.
* shared.cc (memory_init): Remove debug_init call.
* debug.h (handle_list): Change "clexec" to "inherited".
* debug.cc: Remove a spurious declaration.
(setclexec): Conditionalize away since it is currently unused.
(add_handle): Use inherited field rather than clexec.
(debug_fixup_after_fork_exec): Ditto.  Move debugging output to delete_handle.
(delete_handle): Add debugging output.
* fhandler.cc (fhandler_base::set_inheritance): Don't bother setting
inheritance in debugging table since the handle was never protected anyway.
(fhandler_base::fork_fixup): Ditto.
* exceptions.cc (debugger_command): Revert.
2002-07-14 19:15:32 +00:00
Christopher Faylor f5c3d18080 * debug.cc (clexec): Add missing `hl = hl->next'. 2002-07-14 16:16:33 +00:00
Christopher Faylor e8a6396f88 * Makefile.in (cygrun.exe): Add a -lcygwin on the end. 2002-07-14 04:14:32 +00:00
Christopher Faylor fea4c29fda * Makefile.in (cygserver.exe): Add -lstdc++.
(cygrun.exe): Move -lgcc last.
2002-07-14 04:03:01 +00:00
Christopher Faylor 613219252e add initial information 2002-07-13 21:15:10 +00:00
Christopher Faylor 6cb6ef7315 cleanup a tad 2002-07-13 21:13:37 +00:00
Christopher Faylor c03dba93d6 * dcrt0.cc (dll_crt0_1): Delay closing of some handles until cygheap has been
set up.
(break_here): New function, for debugging.
(initial_env): Add program name to "Sleeping" message.  Implement new
"CYGWIN_DEBUG" environment variable option.
* exceptions.cc (debugger_command): Add argument to dumper call.
* strace.cc (strace::hello): Use winpid if cygwin pid is unavailable.
(strace::vsprntf): Ditto.
2002-07-13 21:08:13 +00:00
Christopher Faylor 0301bfd0ac * debug.h (handle_list): Move here from debug.cc. Add "inherit" flag
functionality.
* cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk.
(_csbrk): Reorganize to not assume first allocation is <= 1 page.
(cygheap_setup_for_child): Mark protected handle as inheritable.
* cygheap.h (cygheap_debug): New struct.
(init_cygheap): Add new structure when debugging.
* dcrt0.cc (dll_crt0_1): Remove call to debug_init.  Close ppid_handle here, if
appropriate.  Don't protect subproc_ready, since it is already protected in the
parent.  Call memory_init prior to ProtectHandle to ensure that cygheap is set
up.  Call debug_fixup_after_fork_exec when appropriate.
(_dll_crt0): Don't close ppid_handle here.
* debug.cc: Use cygheap debug structure rather than static elements throughout.
(add_handle): Don't issue a warning if attempt to protect handle in exactly the
same way from exactly the same place.  Add pid info to warning output.  Accept
additional argument controlling whether handle is to be inherited.  Add pid to
stored information.
(debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork.  Reorganize
to avoid erroneously skipping handles.
(mark_closed): Add pid info to warning output.
(setclexec): Rename from setclexec_pid.
* fhandler.cc (fhandler_base::get_default_fmode): Minor reorg.
(fhandler_base::fstat): Add debugging output.
(fhandler_base::set_inheritance): Call setclexec rather than setclexec_pid.
(fhandler_base::fork_fixup): Ditto.
* fhandler_console.cc (get_tty_stuff): Mark protected handle as inheritable.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* tty.cc (tty::make_pipes): Ditto.
(tty::common_init): Ditto.
* fork.cc (fork_parent): Ditto.
(fork_child): Close protected handles with correct name.  Remove
debug_fixup_after_fork call.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Mark protected
handle as inheritable/non-inheritable, as appropriate.
* shared.cc (memory_init): Mark protected handle as inheritable.  Call
debug_init here.
* sigproc.cc (wait_sig): Close protected handle with correct name.
* spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as
inheritable.
* exceptions.cc (debugger_command): Try to run dumper.exe, if found.
* syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup since path
is already resolved.
2002-07-13 20:00:27 +00:00
Christopher Faylor 37f7c64b8b fyx tipo. 2002-07-12 22:59:19 +00:00
Christopher Faylor e82f98d050 * cygwin.in: Change erroneous entries. 2002-07-12 21:32:31 +00:00
Corinna Vinschen 472a822319 * fhandler_disk_file.cc (fhandler_disk_file::open): Don't
move the file pointer to the end of file if O_APPEND is
	specified in the open flags.
2002-07-11 14:05:17 +00:00
Christopher Faylor 1f5ff38778 * debug.cc: Avoid explicit zeroing of globals.
(lock_debug): Make locker a static member.  Avoid unlocking when already
unlocked (from Conrad Scott).
(debug_init): Initialize lock_debug::locker here.
* fork.cc (fork_child): Fix up fdtab earlier to avoid some (but not all)
confusion with close-on-exec craziness.
2002-07-09 04:37:13 +00:00
Christopher Faylor a635af7c2a Add missing entry from 2002-06-25 2002-07-07 00:40:52 +00:00
Corinna Vinschen 6bb769efa0 * fhandler.h (fhandler_socket::is_unconnected): Constify.
(fhandler_socket::is_connect_pending): Ditto.
	(fhandler_socket::is_connected): Ditto.
	(fhandler_socket::set_connect_state): New method.
	(struct select_record): Add member `except_on_write'.
	(select_record::select_record): Initialize all bool values to `false'.
	* fhandler_socket.cc: Use set_connect_state() method throughout.
	(fhandler_socket::connect): Set state always to connected if connection
	isn't pending.
	* net.cc (cygwin_getsockopt): Revert erroneous previous patch.
	* select.cc (set_bits): Check for `except_on_write'.  Set fd in
	write_fds if set.  Set connect state to connected if fd has been
	returned by WINSOCK_SELECT.
	(peek_socket): Check for `except_on_write'.
	(start_thread_socket): Ditto.
	(fhandler_socket::select_write): Don't set `write_ready' if connect
	is pending.  Set `except_on_write' if connect is pending.
2002-07-06 11:16:07 +00:00
Christopher Faylor 6201dd26a6 add missing entry 2002-07-05 22:00:46 +00:00
Christopher Faylor 91a2f87b9d * ntdll.h (_SYSTEM_PROCESSOR_TIMES): Force eight byte alignment.
(_SYSTEM_TIME_OF_DAY_INFORMATION): Ditto.
2002-07-05 21:58:49 +00:00
Corinna Vinschen d5591d9df6 * fhandler.h (UNCONNECTED): New define.
(CONNECT_PENDING): Ditto.
	(CONNECTED): Ditto.
	(class fhandler_socket): Add member `had_connect_or_listen'.
	Add member functions `is_unconnected', `is_connect_pending' and
	`is_connected'.
	* fhandler_socket.cc (fhandler_socket::connect): Set member
	`had_connect_or_listen' according to return code of WinSock
	call.
	(fhandler_socket::listen): Ditto.
	* net.cc (cygwin_getsockopt): Modify SO_ERROR return value in
	case of socket with pending connect().
	* select.cc (peek_socket): Only add socket to matching fd_set
	if it's not "ready".  Call WINSOCK_SELECT only if at least one
	socket is in one of the fd_sets.
	(start_thread_socket): Only add socket to matching fd_set
	if it's not "ready".
	(fhandler_socket::select_write): Set write_ready to true also
	if socket isn't connected or listening.
2002-07-05 18:26:23 +00:00
Corinna Vinschen 5cff62d656 * fhandler_socket.cc (fhandler_socket::set_sun_path): Don't free
memory here.  Allow NULL parameter.
2002-07-04 17:18:14 +00:00
Corinna Vinschen e48947085c * fhandler_socket.cc (fhandler_socket::dup): Add missing copy operation
on sun_path.
2002-07-04 15:32:34 +00:00
Robert Collins d288c1c78c 2002-06-25 Thomas Pfaff <tpfaff@gmx.net>
* include/pthread.h (PTHREAD_CANCELED): Defined a reasonable
        value.
	* pthread.cc (pthread_exit): Call method instead of function.
	(pthread_setcancelstate): Ditto.
	(pthread_setcanceltype): Ditto.
	(pthread_testcancel): Ditto.
	* thread.h (pthread::cancel_event): New member.
        (__pthread_cancel_self): New prototype.
	(pthread::exit): New Method.
	(pthread::cancel): Ditto.
	(pthread::testcancel): Ditto.
	(pthread::cancel_self): Ditto.
	(pthread::static_cancel_self): Ditto.
	(pthread::setcancelstate): Ditto.
	(pthread::setcanceltype): Ditto.
	(__pthread_cancel): Give c++ linkage.
	(__pthread_exit): Remove.
	(__pthread_setcancelstate): Ditto.
	(__pthread_setcanceltype): Ditto.
	(__pthread_testcancel): Ditto.
	 * thread.cc (pthread::pthread): Inititialize cancel_event.
	(pthread::~pthread): Close cancel_event if needed.
	(pthread::create): Create cancel_event.
	(pthread::exit): New method. Replacement for __pthread_exit.
	(pthread::cancel): New method.
	(pthread::testcancel): Ditto.
	(pthread::static_cancel_self); New static method.
	(pthread::setcancelstate): New method. Replacement for
	__pthread_setcancelstate.
	(pthread::setcanceltype): New method. Replacement for
	__pthread_setcanceltype.
	(pthread::pop_cleanup_handler): Added lock for async cancel safe
	cancellation.
	(pthread::thread_init_wrapper): Change __pthread_exit to
	thread->exit().
	(__pthread_cancel): Call method thread->cancel().
	(__pthread_exit): Remove.
	(__pthread_setcancelstate): Ditto.
	(__pthread_setcanceltype): Ditto.
	(__pthread_testcancel): Ditto.
2002-07-04 14:17:30 +00:00
Christopher Faylor 073aa6812a * include/cygwin/version.h: Bump DLL minor number. 2002-07-03 22:25:38 +00:00
Christopher Faylor a0ee9f7574 * include/sys/statfs.h: New header file. 2002-07-03 20:31:39 +00:00
Christopher Faylor 58b43c8d91 * dtable.cc (cygwin_attach_handle_to_fd): Default to implicit bin mode if none
specified.
* fhandler.cc (fhandler_base::init): Make bin argument a guarantee rather than
a suggestion.
* path.cc (path_conv::check): Load flag returned from cygwin_conv_to_win32_path
into path_flags.
2002-07-03 18:02:54 +00:00
Conrad Scott bd86408f58 * tty.cc (tty::common_init): Reverse logic of cygserver check in
call to SetKernelObjectSecurity.
2002-07-03 15:56:35 +00:00
Corinna Vinschen 3c6bd99175 * autoload.cc (WSAEventSelect): Define new autoload function.
(WSAEnumNetworkEvents): Ditto.
	* fhandler_socket.cc (fhandler_socket::accept): If socket is
	in blocking mode wait for incoming connection and signal.
2002-07-03 09:20:24 +00:00
Christopher Faylor 4558638014 * cygheap.cc (init_cheap): Rearrange error message.
(cygheap_fixup_in_child): Ditto.
* dtable.cc: Remove if 0'ed code.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode.
* sec_helper.cc (cygsid::get_id): Use system_printf for error message.
* tty.cc (tty::common_init): Ditto.
2002-07-03 03:20:50 +00:00
Christopher Faylor 5d23017437 * net.cc (cygwin_getpeername): Defend against NULL pointer dereference. 2002-07-02 23:57:05 +00:00
Corinna Vinschen b7e51146bf * include/cygwin/version.h: Bump API minor version. 2002-07-02 09:40:07 +00:00
Corinna Vinschen 891bb974f9 * security.cc (get_logon_server): Interpret a zero length
domain as the local domain.
	(get_group_sidlist): Add authenticated users SID to SYSTEM's group
	list instead of SYSTEM itself.
	(verify_token): Accept the primary group sid if it equals
	the token user sid.
2002-07-02 09:02:53 +00:00
Corinna Vinschen aeed87e86e * cygwin.din (__fpclassifyd): Add symbol.
(__fpclassifyf): Ditto.
	(__signbitd): Ditto.
	(__signbitf): Ditto.
2002-07-02 08:44:54 +00:00
Corinna Vinschen 654bad37a6 * security.h (DONT_INHERIT): Eliminate definition.
(INHERIT_ALL): Ditto.
	(INHERIT_ONLY): Ditto.
	* sec_acl.cc: Use appropriate defines from accctrl.h instead of the
	above throughout.
	* security.cc: Ditto.
2002-07-02 08:11:15 +00:00
Christopher Faylor e968058fed * syscalls.c (seteuid32): Return immediately if the program is not impersonated
and both uid and gid are original.
(setegid32): Return immediately if the new gid is the current egid.
2002-07-02 03:06:32 +00:00
Christopher Faylor 3434e0c857 * syscalls.cc (seteuid32): Fix incorrect placement of Pierre's patch below. 2002-07-02 01:53:58 +00:00
Christopher Faylor 3557bbc1ea * syscalls.cc (seteuid32): Fix incorrect use of system_printf. 2002-07-02 01:42:41 +00:00
Christopher Faylor 74fcdaec20 * autoload.cc (GetSecurityInfo): Define new autoload function.
(RegQueryInfoKeyA): Ditto.
* fhandler.h (fhandler_virtual::fill_filebuf): Change return type to bool.
(fhandler_proc::fill_filebuf): Ditto.
(fhandler_registry::fill_filebuf): Ditto.
(fhandler_process::fill_filebuf): Ditto.
(fhandler_registry::value_name): Add new member.
(fhandler_registry::close): Add new method.
(fhandler_process::p): Remove member.
* fhandler_proc.cc (fhandler_proc::open): Add set_nohandle after calling
superclass method.  Check return value of fill_filebuf.
(fhandler_proc::fill_filebuf): Change return type to bool.  Add return
statement.
* fhandler_process.cc (fhandler_process::open): Add set_nohandle after calling
superclass method.  Remove references to p.  Check return value of
fill_filebuf.
(fhandler_process::fill_filebuf): Change return type to bool.  Don't use
dereference operator on p.  Add return statement.
(fhandler_process::format_process_stat): Fix typo.
* fhandler_registry.cc: Add static open_key declaration.
(fhandler_registry::exists): Assume path is already normalised.  Try opening
the path as a key in its own right first, before reverting to enumerating
subkeys and values of the parent key.
(fhandler_registry::fstat): Add additional code to return more relevant
information about the registry key/value.
(fhandler_registry::readdir): Explicitly set desired access when opening
registry key.  Remove output of buf from debug_printf format string.
(fhandler_registry::open): Use set_io_handle to store registry key handle.  Set
value_name member.  Move code to read a value from the registry to
fill_filebuf.  Add call to fill_filebuf.
(fhandler_registry::close): New method.
(fhandler_registry::fill_filebuf): Change return type to bool.  Add code to
read a value from registry.
(fhandler_registry::open_key): Make function static.  Use KEY_READ as desired
access unless this is the last path component.  Check the return value of
RegOpenKeyEx for an error instead of hKey.
* fhandler_virtual.cc (fhandler_virtual::lseek): Check the return value of
fill_filebuf.
(fhandler_virtual::open): Remove call to set_nohandle.
(fhandler_virtual::fill_filebuf): Change return type to bool.  Add return
statement.
* security.cc (get_nt_object_attribute): New function.
(get_object_attribute): New function.
* security.h (get_object_attribute): New function declaration.
2002-07-02 01:36:15 +00:00
Christopher Faylor 96edd0a9da * syscalls.c (seteuid32): Do not return an error when the token cannot be
created only because of a problem with the gid.
2002-07-01 23:42:05 +00:00
Christopher Faylor 1bc9effd28 * fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode.
* fhandler_console.cc (fhandler_console::open): *Really* force binary mode
rather than make it optional.
* fhandler_proc.cc (fhandler_proc::open): Ditto.
* fhandler_process.cc (fhandler_process::open): Ditto.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
* fhandler_registry.cc (fhandler_registry::open): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* net.cc (fdsock): Ditto.
* path.cc (set_flags): Add more debugging.
2002-07-01 19:03:26 +00:00
Christopher Faylor b5e1ec7632 * debug.cc (threads): Avoid initialization.
* uinfo.cc (cygheap_user::ontherange): (from Corinna Vinschen) Actually make
below changes work.
2002-07-01 16:37:46 +00:00
Christopher Faylor db57a36336 * uinfo.cc (cygheap_user::ontherange): Make cygwin root the last resort for
HOMEPATH/HOMEDRIVE for consistency with HOME.
2002-07-01 15:50:02 +00:00