Commit Graph

1326 Commits

Author SHA1 Message Date
Christopher Faylor 34971f0f8c * mount.cc (main): Issue correct warning for 'not enough arguments'. 2001-08-28 18:48:38 +00:00
Christopher Faylor 8d661d3658 * select.cc (cygwin_select): Ensure that arguments are zeroed on timeout.
(select_stuff::wait): Ditto.
2001-08-27 15:59:26 +00:00
Christopher Faylor e32b4e81cb * syscalls.cc (check_tty_fds): New function. Check whether there is a fd
referring to pty slave.
(setsid): Don't detach console if the process has a pty slave.
2001-08-25 17:27:31 +00:00
Corinna Vinschen 5d0fe6351a * net.cc (free_addr_list): Add define for symmetry.
(free_hostent_ptr): Use free_addr_list to free h_addr_list element.
        (dup_addr_list): New static function.
        (dup_hostent_ptr): Use dup_addr_list instead of dup_char_list in order
        to handle embedded null characters.
2001-08-24 06:57:53 +00:00
Christopher Faylor ecaff08ccd * dtable.cc (dtable::dup2): Allow extension of fd table by dup2.
* syscalls.cc: Minor code cleanup.
(fpathconf): Check for bad fd before doing anything else.
* termios.cc (tcsetattr): Don't convert to new termios if bad fd.
(tcgetattr): Minor debugging tweak.
2001-08-23 02:27:01 +00:00
Corinna Vinschen cb19ccf4b5 * net.cc (cygwin_inet_ntoa): Rearrange previous patch to use
thread local buffer space when compiled thread safe.
        (cygwin_getprotobyname): Ditto.
        (cygwin_getprotobynumber): Ditto.
        (cygwin_getservbyname): Ditto.
        (cygwin_getservbyport): Ditto.
        (cygwin_gethostbyname): Ditto.
        (cygwin_gethostbyaddr): Ditto. Move near to cygwin_gethostbyname.
        * thread.h (struct _winsup_t): Add pointers for above used buffer space.
        * passwd.cc (getpwduid): Remove initializing passwd.
        (setpwent): Ditto.
        (endpwent): Ditto.
        (setpassent): Ditto.
2001-08-22 21:51:48 +00:00
Christopher Faylor 0a047e8f32 * smallprint.c (console_printf): New function.
* dcrt0.cc (dll_crt0_1): Use console_printf for debugging output.
* debug.cc (debug_mark_closed): New function.
(close_handle): Use debug_mark_closed.
* debug.h: Declare new functions.
* dtable.cc (dtable::build_fhandler): Remove unneeded extern.
* spawn.cc: Cosmetic changes.
* winsup.h: Define NO_COPY for C files, too.  Declare a global.
2001-08-22 17:50:22 +00:00
Corinna Vinschen 1fdc8df95d * net.cc (free_char_list): New static function.
(dup_char_list): Ditto.
        (free_protoent_ptr): Ditto.
        (dup_protoent_ptr): Ditto.
        (free_servent_ptr): Ditto.
        (dup_servent_ptr): Ditto.
        (free_hostent_ptr): Ditto.
        (dup_hostent_ptr): Ditto.
        (cygwin_inet_ntoa): Use local static buffer to allow propagating of
        the result to child processes.
        (cygwin_getprotobyname): Ditto.
        (cygwin_getprotobynumber): Ditto.
        (cygwin_getservbyname): Ditto.
        (cygwin_getservbyport): Ditto.
        (cygwin_gethostbyname): Ditto.
        (cygwin_gethostbyaddr): Ditto.
2001-08-22 15:31:59 +00:00
Christopher Faylor d4d65813a7 fix typo. 2001-08-22 02:40:22 +00:00
Earnie Boyd de8e9cfb39 * include/setupapi.h : New file.
* lib/setupapi.def:New file.
	* lib/test.c: Include setupapi.h.
	* include/winioctl.h (_DISK_PERFORMANCE): Correct typo.
	* include/richedit.h (ENLINK): Add structure definition.
	(EM_AUTOURLDETECT, EN_LINK, ENM_LINK): Add defines.
	* include/shlobj.h (CMIC_*): Remove duplicate defines.
	(CMDSTR_*): Remove duplicates; UNICODE string constants.
	(GCS_*): Make UNICODE.
	(CSIDL_*): Add more defines.
	* include/winioctl.h (_MEDIA_TYPE): Add pointer typedef.
	(_DISK_GEOMETRY): Ditto.
	(_DISK_PERFORMANCE): Ditto.
	* include/winbase.h (HasOverlappedIoCompleted): Add macro.
	* include/winnt.h: Move CHAR, SHORT and LONG typedefs outside
	of block protected by #ifndef VOID.
	(This reverts 1998-12-01 Anders Norlander change.)
	* include/odbcinst.h: End file with newline.
	* include/raserror.h: Ditto.
	* include/winsock2.h (#include <wtypes.h): Don't.
	(_BLOB): Define instead, if not already done.
	(__BLOB_T_DEFINED: New define for guarding _BLOB.
	* include/wtypes.h (_BLOB): Guard against prior definition.
	* include/oaidl.h (tagVARIANT): Mark anonymous structs and unions
	 as 	__extension__.
	(tagTYPEDESC): Ditto.
	(_wireBRECORD): Add structure definition.
	(_wireSAFEARR_BRECORD): Ditto.
	(_wireSAFEARR_HAVEIID): Ditto.
	(_wireSAFEARRAY_UNION.u): Add fields SAFEARR_BRECORD RecordStr,
	SAFEARR_HAVEIID HaveIidStr.
	(tagVariant): Add fields _VARIANT_BOOL bool,*pbool.
	(_wireVARIANT): Change field parray to type wirePSAFEARRAY,
	pparray to wirePSAFEARRAY*.
	(_wireVARIANT): Add field wireBRECORD brecVal.
	(wireVARIANT): Change typedef to struct _wireVariant*.
	(IRecordInfo): Add interface definition.
	(LPRECORDINFO): Add typedef for IRecordInfo*.
	(IID_IRecordInfo): Add forward decalaration.
	* include/lmcons.h: Guard CNLEN and UNCLEN against prior definition.
	* include/nddeapi.h: Likewise.
	* ChangeLog: Formatting and typo fixes.
2001-08-21 13:58:52 +00:00
Christopher Faylor d9b68c2c7d debug 2001-08-20 16:03:54 +00:00
Christopher Faylor b1d0b9073c * cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT. 2001-08-20 15:58:16 +00:00
Egor Duda 933cbf6213 * fhandler_socket.cc (fhandler_socket::create_secret_event): Relax
security of secret_event so AF_UNIX socket clients can connect to
servers even if running under a different user account.
(fhandler_socket::check_peer_secret_event): Ditto.
2001-08-16 14:34:27 +00:00
Corinna Vinschen 1457739a63 * resource.cc (getrlimit): Return getdtablesize () as current limit
on RLIMIT_NOFILE.
        * syscalls.cc (getdtablesize): Return OPEN_MAX if current dtable size
        is less than OPEN_MAX, the current dtable size otherwise.
        * sysconf.cc (sysconf): Return getdtablesize () on _SC_OPEN_MAX.
2001-08-16 14:29:21 +00:00
Corinna Vinschen 3171175e90 * resource.cc (getrlimit): Return OPEN_MAX as current limit
on RLIMIT_NOFILE.
        * syscalls.cc (getdtablesize): Return OPEN_MAX.
        * sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX.
        * include/limits.h (OPEN_MAX): Define as 256.
2001-08-16 14:20:09 +00:00
Corinna Vinschen 91a1423a87 * times.cc (utimes): Revert previous change. Just open the
file using FILE_WRITE_ATTRIBUTES instead of GENERIC_WRITE
        on NT/W2K.
2001-08-15 10:48:43 +00:00
Corinna Vinschen 2a9366ff49 * security.cc (set_nt_attribute): Return always -1 in case of
a failure.
        * times.cc (utimes): On NTFS with ntsec ON, change the file's
        security descriptor temporarily to acquire write access if
        opening the file failed.
2001-08-15 10:21:39 +00:00
Corinna Vinschen 5fd12fb0cc * fhandler.cc (fhandler_base::is_nonblocking): New method.
(fhandler_base::set_nonblocking): Ditto.
        * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and
        `set_nonblocking'.
        * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'.
        * fhandler_tty.cc (fhandler_pty_master::process_slave_output):
        Use `is_nonblocking'.
        (fhandler_tty_slave::read): Ditto.
        (fhandler_tty_slave::ioctl): Use `set_nonblocking'.
        (fhandler_pty_master::ioctl): Ditto.
        * net.cc (cygwin_sendto): Fallback to winsock 1 functionality
        in case of nonblocking IO.
        (cygwin_recvfrom): Ditto.
        (cygwin_recv): Ditto.
        (cygwin_send): Ditto.
        * syscalls.cc (_read): Use `is_nonblocking'.
2001-08-15 07:49:15 +00:00
Christopher Faylor da3ea61edd * cygpath.cc (main): Support -w for Windows (System) directories and return
physical correct orthography for the Windows System dir.
2001-08-15 03:24:18 +00:00
Christopher Faylor 3ca6bcc4d0 * include/cygwin/version.h: Bump API version. 2001-08-14 15:05:43 +00:00
Egor Duda 7da232abd7 * spawn.cc (spawn_guts): Enable appropriate privilege before
loading user's registry hive.
2001-08-14 14:57:44 +00:00
Corinna Vinschen 6a574f1ad6 * fhandler.cc (fhandler_base::fcntl): Use new O_NONBLOCK_MASK define.
* fhandler.h: Move definitions of O_NOSYMLINK, O_DIROPEN and
        OLD_O_NDELAY from winsup.h to here. Add O_NONBLOCK_MASK define.
        * fhandler_socket.cc (fhandler_socket::close): Add hack to allow
        a graceful shutdown even if shutdown() hasn't been called by the
        application. Add debug output.
        (fhandler_socket::ioctl): Set fhandler's NONBLOCK flag according
        to FIONBIO setting.
        (fhandler_socket::fcntl): Use new O_NONBLOCK_MASK define. Actually
        set `request' before using it.
        * fhandler_tty.cc: Use new O_NONBLOCK_MASK define throughout.
        (fhandler_tty_slave::ioctl): Set fhandler's NONBLOCK flag according
        to FIONBIO setting.
        (fhandler_pty_master::ioctl): Ditto.
        * net.cc (wsock_event::prepare): Compare WSACreateEvent return code
        with `WSA_INVALID_EVENT' according to MSDN.
        * syscalls.cc (_read): Use new O_NONBLOCK_MASK define.
2001-08-14 07:41:45 +00:00
Christopher Faylor 29a075260a Oops. Forgot to check in include/wchar.h??? 2001-08-11 01:56:53 +00:00
Earnie Boyd 6286806473 * lib/kernels.c: New file. 2001-08-10 11:52:35 +00:00
Earnie Boyd 5b9d54bf97 * lib/test.c (Win32_Winsock): Replace with __USE_W32_SOCKETS.
Add more includes of w32api headers.
	* include/winnt.h (GetCurrentFiber): Change __inline to __inline__.
	Swap asm code with that of GetFiberData.
	(GetFiberData): Ditto.
	* lib/kernels.c: New file, containing library versions of
	GetCurrentFiber and GetFiberData.
	* lib/makefile.in: Add kernel32.o as static object to libkernal32.a.
2001-08-10 11:51:03 +00:00
Christopher Faylor f11db2f4fa * include/wchar.h: Define __need_wint_t. 2001-08-08 19:26:24 +00:00
Earnie Boyd 89500585f7 * include/winuser.h (GET_WHEEL_DELTA_WPARAM): Add macro.
* lib/oleaut32.def: Regenerate.
2001-08-08 17:25:23 +00:00
Corinna Vinschen 8c62297ac5 * security.cc (alloc_sd): Revert to setting inheritance attribute for
permissions given to directories. Never set inheritance on NULL ACE.
2001-08-08 10:00:35 +00:00
Corinna Vinschen c0ae23dc47 * security.cc (alloc_sd): Don't set FILE_DELETE_CHILD for group
if S_ISVTX attribute is given.
        * dir.cc (mkdir): Allow immediate setting of S_ISUID, S_ISGID and
        S_ISVTX attribute.
        * syscalls.cc (_open): Ditto.
2001-08-07 16:14:59 +00:00
Corinna Vinschen 86fb039324 * dir.cc (mkdir): Set security attributes correctly for
CreateDirectoryA () call if ntsec is on. Don't call
        set_file_attributes () then.
        * fhandler.cc (fhandler_base::open): Ditto for CreateFileA () call.
        * path.cc (symlink): Ditto.
        * security.cc (set_security_attribute): New function.
        * security.h: Add declaration for `allow_ntea' and
        `set_security_attribute'.
2001-08-07 15:09:54 +00:00
Corinna Vinschen f5e8e2be4a * grp.cc (class grp_check): New class. Make `group_state'
a member of class grp_check.
        (read_etc_group): Free former allocated memory on reread.
        * passwd.cc (class pwd_check): New class Make `passwd_state'
        a member of class pwd_check.
        (read_etc_passwd): Free former allocated memory on reread.
2001-08-07 08:56:22 +00:00
Christopher Faylor 300624d4f3 * fhandler_console.cc (get_tty_stuff): Don't initialize shared memory console
area if it is already initialized.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Augment debugging info.
2001-08-07 05:15:59 +00:00
Christopher Faylor 96a3f4ae68 * cygheap.cc (cygheap_root::set): Avoid treating '/' specially.
* fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style flag
passed in from application.
* fhandler_socket.cc (fhandler_socket::fcntl): Ditto.
* fhandler.h: Set constant for future use.
* winsup.h: Define OLD_O_NDELAY only for old programs.
* include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
2001-08-07 00:01:42 +00:00
Earnie Boyd 386abb05d9 * include/stdlib.h (_wpgmptr): Don't declare ifndef __MSVCRT__.
* include/stdio.h (_IORW): Change constant to 0x0080.
	(TMP_MAX): Add new define.
	(_P_tmpdir): Ditto.
	(_wP_tmpdir): Ditto.
	(L_tmpnam): Change constant to 16.
	* include/malloc.h: Fix non-ANSI comment after #endif.
	* profile/Makefile.in (mkinstalldirs): Correct relative path.
2001-08-05 12:52:43 +00:00
Earnie Boyd 54580e6a88 * include/wtypes.h: (DECIMAL_SETZERO): Correct typo.
* include/oleidl.h (ISupportErrorInfo, ICreateInfo): Move from here
	* include/oaidl.h: ... to here.
	* include/oaidl.h ICreateErrorInfo): Add interface definition.
	(IErrorInfo::GetGUID): Change arg to GUID.
	(LPSUPPORTERRORINFO): Add typedef.
	(IID_ISupportErrorInfo): Change forward decl. of type to IID.
	* include/winsock2.h (WSAGET* and WSAMAKE*): Remove duplicate
	defines.
	* include/commctrl.h (TreeView_SetIndent): Correct typo.
	* include/commctrl.h (TBSTYPE_FLAT): Remove define.
	* include/commctrl.h (TBBUTTONINFO[AW]): Add struct definitions,
	and UNICODE mappings, if _WIN32_IE >= 0x400.
	(TBIF_* and TB_SETBUTTONINFO): Add defines, if _WIN32_IE >= 0x400.
	(CDIS_*,CDDS_*,CDRF_*) : Add defines.
	(tagNMCUSTOMDRAWINFO): Add struct definition and typedefs.
	(tagNMLVCUSTOMDRAW): Likewise.
	(tagNMTVCUSTOMDRAW): Likewise.
	(tagNMLVCACHEHINT): Likewise.
	* include/basetsd.h (#include <_mingw.h>): Remove.
	(__int64): Define.
	* include/wingdi.h (AC_SRC_OVER): Add define.
	(struct _BLENDFUNCTION): Add.
	* include/shlobj.h:  Add BIF_* defines.
	* include/winerror.h (E_PENDING): Add error code define.
	* include/basetsd.h (#include <_mingw.h>): Add directive.
	* include/winbase.h(InterlockedCompareExchange): Change args
	and return value from PVOID to LONG.
	(InterlockedExchange): Change first arg to LPLONG.
	(InterlockedCompareExchangePointer): New macro.
	(InterlockedExchangePointer): New macro.
2001-08-05 12:47:53 +00:00
Christopher Faylor e5ba4c060e Throughout, change check for running under Windows NT to 'iswinnt'.
* dcrt0.cc (set_os_type): Set 'iswinnt' appropriately.
* cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating cygheap.
(cygheap_setup_for_child_cleanup): New function.  Standard function to call
after calling CreateProcess to cleanup cygheap info passed to child.
(cygheap_fixup_in_child): Copy cygheap from shared memory into allocated space
under Windows 9x or if can't relocate shared space under NT.
* cygheap.h: Declare new function.
* spawn.cc (spawn_guts): Use cygheap_fixup_in_child.
* fork.cc (fork_parent): Ditto.
* winsup.h: Declare iswinnt.
2001-08-04 21:10:52 +00:00
Egor Duda 17195d08bc * dtable.cc (dtable::release): Avoid messing with console when
closing socket.
2001-08-04 18:53:53 +00:00
Corinna Vinschen 7eb971a561 * net.cc (cygwin_accept): Allow NULL peer and len parameters.
* include/cygwin/socket.h: Define socklen_t as int.
2001-08-03 12:06:29 +00:00
Corinna Vinschen dce6f56397 * path.cc (fchdir): Set the fhandler's path to absolute value to
ensure changing to the correct directory even if the fhandler originally
        points to a relative path.
2001-08-03 11:14:09 +00:00
Corinna Vinschen 842c741f98 * security.cc (set_file_attribute): Clean up. Don't call
`set_nt_attribute' when ntsec isn't set.
2001-08-02 16:01:47 +00:00
Christopher Faylor e13ea3343d * dcrt0.cc (alloc_stack_hard_way): Make half-hearted attempt to deal with
growing stack under Windows 95.
* Makefile.in: Add install-lib and install-headers.
2001-07-29 02:33:30 +00:00
Christopher Faylor 8e4e3874c4 * cygwin.din: Export sys_errlist, sys_nerr.
* include/cygwin/version.h: Bump minor version number.
2001-07-27 16:33:20 +00:00
Corinna Vinschen 8b43d2722b * security.cc (get_user_primary_group): Fix compiler warning.
(alloc_sd): Add DELETE permission for user when S_IWUSR is given.
2001-07-27 09:17:57 +00:00
Christopher Faylor f9f2c11985 * thread.cc (__pthread_equal): Invert return value so that true is returned
when threads are equal.
2001-07-26 20:47:05 +00:00
Christopher Faylor 351a85482c Christopher Faylor <cgf@cygnus.com>
* cygwin.din: Export __signgam.
* include/cygwin/version.h: Bump minor version number.
2001-07-26 20:42:52 +00:00
Christopher Faylor 6b91b8d53b Throughout, reorganize header file inclusion to put security.h prior to
fhandler.h.
* fhandler.h (fhandler_base::get_inheritance): New method.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper
close-on-exec inheritance when creating.
(fhandler_socket::check_peer_secret_event): Create handle as non-inheritable.
2001-07-26 19:22:24 +00:00
Christopher Faylor 0cc642a5f1 * syscalls.cc (setsid): Detach process from its console if the current
controlling tty is the console and already closed.
* dtable.h (class dtable): Add members to count descriptors referring to the
console.
* dtable.cc (dtable::dec_console_fds): New function to detach process from its
console.
(dtable::release): Decrement the counter of console descriptors.
(dtable::build_fhandler): Increment it.
* exception.cc (ctrl_c_handler): Send SIGTERM to myself when catch
CTRL_SHUTDOWN_EVENT.
2001-07-26 00:10:52 +00:00
Robert Collins 811bf2902d Tue 24 Jul 2001 02:28:00 PM Trevor Forbes <t4bs@hotmail.com>
* thread.cc (verifyable_object_isvalid): Don't validate
	PTHREAD_MUTEX_INITIALIZER pointer as it will cause an exception
	in IsBadWritePtr() when running GDB.
2001-07-25 23:46:25 +00:00
Corinna Vinschen 09ff05f7f9 * localtime.c: Changed whole file to become C++ clean. Rename to
localtime.cc.
        * localtime.cc (tzload): Preserve errno.
2001-07-25 21:58:21 +00:00
Christopher Faylor a7670c1e82 * cygheap.cc (cygheap_fixup_in_child): Attempt Win95 workaround.
* dtable.cc (dtable::dup_worker): Add debugging output.
(dtable::vfork_child_dup): Correctly set close_on_exec.
* fhandler.cc (fhandler_base::fork_fixup): Don't mess with handle if there is
no need to get it from the parent.
* fhandler_tty.cc (fhandler_tty_common::close): Add debugging output.
2001-07-21 03:20:01 +00:00