Commit Graph

3948 Commits

Author SHA1 Message Date
Danny Smith 4f28a0f0fe 2004-01-01 Mattia Barbon <mbarbon@users.sourceforge.net>
* include/commctrl.h (TVN_GETINFOTIP): Add UNICODE mappings.
	(NMTVGETINFOTIP): Add structure.
2004-01-01 10:16:13 +00:00
Christopher Faylor a7d42fef9f * cygwin.din: Make crt0 functions NOSIGFE.
* include/cygwin/version.h: Gratuitous comment change.
* lib/_cygwin_crt0_common.cc: Remove unneeded declaration.
2003-12-31 06:30:48 +00:00
Christopher Faylor f7cb207b69 * cygtls.h (_threadinfo::stack): Increase stack size to accommodate nested
signal handlers.  Reorganize to cause potential SEGV on stack overflow.
* sigproc.cc (no_signals_available): Check sendsig value rather than relying on
obsolete sig_loop_wait.
(sigproc_terminate): Ditto.
(proc_can_be_signalled): Check sendsig value even for myself.
* tlsoffsets.h: Regenerate.
2003-12-30 03:59:45 +00:00
Christopher Faylor 8ed5c9b629 Move open_fhs from fhandler.h to cygheap.h for easier tracking. Accommodate
this change throughout.
* dtable.cc (dtable::add_archetype): Use correct count when iterating through
*active* archetypes.
* dtable.cc (dtable::fixup_after_exec): Close handle if close_on_exec and
archetype exists since archetype currently does not set windows close-on-exec
flag (FIXME).
* fhandler_tty.cc (fhandler_tty_slave::open): Change debugging output slightly.
(fhandler_tty_slave::close): Ditto.
(fhandler_tty_slave::fixup_after_fork): Just report on inherited use counts
since since archetype currently does not set windows close-on-exec flag
(FIXME).
* pinfo.cc (_pinfo::set_ctty): Change debugging output slightly.
* cygheap.cc (cygheap_init): Remove open_fhs accommodation and use count
reporting.
* perthread.h (vfork_save::fhctty): New element.
* perthread.h (vfork_save::open_fhs): New element.
* fork.cc (vfork): Muck around with ctty and open_fhs stuff, both of which are
now saved in the vfork_save structure.
2003-12-30 01:57:16 +00:00
Christopher Faylor e97377932b * fhandler.h (fhandler_tty_slave::archetype): Make public.
(report_tty_counts): New macro.  Use throughout for reporting tty use counts.
* dtable.cc (dtable::vfork_child_dup): Add debugging output for usecount
increment.  Increment open_fhs if appropriate.
(dtable::vfork_parent_restore): "Close" artificially bumped ctty.
(dtable::vfork_child_fixup): Close ctty since it was bumped prior to vfork.
Save open_fhs around close since the closing of these handles has no effect on
the console.
* fhandler_tty.cc (fhandler_tty_slave::open): Reorganize calls to allow for
easier tracking of usecount modification.
(fhandler_tty_slave::open): Ditto.
2003-12-27 17:41:17 +00:00
Christopher Faylor fe861ce934 * syscalls.cc (close_all_files): Simplify logic around closing ctty. 2003-12-27 02:41:07 +00:00
Christopher Faylor e35f197f34 * pinfo.cc (_pinfo::set_ctty): *Always* call close on opened ctty since it
counts as an opened handle.
2003-12-27 02:20:07 +00:00
Christopher Faylor 1df3fbe2db * fhandler.h (fhandler_tty_master::fixup_after_fork): Remove declaration.
(fhandler_tty_master::fixup_after_exec): Ditto.
* fhandler_tty.cc (fhandler_tty_master::init): Fix so that children do not
inherit master tty handles.
(fhandler_tty_master::fixup_after_fork): Remove, since it was never used.
(fhandler_tty_master::fixup_after_exec): Ditto.
* pinfo.cc (_pinfo::set_ctty): Increment open_fhs when ctty is set.
* cygheap.cc (cygheap_init): Ditto.
* syscalls.cc (setsid): *Always* call close on opened ctty since the archetype
is associated with the ctty and it counts as an opened handle.
* tty.cc (tty::common_init): Don't protect input/output mutex since it confuses
subsequent fork/execs when CYGWIN=tty.
2003-12-27 01:59:29 +00:00
Christopher Faylor 56b5feb639 * exceptions.cc (try_to_debug): Fix off-by-one problem when resetting
environment variable after error_start detected.
* fhandler_tty_slave.cc (fhandler_tty_slave::close): Clarify debug message.
* syscalls.cc (setsid): Don't increment usecount here, since it will be
automatically decremented on close.
2003-12-27 00:25:02 +00:00
Christopher Faylor 6dc18ca4d3 * exceptions.cc (setup_handler): Protect against a race. 2003-12-26 18:30:41 +00:00
Christopher Faylor 39add36fc3 * path.cc (mount_item::build_win32): Backslashify paths in non-managed case. 2003-12-26 18:26:17 +00:00
Christopher Faylor 91301b852f * Makefile.in (CFLAGS, CXXFLAGS): Remove unneeded include.
(CYGWIN_LIB): Delete.
(cygserver.exe target): Add -L$(cygwin_build) to the link line to force linker
to use build tree version of the library.  Remove specific inclusion of
libcygwin.a from the link line.
2003-12-26 05:37:54 +00:00
Christopher Faylor 76832a5b32 * dcrt0.cc (reent_data): Reluctantly resurrect.
(__cygwin_user_data::impure_ptr): Ditto.
(_dll_crt0): Reluctantly initialize _impure_ptr here.
(initialize_main_tls): Eliminate local_clib initialization since it now happens
in init_thread.
* init.cc (dll_entry): Reluctantly remove code which set _impure_ptr to the
main thread's local_clib.
* perthread.h (reent_data): Remove obsolete declaration.
* sigproc.cc (proc_subproc): Add more debugging output.
(get_proc_lock): Ditto.
*dcrt0.cc (dll_crt0_1): Allocate argv[0] via malloc since main thread could
exit.
2003-12-26 04:40:52 +00:00
Christopher Faylor 1f32b7b382 * winsup.api/pthread/rwlock7.c (main): Don't assume that result of rand
operation is non-zero.
2003-12-24 04:37:19 +00:00
Christopher Faylor 05b2a10ba4 * fork.cc (fork_child): After a pthread/fork, ensure that impure pointer stuff
which resides in parent is propagated to child thread.
2003-12-23 22:24:38 +00:00
Christopher Faylor 281e419402 add missing file 2003-12-23 16:43:45 +00:00
Christopher Faylor 29d52c8a27 * exceptions.cc (set_signal_mask): Redefine to not pass by address. Report
calculated mask in debugging output.
* sigproc.h (set_signal_mask): Reflect above change in declaration.
* path.cc (mount_item::build_win32): Take path apart before feeding it to
fnmunge.  Throughout, change use of _reent_winsup()-> to _my_tls.locals.
instead.  Throughout, remove obsolete MT_SAFE/_CYG_THREAD_FAILSAFE
considerations.  Througout, add cygtls.h include.
* Makefile.in (DLL_OFILES): Add cygtls.o.  Add some more objects to the
-fomit-frame-pointer list.
* acconfig.h: Remove obsolete settings.
* config.h.in: Ditto.
* bsdlib.cc: Add cygtls.h include.
* configure.in: Remove --enable-extra-threadsafe-checking.
* configure: Regenerate.
* cygtls.h (_local_storage): New struct renamed from _winsup_t (sic).
(_threadinfo:local_clib): Add new field.
(_threadinfo::locals): Ditto.
(_threadinfo::init_thread): Accept second _reent * argument.
(_threadinfo::call): Define as regparm.
(CYGTLS_PADSIZE): Remove unnecessary slop.
(_getreent): Define as a macro.
* thread.h: Remove _CYG_THREAD_FAILSAFE and MT_SAFE stuff.
(_winsup_t): Move to cygtls.h.
(ResourceLocks::ResourceLocks): Eliminate empty constructor.
(MTinterface::reents): Eliminate.
(MTinterface::thread_self_key): Eliminate.
(MTinterface::MTinterface): Eliminate.
* dcrt0.cc: Include stdio.h for _impure_ptr initialization.
(do_global_ctors): Remove run_ctors_p (sic) considerations.  Don't call atexit
here.
(__main): Initialize destructors for user here.
(dll_crt0_1): Accept a dummy argument.  Don't call init_thread here.  Don't set
_impure_ptr here.  Call do_global_ctors after more things have been
initialized.
(_dll_crt0): Define zeros buffer as max of needed size of CYGTLS_PADSIZE so
that it can be used for two purposes while minimizing stack usage.  Initialize
_impure_ptr specifically, for speed.  Call dll_crt0_1 with buffer argument.
(cygwin_dll_init): Call dll_crt0_1 with dummy argument.
* dtable.cc (dtable::find_unused_handle): Remove call to AssertResourceOwner.
* exceptions.cc: Move _threadinfo stuff to new file.
* cygtls.cc: New file.
* gentls_offsets: Accommodate increasing complexity of cygtls.h.
* hires.h (hires_base::~hires_base): Remove.
* init.cc (dll_entry): Remove setting of reents.
* thread.cc: Remove syslog.h include.
(__getreent): Simplify to use _my_tls.
(_reent_winsup): Delete.
(AssertResourceOwner): Delete.
(MTinterface::Init): Remove setting of _clib and _winsup, with all that
entails.
(MTinterface::fixup_after_fork): Ditto.
(pthread::thread_init_wrapper): Ditto.  Also remove call to
set_tls_self_pointer.
(pthread::set_tls_self_pointer): Eliminate.
(pthread::get_tls_self_pointer): Just return _my_tls.tid;
(__reent_t::init_clib): Eliminate.
* tlsoffsets.h: Regenerate.
2003-12-23 16:26:31 +00:00
Christopher Faylor 98f56d64c2 * sigproc.cc (proc_subproc): Simplify code to just remove all zombies if
SIGCHLD == SIG_IGN.
2003-12-18 04:42:31 +00:00
Christopher Faylor 1f8331ae8b * pinfo.h (pinfo::operator ==): Add a way to check for _pinfo types.
* sigproc.cc (proc_subproc): Ensure that zombie is removed when SIGCHLD ==
SIG_IGN but still allow wait()ing threads to wake up.
2003-12-17 22:47:32 +00:00
Christopher Faylor 1ed95be609 * exceptions.cc (set_signal_mask): Report on input argument rather than
getsigmask.
* fhandler.h (fhandler_base): Make friends with close_all_files.
* pinfo.cc (_pinfo::set_ctty): Add more debugging.
* sigproc.cc (proc_can_be_signalled): Detect state when signal handler thread
is gone in target process as an EPERM situation.  Set errno to ESRCH if process
doesn't exist.
(sigproc_terminate): Set sendsig to illegal value when closed.
(sig_send): Rely on proc_can_be_signalled setting the proper errno.
* syscalls.cc (close_all_files): Detect when all ttys are closed prior to
calling close_all_files.  The ctty needs to be closed explicitly in this case.
2003-12-16 23:28:03 +00:00
Corinna Vinschen 0c3966ac4e * include/cygwin/ipc.h: Include sys/types.h. 2003-12-16 10:15:28 +00:00
Corinna Vinschen 11377ba668 * bsd_helper.cc (tunable_params): Add entries for kern.ipc.msgmnb and
kern.ipc.msgtql.  Raise max value for kern.ipc.msgseg to 65535.
	* cygserver.conf: Add kern.ipc.msgmnb and kern.ipc.msgtql.
	* sysv_msg.cc (msginit): Add TUNABLE_INT_FETCH call for
	kern.ipc.msgmnb and kern.ipc.msgtql.
2003-12-16 10:13:34 +00:00
Christopher Faylor 5c07a5745f * thread.cc (pthread::init_main_thread): Make sure that the main thread has
valid handles.
(pthread::create_cancel_event): Fix error message.
2003-12-15 14:38:12 +00:00
Christopher Faylor 5e2a359c44 add out-of-date notice. 2003-12-15 04:44:30 +00:00
Christopher Faylor d627d17183 Add missing ChangeLog entry. 2003-12-15 04:17:27 +00:00
Christopher Faylor 9908d9977b * winsup.h (access_worker): Declare with added fhandler_base parameter.
* syscalls.cc (access_worker): Accommodate extra fhandler_base argument.  Use
it instead of stat_worker to determine stat information, when appropriate.
* fhandler.cc (fhandler_base::device_access_denied): Pass fhandler pointer to
access_worker so that it can use the proper method for determining stat
information.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
2003-12-15 04:16:42 +00:00
Christopher Faylor 228f99a6c1 white space 2003-12-15 03:59:32 +00:00
Christopher Faylor f2f1af25ab Remove erroneous entry. 2003-12-15 03:10:38 +00:00
Christopher Faylor f6393387ef * exceptions.cc (ctrl_c_handler): Remove this thread from the signal handler
chain.
2003-12-14 16:55:24 +00:00
Christopher Faylor c350feda20 * cygthread.cc (cygthread::stub): Revert previous change and again subsume
cygthread::stub2.  Just return from function now since ExitThread is guaranteed
by automatic _threadinfo wrapper.  Define as per ThreadProc convention.
(cygthread::stub2): Remove.
(cygthread::simplestub): Perform similar operations to cygthread::stub.
(cygthread::simplestub2): Remove.
* cygthread.h (cygthread::stub): Declare as per ThreadProc convention.
(cygthread::stub2): Remove declaration.
(cygthread::simplestub): Declare as per ThreadProc convention.
(cygthread::simplestub2): Remove declaration.
* cygtls.h (_threadinfo::call): Define first argument as per ThreadProc
convention.
(_threadinfo::call2): Ditto.
(_tlsbase): Define as char * pointer.
(_tlstop): New definition.
(_main_tls): Define here.
* dcrt0.cc (alloc_stack): Revert previous change which called init_thread since
information would be overwritten by fork later anyway.
(dll_crt0_1): Use _tlsbase and _tlstop for setting stack bottom, top.
* exceptions.cc: Move _main_tls declaration to cygtls.h.
(_threadinfo::call): Define first argument as per ThreadProc convention.
(_threadinfo::call2): Call ExitThread with thread function return value.
(_threadinfo::init_thread): Don't initialize cygtls to zero if input arg is
NULL.
* fork.cc (fork_child): Reset _main_tls here.  Reinitialize parts of _my_tls
after copying data from parent.
* init.cc (threadfunc_fe): New function.  Front-end for all threads created in
cygwin processes.
(munge_threadfunc): New function.
(dll_entry): Call munge_threadfunc to force the call of a thread wrapper.
* thread.cc (pthread::thread_init_wrapper): Perform similar operations to
cygthread::stub.
(pthread::thread_init_wrapper2): Remove.
* thread.h (pthread::thread_init_wrapper): Declare as per ThreadProc
convention.
(pthread::thread_init_wrapper2): Remove declaration.
* window.cc (Winmain): Just return from function now since ExitThread is
guaranteed by automatic _threadinfo wrapper.
2003-12-14 07:09:22 +00:00
Danny Smith f082663050 * include/stdio.h:(_fileno): Define macro version after both
fileno and _fileno functions declared.

	* include/stdio.h (_rmtmp, rmtmp): Add prototypes.
	* moldnames.def.in (rmtmp) Add stub.
2003-12-13 21:22:34 +00:00
Christopher Faylor 9279515ae1 * dtable.cc (dtable::delete_archetype): Add debugging.
(dtable::release): Move archetype deletion here.
(dtable::vfork_child_dup): Increment ctty usecount to catch later
close_all_files case in parent/child.
(dtable::vfork_child_fixup): Avoid using cygheap->foo where this should really
be using local references.  Call close on archetyped handles since the handles
haven't had the noninherit flag set.
* fhandler_tty.cc (fhandler_tty_slave::close): Remove archetype deletion code.
Add defensive error message when DEBUGGING.
(fhandler_tty_common::set_close_on_exec): Use more robust method for checking
whether to set handles into noninherit if there is an archetype associated with
the fhandler.
2003-12-12 20:46:03 +00:00
Christopher Faylor fac0681d6c * dcrt0.cc (alloc_stack): Move _main_tls if stack is relocated. 2003-12-12 05:04:47 +00:00
Christopher Faylor c76d70d7c0 * miscfuncs.cc (low_priority_sleep): Correct thinko which caused SetPriority to
be called unnecessarily.
* thread.cc (pthread::init_main_thread): Call new create_cancel_event function.
(pthread::precreate): Ditto.
(pthread::postcreate): Remove cancel_event creation.
(pthread::create_cancel_event): Define new function.
* thread.h (pthread::create_cancel_event): Declare new function.
2003-12-12 04:15:32 +00:00
Corinna Vinschen 97cb9b9de4 * fhandler_serial.cc (fhandler_serial::tcflush): Simplify. Remove
read polling loop to avoid a hang with streaming devices.
2003-12-11 18:07:42 +00:00
Christopher Faylor 992406a5ea * pinfo.cc (_pinfo::set_ctty): Correct stupid typo. 2003-12-11 06:19:36 +00:00
Christopher Faylor 8e10c4311f * cygheap.h (cygheap_types): Add HEAP_ARCHETYPES.
(init_cheap::ctty): Change to pointer.
* dtable.h (dtable::find_archetype): Declare new function.
(dtable::add_archetype): Declare new function.
(dtable::delete_archetype): Declare new function.
(dtable::narchetypes): Declare.
(dtable::farchetypes): Declare.
(dtable::initial_archetype_size): Declare.
(dtable::dtable): Initialize new fields.
(dtable::initial_archetype_size): Declare.
* dtable.cc (dtable::find_archetype): Define new function.
(dtable::add_archetype): Define new function.
(dtable::delete_archetype): Define new function.
(dtable::initial_archetype_size): Define.
* fhandler.h (fhandler_base::archetype): Declare.
(fhandler_base::usecount): Declare.
* fhandler.cc (fhandler_base::fhandler_base): Initialize new fields.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Pass NULL to third
argument of set_ctty.
* fhandler_tty.cc (fhandler_tty_slave::open): Accommodate new archetype method
to create only one instance of a tty.
(fhandler_tty_slave::close): Don't close handles unless archetype usecount is
zero.  When that happens, close archetype too.
(fhandler_tty_slave::dup): Just copy archetype.  Set use count appropriately.
Set ctty, if appropriate.
(fhandler_tty_common::dup): Remove slave considerations.
(fhandler_tty_common::set_close_on_exec): Remove cygheap->ctty considerations.
* pinfo.cc (_pinfo::set_ctty): Accommodate new archetype methods.
* pinfo.h (_pinfo::set_ctty): Make third argument explicit.
* syscalls.cc (close_all_files): Decrement controlling tty use count before
closing all handles to allow controlling tty to be closed.  Remove previous
controlling tty considerations.
2003-12-11 06:12:41 +00:00
Christopher Faylor 3f23411449 remove debug output 2003-12-10 04:08:50 +00:00
Christopher Faylor ce40c6baf7 * fhandler_tty.cc (fhandler_tty_common::dup): Just copy cygheap->ctty to child
if duping the current ctty.
(fhandler_tty_common::close): Move debugging statement earlier in function.
(fhandler_tty_slave::close): Return success when closing ctty.
* syscalls.cc (close_all_files): Avoid calling fhandler_tty_slave close method
so that open_fhs will not be decremented when closing cygheap ctty.
(setsid): Ditto.
* dcrt0.cc (do_exit): Reorganize to avoid leaving a critical section active
after vfork.
* fhandler.h (fhandler_tty_slave::get_unit): Remove regparm parameter since it
can't work in a virtualized function.
2003-12-10 03:19:19 +00:00
Christopher Faylor 7176387b4f * pinfo.cc (_pinfo::set_ctty): Don't copy over existing ctty if it is active. 2003-12-09 03:27:05 +00:00
Danny Smith 91ec94b67c 2003-12-08 Danny Smith <dannysmith@users.sourceforge.net>
* include/winuser.h (DISPLAY_DEVICE_*): Remove defines.
	* include/wingdi.h  (DISPLAY_DEVICE_REMOVABLE,
	DISPLAY_DEVICE_MODESPRINED): Add defines from winuser.h

2003-12-08  Hartmut Honisch  <hhonisch@users.sourceforge.net>

	* include/commctrl.h (ListView_Get_State, ListView_Check_State):
	Add macros.
	* include/wingdi.h  (DISPLAY_DEVICE_*): Add multi-monitor
	constants.
	* include/shlobj.h (SHCOLUMNINIT); Add structure.
	(SHCOLUMNDAT): Likwise.
	(SHCOLUMNID): Likewise.
	(SHCOLUMNINFO): Likewise.
	(SHCOLSTATE): Add enum.
	(IColumnProvider): Add COM interface.
	(IQueryInfo): Likewise.
	(IShellIconOverlayIdentifier): Likewise.
  	* include/shlguid.h (IID_IColumnProvider) Declare.
	(IID_IQueryInfo): Likweise.
	(IID_IShellIconOverlayIdentifier): Likwise.
	* lib/shell32.c (IID_IColumnProvider) Define.
	(IID_IQueryInfo): Likweise.
	(IID_IShellIconOverlayIdentifier): Likwise.
2003-12-08 22:41:44 +00:00
Danny Smith ddd3eeee8c 2003-12-08 Roald Ribe <rrib@users.sourceforge.net>
* include/winuser.h (RT_MANIFEST): Add define.

2003-12-08  Pascal Buhler <pbuhler@users.sourceforge.net>

	* include/oleidl.h (IViewObject2): Inherit from IViewObject.
2003-12-08 19:37:19 +00:00
Christopher Faylor ac5ba8b0de * thread.cc (pthread::precreate): Delete duplicate setting of cancel_event. 2003-12-08 06:32:46 +00:00
Christopher Faylor da915a3aa6 * fhandler.h (fhandler_tty_slave::ttyname): Use name from pc since it is
guaranteed to be accurate.
* fhandler_tty.cc (fhandler_tty_slave::open): Increment open_fhs appropriate
when copying ctty.
(fhandler_tty_slave::close): Remove special case handling for exit_state.  Use
ctty < 0 check instead.
(fhandler_tty_common::close): Set io_handle to NULL after closing.
* syscalls.cc (close_all_files): Specifically close cygheap->ctty, if
appropriate.
2003-12-08 06:27:05 +00:00
Christopher Faylor 1b11f4fd72 * wait.cc (wait4): Move sawsig initialization inside loop. 2003-12-08 00:22:56 +00:00
Christopher Faylor 1c5c9a6bfb * spawn.cc (spawn_guts): Change type back to 'int' after erroneous change
below.
2003-12-08 00:21:17 +00:00
Christopher Faylor 2e008fb91f Change use of BOOL, TRUE, FALSE to bool, true, false, as appropriate,
throughout.
* tty.cc (tty::common_init): Remove call to SetKernelObjectSecurity and edit
some comments.
* cygheap.h (init_cygheap::ctty): Add new element.
* devices.in (device::parse): Remove special handling for /dev/tty.
* devices.cc: Regenerate.
* dtable.cc (build_fh_pc): Don't reset /dev/tty device.  Let the device opener
do that.
* fhandler_termios.cc (tty_min::set_ctty): Redefine to _pinfo class.
* fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Avoid setting
noninherit flag for ctty.
* tty.h: Move BOOLs to bools.
(tty_min::set_ctty): Redeclare to _pinfo class.
* pinfo.cc (_pinfo::set_ctty): Define new function based on tty_min::set_ctty.
Change first argument from tty number to tty_min class.
* pinfo.h (_pinfo::set_ctty): Declare.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Reflect move of
set_ctty to _pinfo class.
* fhandler_tty.cc (fhandler_tty_slave::open): Treat FH_TTY specially.  Use
saved cygheap value if it exists.  Otherwise convert to real device and save on
first time open.
(fhandler_tty_common::dup): Potentially set controlling tty if duping a slave
tty.
* syscalls.cc (setsid): Close controlling tty in cygheap.
* tty.cc: Change some BOOLs to bools.
2003-12-07 22:37:12 +00:00
Corinna Vinschen 2e3ff06d3c * syscalls.cc (locked_append): New.
(updwtmp): Remove mutex code and call locked_append.
	(pututline): Ditto.
2003-12-07 12:56:59 +00:00
Christopher Faylor ae2543ed76 * exceptions.cc (_threadinfo::remove): Avoid a linked list walk. 2003-12-07 03:27:51 +00:00
Christopher Faylor 73262d7a44 * cygtls.h (_threadinfo::find_tls): New function.
* exceptions.cc (_threadinfo::find_tls): Rename from find_tls.  Use critical
section to protect access to linked list.
2003-12-07 02:56:52 +00:00
Christopher Faylor fcc47fd001 * exceptions.cc (_threadinfo::remove): Avoid returning without unlocking
critical section in the (hopefully impossible) case of an unrecognized thread.
2003-12-07 02:33:31 +00:00
Christopher Faylor 2b6d15a908 * cygtls.h: Add more "don't parse this" guards.
(_threadinfo::init_thread): Rename from 'init'.
(_threadinfo::init): Declare new function.
(_threadinfo::protect_linked_list): Declare new critical section.
* dcrt0.cc (dll_crt0_1): Call init_thread to initialize thread stuff.
(_dll_crt0): Call _threadinfo::init prior to invoking dll_crt0_1.
* exceptions.cc (_threadinfo::init_thread): Rename from 'init'.
(_threadinfo::init): Define new function.  Protect linked list manipulation
with new critical section.
(_threadinfo::call): Reflect function name change.
(_threadinfo::remove): Protect linked list manipulation with new critical
section
* gentls_offsets: Rework to allow multi-line "don't parse this" protection.
* init.cc (dll_entry): Don't remove threads info stuff here since the remove
function uses a critical section which can't be used during thread creation or
destruction.
* thread.cc (pthread::exit): Call _threadinfo remove function here.
2003-12-06 18:08:38 +00:00
Christopher Faylor aeab6ea658 * cygthread.cc (cygthread::stub2): Remove myself from the list of threads
monitored by signals since this thread will never call raise or sigwait.
(cygthread::simplestub2): Ditto.  Set ev here.
(cygthread::cygthread): Don't set ev here for freerange thread.
2003-12-05 05:29:17 +00:00
Christopher Faylor 78f3155ced * path.cc (slash_unc_prefix_p): Allow '.' as a valid character after '\\' in a
UNC path.
2003-12-05 04:33:40 +00:00
Christopher Faylor 57e6aca667 * exceptions.cc (setup_handler): Remove ill-advised debugging output. 2003-12-05 04:20:48 +00:00
Corinna Vinschen 592db10ed7 * include/cygwin/types.h (struct __fcntl64): Fix datatype of l_start. 2003-12-04 09:37:55 +00:00
Corinna Vinschen 145b4dc249 Substitute 0x7fffffff and 0xffffffff by INT32_MAX and UINT32_MAX
throughout, except in assembler code.
2003-12-03 16:35:52 +00:00
Corinna Vinschen d2fa946e51 * fhandler_disk_file.cc (fhandler_disk_file::lock): Use UINT32_MAX
instead of 0xffffffff.  Accomodate Win 9x bug in evaluating length
	of area to lock when given length is 0.
2003-12-03 11:22:49 +00:00
Corinna Vinschen 1843517401 * fhandler_disk_file.cc (fhandler_disk_file::lock): Interchange
values of off_low and off_high.
2003-12-03 09:58:23 +00:00
Corinna Vinschen e2a39e2efa * fcntl.cc (fcntl_worker): Remove static storage class.
* flock.cc (flock): Use struct __flock64. Call fcntl_worker.
	Use Cygwin errno functions instead of accessing errno directly.
	* winsup.h: Declare fcntl_worker.
2003-12-03 09:55:42 +00:00
Corinna Vinschen 941c9bf805 * fcntl.cc (_fcntl): Whitespace cleanup. 2003-12-03 09:16:37 +00:00
Christopher Faylor d1eb7a4615 * cygthread.cc (cygthread::stub): Properly establish _threadinfo environment.
(cygthread::stub2): New function.
(cygthread::simplestub): Ditto.
(cygthread::simplestub2): New function.
* cygthread.h (cygthread::stub2): Declare new function.
(cygthread::simplestub2): Ditto.
* cygtls.h (_threadinfo::call): Declare new function.
(_threadinfo::call2): Ditto.
* dcrt0.cc (dll_crt0_1): Accommodate new _threadinfo::init which doesn't return
pointer to tls.
(_dll_crt0): Remove obsolete DECLARE_TLS_STORAGE.
(dll_crt0): Ditto.
* exceptions.cc (_threadinfo::call): New function.
(_threadinfo::call2): Ditto.
(_threadinfo::init): Don't return pointer.
* thread.cc (pthread::thread_init_wrapper): Properly establish _threadinfo
environment.
(pthread::thread_init_wrapper2): New function.
* thread.h (pthread::thread_init_wrapper): Remove noreturn attribute
(pthread::thread_init_wrapper2): Declare new function.
* winbase.h: Remove obsolete code.
2003-12-03 05:21:55 +00:00
Christopher Faylor af9ef8abb2 * Makefile.in: Change the way that -f options are appended to CFLAGS, slightly. 2003-12-03 00:21:21 +00:00
Christopher Faylor e575a697ba * fcntl.cc (_fcntl): Silence a compiler warning. 2003-12-02 23:47:28 +00:00
Christopher Faylor 93e4038242 * pinfo.cc (pinfo::init): Use shared_name to construct the mapname. 2003-12-02 04:10:56 +00:00
Christopher Faylor 5c9cceced7 white space 2003-12-02 01:36:08 +00:00
Thomas Pfaff 693dd53815 Change tab to space in Changelog. 2003-12-01 22:13:58 +00:00
Thomas Pfaff 94d2416049 * thread.cc (pthread_rwlock::add_reader): Remove mx parameter for
List_insert call.
(pthread::prepare): Ensure race safeness when adding function
pointers to atfork lists by using List_insert.
* thread.h (List_insert): Use InterlockedCompareExchangePointer to
ensure race safeness without using a mutex.
(List_remove): Use InterlockedCompareExchangePointer to
ensure race safeness with List_insert.
(List::insert): Remove mx parameter for	List_insert call.
2003-12-01 22:10:57 +00:00
Corinna Vinschen bd16a3a8a8 * winsup.api/known_bugs.tcl: Remove fcntl09 and fcntl10. These
tests had a compatibility bug.
	* winsup.api/ltp/fcntl09.c: Don't use F_RDLCK | F_WRLCK but only
	F_WRLCK to set a write lock.
	* winsup.api/ltp/fcntl10.c: Ditto.
2003-12-01 17:33:11 +00:00
Corinna Vinschen dc3998682a * Makefile.in (OBSOLETE_FUNCTIONS): Add fcntl.
(NEW_FUNCTIONS): Add fcntl64.
	* cygwin.din: Export fcntl64.  Make fcntl being SIGFE.
	* fcntl.cc (fcntl_worker): New function.
	(fcntl64): New function.
	(_fcntl): Call fcntl_worker.  Convert 32 bit flock structure into
	64 bit flock structure and vice versa.
	* fhandler.cc (fhandler_base::lock): Change 2nd parameter to
	struct __flock64 *.
	* fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto.  Rework
	to be 64 bit aware.
	* fhandler.h: Accomodate above method argument changes.
	* include/cygwin/types.h: Add struct __flock32 and __flock64.
	Define struct flock according to setting of __CYGWIN_USE_BIG_TYPES__.
	* include/cygwin/version.h: Bump API minor number.
2003-12-01 17:26:28 +00:00
Corinna Vinschen 6c2b784612 * cygheap.cc (cygheap_init): Set cygheap->shared_prefix.
* cygheap.h (struct init_cygheap): Add shared_prefix.
	* shared.cc (shared_name): Use cygheap->shared_prefix.
2003-12-01 15:03:43 +00:00
Corinna Vinschen 4febe95f89 * shared.cc (shared_name): Take into account the SE_CREATE_GLOBAL_NAME
privilege when building the name string.
	(open_shared): Remove the call to OpenFileMapping.
	(shared_info::initialize): Move cygheap initialization to ...
	(memory_init): ... here. Suppress now useless shared_h variable.
	(user_shared_initialize): Make tu a cygpsid.
2003-12-01 11:16:20 +00:00
Corinna Vinschen cb766c47bb * include/tzfile.h: Remove duplicate definition of TM_SUNDAY.
* localtime.cc: Point TZDIR to the /usr/share/zoneinfo directory used
	by the tzcode package.
2003-12-01 10:39:17 +00:00
Danny Smith 635fa4ba48 * include/winnt.h (GetCurrentFiber): Remove duplicate prototype.
(GetFiberData); Likewise.

	(GetCurrentFiber): Change volatile to __volatile__.
	(GetFiberData); Likewise.
2003-12-01 09:11:42 +00:00
Corinna Vinschen b406ed7b51 * flock.cc: Renamed from flock.c. 2003-11-30 10:43:04 +00:00
Christopher Faylor fcac349166 * pinfo.h: Remove global_sigs declaration.
* siginfo.h: Move global_sigs declaration here.
* Makefile.in: Remove duplicate compiler flag.
2003-11-30 02:21:04 +00:00
Christopher Faylor b63ba3b6aa * exceptions.cc (_threadinfo::pop): Zero *contents* of popped stack location
rather than the actual stack pointer.
2003-11-30 02:19:45 +00:00
Corinna Vinschen f3a1e23eb3 * Makefile.in: (DLL_OFILES): Add flock.o.
* cygwin.din: Export flock.
	* flock.c: New file.
	* include/sys/file.h: Include sys/cdefs.h.
	Add function prototype for flock().
	Add some comments from BSD's header for further clarity.
	(L_SET, L_CURR, L_INCR, L_XTND): Redefine as the macros
	SEEK_SET, SEEK_CUR, SEEK_CUR, & SEEK_END respectively.
	(LOCK_SH,LOCK_EX,LOCK_NB,LOCK_UN): New macros for flock().
	* include/cygwin/version.h: Bump API minor number.
2003-11-29 23:00:51 +00:00
Christopher Faylor b50fe8212f * sigproc.cc (no_signals_available): Fix so that non-zero exit state is a true
condition rather than errnoneously only checking other states when exist_state
was zero.
2003-11-29 00:31:37 +00:00
Christopher Faylor 62e070d72e * pinfo.h (_pinfo::getthread2signal): Remove obsolete function.
* cygtls.h (_threadinfo): Define tid more precisely.
(_threadinfo::operator HANDLE): Define.
* exceptions.cc (_threadinfo::interupt_now): Use _threadinfo HANDLE operator to
derive thread handle.
(setup_handler): Ditto.
* sigproc.cc: Reorganize includes.
2003-11-29 00:26:40 +00:00
Christopher Faylor 13584f077b * pinfo.h (_pinfo::getsig): Remove obsolete function, here and throughout.
* exceptions.cc: Ditto.
* fhandler_termios.cc: Ditto.
* signal.cc: Ditto.
* sigproc.cc: Ditto.
* Makefile.in: Revert previous change which made a cygwin.din newer than a
version.h a warning rather than an error.
2003-11-28 22:13:57 +00:00
Christopher Faylor 74d893b13c * cygwin.din: Re-add inexplicably missing semaphore/msg functions. 2003-11-28 21:39:08 +00:00
Christopher Faylor 965f78cbbe * gendevices: Issue error when shilka is missing. 2003-11-28 21:20:15 +00:00
Christopher Faylor abd2fa9994 * include/cygwin/signal.h: New file.
(also check in tlsoffsets.h, missed by previous checkin)
2003-11-28 21:01:09 +00:00
Christopher Faylor 9a4d574b8d Eliminate use of sigframe and sigthread throughout.
* Makefile.in (DLL_OFILES): Add sigfe.o.  Remove reliance on cygwin.def from
cygwin0.dll dependency since dependence on sigfe.o implies that.  Generate def
file on the fly using 'gendef'.
* configure.in: Don't auto-generate cygwin.def.
* configure: Regenerate.
* cygwin.din: Add SIGFE stuff where appropriate.
* dcrt0.cc (dll_crt0_1): Initialize cygwin tls early in process startup.  Set
_main_tls to address of the main thread's cygwin tls.
* debug.h: Remove now unneeded WFSO and WFMO declarations.
* exceptions.cc (_last_thread): Define.
(set_thread_state_for_signals): New function.
(reset_thread_exception_for_signals): Ditto.
(init_thread_for_signals): Ditto.
(delete_thread_for_signals): Ditto.
(capture_thread_for_signals): Ditto.
(handle_exceptions): Set return address explicitly for exceptions prior to
calling sig_send.
(interrupt_on_return): Eliminate.
(setup_handler): Add preliminary implementation for dealing with
thread-specific signals by querying _main_tls.
(signal_exit): Use cygthread::main_thread_id instead of mainthread.id.
(call_signal_handler_now): For now, just handle the main thread.
* fork.cc (vfork): Save and restore main _my_tls.
* gendef: New file.  Generates def file and sigfe.s file.
* gentls_offsets: New file.  Generates offsets for perl to use in sigfe.s.
* how-signals-work.txt: Mention that info is obsolete.
* init.cc (dll_entry): Initialize cygwin tls storage here.
* miscfuncs.cc (low_priority_sleep): Make a C function for easier calling from
asm.
* perthread.h (vfork_save::tls): New element.
* signal.cc (nanosleep): Replace previous use of
sigframe.call_signal_handler_now with straight call to call_signal_handler_now.
(abort): Ditto.
* syscalls.cc (readv): Ditto.
* termios.cc (tcsetattr): Ditto.
* wait.cc (wait4): Ditto.
* sigproc.cc (sig_dispatch_pending): Ditto.
(sig_send): Ditto.
* sigproc.h: Declare call_signal_handler_now.
* thread.cc (pthread::thread_init_wrapper): Initialize cygwin tls.  Remove
obsolete and unworking signal stuff.
* thread.h (verifyable_object::sigs): Eliminate.
(verifyable_object::sigmask): Eliminate.
(verifyable_object::sigtodo): Eliminate.
(verifyable_object::exit): Make attribute noreturn.
(verifyable_object::thread_init_wrapper): Ditto.
(pthread_null::exit): Ditto.
* winbase.h (__stackbase): Always define.
* winsup.h (low_priority_sleep): Declare as a "C" function.
* include/cygwin/version.h: Bump API version to reflect sigwait export.
* include/sys/queue.h: Protect SLIST_ENTRY from previous declaration.
* signal.cc (sigwait): Implement.
* select.cc (fhandler_base::ready_for_read): Add debugging output.
* devices.h: Define more device pointers via their storage.
* devices.in: Don't parse things like /dev/inet/tcp, as they really have no
meaning.
* devices.cc: Regenerate.
* gendevices: Set proper protection for output file.
* cygtls.h: New file.
* gendef: New file.
* gentls_offsets: New file.
* tlsoffsets.h: New file.  Autogenerated.
* config/i386/longjmp.c: Remove.  File subsumed by gendef output.
* config/i386/makefrag: Remove obsolete file.
* fhandler.cc: Remove spurious access_worker declaration.
* spawn.cc (spawnve): Make debugging output more accurate.
* cygwin-gperf: Remove.
* devices.cc: Remove.
2003-11-28 20:55:59 +00:00
Christopher Faylor ffe0063843 * speclib: Use correct EOF marker. Ensure that directory is actually deleted
when running under Windows.
2003-11-28 20:51:11 +00:00
Christopher Faylor 268aec4006 * speclib: Use correct EOF marker. Ensure that directory is actually deleted
when running under Windows.
2003-11-28 20:10:07 +00:00
Christopher Faylor 8cf11e2918 * lib/Makefile.in: Use make function to locate .mri file to allow building in
directory other than source directory.
2003-11-27 23:34:18 +00:00
Christopher Faylor 93eba3cb60 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Reorganize to avoid
inappropriate .lnk extensions with munged filenames under managed mode.
2003-11-27 23:27:23 +00:00
Danny Smith 714b947a1b 2003-11-27 Dimitry Sibiryakov <aafemt@users.sourceforge.net>
* include/signal.h (SIG_SGE, SIG_ACK): Add defines.
2003-11-27 08:23:43 +00:00
Danny Smith d799adc46f * lib/vfw32.def: Remove, replacing with ...
* lib/msvfw32.def: New file.
	* lib/avicap32.def: New file.
	* lib/avifil32.def: New file.
	* lib/vfw32.mri: New file.
	* Makefile.in: (MRI_FILES, MIMPLIBS): New vars for
	import libs with multiple dll's.
	(LIBS): Add MIMPLIBS.
	(DISTFILES): Add MRI_FILES.
	(libvfw32.a): Build using mri script.
2003-11-27 02:14:37 +00:00
Corinna Vinschen 1d88f8cea2 * cygserver.cc (main): Move call to ipcinit() up before installing
any threads.
	* sysv_sem.cc: Update to FreeBSD version 1.67.
	(seminit): Initialize semaphore sequence numbers to 0.
2003-11-26 22:29:35 +00:00
Corinna Vinschen a2acbfb14e * Makefile.in (CYGWIN_LIB): Variable pointing to libcygwin.a in
the parallel cygwin dir.
	(cygserver.exe): Depend on and link against $CYGWIN_LIB.
2003-11-26 20:05:09 +00:00
Corinna Vinschen f25babdf07 * mkgroup.c (main): Print "root" group with local admins group sid
and gid 0.
2003-11-26 15:47:44 +00:00
Corinna Vinschen cb55867514 * sec_helper.cc (set_process_privilege): Rename restore_priv to
priv_luid.

	* sec_helper.cc (set_process_privilege): Call LookupPrivilegeValue
	before opening the token.
2003-11-26 14:29:22 +00:00
Corinna Vinschen 12069cf31b * dir.cc (mkdir): Use local security_descriptor. Call
set_security_attribute appropriately.
	* external.cc (cygwin_internal): Ditto.
	* fhandler.cc (fhandler_base::open): Ditto.
	* fhandler_socket.cc (fhandler_socket::bind): Ditto.
	* path.cc (symlink_worker): Ditto.
	* sec_acl.cc (setacl): Ditto. Call read_sd appropriately.
	(getace): Ditto.
	* sec_helper.cc (security_descriptor::malloc): New method.
	(security_descriptor::realloc): New method.
	(security_descriptor::free): New method.
	* security.cc (read_sd): Get security_descriptor as parameter instead
	of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check.
	Allocate the security_descriptor buffer according to size returned by
	a call to GetFileSecurity. Return buffer size on success.
	(write_sd): Get security_descriptor as parameter instead of
	PSECURITY_DESCRIPTOR and a size.
	(get_nt_attribute): Use local security_descriptor.
	(get_nt_object_attribute): Ditto in case of type == SE_REGISTRY_KEY.
	Allocate security_descriptor buffer according to size returned by
	a call to RegGetKeySecurity.
	(alloc_sd): Make static. Get security_descriptor as parameter instead
	of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check.
	(set_security_attribute): Get security_descriptor as parameter instead
	of PSECURITY_DESCRIPTOR and a size.
	(set_nt_attribute): Use local security_descriptor.
	(check_file_access): Ditto.
	* security.h: Add class security_descriptor.
	(read_sd): Change declaration to get security_descriptor as parameter
	instead of PSECURITY_DESCRIPTOR and a size.
	(write_sd): Ditto.
	(set_security_attribute): Ditto.
	(alloc_sd): Remove declaration.
	* thread.cc (semaphore::semaphore): Use local security_descriptor. Call
	set_security_attribute appropriately.
2003-11-26 13:23:27 +00:00
Corinna Vinschen 3db690789f * sec_acl.h (getace): Use FILE_*_BITS as permission mask.
* security.cc (get_attribute_from_acl): Ditto.
	* security.h (FILE_READ_BITS): Define to match also GENERIC bits.
	(FILE_WRITE_BITS): Ditto.
	(FILE_EXEC_BITS): Ditto.
2003-11-26 10:52:21 +00:00
Christopher Faylor af284c9c3b * Makefile.in (CXXFLAGS): Remove duplicate options handled in Makefile.common. 2003-11-26 03:52:12 +00:00
Christopher Faylor b5aa10cda8 more white space 2003-11-25 22:59:37 +00:00
Christopher Faylor 8861377a2d more white space 2003-11-25 22:58:32 +00:00