summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/include
Commit message (Collapse)AuthorAgeFilesLines
* Use COMSPEC env var, not hard-coded CMD.EXE path.Kaz Kylheku2017-11-161-1/+0
| | | | | | | | | | | | | | | | | | | | It is with some reluctance I make this change, due to the security implications of relying on environment variables. But we can't have a hard-coded path. * winsup/cygwin/include/paths.h (_PATH_CMDEXE): Macro removed. * winsup/cygwin/spawn.cc (av::setup): Use COMSPEC environment variable instead of hard-coded path. If missing, bail with errno set to EOPNOTSUPP. * winsup/cygwin/syscalls.cc (system): Use COMSPEC environment variable. If missing, return -1. (getusershell): Eliminate static array of shell names. If shell_index is zero, return value of COMSPEC env var, if it exists, and increment shell_index to 1. (popen): Use COMSPEC and if that is missing, set errno to EOPNOTSUPP and return NULL.
* Cygnal apps use cmd.exe, not /bin/sh.Kaz Kylheku2017-11-161-1/+1
| | | | | | | | | | | | | | | | | | | * winsup/cygwin/include/paths.h (_PATH_CMDEXE): New preprocessor symbol. * winsup/cygwin/spawn.cc (av_setup): Use _PATH_CMDEXE rather than "/bin/sh". * winsup/cygwin/syscalls.cc (system): Spawn _PATH_CMDEXE with /c option rather than /bin/sh. (ETC_SHELLS): Preprocessor symbol removed. (shell_fp): Global variable removed. (getusershell): Don't open ETC_SHELLS, just march through static array of shell names. That array contains only one entry: _PATH_CMDEXE. (setusershell, endusershell): Remove references to shell_fp. (popen): Exec _PATH_CMDEXE rather than "/bin/sh", and the option is /c.
* cygwin: export strnstrCorinna Vinschen2017-08-251-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Implement renameat2Ken Brown2017-08-192-1/+8
| | | | | | Define the RENAME_NOREPLACE flag in <cygwin/fs.h> as defined on Linux in <linux/fs.h>. The other RENAME_* flags defined on Linux are not supported.
* headers: avoid bareword attributesEric Blake2017-08-174-5/+5
| | | | | | | | | Always use the __-decorated form of an attribute name in public headers, as the bareword form is in the user's namespace, and we don't want compilation to break just because the user defines the bareword to mean something else. Signed-off-by: Eric Blake <eblake@redhat.com>
* cygwin: Implement pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlockCorinna Vinschen2017-08-031-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Bump DLL version to 2.9.0Corinna Vinschen2017-08-031-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Implement pthread_mutex_timedlockCorinna Vinschen2017-08-032-1/+3
| | | | | | | - pthread_mutex::lock now takes a PLARGE_INTEGER timeout pointer and uses that in the call to cygwait. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin/signal.h: Remove SI_QUEUE unimplemented commentCorinna Vinschen2017-08-031-2/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Revert "cygwin/signal.h: Remove SI_QUEUE unimplemented comment"Corinna Vinschen2017-08-031-1/+2
| | | | This reverts commit 54ed68a781fe8a36d08352503524e61534a25e07.
* cygwin/signal.h: Remove SI_QUEUE unimplemented commentCorinna Vinschen2017-08-031-2/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add elf.h to newlibYaakov Selkowitz2017-08-027-1890/+0
| | | | | | | This is copied from musl (MIT license). This is newer and more thorough than that of FreeBSD currently shipped only on Cygwin. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* cygwin: Export explicit_bzeroYaakov Selkowitz2017-08-021-1/+2
| | | | | | This was added to newlib together with timingsafe_*cmp but never exported. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* cygwin: Bump DLL version to 2.8.3Corinna Vinschen2017-07-191-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: export fls, flsl, flsllCorinna Vinschen2017-07-111-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fix guard on struct siginfo_tYaakov Selkowitz2017-07-101-2/+4
| | | | | | | Add line breaks to make it clearer that the struct packing applies to more than one struct. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Rename __in and __out in headers to avoid collision with Windows APIsDavid Macek2017-07-071-1/+1
| | | | | * string.h: Local variables in expansion of strdupa and strndupa * sys/wait.h: Fields in anonymous union in expansion of __wait_status_to_int
* Cygwin: fix signal.h with _POSIX_C_SOURCE=1Yaakov Selkowitz2017-07-041-0/+2
| | | | | | | | struct sigaction is POSIX.1-1990 but siginfo_t, which is used by its sa_sigaction member, is POSIX.1b-1993. Therefore it needs to be guarded as well, and as part of a union, the struct size is protected. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Bump DLL minor versionCorinna Vinschen2017-07-041-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: export strverscmp, add versionsortYaakov Selkowitz2017-06-192-1/+3
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Export XSI sigpauseYaakov Selkowitz2017-06-141-1/+2
| | | | | | | | | | There are two common sigpause variants, both of which take an int argument. If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version, which removes the given signal from the process's signal mask; otherwise you get the BSD version, which sets the process's signal mask to the given value. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: Cygwin signal.hYaakov Selkowitz2017-06-141-1/+25
| | | | | | This should match newlib's <sys/signal.h>. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Cygwin: Export reallocarrayCorinna Vinschen2017-04-041-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump Cygwin to 2.8.1Corinna Vinschen2017-04-041-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement getloadavg()Jon Turney2017-03-272-1/+6
| | | | | | | | | | | | | | | v2: autoload PerfDataHelper functions Keep loadavg in shared memory Guard loadavg access by a mutex Initialize loadavg to the current load v3: Shared memory version bump isn't needed if we are only extending it Remove unused autoload Mark inititalized flags as NO_COPY for correct behaviour in fork child Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* declaration of ppoll() by poll.h should be guarded by _GNU_SOURCEJon Turney2017-03-271-0/+2
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Rename <sys/_locale.h> to <xlocale.h>Yaakov Selkowitz2017-03-221-1/+1
| | | | | | | | | The locale_t type is provided by <xlocale.h> on Linux, FreeBSD, and Darwin. While, like on some of those systems, it is automatically included by <locale.h> with the proper feature test macros, its presence under this particular name is still presumed in real-world software. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Belatedly bump Cygwin DLL version to 2.8.0Corinna Vinschen2017-03-101-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement dladdr() (partially)Jon Turney2017-03-082-1/+20
| | | | | | | Note that this always returns with dli_sname and dli_saddr set to NULL, indicating no symbol matching addr could be found. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Export timingsafe_bcmp and timingsafe_memcmpJon Turney2017-03-071-1/+2
| | | | Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Bump Cygwin version to 2.7.1Corinna Vinschen2017-02-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: create separate bits/byteswap.hYaakov Selkowitz2017-02-083-37/+51
| | | | | | | | Match glibc behaviour to expose the public bswap_* macros only with an explicity #include <byteswap.h>; #include'ing <endian.h> should not expose them. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Cygwin: Add IUTF8 termios iflagCorinna Vinschen2017-01-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The termios code doesn't handle erasing of multibyte characters in canonical mode, it always erases a single byte. When entering a multibyte character and then pressing VERASE, the input ends up with an invalid character. Following Linux we introduce the IUTF8 input flag now, set by default. When this flag is set, VERASE or VWERASE will check if the just erased input byte is a UTF-8 continuation byte. If so, it erases another byte and checks again until the entire UTF-8 character has been removed from the input buffer. Note that this (just as on Linux) does NOT work with arbitrary multibyte codesets. This only works with UTF-8. For a discussion what happens, see https://cygwin.com/ml/cygwin/2017-01/msg00299.html Sidenote: The eat_readahead function is now member of fhandler_termios, not fhandler_base. That's necessary to get access to the terminal's termios flags. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Export getentropy and getrandom callsCorinna Vinschen2016-12-162-3/+33
| | | | | | | | | | | | getentropy per OpenBSD http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2 getrandom per Linux http://man7.org/linux/man-pages/man2/getrandom.2.html Note that GRND_NONBLOCK is not handled
* Provide <memory.h>Sebastian Huber2016-11-221-15/+0
| | | | | | | | Provide <memory.h> for all standard Newlib targets and remove Cygwin-specific header. Most POSIX like systems provide this historic header. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Move pthread types to <sys/_pthreadtypes.h>Sebastian Huber2016-11-172-46/+59
| | | | | | | | | | This makes it possible provide operating system specific types for <pthread.h>. It is in line with the FreeBSD header file structure and allows a future cleanup of <pthread.h> to not expose unrelated things via <sys/types.h> and <unistd.h>. Glibc uses the similar <bits/pthreadtypes.h> for this purpose. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add _PC_CASE_INSENSITIVE to [f]pathconfKen Brown2016-10-211-1/+2
| | | | | | | | Update the getconf utility to support the new flag as well as _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY. These were previously unsupported, probably as an oversight. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Bump Cygwin version to 2.6.1Corinna Vinschen2016-10-191-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Export and document strerror_l, strptime_l, wcsftime_l from CygwinCorinna Vinschen2016-08-231-1/+2
| | | | | | Bump Cygwin API minor number. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add pthread_getname_np and pthread_setname_npJon Turney2016-08-232-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds pthread_getname_np and pthread_setname_np. These were added to glibc in 2.12[1] and are also present in some form on NetBSD and several UNIXes. The code is based on NetBSD's implementation with changes to better match Linux behaviour. Implementation quirks: * pthread_setname_np with a NULL pointer segfaults (as linux) * pthread_setname_np returns ERANGE for names longer than 16 characters (as linux) * pthread_getname_np with a NULL pointer returns EFAULT (as linux) * pthread_getname_np with a buffer length of less than 16 returns ERANGE (as linux) * pthread_getname_np truncates the thread name to fit the buffer length. This guarantees success even when the default thread name is longer than 16 characters, but means there is no way to discover the actual length of the thread name. (Linux always truncates the thread name to 16 characters) * Changing program_invocation_short_name changes the default thread name (on linux, it has no effect on the default thread name) I'll leave it up to you to decide if any of these matter. This is implemented via class pthread_attr to make it easier to add pthread_attr_[gs]etname_np (present in NetBSD and some UNIXes) should it ever be added to Linux (or we decide we want it anyway). [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS
* Implement missing POSIX function nl_langinfo_lCorinna Vinschen2016-08-201-1/+2
| | | | | | | | | | | | Change nl_langinfo to nl_langinfo_l using locale given as argument. Remove outdated TRANSITION_PERIOD_HACK. The codeset is stored in the locale for quite some time now. For !MB_CAPABLE targets, just return "US_ASCII" as codeset. Implement nl_langinfo by calling nl_langinfo_l. Export nl_langinfo_l from Cygwin DLL and bump minor API version number. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Only define __getreent inline function when building newlib or CygwinCorinna Vinschen2016-08-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Commit 6f3943b erroneously removed the `#ifdef _COMPILING_NEWLIB' guarding the __getreent inline function. This patch ignored the fact that config.h is included when building applications, and the code in question requires internal, auto-generated headers to be available which are not exposed to user-space. Reinstantiate defined(_COMPILING_NEWLIB) test and alternatively check for defined (__INSIDE_CYGWIN__), otherwise we'd have to reinstantiate the __getreent macro in cygtls.h which is really confusing. While testing it turned out that a low number of source codes inside Cygwin won't see the inline __getreent due to a missing __INSIDE_CYGWIN__ definition. For malloc.cc this was actually deliberate to get different definitions from including cygmalloc.h. Change this by defining __INSIDE_CYGWIN__ in malloc.cc but changing the test in cygmalloc.h to test for defined(DLMALLOC_VERSION). This might need a change if we ever get around to replace dlmalloc with a newer, more threading-aware malloc implementation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Reinstantiate Cygwin function called `__getreent'Corinna Vinschen2016-08-181-2/+0
| | | | | | | | | | This partially reverts commit 10a30e7 as far as the Cygwin version of the __getreent function is concerned. Remove _COMPILING_NEWLIB guard only allowing to use __getreent inline function when building newlib, since we wan to use it in Cygwin as well. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Stefan Assmann <sassmann@redhat.com>
* Revert "Fix __getreent function for Cygwin"Corinna Vinschen2016-08-181-2/+1
| | | | | | | | | | | This reverts commit 4de8596. It worked around a problem which was actually introduced by patch 10a30e7 a few weeks ago. Rather than adding special code to the newlib version of __getreent, the followup patch reinstantiates the original, Cygwin-only implementation of __getreent. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Stefan Assmann <sassmann@redhat.com>
* Fix __getreent function for CygwinCorinna Vinschen2016-08-181-1/+2
| | | | | | | | | | | | | | | | | | So far the lib function __getreent always returned _impure_ptr. On Cygwin this is only correct after _impure_ptr got initialized. The inline function in include/cygwin/config.h always returns the right _reent ptr, though. After introducing per-thread locales, the __getreent function is called prior to initialization of _impure_ptr (from dll_crt0_0) to access the locale pointer, which leads to a crash. Fix the __getreent lib function for Cygwin to return the correct _reent pointer all the time. Rename inline function to __inline_getreent and introduce a macro __getreent calling the inline function. Change the lib function __getreent to call __inline_getreent on Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement strto[dflu]_l/wcsto[dflu]_lCorinna Vinschen2016-08-151-1/+4
| | | | | | | | | | Implement GNU extensions strtod_l, strtof_l, strtol_l, strtold_l, strtoll_l, strtoul_l, strtoull_l, wcstod_l, wcstof_l, wcstol_l, wcstold_l, wcstoll_l, wcstoul_l, wcstoull_l. Export from Cygwin, fix posix.xml. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add sys/_locale.h header and fix up headersCorinna Vinschen2016-08-151-1/+12
| | | | Signed-off by: Corinna Vinschen <corinna@vinschen.de>
* Bump CygwinAPI minor.Corinna Vinschen2016-08-151-3/+5
| | | | Signed-off by: Corinna Vinschen <corinna@vinschen.de>
* Implement all per-locale ctype functionsCorinna Vinschen2016-08-151-1/+7
| | | | Signed-off by: Corinna Vinschen <corinna@vinschen.de>
* Implement newlocale, freelocale, duplocale, uselocaleCorinna Vinschen2016-08-151-3/+4
| | | | | | | | Add global const __C_locale for reference purposes. Bump Cygwin API minor number and DLL major version number to 2.6.0. Signed-off by: Corinna Vinschen <corinna@vinschen.de>