Commit Graph

92 Commits

Author SHA1 Message Date
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor 6e75c72b89 Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,
(mainly in fhandler*) start fixing gcc 4.7.2 mismatch between regparm
definitions and declarations.
* gendef: Define some functions to take @ declaration to accommodate _regN
defines which use __stdcall.
* gentls_offsets: Define __regN macros as empty.
* autoload.cc (wsock_init): Remove unneeded regparm attribute.
* winsup.h (__reg1): Define.
(__reg2): Define.
(__reg3): Define.
* advapi32.cc (DuplicateTokenEx): Coerce some initializers to avoid warnings
from gcc 4.7.2.
* exceptions.cc (status_info): Declare struct to use NTSTATUS.
(cygwin_exception::dump_exception): Coerce e->ExceptionCode to NTSTATUS.
* fhandler_clipboard.cc (cygnativeformat): Redefine as UINT to avoid gcc 4.7.2
warnings.
(fhandler_dev_clipboard::read): Ditto.
2013-01-21 04:34:52 +00:00
Corinna Vinschen 5d858e49eb * errno.cc (errmap): Map ERROR_LOCK_VIOLATION to EBUSY. 2013-01-18 16:09:51 +00:00
Christopher Faylor 0587c5ef4f * errno.cc (errmap): Keep sorted. 2012-08-14 18:38:22 +00:00
Christopher Faylor fee05a2380 * errno.cc (errmap): Keep sorted. 2012-08-14 14:56:19 +00:00
Christopher Faylor 2134b7a5b0 * errno.cc (errmap): Map ERROR_SXS_CANT_GEN_ACTCTX to ELIBBAD. 2012-08-13 19:33:17 +00:00
Christopher Faylor b9aa81491f Throughout, remove extra space after function name from debugging output.
Throughout, change syscalls to report on return values using new %R format
option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on return
values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use
shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
2011-12-03 21:43:27 +00:00
Christopher Faylor 4d046729d1 * errno.cc (EIO): Lowercase "o" representative string. 2011-06-15 17:36:10 +00:00
Christopher Faylor b86f999af1 whitespace elimination 2011-06-06 05:02:13 +00:00
Eric Blake 154fa4d7ef perror: fix POSIX compliance and work with recent newlib change
* cygtls.h (strerror_r_buf): New buffer.
* errno.cc (strerror): Move guts...
(_strerror_r): ...to new function demanded by newlib.
(strerror_r): Don't clobber strerror buffer.
(_user_strerror): Drop unused declaration.
* tlsoffsets.h: Regenerate.
2011-05-25 18:47:32 +00:00
Eric Blake 4d95630803 strerror: match recent glibc changes
* errno.cc (strerror): Print unknown errno as int.
(__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
2011-05-23 20:43:06 +00:00
Yaakov Selkowitz d470b53c98 * cygwin.din (error): Export.
(error_at_line): Export.
(error_message_count): Export.
(error_one_per_line): Export.
(error_print_progname): Export.
* errno.cc (error_message_count): Define.
(error_one_per_line): Define.
(error_print_progname): Define.
(_verror): New static function.
(error): New function.
(error_at_line): New function.
* posix.sgml (std-gnu): Add error, error_at_line.
* include/error.h: New header.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-18 01:25:41 +00:00
Corinna Vinschen e0b0b9e4ff * errno.cc (errmap): Sort. Map ERROR_EXE_MACHINE_TYPE_MISMATCH to
ENOEXEC.
2011-04-29 18:54:23 +00:00
Corinna Vinschen 86bf572ef0 * cygerrno.h (geterrno_from_nt_status): Declare.
* errno.cc (geterrno_from_nt_status): Define.
	* flock.cc: Fix copyright dates.
	* ntdll.h (enum _TIMER_TYPE): Define.
	(PTIMER_APC_ROUTINE): Define.
	(NtCancelTimer): Declare.
	(NtCreateTimer): Declare.
	(NtSetTimer): Declare.
	* posix_ipc.cc (ipc_cond_timedwait): Rewrite to make interruptible and
	restartable.  Call pthread_testcancel in case of timeout to enable
	pthread_cancel on waiting thread.  Replace WFMO timeout with waiting
	for a waitable timer.  Explain why.  Replace single call to WFMO with
	two calls, one for the event, one for the mutex.  Don't lock mutex in
	case of error.
	(ipc_cond_signal): Make void function.
	(ipc_cond_close): Ditto.
	(_mq_send): Immediately return -1 in case of error from
	ipc_cond_timedwait.
	(_mq_receive): Ditto.
2011-04-28 12:13:41 +00:00
Christopher Faylor 779ece3ce0 * errno.cc (errmap): Change mapping of NO_SYSTEM_RESOURCES to EFBIG.
* fhandler.cc (MAX_OVERLAPPED_WRITE_LEN): New constant.
(MIN_OVERLAPPED_WRITE_LEN): Ditto.
(fhandler_base_overlapped::close): Accommodate change in arguments to
wait_overlapped.
(fhandler_base_overlapped::setup_overlapped): Add __stdcall and regparm
modifiers.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::wait_overlapped): Modify to return an enum returning
various states.  Accept nonblocking parameter.
(fhandler_base_overlapped::read_overlapped): Add __stdcall and regparm
modifiers.  Rework to attempt to be smarter about reacting to states returned
by wait_overlapped.
(fhandler_base_overlapped::write_overlapped): Ditto.  Add fallback option for
when wait_overlapped detects that smaller chunks must be written.
(fhandler_base_overlapped::write_overlapped_fallback): Ditto.
* fhandler.h (DEFAULT_PIPEBUFSIZE): Move definition here from pipe.cc.
(fhandler_base::has_ongoing_io): Define with __stdcall and regparm modifiers.
(fhandler_base_overlapped::wait_return): New enum.
(fhandler_base_overlapped::max_atomic_write): New variable.
(fhandler_base_overlapped:: wait_overlapped): Accommodate changes mentioned
above to arguments and modifiers.
(fhandler_base_overlapped::setup_overlapped): Ditto for modifiers.
(fhandler_base_overlapped::read_overlapped): Ditto.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::fhandler_base_overlapped): Zero max_atomic_write.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Set max_atomic_write to the
size of the DEFAULT_PIPEBUFSIZE.
(fhandler_fifo::wait): Accommodate change in arguments to wait_overlapped.
* pipe.cc (fhandler_pipe::fhandler_pipe): Set max_atomic_write to the size of
the DEFAULT_PIPEBUFSIZE.
(fhandler_pipe::create_selectable): Allow minimum size of DEFAULT_PIPEBUFSIZE.
(DEFAULT_PIPEBUFSIZE): Delete here, move to fhandler.h.
2011-03-09 16:47:44 +00:00
Corinna Vinschen b7351dcfb1 * errno.cc (__xpg_strerror_r): Add accidentally missing condition. 2011-03-03 09:50:13 +00:00
Eric Blake 96b998db51 strerror_r: fix compilation bug in previous patch
* errno.cc (includes): Avoid compilation failure if <string.h>
settles on wrong strerror_r signature.
2011-02-10 20:25:54 +00:00
Eric Blake 3c9abad56b strerror_r: obey POSIX, and match newlib header change
* errno.cc (__xpg_strerror_r): New function.
(strerror_r): Update to copy newlib's fixes.
(strerror): Set errno on failure.
(_sys_errlist): Cause EINVAL failure for reserved values.
* cygwin.din: Export new function.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Combine
this into minor 236.
2011-02-10 17:36:51 +00:00
Corinna Vinschen 808aae3d13 * errno.cc (errmap): Add error codes for invalid binaries.
* exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
	from here.
	(execvpe): Ditto.
	* spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
	store in p_type_exec.  Call av::fixup with addtional p_type_exec
	argument.
	(spawnve): Check for filtered mode.
	(spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
	(av::fixup): Accept additional bool parameter p_type_exec.  Only check
	for script if p_type_exec is true.
	* winf.h (_P_PATH_TYPE_EXEC): Define.
	(_P_MODE): Define.
	(av::fixup): Declare with additional bool parameter.
2011-01-19 09:15:17 +00:00
Corinna Vinschen 3498f76deb * errno.cc (errmap): Map ERROR_BAD_NET_RESP to ENOSYS.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Handle ENOSYS and
	point to  the explanation.
	* ntdll.h (STATUS_NOT_IMPLEMENTED): Define.
	* path.cc (symlink_info::check): Handle the inability of NT4 to use
	FileNetworkOpenInformation on share root dirs in either direction.
	* path.h (slash_unc_prefix_p): Remove unused declaration.
	* security.cc (get_info_from_sd): Handle ENOSYS from get_file_sd.
	Explain when this happens.
2010-09-24 12:41:33 +00:00
Corinna Vinschen 7cdcd90ca1 * cygerrno.h (seterrno_from_nt_status): Declare.
(__seterrno_from_nt_status): Call seterrno_from_nt_status.
	* errno.cc (seterrno_from_win_error): Set errno without calling
	set_errno to avoid packing strace output with errno messages.
	(seterrno_from_nt_status): New function to print NT status as well as
	resulting Windows error.
2010-04-16 15:42:29 +00:00
Christopher Faylor fee56469d4 * errno.cc (errmap): Add mapping for ERROR_IO_INCOMPLETE.
* fhandler.cc (fhandler_base::fcntl): Fix comment.
(fhandler_base::wait_overlapped): Accept an optional len parameter.  Use the
len parameter when WriteFile fails with ERROR_IO_PENDING.  Make debug output
less alarming.
(fhandler_base::write_overlapped): Pass len to wait_overlapped.
* fhandler.h (fhandler_base::wait_overlapped): Add an optional argument
denoting the number of characters intended to be written.
* fhandler_tty.cc (fhandler_pty_master::close): Don't close archetype handles
when cygwin is still initializing since the handles aren't actually opened at
that point.
2009-06-14 23:42:09 +00:00
Corinna Vinschen 99438c631a * errno.cc (_sys_errlist): Add ESTRPIPE. 2009-03-15 13:46:56 +00:00
Corinna Vinschen 165cb24581 * Fix copyright dates. 2009-01-16 12:17:28 +00:00
Corinna Vinschen b98c66ee2c * errno.cc (errmap): Set errno to ENOENT instead of ENOSHARE throughout.
* path.cc (path_conv::check): Set to and check for ENOENT instead of
	ENOSHARE.

	* path.cc (symlink_info::check): Fix Samba 3.2.x comment.
2009-01-11 16:13:11 +00:00
Eric Blake ddf8700121 * errno.cc (_sys_errlist): Add ECANCELED, ENOTRECOVERABLE, EOWNERDEAD. 2008-09-19 23:29:24 +00:00
Christopher Faylor c4ca0e800a * cygwin.din (sys_sigabbrev): Add this here.
* dcrt0.cc (__argc,__argv,_check_for_executable): Remove dllexport decoration
since it is already handled in cygwin.din.
* errno.cc (_sys_errlist): Ditto.
* strsig.cc (sys_sigabbrev): Ditto.
* include/cygwin/signal.h: Protect use of dllimport when __INSIDE_CYGWIN__.
* libc/getopt.c: Revert previous changes.  Define __INSIDE_CYGWIN__.
2008-09-11 06:22:31 +00:00
Corinna Vinschen 9a51257715 Change length for domain buffers from INTERNET_MAX_HOST_NAME_LENGTH to
MAX_DOMAIN_NAME_LEN throughout.
	* cyglsa.h (CYG_LSA_MAGIC): New value.
	(cyglsa_t): Define username and domain as WCHAR arrays.
	* errno.cc (errmap): Add mapping for ERROR_NONE_MAPPED.
	* sec_auth.cc: Drop 'w' prefix from WCHAR string variable names where
	appropriate.
	(extract_nt_dom_user): Prefer resolving by SID before resolving by
	domain\name pair.
	(cygwin_logon_user): Don't print cleartext password in debug output.
	Change comment.
	(get_user_groups): Revert calls to LookupAccountNameW to use NULL
	server instead of explicit server name, according to MSDN.
	(get_user_local_groups): Ditto.
	(get_server_groups): Fetch domain and user name from usersid per
	LookupAccountSidW instead of calling extract_nt_dom_user.
	(lsaauth): Fetch domain and user name from usersid per LookupAccountSidW
	instead of calling extract_nt_dom_user.
	* sec_helper.cc (cygpriv): Convert to wchar_t pointer array.
	(privilege_luid): Convert first parameter to  PWCHAR.
	(privilege_name): Return wchar_t pointer.
	(set_privileges): Accommodate debug output.
	* security.h (privilege_luid): Change prototype accordingly.
2008-07-11 10:00:36 +00:00
Christopher Faylor b13e6864f5 Remove unneeded header files from source files throughout. 2008-04-07 18:45:59 +00:00
Corinna Vinschen a7d2cc16e2 * Fix copyright dates. 2008-04-01 13:22:47 +00:00
Corinna Vinschen 50450dcc5f * Makefile.in (DLL_OFILES): Add ntea.o.
* cygwin.din (getxattr, listxattr, removexattr, setxattr, lgetxattr,
	llistxattr, lremovexattr, lsetxattr, fgetxattr, flistxattr,
	fremovexattr, fsetxattr): Export Linux extended attribute functions.
	Sort.
	* errno.cc (errmap): Add mappings for ERROR_EAS_DIDNT_FIT,
	ERROR_EAS_NOT_SUPPORTED, ERROR_EA_LIST_INCONSISTENT,
	ERROR_EA_TABLE_FULL, ERROR_FILE_CORRUPT, ERROR_INVALID_EA_NAME.
	* fhandler.h (class fhandler_base): Declare new fgetxattr and
	fsetxattr methods.
	(class fhandler_disk_file): Ditto.
	* fhandler.cc (fhandler_base::fgetxattr): New method.
	(fhandler_base::fsetxattr): New method.
	* fhandler_disk_file.cc (fhandler_disk_file::fgetxattr): New method.
	(fhandler_disk_file::fsetxattr): New method.
	* ntdll.h (STATUS_EA_TOO_LARGE): Define.
	(STATUS_NONEXISTENT_EA_ENTRY): Define.
	(STATUS_NO_EAS_ON_FILE): Define.
	* ntea.cc (read_ea): Rewrite for long pathnames and for using with
	Linux extended attribute functions.
	(write_ea): Ditto.
	(getxattr_worker): New static function.
	(getxattr): New function.
	(lgetxattr): New function.
	(fgetxattr): New function.
	(listxattr): New function.
	(llistxattr): New function.
	(flistxattr): New function.
	(setxattr_worker): New static function.
	(setxattr): New function.
	(lsetxattr): New function.
	(fsetxattr): New function.
	(removexattr): New function.
	(lsetxattr): New function.
	(fsetxattr): New function.
	* security.h (read_ea): Change declaration according to above changes.
	(write_ea): Ditto.
	* include/cygwin/version.h: Bump API minor version.
2008-02-10 15:43:04 +00:00
Christopher Faylor d6b1ac7faa * environ.cc (build_env): Don't put an empty environment variable into the
environment.  Optimize use of "len".
* errno.cc (ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.
2006-09-07 20:42:53 +00:00
Corinna Vinschen 6c22c79f73 * errno.cc (errmap): Map ERROR_SEEK and ERROR_SECTOR_NOT_FOUND. 2005-09-26 15:27:15 +00:00
Christopher Faylor 67483cb2cd * dcrt0.cc (do_exit): Rely on sigproc_terminate to set exit_state
appropriately.
* pinfo.cc (pinfo::exit): Always call sigproc_terminate here.  Rely on
sigproc_terminate to signal signal thread to handle eventual process exit.
* sigproc.cc (no_signals_available): Change criteria for determining if this
process can handle signals to itself.
(my_sendsig): New variable.  Copy of my sendsig handle.
(proc_can_be_signalled): Don't send signals if exit code is set.
(sigproc_terminate): Use and set exit_state appropriately to determine when to
do anything.  Send __SIGEXIT to self to control process exit.
(sig_send): Use my_sendsig for sending signals.  Don't call
proc_can_be_signalled for myself since the criteria is now different for
sending signals to myself.
(wait_sig): Copy myself->sendsig to my_sendsig for future use.  Exit signal
loop when __SIGEXIT is received.  Wait for main thread to exit and use its exit
status to actually exit process.
* sigproc.h (__SIGEXIT): New enum.
* dcrt0.cc (alloc_stack): Eliminate superfluous "return;".
* debug.cc (add_handle): Ditto.
* devices.in (device::parse): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
(dtable::vfork_child_fixup): Ditto.
* environ.cc (parse_options): Ditto.
* errno.cc (seterrno_from_win_error): Ditto.
* exceptions.cc (sig_handle_tty_stop): Ditto.
(set_signal_mask): Ditto.
* fhandler.cc (fhandler_base::read): Ditto.
(fhandler_base::operator delete): Ditto.
(fhandler_base::seekdir): Ditto.
(fhandler_base::rewinddir): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::fixup_after_exec): Ditto.
* sigproc.cc (sigproc_init): Ditto.
(sigproc_terminate): Ditto.

* devices.cc: Regenerate.
2005-09-13 17:08:54 +00:00
Christopher Faylor 453185b136 * cygwin.din: Correct readdir_r typo. 2005-08-28 17:30:34 +00:00
Christopher Faylor b4b0980b9d * errno.cc (errmap): Translate ERROR_NO_MORE_ITEMS to ENMFILE. 2005-08-25 15:27:10 +00:00
Corinna Vinschen d71805725f * errno.cc (strerror): Check errnum for underflow. 2005-08-18 08:35:19 +00:00
Christopher Faylor f82ca06eda * spawn.cc (find_exec): Accept a PATH-like string in place of an environment
variable.
* dlfcn.cc (get_full_path_of_dll): Search /usr/bin (for windows compatibility)
and /usr/lib (for UNIX compatibility) when looking for shared libraries.
* environ.cc (conv_envvars): Put back LD_LIBRARY_PATH since it is used by
get_full_path_of_dll().
* errno.cc (errmap): Map MOD_NOT_FOUND to ENOENT.
* cygmagic: Remove debugging cruft.
2005-05-22 03:54:29 +00:00
Christopher Faylor 06e0dc9a46 * errno.cc (errmap): Sort table. 2005-04-30 04:10:39 +00:00
Christopher Faylor 7b076c36fc * errno.cc (errmap): Map ERROR_NETNAME_DELETED to ENOSHARE. 2005-04-30 03:40:26 +00:00
Corinna Vinschen 12a410132d * errno.cc (NO_SYSTEM_RESOURCES): Map to EAGAIN.
(NONPAGED_SYSTEM_RESOURCES): Ditto.
	(PAGED_SYSTEM_RESOURCES): Ditto.
	(WORKING_SET_QUOTA): Ditto.
	(PAGEFILE_QUOTA): Ditto.
	(COMMITMENT_LIMIT): Ditto.
2005-03-30 22:07:20 +00:00
Christopher Faylor 12f9fb4972 * timer.cc (timer_tracker::timer_tracker): Eliminate simple constructor.
(ttstart): Fully initialize.
* errno.cc: Fix typo introduced in previous change.
2005-03-28 18:06:49 +00:00
Christopher Faylor 64443bd47e * errno.cc (FILENAME_EXCED_RANGE): Map to ENAMETOOLONG. 2005-03-28 16:57:13 +00:00
Christopher Faylor a53953b070 * errno.cc (errmap): Correct typo in previous change. 2005-03-16 01:00:05 +00:00
Christopher Faylor 9d387e73b8 * cygtls.cc (_cygtls::remove): Free process_ident, if it exists.
* errno.cc (errmap): ERROR_DISK_CORRUPT -> EIO.
2005-03-15 21:58:44 +00:00
Christopher Faylor 731028b326 copyright 2005-02-20 04:25:33 +00:00
Christopher Faylor 2380dfe14c * pinfo.h (_pinfo::set_exit_state): Declare new function.
(pinfo::exit): Move here from _pinfo::exit.
* sigproc.cc (child_info::sync): Use new function to set exitcode and
process_state.
* pinfo.cc (_pinfo::exit): Ditto.
(proc_waiter): Ditto.
(_pinfo::set_exit_state): Define new function.
(_pinfo::dup_proc_pipe): Close handle when there is no parent process around to
care about the exit value.
* dcrt0.cc (dll_crt0_0): Move subproc_ready synchronization later to make sure
that myself is still mapped in parent.
(do_exit): Reflect movement to pinfo::exit.
(__api_fatal): Ditto.
* exceptions.cc (signal_exit): Ditto.
* errno.cc (errmap): Map PROC_NOT_FOUND.
* init.cc (dll_entry): Release myself before exiting.
* sigproc.cc (proc_can_be_signalled): Set errno appropriately.
(sig_send): Ditto.  Also remove ill-advised test for !myself->sendsig since
this is an indication of a process which is still initializating -- it is not
an error.
(child_info::sync): Don't set exitcode here.  Assume that will happen in
proc_waiter, if necessary.
* spawn.cc (spawn_guts): Delay "wait_for_myself" logic until later.  Don't wait
at all if the process has already exited.  Reflect movement to pinfo::exit.
2005-01-11 15:31:04 +00:00
Corinna Vinschen aee05403d1 * errno.cc (errmap): Map ERROR_INVALID_ADDRESS to EINVAL instead of
EOVERFLOW.
2004-12-10 17:43:00 +00:00
Corinna Vinschen b9188d6c1e * errno.cc (_sys_errlist): Change various text to their english Linux
counterparts.  Unify layout.
	(strerror): Remove switch statement.
2004-08-19 18:26:58 +00:00
Corinna Vinschen 3410b5be3e * errno.cc (errmap): Add ERROR_TOO_MANY_LINKS -> EMLINK mapping.
* syscalls.cc (link): Only copy files if FS doesn't support hard links.
2004-08-03 14:37:26 +00:00