Commit Graph

189 Commits

Author SHA1 Message Date
Corinna Vinschen 722031140a * Makefile.in (DLL_OFILES): Add inet_addr.o and inet_network.o.
* autoload.cc (inet_addr): Drop definition.
	(inet_ntoa): Ditto.
	* net.cc: Forward declare cygwin_inet_aton and cygwin_inet_ntop.
	(cygwin_inet_ntoa): Call cygwin_inet_ntop instead of Winsock inet_ntoa.
	(cygwin_inet_addr): Remove here.
	(cygwin_inet_aton): Ditto.
	(cygwin_inet_network): Ditto.
	* libc/inet_addr.c: New file implementing cygwin_inet_aton and
	cygwin_inet_addr.
	* libc/inet_network.c: New file implementing cygwin_inet_network.
2006-07-07 09:14:15 +00:00
Corinna Vinschen fa48cf5325 * Makefile.in (DLL_OFILES): Add rexec.o.
* autoload.cc (inet_network): Drop definition.
	(rexec): Ditto.
	* net.cc (rexec): Drop extern declaration.
	(inet_network): Ditto.
	(cygwin_inet_network): Implement using inet_addr.
	(cygwin_rexec): Remove.
	* libc/rexec.cc: New file.
2006-07-04 20:24:27 +00:00
Christopher Faylor bc78e8bc6a * Makefile.in (libdl.a): New library. 2006-06-03 15:48:30 +00:00
Brian Dessent a72a9c190f * Makefile.in (clean): Also delete *.dbg. 2006-05-10 22:01:57 +00:00
Christopher Faylor 329a39ebea * Makefile.in (DLL_OFILES): Add winf.o.
* spawn.cc: Move command line handling stuff into winf.cc.
* winf.h: New file.
* winf.cc: New file.
2006-04-12 15:53:22 +00:00
Corinna Vinschen 19e7c3a068 * libc: Add subdirectory.
* Makefile.in (VPATH): Add libc subdir.
	(DLL_OFILES): Add strptime.o and timelocal.o.
	* cygwin.din: Export timelocal and timegm.
	* localtime.cc: Define STD_INSPIRED unconditionally.
	* include/cygwin/time.h (timelocal): Add declaration.
	(timegm): Ditto.
	* include/cygwin/version.h: Bump API minor version.
	* libc/strptime.cc: New file.
	* libc/timelocal.cc: New file.
	* libc/timelocal.h: New file.
2005-11-18 17:48:23 +00:00
Christopher Faylor 42cd8528aa * memmem.cc: New file.
* include/cygwin/version.h: Bump API version number to 142.
* cygwin.din: Export memmem.
2005-11-08 22:08:39 +00:00
Christopher Faylor 0fa52a6cdf Check in previously ChangeLoged entry. 2005-10-17 03:20:20 +00:00
Christopher Faylor fd1165e29a * Makefile.in (MKDIRP): Just use raw $(INSTALL) rather than $(INSTALL_DATA).
Create directories with 755 permissions.
2005-10-14 02:15:12 +00:00
Christopher Faylor d9b8d62966 * Makefile.in: Make sure that directories are created prior to copying to them. 2005-10-11 18:27:05 +00:00
Christopher Faylor 414808f9e0 * Makefile.in (CXXFLAGS): Use 'override' to correctly set flags to generate
dependencies when invoked from top-level make.
2005-09-02 17:12:37 +00:00
Corinna Vinschen e6ae6cd338 * Makefile.in (DLL_OFILES): Add fts.o, ftw.o, nftw.o.
* cygwin.din: Export fts_children, fts_close, fts_get_clientptr,
	fts_get_stream, fts_open, fts_read, fts_set, fts_set_clientptr,
	ftw, nftw.
	* fts.c: New file, imported from FreeBSD.
	* ftw.c: Ditto.
	* nftw.c: Ditto.
	* include/fts.h: Ditto.
	* include/ftw.h: Ditto.
	* include/cygwin/version.h: Bump API minor number.
2005-08-08 09:45:42 +00:00
Christopher Faylor 6a7bea70f0 * Makefile.in (dtable_CFLAGS): Use -fomit-frame-pointer and -fcheck-new.
* cygheap.cc (cmalloc): Only emit system_printf warnings on failure if
DEBUGGING.
(crealloc): Ditto.
(ccalloc): Ditto.
* dtable.cc (build_fh_name): Treat NULL return from cnew as indicative of
EMFILE condition.
(build_fh_dev): Ditto.
(dtable::dup_worker): Handle NULL return from build_fh_pc.
(dtable::vfork_child_dup): Trust dup_worker to set errno.
* fhandler.h (fhandler_base::new): Mark as nothrow.
2005-08-08 04:06:07 +00:00
Christopher Faylor cbda22eb63 * dllfixdbg: New perl script.
* configure.in: Detect objcopy, objdump, strip.
* configure: Regenerate.
* Makefile.in: Pass target objcopy/objdump to new dllfixdbg script.  Remove
previous perl check.
* cygwin.sc: Add .gnu_debuglink_overlay section for eventual replacement with
.gnu_debuglink section.  Revert move of cygheap to end of image.
2005-08-08 02:27:43 +00:00
Corinna Vinschen 1e0cb9ee0a * Makefile.in: Allow previous patch to work in a 64 bit environment. 2005-08-07 09:21:09 +00:00
Christopher Faylor 82eaabf521 * Makefile.in: Warn when end of cygheap is not on 64k boundary.
* cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.  Move
cygheap to end of image to stop interference from unstripped debug regions.
2005-08-07 02:38:13 +00:00
Christopher Faylor 88cbbd450e * Makefile.in: Avoid initial heap allocation since cygwin has its own heap. 2005-06-11 21:00:23 +00:00
Christopher Faylor 6eb501439a * Makefile.in: Build sync.o with -fomit-frame-pointer and -O3. 2005-06-05 04:15:16 +00:00
Christopher Faylor cb3f5f0862 * cygwin.din: Export mkdtemp.
* mktemp.cc: New file.
* Makefile.in (DLL_OFILES): Add mktemp.o
2005-05-25 03:40:07 +00:00
Corinna Vinschen 13505ca8fc * Makefile.in (DLL_OFILES): Add fhandler_mailslot.o.
* devices.h (FH_KMSG): Define new device.
	* devices.in: Add "/dev/kmsg" entry.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Handle case FH_KMSG.
	* fhandler.h (class fhandler_mailslot): New class.
	(class select_stuff): Add device_specific_mailslot pointer.
	* fhandler_mailslot.cc: New file.
	* select.cc (peek_mailslot): New function.
	(verify_mailslot): Ditto.
	(struct mailslotinf): New stuct to handle select on mailslots.
	(thread_mailslot): New function.
	(start_thread_mailslot): Ditto.
	(mailslot_cleanup): Ditto.
	(fhandler_mailslot::select_read): New method.
	* syslog.cc (klog_guard): New muto.
	(dev_kmsg): Local mailslot for kernel message device.
	(vklog): New function.
	(klog): Ditto.
	* winsup.h (vklog): Declare.
	(klog): Ditto.
	* include/sys/syslog.h: Define _PATH_KLOG.
2005-05-10 20:56:07 +00:00
Christopher Faylor 8cdcc8803a * Makefile.in (DLL_O_FILES): Add fhandler_netdrive.o.
* fhandler_netdrive.cc: Placeholder file for future development.
* devices.h (FH_NETDRIVE): Define new virtual device type.
(netdrive_dev): Define.
* devices.in (dev_netdrive_storage): Define.
* devices.cc: Regenerate.
2005-05-06 04:06:17 +00:00
Christopher Faylor ec98d19a08 * wininfo.h (wininfo::timer_active): Delete.
(wininfo::itv): Ditto.
(wininfo::start_time): Ditto.
(wininfo::window_started): Ditto.
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(wininfo::wininfo): Ditto.
(wininfo::lock): New method.
(wininfo::release): Ditto.
* window.cc: Use new lock/acquire wininfo methods throughout.
(wininfo::wininfo): Delete
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(getitimer): Ditto.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
(wininfo::lock): Define new function.
(wininfo::release): Ditto.
(wininfo::process): Delete WM_TIMER handling.
* timer.cc (struct timetracker): Delete it, flags.  Add it_interval,
interval_us, sleepto_us, running, init_muto(), syncthread, and gettime().
(ttstart): Make NO_COPY.
(lock_timer_tracker): New class.
(timer_tracker::timer_tracker): Distinguish ttstart case.
(timer_tracker::~timer_tracker): New destructor.  Clean out events, and reset
magic.
(timer_tracker::init_muto): New method.
(to_us): Round up as per POSIX.
(timer_thread): Reorganize to match timer_tracker::settime and
timer_tracker::gettime.  Call sig_send without wait.  Call auto_release.
(timer_tracker::settime): Reorganize logic to avoid race.  Call gettime to
recover old value.
(timer_tracker::gettime): New method.
(timer_create): Properly set errno on invalid timerid.  Use new
lock_timer_tracker method.
(timer_delete): Ditto.  Simplify code slightly.
(timer_gettime): New function.
(fixup_timers_after_fork): Reinit ttstart.
(getitimer): New implementation.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
* cygwin.din: Export timer_gettime.
* winsup.h: Remove has has_visible_window_station declaration.
* Makefile.in (DLL_OFILES): Add lsearch.o.
* cygthread.h (cygthread::notify_detached): New element.
(cygthread::cygthread): Take optional fourth argument signifying event to
signal on thread completion.
* cygthread.cc (cygthread::stub): Signal notify_detached event, if it exists.
(cygthread::cygthread): Initialize notify_detached from fourth argument.
(cygthread::detach): Wait for notify_detached field is present.
* lsearch.cc: New file.
* search.h: Ditto.
* include/cygwin/version.h: Bump API minor number to 126.
* cygwin.din: Export lsearch, lfind.
2005-03-27 01:57:38 +00:00
Christopher Faylor 6d89e9dd43 * include/ctype.h: New file.
* ctype.cc: Ditto.
* Makefile.in: Add ctype.o to DLL_OFILES.
* cygwin.din: Remove _ctype_ptr (for now?).
2005-03-23 17:11:24 +00:00
Christopher Faylor b1d9a0bd41 * Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.
* cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK.
(hook_chain): New struct.
(init_cygheap::hooks): Define new element.
* cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec.
* dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function.
* external.cc (cygwin_internal): Implement CW_HOOK.
* fork.cc (fork_child): Call fixup_hooks_after_fork.
* init.cc (cygwin_hmodule): Reinstate after a long absence.
* include/sys/cygwin.h: Define CW_HOOK.
* hookapi.cc: New file.
* select.cc (start_thread_socket): Add debugging output.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x accommodation.
* fhandler_socket.cc (fhandler_socket::connect): Make sure that err is
initialized.
2005-03-22 19:00:31 +00:00
Christopher Faylor 85a798d6e7 * cygthread.h (cygthread::terminate_thread): Reflect return value.
* cygthread.cc (cygthread::detach): Be more careful about ensuring that sigwait
is properly waited for to avoid later missynchronization.
(cygthread::terminate_thread): Return true if thread was actually terminated
and all handles were closed.
* fhandler_base.cc (fhandler_base::raw_read): Use signal_read_state rather than
raw calls to win32 api.
(fhandler_base::read): Ditto.
* fhandler.h (fhandler_pipe::fixup_after_exec): Use method to create read_state
signalling.
(fhandler_pipe::create): Ditto.
* Makefile.in: Make some more files -fomit-frame-pointer.
2005-02-06 05:04:34 +00:00
Corinna Vinschen 4875a4b66e * Makefile.in: Create libutil.a from bsdlib.o exports.
* bsdlib.cc (logwtmp): Move from syscalls.cc to here.
	(login): Ditto.
	(logout): Ditto.

	* winsup.h (EXPORT_ALIAS): New macro.
	* exec.cc: Define alias symbols using EXPORT_ALIAS macro.
	* syscalls.cc: Ditto.
	* times.cc: Ditto.
2004-09-10 08:30:51 +00:00
Christopher Faylor 894c677711 * Makefile.in (clean): Remove cygwin.def since it is autogenerated. 2004-07-20 15:52:33 +00:00
Christopher Faylor 3dcb399b58 * path.cc (is_unc_share): Remove redundant tests. 2004-05-04 15:09:58 +00:00
Corinna Vinschen 49294f009e * Makefile.in (EXTRALIBS): Add libtextreadmode.a.
(INSTOBJS): Add textreadmode.o.
	* textreadmode.c: New file.
2004-04-06 14:22:43 +00:00
Christopher Faylor 720c33ae4c * Makefile.in (clean): Clean libserver, too.
* fhandler.cc (fhandler_base::~fhandler_base): Remove path_conv cleanup.
* syscalls.cc (chroot): Ditto.
* path.cc (path_conv::~path_conv): Define new destructor.
(conv_path_list_buf_size): Remove explicit path_conv cleanup.
* path.h (path_conv::~path_conv): Declare new destructor.
2004-02-17 20:03:01 +00:00
Christopher Faylor 88e584bf43 * Makefile.in: Compile flock.o with -fomit-frame-pointer. 2004-02-17 15:23:29 +00:00
Christopher Faylor f6cd9c3555 * Makefile.in: Compile dlfcn.o with -fomit-frame-pointer. 2004-02-16 21:25:10 +00:00
Christopher Faylor 2c29523ece * Makefile.in: Compile delqueue.o with -fomit-frame-pointer. 2004-02-16 20:30:46 +00:00
Christopher Faylor 955bf2ee96 * Makefile.in: Compile syscalls.o with -fomit-frame-pointer.
* sigproc.cc: Eliminate unused variable.
2004-02-15 02:44:16 +00:00
Christopher Faylor edc4f86ad2 * Makefile.in (clean): Remove sigfe.s.
(sigfe.s): Ensure that sigfe.s will be regenerated if it does not exist.
* dll_init.cc (dll_dllcrt0): Simplify initializing tests.
* exceptions.cc (setup_handler): Detect when stub caller is either spinning or
has acquired the lock after being suspended to avoid windows problems with
suspending a win32 API call.
* cygtls.h (_cygtls::spinning): Declare new element.
* gendef: Remove unused _siglist_index and _siglist declaration.
(_sigfe): Set spinning element when potentially looping, waiting for lock.
(_sigbe): Ditto.
(_cygtls::lock): Ditto.
(_longjmp): Ditto.
* tlsoffsets.h: Regenerate.
* pinfo.cc (_pinfo::exit): Set final exit state here.  Call sigproc_terminate
if invoked with 'norecord'.  Clear any residual _cygtls stuff.
* winsup.h (exit_states): Define ES_FINAL.
* spawn.cc (spawn_guts): Don't call proc_terminate specifically when execing.
Let _pinfo::exit handle that case.
* sigproc.cc (wait_subproc): Always exit loop early when proc_loop_wait.
* init.cc (munge_threadfunc): Eliminate unused argument.
(dll_entry): Reflect above change in call to munge_threadfunc.
2004-02-13 19:34:32 +00:00
Christopher Faylor 6946073e78 * localtime.cc (localtime_r): Call tzset.
* Makefile.in: Make version.h/cygwin.din version check a warning since it is
not foolproof.
* cygheap.h (CYGHEAPSIZE): Bump size down.
* cygtls.h (_threadinfo::stacklock): New element.
(_threadinfo::pop): Make regparm.
(_threadinfo::lock): New function.
(_threadinfo::unlock): New function.
* cygtls.cc (_threadinfo::push): Wait for a lock on the stack before performing
the operation.
(_threadinfo::pop): Move to another file.
* cygwin.din: More SIGFE changes.
* exceptions.cc (try_to_debug): Always display messages on console.
(handle_exceptions): Unwind stack only when actually about to call sig_send.
(setup_handler): Lock stack prior to performing any operations.
* gendef (_sigfe): Ditto.
(_sigbe): Ditto.
(_threadinfo::pop): Ditto.  Move here.
* gen_tlsoffsets: Generate positive offsets.
* tlsoffsets.h: Regenerate.
2004-02-08 19:59:27 +00:00
Christopher Faylor c571716c64 * Makefile.in (DLL_OFILES): Add strsig.o.
* cygtls.h (_local_storage::signamebuf) New element.
* sysconf.cc (sysconf): Implement _SC_RTSIG_MAX.
* tlsoffset.h: Regenerate.
* include/limits.h (_POSIX_RTSIG_MAX): New define.
(RTSIG_MAX): Ditto.
* include/cygwin/signal.h (SIGRTMIN): New define.
(SIGRTMAX): Ditto.
(NSIG): Bump.
* strsig.cc: New file.
2004-02-03 21:59:27 +00:00
Christopher Faylor d795119cbe * sigproc.cc (sigproc_terminate): Don't close sendsig handle when execing since
we're not closing what we think we're closing.
(sig_send): Improve debugging when exiting due to no_signals_available.
* wincap.h (wincaps::cant_debug_dll_entry): New element.
* wincap.cc: Implement above element throughout.
* dcrt0.cc (initial_env): Accommodate changes necessary to allow initial
debugging for systems which do not allow debugging in dll_entry.
(dll_crt0_0): Add initial_env call back here.
* Makefile.in (install-man): Use mandir as target for installation.
* include/cygwin/version.h: Bump DLL minor number to 7 (should have been done
earlier).
2004-01-19 23:03:43 +00:00
Christopher Faylor f6936c48f3 * cygwin/include/signal.h: Add copyright notice.
* cygwin.din: Make clock SIGFE.  Add clock_gettime, sigwaitinfo, timer_create,
timer_delete, timer_settime.
* include/cygwin/version.h: Reflect above additions.
* fork.cc (fork_child): Call fixup_timers_after_fork.
* signal.cc (sigwait): Remove unused variable.
* timer.cc: New file.
(clock_gettime): Define new function.
(timer_tracker): Define new struct used by timer functions.
(timer_tracker::timer_tracker): New function.
(to_us): New function.
(timer_thread): New function.
(timer_tracker::settime): New function.
(timer_create): New function.
(timer_settime): New function.
(timer_delete): New function.
(fixup_timers_after_fork): New function.
* cygthread.cc: Bump thread count.
* signal.cc (sigwaitinfo): Define new function.
(sigwait): Redefine based on sigwaitinfo.
* include/cygwin/signal.h (sigwaitinfo): Declare.
(sigwait): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Avoid double close of ctty when
ctty == ctty_on_hold.
* cygtls.h (_threadinfo::threadkill): New element.
(_threadinfo::set_threadkill): Declare new function.
(_threadinfo::reset_threadkill): Declare new function.
* dcrt0.cc (dcrt0_1): Call here so that it will be possible to attach to
running process with #(*& Windows Me/9x.
(initial_env): Try to initialize strace if uninitialized.
* gendef: Don't zero signal if threadkill is set since that will happen in the
called function.
* signal.cc (sigwait): Ensure cleanup in error conditions.
* sigproc.cc (sig_send): Clear packet mask storage.
(wait_subproc): Fill in child exit code in siginfo_t structure.
* thread.cc (pthread_kill): Set threadkill flag.
* tlsoffsets.h: Regenerate.  Throughout, use siginfo_t to fill out all signal
information for "kernel" signals.
* cygtls.h (_threadinfo::set_siginfo): Declare new function.
* cygtls.cc (_threadinfo::set_siginfo): Define new function.
* dcrt0.cc (do_exit): Accommodate siginfo_t considerations.
* exceptions.cc (handle_exceptions): Ditto.
(sig_handle_tty_stop): Ditto.
(ctrl_c_handler): Use killsys() to send signal.
(sigpacket::process): Rename from sig_handle.  Use siginfo_t field from
sigpacket for everything.
(tty_min::kill_pgrp): Accommodate siginfo_t considerations.
(fhandler_termios::bg_check): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Use killsys() to send signal.
* signal.cc (kill_worker): Rewrite to use siginfo_t second argument.
(kill_pgrp): Ditto.
(kill0): Define new function pulled from kill().
(kill): Rewrite as frontend to kill0.
(killsys): Define new function.
* sigproc.cc (sigelem): Eliminate.
(sigpacket): Move to sigproc.h.  Subsume sigelem.
(pending_signals): Use sigpacket rather than sigelem for everything.
(sig_clear): Ditto.
(wait_sig): Ditto.
(sig_send): Rewrite to use siginfo_t argument.
(sig_send): New function wratpper to sig_send with siginfo_t argument.
(wait_subproc): Accommodate siginfo_t considerations.
* thread.cc (pthread_kill): Ditto.
* sigproc.h (sigpacket): Move here.
(sigpacket::process): Declare "new" function.
(sig_handle): Eliminate declaration.
(sig_send): Declare with new paramaters.
(killsys): Declare new function.
(kill_pgrp): Declare.
* winsup.h: Move some signal-specific stuff to sigproc.h.
* include/cygwin/signal.h: Tweak some siginfo_t stuff.
2004-01-19 05:46:54 +00:00
Christopher Faylor 2d1d1eb1e4 * cygtls.h (_threadinfo::call): Remove regparm declaration to work around
compiler bug.
* autoload.cc (TryEnterCriticalSection): Remove.
* dcrt0.cc (dll_crt0_0): Delete inappropriate setting of _my_tls.stackptr to
NULL since it has really bad consequences.  Make 'si' an automatic variable.
* cygtls.cc (_threadinfo::init_thread): Correct thinko which caused thread list
to be allocated every time.
* cygtls.h (CYGTLS_PADSIZE): Define as const int.
* sync.h: Make multiple inclusion safe.
(muto::next): Eliminate.
(muto::exiting_thread): New variable.
(muto::set_exiting_thread): New function.
(new_muto): Change to use different section for mutos since c++ give
inexplicable warning in some cases otherwise.
(new_muto1): Ditto.
* dcrt0.cc (do_exit): Call muto::set_exiting_thread here.
* sync.cc (muto_start): Eliminate.
(muto::acquire): Always give exiting thread a lock.  Never give thread a lock
if exiting.
(muto::release): Ditto for releasing.
* dtable.cc (dtable::init_lock): Unline function and define here.
* dtable.h (lock_cs): Define as a muto since critical sections seem to work
oddly on Windows Me.
(lock): Accommodate switch to muto.
(unlock): Ditto.
* exceptions.cc (setup_handler): Don't worry about acquiring mutos since that
hasn't mattered for a long time.
(signal_exit): Ditto: muto stuff will be handled automatically on exit now.
* Makefile.in (DLL_IMPORTS): Link advapi32 to ensure proper DLL initialization.
* autoload.cc (RegCloseKey): Arbitrarily choose this function as a "seed" to
pull the advapi32 link library in.  So, comment out the autoloading.
* cygtls.cc (_threadinfo::init_thread): Just clear CYGTLS_PADSIZE.
(_threadinfo::remove): Add debugging.
(_threadinfo::find_tls): Ditto.
* cygtls.h (_threadinfo::padding): Make zero length (for now?).
* dcrt0.cc (dll_crt0_0): Move more initialization here from dll_crt0_1.
(dll_crt0_1): See above.
* dtable.h (dtable::lock): Remove commented out critical section locking.
* dtable.h (dtable::init_lock): Remove commented out critical section locking.
* dtable.h (dtable::unlock): Remove commented out critical section locking.
* exceptions.cc (interruptible): bool'ize.
* init.cc (threadfunc_fe): Revert to storing threadfunc at stack bottom.
(munge_threadfunc): Ditto.  Avoid adding overhead to calibration_thread.
(prime_threads): Don't initialize tls stuff.
(dll_entry): Make minor change to initialization order.
* tlsoffsets.h: Regenerate.
* sigproc.cc (wait_sig): Add sanity check for end of process thread exit.
* select.h: Make minor formatting change.
* Makefile.in: Add still more -fomit-frame-pointer functions.
* dtable.h (dtable::lock): New function.
(dtable::unlock): New function.
(dtable::init_lock): New function.
* cygheap.h (HEAP_TLS): Declare new enum value.
(init_cygheap::threadlist): Declare new array.
(init_cygheap::sthreads): Declare new variable.
(cygheap_fdmanip::~cygheap_fdmanip): Use new dtable lock/unlock functions.
(cygheap_fdnew::cygheap_fdnew): Ditto.
(cygheap_fdget::cygheap_fdget): Ditto.
* dtable.cc (dtable_init): Initialize fdtab critical section.
(dtable::fixup_after_fork): Ditto.
(dtable::fixup_after_exec): Ditto.
(dtable::dup2): Use lock/unlock calls to protect access to fdtab.
(dtable::find_fifo): Ditto.
(dtable::fixup_before_fork): Ditto.
(dtable::fixup_before_exec): Ditto.
(dtable::set_file_pointers_for_exec): Ditto.
(dtable::vfork_child_dup): Ditto.
(dtable::vfork_parent_restore): Ditto.
* syscalls.cc (close_all_files): Ditto.
* sync.h (muto::acquired): Declare new function.
(new_muto1): Declare new macro used to specify name of muto storage.
* sync.cc (muto::acquired): Define new function.
* cygthread.cc (cygthread::stub): Remove signal chain removal call since it is
handled during initialization now.
* cygthread.cc (cygthread::simplestub): Remove signal chain removal call since
it is handled during initialization now.
* cygtls.cc (sentry): New class used for locking.  Use throughout.
(_threadinfo::reset_exception): Don't pop stack.
(_threadinfo::find_tls): Move from exceptions.cc.
(_threadinfo::init_thread): Initialize array of threads rather than linked
list.  Take second argument indicating thread function for this thread.
(_threadinfo::remove): Search thread array rather than linked list.  Use sentry
to lock.  Only unlock if we got the lock.
(_threadinfo::find_tls): Ditto for first two.
(handle_threadlist_exception): Handle exceptions when manipulating the thread
list in case of premature thread termination.
(_threadinfo::init_threadlist_exceptions): Ditto.
* cygtls.h (TLS_STACK_SIZE): Decrease size.
(_threadinfo::padding): Add element to avoid overwriting lower part of stack.
(_threadinfo::remove): Add a "wait" argument to control how long we wait for a
lock before removing.
* exceptions.cc (init_exception_handler): Make global.  Take argument to
control exception handler being set.
(ctrl_c_handler): Wait forever when removing self from signal chain.
(_threadinfo::find_tls): Move to cygtls.cc.
(sig_handle): Reorganize detection for thread-specific signals.
* heap.cc (heap_init): Rework slightly.  Make fatal error more verbose.  Remove
malloc initialization since it can't happen during dll attach.
* init.cc (search_for): Move address to search for on stack here.
(threadfunc_ix): Ditto for stack offset.  Make shared so that stack walk
potentially only has to be done once when cygwin processes are running.
(threadfunc_fe): Use standard tls to store thread function (may change back
later).
(calibration_thread): New function.  Potentially called to find threadfunc_ix.
(munge_threadfunc): Search for "search_for" value on stack.  Output warning
when thread func not found on stack.  Use standard tls to store thread
function.
(prime_threads): New function.  Called to prime thread front end.
(dll_entry): Call dll_crt0_0 here when DLL_PROCESS_ATTACH.  Call prime_threads
here.  Try to remove thread from signal list here.
* sigproc.cc (wait_sig): Initialize threadlist exception stuff here.
* thread.cc (pthread::exit): Pass argument to signal list remove function.
* thread.h: Remove obsolete *ResourceLock defines.
* tlsoffsets.h: Regenerate.
* winsup.h (spf): Define temporary debug macro to be deleted later.
* dcrt0.cc (dll_crt0_0): New function, called during DLL initialization.
Mainly consists of code pulled from dll_crt0_1.
(dll_crt0_1): See above.
(_dll_crt0): Wait for initial calibration thread to complete, if appropriate.
Move some stuff to dll_crt0_0.
(initialize_main_tls): Accommodate argument change to
_thread_info::init_thread.
* fork.cc (fork_child): Ditto.
(sync_with_child): Fix debug message.
* external.cc (cygwin_internal): Remove special considerations for
uninitialized dll since initialization happens during dll attach now.
* dlfcn.cc (dlopen): Remove obsolete *ResourceLock calls.
(dlclose): Ditto.
* cygheap.h (init_cygheap::close_ctty): Declare new function.
* cygheap.cc (init_cygheap::close_ctty): Define new function.
* syscalls.cc (close_all_files): Use close_ctty.
(setsid): Ditto.
* cygthread.cc (cygthread::stub): Remove exception initialization.
* cygthread.cc (cygthread::stub): Remove exception initialization.
(cygthread::simplestub): Ditto.
* thread.cc (pthread::thread_init_wrapper): Ditto.
* cygtls.cc (_last_thread): Make static.
(_threadinfo::call2): Initialize exception handler here.
(_threadinfo::find_tls): Move here.
* exceptions.cc (_threadinfo::find_tls): Move.
* dcrt0.cc (__api_fatal): Add prefix info to message here rather than including
it in every call to function.
* winsup.h (api_fatal): Accommodate above change.
* debug.cc (add_handle): Don't do anything if cygheap not around.
(mark_closed): Ditto.
* dll_init.cc (dll_list::detach): Fix debug output.
* fork.cc (sync_with_child): Ditto.
(vfork): Improve debug output.
* heap.cc (heap_init): Ditto.
* exceptions.cc (try_to_debug): Clarify message when debugger attaches.
2004-01-14 15:45:37 +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 af9ef8abb2 * Makefile.in: Change the way that -f options are appended to CFLAGS, slightly. 2003-12-03 00:21:21 +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
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 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 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
Corinna Vinschen 56a4ceac3d * Makefile.in (OBSOLETE_FUNCTION): Add tmpfile.
(NEW_FUNCTIONS): Add _tmpfile64 -> tmpfile translation.
	* cygwin.din: Export _tmpfile64
	* include/cygwin/version.h: Bump api minor number.
2003-10-27 13:06:56 +00:00
Corinna Vinschen e217832c4c * Makefile.in: Add $(LIBSERVER) rule.
* cygserver.h: Moved from include/cygwin to here.
	* cygserver_ipc.h: Moved from ../cygserver to here.
	* cygserver_shm.h: Ditto.
	* cygwin.din: Add shmat, shmctl, shmdt and shmget.
	* fhandler_tty.cc (fhandler_tty_slave::open): Don't warn about handle
	dup'ing if not build with USE_SERVER.
	* shm.cc: Include cygerrno.h unconditionally.
	(shmat): Set errno to ENOSYS and return -1 if not build with
	USE_SERVER.
	(shmctl): Ditto.
	(shmdt): Ditto.
	(shmget): Ditto.
	* woutsup.h: Remove.
	* include/cygwin/cygserver_process.h: Moved to ../cygserver directory.
	* include/cygwin/cygserver_transport.h: Ditto.
	* include/cygwin/cygserver_transport_pipes.h: Ditto.
	* include/cygwin/cygserver_transport_sockets.h: Ditto.
	* include/cygwin/version.h: Bump API minor number.
2003-10-22 10:07:59 +00:00
Christopher Faylor 0e1ba88882 * Makefile.in: Add YA method for generating devices.cc.
* child_info.h: YA update of another magic number.
* gendevices: New file.
* devices.in: New file.
* devices.cc: Regenerate.
* devices.shilka: Remove.
* devices.h: Correctly define device pointers.
(device): Remove now obsolete fields.
(device::native): Renamed from device::fmt.
* dtable.cc (build_fh_dev): Simplify in light of new unit parsing scheme.
(build_fh_pc): Ditto.
* path.cc (win32_device_name): Ditto.
* fhandler.h (fhandler_base::get_native_name): Reflect renaming of fmt to
native.
* fhandler_tty.cc (fhandler_tty_mster::init): Initialize slave device prior to
reporting unit.
2003-10-01 12:36:39 +00:00