Commit Graph

2933 Commits

Author SHA1 Message Date
Corinna Vinschen 231a60c73a * net.cc (free_protoent_ptr): Add missing free() for base structure.
(free_servent_pt): Ditto.
	(free_hostent_pt): Ditto.
2002-12-10 16:36:36 +00:00
Corinna Vinschen bb241345b1 * netdb.cc (parse_alias_list, parse_services_line)
(parse_protocol_line): Change strtok calls to strtok_r.
2002-12-10 13:27:15 +00:00
Corinna Vinschen d6ffc07588 2002-12-10 Pierre Humblet <pierre.humblet@ieee.org>
* pwdgrp.h (pwdgrp_check::pwdgrp_state): Replace by
	pwdgrp_check::isinitializing ().
	(pwdgrp_check::isinitializing): Create.
	* passwd.cc (grab_int): Change type to unsigned, use strtoul and
	set the pointer content to 0 if the field is invalid.
	(parse_pwd): Move validity test after getting pw_gid.
	(read_etc_passwd): Replace "passwd_state <= " by
	passwd_state::isinitializing ().
	(internal_getpwuid): Ditto.
	(internal_getpwnam): Ditto.
	(getpwent): Ditto.
	(getpass): Ditto.
	* grp.cc (parse_grp): Use strtoul for gr_gid and verify the validity.
	(read_etc_group): Replace "group_state <= " by
	group_state::isinitializing ().
	(internal_getgrgid): Ditto.
	(getgrent32): Ditto.
	(internal_getgrent): Ditto.

2002-12-10  Pierre Humblet <pierre.humblet@ieee.org>

	* security.h: Move declarations of internal_getgrent,
	internal_getpwsid and internal_getgrsid to pwdgrp.h.
	* pwdgrp.h: Declare internal_getpwsid, internal_getpwnam,
	internal_getpwuid, internal_getgrsid, internal_getgrgid,
	internal_getgrnam, internal_getgrent and internal_getgroups.
	Delete "emulated" from enum pwdgrp_state.
	(pwdgrp_check::isuninitialized): Create.
	(pwdgrp_check::pwdgrp_state): Change state to initializing
	rather than to uninitialized.
	(pwdgrp_read::gets): Remove trailing CRs.
	* passwd.cc (grab_string): Don't look for NLs.
	(grab_int): Ditto.
	(parse_pwd): Don't look for CRs. Return 0 if entry is too short.
	(search_for): Delete.
	(read_etc_passwd): Simplify tests to actually read the file.
	Set state to loaded before making internal_getpwXX calls.
	Replace search_for calls by equivalent internal_pwgetXX calls.
	(internal_getpwsid): Use passwd_state.isuninitialized to decide
	to call read_etc_passwd.
	(internal_getpwuid): Create.
	(internal_getpwnam): Create.
	(getpwuid32): Simply call internal_getpwuid.
	(getpwuid_r32): Call internal_getpwuid.
	(getpwnam): Simply call internal_getpwnam.
	(getpwnam_r): Call internal_getpwnam.
	* grp.cc (parse_grp): Don't look for CRs. Adjust blank space.
	(add_grp_line): Adjust blank space.
	(class group_lock): Ditto.
	(read_etc_group): Simplify tests to actually read the file.
	Set state to loaded before making internal_getgrXX calls.
	Replace getgrXX calls by equivalent internal calls.
	(internal_getgrsid): Use group_state.isuninitialized to decide
	to call read_etc_group.
	(internal_getgrgid): Create.
	(internal_getgrnam): Create.
	(getgroups32): Simply call internal_getgrgid.
	(getgrnam32): Simply call internal_getgrnam.
	(internal_getgrent): Call group_state.isuninitialized.
	(internal_getgroups): Create from the former getgroups32, using
	two of the four arguments. Set gid to myself->gid and username
	to cygheap->user.name ().
	(getgroups32): Simply call internal_getgroup.
	(getgroups): Call internal_getgroup instead of getgroups32.
	(setgroups32): Call internal versions of get{pw,gr}XX.
	* sec_helper.cc: Include pwdgrp.h.
	(is_grp_member): Call internal versions of get{pw,gr}XX.
	* security.cc: Include pwdgrp.h.
	(alloc_sd): Call internal versions of get{pw,gr}XX.
	* syscalls.cc: Include pwdgrp.h.
	(seteuid32): Call internal versions of get{pw,gr}XX.
	(setegid32): Ditto.
	* uinfo.cc: Include pwdgrp.h.
	(internal_getlogin): Call internal versions of get{pw,gr}XX.
	(cygheap_user::ontherange): Ditto.
	* sec_acl.cc: Include pwdgrp.h.
	(setacl): Call internal versions of get{pw,gr}XX.
	(acl_access): Ditto and simplify logic.
	(aclfromtext): Ditto.
2002-12-10 12:43:49 +00:00
Christopher Faylor 4b47fb2c3f correct date 2002-12-09 23:08:59 +00:00
Christopher Faylor b862c42198 * lib/pseudo-reloc.c: New file.
* lib/_cygwin_crt0_common.cc: Perform pseudo-relocs during initialization of
cygwin binary (.exe or .dll).
2002-12-09 22:49:12 +00:00
Danny Smith 97cc22ad06 * include/shellapi.h (ExtractIconEx[AW]): Correct return type
to UINT.
2002-12-09 01:51:27 +00:00
Danny Smith 009bcda6f9 * mingwex/math/s_erf.c: New file.
* mingwex/math/sf_erf.c: New file.
	* mingwex/Makefile.in (MATH_DISTFILES): Add new files.
	(MATH_OBJS): Add new objects.
	* include/math.h (erf[f]): Add prototypes.
	(erfc[f]): Add prototypes.
2002-12-08 01:46:42 +00:00
Danny Smith 4c49b9a2a5 * include/math.h: Add traditional/XOPEN math constants.
Add missing ChangeLog entry for 2002-11-27
2002-12-07 08:58:49 +00:00
Danny Smith e57ba5d3cd * include/winuser.h (AllowSetForegroundWindow,
LockSetForegroundWindow) Add prototypes.
	(ASFW_ANY, LSFW_LOCK, LSFW_UNLOCK) Add defines.
	Thanks to:  Pat Thoyts  <patthoyts@users.sourceforge.net>
	* lib/winuser.def (AllowSetForegroundWindow,
	LockSetForegroundWindow): Add stubs.
2002-12-07 07:23:41 +00:00
Christopher Faylor 2cc2e4e5ea fix date 2002-12-07 04:49:59 +00:00
Christopher Faylor 11b087d571 * cygwin.din: Reflect name change from strtodf to strtof. Export strtof.
* include/cygwin/version.h: Bump API minor number.
2002-12-06 19:48:03 +00:00
Danny Smith e25e377eb3 2002-12-06 Ken Fitlike <kenfitlike@users.sourceforge.net>
* include/commctrl.h (TN_GETDISPINFO[AW]): Add defines and
	UNICODE mappings.
	(tagNMTTDISPINFO[AW]): Replace obsolete struct names
	tagTOOLTIPTEXT[AW] and typedefs. Add defines for backward
	compatability. Add lParam field. Add UNICODE mappings for new
	names.
2002-12-06 04:13:31 +00:00
Christopher Faylor 49dd6fc61e * fhandler.h (fhandler_termios::line_edit): Change return from an int to an
enum to allow the function to return an error.
* fhandler_console.cc (fhandler_console::read): Update the line_edit call to
use the new enum.
* fhandler_termios.cc (fhandler_termios::line_edit): Change return from an int
to an enum to allow the function to return an error.  Put put_readahead call
before doecho for future patch.
* fhandler_tty.cc (fhandler_pty_master::write): Change to call line_edit one
character at a time, and stop if an error occurs.
2002-12-05 16:24:52 +00:00
Christopher Faylor 77c33bf2b9 fix comment 2002-12-04 20:46:16 +00:00
Christopher Faylor 838ad58232 * netdb.cc: New file.
* Makeile.in (DLL_OFILES): Add reference to the new netdb.cc file.
* cygwin.din : Add new aliased exports for service and protocol enumerations in
netdb.cc.
2002-12-04 20:44:17 +00:00
Corinna Vinschen 7453997e0e * cxx.cc: New file. Implement new, new[], delete and delete[]
operators and  __cxa_pure_virtual if compiled by gcc >=3.
	* Makefile.in (DLL_OFILES): Add cxx.o.
	Remove libstdc++.a from cygwin1.dll link step.
2002-12-04 20:36:23 +00:00
Danny Smith d0619aa715 2002-12-02 Andrew Stadt <acstadt@sympatico.ca>
* include/shellapi.h (_SHFILEOPSTRUCTA,_SHFILEOPSTRUCTW):
	Wrap with pshpack2.h/poppack.h to correct alignment.
2002-12-02 09:53:09 +00:00
Danny Smith c7ca0398dc 2002-12-02 Ken Fitlike <kenfitlike@users.sourceforge.net>
* include/commctrl.h (LVBKIF_*): Add defines.
	(LVM_SETIMAGE[AW]): Add defines and UNICODE mappings.
	(LVM_GETIMAGE[AW]): Add defines and UNICODE mappings.
	(LVBKIMAGE[AW]): Add defines and UNICODE mappings.
	(LPLVBKIMAGE[AW]): Add defines and UNICODE mappings.
	(LVM_GETBKIMAGE[AW]): Add defines and UNICODE mappings.
	(LVM_SETBKIMAGE[AW]): Add defines and UNICODE mappings.
	(ListView_GetBkImage): Add define.
	(ListView_SetBkImage): Add define.
	(LVBKIMAGE): Add structures and typedefs.
2002-12-02 09:50:03 +00:00
Christopher Faylor 4f96ae699c * fhandler_tty.cc (fhandler_pty_master::accept_input): Move read_retval
assignment to prevent race condition.  Remove read_retval from return
statement.
2002-11-30 22:23:01 +00:00
Christopher Faylor 883bbc6478 * pinfo.h (winpids::set): Renamed from init.
(winpids::init): New declaration.
(winpids::cs): Ditto.
(winpids::winpids): Use set rather than init.
* external.cc (fillout_pinfo): Ditto.
* dcrt0.cc (dll_crt0_1): Call winpids::init.
* pinfo.cc (winpids::set): Renamed from init.  Wrap calls in critical section.
(winpids::init): New function.
(winpids::cs): Define.
2002-11-29 07:05:26 +00:00
Christopher Faylor c0b813e500 * sigproc.cc (sig_dispatch_pending): Remove assertion. 2002-11-29 00:43:50 +00:00
Christopher Faylor ae799c9931 revert botched checkin 2002-11-28 00:41:02 +00:00
Christopher Faylor 7007fd238f * include/cygwin/version.h: Bump DLL minor number. 2002-11-28 00:40:20 +00:00
Christopher Faylor 50f4a61a36 * fhandler_socket.cc (fhandler_socket::sendto): Fix potential unitialized value
return.
2002-11-27 23:44:14 +00:00
Christopher Faylor cdaf88961d * cygwin.din: Export pthread_getsequence_np.
* include/cygwin/version.h: Bump API minor version.
2002-11-27 16:11:40 +00:00
Danny Smith dc8597f966 * mingwex/math/lgamma.c: New file.
* mingwex/math/lgammaf.c: New file.
	* mingwex/math/lgammal.c: New file.
	* mingwex/math/tgamma.c: New file.
	* mingwex/math/tgammaf.c: New file.
	* mingwex/math/tgammal.c: New file.
	* mingwex/math/cephes_mconf (polevlf): Add float version.
	(p1evlf): Likewise.
	Define _CEPHES_USE_ERRNO.
	* mingwex/Makefile.in (MATH_DISTFILES): Add new files.
	(MATH_OBJS): Add new objects.
	* include/math.h (lgamma[fl]): Add prototypes.
	(tgamma[fl]): Add prototypes.
2002-11-27 03:41:25 +00:00
Christopher Faylor eb6d2e2f9a white space 2002-11-27 02:26:44 +00:00
Christopher Faylor 05c728c45b * cygwin.din: Export nl_langinfo().
* include/cygwin/version.h: Bump API minor version.
2002-11-27 02:12:50 +00:00
Christopher Faylor b263d1d8d3 * fhandler_tty.cc (fhandler_pty_master::accept_input): Just use a normal Sleep
or suffer amazing pauses when other tty apps are running.
(fhandler_pty_master::process_slave_output): Ditto.
2002-11-26 20:32:39 +00:00
Danny Smith 5362be5926 Add strtold and wcstold to libmingwex.a
* mingwex/strtold.c: New file.
	* mingwex/wcstold.c: New file.
	* mingwex/ldtoa.c: New file.
	* mingwex/math/cephes_emath.h: New file.
	* mingwex/math/cephes_emath.c: New file.
	* mingwex/Makefile.in (DISTFILES): Add new files.
	(MATH_DISTFILES): Ditto.
	(STDLIB_OBJS): New. Define as strtold.c wcstold.c.
	(MATH_OBJS): Add cephes_emath.o.
	(LIB_OBJS): Add $(STDLIB_OBJS).
	* include/stdlib.h (strtold, wcstold): Add prototypes.
	* include/wchar.h (wcstold): Add prototype.

Add missing ChangeLog entry for 2002-11-09.
2002-11-26 00:11:06 +00:00
Earnie Boyd 4e85569d11 * include/w32api.h: Increment to version 2.2
* Makefile.in: Ditto.
2002-11-25 21:15:52 +00:00
Earnie Boyd 60d4d42f4f * lib/Makefile.in (dist, install): Correct the install destinations.
* lib/ddk/Makefile.in (dist, install): Ditto.
2002-11-25 18:14:25 +00:00
Corinna Vinschen d1b6d5cd14 * mkpasswd.c (main): Set pw_passwd field to '*' on 9x/Me. 2002-11-25 15:12:50 +00:00
Corinna Vinschen efcaf0426a * passwd.cc (read_etc_passwd): Never add an entry when starting
on Win95/98/ME if a default entry is present.
	* uinfo.cc (internal_getlogin): Look for the default uid if needed.
	Always call user.set_name ().
2002-11-25 15:11:39 +00:00
Corinna Vinschen f1da8a0664 * sec_acl.cc (getacl): Set errno to ENOSPC if command is GETACL and
nentries is less than the number of entries in the file's ACL.
2002-11-25 11:23:21 +00:00
Corinna Vinschen 19f209011a 2002-11-24 Corinna Vinschen <corinna@vinschen.de>
* sec_acl.cc: Fix some formatting.  Only set and check `other' bits in
	a_perm throughout.  Use ILLEGAL_GID id for all entries having no id.
	(setacl): Fix inheritance condition.
	(getacl): Set all permission bits in CLASS_OBJ and DEF_CLASS_OBJ
	entries.  Remove DENY bits before returning to calling function.
	(acltomode): Fix usage of searchace().  If available, use CLASS_OBJ
	to mask GROUP_OBJ permissions.
	(aclfrommode): Fix usage of searchace().  If available, set CLASS_OBJ
	permissions to same value as GROUP_OBJ permissions.

2002-11-24  Pierre Humblet <pierre.humblet@ieee.org>

	* sec_acl.cc (getace): Fix the behavior when allow and
	deny entries are present in arbitrary order.
	(getacl): Report the actual number of entries when
	aclbufp is NULL, even if nentries is zero. Fix the mask
	reporting, handle the case where the owner and group sids
	are equal and streamline the code.
	(acl_worker): Take allow_ntsec into account.
2002-11-24 18:58:47 +00:00
Corinna Vinschen 2d06bd1109 * setfacl.c (getperm): Set only `other' permission bits.
(getaclentry): Set a_id to -1 by default.
2002-11-24 18:07:30 +00:00
Corinna Vinschen ad2bc53e8f * getfacl.c (permstr): Use `other' permission bits for requesting
ace permissions.
2002-11-24 16:15:33 +00:00
Robert Collins f8c8e13b7e 2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
* dcrt0.cc (dll_crt0_1): Add call to pthread::initMainThread to
        initialize mainthread when it is safe to call new.
        * init.cc (dll_entry): Change call to store reents in tls key.
        * thread.cc (_reent_clib) : Change call to get reents from tls
        key.
        (_reent_winsup): Ditto.
        (MTinterface::Init): Key handling changed. Remove initialization
        of member variables.
        (MTinterface::fixup_after_fork): Reinitialize mainthread object
        after fork. Reset threadount to 1.
        (pthread::initMainThread): Create mainthread object dynamically.
        and initialize with valid handles.
        (pthread::self): Remove calls to create thread objects.
        (pthread::setTlsSelfPointer): Change call to store thread self
        handle in tls key.
        (pthread::getTlsSelfPointer): New static method.
        (pthread::exit): Remove setTlsSelfPointer call.
        (pthread::initCurrentThread): New method.
        (pthread::thread_init_wrapper): Change call to store thread self
        handle in tls key.
        (pthread::join): Check for a valid joiner.
        (pthreadNull::pthreadNull): Mark Null object as detached.
        (pthreadNull::exit): Terminate thread via ExitThread.
        * thread.h (pthread::initMainThread): Change parameter in function
        call.
        (pthread::getTlsSelfPointer): New static method.
        (pthread::initCurrentThread): New method.
        (MTinterface::reent_key): Remove.
        (MTinterface::thread_self_dwTlsIndex): Ditto..
        (MTinterface::indexallocated): Ditto.
        (MTinterface::mainthread): Ditto.
        (MTinterface::reent_key): New member.
        (MTinterface::thread_self_key): Ditto.
        (MTinterface::MTinterface): Initialize all members.
2002-11-24 13:54:14 +00:00
Robert Collins 4f0de34d37 2002-11-25 Robert Collins <rbtcollins@hotmail.com>
* readme: Document running portions of the test suite (Thanks Egor!).
        * winsup.api/pthread/mainthreadexits.c: New file, derived from
        Thomas Pfaff's test cases.
        * winsup.api/pthread/threadidafterfork.c: Ditto.
2002-11-24 13:41:36 +00:00
Christopher Faylor 4497f2a88d * wait.cc (wait4): Force pending signal delivery before waiting for process
completion.
2002-11-23 20:24:08 +00:00
Christopher Faylor 1d676025c9 * include/cygwin/version.h: Bump DLL minor number. 2002-11-23 17:43:46 +00:00
Christopher Faylor 15a3d9cc40 fix typo 2002-11-23 01:27:42 +00:00
Christopher Faylor a0d3c309e4 * exceptions.cc (handle_sigsuspend): Force pending signal delivery before
waiting for signals to happen.
* signal.cc (sleep): Force pending signal delivery before sleeping.
(usleep): Ditto.
(signal): Force pending signal delivery before manipulating signal stuff.
(sigprocmask): Ditto.
(kill_worker): Ditto.
(abort): Ditto.
(sigaction): Ditto.
* syscalls.cc (readv): Force pending signal delivery before I/O.
(writev): Ditto.
(open): Ditto.
* net.cc: Ditto, throughout.
* sigproc.cc (sig_dispatch_pending): Deliver any pending signals prior to
returning.
* tty.cc (tty::make_pipes): Increase pipe buffer size.
2002-11-22 20:51:13 +00:00
Christopher Faylor 8efb9fd7af * include/cygwin/version.h: Fix comment. 2002-11-22 16:27:32 +00:00
Christopher Faylor ad377fe347 * external.cc (cygwin_internal): Fix va_arg references. 2002-11-22 04:50:53 +00:00
Christopher Faylor 13af9a149d * exceptions.cc (sigthread::get_winapi_lock): Just do standard 'give up
timeslice' wait.
(setup_handler): Revamp YA to attempt to deliver signal multiple times on
failure rather than punting to wait_sig.
* miscfuncs.cc (low_priority_sleep): Accept INFINITE sleep to mean "don't reset
the priority after setting it to idle".  Return previous priority.
* winsup.h (SLEEP_0_STAY_LOW): Define.
(low_priority_sleep): Return an int.
* sigproc.h: Define WAIT_SIG_PRIORITY here.
* sigproc.cc: Remove WAIT_SIG_PRIORITY definition.
2002-11-22 04:43:47 +00:00
Corinna Vinschen 647b92a7d4 * security.h: Declare internal_getpwsid and internal_getgrsid.
Undeclare internal_getpwent.  Define DEFAULT_UID_NT.  Change
	DEFAULT_GID.
	* passwd.cc (internal_getpwsid): New function.
	(internal_getpwent): Suppress.
	(read_etc_passwd): Make static.  Rewrite the code for the completion
	line.  Set curr_lines to 0.
	(parse_pwd): Change type to static int.  Return 0 for short lines.
	(add_pwd_line): Pay attention to the value of parse_pwd.
	(search_for): Do not look for nor return the DEFAULT_UID.
	* grp.cc (read_etc_group): Make static.  Free gr_mem and set
	curr_lines to 0.  Always call add_pwd_line.  Rewrite the code for the
	completion line.
	(internal_getgrsid): New function.
	(parse_grp): If grp.gr_mem is empty, set it to &null_ptr.
	Never NULL gr_passwd.
	(getgrgid32): Only return the default if ntsec is off and the gid is
	ILLEGAL_GID.
	* sec_helper.cc (cygsid::get_id): Use getpwsid and getgrsid.
	(cygsid_getfrompw): Clean up last line.
	(cygsid_getfromgr): Ditto.
	(is_grp_member): Use getpwuid32 and getgrgid32.
	* uinfo.cc (internal_getlogin): Set DEFAULT_GID at start.
	Use getpwsid. Move the read of /etc/group after the second access
	to /etc/passwd.  Change some debug_printf.
2002-11-20 17:10:05 +00:00
Corinna Vinschen 3a366b12f6 * poll.cc (poll): ...but set POLLIN instead. 2002-11-20 11:00:15 +00:00
Corinna Vinschen dbcb75780a * security.cc (get_attribute_from_acl): Always test "anti",
just in case an access_denied ACE follows an access_allowed.
	Handle the case owner_sid == group_sid, with a FIXME.
	Remove unnecessary tests for non-NULL PSIDs.
	(alloc_sd): Use existing owner and group sids if {ug}id == -1.
	Handle case where owner_sid == group_sid.
	Do not call is_grp_member. Try to preserve canonical ACE order.
	Remove unnecessary tests for non-NULL PSIDs. Reorganize
	debug_printf's.
	(get_initgroups_sidlist): Put well_known_system_sid on left
	side of ==.
	(add_access_denied_ace): Only call GetAce if inherit != 0.
	(add_access_allowed_ace): Ditto. Use appropriate sizeof.
	* syscalls.cc (chown_worker): Pass {ug}id equal to -1 to
	alloc_sd, which removes the need to obtain old_{ug}id.
	(chmod): Remove call to get_file_attribute (), simply pass
	{ug}id equal to -1 to alloc_sd.
2002-11-20 09:23:21 +00:00
Corinna Vinschen 03b65245db * poll.cc (poll): Don't set POLLERR if a listening socket has a
pending connect.  Don't use errno value from call to
	fhandler_socket::recvfrom().
2002-11-20 08:03:50 +00:00
Christopher Faylor 4b45d8a6f3 * net.cc: Sprinkle sigframes throughout. 2002-11-19 08:01:49 +00:00
Christopher Faylor 78907ddc89 remove unneeded comments 2002-11-19 01:20:58 +00:00
David Starks-Browning 4ed9c1e62e new entry: "Is there a better alternative to the standard console window?" (yes, rxvt) 2002-11-18 00:25:14 +00:00
David Starks-Browning 34fd220461 re. copy/paste in console window: use rxvt instead 2002-11-17 23:54:11 +00:00
David Starks-Browning 52b945c6bf indicate ntsec now on by default 2002-11-17 23:49:14 +00:00
Christopher Faylor 1b6860be30 * tty.cc (tty::make_pipes): Make pipe buffer larger. 2002-11-16 06:22:42 +00:00
Christopher Faylor 463e739282 * grp.cc (getgroups32): Protect against closing cygheap->user.token. 2002-11-16 03:50:56 +00:00
Danny Smith a87878a965 * lib/uuid.c (CATID_InternetAware,CLSID_HttpSProtocol,
CLSID_PSUrlMonProxy,CLSID_StdURLMoniker,IID_IObjectWithSite,
	IID_IPersistMoniker,IID_IProgressNotify): Correct definitions.
	(CLSID_CFontPropPage00, GUID_FONTUNDERSCORE11,
	IID_IOleControlSite89): Remove.
2002-11-16 03:04:41 +00:00
Christopher Faylor d894f55295 * lib/uuid.c (IID_IRunnableObject): Remove duplicate definition.
(IID_IStdMarshalInfo): Ditto.
2002-11-15 21:18:47 +00:00
Christopher Faylor ed2b976b0f * lib/uuid.c (IID_IOleInPlaceSite): Remove duplicate definition.
(IID_IPersistStorage): Ditto.
2002-11-15 21:11:29 +00:00
Christopher Faylor f319cb1ad3 * include/cygwin/version.h: Bump API_MINOR to accommodate below changes.
* cygwin.din (siginterrupt): New export.
* signal.cc (siginterrupt): New.
2002-11-15 19:04:36 +00:00
Christopher Faylor 4b9ddc7dc9 * select.cc (peek_serial): Don't call PurgeComm() to avoid characters loss. 2002-11-15 18:58:12 +00:00
Danny Smith 26eb19efe4 2002-11-15 Weiqi Gao <weiqigao@users.sourceforge.net>
* lib/uuid.c (CLSID_PSClassObject, CLSID_PSEnumerators,
	IID_IClassActivator, IID_IClientSecurity, IID_ICreateTypeInfo,
	IID_ICreateTypeLib2, IID_IOleInPlaceSite, IID_IPersistStorage,
	IID_IRunnableObject, IID_IServerSecurity, IID_IStdMarshalInfo):
	Correct definitions.
2002-11-15 07:13:22 +00:00
Christopher Faylor 6597785dc2 * exceptions.cc (setup_handler): Add debugging output. Set thread priority to
idle if pending signals to allow other threads to get into interruptible state.
* miscfuncs.cc (sys_mbstowcs): Save current thread in variable to avoid an OS
call.
* wait.cc (wait_sig): Reset thread priority each time through loop since the
priority may have been set down to deal with pending signals.
2002-11-15 04:35:13 +00:00
Christopher Faylor d4990113a1 * fhandler_serial.cc (fhandler_serial::tcgetattr): Don't take any special
action when vmin_ == 0.
2002-11-15 02:12:36 +00:00
Danny Smith 540d550a38 * include/ddk/(atm.h, batclass.h, cfg.h, cfgmgr32.h, d4drvif.h,
d4iface.h, ddkmapi.h, hidclass.h, hidpi.h, hidusage.h, mcd.h,
	miniport.h, minitape.h, mountdev.h, mountmgr.h, ndis.h,
	ndisquid.h, ndistapi.h, ndisvan.h, netevent.h, netpnp.h,
	netdev.h, ntapi.h, ntdd8042.h, ntddbeep.h, ntddcdrm.h,
	ntddcdvd.h, ntddchgr.h, ntdddisk.h, ntddk.h, ntddkbd.h,
	ntddmou.h, ntddndis.h, ntddpar.h, ntddpcm.h, ntddscsi.h,
	ntddser.h, ntddstor.h, ntddtape.h, ntddtdi.h, ntddvdeo.h,
	ntddvol.h, ntifs.h, ntpoapi.h, ntstatus.h, parallel.h, pfhook.h,
	poclass.h, scsi.h, scsiscan.h, scsiwmi.h, smbus.h, srb.h,
	storport.h, tdi.h, tdiinfo.h, tdikrnl.h, tdistat.h, tvout.h,
	upssvc.h, usb.h, usb100.h, usbcamdi.h, usbdi.h, usbioctl.h,
	usbiodef.h, usbscan.h, usbuser.h, video.h, videoagp.h, win2k.h,
	winddi.h, winddk.h, winnt4.h, winxp.h, ws2san.h,
	xfilter.h): Change comment to refer w32api package, not MinGW.
2002-11-15 01:08:17 +00:00
Danny Smith 429ae76922 * include/ddk/ntddk.h: Include winnt.h as system header. 2002-11-15 01:02:37 +00:00
Corinna Vinschen 4ce377c9d4 * grp.cc (getgroups32): Revert previous patch. Use impersonation
token if process is in impersonated state.
	* sec_helper.cc (is_grp_member): Rewrite.  Call getgroups32 only
	for current user.  Scan passwd and group info otherwise.
2002-11-14 19:19:39 +00:00
Christopher Faylor 33902276b1 checking previously ChangeLog'ed file. 2002-11-14 18:02:05 +00:00
Christopher Faylor 5b213f8bd6 * fhandler_console.cc (fhandler_console::write): Allow characters >= 0177 to be
displayed in the title bar.
2002-11-14 17:46:58 +00:00
Corinna Vinschen dae01cb624 * grp.cc (getgroups32): Don't use access token of current user when
retrieving group info for another user.
2002-11-14 10:28:55 +00:00
Christopher Faylor 052990e6b3 * dll_init.cc (dll_list::detach): Eliminate reliance on passed in dll address.
Infer from module of caller instead.
(cygwin_detach_dll): Ignore dll_index argument.
* dll_init.h (dll_list::detach): Reflect argument change above.
2002-11-14 04:29:39 +00:00
Christopher Faylor a2dea5c333 * ioctl.cc (ioctl): Always print ioctl results, even when it's a tty.
* winsup.h (low_priority_sleep): Declare.
2002-11-14 02:15:23 +00:00
Christopher Faylor 40e4147f4e * winsup.h (low_priority_sleep): Declare. 2002-11-13 22:08:05 +00:00
Christopher Faylor c0a02a4b42 * miscfuncs.cc (low_priority_sleep): New function. Use throughout where code
is supposed to be giving up time slice.
* fhandler_console.cc (fhandler_console::read): Switch button 2/3 output escape
sequences to be consistent with xterm.
2002-11-13 19:36:12 +00:00
David Starks-Browning e0900ffdb5 Update Emacs-related entries (new Cygwin port, details on XEmacs ports) 2002-11-13 00:23:18 +00:00
Danny Smith 6ac7b97610 * include/ddk/(atm.h, batclass.h, cfg.h, cfgmgr32.h, d4drvif.h,
d4iface.h, ddkmapi.h, hidclass.h, hidpi.h, hidusage.h, mcd.h,
	miniport.h, minitape.h, mountdev.h, mountmgr.h, ndis.h,
	ndisquid.h, ndistapi.h, ndisvan.h, netevent.h, netpnp.h,
	netdev.h, ntapi.h, ntdd8042.h, ntddbeep.h, ntddcdrm.h,
	ntddcdvd.h, ntddchgr.h, ntdddisk.h, ntddk.h, ntddkbd.h,
	ntddmou.h, ntddndis.h, ntddpar.h, ntddpcm.h, ntddscsi.h,
	ntddser.h, ntddstor.h, ntddtape.h, ntddtdi.h, ntddvdeo.h,
	ntddvol.h, ntifs.h, ntpoapi.h, ntstatus.h, parallel.h, pfhook.h,
	poclass.h, scsi.h, scsiscan.h, scsiwmi.h, smbus.h, srb.h,
	storport.h, tdi.h, tdiinfo.h, tdikrnl.h, tdistat.h, tvout.h,
	upssvc.h, usb.h, usb100.h, usbcamdi.h, usbdi.h, usbioctl.h,
	usbiodef.h, usbscan.h, usbuser.h, video.h, videoagp.h, win2k.h,
	winddi.h, winddk.h, winnt4.h, winxp.h, ws2san.h,
	xfilter.h): Fix typo in disclaimer comment.
2002-11-12 21:34:07 +00:00
Danny Smith 4308e5b0dd * include/exdisp.h: Include oaidl.h as system header. 2002-11-12 21:25:23 +00:00
Earnie Boyd 1f90279128 * include/w32api.h (__W32API_VERSION): Fix. 2002-11-12 16:13:51 +00:00
Corinna Vinschen 7a11fe607e * syscalls.cc (chmod): Simplify conditional.
* sec_helper (cygsid::getfromstr): Reorganize to remove
	calls to strcpy and strtok_r.
	(cygsid::getfromgr): Change type to __uid32_t instead of int.
	Keep only the allow_ntsec branch. Never call LookupAccountSid
	which calls PDCs, simply return -1 in case of failure.
	Use cygsid == instead of calling EqualSid and remove test
	for NULL psid.
	* security.h: Declare cygsid::getfromgr as __uid32_t.
2002-11-12 15:51:11 +00:00
Christopher Faylor 1b5f0e595b * how-programming.texinfo: Document _WIN32 more fully. 2002-11-10 19:38:26 +00:00
Corinna Vinschen 7922485391 * net.cc: Run indent.
* autoload.cc (GetIfEntry): Add symbol.
	* net.cc (get_2k_ifconf): Get the interface entries with the GetIfEntry
	call intead of the GetIfTable call. Clean-up multiple IP address naming.
2002-11-10 13:43:26 +00:00
Danny Smith 5d7bffe927 2002-11-09 Weiqi Gao <weiqigao@users.sourceforge.net>
* lib/uuid.c (IID_ICatInformation): Correct definition.
2002-11-10 04:14:31 +00:00
Christopher Faylor ec61cd7268 correct date 2002-11-10 00:51:25 +00:00
Danny Smith 9da547ff26 * include/math.h (sqrt): Remove inline definition.
(sqrtf): Replace inline definition with prototype.
	(sqrtl): Likewise.
	* mingwex/math/sqrtf.c (sqrtf): Set domain error if
	argument less than zero.
	* mingwex/math/sqrtf.c (sqrtl): Likewise.

	Correct typo in 2002-10-30 ChangeLog entry.
2002-11-09 10:44:02 +00:00
Christopher Faylor 49f7ea1675 * fhandler.h (class fhandler_pipe): New ioctl() method.
* pipe.cc (fhandler_pipe::ioctl): New.
2002-11-09 03:17:40 +00:00
Corinna Vinschen 7c4f9b9a05 * setfacl.c (usage): Add missing LF. 2002-11-08 10:22:58 +00:00
Danny Smith 00970f126e * include/oleauto.h (DeregisterTypeLib): Remove.
(UnRegisterTypeLib): Add prototype.
2002-11-08 00:00:01 +00:00
Christopher Faylor 783747919d * fhandler_serial.cc (fhandler_serial::ioctl): Fix typo. 2002-11-07 18:47:21 +00:00
Corinna Vinschen cad2c685b4 * include/cygwin/fs.h: New file.
* include/cygwin/hdreg.h: New file.
	* fhandler_floppy.cc (fhandler_floppy::ioctl): Add implementation for
	HDIO_GETGEO, BLKGETSIZE, BLKGETSIZE64, BLKRRPART and BLKSSZGET ioctls.
2002-11-07 14:16:29 +00:00
Corinna Vinschen 963fb8837d * include/winioctl.h: Add definition for IOCTL_DISK_UPDATE_DRIVE_SIZE. 2002-11-07 14:14:01 +00:00
Corinna Vinschen 59ba222ca2 * fhandler_socket.cc (fhandler_socket::ioctl): Return correct flags
for loopback interface when name is given on input instead of address.
2002-11-07 10:22:26 +00:00
Corinna Vinschen 0be1147408 * cygwin.din: Export fseeko() and ftello().
* include/cygwin/version.h: Bump API minor version.
2002-11-07 09:08:40 +00:00
Christopher Faylor f7618386af minor reformat 2002-11-07 03:41:16 +00:00
Christopher Faylor c8fae3c17b * fhandler_console.cc (keytable[]): Revert previous change. It would break too
many things.
2002-11-07 03:35:02 +00:00
Christopher Faylor 6c2d501195 * fhandler_console.cc (keytable[]): Redefine F1 - F5 to something a little more
sensical.
2002-11-07 03:16:08 +00:00
Christopher Faylor c759d297b2 * syscalls.cc (getutid): Use UT_IDLEN where appropriate. 2002-11-07 02:50:50 +00:00
Christopher Faylor 4248a1d7f8 * include/cygwin/version.h: Bump API minor number for below export.
* cygwin.din (pututline): New exported function.
* syscalls.cc (login): Use pututiline().
(setutent): Open utmp as read/write.
(endutent): Check if utmp file is open.
(utmpname): call endutent() to close current utmp file.
(getutid): Enable all cases, use strncmp() to compare ut_id fields.
(pututline): New.
* tty.cc (create_tty_master): Set ut_pid to current pid.
2002-11-07 02:19:52 +00:00
Christopher Faylor 2035f402e4 * fhandler_serial.cc (fhandler_serial::ioctl): Don't try to figure out if OS
has the capability to retrieve RTS/CTS.  Just set default values if
DeviceIoControl fails.  (suggested by Sergey Okhapkin)
2002-11-06 01:50:32 +00:00
Christopher Faylor 087a28bf5e * fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for
minchars.
(fhandler_serial::ioctl): Set errno if the ClearCommError fails.
(fhandler_serial::tcsetattr): Use correct value for vmin_.
(fhandler_serial::tcgetattr): Ditto.
2002-11-05 23:15:04 +00:00
Christopher Faylor 2f5e9ace2e * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
WSARecvFrom with fromlen = NULL.
2002-11-05 16:49:58 +00:00
Christopher Faylor ef1bf288df * pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin. 2002-11-05 04:52:52 +00:00
Christopher Faylor d263732238 * pinfo.cc (_pinfo::commune_send): Set priority low when sleeping, waiting for
commune completion so that we don't spin waiting for lower priority processes.
2002-11-05 04:43:02 +00:00
Christopher Faylor 73f7245be2 revert erroneous checkins 2002-11-05 04:24:48 +00:00
Christopher Faylor 5806add291 * sigproc.cc (WAIT_SIG_PRIORITY): Bump to THREAD_PRIORITY_TIME_CRITICAL. 2002-11-05 04:23:41 +00:00
Christopher Faylor f57289609b * pinfo.cc (_pinfo::commune_send): Initialize buffer or suffer random crashes. 2002-11-05 03:39:25 +00:00
Christopher Faylor 8948b6585d * fhandler_process.cc (fhandler_process::fill_filebuf): Deal with error
condition from cmdline retrieval.
2002-11-05 03:21:32 +00:00
Christopher Faylor 43a299881f * sigproc.cc (WAIT_SIG_PRIORITY): Bump to highest priority. 2002-11-05 02:58:10 +00:00
Christopher Faylor d4e7dfae8e * include/cygwin/version.h: Bump DLL minor number. 2002-11-04 05:08:15 +00:00
Christopher Faylor b6183403ae * fhandler_serial.cc (fhandler_serial::ioctl): Reformat. Set errno
appropriately.  Exit from the bottom.  Correctly deal with third argument for
TCFLSH.  (Suggested by Sergey Okhapkin)
2002-11-04 04:09:14 +00:00
Danny Smith 2f14399c16 * include/winnt.h (VerSetConditionMask): Add prototype.
* lib/kernel32.def (VerifyVersionInfo[AW]): Add stubs.
2002-11-04 03:53:53 +00:00
Christopher Faylor 2601ab5778 * fhandler_tty.cc (fhandler_tty_slave::ioctl): Do nothing if the new window
size is equal to the old one.  Send SIGWINCH if slave connected to a pseudo
tty.
(fhandler_pty_master::ioctl): Do nothing if the new window size is equal to the
old one.
2002-11-04 01:10:38 +00:00
Christopher Faylor 3593c18730 space 2002-11-02 03:31:15 +00:00
Pierre Humblet fe5ba95245 2002-10-31 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler.cc (fhandler_base::open): Verify pc isn't NULL.
2002-11-01 01:47:29 +00:00
Christopher Faylor cf157504a8 * cygpath.cc (get_long_path_name_w32impl): Define similarly to GetLongPathName.
(get_long_name): Correctly prototype GetLongPathName.
(get_long_paths): Implement using get_long_name to cut down on code
duplication.
(doit): Do various things to make path output work predictably.
2002-10-31 02:40:26 +00:00
Christopher Faylor bfb1f3e04f * include/cygwin/version.h: Bump DLL minor number. 2002-10-30 21:06:21 +00:00
Christopher Faylor 831d6fa520 * external.cc (cygwin_internal): Implement CW_CMDLINE.
* pinfo.h (SIGCOMMUNE): New signal type.
(commune_result): New structure for commune functions.
(picom): New enum for commune functions.
(_pinfo::hello_pid): New.  Pid who's communicating with me.
(_pinfo::tothem): New.  Handle of communicating pipe.
(_pinfo::fromthem): Ditto.
(_pinfo::commune_recv): Declare.
(_pinfo::commune_send): Declare.
(_pinfo::alive): Declare.
(_pinfo::cmdline): Declare.
(_pinfo::lock): Declare.
* pinfo.cc (set_myself): Initialize new _pinfo lock.
(_pinfo::alive): Define.  Determines if process still exists.
(_pinfo::commune_recv): Define.  Receive info from another cooperating process.
(_pinfo::commune_send): Define.  Send info to another cooperating process.
(_pinfo::cmdline): Define.  Determine command line of a given process.
* include/sys/cygwin.h (CW_CMDLINE): Define.
*sigproc.cc (talktome): Communicate with any processes who want to talk to me.
(wait_sig): Honor __SIGCOMMUNE.
* fhandler.cc (fhandler_virtual::fixup_after_exec): Declare.
* fhandler_proc.cc: Use malloc/free/realloc throughout rather than cmalloc
since buffers don't need to be propagated to subprocesses.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
(fhandler_virtual::fixup_after_exec): Define.
* fhandler_process.cc: Ditto for malloc/free/realloc.
(process_listin): Add "cmdline".
(fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE.
* miscfuncs.cc (isalpha_array): New array populated with xor values for alpha
characters to switch from one case to another.
* string.h (cygwin_strcasematch): New asm implementation of case match.
* string.h (cygwin_nstrcasematch): New asm implementation of counted case
match.
2002-10-30 21:05:18 +00:00
Danny Smith 4c8eba2cf3 2002-10-30 Guido Serassio <serassio@libero.it>
* include/stdio.h (_getnaxstdio): Add prototype.
         (_setmaxstdio): Likewise.
2002-10-30 01:07:54 +00:00
Christopher Faylor 950a7601d1 * pwdgrp.h (pwdgrp_read::open): Compare fh to INVALID_HANDLE_VALUE. 2002-10-24 14:33:13 +00:00
Joshua Daniel Franklin a8ab20942e * ntsec.sgml: Correct some minor grammatical errors. 2002-10-23 04:29:46 +00:00
Joshua Daniel Franklin 0fd3e6ea29 * dll.sgml: Simplify dll build instructions. 2002-10-23 03:55:34 +00:00
Christopher Faylor 281e3b2423 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Nevermind. Revert
everything to previous state wrt ntsec and exec bits.
2002-10-23 02:32:34 +00:00
Christopher Faylor 082512aea1 * shared.cc (shared_info::initialize): Use correct value for version
comparison.
* include/cygwin/version.h (CYGWIN_VERSION_MAGIC): Use all of a DWORD for magic
calculation.
2002-10-23 02:20:38 +00:00
Christopher Faylor 046a4e718e * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only do the
executable thing for #! scripts since .exe files wouldn't be executable in
ntsec case regardless.
2002-10-22 21:35:21 +00:00
Christopher Faylor 7dcbb978e0 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always consider
.exe files and '#!' shell scripts to be executable.
2002-10-22 20:41:31 +00:00
Christopher Faylor d525130f04 * cygthread.cc (cygthread::exiting): New variable.
(cygthread::initialized): Delete.
(cygthread::stub): Use exiting variable to determine when to exit.
(cygthread::runner): Delete.
(cygthread_protect): New variable.
(cygthread::init): Don't start runner thread.  Initialize muto for list
protection.
(cygthread::freerange): Return pointer to cygthread.
(cygthread::operator new): Change logic to start threads on an as-needed basis.
(cygthread::detach): Don't zero id.
(cygthread::terminate): Don't kill any executing threads.  Just set exiting
flag.
* cygthread.h (cygthread): Reflect above changes.
* dcrt0.cc (dll_crt0_1): Move cygthread initialization later.
* fork.cc (fork_child): Do fdtab fixup after dll fixup or (apparently) winsock
may allocate memory in dll load address.
2002-10-22 20:16:31 +00:00
Christopher Faylor 329b9ead3e * sec_helper.cc (cygsid::get_id): If the sid matches a sid stored in
cygheap->user, return the uid or gid from myself.
* security.cc (alloc_sd): If gid == myself->gid, return the group sid from
cygheap->user.  Remove the test for uid == original_uid, which is
counter-productive.
2002-10-22 16:22:10 +00:00
Christopher Faylor 1cc651ecaf * cygheap.cc (cygheap_fixup_in_child): Use user_heap element in cygheap.
(init_cheap): Ditto for declaration.
* fork.cc (fork_parent): Use user_heap element in cygheap.
* heap.h (inheap): Ditto.
* heap.cc (sbrk): Ditto.
(heap_init): Ditto.  Reorganize to shrink heap chunk as required and record new
value in cygheap.
* dcrt0.cc (dll_crt0_1): More "move the cygthread init" games.
* shared.cc (open_shared): Rework memory protection to properly deal with
relocated shared segment.
(shared_info::heap_chunk_size): Rename element to 'heap_chunk'.
* shared_info.h (shared_info): Ditto for declaration.
* strace.cc (strace::hello): Report on heap chunk size from cygheap since it
may shrink.
2002-10-22 16:18:55 +00:00
Christopher Faylor 5ec14fe40a Change _function() to function() throughout.
* cygwin.din: Remove last vestiges (?) of newlib wrappers.
* cygthread.cc (cygthread::detach): Always wait for event or suffer an
apparently inavoidable race.
* dcrt0.cc (dll_crt0_1): Allocate threads after stack has been relocated.
* debub.cc (lock_debug): Don't acquire lock on exit.
* fork.cc (fork_child): Recreate mmaps before doing anything else since Windows
has a habit of using blocks of memory in the child that could previously have
been occupied by shared memory in the parent.
* mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here and
provide some details about what went wrong.
(fixup_mmaps_after_fork): Remove error message.
* shared.cc (open_shared): Move warning message so that more detail is
possible.
* sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a race.
(sigproc_terminate): Specifically wait for process thread to terminate.
2002-10-21 01:00:58 +00:00
Christopher Faylor ccefaab1d5 * cygthread.cc (cygthread::stub): Fix typo.
(cygthread::terminate): Don't zero thread handle prior to using it.
2002-10-20 18:17:43 +00:00
Christopher Faylor cf70a7e372 fix typo 2002-10-20 04:53:30 +00:00
Christopher Faylor 818089d9c8 missed checkin 2002-10-20 04:46:31 +00:00
Christopher Faylor da17f96378 fix typo 2002-10-20 04:42:13 +00:00
Danny Smith aab9ff2a5e 2002-10-19 Kang Li <rubylith@users.sourceforge.net>
* include/fcntl.h (O_SEQUENTIAL): Correct typo.
2002-10-20 04:35:58 +00:00
Danny Smith 1c00ad29b8 2002-10-19 Danny Smith <dannysmith@users.sourceforge.net>
* crt1.c: Define new macro __IN_MINGW_RUNTIME before including
	stdlib.h. Comment on reason.
	Define WIN32_MEAN_AND_LEAN before including windows.h
	* include/stdlib.h (_fmode): Protect declaration as dllimported
	variable with __IN_MINGW_RUNTIME.

2002-10-19  Igor Pechtchanski  <pechtcha@cs.nyu.edu>

	* crt1.c: Include stdlib.h.
2002-10-20 04:30:28 +00:00
Christopher Faylor bfda61d419 * sigproc.cc (wait_sig): Remove obsolete sigchld logic. 2002-10-20 04:17:59 +00:00
Christopher Faylor d25c187f12 Rename _kill() to kill() throughout. Rename _raise() to raise() throughout.
Rename _pid() to pid() throughout.
* Makefile.in: Compile some objects with -fomit-frame-pointer.
* cygwin.din: Reverse aliasing for _kill.
* syscalls.cc (_getpid_r): New function, implemented for newlib compatibility.
* shared.cc (open_shared): Remove reserving of memory since previous change
eliminate the need for this hack.
2002-10-20 04:15:50 +00:00
Danny Smith bea966c0d9 * Makefile.in (CRT0S): Add txtmode.o binmode.o.
(MINGW_OBJS): Add txtmode.o.
	(SRCDIST_FILES): Add txtmode.c binmode.c.
	crt1.c: Don't include fcntrl.h, stdlib.h.
	(_fmode): Declare, without dllimport attribute.
	(__p__fmode): Declare access function for dll's _fmode.
	(_mingw32_init_fmode): Sync dll _fmode with staticly linked
	_fmode for app.
	* txtmode.c: New file.
	* binmode.c: New file.
	* samples/fmode/test2.c: New file.
	* samples/fmode/jamfile: Add test2.exe target.
2002-10-19 20:26:26 +00:00
Christopher Faylor 1fc4df5a69 * fork.cc (fork_child): Move pinfo fixup later to attempt some minor gains from
concurrency from cythread::init.
2002-10-19 18:29:37 +00:00
Christopher Faylor 3350721cff fix changelog 2002-10-19 11:59:14 +00:00
Christopher Faylor 7c51881531 * mount.cc (usage): Correctly report default mode. 2002-10-19 11:41:31 +00:00
Christopher Faylor a85860b5c8 * dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not forking.
* fork.cc (fork_child): Initialize cygwin thread later in process to avoid
allocating memory for thread stacks.
* shared.cc (open_shared): Issue warning if NT and shared segment is relocated.
2002-10-19 00:57:06 +00:00
Christopher Faylor 824166e620 * cygthread.cc: Bump number of cygthreads up to accommodate applications which
use ttys.
2002-10-19 00:35:20 +00:00
Christopher Faylor 60bc7b5977 * fork.cc (fork_child): Move mmap initialization.
* shared.cc (shared_info::heap_chunk_size): Store info as megabytes.  Search
HKEY_LOCAL_MACHINE as well as HKEY_CURRENT_USER.
* shared_info.h (shared_info::initial_heap_size): Change element name to
reflect new functionality.
* strace.cc (strace::hello): Report on initial heap size.
2002-10-18 23:52:59 +00:00
Christopher Faylor 5d8c2b592d * thread.cc (verifyable_object_isvalid): Test for a valid object pointer before
testing for static ptr.
2002-10-18 14:02:40 +00:00
Christopher Faylor abb58a6d3f * dtable.cc (dtable::init_std_file_from_handle): Force "devices" to always be
in binary mode.  Temporary fix until ssh is rebuilt?
2002-10-18 01:28:48 +00:00
Christopher Faylor fef1edbc9a * dtable.cc (dtable::set_file_pointers_for_exec): New function.
* dtable.h (dtable::set_file_pointers_for_exec): Declare new function.
* spawn.cc (spawn_guts): Call dtable::set_file_pointers_for_exec to set
pointers to EOF when execing non-cygwin applications.
2002-10-17 17:45:09 +00:00
Robert Collins e9350b6575 2002-10-17 Robert Collins <rbtcollins@hotmail.com>
* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare.
        * thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement.
        (pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid
        unneeded SEGV's during debugging.
2002-10-17 08:44:18 +00:00
Robert Collins 841cf30bc3 2002-10-17 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (verifyable_object_isvalid): Test for static object first.
2002-10-17 08:31:30 +00:00
Danny Smith d7c2dc62fd * include/winuser.h (MONITORINFOEX[AW]): Add structure
definitions and ANSI/UNICODE mappings.
	Cleanup whitespace.
2002-10-16 22:20:34 +00:00
Christopher Faylor 207daf0f11 * fhandler_tty.cc (fhandler_tty_slave::read): Attempt #527 to properly
implement VMIN/VTIME.
2002-10-16 04:54:08 +00:00
Christopher Faylor 6c6c3b90e9 * shared.cc (open_shared): Revert to "old" method for shared memory location if
!wincap.needs_memory_protection.
* wincap.cc: Implement needs_memory_protection throughout.
* wincap.h: Ditto.
2002-10-15 17:04:20 +00:00
Christopher Faylor fdb28b5e5f * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info_fork::mount_table): Remove.
(child_info_fork::myself_addr): Remove.
* fork.cc (fork_child): Don't set either of the above.
* dcrt0.cc (dll_crt0_1): Call memory_init as early as possible.
* fhandler_console.cc (console_state): Move to shared_info.h.
(fhandler_console::get_tty_stuff): Reflect open_shared arg change.
* pinfo.cc (myself_addr): Remove definition.
(pinfo::init): Get myself address from open_shared.
* pinfo.h (myself_addr): Remove declaration.
* shared.cc (open_shared): Rework so that known shared memory locations are
protected.  Take shared memory type as fifth argument.
(memory_init): Reflect open_shared arg change.
* shared_info.h (shared_locations): New enum.
(console_state): Move here.
(open_shared): Reflect open_shared arg change in declaration.
2002-10-15 07:03:45 +00:00
Christopher Faylor 54030e2146 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info_fork::heaptop): Remove obsolete element.
(child_info_fork::heabbase): Ditto.
(child_info_fork::heapptr): Ditto.
(child_info_fork::mount_table): New element.
(child_info_fork::myself_addr): Ditto.
* dcrt0.cc (dll_crt0_1): Set mount_table and myself_addr when forking.
(initial_env): Add newline to "sleeping" message.
* dll_init.cc (reserve_upto): Accommodate cygwin heap when freeing memory.
Make debugging output a little more descriptive.
* fork.cc (fork_parent): Save mount_table and myself_addr.
* pinfo.cc (myself_addr): New variable.
(set_myself): Pass PID_MYSELF flag to init.
(pinfo::Init): Honor PID_MYSELF.  Save address where myself shared memory
resides in myself_addr, for fork.
* pinfo.h (myself_addr): Declare.
* shared.cc (memory_init): On fork, use previously saved address for location
of mount table.
* include/sys/cygwin.h (PID_MYSELF): New value.
* dtable.cc (dtable::stdio_init): Don't pass access type to
init_std_file_from_handle.  It's always the same.
(dtable::init_std_file_from_handle): Remove access type argument.  Assume
read/write.
* dtable.h (dtable::init_std_file_from_handle): Ditto for declaration.
* exceptions.cc (try_to_debug): Don't try to debug if already being debugged.
* fhandler_console.cc (shared_console_info_save): New variable.
(fhandler_console::get_tty_stuff): Save address of shared console stuff for
fork.
2002-10-14 20:25:52 +00:00
Earnie Boyd c14ae835c5 * Makefile.in: Add components for lib/ddk. Adjust for autoconf-2.53.
* configure.in: Ditto.
	* lib/Makefile.in: Ditto.
	* lib/ddk/Makefile.in: Correct installation procedure.  Adjust for
	autoconf-2.53.
	* configure: Regenerate.
2002-10-14 19:59:04 +00:00
Christopher Faylor 969203ce91 * cygthread.cc (cygthread::stub): Reintroduce clearing of __name but do it
before SetEvent to eliminate a race.
(cygthread::terminate): Accumulate list of threads to check for termination and
call WaitForMultipleObjects on list rather than waiting for each thread
individually.
* sigproc.cc (subproc_init): Zap hwait_subproc thread handle since it is no
longer used.
* spawn.cc (spawn_guts): Fix so that cygthread::terminate is *really* called
only for exec.
2002-10-14 03:51:44 +00:00
Christopher Faylor a7a5d0ba37 * cygthread.cc (cygthread::stub): Don't zero __name here. That introduces a
race.
2002-10-14 02:37:49 +00:00
Danny Smith 5c2b46f4a8 * include/windows.h: Don't include basetyps.h.
* include/objfwd.h: Do include basetyps.h.
2002-10-14 02:12:51 +00:00
Christopher Faylor bac610ad86 * include/cygwin/version.h: Bump DLL minor number. 2002-10-14 00:06:33 +00:00
Christopher Faylor 3f5046a540 * cygthread.cc (cygthread::stub): Don't create event for long-running threads.
Initialize thread_sync event here which is used to Suspend using an event
rather than relying on SuspendThread/ResumeThread.
(cygthread::init): Save handle to runner thread for future termination.
(cygthread::cygthread): Only resume thread when it is actually suspended.
Otherwise signal thread completion event.
(cygthread::terminate): Forcibly terminate runner thread and any helper
threads.  Call DisableThreadLibrary calls if execing.
* cygthread.h (cygthread::thread_sync): Declare.
* dcrt0.cc (do_exit): Eliminate calls to obsolete window_terminate and
shared_terminate.
* exceptions.cc (events_terminate): Don't bother closing title_mutex since it
is going away anyway.
* pinfo.cc (_pinfo::exit): Call cygthread::terminate to ensure that threads are
shut down before process exit or otherwise strange races seem to occur.
* shared.cc (shared_terminate): Eliminate.
* shared.h (shared_terminate): Eliminate declaration.
* winsup.h (window_terminate): Eliminate declaration.
* spawn.cc (spawn_guts): Call cygthread::terminate early in process if execing.
Call DisableThreadLibrary calls if execing.
* window.cc (Winmain): Call ExitThread to force exit.
(window_terminate): Eliminate.
* dcrt0.cc (do_exit): Track exit state more closely.
2002-10-13 18:16:33 +00:00
Danny Smith 5cafa3aa1a * include/objbase.h: Include rpc.h and rpcndr.h
before header guard.
2002-10-13 03:11:58 +00:00
Danny Smith afc65aebbd * include/olectl.h (PROPPAGEINFO): Change type of
field cb to ULONG.
2002-10-11 03:40:06 +00:00
Danny Smith b04b30b914 2002-10-11 Steven Edwards <Steven_Ed4153@yahoo.com>
* lib/ntdll.def (RtlAcquireResourceExclusive,
	RtlAcquireResourceShared, RtlDeleteResource,
	RtlInitializeResource, RtlReleaseResource,
	RtlTimeToSecondsSince1970) : Added missing exports.
	* include/olectl.h (PROPPAGEINFO): Change type of
	field cb to ULONG.
2002-10-11 03:38:14 +00:00
Danny Smith 798a4740d7 * include/stdint.h (INT64_C, UINT64_C ): Append suffix to let
macros work with C89.
	(INTMAX_C, UINTMAX_C): Likewise.
2002-10-11 02:21:56 +00:00
Danny Smith f98e630084 * include/string.h (strcasecmp): Make extern __inline__.
(strncasecmp): Likewise.
	(wcscmpi): Likewise.
2002-10-11 01:41:31 +00:00
Christopher Faylor b01ff453d9 * window.cc (gethwnd): Use SetThreadPriority method. 2002-10-10 05:31:43 +00:00
Christopher Faylor 2a3bf3e2ce * Makefile.in (new-cygwin1.dll): Reorganize library order.
* dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads are
terminated during vfork.
* sigproc.cc (proc_terminate): Grab proc lock prior to signalling subproc
thread exit to avoid an extra "wait-for-thread-to-exit".
2002-10-10 05:23:23 +00:00
Christopher Faylor c4ec64d76b * cygthread.cc (cygthread::stub): Don't create an event for "cygself" threads.
Assume that they exit via an ExitThread call.
* cygthread.h (cygthread::SetThreadPriority): New function.
(cygthread::zap_h): New function.
* dcrt0.cc (do_exit): Move cygthread::terminate earlier and establish
exit_state guard.
* fhandler.h (fhandler_tty_master::output_thread): Delete.
* fhandler_tty.cc (fhandler_tty_master::init): Set priority for threads via
method.  Zap handles when done.  Don't treat process_output specially.
(process_output): Call ExitThread directly.
(fhandler_tty_master::fixup_after_fork): Don't worry about output_thread.
(fhandler_tty_master::fixup_after_exec): Ditto.
* sigproc.cc (proc_terminate): Don't detach from hwait_subproc.  Just let it
exit.
(sigproc_init): Close thread handle after initialization.
(wait_sig): Use GetCurrentThread() as SetThreadPriority call rather than
*event* handle.  Call ExitThread directly on termination.
(wait_subproc): Call ExitThread directly on termination.
* tty.cc (tty_list::terminate): Don't attempt t detach from output_thread.
2002-10-09 05:55:40 +00:00
Christopher Faylor 7da53596cf * cygheap.cc (dup_now): Make fatal error a little more informative.
(cygheap_setup_for_child): Detect when default size of shared region is less
than the current size and allocate that much.
(_cbrk): Just return NULL on inability to allocate.
(_cmalloc): Ditto.
* cygheap.h (CYGHEAPSIZE): Change size to reflect newer, tinier fhandler sizes.
* spawn.cc (av::error): New element, reflects potential errno from cmalloc.
(av::~av): Don't free NULL pointers.
(av::replace0_maybe): Detect out-of-memory conditions.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): Set errno and return if argv creation ran into problems.
* fhandler.h (fhandler_union): Change member names to something safer.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Always set
fhandler_console::dev_state regardless of whether shared region is initialized.
* cygthread.cc (cygthread::runner): Use ExitThread rather than return
(planning for future).
2002-10-09 04:08:05 +00:00
Danny Smith ce6ac4003f 2002-10-08 Heiko Gerdau <hg@technosis.de>
* include/oleacc.h: New file.
	* include/winuser.h (ENDSESSION_LOGOFF) Add define.
	(OBJID_*) Add defines.
	* lib/uuid.c: Add DEFINE_GUID for IID_IAccessible.
	* lib/test.c: Include oleacc.h.
2002-10-09 00:16:22 +00:00
Danny Smith 32fef334cd 2002-10-08 Heiko Gerdau <hg@technosis.de>
* include/tchar.h (_tchdir. _tgetcwd, _tgetdcwd.
	_tmkdir, _trmdir, _tstat): Add ASCII and UNICODE
	mappings.
2002-10-08 20:28:14 +00:00
Christopher Faylor 3c66c0707c * fhandler.h (dev_console): New class.
(fhandler_console::dev_state): New class element.
(fhandler_console::mouse_aware): Use dev_state element.
(fhandler_console::get_tty_stuff): Declare new function.
* fhandler_console.cc: Use dev_state fhandler_console element, throughout.
(fhandler_console::get_tty_stuff): Move to fhandler_console class.  Incorporate
dev_console information.  Move constructor stuff here.
2002-10-08 06:16:16 +00:00
Christopher Faylor 9655ff2680 * dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard open
behavior with files redirected from stdin/stdout/stderr, i.e., fmode settings
take precedence over mount settings.
2002-10-08 02:44:35 +00:00
Christopher Faylor dd76747b8e * dtable.cc (unknown_file): New variable.
(dtable::init_std_file_from_handle): Don't set binmode if we couldn't determine
the actual file name on stdin/stdout/stderr.
(handle_to_fn): Return unknown_file when can't determine filename.
2002-10-07 20:06:16 +00:00
Christopher Faylor bc63ea872c * dcrt0.cc (do_exit): Call DisableThreadLibraryCalls since we don't need to
track thread detaches.
* init.cc (dll_entry): Reorganize slightly.  Fix api_fatal message.
2002-10-07 04:12:54 +00:00
Danny Smith 66451d9590 * mingwex/math/powil.c: Rename powil to __powil.
* mingwex/math/powl.c: Adjust declaration and call
	to __powil. Remove comment on powil.
	* mingwex/math/powi.c: New file.
	* mingwex/math/powif.c: New file.
	* mingwex/math/pow.c: New file.
	* mingwex/math/cephes_mconf.h. Add double and float
	versions of constants.
	(polevl): Add double precision function.
	(p1evl): Likewise.
	* mingwex/Makefile.in (MATH_DISTFILES): Add pow.c,
	powi.c, powif.c.
	(MATH_OBJS): Add pow.o,	powi.o, powif.o.
2002-10-06 23:26:43 +00:00
Earnie Boyd 2bacbfb1d1 2002-10-06 Casper Hornstrup <chorns@it.dk>
* include/ddk: New subdir.
	* lib/ddk: Ditto.
	* include/ddk/(atm.h, batclass.h, cfg.h, cfgmgr32.h, d4drvif.h,
	d4iface.h, ddkmapi.h, hidclass.h, hidpi.h, hidusage.h, mcd.h,
	miniport.h, minitape.h, mountdev.h, mountmgr.h, ndis.h,
	ndisquid.h, ndistapi.h, ndisvan.h, netevent.h, netpnp.h,
	netdev.h, ntapi.h, ntdd8042.h, ntddbeep.h, ntddcdrm.h,
	ntddcdvd.h, ntddchgr.h, ntdddisk.h, ntddk.h, ntddkbd.h,
	ntddmou.h, ntddndis.h, ntddpar.h, ntddpcm.h, ntddscsi.h,
	ntddser.h, ntddstor.h, ntddtape.h, ntddtdi.h, ntddvdeo.h,
	ntddvol.h, ntifs.h, ntpoapi.h, ntstatus.h, parallel.h, pfhook.h,
	poclass.h, scsi.h, scsiscan.h, scsiwmi.h, smbus.h, srb.h,
	storport.h, tdi.h, tdiinfo.h, tdikrnl.h, tdistat.h, tvout.h,
	upssvc.h, usb.h, usb100.h, usbcamdi.h, usbdi.h, usbioctl.h,
	usbiodef.h, usbscan.h, usbuser.h, video.h, videoagp.h, win2k.h,
	winddi.h, winddk.h, winnt4.h, winxp.h, ws2san.h,
	xfilter.h): New files.
	* lib/ddk/(Makefile.in, apcups.def, cfgmgr32.def, dxapi.def,
	hal.def, hid.def, hidparse.def, mcd.def, ndis.def, ntoskrnl.def,
	scsiport.def, tdi.def, usbcamd.def, usbcamd2.def, videoprt.def,
	win32k.def): Ditto.
2002-10-06 22:18:26 +00:00
Christopher Faylor 09663d31bb * cygthread.cc (cygthread::stub): Very minor cleanup.
(cygthread::stub): Report overflows in cygwin thread pool when DEBUGGING is on
and special environment variable is not set.
(cygthread::terminate): Set event only when event actually exists.
* exceptions.cc (signal_exit): Set priority of main thread to low before
setting current thread to high.
2002-10-06 01:01:58 +00:00
Christopher Faylor f8f63f9bc1 whitespace 2002-10-05 17:47:25 +00:00
Danny Smith b63ad95b8d 2002-10-04 Steven Edwards <Steven_Ed4153@yahoo.com>
* lib/ntdll.def (NtAccessCheck, NtAdjustPrivilegesToken,
	NtCreateKey, NtDeleteKey, NtDeleteValueKey, NtEnumerateKey,
	NtEnumerateValueKey, NtOpenKey, NtOpenProcessToken,
	NtOpenThreadToken, NtQueryInformationToken, NtQueryKey,
	NtQueryValueKey, NtSetSecurityObject, NtSetValueKey,
	RtlAddAccessAllowedAce, RtlCreateAcl,
	RtlCreateSecurityDescriptor, RtlCreateUnicodeStringFromAsciiz,
	RtlGetAce, RtlGetControlSecurityDescriptor,
	RtlGetDaclSecurityDescriptor,RtlGetGroupSecurityDescriptor,
	RtlGetOwnerSecurityDescriptor,RtlGetSaclSecurityDescriptor,
	RtlImpersonateSelf, RtlIsTextUnicode, RtlLargeIntegerAdd,
	RtlLengthSecurityDescriptor, RtlMakeSelfRelativeSD,
	RtlMultiByteToUnicodeN RtlMultiByteToUnicodeSize,
	RtlOpenCurrentUser, RtlSetDaclSecurityDescriptor,
	RtlSetGroupSecurityDescriptor, RtlSetOwnerSecurityDescriptor,
	RtlSetSaclSecurityDescriptor, RtlValidSecurityDescriptor,
	ZwAccessCheck, ZwAdjustPrivilegesToken, ZwCreateKey,
	ZwDeleteValueKey, ZwEnumerateKey, ZwEnumerateValueKey,
	ZwOpenKey, ZwOpenProcessToken, ZwOpenThreadToken,
	ZwQueryInformationToken, ZwQueryKey, ZwQueryValueKey
	ZwSetSecurityObject, ZwSetValueKey): Added missing exports.

ChangeLog whitespace cleanup.
2002-10-04 04:39:26 +00:00
Danny Smith d905b7d0ce 2002-10-04 "KJK::Hyperion" <noog@libero.it>
*include/windef.h (WPARAM): Update typedef.
	(LPARAM): Ditto.
	(LRESULT): Ditto.
2002-10-04 04:25:00 +00:00
Danny Smith 6930d6cdd0 2002-10-04 "KJK::Hyperion" <noog@libero.it>
* include/shlobj.h (CSIDL_*): Add defines.
2002-10-04 04:18:55 +00:00
Danny Smith 3073f3f29d * include/cytpe.h (_imp____mbcur_max): Add missing ';'.
(_imp____mbcur_max_dll): Likewise.
2002-10-03 00:51:25 +00:00
Danny Smith 7c3de623b6 * include/fcntl.h (_fmode): Remove declarations and
compatibility defines.
	(_setmode, setmode): Remove prototypes.
	* include/stdlib (_fmode): Add declarations and
	compatibility defines.  Change type to int.
	* include/io.h (_setmode, setmode): Add prototypes.
	* samples/fmode/all.c: Adjust includes.
	* samples/fmode/test.c: Likewise.
	* crt1.c (_CRT_fmode): Declare as int.
	* CRTfmode.c (_CRT_fmode): Likewise.

	* include/stdlib: Remove comment about MB_CUR_MAX.
2002-10-03 00:49:21 +00:00
Danny Smith 516658560f * include/stdlib.h (_imp____mbcur_max): add missing ';'.
(_imp____mbcur_max_dll): Likewise.
2002-10-02 03:43:33 +00:00
Robert Collins 404f35cb5c 2002-10-01 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining
        why.
        (pthreadNull::_instance): Copy on fork. Absolutely no state exists
        in pthreadNull.
2002-09-30 21:06:05 +00:00
Conrad Scott 18be975d30 * cygserver_transport_pipes.cc (transport_layer_pipes::accept):
Remove trailing \n from debug_printf.
2002-09-30 18:31:56 +00:00
Christopher Faylor 6cae97d5dc whitespace 2002-09-30 15:17:44 +00:00
Christopher Faylor 66dca8bb0d * thread.cc (pthread_mutex::initMutex): Remove \n from api_fatal. 2002-09-30 15:11:55 +00:00
Christopher Faylor bd2b5664a1 * thread.cc (pthread::precreate): Use explicit "no inherit" option when
creating mutex.
(pthread_mutex::nativeMutex::init): Ditto.
(semaphore::semaphore): Ditto.
2002-09-30 15:05:00 +00:00
Christopher Faylor e58273df45 * thread.cc (pthread_key::keys): Do not copy on fork.
(pthread_mutex::mutexInitializationLock): Ditto.
(pthreadNull::_instance): Ditto.
2002-09-30 15:00:52 +00:00
Christopher Faylor 63e5f2006d * exceptions.cc (unused_sig_wrapper): Still need additional level of
indirection when setting errno.
2002-09-30 14:18:43 +00:00
Robert Collins 06175d0acd 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_mutex::initMutex): Use the wrapper init call.
        (pthread_mutex::nativeMutex::init): Implement.
        (pthread_mutex::nativeMutex::lock): Ditto.
        (pthread_mutex::nativeMutex::unlock): Ditto.
        (pthread_mutex::init): Use the wrapper lock and unlockcalls.
        * thread.h (pthread_mutex): Move mutexInitializationLock into a
        nativeMutex wrapper class.
2002-09-30 11:43:43 +00:00
Christopher Faylor f70389b541 Remove \n from calls to strace class printfs throughout. 2002-09-30 04:35:18 +00:00
Christopher Faylor da77b2c84c remove newline 2002-09-30 04:27:32 +00:00
Christopher Faylor e7733defb9 * exceptions.cc (unused_sig_wrapper): Accommodate newer compilers. 2002-09-30 04:26:52 +00:00
Christopher Faylor f789fbbf35 * security.cc (allow_ntsec): Default to zero.
* environ.cc (environ_init): Set allow_ntsec to TRUE by default, assuming OS
allows it.
2002-09-30 03:05:13 +00:00
Christopher Faylor 0fa64fa3a7 * cygpath.cc (close_arg): Remove unused static.
* mkgroup.c (enum_local_users): Avoid compiler warning.
(enum_users): Ditto.
* mkpasswd.c: Ditto throughout.
* ssp.c: Ditto throughout.
2002-09-30 03:01:17 +00:00
Christopher Faylor 9d1e72a175 * environ.cc (environ_init): Avoid a compiler warning.
* path.cc (path_conv::check): Ditto.
* path.h (path_conv::operator int): Ditto.
* regex/engine.c: Ditto throughout.
* regex/regcomp.c: Ditto throughout.
* regex/regexec.c: Ditto throughout.
2002-09-30 02:51:22 +00:00
Christopher Faylor 79ed43004f * thread.cc: Use "%E" in *_printf throughout rather than calling GetLastError.
GNUify comments.
(__pthread_mutex_lock): Don't return error on EBUSY since that just means that
the mutex has already been initialized.
2002-09-30 01:19:45 +00:00
Christopher Faylor 881ffcb478 GNUify slightly. 2002-09-29 23:56:57 +00:00
Robert Collins eb208df05a 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc (pthread_mutex_init): Use new pthread_mutex::init.
        * thread.cc: Change __pthread_mutex_init to pthread_mutex::init
        throughout.
        (MTinterface::Init): Initialise pthread_mutex support.
        (pthread_mutex::mutexInitializationLock): Instantiate.
        (pthread_mutex::initMutex): New method.
        (__pthread_cond_dowait): Don't dereference untrusted pointers.
        Use the new pthread_mutex::init method.
        (__pthread_condattr_init): Don't dereference untrusted pointers.
        (__pthread_mutex_init): Rename to pthread_mutex::init.
        Lock and release mutexInitializationLock to prevent races on
        mutex initialisation.
        * thread.h (pthread_mutex::initMutex): New method, initialise
        pthread_mutex supporting state on process initialisation.
        (pthread_mutex::init): Initialise a single mutex.
        (pthread_mutex::mutexInitializationLock): A win32 mutex for
        syncronising pthread mutex initialisation.
        (__pthread_mutex_init): Remove this.
2002-09-29 23:47:45 +00:00
Christopher Faylor 4d8eba164f Add missing ChangeLog entry. 2002-09-29 03:15:55 +00:00
Christopher Faylor aea1f301fc * cygthread.h (cygthread::terminate): Declare new function.
(cygthread::initialized): Change to 'int'.
* cygthread.cc (cygthread::stub): Exit thread if initialized < 0.
(cygthread::new): Ditto.
(cygthread::runner): Ditto.  Set initialized using xor to preserve sign.
(cygthread::terminate): New function.
* dcrt0.cc (do_exit): Call cygthread::terminate.
2002-09-29 02:19:35 +00:00
Christopher Faylor fc5dae1cca * Makefile.in (check): Be more defensive when creating testsuite config.status. 2002-09-28 03:15:44 +00:00
Robert Collins da6a08decb 2002-09-27 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::run_destructor): Run_destructor is not
       const as it needs to set the key value.
       * thread.h (pthread_key::run_destructor): Ditto.

2002-09-27  Robert Collins <rbtcollins@hotmail.com>

       * thread.cc (pthread_key::run_destructor): Follow opengroup algorithm.
       I.e. only run the destructor NON-NULL key values, and reset the key
       to NULL before running the destructor. Reported by Thomas Pfaff.
2002-09-27 15:08:50 +00:00
Christopher Faylor 961973e7a4 * cygrun.c (main): Fix setting of CYGWIN environment variable.
* Makefile.in: Remove linking of unnecessary libraries.
2002-09-25 13:53:46 +00:00
Christopher Faylor 38c77307c5 * fhandler_proc.cc (format_process_stat): make ctty a real device number.
(format_process_status): use effective uid/gid as real and saved uid/gid.
2002-09-25 12:24:23 +00:00
Corinna Vinschen f4b098d95e * errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
EOVERFLOW.
	(_sys_errlist): Add entries for EILSEQ and EOVERFLOW.
	(strerror): Ditto.
	* mmap.cc (map_map): Set errno in case of error.
	(mmap64): Remove setting errno explicitely to ENOMEM.
2002-09-24 14:17:50 +00:00
Corinna Vinschen 6b579509ea * mmap.cc (map_map): Add debug output.
(mmap64): Evaluate gran_len correctly even if offset isn't 0.
2002-09-24 13:48:07 +00:00
Danny Smith 1878ede072 * include/ws2tcpip.h: Throw error if winsock.h, not winsock2.h
has been included first.
2002-09-24 01:47:27 +00:00
Danny Smith 7aaee7b646 2002-09-24 Rene Moeller Fonseca <fonseca@users.sourceforge.net>
* include/winbase.h (FindFirstFileEx): Fixed ANSI mode.
        * include/wingdi.h (PFD_SWAP_LAYER_BUFFERS):Added define.
        * include/winuser.h (AppendMenu[AW]): Fixed prototypes.
2002-09-24 01:28:00 +00:00
Christopher Faylor f0227ea3c7 More GNUify non-GNU formatted functions calls throughout. 2002-09-23 00:31:31 +00:00
Christopher Faylor c87c8a533f Reset ChangeLog dates from cygwin_daemon merge. 2002-09-22 21:44:17 +00:00
Christopher Faylor 6299349ba4 white space. 2002-09-22 21:39:03 +00:00
Christopher Faylor c6392f6a72 * Makefile.in (DLL_O_FILES): Restore formatting. 2002-09-22 16:33:36 +00:00
Conrad Scott 1c001dd2d6 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
GNUify non-GNU formatted functions calls throughout.

2002-09-22  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (with_strerr): Remove macro.
	(server_shmmgr::segment_t::~segment_t): Remove calls to with_strerr.
	(server_shmmgr::segment_t::attach): Ditto.
	(server_shmmgr::new_segment): Ditto.
	* shm.cc (with_strerr): Remove macro.
	(client_shmmgr::shmdt): Remove calls to with_strerr.
	(client_shmmgr::attach): Ditto.

2002-09-21  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/sys/ipc.h: Move to "include/cygwin/ipc.h".
	* include/sys/msg.h: Move to "include/cygwin/msg.h".
	* include/sys/sem.h: Move to "include/cygwin/sem.h".
	* include/sys/shm.h: Move to "include/cygwin/shm.h".
	* include/cygwin/ipc.h: New file.
	* include/cygwin/msg.h: Ditto.
	* include/cygwin/sem.h: Ditto.
	* include/cygwin/shm.h: Ditto.
	* cygserver_shm.h: Update includes.
	* msg.cc: Ditto.
	* sem.cc: Ditto.

2002-09-21  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* safe_memory.h (safe_delete): Make a templated function.
	* cygserver.cc (~server_request): Update use of safe_delete.
	(main): Ditto.
	* cygserver_client.cc (client_request::handle_request): Ditto.
	(client_request::make_request): Ditto.
	* cygserver_process.cc (~process_cleanup): Ditto.
	(process::remove): Ditto.
	(process::cleanup): Ditto.
	(process_cache::process): Ditto.
	* cygserver_shm.cc (server_shmmgr::segment_t::detach): Ditto.
	(server_shmmgr::delete_segment): Ditto.
	* shm.cc (client_shmmgr::shmdt): Ditto.
	* threaded_queue.cc (~threaded_queue): Ditto.
	(threaded_queue::worker_loop): Ditto.

2002-08-29  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* safe_memory.h: Replace #include <new> with an explicit
	definition of the placement new operator.
	(safe_delete): Remove unnecessary ## operator.

2002-07-28  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (class server_shmmgr): Remove `cleanup_t'
	friend declaration.
	(cleanup_t::cleanup_t): Use the segment's shmid as the key rather
	than the segment pointer itself.
	(cleanup_t::segptr): Remove method.
	(cleanup_t::shmid): New method.
	(cleanup_t::cleanup): Update for new key value.
	(server_shmmgr::find (segment_t *)): Remove method.
	* include/cygwin/cygserver_process.h (cleanup_routine::key): Make
	method const.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver_process.h
	(cleanup_routine::_key): New field.
	(cleanup_routine::cleanup_routine): Initialise new field with new
	argument.
	(cleanup_routine::operator==): New method.
	(cleanup_routine::key): New method.
	(cleanup_routine::cleanup): Make argument non-const.
	(process::is_active): New method.
	(process::remove): Ditto.
	(process::check_exit_code): Rename method.
	* cygserver_process.cc (process::add): Reorganize code.
	(process::remove): New method.
	(process::check_exit_code): Rename method.
	(process::cleanup): Use new `process::is_active' method.
	(process_cache::process): Ditto.
	(process_cache::sync_wait_array): Ditto.
	(process_cache::check_and_remove_process): Ditto.
	* cygserver_shm.cc (server_shmmgr): Make `cleanup_t' a friend.
	(segment_t::detach): Make argument non-const.  Remove cleanup
	object from client if appropriate.
	(cleanup_t::_segptr): Remove field.
	(cleanup_t::cleanup_t): Initialise parent explicitly.  Remove
	field.
	(cleanup_t::segptr): New method.
	(cleanup_t::cleanup): Add error checking and reporting.
	(server_shmmgr::shmdt): Make argument non-const.
	(server_shmmgr::find (segment_t *)): New method.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (client_request_shutdown::client_request_shutdown):
	Comment out verbose tracing statement.
	* cygserver_client.cc
	(client_request_get_version::client_request_get_version): Ditto.
	(client_request_attach_tty::client_request_attach_tty): Ditto.
	* cygserver_shm.cc (client_request_shm::client_request_shm):
	Ditto.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport_pipes.cc (transport_layer_pipes::listen):
	Set `_is_listening_endpoint' appropriately.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver_transport.h
	(transport_layer_base::listen): Change return type.
	(transport_layer_base::connect): Ditto.
	* include/cygwin/cygserver_transport_pipes.h
	(transport_layer_pipes::listen): Change return type.
	(transport_layer_pipes::connect): Ditto.
	(transport_layer_pipes::_sec_none_nih): Remove unused field.
	(transport_layer_pipes::_is_listening_endpoint): New field.
	* cygserver_transport_pipes.cc: Synchronize with sockets code.
	(transport_layer_pipes::transport_layer_pipes): Initialise new
	field.  Separate out asserts.
	(transport_layer_pipes::listen): Change return type.  Add asserts.
	(transport_layer_pipes::accept): Add asserts.
	(transport_layer_pipes::read): Change conditional to an assert.
	Add assert.
	(transport_layer_pipes::write): Ditto.
	(transport_layer_pipes::connect): Change return type.  Change
	conditional to an assert.  Add asserts.  Rationalize error code
	slightly.
	(transport_layer_pipes::impersonate_client): Add asserts.
	* include/cygwin/cygserver_transport_sockets.h
	(transport_layer_sockets::listen): Change return type.
	(transport_layer_sockets::connect): Ditto.
	(transport_layer_sockets::_addr): Change type of field.
	(transport_layer_sockets::_addr_len): Ditto.
	(transport_layer_sockets::_is_accepted_endpoint): New field.
	(transport_layer_sockets::_is_listening_endpoint): Ditto.
	* cygserver_transport_sockets.cc
	(MAX_CONNECT_RETRY): New constant.
	(transport_layer_sockets::transport_layer_sockets): Initialise new
	fields.  Only initialise the socket address where necessary.
	(transport_layer_sockets::listen): Change return type.  Rewrite.
	(transport_layer_sockets::accept): Add asserts.  Add tracing
	statements.  Use a local variable to hold the accepted address.
	(transport_layer_sockets::close): Add tracing statements.  Unlink
	the UNIX domain socket file as appropriate.  Close the socket
	cleanly.
	(transport_layer_sockets::read): Rewrite method.
	(transport_layer_sockets::write): Ditto.
	(transport_layer_sockets::connect): Change return type.  Rewrite.
	* cygserver.cc (server_submission_loop::request_loop): Run the
	listening thread at high priority with special handling for
	shutdown.
	(main): Print the request error code rather than errno in shutdown
	request code.  Install signal handlers with sigaction(2) to avoid
	setting SA_RESTART.  Check value of the listen method call, now it
	has one.
	* cygserver_client.cc (client_request::make_request): Check new
	return value on connect method call.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver_transport_pipes.h
	(cygserver_transport_pipes::_sd): Rename field.
	(cygserver_transport_pipes::_sec_none_nih): Ditto.
	(cygserver_transport_pipes::_sec_all_nih): Ditto.
	(cygserver_transport_pipes::_pipe_name): Ditto.
	(cygserver_transport_pipes::_hPipe): Ditto.
	(cygserver_transport_pipes::_is_accepted_endpoint): Ditto.
	* cygserver_transport_pipes.cc
	(transport_layer_pipes::transport_layer_pipes): Rename fields.
	(transport_layer_pipes::init_security): Ditto.
	(transport_layer_pipes::listen): Ditto.
	(transport_layer_pipes::accept): Ditto.
	(transport_layer_pipes::close): Ditto.
	(transport_layer_pipes::read): Ditto.
	(transport_layer_pipes::write): Ditto.
	(transport_layer_pipes::connect): Ditto.
	(transport_layer_pipes::impersonate_client): Ditto.
	(transport_layer_pipes::revert_to_self): Ditto.
	* include/cygwin/cygserver_transport_sockets.h
	(cygserver_transport_sockets::_fd): Rename field.
	(cygserver_transport_sockets::_addr): Ditto.
	(cygserver_transport_sockets::_addr_len): Ditto.
	* cygserver_transport_sockets.cc
	(transport_layer_sockets::transport_layer_sockets): Rename fields.
	(transport_layer_sockets::listen): Ditto.
	(transport_layer_sockets::accept): Ditto.
	(transport_layer_sockets::close): Ditto.
	(transport_layer_sockets::read): Ditto.
	(transport_layer_sockets::write): Ditto.
	(transport_layer_sockets::connect): Ditto.

2002-07-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (with_strerr): Fix use of %p format.
	* shm.cc (client_shmmgr::shmat): Ditto.
	(client_shmmgr::shmctl): Ditto.
	(client_shmmgr::shmdt): Ditto.
	(client_shmmgr::attach): Ditto.

2002-07-14  Christopher Faylor  <cgf@redhat.com>

	* woutsup.h (system_printf): Remove extraneous semicolon from macro
	definition.

2002-07-14  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport_pipes.cc
	(transport_layer_pipes::connect): Use ProtectHandle in DLL code.
	(transport_layer_pipes::close): Use ForceCloseHandle in DLL code.

2002-07-13  Nicholas Wourms  <nwourms@netscape.com>

	* threaded_queue.h (class queue_submission_loop): Correct friend
	declaration for GCC 3.1.1.
	* include/cygwin/cygserver_process.h (class process): Ditto.
	(class process_cache): Ditto.

2002-07-12  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (server_shmmgr::shmdt): Only call
	delete_segment if the segment exists [sic].

2002-07-12  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* safe_memory.h: Include <new> rather than <new.h> for gcc 3.

2002-07-11  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* safe_memory.h: New file extracted from "woutsup.h".
	* woutsup.h: Move the "safe" new/delete macros into the new
	"safe_memory.h" header file and include that here.
	* cygserver_client.cc: Explicitly include "safe_memory.h" for
	client-side code.
	(client_request::make_request): Use the "safe" new/delete macros
	unconditionally, i.e. use them on the client side as well as on
	the server side.
	* cygserver_transport.cc: Explicitly include "safe_memory.h" for
	client-side code.
	(create_server_transport): Use the "safe" new/delete macros
	unconditionally, i.e. use them on the client side as well as on
	the server side.
	* shm.cc: Include "safe_memory.h".
	(client_shmmgr::instance): Use the "safe" new/delete macros.
	(client_shmmgr::shmdt): Ditto.
	(client_shmmgr::new_segment): Ditto.

2002-07-11  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_process (process::process): Add the client's cygpid
	and winpid to all tracing statements as appropriate.
	(process::exit_code): Ditto.
	(process_cache::check_and_remove_process): Ditto.
	* cygserver_shm.cc (server_shmmgr::shmat): Ditto.
	(server_shmmgr::shmdt): Ditto.
	(server_shmmgr::shmctl): Add a process object argument and remove
	the explicit cygpid argument.  Add the client's cygpid and winpid
	to all tracing statements as appropriate.
	(server_shmmgr::shmget): Ditto.
	(client_request_shm::serve): Update for the new signature of the
	shmctl and shmget methods.

2002-07-11  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (client_request_shutdown::serve): Don't set the
	shutdown flag directly, but send a SIGINT, as the signal handler
	sets the flag and the signal breaks the pause(2) in the main loop.
	(print_usage): Add new options.
	(main): Add new --cleanup-threads and --request-threads options to
	set the number of threads used by the daemon.  Use pause(2) rather
	the win32 Sleep in the main loop.
	* shm.cc (shmat): Add sigframe.
	(shmctl): Ditto.
	(shmdt): Ditto.
	(shmget): Ditto.

2002-07-11  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc: Automatically detach processes from any
	segments they are attached to at exit.
	(class server_shmmgr::attach_t): New class.
	(server_shmmgr::segment_t::IS_DELETED): Rename and make private.
	(server_shmmgr::segment_t::_sequence): Make private.
	(server_shmmgr::segment_t::_flg): Ditto.
	(server_shmmgr::segment_t::_hFileMap): Ditto.
	(server_shmmgr::segment_t::_attach_head): New private field.
	(server_shmmgr::segment_t::segment_t): Initialise new fields.
	Make non-inline.
	(server_shmmgr::segment_t::~segment_t): New method.
	(server_shmmgr::segment_t::is_deleted): Ditto.
	(server_shmmgr::segment_t::is_pending_delete): Ditto.
	(server_shmmgr::segment_t::mark_deleted): Ditto.
	(server_shmmgr::segment_t::attach): Ditto.
	(server_shmmgr::segment_t::detach): Ditto.
	(server_shmmgr::segment_t::find): Ditto.
	(class server_shmmgr::cleanup_t): New class.
	(server_shmmgr::_shm_atts): New private field.
	(server_shmmgr::shmat): Add a process object argument to replace
	the removed process_cache, cygpid and winpid arguments.  Remove
	the process_cache manipulations.  Move body of code to the
	segment_t::attach method.  Increment _shm_atts when required.
	Update tracing statements.
	(server_shmmgr::shmdt): Add a process object argument to replace
	the removed cygpid argument.  Move body of code to the
	segment_t::detach method.  Decrement _shm_atts when required.
	Update tracing statements.
	(server_shmmgr::shmget): Use the new segment_t::is_deleted method.
	(server_shmmgr::server_shmmgr): Initialise the new _shm_atts
	field.
	(server_shmmgr::delete_segment): Remove the CloseHandle code, as
	this is now done in the segment_t destructor.
	(client_request_shm::serve): Look up the client's process object
	and pass to the server_shmmgr::shmat and server_shmmgr::shmdt
	methods rather than passing the cache, winpid and cygpid.
	* cygserver_process.h: Add a cygpid to the process object to make
	it more useful and then pass process objects rather than winpids
	where possible.
	(cleanup_routine::cleanup): Change argument to be a pointer to a
	process object.
	(class process): Re-order fields for no discernible reason.
	(process::_cygpid): New field.
	(process::process): Add a cygpid argument.
	(process::winpid): New method.
	(process::cygpid): Ditto.
	(process::add): Make public, as it always should have been.
	(process_cache::process): Add a cygpid argument.
	* cygserver_process.cc (process::process): Add a cygpid argument
	and use it to initialise the `_cygpid' field.  Re-order
	initialisers to match new field order.
	(process::cleanup): Pass `this' rather than just the winpid to
	cleanup_routine::cleanup.
	(process_cache::process): Add a cygpid argument and pass it to the
	process object constructor.
	* include/sys/shm.h (shmatt_t): Make unsigned as per SUSv3.
	(shm_info::shm_atts): New field.

2002-07-11  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (class server_shmmgr::segment_t): Add `_'
	prefix to the names of all fields.

2002-07-10  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* msg.cc: New file of stub functions, no functionality.
	* sem.cc: Ditto.
	* shm.cc (client_shmmgr::shmctl): Add support for an out shm_info
	buffer for the SHM_INFO command.
	(client_shmmgr::shmget): Use %X to print keys.
	* include/sys/ipc.h: Comment all fields and values.
	(IPC_PRIVATE): Change to be non-negative.
	* include/sys/msg.h: New file with SUSv3 and ipcs(8) interfaces.
	* include/sys/sem.h: Ditto.
	* include/sys/shm.h: Comment all fields and values.
	(struct shm_info): New struct.
	* cygserver_shm.h (client_request_shm::shminfo): Rename.
	(client_request_shm::shm_info): New method.
	(client_request_shm::_parameters.out.hFileMap): Move into union.
	(client_request_shm::_parameters.out.shminfo): Rename.
	(client_request_shm::_parameters.out.shm_info): New field.
	* cygserver_shm.cc (server_shmmgr::_shm_ids): Rename.
	(server_shmmgr::_shm_tot): New field.
	(server_shmmgr::shmctl): Rename `out_shminfo' argument.  Add
	`out_shm_info' argument.  Fill in the `out_shm_info' argument in
	the SHM_INFO command.
	(server_shmmgr::shmget): Check `shmflg' against the mode of
	existing segments as per Stevens 1990, p. 123.
	(server_shmmgr::server_shmmgr): Initialise the new `_shm_tot'
	field.
	(server_shmmgr::new_segment): Set ENOMEM if CreateFileMapping
	fails.  Pass `size' to new_segment.
	(server_shmmgr::new_segment): Add size argument and use it to
	check against and update the new `_shm_tot' field.
	(server_shmmgr::delete_segment): Update the new `_shm_tot' field.
	* Makefile.in (DLL_OFILES): Add new DLL object files.

2002-07-09  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport_pipes.cc: The main change is to make the
	client try harder to connect to the server if it's previously
	connected, and so has good grounds for believing that the server
	is running.
	(MAX_WAIT_NAMED_PIPE_RETRY): Change to be an enumerator.
	(WAIT_NAMED_PIPE_TIMEOUT): Ditto.
	(transport_layer_pipes::accept): Use interlocked operators on
	`pipe_instance'.
	(transport_layer_pipes::close): Rearrange so that FlushFileBuffers
	and DisconnectNamedPipe are only called for accepted endpoints.
	Use interlocked operators on `pipe_instance'.
	(transport_layer_pipes::read): Use set_errno where required.
	(transport_layer_pipes::write): Ditto.
	(transport_layer_pipes::connect): Add local static variable
	`assume_cygserver'.  Set it if a connection is made to cygserver,
	clear it if a connection is not made even after retrying.  If set,
	ignore all errors from CreateFile and retry the connection.  Catch
	the situation where WaitNamedPipe fails to wait [sic] and add a
	`Sleep (0)' so that the server gets a chance to run.

2002-07-03  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* dcrt0.cc: Only check for cygserver if and when required.
	(dll_crt0_1): Remove call to `cygserver_init ()'.
	* fhandler_tty.cc (fhandler_tty_slave::open): Change the cygserver
	logic to allow for the fact that `cygserver_init ()' may not yet
	have been called.
	(fhandler_tty_slave::cygserver_attach_tty): Tweak the cygserver
	request logic to conform to the practice elsewhere in the code.
	* tty.cc (tty::common_init): Add an explicit call to
	`cygserver_init ()' if it hasn't already been called.
	* include/cygwin/cygserver.h (CYGSERVER_UNAVAIL): Rename from
	`CYGSERVER_DEAD'.
	(client_request_get_version::check_version): Make available in
	cygserver as well the DLL.
	(check_cygserver_available): Ditto.  Remove `check_version_too'
	argument.
	(cygserver_init): Ditto.  And likewise.
	* cygserver_client.cc (client_request_get_version::check_version):
	Make available in cygserver as well the DLL.
	(client_request::make_request): This may now be called without
	`cygserver_init ()' having been called first.  Detect this and
	call it as required.  Add tracing.
	(check_cygserver_available): Make available in cygserver as well
	the DLL.  Remove `check_version_too' argument and always check the
	version information.  And since this is called from within
	`cygserver_init ()', force `cygserver_running' before calling
	`client_request::make_request ()'.
	(cygserver_init): Make available in cygserver as well the DLL.
	Remove `check_version_too' argument.

2002-07-03  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc: Implement the ipcs(8) interfaces, IPC_INFO,
	SHM_STAT and SHM_INFO.
	(server_shmmgr::segment_t::sequence): New static field.
	(server_shmmgr::segment_t::key): Remove field, use the new
	ds.shm_perm.key field instead.
	(server_shmmgr::segment_t::shmid): Remove field.
	(server_shmmgr::segment_t::intid): New field.
	(server_shmmgr::segment_t::segment_t): Use the `key' argument to
	initialise `ds.shm_perm.key'.  Change from using `shmid' to
	`intid'.
	(server_shmmgr::_shmseg_cnt): Renamed from `_shmid_cnt'.
	(server_shmmgr::_intid_max): Renamed from `_shmid_max.
	(server_shmmgr::shmat): Move the out arguments to the start of the
	argument list.  Rename the `pid' argument as `cygpid'.  Add
	tracing.  Pass an intid to `find ()', not a shmid.
	(server_shmmgr::shmctl): Add separate out arguments.  Rename the
	`pid' argument as `cygpid'.  Add support for the ipcs(8)
	interfaces.  Add tracing.  Pass an intid to `find ()', not a
	shmid.
	(server_shmmgr::shmdt): Rename the `pid' argument as `cygpid'.
	Add tracing.  Pass an intid to `find ()', not a shmid.
	(server_shmmgr::shmget): Add a separate out arguments.  Rename the
	`pid' argument as `cygpid'.  Add tracing.
	(server_shmmgr::server_shmmgr): Update for new field names.
	(server_shmmgr::find_by_key): Update for the new `ds.shm_perm.key'
	field.
	(server_shmmgr::find): Update to use the new `segment_t::intid'
	field.
	(server_shmmgr::new_segment): Rename the `pid' argument as
	`cygpid'.  Check that the requested size is within bounds.  Handle
	new error result from `new_segment (key, HANDLE)'.
	(server_shmmgr::new_segment): Work with intids, not shmids.  Check
	that the new intid is within bounds.  Update for new field names.
	(server_shmmgr::delete_segment): Pass an intid to `find ()', not a
	shmid.  Update for new field names.
	(client_request_shm::serve): Check that the incoming message
	length is the size of the `_parameters.in' struct, not of the
	whole in/out parameter union.  Likewise, set the outgoing message
	length to the size of the `_parameters.out' struct.  Update for
	the new server_shmmgr interfaces.
	* include/sys/ipc.h (ipc_perm::key): New field.
	* include/sys/shm.h (SHM_INFO): New constant.
	* cygserver_ipc.h (IPCMNI): New constant.
	(ipc_int2ext): Add `sequence' argument and munge this into the
	external ipc id.
	(ipc_ext2int_subsys): Unmunge the sequence number from the
	external ipc id.
	(ipc_ext2int): Ditto.
	(ipc_inc_id): Remove.
	(ipc_dec_id): Remove.
	* cygserver_shm.h (SHMMAX): New constant.
	(SHMMIN): Ditto.
	(SHMMNI): Ditto.
	(SHMSEG): Ditto.
	(SHMALL): Ditto.
	(client_request_shm::_parameters): Re-arrange as a union of two
	separate structs, one for in arguments, the other for out.
	(client_request_shm::shmid): Update for the new parameter layout.
	(client_request_shm::ds): Ditto.
	(client_request_shm::info): New method.
	* shm.cc (client_shmmgr::_shmat_cnt): New static field.
	(client_shmmgr::shmat): Add locking.  Add tracing.
	(client_shmmgr::shmctl): Update for ipcs(8) commands.  Add
	tracing.  Add more argument checking.
	(client_shmmgr::shmdt): Add locking.  Add tracing.  Update the new
	`_shmat_cnt' field.
	(client_shmmgr::shmget): Add tracing.
	(client_shmmgr::fixup_shms_after_fork): Add tracing.  Add
	consistency checking.
	(client_shmmgr::attach): Add more tracing.
	(client_shmmgr::new_segment): Update the new `_shmat_cnt' field.
	(client_request_shm::client_request_shm): Update for the new
	parameter layout.  Set the outgoing message length to the size of
	the `_parameters.in' struct, not of the whole in/out parameter
	union.

2002-07-02  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* shm.cc: Remove the use of a static client_shmmgr object.
	(client_shmmgr::_instance): New static variable.
	(client_shmmgr::instance): Allocate a new shmmgr on the heap,
	rather than using a local static object.

2002-07-01  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport.cc (create_server_transport): Fix
	cut-and-paste error.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_client.cc (client_request::handle_request): Don't
	bother with the client request activity marker when compiled with
	debugging output.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport_pipes.cc
	(MAX_WAIT_NAMED_PIPE_RETRY): New constant.
	(WAIT_NAMED_PIPE_TIMEOUT): Ditto.
	(transport_layer_pipes::close): The `pipe' field is now either
	NULL or a valid handle, and it should never have the value
	`INVALID_HANDLE_VALUE'.
	(transport_layer_pipes::read): Ditto.
	(transport_layer_pipes::write): Ditto.
	(transport_layer_pipes::connect): Ditto.
	(transport_layer_pipes::impersonate_client): Ditto.
	(transport_layer_pipes::connect): Ditto.  New, but still bogus,
	retry logic.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (server_shmmgr::server_shmmgr): All fields have
	to be initialized now that the singleton is no longer static.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc (server_shmmgr::_instance): New static field.
	(server_shmmgr::_instance_once): Ditto.
	(server_shmmgr::initialise_instance): New static method.
	(server_shmmgr::instance): Use a pthread_once_t rather than
	relying on a local static variable.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* woutsup.h: Remove all uses of the C++ new and delete operators
	throughout cygserver until they are fully thread-safe.
	(safe_new0): New macro to replace the C++ new operator.
	(safe_new): Ditto.
	(safe_delete): New macro to replace the C++ delete operator.
	* cygserver_client.cc (client_request::handle_request): Replace
	all uses of the C++ new and delete operators with the new macros
	from "woutsup.h".
	(client_request::make_request): Ditto.
	* cygserver_process.cc (~process_cleanup): Ditto.
	(process::cleanup): Ditto.
	(process_cache::process): Ditto.
	(process_cache::check_and_remove_process): Ditto.
	* cygserver_shm.cc (server_shmmgr::new_segment): Ditto.
	(server_shmmgr::delete_segment): Ditto.
	* cygserver_transport.cc (create_server_transport): Ditto.
	* cygserver_transport_pipes.cc
	(transport_layer_pipes::accept): Ditto.
	* cygserver_transport_sockets.cc
	(transport_layer_sockets::accept): Ditto.
	* threaded_queue.cc (~threaded_queue): Ditto.
	(threaded_queue::worker_loop): Ditto.
	(threaded_queue::stop): Replace sleep(3) with win32 Sleep.
	* cygserver.cc (~server_request): Replace all uses of the C++ new
	and delete operators with the new macros from "woutsup.h".
	(server_submission_loop::request_loop): Ditto.
	(main): Ditto.  Replace sleep(3) with win32 Sleep.  Replace
	iostreams with FILEs.
	(print_usage): Replace iostreams with FILEs.
	(print_version): Ditto.

2002-06-30  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_transport_sockets.cc
	(transport_layer_sockets::accept): Rename local variable
	`accept_fd' to avoid shadowing the `fd' field.

2002-06-29  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygwin_ipc.h: Moved (back) to "include/sys/ipc.h".
	* cygwin_shm.h: Moved (back) to "include/sys/shm.h".
	* include/sys/ipc.h: New file.
	* include/sys/shm.h: New file.
	* cygserver_shm.h: Update for new header file locations.
	* ipc.cc: Ditto.

2002-06-28  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_client.cc (client_request::make_request): Comment out
	a verbose tracing statement.
	* cygserver_process.cc (process_cache::sync_wait_array): Fix
	broken assert.
	* include/cygwin/cygserver.h (class client_request): Remove excess
	use of `class' qualifier in declarations.
	(class client_request_get_version): Ditto.
	(class client_request_shutdown): Ditto.
	(class client_request_attach_tty): Ditto.

2002-06-28  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_ipc.h: New file.
	* cygserver_shm.h: Re-written from scratch.
	* cygserver_shm.cc: Ditto.
	* shm.cc: Ditto.

2002-06-28  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* threaded_queue.h (class queue_request): Re-write.
	(threaded_queue_thread_function): Remove.
	(class queue_process_param): Remove.
	(class threaded_queue): Re-write.
	(class queue_submission_loop): New version of the old
	`queue_process_param' class.
	(TInterlockedExchangePointer): New templated function.
	(TInterlockedCompareExchangePointer): Ditto.
	* threaded_queue.cc (worker_function): Remove.
	(class threaded_queue): Re-write.
	(class queue_process_param): Remove.
	(class queue_submission_loop): New version of the old
	`queue_process_param' class.
	* include/cygwin/cygserver_process.h (process_cleanup): Re-write.
	(class process_process_param): Remove.
	(class cleanup_routine): Re-write.
	(class process): Re-write.
	(class process_cache): Re-write.
	* cygserver_process.cc (process_cleanup): Re-write.
	(class process_process_param): Remove.
	(class cleanup_routine): Re-write.
	(class process): Re-write.
	(class process_cache): Re-write.
	* cygserver.cc (request_count): Remove unused variable.
	(class server_request): Move methods inline.
	(class server_process_param): Remove.
	(class server_request_queue): Remove.
	(request_queue): Move into `main ()' and change type to
	`threaded_queue'.
	(request_loop): Remove.
	(class server_submission_loop): New version of the old
	`server_process_param' class.
	(shutdown_server): New variable.
	(client_request_shutdown::serve): Set `shutdown_server' to trigger
	shutdown.
	(handle_signal): Ditto.
	(main): Install signal handler for SIGINT rather than SIGQUIT.
	Use new interfaces for the `request_queue' and the `cache'.
	Create a `server_submission_loop' and add to the `request_queue'.
	Add check for the `shutdown_server' variable to the main loop.
	* cygserver_shm.cc (client_request_shm::serve): Release the
	process object after use.

2002-06-27  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_client.cc (client_request::handle_request): Correct
	tracing statement.
	* cygserver_transport_pipes.cc: Remove local definition of
	FILE_FLAG_FIRST_PIPE_INSTANCE constant.
	* cygwin_ipc.h: Update copyright notice.
	* cygwin_shm.h: Ditto.
	* woutsup.h: Add definition of _WIN32_WINNT.

2002-06-24  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_client (client_request::make_request): Replace my
	inappropriate use of set_errno () with error_code () throughout.

2002-06-24  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver.h: Add forward declarations of class
	transport_layer_base and class process_cache to reduce
	dependencies between header files.
	* include/cygwin/cygserver_process.h: Add include of
	"threaded_queue.h".
	* cygserver.cc: Remove unnecessary cygserver header files.
	* cygserver_client.cc: Ditto.
	* cygserver_process.cc: Ditto.
	* cygserver_shm.cc: Ditto.
	* cygserver_shm.h: Ditto.
	* cygserver_transport_pipes.cc: Ditto.
	* dcrt0.cc: Ditto.
	* fhandler_tty.cc: Ditto.
	* tty.cc: Ditto.

2002-06-24  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.h: Replace <sys/shm.h> with "cygwin_shm.h" after
	merge from HEAD.
	* cygwin_ipc.h: Update with changes to include/sys/ipc.h lost in
	merge from HEAD.
	* cygwin_shm.h: Ditto.

2002-06-21  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc: The tests for a duplicate server instance are now
	the responsibility of the transport layer.
	(request_loop): Use new `recoverable' flag in call to
	`cygserver_transport::accept ()' and shutdown on an unrecoverable
	error.
	(main): Never call `cygserver_init ()'.  Fake `cygserver_running'
	just for sending a shutdown request.
	* cygserver_client.cc (client_request::send): Comment out
	message-size tracing statements as verbose.
	(client_request::handle): Ditto.
	(client_request_get_version::check_version): #ifdef as DLL-only.
	(check_cygserver_available): Ditto.
	(cygserver_init): Ditto.
	* include/cygwin/cygserver.h
	(client_request_get_version::check_version): #ifdef as DLL-only.
	(check_cygserver_available): Ditto.
	(cygserver_init): Ditto.
	* include/cygwin/cygserver_transport.h
	(transport_layer_base::impersonate_client): #ifdef as
	cygserver-only.
	(transport_layer_base::revert_to_self): Ditto.
	(transport_layer_base::listen): Ditto.
	(transport_layer_base::accept): Ditto.  Add a `recoverable' out
	flag for error handling.
	* include/cygwin/cygserver_transport_sockets.h: Ditto.
	* include/cygwin/cygserver_transport_pipes.h: Ditto.
	(transport_layer_pipes): Change type of the `pipe_name' field.
	Remove the `inited' field, as unnecessary.  Add new
	`is_accepted_endpoint' field.
	* include/cygwin/cygserver_transport.cc
	(transport_layer_base::impersonate_client): #ifdef as
	cygserver-only.
	(transport_layer_base::revert_to_self): Ditto.
	* include/cygwin/cygserver_transport_sockets.cc
	(transport_layer_sockets::listen): #ifdef as cygserver-only.
	(transport_layer_sockets::accept): #ifdef as cygserver-only.
	Analyse any errno from `accept ()' and set `recoverable' as
	appropriate.
	* cygserver_transport_pipes.cc: Add local #define of
	`FILE_FLAG_FIRST_PIPE_INSTANCE'.
	(pipe_instance_lock_once): New variable.
	(pipe_instance_lock): Ditto.
	(pipe_instance): Ditto.
	(initialise_pipe_instance_lock): New function.
	(transport_layer_pipes::transport_layer_pipes): Change
	initialization of `pipe_name'.  Initialize `is_accepted_endpoint'
	as appropriate.  Remove use of `inited'.
	(transport_layer_pipes::impersonate_client): #ifdef as
	cygserver-only.
	(transport_layer_pipes::revert_to_self): Ditto.
	(transport_layer_pipes::listen): Ditto.
	(transport_layer_pipes::accept): Ditto.  Keep track of how often
	many named pipes have been created, in the `pipe_instance'
	variable, and pass the `FILE_FLAG_FIRST_PIPE_INSTANCE' flag on the
	open of the first instance.  Analyse the error code from
	`CreateNamedPipe ()' and set the `recoverable' flag as
	appropriate.
	(transport_layer_pipes::close): Update the `pipe_instance' count.

2002-06-18  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* woutsup.h (cygserver_running): Add declaration.
	(api_fatal): Eliminate.
	* include/cygwin/cygserver.h
	(client_request_get_version::check_version): Change return type to
	bool.
	(check_cygserver_available): New function.
	(cygserver_init): Add check_version_too argument.
	* cygserver_client.cc (allow_daemon): Make a bool.
	(client_request_get_version::make_request): See errno on error.
	Remove special case for CYGSERVER_REQUEST_GET_VERSION; this is now
	handled in cygserver_init().
	(client_request_get_version::check_version): Use syscall_printf()
	instead of api_fatal(). Return true if cygserver version is
	compatible.
	(check_cygserver_available): New function; code moved here from
	cygserver_init().
	(cygserver_init): Move some code into check_cygserver_available().
	* cygserver.cc (__set_errno): Copy from debug.cc so that
	set_errno() can be used when __OUTSIDE_CYGWIN__.
	(main): Call cygserver_init() to set up cygserver_running and add
	checks against this to (try and) prevent multiple copies of
	cygserver running simultaneously.  Remember to delete all
	transport connections so that (one day) the transport classes can
	tidy up on cygserver shutdown.

2002-06-17  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (main): Adjust tracing output for a cleaner display
	when compiled without --enable-debugging.
	* threaded_queue.cc (threaded_queue::cleanup): Ditto.
	(queue_process_param::stop): Ditto.
	* include/cygwin/cygserver.h
	(client_request::make_request): Make non-virtual.
	(client_request::send): Make virtual and protected, not private.
	(client_request_attach_tty::send): New virtual method.
	* cygserver_client.cc: Use the `msglen()' accessor rather than
	`_header.msglen' throughout.
	(client_request_attach_tty::send): New method.
	(client_request::make_request): Remove the explicit close of
	`transport' as it is closed on deletion.

2002-06-17  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver.h: Change the client_request classes to
	give greater encapsulation and to allow variable length requests
	and replies.
	(enum cygserver_request_code): Now client_request::request_code_t.
	(class request_header): Now client_request::header_t.  Make a
	union of the request_code and the error_code.  The `cb' field,
	which was the buffer length, is now the `size_t msglen' field.
	(struct request_get_version): Now
	client_request_get_version::request_get_version.
	(struct request_shutdown): Remove unused type.
	(struct request_attach_tty): Now
	client_request_attach_tty::request_attach_tty.
	(client_request::_buf): Make field const.
	(client_request::_buflen): New const private field.
	(client_request::request_code): New accessor.
	(client_request::error_code): Ditto.
	(client_request::msglen): Ditto.
	(client_request::handle_request): New static method.
	(client_request::make_request): New virtual method.
	(client_request::handle): New method.
	(client_request::send): Make private.
	(client_request_get_version::check_version): New method.
	(client_request_get_version::serve): Make private.
	(client_request_get_version::version): Ditto.
	(client_request_shutdown::serve): Ditto.
	(client_request_attach_tty::req): Ditto.
	(client_request_attach_tty::serve): Ditto.
	(client_request_attach_tty::from_master): Make method const.
	(client_request_attach_tty::from_master): Ditto.
	* cygserver_client.cc
	(client_request_get_version::client_request_get_version): Track
	changes to the client_request classes.
	(client_request_attach_tty::client_request_attach_tty): Ditto.
	(client_request_get_version::check_version): New method to
	encapsulate code from cygserver_init().
	(client_request_shutdown::client_request_shutdown): Move into
	"cygserver.cc".
	(client_request::send): Track changes to the client_request
	classes.  Add more error checking.
	(client_request::handle_request): New static method containing the
	first half of the old server_request::process() code.
	(client_request::make_request): New method to replace the old
	cygserver_request() function.
	(client_request::handle): New method containing the second half of
	the old server_request::process() code.
	(cygserver_init): Track changes to the client_request classes.  In
	particular, some code moved into the
	client_request_get_version::check_version() method.
	* cygserver.cc (client_request_attach_tty::serve): Track changes
	to the client_request classes.  In particular, only return a reply
	body if some handles are successfully duplicated for the client.
	And remove goto's.
	(client_request_get_version::serve): Track changes to the
	client_request classes.
	(client_request_shutdown::serve): Ditto.
	(class client_request_invalid): Dead, and so young too.
	(server_request::request_buffer): Remove unnecessary field.
	(client_request_shutdown::client_request_shutdown): Moved here
	from "cygserver_client.cc".
	(server_request::process): Implementation moved into the new
	client_request::handle_request() and client_request::handle()
	methods.
	* cygserver_shm.h (class client_request_shm): Put client- and
	server-specific interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__
	guards.
	(client_request_shm::serve): Make private.
	* cygserver_shm.cc
	(client_request_shm::client_request_shm): Track changes to the
	client_request classes.
	(client_request_shm::serve): Ditto
	* shm.cc (client_request_shm::client_request_shm): Ditto.  Use
	alloc_sd() rather than set_security_attribute() to get access to
	the SECURITY_DESCRIPTOR length, so that we can use it to set the
	request body length.
	(shmat): Track changes to the client_request classes. In
	particular, allocate client_request objects on the stack rather
	than on the heap, and use the client_request::make_request()
	method rather than the old cygserver_request() function.
	(shmdt): Ditto.
	(shmctl): Ditto.
	(shmget): Ditto.
	* fhandler_tty.cc (fhandler_tty_slave::cygserver_attach_tty): Ditto.

2002-06-17  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver_transport.h
	(cygserver_transport::read): Change buffer type to void *.
	(cygserver_transport::write): Ditto.
	* include/cygwin/cygserver_transport_sockets.h
	(cygserver_transport_sockets::read): Ditto.
	(cygserver_transport_sockets::write): Ditto.
	* include/cygwin/cygserver_transport_pipes.h
	(cygserver_transport_pipes::read): Ditto.
	(cygserver_transport_pipes::write): Ditto.
	* cygserver_transport_sockets.cc
	(cygserver_transport_sockets::read): Ditto.
	(cygserver_transport_sockets::write): Ditto.
	* cygserver_transport_pipes.cc
	(cygserver_transport_pipes::read): Ditto. Set errno on error, to
	match behaviour of cygserver_transport_sockets class.
	(cygserver_transport_pipes::write): Ditto.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (version): New static variable.
	(server_request_queue::add_connection): Remove my gratuitous use
	of studly caps.
	(setup_privileges): Declare static.
	(handle_signal): Ditto.
	(longopts): Make a local variable of main().
	(opts): Ditto.
	(print_usage): New function.
	(print_version): Ditto (tip of the hat to Joshua Daniel Franklin
	for inspiration here).
	(main): More argument checking.  Add --help and --version options.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver.h (client_request::serve): Make pure
	virtual.
	* cygserver.cc (client_request::serve): Remove definition of pure
	virtual method.
	(class client_request_invalid): New class.
	(server_request::process): Use new client_request_invalid
	class. And remove goto's.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (class server_request): Add virtual destructor.
	(server_request_queue::addConnection): New method to replace bad
	virtual add() method.
	(request_loop): Replace call to queue->add() with call to
	queue->addConnection().
	(server_request::server_request): Use field initialization.
	(server_request::~server_request): New virtual destructor.
	(server_request::process): Remove close and delete of
	transport_layer_base object. It is deleted by the server_request's
	own destructor and closed by its own destructor.
	* include/cygwin/cygserver.h
	(client_request::operator request_header): Remove unused method.
	* cygserver_client.cc: Ditto.
	* include/cygwin/cygserver_process.h
	(class cleanup_routine): Add virtual destructor.
	(cleanup_routine::cleanup): Make pure virtual.
	(class process_cache): Make destructor non-virtual.
	(process_cache::add): Ditto.
	* cygserver_process.cc
	(cleanup_routine::~cleanup_routine): New virtual destructor.
	* include/cygwin/cygserver_transport.h
	(class transport_layer_base): Add virtual destructor.
	* cygserver_transport.cc
	(transport_layer_base::~transport_layer_base): New virtual
	destructor.
	* include/cygwin/cygserver_transport_pipes.h
	(class transport_layer_pipes): Add virtual destructor.
	* cygserver_transport_pipes.cc
	(transport_layer_pipes::~transport_layer_pipes): New virtual
	destructor.
	(transport_layer_pipes::close): Null out handle after closing.
	* include/cygwin/cygserver_transport_sockets.h
	(class transport_layer_sockets): Add virtual destructor.
	* cygserver_transport_sockets.cc
	(transport_layer_sockets::~transport_layer_sockets): New virtual
	destructor.
	(transport_layer_sockets::close): Null out fd after closing.
	* threaded_queue.h (class queue_request): Add virtual destructor.
	(queue_request::process): Make pure virtual.
	* threaded_queue.cc (~queue_request): New virtual destructor.
	(queue_request::process): Remove definition of pure virtual
	method.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver.h (client_request::send): Make
	non-virtual.
	(class client_request_attach_tty): Put client- and server-specific
	interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__ guards.
	* cygserver_client.cc: Ditto.
	(cygserver_init): Fix error handling.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc: Throughout the code, check and correct level of
	the XXX_printf() functions used. Comment out several of the
	debug_printf() calls with "// verbose:".  Reformat and correct
	typos of some of the XXX_printf() formats.
	* cygserver_process.cc: Ditto.
	* cygserver_shm.cc: Ditto.
	* cygserver_transport_pipes.cc: Ditto.
	* cygserver_transport_sockets.cc: Ditto.
	* shm.cc (hi_ulong): New function to allow printing of a 64-bit
	key with current small_printf implementation.
	(lo_ulong): Ditto.
	(client_request_shm::client_request_shm): Use hi_ulong() and
	lo_ulong() in call to debug_printf().

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver_shm.cc: Remove #define __INSIDE_CYGWIN__ from around
	<sys/shm.h> as it no longer contains any internal code.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/sys/ipc.h (IPC_PRIVATE): Add cast to key_t.
	(IPC_INFO): New flag for ipcs(8).
	(IPC_RMID IPC_SET IPC_STAT): Renumber.
	* include/sys/shm.h (SHM_RDONLY SHM_RND): Renumber with distinct
	values [sic].
	(class _shmattach): Internal type moved to "cygserver_shm.h".
	(class shmnode): Ditto.
	(class shmid_ds): Ditto.
	(struct shmid_ds): Add spare fields.
	(struct shminfo): New type for IPC_INFO interface.
	* cygserver_shm.h: Remove obsolete #if 0 ... #endif block.
	(class shm_cleanup): Remove unused class.
	(struct _shmattach): Internal type moved from <sys/shm.h>.
	(struct shmnode): Ditto.
	(struct int_shmid_ds): Ditto. Renamed to avoid name clash with
	public interface struct shmid_ds. Use the shmid_bs structure as a
	field.
	* cygserver_shm.cc: Remove obsolete #if 0 ... #endif block.
	(client_request_shm::serve): Update for redefinition of
	int_shmid_ds structure.
	* shm.cc (build_inprocess_shmds): Ditto.
	(fixup_shms_after_fork): Ditto.
	(shmctl): Ditto.
	(shmget): Ditto. Remove obsolete #if 0 ... #endif code.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* include/cygwin/cygserver_transport.h
	(transport_layer_base::transport_layer_base): Remove since it is
	now redundant.
	(transport_layer_base::listen): Make a pure virtual method.
	(transport_layer_base::accept): Ditto.
	(transport_layer_base::close): Ditto.
	(transport_layer_base::read): Ditto.
	(transport_layer_base::write): Ditto.
	(transport_layer_base::connect): Ditto.
	* cygserver_transport.cc
	(transport_layer_base::transport_layer_base): Remove since it is
	now redundant.
	(transport_layer_base::listen): Remove since it is now a pure
	virtual method.
	(transport_layer_base::accept): Ditto.
	(transport_layer_base::close): Ditto.
	(transport_layer_base::read): Ditto.
	(transport_layer_base::write): Ditto.
	(transport_layer_base::connect): Ditto.

2002-06-16  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* cygserver.cc (check_and_dup_handle): Only use security code if
	running on NT, i.e. if wincap.has_security().
	(client_request_attach_tty::serve): Add check for has_security().
	* cygserver_process.cc (process_cache::process): Use DWORD winpid
	throughout to avoid win32 vs. cygwin pid confusion.
	(process::process): Ditto.
	* cygserver_shm.cc (client_request_shm::serve): Only use security
	code if running on NT, i.e. if wincap.has_security().
	* cygserver_shm.h (client_request_shm::parameters.in): Replace the
	ambiguous pid field with cygpid and winpid fields.
	(client_request_shm::client_request_shm): Reduce to only two
	client-side constructors: one for SHM_CREATE, another for all the
	other requests.
	* shm.cc (client_request_shm::client_request_shm):
	Ditto. Initialize cygpid and winpid fields here. On NT initialize
	sd_buf here using set_security_attribute() to make use of the euid
	and egid.
	(shmat): Use new client_request_shm constructor.
	(shmdt): Ditto.
	(shmctl): Ditto.
	(shmget): Ditto. Remove security code, now performed in the
	relevant client_request_shm constructor.
	* include/cygwin/cygserver_process.h: (class cleanup_routine):
	Change winpid type to DWORD.
	(class process): Ditto.

2002-06-15  Conrad Scott  <conrad.scott@dsl.pipex.com>

	* woutsup.h: New file.
	* cygserver.cc: Use "woutsup.h" and new XXX_printf macros.
	(getfunc): New function, copied verbatim from "strace.cc".
	(__cygserver__printf): New function.
	* cygserver_client.cc: Use "woutsup.h" and new XXX_printf macros.
	* cygserver_process.cc: Ditto.
	* cygserver_shm.cc: Ditto.
	* cygserver_transport.cc: Ditto.
	* cygserver_transport_pipes.cc: Ditto.
	* cygserver_transport_sockets.cc: Ditto.
	* threaded_queue.cc: Ditto.
	* shm.cc: Remove trailing \n from XXX_printf format strings.
	* Makefile.in: Remove special __OUTSIDE_CYGWIN__ case for
	cygserver_shm.cc.
2002-09-22 12:04:15 +00:00
Christopher Faylor a5cc51fa3c * init.cc (dll_entry): Temporarily disable thread detach code. 2002-09-22 03:39:48 +00:00
Christopher Faylor c90e1cf179 * fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller has
already taken care of that.
* fhandler_console.cc (fhandler_console::open): Initialize handles to NULL.
(fhandler_console::close): Ditto.  GNUify non-GNU formatted functions calls
throughout.
2002-09-22 03:38:57 +00:00
Christopher Faylor 228f6b6e07 whitespace 2002-09-22 00:46:24 +00:00
Conrad Scott 9fc5ba9656 * cygwin_ipc.h: Move to "include/cygwin/ipc.h".
* cygwin_shm.h: Move to "include/cygwin/shm.h".
	* include/cygwin/ipc.h: New file.
	* include/cygwin/shm.h: New file.
	* ipc.c:c Update <cygwin/ipc.h> include.
	* cygserver_shm.cc: Update <cygwin/shm.h> include.
	* shm.cc: Ditto.
2002-09-21 13:03:24 +00:00
Robert Collins 01f58e415c 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* pthread.cc: Use class::call for converted pthread and semaphore
        calls.
        * thread.cc: Convert various __pthread_call and __sem_call to
        pthread::call and sem::call throughout.
        * pthread.h (__pthread_cancel): Convert to pthread::cancel.
        (__pthread_join): Convert to pthread::join.
        (__pthread_detach): Convert to pthread::detach.
        (__pthread_create): Convert to pthread::create.
        (__pthread_once): Convert to pthread::once.
        (__pthread_atfork): Convert to pthread::atfork.
        (__pthread_suspend): Convert to pthread::suspend.
        (__pthread_continue): Convert to pthread::resume.
        (__sem_init): Convert to semaphore::init.
        (__sem_destroy): Convert to semaphore::destroy.
        (__sem_wait): Convert to semaphore::wait.
        (__sem_trywait): Convert to semaphore::trywait.
        (__sem_post): Convert to semaphore::post.
2002-09-21 03:59:58 +00:00
Robert Collins af428c1ef4 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
* thread.cc: Finish the removal of the separate pthread_key
        destructor list.
        Remove all pthread_key_destructor and pthread_key_destructor_list
        references throughout.
        (pthread::exit): Call the new pthread_key interface to activate
        destructors.
        (pthread_key::keys): Change into a list.
        (pthread_key::saveAKey): New method, used via forEach.
        (pthread_key::restoreAKey): Ditto.
        (pthread_key::destroyAKey): Ditto.
        (pthread_key::fixup_before_fork): Use the List::forEach functionality.
        (pthread_key::fixup_after_fork): Ditto.
        (pthread_key::runAllDestructors): New method implementation.
        (pthread_key::pthread_key): Use List::Insert rather than custom list
        code.
        (pthread_key::~pthread_key): Use List::Remove for the same reason.
        * thread.h: Remove all pthread_key_destructor and
        pthread_key_destructor_list references throughout.
        (List): Move the interface above pthread_key in the header.
        Use atomic operations during insert and delete.
        (List::forEach): A generic interface for doing something on each node.
        (pthread_key::runAllDestructors): New method, run all destructors.
        (pthread_key::fork_buf): Make private.
        (pthread_key::run_destructor): Ditto.
        (pthread_key::saveAKey): New method for clearer source.
        (pthread_key::restoreAKey): Ditto.
        (pthread_key::destroyAKey): Ditto.
        (MTinterface::destructors): Remove.
2002-09-21 03:20:27 +00:00
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
Danny Smith 76f28487ee * mingwex/math/files.txt: Remove inadvertantly added file. 2002-09-19 23:05:27 +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
Danny Smith 776044d554 * include/string.h (_strerror): Move into #ifndef
__STRICT_ANSI__ block.
2002-09-19 05:35:30 +00:00
Christopher Faylor 468b26c591 * cygcheck.cc: Include sys/time.h rather than time.h to avoid a compiler error. 2002-09-19 03:48:19 +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
Danny Smith 57dfd574a7 2002-09-18 Eric R. Krause <ekrause_98@users.sourceforge.net>
* include/winuser.h (DS_SHELLFONT): Define.
2002-09-19 00:01:18 +00:00
Danny Smith 41cb3243c5 * include/time.h (__need_NULL): Define before including
stddef.h.  Thanks to: R�diger Dehmel  <de@lmnet.de>.
2002-09-17 21:36:02 +00:00
Danny Smith e58d89280b 2002-09-17 Daniel Schlyder <daniel@dascdev.net>
* include/winnt.h (VER_SUITE_BLADE): Define.
2002-09-17 21:21:48 +00:00
Christopher Faylor 4ddb62e794 * cygcheck.cc: Reorder includes to avoid compiler error. 2002-09-17 17:13:21 +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
Danny Smith cbb704cf60 * include/shlobj.h (SHGetSpecialFolderPath[AW]): Add _WIN32_IE guard.
Correct prototype for wide version.
	(SHGetFolderPath): Add comment on shfolder.dll library.
	(SHGetFolderLocation): Add prototyope for WinME and W2K.
	(SHGetFolderPathAndSubDir[AW]): Add prototypes for XP.
2002-09-17 03:08:11 +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
Danny Smith 0812076923 * lib/shell32.def (SHGetFolderPath[AW]): Add comment.
* lib/shfolder.def: New file.
2002-09-16 10:28:16 +00:00
Danny Smith fbf3d133ce 2002-09-16 Ranjit Matthew <rmathew@hotmail.com>
* include/stdio.h: Correct comment about directory separator.
2002-09-16 09:44:06 +00:00
Joshua Daniel Franklin 98467dae59 Add final newlines to utils 2002-09-15 19:24:37 +00:00
Joshua Daniel Franklin 9b566b9695 2002-09-12 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* cygpath.cc (options) New global variable.
	(main) Make short options global for easier change.
	(print_version) Add a missing newline.
2002-09-15 15:19:49 +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
Danny Smith 139b31f7ac * include/sys/time.h (timeval): Add struct definition and
associated macros (copied from w32api/include/winsock.h).
2002-09-12 10:34:54 +00:00
Danny Smith 3f7b89caf1 * include/winsock.h (timeval): Guard struct and associated
macros with _TIMEVAL_DEFINED.
	* include/winsock2.h (timeval): Likewise.
2002-09-12 10:11:05 +00:00