Commit Graph

935 Commits

Author SHA1 Message Date
Yaakov Selkowitz d6aa3abb4f * common.din (stime): Export.
* times.cc (stime): New function.
* include/cygwin/time.h (stime): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-22 19:03:02 +00:00
Corinna Vinschen 1db937e986 * Makefile.in (DLL_OFILES): Add quotactl.o.
* common.din (quotactl): Export.
	* ntdll.h: Define FILE_FS_CONTROL_INFORMATION::FileSystemControlFlags
	flag values.
	(struct _FILE_FS_CONTROL_INFORMATION): Define.
	(struct _FILE_GET_QUOTA_INFORMATION): Define.
	(typedef struct _FILE_QUOTA_INFORMATION): Define.
	(NtQueryObject): Use PVOID rather than VOID*.
	(NtQueryVolumeInformationFile): Ditto.
	(NtQueryQuotaInformationFile): Declare.
	(NtSetQuotaInformationFile): Declare.
	(NtSetVolumeInformationFile): Declare.
	* quotactl.cc: New file implementing quotactl().
	* include/sys/mount.h (BLOCK_SIZE): Define.
	(BLOCK_SIZE_BITS): Define.
	* include/sys/quota.h: New header.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-17 08:19:27 +00:00
Corinna Vinschen 697b9afe00 Add setsockopt(sd, SOL_SOCKET, SO_PEERCRED, NULL, 0) to disable
initial handshake on AF_LOCAL sockets.
	* fhandler.h (class fhandler_socket): Add no_getpeereid status flag.
	(fhandler_socket::af_local_set_no_getpeereid): New prototype.
	* fhandler_socket.cc (fhandler_socket::af_local_connect): Skip handshake
	if no_getpeereid is set.  Add debug output.
	(fhandler_socket::af_local_accept): Likewise.
	(fhandler_socket::af_local_set_no_getpeereid): New function.
	(fhandler_socket::af_local_copy): Copy no_getpeereid.
	(fhandler_socket::getpeereid): Fail if no_getpeereid is set.
	* net.cc (cygwin_setsockopt): Add SO_PEERCRED for AF_LOCAL/SOCK_STREAM
	sockets.  Add comment to explain why we need it.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-11 18:28:04 +00:00
Corinna Vinschen d326f841c3 * common.din (ffsl): Export.
(ffsll): Export.
	* syscalls.cc (ffs): Implement using GCC intrinsic.
	(ffsl): Ditto.
	(ffsll): Ditto.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-08 21:03:40 +00:00
Corinna Vinschen 1a33a5c6d3 * fhandler.cc (fhandler_base::facl): Drop CLASS_OBJ entry.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Ditto in noacl case.
	* sec_acl.cc (getacl): Compute useful fake CLASS_OBJ and DEF_CLASS_OBJ
	permission bits based on how these values are generated on Linux.
	Add commants to explain what the code is doing.
	* security.cc (get_attribute_from_acl): Compute group permission based
	on the actual primary group permissions and all secondary user and group
	ACCESS_ALLOWED_ACEs to emulate Linux' behaviour more closely.
	(check_access): Fix typos im comment.
	* include/cygwin/acl.h (MIN_ACL_ENTRIES): Redefine as 3.
2014-08-28 12:38:52 +00:00
Corinna Vinschen 0d45f7ee54 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 33.
(CYGWIN_VERSION_API_MINOR): Bump to reflect intermediate 1.7.32 release.
2014-08-13 17:38:47 +00:00
Yaakov Selkowitz f9c956a1ff * common.din (__cxa_finalize): Export.
* dcrt0.cc (cygwin_atexit): Use d->handle with __cxa_atexit.
* dll_init.cc (dll_list::detach): Use d->handle with __cxa_finalize.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Use 274 for
__cxa_finalize as well.
2014-08-07 16:25:06 +00:00
Corinna Vinschen 0b20d00bf3 * include/sys/file.h: Add extern "C". 2014-08-06 08:46:12 +00:00
Corinna Vinschen 79131d442e * common.din (__cxa_atexit): Export.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump to 274.
2014-08-04 16:52:04 +00:00
Eric Blake 9067d19b9a headers: properly decorate attributes
As pointed out here:
https://cygwin.com/ml/cygwin/2014-07/msg00371.html

any use of __attribute__ in a header that can be included by a user
should be namespace-safe, by decorating the attribute arguments with __
(while gcc does a lousy job at documenting it, ALL attributes have a __
counterpart, precisely so that public headers can use attributes without
risk of collision with macros belonging to user namespace).

* include/pthread.h: Decorate attribute names with __, for
namespace safety.
* include/cygwin/core_dump.h: Likewise.
* include/cygwin/cygwin_dll.h: Likewise.
* include/sys/cygwin.h: Likewise.
* include/sys/strace.h: Likewise.
2014-08-01 15:48:37 +00:00
Corinna Vinschen 7cc124b0e5 bump to 32 2014-07-21 11:08:07 +00:00
Corinna Vinschen 2f84de1ff5 * thread.cc (pthread::create): Handle stackaddr as upper bound address.
Add comment.
	(pthread_attr_setstack): Store upper bound address in stackaddr.
	Explain why.
	(pthread_attr_getstack): Handle stackaddr as upper bound address.
	Add comment.
	(pthread_attr_setstackaddr): Add comment.
	(pthread_attr_getstackaddr): Add comment.
	(pthread_attr_getstacksize): Return default stacksize if stacksize has
	not been set by the application, just as on Linux.  Add comment.
	(pthread_getattr_np): Store upper bound address in stackaddr.  Explain
	why.
	* include/pthread.h: Remove outdated comment.
	(pthread_attr_getstackaddr): Mark as deprecated, as on Linux.
	(pthread_attr_setstackaddr): Ditto.
2014-07-16 10:21:18 +00:00
Corinna Vinschen 50e4a3cdff Fix typo 2014-07-15 08:45:10 +00:00
Corinna Vinschen 4866e86cb1 * thread.cc (pthread_mutex::pthread_mutex): Change default type
to PTHREAD_MUTEX_NORMAL.
	(pthread_mutex::unlock): Return EPERM if the mutex has no owner and
	the mutex type is PTHREAD_MUTEX_ERRORCHECK, as on Linux.
	(pthread_mutexattr::pthread_mutexattr): Ditto.
	(pthread_mutex_unlock): Do not fail if mutex is a normal mutex
	initializer.
	* include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Redefine as
	PTHREAD_NORMAL_MUTEX_INITIALIZER_NP.
2014-07-14 09:42:15 +00:00
Corinna Vinschen a25a812338 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 31. 2014-05-19 14:31:08 +00:00
Corinna Vinschen 2d0cb1acc7 * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump to 273. 2014-05-15 11:24:42 +00:00
Corinna Vinschen 076a61f0d9 * external.cc (cygwin_internal): Implement CW_CYGNAME_FROM_WINNAME.
Add lengthy comment to explain what we do and why.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add
	CW_CYGNAME_FROM_WINNAME.
2014-05-15 11:16:28 +00:00
Corinna Vinschen 3d6a6ba138 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 30. 2014-04-10 19:20:49 +00:00
Corinna Vinschen 29b7313d22 * cygheap.h (enum cygheap_pwdgrp::cache_t): Remove.
(cygheap_pwdgrp::caching): Convert to bool.
	(cygheap_pwdgrp::pwd_cache): Add cygserver member.
	(cygheap_pwdgrp::grp_cache): Ditto.
	(cygheap_pwdgrp::nss_db_caching): Drop.
	(cygheap_pwdgrp::nss_db_full_caching): Drop.
	(cygheap_pwdgrp::nss_cygserver_caching): New method.
	(cygheap_pwdgrp::nss_disable_cygserver_caching): New method.
	* cygserver.h (client_request::request_code_t): Add
	CYGSERVER_REQUEST_PWDGRP.
	* cygserver_pwdgrp.h: New file.
	* cygtls.h (struct _local_storage): Remove pwbuf and grbuf members.
	* grp.cc (pwdgrp::prep_tls_grbuf): Drop.
	(internal_getgrsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getgrnam): Ditto.
	(internal_getgrgid): Ditto.
	(gr_ent::enumerate_caches): Handle cygserver cache.
	* passwd.cc (pwdgrp::prep_tls_pwbuf): Drop.
	(internal_getpwsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getpwnam): Ditto.
	(internal_getpwuid): Ditto.
	(pw_ent::enumerate_caches): Handle cygserver cache.
	* pwdgrp.h (pwdgrp::add_account_from_cygserver): New method declaration.
	(pwdgrp::fetch_account_from_cygserver): New method declaration.
	(pwdgrp::prep_tls_pwbuf): Drop declaration.
	(pwdgrp::prep_tls_grbuf): Drop declaration.
	(pwdgrp::add_user_from_cygserver): New inline methods.
	(pwdgrp::add_group_from_cygserver): New inline methods.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
	* uinfo.cc (internal_getlogin): Call internal_getgroups if cygserver
	caching is not available.
	(cygheap_pwdgrp::init): Initialize pwd_cache.cygserver and
	grp_cache.cygserver.  Set caching to true.
	(cygheap_pwdgrp::nss_init_line): Drop db_cache handling entirely.
	(pwdgrp::add_account_from_windows): Drop no caching handling.
	(client_request_pwdgrp::client_request_pwdgrp): New method.
	(pwdgrp::fetch_account_from_cygserver): New method.
	(pwdgrp::add_account_from_cygserver): New method.

	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix formatting.
	* include/sys/cygwin.h: Ditto.
2014-03-12 17:36:56 +00:00
Corinna Vinschen 8861a80ee8 * include/cygwin/socket.h (IPV6_JOIN_GROUP): Revert.
(IPV6_LEAVE_GROUP): Ditto.
2014-03-12 09:44:33 +00:00
Corinna Vinschen 512ecab4a8 * include/cygwin/config.h (__TM_GMTOFF): Define.
(__TM_ZONE): Define.
2014-03-05 12:50:29 +00:00
Corinna Vinschen 27afe3a4ab * localtime.cc: Define TM_GMTOFF and TM_ZONE based on __TM_GMTOFF and
__TM_ZONE being defined.  Throughout, write to these struct tm members
	only if CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS is true.
	* libc/strptime.cc: Ditto.
	* include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS):
	Define.
	(CYGWIN_VERSION_API_MINOR): Bump to 272.
2014-03-05 12:45:49 +00:00
Corinna Vinschen b211f4c17e * external.cc (cygwin_internal): Add cases for CW_GETNSSSEP,
CW_GETPWSID and CW_GETGRSID.
	* grp.cc (internal_getgrsid_from_db): New function.
	* passwd.cc (internal_getpwsid_from_db): New function.
	(pg_ent::setent): Add special case for call from mkpasswd/mkgroup.
	* pwdgrp.h (internal_getpwsid_from_db): Declare.
	(internal_getgrsid_from_db): Declare.
	(enum nss_enum_t): Move to include/sys/cygwin.h.
	(class pg_ent): Add comment.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Fix typo in comment.
	Change "UNIX" to "Unix" in domain name.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GETNSSSEP,
	CW_GETPWSID and CW_GETGRSID.
	(enum nss_enum_t): Define here.
2014-02-22 19:38:12 +00:00
Corinna Vinschen 036f56cf32 * external.cc (cygwin_internal): Handle new CW_SETENT, CW_GETENT and
CW_ENDENT info types.
	* grp.cc (setgrent_filtered): New function, called from cygwin_internal.
	(getgrent_filtered): Ditto.
	(endgrent_filtered): Ditto.
	* passwd.cc (pg_ent::setent): Set state explicitely to from_cache.
	(pg_ent::getent): Handle the fact that a DC has no SAM and enumerating
	local accounts is equivalent to enumerating domain accounts.
	(setpwent_filtered): New function, called from cygwin_internal.
	(getpwent_filtered): Ditto.
	(endpwent_filtered): Ditto.
	* pwdgrp.h (setpwent_filtered): Declare.
	(getgrent_filtered): Ditto.
	(endgrent_filtered): Ditto.
	(setpwent_filtered): Ditto.
	(getpwent_filtered): Ditto.
	(endpwent_filtered): Ditto.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_SETENT, CW_GETENT,
	and CW_ENDENT.
2014-02-18 19:39:48 +00:00
Corinna Vinschen abbe1f5320 * fhandler_disk_file.cc (fhandler_disk_file::fchown): Fix typo in
comment.
	* mount.cc (mount_info::from_fstab): Use tmp_pathbuf rather than
	stack for big local buffer.
	* net.cc (cygwin_gethostname): Call GetComputerNameExA rather than
	GetComputerNameA if gethostname failed.
	* shared.cc (user_info::initialize): Fix formatting.
	* include/sys/file.h: Define flock and accompanying macros if not
	already defined in sys/_default_fcntl.h.
2014-02-06 20:38:35 +00:00
Corinna Vinschen f3852ab7db * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 29. 2014-02-04 16:32:04 +00:00
Corinna Vinschen 01f05a28c8 * include/cygwin/in6.h (struct ipv6_rt_hdr): Define.
* include/cygwin/socket.h: Fix formatting.
	(IP_UNICAST_IF): Define.
	(IPV6_JOIN_GROUP): Remove Windowism.
	(IPV6_LEAVE_GROUP): Ditto.
	(IPV6_UNICAST_IF): Define.
	(IPV6_TCLASS): Ditto.
	(IPV6_RECVTCLASS): Ditto.
2014-01-20 17:25:54 +00:00
Corinna Vinschen 3228065cea * include/netinet/ip6.h: New file, copied from FreeBSD vebatim. 2014-01-18 11:37:55 +00:00
Corinna Vinschen 92a8ea56e5 * include/sys/file.h (LOCK_SH): Drop definition in favor of new
definitions in newlib.
	(LOCK_EX): Ditto.
	(LOCK_NB): Ditto.
	(LOCK_UN): Ditto.
	(flock): Ditto.
	(F_OK): Drop.  Already correctly defined in unistd.h.
	(X_OK): Ditto.
	(W_OK): Ditto.
	(R_OK): Ditto.
2014-01-17 11:01:46 +00:00
Corinna Vinschen 5780e35aa3 * include/cygwin/config.h (_STDIO_BSD_SEMANTICS): Define as 1. 2014-01-17 10:56:25 +00:00
Christopher Faylor 13621d2ef8 * external.cc (fillout_pinfo): Remove nonsensical loop.
* fork.cc (frok::parent): When initializing pinfo for child new PID_NEW flag +
actual defined constant rather than raw number.  Don't set start_time here.
* pinfo.cc (pinfo::thisproc): Use PID_NEW when initializing pinfo.  Avoid
checking h for NULL multiple times.  Don't set start_time here.
(pinfo_init): Aways set ppid last.  Tweak strace output.
(pinfo::init): Handle new PID_NEW flag.  Wait for shared memory to contain
useful information.  Set start_time if PID_NEW.
(_onreturn:h): Define as HANDLE rather than HANDLE *.
(_onreturn::~onreturn): Accommodate h definition change.
(_onreturn::no_close_handle): Rename from no_close_p_handle.  Take a pinfo arg
and set hProcess to h before zeroing.
(winpids::add): Don't open a handle to our own process.  Change logic
associated with when a handle gets closed.  Accommodate no_close_handle
changes.
(winpids::enum_processes): Simplify process enumeration loop.
(winpids::set): Eliminate ill-considered malloc locking.
* sigproc.cc (proc_subproc): Always set ppid last.
2013-12-18 03:58:11 +00:00
Corinna Vinschen db0d50a67d * include/cygwin/stdlib.h (initstate, random, setstate, srandom):
Harden _XOPEN_SOURCE guard against applications defining _XOPEN_SOURCE
	with empty value.
2013-12-09 10:12:42 +00:00
Corinna Vinschen 4726a0e769 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 28. 2013-12-08 13:42:16 +00:00
Christopher Faylor 8116e5e59b * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 27. 2013-11-29 13:31:54 +00:00
Jon TURNEY 390aa0b67f * include/cygwin/stdlib.h(initstate, random, setstate, srandom) :
Prototype if not __STRICT_ANSI__ or _XOPEN_SOURCE is defined appropriately.
2013-11-29 13:05:43 +00:00
Corinna Vinschen f8b02da153 * include/glob.h: Fix invalid use of 'restrict' error. 2013-11-28 10:00:01 +00:00
Corinna Vinschen bb9d95eb38 * common.din: Export posix_spawn[...] functions.
* exec.cc (execve): Add EXPORT_ALIAS _execve.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* posix.sgml (std-susv4):  Add posix_spawn[...] here.
	(std-notimpl): Drop here.
2013-11-26 17:11:09 +00:00
Corinna Vinschen 3073f26d6a Throughout, keep function definitions and declarations in sync with
newlib in terms of C99 "restrict" keyword.
2013-11-25 11:38:08 +00:00
Corinna Vinschen c03063e2fc * include/cygwin/stdlib.h (realpath): Drop declaration. It's declared
in newlib's stdlib.h now.
2013-11-20 09:48:04 +00:00
Corinna Vinschen 5b56e9b02b * autoload.cc (IdnToAscii): Define.
(IdnToUnicode): Define.
	(FreeAddrInfoW): Define.
	(GetAddrInfoW): Define.
	(GetNameInfoW): Define.
	* net.cc: Drop W. Richard STEVENS libgai implementation.
	(cygwin_freeaddrinfo): Move code from ipv4_freeaddrinfo here.  Move
	definition up in file to avoid forward declaration in ga_duplist.
	(ga_dup): Take addrinfoW as input.  Add parameters to get IDN flags
	and to set error value.  Handle IDN flags and especially AI_CANONIDN.
	Convert input wchar_t ai_canonname string to multibyte for output.
	(ga_duplist): Add parameters to get IDN flags and to set error value
	and propagate to ga_dup.  Call cygwin_freeaddrinfo.
	(gai_errmap): Add comments.  Align error strings to GLibc.  Add
	EAI_IDN_ENCODE entry.
	(get_ipv6_funcs): Remove.
	(load_ipv6_guard): Remove.
	(ipv6_inited): Remove.
	(load_ipv6): Remove.
	(load_ipv6_funcs): Remove.
	(cygwin_getaddrinfo): Drop calling load_ipv6.  Handle AI_IDN* flags.
	Convert input strings to wchar_t and call GetAddrInfoW/FreeAddrInfoW.
	In case hints is NULL, set default ai_flags explicitely to
	AI_V4MAPPED | AI_ADDRCONFIG, as documented for Glibc.  Only add AI_ALL
	if AI_ADDRCONFIG is not given.  Unconditionally add Windows-specific
	AI_DISABLE_IDN_ENCODING to ai_flags to make IDN behaviour compatible
	to Glibc even on Windows 8 and later.
	(cygwin_getnameinfo): Drop calling load_ipv6.  Handle NI_IDN* flags.
	Call GetNameInfoW and convert returned strings from wchar_t to
	multibyte.
	* include/netdb.h: Add comments to describe flags and error values.
	(AI_*): Define all flags using hex values for clearness.
	(AI_IDN): Define.
	(AI_CANONIDN): Define.
	(AI_IDN_ALLOW_UNASSIGNED): Define.
	(AI_IDN_USE_STD3_ASCII_RULES): Define.
	(NI_*): Define all flags using hex values for clearness.
	(NI_IDN): Define.
	(NI_IDN_ALLOW_UNASSIGNED): Define.
	(NI_IDN_USE_STD3_ASCII_RULES): Define.
	(EAI_IDN_ENCODE): Define.
2013-11-19 13:29:37 +00:00
Corinna Vinschen 14be153e9b * exception.h: Fold in content of include/exceptions.h.
* include/exceptions.h: Remove.
2013-10-27 09:42:17 +00:00
Corinna Vinschen 2e178c6909 * exception.h (_exception_list): Drop redefinition for x86_64.
* include/exceptions.h: Disable content for x86_64 since it's not
	using frame based exception handling anymore.
2013-10-26 09:37:34 +00:00
Corinna Vinschen 158508011c * include /cygwin/config.h (_READ_WRITE_BUFSIZE_TYPE): Define. 2013-10-23 10:06:17 +00:00
Christopher Faylor ade2acf274 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 26. 2013-09-25 16:17:59 +00:00
Corinna Vinschen 3c654cd48a * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Belatedly bump
to 25.
2013-08-31 18:05:31 +00:00
Corinna Vinschen 3ee82da30d * fhandler_tape.cc (mtinfo_drive::create_partitions): Allow partitioning
of drives supporting select partitions.
	(mtinfo_drive::get_status): Fill in current partition and number of
	partitions on tape into mt_resid.
	* include/cygwin/mtio.h (struct mtget): Align mt_resid comment to
	aforementioned change.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2013-08-21 20:28:12 +00:00
Corinna Vinschen ef23b0a6a4 * include/sys/cygwin.h (struct per_process): Add posix_memalign. Reduce
size of unused2 accordingly.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Initialize
	u->posix_memalign with address of posix_memalign.
	* malloc_wrapper.cc (posix_memalign): Call user-provided posix_memalign
	rather than just returning ENOSYS.
	* globals.cc (__cygwin_user_data): Initialize posix_memalign member.
2013-08-14 11:44:23 +00:00
Corinna Vinschen 2da426bee6 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 24. 2013-08-09 09:12:55 +00:00
Corinna Vinschen 5709fcbfe5 Fix copyright date 2013-07-24 14:21:13 +00:00
Corinna Vinschen 3fdddd7d77 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 23. 2013-07-22 15:08:54 +00:00