Commit Graph

436 Commits

Author SHA1 Message Date
Christopher Faylor 8556456790 * include/pthread.h: Change PTHREAD_MUTEX_DEFAULT to PTHREAD_MUTEX_NORMAL.
Revert PTHREAD_MUTEX_INITIALIZER to PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
since that is actually closer to what linux does.
* thread.h (cw_cancel_action): New enum.
(cancelable_wait): Use cw_cancel_action as third argument.
* thread.cc (cancelable_wait): Ditto.  Don't wait for cancel if cancel_action
== cw_no_cancel.
(pthread::create): Don't wait for cancel event since that is racy.
(pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK.
(pthread_mutexattr::pthread_mutexattr): Ditto.
(pthread_mutex::_lock): Tell cancelable_wait not to wait for cancellation
event.
(semaphore::_timedwait): Accommodate change in cancelable_wait args.
(pthread::join): Ditto.
2005-06-11 04:56:36 +00:00
Corinna Vinschen 5680109cf6 * cygwin.din (imaxabs): Export.
(imaxdiv): Export.
	(llabs): Export.
	(lldiv): Export.
	(strtoimax): Export.
	(strtoumax): Export.
	* include/inttypes.h (imaxabs): Activate declaration.
	(imaxdiv): Ditto.
	(strtoimax): Ditto.
	(strtoumax): Ditto.
	* include/cygwin/version.h: Bump API minor.
2005-06-10 12:11:35 +00:00
Christopher Faylor 8891625cbf * include/pthread.h (PTHREAD_MUEXT_INITIALIZER): Change to
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP to be closer to linux default.
2005-06-09 15:30:44 +00:00
Christopher Faylor 31d0f220ad * include/machine/stdlib.h: New file. 2005-06-01 18:24:31 +00:00
Corinna Vinschen f330e7b8e8 * include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Always define. 2005-05-29 10:05:56 +00:00
Christopher Faylor 720c77ee72 * include/cygwin/version.h: Bump DLL minor number to 18. 2005-05-26 18:19:26 +00:00
Christopher Faylor 2a41ee9e0c * include/cygwin/version.h: Bump API minor number to 129. 2005-05-25 03:46:10 +00:00
Corinna Vinschen e0242a025a * include/stdint.h (INTMAX_C, UINTMAX_C): Fix definition. 2005-05-23 13:13:00 +00:00
Corinna Vinschen 89e5f7f81e * include/cygwin/in.h: Add comment. 2005-05-19 21:22:37 +00:00
Corinna Vinschen 58065cb805 * include/cygwin/in.h: Define IPPROTO_xxx values as macros to
accomodate SUSv3.
2005-05-19 21:18:17 +00:00
Christopher Faylor 8c509c0a11 fix comment 2005-05-19 20:37:51 +00:00
Christopher Faylor d63279febe fix comment 2005-05-19 20:34:42 +00:00
Christopher Faylor 776b73dd33 * include/limits.h: Include features.h, as on linux. 2005-05-19 19:45:28 +00:00
Christopher Faylor 071f64d934 * include/endian.h: New file. 2005-05-19 19:44:31 +00:00
Christopher Faylor 5c8e6fbd8c * include/sys/cygwin.h (enum cygwin_getinfo_types): Add CW_DEBUG_SELF.
* external.cc (cygwin_internal): Implement CW_DEBUG_SELF.
* init.cc (dll_entry): Minor rearrangement of code.
2005-05-17 01:21:06 +00:00
Christopher Faylor 66582dd6e7 * cygtls.cc (_cygtls::remove): Eliminate compiler warning.
* dir.cc (mkdir): Check path for writability.
(rmdir): Ditto.  Remove check for special directories.
* path.cc (path_conv::check): Set PATH_RO for virtual devices.  Set error if
read-only and asked for writability.
* path.h (pathconv_arg): Add PC_WRITABLE.
(path_types): Add PATH_RO.
(path_conv::isro): Add (currently unused) check for read-only filesystem.
Return "ENOSHARE" when we know a share doesn't exist.
* include/sys/mount.h: Add MOUNT_RO flag.
* autoload.cc (WNetGetResourceInformationA): Import.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual existence of
remote system rather than always assuming that it exists.
2005-05-13 03:21:39 +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 1cd8ccec87 * dcrt0.cc (get_cygwin_startup_info): New function pulled from dll_crt0_0.
(dll_crt0_0): Use get_cygwin_startup_info to retrieve cygwin-specific startup
pointer.
* external.cc (cygwin_internal): Implement CW_ARGV and CW_ENVP.
* include/sys/cygwin.h: Implement CW_ARGV and CW_ENVP.
2005-05-09 01:19:38 +00:00
Christopher Faylor 05726ddd86 white space and minor comment cleanup. 2005-05-02 03:50:11 +00:00
Christopher Faylor 0aedc5e99a * include/cygwin/version.h: Bump DLL minor number to 17. 2005-04-26 17:27:40 +00:00
Corinna Vinschen d02099f239 * cygwin.din (pselect): Export.
* select.cc (pselect): New function.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/select.h: Include signal.h.  Declare pselect.
2005-04-19 08:32:59 +00:00
Christopher Faylor 2180b9627d * include/cygwin/version.h: Bump DLL minor number to 16. 2005-04-18 17:25:04 +00:00
Christopher Faylor 06e18175e0 * fhandler.cc (fhandler::dup): Duplicate flags, too.
* fhandler.h (fhandler_fifo::owner): Eliminate.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk devices
better.
(fhandler_base::fstat_helper): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize obsolete
"owner".
(fhandler_fifo::open_not_mine): Add some debugging.  Duplicate correct handle
when we own it.
(fhandler_fifo::open): Set flags from input, not from first pipe.  Flag that
fork fixup is needed.
(fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
* pinfo.cc (commune_send): Add debugging for fifo.
* cygwin/version.h: Bump API minor version to 127 to reflect exporting of
sigrelese.
2005-04-16 05:20:01 +00:00
Corinna Vinschen 9d61c9a250 * syslog.cc: Include sys/socket.h.
(try_connect_guard): New static variable.
	(syslogd_inited): Ditto.
	(syslogd_sock): Ditto.
	(try_connect_syslogd): New function to connect and write syslog to
	local syslogd.
	(vsyslog): Log to stderr if LOG_PERROR flag has been given to openlog.
	Try logging to syslogd.  Use Event Log resp. log file as fallback.
	(closelog): Close socket to syslogd.
	* include/sys/syslog.h (_PATH_LOG): Define.
	(INTERNAL_NOPRI): Define if SYSLOG_NAMES is defined.
	(INTERNAL_MARK): Ditto.
	(struct _code): Ditto.
	(prioritynames): Ditto.
	(facilitynames): Ditto.
2005-04-07 20:16:46 +00:00
Christopher Faylor 5e679b1981 * include/cygwin/version.h: Bump DLL minor number to 15. 2005-04-02 21:22:52 +00:00
Corinna Vinschen 232fee428a * include/limits.h (NAME_MAX): New define.
(PATH_MAX): POSIX allows PATH_MAX to include trailing NUL.
2005-03-29 17:46:17 +00:00
Christopher Faylor 68d96be776 * include/ctype.h: Accommodate building in newlib. 2005-03-28 21:58:23 +00:00
Christopher Faylor dc000a8386 * cygthread.cc (cygthread::detach): Revert to just waiting for thred event
since waiting for anything else is racy.
* timer.cc (timer_tracker::hcancel): Rename from cancel.
(timer_tracker::cancel): New method.
(timer_tracker::th): Remove.
(timer_tracker::~timer_tracker): Call cancel method.
(timer_tracker::timer_tracker): Ditto.
(timer_tracker::timer_tracker): Always, clear cancel, even though it is
probably not strictly necessary for ttstart.
(timer_thread): Accommodate cancel -> hcancel rename.
(timer_tracker::settime): Ditto.
(timer_tracker::gettime): Ditto.
(timer_delete): Ditto.
* cygwin.din: Export _ctype_.
* include/ctype.h: Mark that _ctype_ is imported.
2005-03-28 19:31:23 +00:00
Christopher Faylor 255557f8c3 * timer.cc (nanosleep): Treat tv_sec < 0 as invalid.
* include/search.h: Make declarations consistent with newlib.
2005-03-27 02:31:33 +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 c6190209b3 * include/ctype.h: Always define macros when inside cygwin.
(isblank): New macro.
2005-03-23 21:04:00 +00:00
Christopher Faylor bc3f9e29d0 * include/cygwin/version.h: Change coment for most recent API version bump to
reflect new additions to the DLL and to remove change obsoleted by the previous
checkin.
2005-03-23 17:16:16 +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
Corinna Vinschen 3b5f210520 * cygwin.din (__ctype_ptr): Export.
* include/cygwin/version.h: Bump API minor version.
2005-03-22 11:37:55 +00:00
Corinna Vinschen d2428633a6 * mmap.cc (mmap64): Handle MAP_AUTOGROW flag.
(fhandler_disk_file::mmap): Ditto. Clean conditional for readability.
	* include/sys/mman.h: Add MAP_AUTOGROW flag.
	* include/cygwin/version.h: Bump API minor version.
2005-03-08 09:18:47 +00:00
Corinna Vinschen 6b76b0c5d4 * cygwin.din (utmpxname): Export.
* syscalls.cc (utmpxname): Create export alias to utmpname.
	* include/utmpx.h: Define ut_name and ut_xtime if not already defined.
	(utmpxname): Add prototype.
	* include/sys/utmp.h: Only define ut_name if not already defined.
	* include/cygwin/version.h: Bump API minor version.
2005-03-03 22:08:12 +00:00
Christopher Faylor b9b8c930c3 * include/cygwin/version.h: Bump DLL minor number to 14. 2005-03-01 20:20:45 +00:00
Corinna Vinschen c8b404bf5c * cygwin.din (getpeereid): Export.
* fhandler.h (class fhandler_socket): Add pipe and id members to
	exchange eid credentials for AF_LOCAL sockets.
	(eid_pipe_name): Declare new method.
	(getpeereid): Ditto.
	* fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method.
	(fhandler_socket::fhandler_socket): Initialize sec_pipe.
	(fhandler_socket::connect): Exchange eid credentials with accepting
	socket process.
	(fhandler_socket::listen): Prepare eid credential transaction.
	(fhandler_socket::accept): Exchange eid credentials with connecting
	socket process.
	(fhandler_socket::close): Close eid credentials pipe if open.
	(fhandler_socket::getpeereid): New method.
	* net.cc (cygwin_getsockopt): Add SO_PEERCRED handling.
	(getpeereid): New function.
	* include/asm/socket.h (SO_PEERCRED): Define.
	* include/cygwin/socket.h (struct ucred): Define new type.
	* include/cygwin/version.h: Bump API minor version.
2005-02-23 17:39:46 +00:00
Corinna Vinschen 81d0376064 * include/sys/statvfs.h (ST_RDONLY): Define.
(ST_NOSUID): Define.
2005-02-23 16:27:54 +00:00
Corinna Vinschen a652e6d52a * cygwin.din (fstatvfs): Export.
(statvfs): Export.
	* syscalls.cc: Include sys/statvfs.h.
	(statvfs): New function.  Move statfs functionality here.
	(fstatvfs): New function.
	(statfs): Just call statvfs and copy structure.  Check validity of
	incoming struct statfs pointer.
	* include/cygwin/types.h (fsblkcnt_t): Define.
	(fsfilcnt_t): Define.
	* include/cygwin/version.h: Bump API minor version.
	* include/sys/statvfs.h: New file.
2005-02-23 13:12:43 +00:00
Corinna Vinschen 24e8fc6872 * cygwin.din (basename): Export.
(dirname): Export.
	* path.cc (basename): New function.
	(dirname): New function.
	* include/libgen.h: New file.
	* include/cygwin/version.h: Bump API minor version.
2005-02-22 19:45:41 +00:00
Corinna Vinschen 9ba51f6d17 * include/cygwin/version.h: Fix comment. 2005-02-22 15:35:10 +00:00
Corinna Vinschen a62f6b806e * cygwin.din (fdatasync): Export.
* fhandler.cc (fhandler_base::fsync): Return with EINVAL if no
	handle is available.
	* syscalls.cc (fdatasync): Create export alias to fsync.
	* include/cygwin/version.h: Bump API minor version.
2005-02-22 15:30:09 +00:00
Corinna Vinschen b6bddccad6 * times.cc (timeval_to_filetime): Define first parameter const.
(utimes): Define second parameter to const according to SUSv3.
	(utime): Ditto.
	* include/sys/utime.h (utime) : Change declaration accordingly.
2005-02-08 20:59:41 +00:00
Corinna Vinschen 72c1491bba * cygwin.din: Export getpriority and setpriority.
* fork.cc (fork_parent): Copy parent's nice value into child.
	* spawn.cc (spawn_guts): Ditto.
	* miscfuncs.cc (winprio_to_nice): New function.
	(nice_to_winprio): Ditto.
	* pinfo.cc (pinfo_init): If parent is not a Cygwin process, set
	default nice value according to current Win32 priority class.
	* pinfo.h (class _pinfo): Add nice member.
	* syscalls.cc (setpriority): New function, only implementing
	PRIO_PROCESS for now.
	(getpriority): Ditto.
	(nice): Just call setpriority.
	* wincap.h (wincaps::has_extended_priority_class): New element.
	* wincap.cc: Implement above element throughout.
	* winsup.h: Add prototypes for winprio_to_nice and nice_to_winprio.
	* include/limits.h (NZERO): New define.
	* include/cygwin/types.h (id_t): New datatype.
	* include/cygwin/version.h: Bump API minor version.
	* include/sys/resource.h: Add PRIO_XXX defines and prototypes for
	getpriority and setpriority.
2005-01-25 22:45:11 +00:00
Christopher Faylor 85b3fb9640 * init.cc (dll_entry): Remove unused extern.
* include/sys/cygwin.h: Remove PID_ZOMBIE.
* pinfo.h: Rename EXITCODE_* defines.
(pinfo::set_exit_state): Remove parameter.
* pinfo.cc (set_exit_state): Remove parameter.  Reverse sense of test so that
exitcode is checked for having been set rather than not having been set.  Set
flag when exitcode has been established.  Don't set PID_STATE here.
(pinfo::init): Remove exitcode initialization.
(pinfo::exit): Reflect change in EXITCODE_* naming.  Set flag when exitcode has
been established.  Reflect change in arguments to set_process_state.
(proc_waiter): Reflect change in arguments to set_process_state.  Set
process_state here and only here.
* fhandler_process.cc (fhandler_process::fill_filebuf): Reflect removal of
PID_ZOMBIE define.
(format_process_stat): Ditto.
(format_process_status): Ditto.
* sigproc.cc (pid_exists): Ditto.
(stopped_or_terminated): Ditto.  Make sure that only low-order 16 bits of
exitcode are used.
* spawn.cc (spawn_guts): Reflect change in EXITCODE_* naming.
2005-01-16 17:00:27 +00:00
Corinna Vinschen 2ef89b220a * cygwin.din: Add utmpx symbols.
* syscalls.cc: Include utmpx.h.  Implement utmpx functions as stubs
	to utmp functions.
	(copy_ut_to_utx): New static function.
	(pututline): Change from void to struct utmp * as on Linux.
	(setutxent): New function.
	(endutxent): New function.
	(getutxent): New function.
	(getutxid): New function.
	(getutxline): New function.
	(pututxline): New function.
	* include/utmpx.h: New file.
	* include/cygwin/utmp.h: New file.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/utmp.h: Include cygwin/utmp.h.  Move stuff common with
	utmpx functionality there.
	(pututline): Declare struct utmp *.
2004-12-15 17:29:01 +00:00
Christopher Faylor 804cd111b4 * include/sys/strace.h: Don't output paranoid_printf by default. 2004-12-10 16:25:35 +00:00
Christopher Faylor 54dd79bb44 * sigproc.cc (mychild): Reimplement as list scan.
(proc_subproc): Don't mess with pinfo if it's myself.
* child_info.h (child_info_types): Label enum for _PROC constants.
(child_info::child_info): New constructor.
(child_info::~child_info): New destructor.
(child_info::sync): Declare new function.
(child_info_fork::child_info_fork): New constructor.
(child_info_spawn::child_info_spawn): Remove old constructor.
(child_info_spawn::child_info_spawn): New constructor.
* dcrt0.cc (dll_crt0_0): Use correct sizeof when doing sanity check on passed
in child_info.  Signal readiness to parent when not forking (and not spawning).
* fork.cc (sync_with_child): Delete.
(resume_child): Remove extra argument.
(sync_with_parent): Use child_info method to sync with parent.
(fork_child): Don't close fork_info->subproc_ready since that is now handled by
the destructor.
(fork_parent): Remove subproc_ready stuff.  Use child_info sync method for
waiting..  Set start time here for child.  Rename "forked" to "child".
(fork): Check ch.subproc_ready for validity here.
* pinfo.h (_pinfo::exec_sendsig): Temp storage for exec stub which may be
staying around to handle non-cygwin captive process.
(_pinfo::exec_dwProcessId): Ditto.
(_pinfo::_lock): Renamed from lock.
(_pinfo::lock): New method.
(_pinfo::unlock): Ditto.
(_pinfo::initialize_lock): Ditto.
* pinfo.cc (set_myself): Use initialize_lock method to initialize myself lock.
Set "exec" fields in _pinfo to zero to indicate that we've started
successfully.  Set start time here when appropriate.
(_pinfo::commune_send): Use pinfo lock/unlock methods.
(proc_waiter): Remove special case for non-cywin processes.  Reinstitute
handling for PID_NOCLDSTOP.
* sigproc.cc (proc_subproc): Set proper EAGAIN errno when process table is
filled.
(sig_send): Use exec_* fields from _pinfo for sending signals if the the _pinfo
sendsig never materializes.
(child_info::child_info): New constructor, renamed from init_child_info.
Zeroes child_info structure and sets appropriate fields in structure based on
chtype.
(child_info::~child_info): New destructor.  Closes subproc_ready if it exists.
(child_info_fork::child_info_fork): New constructor.
(child_info_spawn::child_info_spawn): New constructor.
(child_info::ready): New function.  Signals parent when child is ready.
(child_info::sync): New function.  Wait for child to signal us or process to
die.
(remove_proc): Remove closing of hProcess since this should now be handled
shortly after process creation.
* spawn.cc (spawn_guts): Use child_info_spawn constructor rather than
init_child_info.  Save exec_sendsig and exec_dwProcessId in execing _pinfo.
Rely on child_info constructor to properly set parent_wr_proc_pipe in ciresrv.
Revert to previous determination on whether to start a process in suspended
mode.  Remove reparenting stuff.  Just keep a stub around if starting a
non-cygwin process.
2004-12-05 19:41:26 +00:00