aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-03-17Feature test macros overhaul: sys/types.hYaakov Selkowitz1-4/+7
The u_int/u_char/etc. BSD types are needed by Cygwin's netinet/*.h headers, so they always need to be available. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Revert "Remove inclusion of sys/select.h in sys/types.h for backward compat"Yaakov Selkowitz1-0/+2
This BSDism is still in use (e.g. putty). This reverts commit 088f7a723962dd18dcae09e8e8fa168bbea6ed0b.
2016-03-17Feature test macros overhaul: sys/time.hYaakov Selkowitz1-5/+8
The inclusion of <sys/select.h> is required also by POSIX.1-2001. setitimer is XSI, and futimesat is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: sys/stat.hYaakov Selkowitz1-10/+6
Replace all !_POSIX_SOURCE with BSD. All *at functions depend on ATFILE; futimens is POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: sys/select.hYaakov Selkowitz1-4/+5
Remove !_POSIX_SOURCE conditional; pselect is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: wchar.hYaakov Selkowitz1-0/+2
open_wmemstream is POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: unistd.hYaakov Selkowitz1-35/+41
Throughout, use proper internal macros for functions, including those marked as target-specific. Use ATFILE for all *at functions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: time.hYaakov Selkowitz2-5/+17
Throughout, replace __STRICT_ANSI__ with the proper internal macros. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: strings.hYaakov Selkowitz1-3/+3
Replace __STRICT_ANSI__ with the proper internal macros for bcmp etc. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: string.hYaakov Selkowitz1-23/+15
Throughout, remove __STRICT_ANSI__ and use the proper internal macros. bcmp, bcopy, bzero, index, and rindex were in POSIX prior to 2008. memrchr is GNU. strdup and strndup are POSIX.1-2008. The int-returning form of strerror_r is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: stdlib.hYaakov Selkowitz5-54/+73
Throughout, simplify the C99/C11 conditionals, and replace __STRICT_ANSI__ with the proper internal POSIX macros. The _*_r reentrant functions need not be guarded (and most haven't been) because such names in the global scope are reserved to the implementation. atoff is unique to newlib. dtoa is not actually exported (_dtoa_r is used internally), is nonstandard, and the declaration conflicts with the code included in MySQL, NSPR, and SpiderMonkey. mktemp was removed in POSIX.1-2001. The qsort_r declarations are reordered so that the GNU version retains precedence. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: stdio.hYaakov Selkowitz2-33/+46
Throughout, remove references to __STRICT_ANSI__ and use the proper internal macros and versions for C99, POSIX, ATFILE for the various *at functions, or LARGEFILE for fseeko and ftello. [v]asprintf are GNU extensions, but the *iprintf, *iscanf, and *asnprintf functions are unique to newlib. getw and putw were removed from POSIX.1-2001. funopen is BSD, and fopencookie is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: signal.hYaakov Selkowitz2-15/+11
Use proper internal macros for BSD sig_t and GNU sighandler_t. sigaltstack and friends are XSI even in SUSv4 but in glibc are nonetheless handled as POSIX.1-2008 (not 2001). The requirement for the ucontext_t typedef in signal.h was XSI prior to POSIX.1-2008. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: pwd.hYaakov Selkowitz1-2/+2
getpw*_r dates back to POSIX.1c, and *pwent to XPG4v2. Both are also BSD. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: pthread.hYaakov Selkowitz1-2/+2
Use internal macros for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: math.hYaakov Selkowitz1-20/+23
Simplify the C99 conditionals. Mark the drem and gamma functions as BSD|SVID, the Bessel double functions also XSI and the floats also SUSv3. signgam is BSD|SVID|XSI, and matherr is SVID. Finally, use the internal macros to control the symbolic constants. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: limits.hYaakov Selkowitz2-4/+4
Simplify the C99 conditional, and use the internal macro for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: grp.hYaakov Selkowitz1-3/+5
_PATH_GROUP is a BSDism. getgr*_r are BSD|SVID|POSIX, and the *grent functions are BSD|SVID|XPG4v2. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: fnmatch.hYaakov Selkowitz3-6/+7
Use the proper internal macro for GNU extensions. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: fcntl.hYaakov Selkowitz1-14/+14
Most of the !_POSIX_SOURCE code is BSD, although ironically some were added to POSIX.1-2001. Use the ATFILE conditional for most of the *at functions, except futimesat which is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: dirent.hYaakov Selkowitz2-4/+12
MAXNAMLEN is a BSDism. Use the proper internal macros instead of !_POSIX_SOURCE. telldir and seekdir are XSI, scandir and alphasort are POSIX.1-2008, and scandirat is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: ctype.hYaakov Selkowitz1-6/+7
Simplify C99 test for isblank. isascii and toascii are BSD|SVID|XSI. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17Feature test macros overhaul: sys/features.hYaakov Selkowitz3-148/+275
This is the complete rework of the feature tests macros for better compatibility with GNU libc, primarily based on the Linux man pages documentation: http://man7.org/linux/man-pages/man7/feature_test_macros.7.html The previous implementation was flawed in its approach that macros were often used to hide symbols if defined (e.g. !defined __STRICT_ANSI__ or !defined _POSIX_SOURCE), whereas the approach of glibc is that these macros make symbols available when defined (e.g. defined _BSD_SOURCE, or as used internally, #if __BSD_VISIBLE). As much open-source software is written with glibc in mind, this necessitated patching numerous packages just to compile. In particular, __STRICT_ANSI__ (which is defined by gcc -ansi or -std=c*) was given too much importance. This implementation limits the influence of __STRICT_ANSI__ to controlling the default when no other feature test macros are defined, and to the inclusion of <alloca.h> in <stdlib.h> as documented. These are the only places where __STRICT_ANSI__ should be tested. The following macros are now accepted: _ATFILE_SOURCE, _BSD_SOURCE, _DEFAULT_SOURCE, _ISOC99_SOURCE, _ISOC11_SOURCE, _LARGEFILE_SOURCE, _SVID_SOURCE, _XOPEN_SOURCE_EXTENDED. The existing __*_VISIBLE internal macros have been kept mostly compatible with the original BSD implementation, with some changes to the criteria which controls them. Several more macros in this style have been added where needed for concision or accuracy. Enabling C++11 or newer in the compiler also enables C99 and C11 functions. Doing so should help move away from the need to define _GNU_SOURCE in g++ for _GLIBCXX_USE_C99 support as on Linux: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749 Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17add release message for commit 4c9bb3eCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-17Propagate correct Windows error if executable can't be openedCorinna Vinschen1-0/+1
* spawn.cc (av::setup): Set last Win32 error if NtOpenFile fails. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-17Add release message for commit 7346568Thomas Wolff2-0/+10
2016-03-16Make requested console reports workThomas Wolff3-4/+30
cf https://cygwin.com/ml/cygwin-patches/2012-q3/msg00019.html This enables the following ESC sequences: ESC[c sends primary device attributes ESC[>c sends secondary device attributes ESC[6n sends cursor position report * fhandler.h (class dev_console): Add console read-ahead buffer. (class fhandler_console): Add peek function for it (for select). * fhandler_console.cc (fhandler_console::setup): Init buffer. (fhandler_console::read): Check console read-aheader buffer. (fhandler_console::char_command): Put responses to terminal requests (device status and cursor position reports) into common console buffer (shared between CONOUT/CONIN) instead of fhandler buffer (separated). * select.cc (peek_console): Check console read-ahead buffer.
2016-03-15Attempt to fix Coverity issues in sspJon Turney1-6/+17
* ssp.c (lookup_thread_id): Consistently check if tix is a null pointer. (run_program): Annotate that STATUS_BREAKPOINT falls-through to STATUS_SINGLE_STEP case. (main): Guard against high_pc-low_pc overflow and malloc failure. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2016-03-14cygwin_getaddrinfo: workaround Winsock getaddrinfo issue with broken DNSCorinna Vinschen1-1/+10
Add experimental code to workaround the issue described in the thread starting at https://cygwin.com/ml/cygwin/2015-07/msg00350.html There's a hint in https://communities.vmware.com/message/2577858#2577858 that this problem is related to using the AI_ALL flag. This patch checks if GetAddrInfoW returned with WSANO_RECOVERY and if the AI_ALL flag was set, it retries GetAddrInfo without the AI_ALL flag. * net.cc (cygwin_getaddrinfo): Add experimental code to retry GetAddrInfoW without AI_ALL flag if it returned with WSANO_RECOVERY. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13Don't write NULL SID ACE if it's not necessary.Corinna Vinschen1-4/+17
If the ACL is supposed to reflect only standard POSIX permissions, and if the permissions are so that user has more perms than group and group has more perms than other, we don't really need the NULL SID ACE. If the permissions are that simple, get_posix_access will not call AuthZ. * sec_acl.cc (set_posix_perms): Don't write NULL SID ACE if it's not required. Explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13or1k: properly restore timerStefan Roesch1-1/+1
Consider the function parameter for restoring the timer
2016-03-13or1k: Fix multicore stack calculationStefan Roesch2-14/+14
Change the type of the stack pointers to enable pointer calculations at byte granularity, which is needed for the calculation of _or1k_stack_core[c] and _or1k_exception_stack_core[c] with _or1k_stack_size and _or1k_exception_stack_size. (util.c:53-54)
2016-03-13setvbuf: Drop setting reent->__cleanupCorinna Vinschen1-1/+0
The __sinit call added with 1eb6db6 already sets reent->__cleanup. * libc/stdio/setvbuf.c (setvbuf): Drop setting reent->__cleanup. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13Update Cygwin release message text with latest bugfixes.Corinna Vinschen1-1/+12
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Update setvbuf to latest OpenBSD implementationCorinna Vinschen1-42/+75
Newlib's setvbuf function is very old and has two bugs: - It sets the SRD/SWR flags incorrectly in case of files opened for reading and writing. See https://cygwin.com/ml/cygwin/2016-03/msg00180.html for a desription of the effect. - It always sets the buffer size to BUFSIZ if it's not provided by the application, independent of the optimal blocksize for the underlying IO device. Update setvbuf to latest code from OpenBSD to fix both problems. * libc/stdio/setvbuf.c (setvbuf): Import latest OpenBSD implementation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Add __swhatbuf function from OpenBSDCorinna Vinschen2-49/+60
To fix a long-standing setvbuf bug, import __swhatbuf function from OpenBSD and only slightly rearrange for newlib. * libc/stdio/local.h (__swhatbuf_r): Declare. * libc/stdio/makebuf (__smakebuf_r): New function. (__smakebuf_r): Drop file handling code and call __smakebuf_r. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Use __sputc_r inline code when building with gccCorinna Vinschen1-3/+5
Per the preceeding comment this inline code is disabled since 1993(!) because of a bug in GCC at the time. This is long gone and the equivalent inline code is used in the BSDs for quite some time. Enable this code for newlib as well. * libc/include/stdio.h (__sputc_r): Enable GCC inline code. Add handling for targets defining __SCLE. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Fix typo which might break permission evaluationCorinna Vinschen1-1/+1
* sec_acl.cc (get_posix_access): Fix a typo checking for a_id rather than a_type. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Fix reading/writing Samba ACLs using RFC2307 mappingCorinna Vinschen3-18/+82
When using RFC2307 uid/gid-mapping on Samba shares, the POSIX ACL contains the Windows SIDs. When writing back such an ACL we have to map the Windows SIDs back to the corresponding Samba SIDs representing the UNIX uid/gid value. When reading Samba SIDs, make sure never to evaluate a UNIX user account as group. * sec_acl.cc (set_posix_access): Convert Windows SIDs to RFC2307-mapped Sambe UNIX SIDs. * sec_helper.cc (cygpsid::get_id): Skip UNIX user accounts when trying to evaluate a SID as group. Skip UNIX group accounts when trying to evaluate a SID as user. * cygheap.h (cygheap_ugid_cache::reverse_get): New method to get nfs id from cygwin id. (cygheap_ugid_cache::reverse_get_uid): Wrapper for uids. (cygheap_ugid_cache::reverse_get_gid): Wrapper for gids. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-12Add cygsid methods to create SIDs from scratchCorinna Vinschen3-23/+54
So far creating cygsids requires to generate an "S-1-..." string which is then converted to a SID by cygsid::getfromstr. Add two new methods: - cygsid::create (DWORD auth, DWORD subauth_count, ...) ... is a variable length list of subauth_count DWORD values being the actual subauths. - cygsid::append (DWORD rid) allows to append a single RID to an alreaday constituted SID. * security.h (cygsid::create): Declare public. (cygsid::append): Ditto. * sec_helper.cc (cygsid::create): Implement. (cygsid::append): Implement. * uinfo.cc (pwdgrp::fetch_account_from_windows): Use both new methods as appropriate. Drop setting csid from string. Create SID strings for printing SIDs only. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-11gmon.h: Fix type of gmonparam state memberCorinna Vinschen1-1/+4
gmonparam::state is used in calls to Win32 Interlocked functions. Having this defined as int breaks the build on i686. Redefine as LONG (same size and correct type on all platforms) to make gcc happy. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-11Spinlock spin with pause instructionVáclav Haisman1-1/+19
Hi. I have noticed that Cygwin's spinlock goes into heavy sleeping code for each spin. It seems it would be a good idea to actually try to spin a bit first. There is this 'pause' instruction which let's the CPU make such busy loops be less busy. Here is a patch to do this. -- VH
2016-03-11Documentation covering profiling Cygwin programs.Mark Geisert3-1/+259
2016-03-10Add release message for commit 8b1ede3ce11d53292036aadfcfb6043df0235f9cCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10Add commit 5807ba83e release message to documentationCorinna Vinschen1-1/+8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10Add release message for commit 5807ba83e498d87b52675376a81d2edfe6de098dCorinna Vinschen1-0/+5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10Support profiling of multi-threaded apps.Mark Geisert7-73/+134
This patch set modifies Cygwin's profiling support to sample PC values of all an app's threads, not just the main thread. There is no change to how profiling is requested: just compile and link the app with "-pg" as usual. The profiling info is dumped into file gmon.out as always. A new facility enabled via the environment variable GMON_OUT_PREFIX. This facility is intended to match an undocumented Linux glibc feature. Exporting the variable with a non-empty value such as "foo" causes the profiling info to go to a file named foo.$pid instead of the default. With that, both resulting processes of a fork() can have their profiling data captured in separate files. gprof already knows how to accumulate data from multiple files if they all pertain to the same app. There is no change to the normal Cygwin execution paths if profiling is not enabled. And when it is enabled, only the one profiling thread per profiled app is doing more work than it used to. * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL. * cygheap.cc (cygheap_profthr_all): New C-callable function that runs cygheap's threadlist handing each pthread's thread handle in turn to profthr_byhandle(). * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL. * gmon.c (_mcleanup): Add support for multiple simultaneous gmon.out* files named via environment variable GMON_OUT_PREFIX. * gmon.h (struct gmonparam): Make state decl volatile. * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use Interlocked operations. Add #include "winsup.h", update commentary. * profil.c (profthr_byhandle): New function abstracting out the updating of profile counters based on a thread handle. (profthr_func): Update to call profthr_byhandle() to sample the main thread then call cygheap_profthr_all() indirectly through cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads. (profile_off): Zero targthr to indicate profiling was turned off. (profile_on): Fix handle leak on failure path. (profile_child): New callback func to restart profiling in child process after a fork if the parent was being profiled. (profile_ctl): Call pthread_atfork() to set profile_child callback. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10getifaddrs: Return pointer to extended interface info in ifa_data memberCorinna Vinschen2-22/+36
According to https://cygwin.com/ml/cygwin/2016-03/msg00124.html it's a problem to collect friendlyname info using AF_INET6 sockets. Fix problem by exposing additional hardware info for all collected interfaces via the pointer in the ifaddrs::ifa_data member. * include/ifaddrs.h (struct ifaddrs_hwdata): Define as struct of not yet exposed members of struct ifall, defined in net.cc. * net.cc (struct ifall): Replace hardware dta members with struct ifaddrs_hwdata. Accommodate throughout. (get_ifs): Let ifaddrs ifa_data member point to ifall::ifa_hwdata member. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10Remove bogus LONG(0) directives from MSP430 linker scripts.Nick Clifton2-2/+0
2016-03-10Revamp acl_extended_fd/acl_extended_file to avoid open(2) callCorinna Vinschen1-14/+44
Calling open from acl_extended_file{_nofollow} indiscriminately may hang if the file is a FIFO. Ultimately the FIFO implementation needs a thorough rewrite, but for the time being we better do what stat(2) and friends do: Just create an fhandler directly. * sec_posixacl.cc (__acl_extended_fh): New static function calling fhandler::facl. (acl_extended_fd): Just call __acl_extended_fh. (__acl_extended_file): Take just a path_conv as parameter and create temporary fhandler to call __acl_extended_fh. (acl_extended_file): Create path_conv from incoming path and call __acl_extended_file on it. (acl_extended_file_nofollow): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>