]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
8 years agoUpdate setvbuf to latest OpenBSD implementation
Corinna Vinschen [Sat, 12 Mar 2016 22:41:21 +0000 (23:41 +0100)]
Update setvbuf to latest OpenBSD implementation

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>
8 years agoAdd __swhatbuf function from OpenBSD
Corinna Vinschen [Sat, 12 Mar 2016 22:37:01 +0000 (23:37 +0100)]
Add __swhatbuf function from OpenBSD

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>
8 years agoUse __sputc_r inline code when building with gcc
Corinna Vinschen [Sat, 12 Mar 2016 22:25:11 +0000 (23:25 +0100)]
Use __sputc_r inline code when building with gcc

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>
8 years agoFix typo which might break permission evaluation
Corinna Vinschen [Sat, 12 Mar 2016 16:57:34 +0000 (17:57 +0100)]
Fix typo which might break permission evaluation

* 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>
8 years agoFix reading/writing Samba ACLs using RFC2307 mapping
Corinna Vinschen [Sat, 12 Mar 2016 16:56:21 +0000 (17:56 +0100)]
Fix reading/writing Samba ACLs using RFC2307 mapping

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>
8 years agoAdd cygsid methods to create SIDs from scratch
Corinna Vinschen [Sat, 12 Mar 2016 15:39:19 +0000 (16:39 +0100)]
Add cygsid methods to create SIDs from scratch

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>
8 years agogmon.h: Fix type of gmonparam state member
Corinna Vinschen [Fri, 11 Mar 2016 21:50:24 +0000 (22:50 +0100)]
gmon.h: Fix type of gmonparam state member

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>
8 years agoSpinlock spin with pause instruction
Václav Haisman [Fri, 11 Mar 2016 10:28:27 +0000 (11:28 +0100)]
Spinlock spin with pause instruction

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

8 years agoDocumentation covering profiling Cygwin programs.
Mark Geisert [Fri, 11 Mar 2016 07:56:56 +0000 (23:56 -0800)]
Documentation covering profiling Cygwin programs.

8 years agoAdd release message for commit 8b1ede3ce11d53292036aadfcfb6043df0235f9c
Corinna Vinschen [Thu, 10 Mar 2016 19:48:04 +0000 (20:48 +0100)]
Add release message for commit 8b1ede3ce11d53292036aadfcfb6043df0235f9c

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd commit 5807ba83e release message to documentation
Corinna Vinschen [Thu, 10 Mar 2016 19:47:33 +0000 (20:47 +0100)]
Add commit 5807ba83e release message to documentation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd release message for commit 5807ba83e498d87b52675376a81d2edfe6de098d
Corinna Vinschen [Thu, 10 Mar 2016 19:42:42 +0000 (20:42 +0100)]
Add release message for commit 5807ba83e498d87b52675376a81d2edfe6de098d

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoSupport profiling of multi-threaded apps.
Mark Geisert [Sat, 20 Feb 2016 06:58:31 +0000 (22:58 -0800)]
Support profiling of multi-threaded apps.

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>
8 years agogetifaddrs: Return pointer to extended interface info in ifa_data member
Corinna Vinschen [Thu, 10 Mar 2016 17:00:00 +0000 (18:00 +0100)]
getifaddrs: Return pointer to extended interface info in ifa_data member

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>
8 years agoRemove bogus LONG(0) directives from MSP430 linker scripts.
Nick Clifton [Thu, 10 Mar 2016 10:41:13 +0000 (10:41 +0000)]
Remove bogus LONG(0) directives from MSP430 linker scripts.

8 years agoRevamp acl_extended_fd/acl_extended_file to avoid open(2) call
Corinna Vinschen [Thu, 10 Mar 2016 09:36:00 +0000 (10:36 +0100)]
Revamp acl_extended_fd/acl_extended_file to avoid open(2) call

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>
8 years agoOverwite potentially faked kernel version with correct values
Corinna Vinschen [Wed, 9 Mar 2016 22:10:17 +0000 (23:10 +0100)]
Overwite potentially faked kernel version with correct values

* ntdll.h (RtlGetNtVersionNumbers): Declare.
* wincap.cc (wincapc::init): Overwrite kernel version info
returned by RtlGetVersion with correct info returnd by
RtlGetNtVersionNumbers.  Add comment.

Originally, using RtlGetVersion instead of GetVersionEx was supposed to
fix the fact that GetVersionInfo returns the wrong kernel version if the
executable has been built with an old manifest (or none at all), starting
with Windows 8.1.  Either this never really worked as desired and our
testing was flawed, or this has been changed again with Windows 10, so
that RtlGetVersion does the kernel faking twist as well.  Since we're
only reading the value in the first process in a process tree. the entire
process tree is running with a wrong OS version information in that case.

Fortunately, the (undocumented) RtlGetNtVersionNumbers function is not
affected by this nonsense, so we simply override the OS version info
fields with the correct values now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMove definition of wsadata into wsock_init
Corinna Vinschen [Wed, 9 Mar 2016 21:55:28 +0000 (22:55 +0100)]
Move definition of wsadata into wsock_init

The problem this patch fixes showed up after updating to gcc-5.3.0.  The
cuplrit is a change in gcc when emitting section attributes.  It only
shows up when building without optimization.  Effect in Cygwin: ws2_32
functions failed to load.

In the original code the definition of "NO_COPY wsadata" was preceeding
an __asm__ block (the definition of the _wsock_init wrapper), while the
definition of "NO_COPY here" immediately follows the same assembler
block.  When gcc-5.3.0 emits assembler code for the wsadata definition,
it emits the .data_cygwin_nocopy section attribute.

Next it emits the assembler output for the __asm_ block, entirely ignoring
its content.  The __asm__ block adds a .text section definition.

Eventually gcc emits assembler code for the here definition.  However,
apparently gcc still "knows" that it just emitted the .data_cygwin_nocopy
section attribute and so doesn't redefine it.  Remember the __asm__?  It
changed the section to .text.

So with gcc-4.9.3 we got:

    .section .data_cygwin_nocopy,"w"
  wsadata:

  __asm__ block:
    .text

    .section .data_cygwin_nocopy,"w"
  here:

With gcc 5.3.0 we now get:

    .section .data_cygwin_nocopy,"w"
  wsadata:

  __asm__ block:
    .text

  here:

So "here" is now in the .text segment which is read-only.  Hilarity ensues.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoCygwin: Document new POSIX ACL API
Corinna Vinschen [Tue, 8 Mar 2016 16:33:08 +0000 (17:33 +0100)]
Cygwin: Document new POSIX ACL API

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agofaq: Sort BLODA list and update advice on fixing fork failures
Jon Turney [Mon, 7 Mar 2016 18:42:41 +0000 (18:42 +0000)]
faq: Sort BLODA list and update advice on fixing fork failures

* faq-using.xml (bloda): Alphabetically sort BLODA list for ease
of finding things in it.
(fixing-fork-failures): Update to suggest rebase-trigger rather
than running rebaseall via dash yourself.  Mention detect_bloda
CYGWIN token.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoacl_create_entry: Don't invalidate existing entry_d and permset_d.
Corinna Vinschen [Wed, 6 Jan 2016 22:00:51 +0000 (23:00 +0100)]
acl_create_entry: Don't invalidate existing entry_d and permset_d.

* sec_posixacl .cc (__acl_dup): Remove.
(acl_dup): Fold __acl_dup functionality into this function.
(acl_create_entry): Don't create new acl_t.  Just realloc
acl->entry to make room for new aclent_t.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years ago__acltotext: Always append NUL
Corinna Vinschen [Wed, 6 Jan 2016 20:05:56 +0000 (21:05 +0100)]
__acltotext: Always append NUL

* sec_acl.cc (__acltotext): Append NUL unconditionally.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoImplement POSIX.1e ACL functions
Corinna Vinschen [Wed, 6 Jan 2016 17:41:36 +0000 (18:41 +0100)]
Implement POSIX.1e ACL functions

* Makefile.in (DLL_OFILES): Add sec_posixacl.o.
(SUBLIBS): Add libacl.a
(libacl.a): New rule to create libacl.a.
* common.din: Export POSIX ACL functions as well as most libacl.a
extensions.
* fhandler.h (fhander_base::acl_get): New prototype.
(fhander_base::acl_set): Ditto.
(fhandler_disk_file::acl_get): Ditto.
(fhandler_disk_file::acl_set): Ditto.
* include/acl/libacl.h: New file.
* include/cygwin/version.h: Bump API minor version.
* include/sys/acl.h: Drop including cygwin/acl.h.  Accommodate
throughout Cygwin.  Add POSIX ACL definitions.
* sec_acl.cc: Include sec_posixacl.h.  Replace ILLEGAL_UID and
ILLEGAL_GID with ACL_UNDEFINED_ID where sensible.
(__aclcheck): New internal acl check function to be used for
Solaris and POSIX ACLs.
(aclcheck32): Call __aclcheck.
(__aclcalcmask): New function to compute ACL_MASK value.
(__aclsort): New internal acl sort function to be used for Solaris
and POSIX ACLs.
(aclsort32): Call __aclsort.
(permtostr): Work directly on provided buffer.
(__acltotext): New internal acltotext function to be used for
Solaris and POSIX ACLs.
(acltotext32): Call __acltotext.
(__aclfromtext): New internal aclfromtext function to be used for
Solaris and POSIX ACLs.
(aclfromtext32): Call __aclfromtext.
* sec_posixacl.cc: New file implemeting POSIX ACL functions.
* sec_posixacl.h: New internal header.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygwin/acl.h: Don't clutter namespace
Corinna Vinschen [Wed, 6 Jan 2016 17:24:03 +0000 (18:24 +0100)]
cygwin/acl.h: Don't clutter namespace

include/cygwin/acl.h: Change comments to /**/ style.  Reformat
declarations.  Use underscores in argument names.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMention 64-bit Cygwin as another remedy for fork() failures.
Alexey Sokolov [Fri, 4 Mar 2016 19:42:15 +0000 (19:42 +0000)]
Mention 64-bit Cygwin as another remedy for fork() failures.

8 years agoccwrap: fix build with non-english locale set (v2)
Patrick Bendorf [Mon, 29 Feb 2016 13:34:09 +0000 (14:34 +0100)]
ccwrap: fix build with non-english locale set (v2)

after some discussion on irc and the list i'm resubmitting a simpler
version of the patch.
setting the locale on cygwin to 'C.UTF-8' is not needed, so i'm always
setting it to 'C' which is sufficient for the build process and the
most simple fix.

8 years agoccwrap: fix build with non-english locale set
Patrick Bendorf [Mon, 29 Feb 2016 12:19:43 +0000 (13:19 +0100)]
ccwrap: fix build with non-english locale set

short explanation: after setting up cygwin on my systems the default
locale is set to "de_DE.UTF-8". this leads to ccwrap not picking up
certain "-isystem" arguments, which in turn leads to "stddef.h: no such
file or directory". this breaks the build process for systems having non
english locale.

ccwrap scans the output of the first compiler invocation (line 21) for
some specific english output on and around line 43.

i changed the patch to check uname -o for cygwin string and set the
locale to either C or C.UTF-8

8 years agoEnable HW interrupt setup on x86/x86_64 systems by default newlib-snapshot-20160226
Corinna Vinschen [Fri, 26 Feb 2016 17:52:46 +0000 (18:52 +0100)]
Enable HW interrupt setup on x86/x86_64 systems by default

* configure.host: Define _I386MACH_DISABLE_HW_INTERRUPTS on rdos.
Remove setting _I386MACH_ALLOW_HW_INTERRUPTS anywhere else.
* libc/machine/i386/i386mach.h: Replace test for
_I386MACH_ALLOW_HW_INTERRUPTS with test for
!_I386MACH_DISABLE_HW_INTERRUPTS.
* libc/machine/x86_64/x86_64mach.h: Ditto.
* libc/sys/linux/machine/i386/i386mach.h: Ditto.
* libm/machine/i386/i386mach.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agonewlib/configure.host: Turn off sti/cli for i386 setjmp for i386-rtems*
Joel Sherrill [Thu, 25 Feb 2016 17:43:18 +0000 (11:43 -0600)]
newlib/configure.host: Turn off sti/cli for i386 setjmp for i386-rtems*

8 years agoFix _newlib_version.h logic to support building gcc with newlib.
Jeff Johnston [Thu, 25 Feb 2016 20:04:19 +0000 (15:04 -0500)]
Fix _newlib_version.h logic to support building gcc with newlib.

8 years agocygwin: Export clog10, clog10f
Yaakov Selkowitz [Thu, 18 Feb 2016 16:51:01 +0000 (10:51 -0600)]
cygwin: Export clog10, clog10f

winsup/cygwin/
* common.din: Add clog10, clog10f.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

winsup/doc/
* new-features.xml (ov-new2.5): Mention clog10, clog10f.
* posix.xml (std-gnu): Add clog10, clog10f.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agolibm/complex: add clog10, clog10f
Yaakov Selkowitz [Thu, 18 Feb 2016 16:47:15 +0000 (10:47 -0600)]
libm/complex: add clog10, clog10f

newlib/
* libc/include/complex.h (clog10, clog10f): Declare.
* libm/complex/Makefile.am (src): Add clog10.c.
(fsrc): Add clog10f.c.
(CHEWOUT_FILES): Add clog10.def.
* libm/complex/Makefile.in: Regenerate.
* libm/complex/clog10.c: New file.
* libm/complex/clog10f.c: New file.
* libm/complex/complex.tex: Add references to clog10 docs.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agopthread.h, sys/types.h Add missing pthread methods
Joel Sherrill [Fri, 19 Feb 2016 21:45:17 +0000 (15:45 -0600)]
pthread.h, sys/types.h Add missing pthread methods

* pthread.h: Add prototypes for pthread_condattr_getclock(),
pthread_condattr_setclock(), pthread_setschedpri(),
pthread_getcpuclockid(), pthread_getconcurrency(), and
pthread_setconcurrency().  Also cleaned up file header to
remove CVS Id string.
* sys/types.h: Add clock ID to pthread_condattr_t.

8 years agoFix comments in sec_acl.cc
Corinna Vinschen [Mon, 22 Feb 2016 09:54:13 +0000 (10:54 +0100)]
Fix comments in sec_acl.cc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agossp: Fixes for 64-bit
Jon Turney [Mon, 2 Nov 2015 15:02:29 +0000 (15:02 +0000)]
ssp: Fixes for 64-bit

Fix various 32/64-bit portability issues in ssp, the single-step profiler, and
also build it for 64-bit.

This didn't turn out to actually be very useful for what I wanted to use it for,
so it's only been lightly tested.

It appears that on x86_64, single-step exceptions occur for much more of the
code in system DLLs, unlike x86, so ssp may take much, much longer to profile
some programs.  There is existing code to use breakpoints to mitigate this, but
that is currently disabled.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoUpdate Cygwin release notes.
Corinna Vinschen [Thu, 18 Feb 2016 14:56:51 +0000 (15:56 +0100)]
Update Cygwin release notes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygwin: accept SIGIOT as alias of SIGABRT
Yaakov Selkowitz [Thu, 18 Feb 2016 05:13:32 +0000 (23:13 -0600)]
cygwin: accept SIGIOT as alias of SIGABRT

winsup/cygwin/
* include/cygwin/signal.h (SIGIOT): Define SIGIOT in terms of SIGABRT.
* strsig.cc (struct sigdesc): Ditto.

winsup/doc/
* utils.xml (kill): Document SIGIOT.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agosys/features.h: Update Cygwin POSIX option macros
Corinna Vinschen [Thu, 18 Feb 2016 12:10:28 +0000 (13:10 +0100)]
sys/features.h: Update Cygwin POSIX option macros

* libc/include/sys/features.h: Set POSIX option macros from 200112L
to 200809L for Cygwin.
(_POSIX_SPAWN): Set to 200809L for Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop temporary declaration of GetSystemTimePreciseAsFileTime.
Corinna Vinschen [Thu, 18 Feb 2016 11:38:24 +0000 (12:38 +0100)]
Drop temporary declaration of GetSystemTimePreciseAsFileTime.

* times.cc (GetSystemTimePreciseAsFileTime): Remove declaration
and accompanying comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agosetuid: Create token from scratch without credentials of caller
Corinna Vinschen [Wed, 17 Feb 2016 15:40:27 +0000 (16:40 +0100)]
setuid: Create token from scratch without credentials of caller

* sec_auth.cc (get_token_group_sidlist): Drop auth_luid and
auth_pos parameter.  Remove code adding a logon SID.
(get_initgroups_sidlist): Drop auth_luid and auth_pos parameter.
Drop in call to get_token_group_sidlist. Accommodate in callers.
(get_setgroups_sidlist): Ditto.
(create_token): Explicitely set auth_luid to ANONYMOUS_LOGON_LUID
or LOCALSERVICE_LUID depending on OS.  Explain why.
Remove handling of logon SID since we don't generate one anymore.
(lsaauth): Drop now unused local variable auth_luid and auth_pos.
* wincap.h (wincaps::has_broken_whoami): New element.
* wincap.cc: Implement above element throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAlso fix libm/machine generated files.
Jeff Johnston [Wed, 17 Feb 2016 22:08:54 +0000 (17:08 -0500)]
Also fix libm/machine generated files.

8 years agoFix libm regenerated files again.
Jeff Johnston [Wed, 17 Feb 2016 22:06:46 +0000 (17:06 -0500)]
Fix libm regenerated files again.

8 years agoFix regeneration of libm autotool files.
Jeff Johnston [Wed, 17 Feb 2016 21:49:59 +0000 (16:49 -0500)]
Fix regeneration of libm autotool files.

8 years agoDefine the newlib version macros in one place: _newlib_version.h.
Pieter du Preez [Sun, 14 Feb 2016 10:12:06 +0000 (11:12 +0100)]
Define the newlib version macros in one place: _newlib_version.h.

Currently, the newlib version information needs to be updated in two places:
 - newlib/acinclude.m4
 - newlib/libc/include/sys/features.h

The goal of this patch is to:
 - supply a single location for defining the newlib version
   information: newlib/acinclude.m4
 - define __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__
   This is in line with what gcc does for its version macros. See:
   https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

This patch moves the definition of the _NEWLIB_VERSION, __NEWLIB__
and __NEWLIB_MINOR__ macros from newlib/libc/include/sys/features.h,
to the newly generated newlib/_newlib_version.h file. Additionally,
the __NEWLIB_PATCHLEVEL__ macro was created, for completeness.

In order to stay backwards compatible, newlib/_newlib_version.h gets
included by newlib/newlib.h and newlib/libc/include/sys/features.h.

Note: This patch does _not_ include the modifications to the following
files, as these should all be generated any way.
      *Makefile.in,
      *aclocal.m4,
      *configure
      stamp-* files

Signed-off-by: Pieter du Preez <pdupreez@gmail.com>
8 years agocyglsa: Drop code handling Windows 2000 and earlier
Corinna Vinschen [Wed, 17 Feb 2016 15:08:59 +0000 (16:08 +0100)]
cyglsa: Drop code handling Windows 2000 and earlier

* cyglsa.c (must_create_logon_sid): Remove.
(LsaApInitializePackage): Drop checking version and setting
must_create_logon_sid accordingly.
(LsaApLogonUserEx): Drop code setting login SID only required on
Windows 2000 and earlier.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoSilent relocation truncations considered harmful
Mark Geisert [Wed, 17 Feb 2016 09:55:16 +0000 (10:55 +0100)]
Silent relocation truncations considered harmful

This follows up from my msg re GMP-ECM failing its 'make check' on the
main list https://cygwin.com/ml/cygwin/2016-02/msg00147.html .

There's an error that ought to be reported during dynamic linking if the
linked-to address is too far from the relocation site.  However the error
is not reported if __OPTIMIZE__ was #defined when building the Cygwin DLL.
I can't see why optimization settings should affect this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygwin_conv_path: Really always preserve trailing slash in conversion to POSIX path
Corinna Vinschen [Mon, 15 Feb 2016 15:25:10 +0000 (16:25 +0100)]
cygwin_conv_path: Really always preserve trailing slash in conversion to POSIX path

* mount.cc (mount_info::conv_to_posix_path): Account for scenarios
where the path is identical to a mount point in terms of preserving
the trailing slash in the output.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMake buffered console characters visible to select().
John Hood [Sat, 30 Jan 2016 22:36:43 +0000 (17:36 -0500)]
Make buffered console characters visible to select().

8 years agoDocument pthread_barrier* functions as implemented
Corinna Vinschen [Sat, 13 Feb 2016 16:03:36 +0000 (17:03 +0100)]
Document pthread_barrier* functions as implemented

posix.xml (std-susv4): Add pthread_barrier* functions.
(std-notimpl): Remove here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoRemove local winbase.h (again).
Corinna Vinschen [Sat, 13 Feb 2016 15:56:12 +0000 (16:56 +0100)]
Remove local winbase.h (again).

Mingw32-w64 supports all required inline Interlocked functions in the
meantime.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoBump Cygwin version to 2.5.0
Corinna Vinschen [Sat, 13 Feb 2016 15:49:47 +0000 (16:49 +0100)]
Bump Cygwin version to 2.5.0

Add a release file.  Add release text to documentation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoPOSIX barrier implementation, take 3
Václav Haisman [Fri, 12 Feb 2016 21:25:59 +0000 (22:25 +0100)]
POSIX barrier implementation, take 3

The attached patch should address all of the review comments.

Modifed change log:

Newlib:

* libc/include/sys/features.h (_POSIX_BARRIERS): Define for Cygwin.
* libc/include/sys/types.h (pthread_barrier_t)
(pthread_barrierattr_t): Do not define for Cygwin.

Cygwin:

* common.din (pthread_barrierattr_init)
(pthread_barrierattr_setpshared, pthread_barrierattr_getpshared)
(pthread_barrierattr_destroy, pthread_barrier_init)
(pthread_barrier_destroy, pthread_barrier_wait): Export.
* include/cygwin/types.h (pthread_barrierattr_t)
(pthread_barrier_t): Declare.
* include/pthread.h (PTHREAD_BARRIER_SERIAL_THREAD)
(pthread_barrierattr_init, pthread_barrierattr_setpshared)
(pthread_barrierattr_getpshared, pthread_barrierattr_destroy)
(pthread_barrier_init, pthread_barrier_destroy)
(pthread_barrier_wait): Declare.
* thread.h (PTHREAD_BARRIER_MAGIC)
(PTHREAD_BARRIERATTR_MAGIC): Define.
(class pthread_barrierattr, class pthread_barrier): Declare.
* thread.cc (delete_and_clear): New local helper function.
(class pthread_barrierattr, class pthread_barrier): Implement.
* miscfuncs.h (likely, unlikely): New macros.

--
VH

8 years agocygwin: work around GCC 5 preprocessor changes
Yaakov Selkowitz [Fri, 12 Feb 2016 22:02:13 +0000 (16:02 -0600)]
cygwin: work around GCC 5 preprocessor changes

GCC 5 adds #line directives (and hence extra newlines) for macros
expansions, which confuses cygmagic.  Using the -P flag avoids
them entirely.

https://cygwin.com/ml/cygwin-patches/2016-q1/msg00016.html

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoBump Cygwin version to 2.4.2.
Corinna Vinschen [Fri, 12 Feb 2016 20:23:20 +0000 (21:23 +0100)]
Bump Cygwin version to 2.4.2.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygwin: fix errors with GCC 5
Yaakov Selkowitz [Fri, 12 Feb 2016 17:17:35 +0000 (11:17 -0600)]
cygwin: fix errors with GCC 5

GCC 5 switched from C89 to C11 by default. This implies a change from
GNU to C99 inline by default, which have very different meanings of
extern inline vs. static inline:

https://gcc.gnu.org/onlinedocs/gcc/Inline.html

Marking these as gnu_inline retains the previous behaviour.

winsup/cygwin/
* exceptions.cc (exception::handle): Change debugging to int to fix
an always-true boolean comparison warning.
* include/cygwin/config.h (__getreent): Mark gnu_inline.
* winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoRemove broken ieeefp.h macros
Yaakov Selkowitz [Fri, 12 Feb 2016 02:23:10 +0000 (20:23 -0600)]
Remove broken ieeefp.h macros

Any attempt to use isnanf, isinff, or finitef from <ieeefp.h> with
GCC 5 on platforms other than SPU result in a "lvalue required as
unary '&' operand" error.

newlib/libc/
* include/ieeefp.h (__ieeefp_isnanf): Remove broken macro.
(__ieeefp_isinff, __ieeefp_finitef): Ditto.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoFix compile with GCC 5 -Werror
Yaakov Selkowitz [Fri, 12 Feb 2016 02:16:06 +0000 (20:16 -0600)]
Fix compile with GCC 5 -Werror

newlib/libc/
* stdio64/freopen64.c: Include <string.h> for memset().
* stdlib/quick_exit.c: Include <unistd.h> for _exit().
* string/gnu_basename.c (__gnu_basename): Fix discarded const
qualifier warning.
* stdlib/strtold.c: Include "mprec.h" for _strtorx_r().

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agocygwin_conv_path: Always preserve trailing backslashes in conversion to POSIX paths
Corinna Vinschen [Tue, 9 Feb 2016 14:00:30 +0000 (15:00 +0100)]
cygwin_conv_path: Always preserve trailing backslashes in conversion to POSIX paths

* include/sys/cygwin.h (CCP_CONVFLAGS_MASK): Define.
* mount.h (__CCP_APP_SLASH): Define.
* mount.cc (mount_info::conv_to_posix_path): Handle __CCP_APP_SLASH
flag.
* path.cc (cygwin_conv_path): Use CCP_CONVFLAGS_MASK to evaluate
"how" flag values.  Always add __CCP_APP_SLASH flag when calling
mount_info::conv_to_posix_path.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoSeperate MSP430 cio syscalls into individual function sections.
Nick Clifton [Tue, 9 Feb 2016 13:44:05 +0000 (13:44 +0000)]
Seperate MSP430 cio syscalls into individual function sections.

    START_FUNC: New macro.
    END_FUNC: New macro.
    exit, isatty, getpid, sc2: Use the new macros.

8 years agoprintf(3): Handle multibyte decimal point in field size computation
Corinna Vinschen [Mon, 8 Feb 2016 12:33:17 +0000 (13:33 +0100)]
printf(3): Handle multibyte decimal point in field size computation

  This patch fixes the problem reported in
  https://cygwin.com/ml/cygwin/2016-02/msg00014.html

  The 2009 changes to handle multibyte decimal point and thousands
  separator missed to take the length of a multibyte decimal point into
  account when computing the field size.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agostdio.h: Use __POSIX_VISIBLE etc. guards for POSIX 1003.1:2001 functions
Jon Turney [Thu, 4 Feb 2016 17:07:44 +0000 (17:07 +0000)]
stdio.h: Use __POSIX_VISIBLE etc. guards for POSIX 1003.1:2001 functions

Current mesa expects stdio.h to prototype fileno() when compiling with gcc
-std=c99 -D_XOPEN_SOURCE

Fix the 'POSIX 1003.1:2001' block in stdio.h to prototype functions if not
__STRICT_ANSI__, or _BSD_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE are defined
appropriately

As far as I can tell, despite being in this block, setbuffer() and setlinebuf()
are BSDisms which aren't in POSIX 1003.1:2001

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoNewlib build is broken if configured with nano-malloc and non-reentrant system calls
Игорь Веневцев [Fri, 29 Jan 2016 15:19:57 +0000 (18:19 +0300)]
Newlib build is broken if configured with nano-malloc and non-reentrant system calls

Non-reentrant system calls version implies both MISSING_SYSCALL_NAMES
and REENTRANT_SYSCALL_PROVIDED macros to be defined.
Being coupled with --enable-newlib-nano-malloc knob it breaks the build:

bash-4.3$ ../newlib-2.3.0.20160104/configure CC_FOR_TARGET=gcc
AR_FOR_TARGET=ar RANLIB_FOR_TARGET=ranlib CFLAGS_FOR_TARGET="-m32
-DMISSING_SYSCALL_NAMES -DREENTRANT_SYSCALLS_PROVIDED"
--target=i386-elf --enable-newlib-nano-malloc && make

<...omitted output...>

../../../../../../newlib-2.3.0.20160104/newlib/libc/stdlib/nano-mallocr.c:
In function ‘_mallinfo_r’:
../../../../../../newlib-2.3.0.20160104/newlib/libc/stdlib/nano-mallocr.c:489:35:
error: macro "_sbrk_r" requires 2 arguments, but only 1 given
         sbrk_now = _sbrk_r(RCALL 0);
                                   ^
../../../../../../newlib-2.3.0.20160104/newlib/libc/stdlib/nano-mallocr.c:489:20:
error: ‘_sbrk_r’ undeclared (first use in this function)
         sbrk_now = _sbrk_r(RCALL 0);
                    ^
../../../../../../newlib-2.3.0.20160104/newlib/libc/stdlib/nano-mallocr.c:489:20:
note: each undeclared identifier is reported only once for each
function it appears in
Makefile:1512: recipe for target 'lib_a-nano-mallinfor.o' failed
make[8]: *** [lib_a-nano-mallinfor.o] Error 1

In case of non-reentrant system calls _sbrk_r became a macro with TWO
args (defined in reent.h):

#define _sbrk_r(__reent, __incr)  sbrk(__incr)

But in our case only one argument is present. (RCALL 0) is considered
as a single argument despite RCALL itself is a macro:)

So intermediate one-arg macro will be enough to expand args before
final _sbrk_r expansion:

#define _SBRK_R(X) _sbrk_r(X)

Here is a patch:

8 years ago* newlib/libc/stdio/nano-vfscanf.c: Fix '%X' specifier procesing
Igor Venevtsev [Mon, 1 Feb 2016 14:31:43 +0000 (17:31 +0300)]
* newlib/libc/stdio/nano-vfscanf.c: Fix '%X' specifier procesing

8 years ago* newlib/libc/stdio/nano-vfscanf.c: Fix '%F', '%G' and '%E' specifiers processing
Igor Venevtsev [Tue, 2 Feb 2016 10:50:09 +0000 (13:50 +0300)]
* newlib/libc/stdio/nano-vfscanf.c: Fix '%F', '%G' and '%E' specifiers processing

8 years agoChange if_nameindex() to use unsigned int i variable.
Jeff Johnston [Thu, 4 Feb 2016 18:30:14 +0000 (13:30 -0500)]
Change if_nameindex() to use unsigned int i variable.

- i variable used in loop that shifts to right so use
  unsigned int instead

8 years agoinclude/grp.h: Remove prototypes of non-standard functions
Corinna Vinschen [Fri, 29 Jan 2016 12:39:57 +0000 (13:39 +0100)]
include/grp.h: Remove prototypes of non-standard functions

* libc/include/grp.h (group_from_gid): Remove prototype.
(setgrfile): Ditto.
(setgroupent): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix memcpy bug that reads past end of buffer.
Steve Ellcey [Thu, 28 Jan 2016 22:08:35 +0000 (14:08 -0800)]
Fix memcpy bug that reads past end of buffer.

* libc/machine/mips/memcpy.S (memcpy): Fix read past end of
input.

8 years agogrp.h: use __BSD_VISIBLE and __XSI_VISIBLE guards
Yaakov Selkowitz [Thu, 28 Jan 2016 21:39:02 +0000 (15:39 -0600)]
grp.h: use __BSD_VISIBLE and __XSI_VISIBLE guards

This fixes the build of krb5 and other packages on Cygwin.

* libc/include/grp.h: Use __BSD_VISIBLE and __XSI_VISIBLE guards.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoTreat ACLs with extra ACEs for Admins and SYSTEM like a trivial ACL
Corinna Vinschen [Thu, 28 Jan 2016 21:05:49 +0000 (22:05 +0100)]
Treat ACLs with extra ACEs for Admins and SYSTEM like a trivial ACL

POSIX.1e requires that chmod changes the MASK rather than the
GROUP_OBJ value if the ACL is non-trivial.

On Windows, especially on home machines, a standard ACL often
consists of entries for the user, maybe the group, and additional
entries for SYSTEM and the Administrators group.  A user calling
chmod on a file with bog standard Windows perms usually expects
that chmod changes the GROUP_OBJ perms, but given the rules from
POSIX.1e we can't do that.

However, since we already treat Admins and SYSTEM special in a
ACL (they are not used in MASK computations) we go a step in the
Windows direction to follow user expectations.  If an ACL only
consists of the three POSIX permissions, plus entries for Admins
and SYSTEM *only*, then we change the permissions of the GROUP_OBJ
entry *and* the MASK entry.

* fhandler_disk_file.cc (fhandler_disk_file::chmod): Drop unused
code.  Add special handling for a "standard" Windows ACL.  Add
comment to explain.
* sec_acl.cc (get_posix_access): Allow to return "standard-ness"
of an ACL to the caller.  Add preceeding comment to explain a bit.
* security.h (get_posix_access): Align prototype.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoget_posix_access: Fix primary group handing when multiple ACEs exist
Corinna Vinschen [Thu, 28 Jan 2016 13:34:11 +0000 (14:34 +0100)]
get_posix_access: Fix primary group handing when multiple ACEs exist

Handle additional ACE for primary group only as another GROUP
entry if it's an allow ACE.  Deny ACEs don't qualify.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMake macro checks ARMv8-M baseline proof
Thomas Preud'homme [Thu, 28 Jan 2016 10:26:09 +0000 (11:26 +0100)]
Make macro checks ARMv8-M baseline proof

libgloss:

        * arm/Makefile.in: Add newlib/libc/machine/arm to the include path if
        newlib is present.
        * arm/arm.h: Include acle-compat.h.
        (THUMB_V7_V6M): Rename to ...
        (PREFER_THUMB): This.  Use ACLE macros __ARM_ARCH_ISA_ARM instead of
        __ARM_ARCH_6M__ to decide whether to define it.
        (THUMB1_ONLY): Define for Thumb-1 only targets.
        (THUMB_V7M_V6M): Rename to ...
        (THUMB_VXM): This.  Defined based on __ARM_ARCH_ISA_ARM, excluding
        ARMv7.
        * arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__,
        !__ARM_ARCH_ISA_ARM rather than THUMB_V7M_V6M for fp enabling, and
        PREFER_THUMB rather than THUMB_V7_V6M.  Rename other occurences of
        THUMB_V7M_V6M to THUMB_VXM.
        * arm/linux-crt0.c: Likewise.
        * arm/redboot-crt0.S: Likewise.
        * arm/swi.h: Likewise.
        * arm/trap.S: Likewise.

newlib:

        * libc/machine/arm/memcpy-stub.c: Use ACLE macros __ARM_ARCH_ISA_THUMB
        and __ARM_ARCH_ISA_ARM to check for Thumb-2 only targets rather than
        __ARM_ARCH and __ARM_ARCH_PROFILE.
        * libc/machine/arm/memcpy.S: Likewise.
        * libc/machine/arm/setjmp.S: Likewise for Thumb-1 only target and
        include acle-compat.h.
        * libc/machine/arm/strcmp.S: Likewise for Thumb-1 and Thumb-2 only
        target and include acle-compat.h.
        * libc/sys/arm/arm.h: Include acle-compat.h.
        (THUMB_V7_V6M): Rename to ...
        (PREFER_THUMB): This.  Use ACLE macro __ARM_ARCH_ISA_ARM instead of
        __ARM_ARCH_6M__ to decide whether to define it.
        (THUMB1_ONLY): Define for Thumb-1 only targets.
        (THUMB_V7M_V6M): Rename to ...
        (THUMB_VXM): This.  Defined based on __ARM_ARCH_ISA_ARM, excluding
        ARMv7.
        * libc/sys/arm/crt0.S: Use PREFER_THUMB rather than THUMB_V7_V6M and
        rename THUMB_V7M_V6M into THUMB_VXM.
        * libc/sys/arm/swi.h: Likewise.

8 years agoDeprecate newlib and winsup ChangeLog files
Corinna Vinschen [Thu, 28 Jan 2016 10:15:33 +0000 (11:15 +0100)]
Deprecate newlib and winsup ChangeLog files

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDon't use LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32). It hangs
Corinna Vinschen [Wed, 27 Jan 2016 14:43:15 +0000 (15:43 +0100)]
Don't use LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32).  It hangs

Observed running hexchat under X.  For some reason the call to
LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32) in dll_load
hangs when trying to autoload MsgWaitForMultipleObjectsEx in
select.cc after hexchat forks to run DNS calls.  Dropping the
call and just using full paths as in 2.3.1 fixes the issue.

* autoload.cc (dll_load): Drop call to LoadLibraryEx with
LOAD_LIBRARY_SEARCH_SYSTEM32 flag.
* wincap.h (wincaps::has_load_lib_search_flags): Remove.
* wincap.cc (wincaps::has_load_lib_search_flags): Drop handling
this flag.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop has_broken_fnoi flag
Corinna Vinschen [Wed, 27 Jan 2016 14:39:11 +0000 (15:39 +0100)]
Drop has_broken_fnoi flag

* mount.cc (fs_info::update): Don't set has_broken_fnoi.  It's
unused anyway.
* mount.h (class fs_info): Remove has_broken_fnoi status flag.
* path.h (class path_conv): Remove has_broken_fnoi method.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMake select wait state more readable
Corinna Vinschen [Mon, 25 Jan 2016 20:00:14 +0000 (21:00 +0100)]
Make select wait state more readable

Rename "res" to "wait_state" and change its type to
select_stuff::wait_states.  Use select_stuff::wait_states
values instead of ints throughout.  Rearrange a few comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix missing 'user' in usertemp docs
Corinna Vinschen [Mon, 25 Jan 2016 09:09:55 +0000 (10:09 +0100)]
Fix missing 'user' in usertemp docs

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd 2.4.1 release message file cygwin-2_4_1-release
Corinna Vinschen [Sat, 23 Jan 2016 21:33:31 +0000 (22:33 +0100)]
Add 2.4.1 release message file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygpath: Avoid returning SysWOW64
Corinna Vinschen [Thu, 21 Jan 2016 17:40:30 +0000 (18:40 +0100)]
cygpath: Avoid returning SysWOW64

On Cygwin 32 running under WOW64:

When case-correcting the path fetched with -S, the underlying
Windows function fetching the normalized path returns the real
path C:\Windows\SysWOW64 instead of the path redirection
enabled C:\Windows\System32 path.  This breaks using the result
of `cygpath -S' to fetch the POSIX path of the network related
files under SYSTEMROOT\drivers\etc.  This path is in fact under
the *real* C:\Windows\System32 and only mapped into the 32 bit
C:\Windows\System32 (aka C:\Windows\SysWOW64) via path redirection.
Sounds messy?

This patch checks if we're running under WOW64.  If so, it
changes the path returned by GetSystemDirectoryW from "system32"
to "Sysnative".  This in turn is changed to "System32" by
NtQueryInformationFile, so we're back to what we need.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygwin_logon_user: Return non-privileged token as well
Corinna Vinschen [Thu, 21 Jan 2016 17:32:16 +0000 (18:32 +0100)]
cygwin_logon_user: Return non-privileged token as well

If the calling process doesn't have sufficient privileges to
fetch the linked token of an admin-user token, cygwin_logon_user
fails.  This patch changes that by returning the original,
unprivileged token of the admin user to allow authentication
and calling setuid for the current process.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix formatting in sec_auth.cc
Corinna Vinschen [Thu, 21 Jan 2016 17:27:05 +0000 (18:27 +0100)]
Fix formatting in sec_auth.cc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoBump cygwin version to 2.4.1
Corinna Vinschen [Sat, 16 Jan 2016 11:57:53 +0000 (12:57 +0100)]
Bump cygwin version to 2.4.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agofaq: Update FAQ question and answer about gdb and signals
Jon Turney [Thu, 14 Jan 2016 17:44:18 +0000 (17:44 +0000)]
faq: Update FAQ question and answer about gdb and signals

    * faq-programming.xml: Update question and answer about gdb and signals.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoget_posix_access: Fix group deny bits leaking into file type attribute bits cygwin-2_4_0-release
Corinna Vinschen [Fri, 15 Jan 2016 14:13:11 +0000 (15:13 +0100)]
get_posix_access: Fix group deny bits leaking into file type attribute bits

* sec_acl.cc (get_posix_access): Fix bracketing in expression
constructing POSIX group permissions so as not leaking deny bits
into POSIX file type bits.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoInitialize handle in dll_load to avoid compiler warning
Corinna Vinschen [Tue, 12 Jan 2016 14:45:17 +0000 (15:45 +0100)]
Initialize handle in dll_load to avoid compiler warning

* autoload.cc (dll_load): Initialize h to NULL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoUse MAKEWORD macro in WSAStartup call per documentation
Corinna Vinschen [Tue, 12 Jan 2016 14:25:15 +0000 (15:25 +0100)]
Use MAKEWORD macro in WSAStartup call per documentation

* autoload.cc (wsock_init): Use MAKEWORD macro to create requested
version rather than handcrafted expression.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoTry loading with safe path using LOAD_LIBRARY_SEARCH_SYSTEM32 first
Corinna Vinschen [Tue, 12 Jan 2016 14:23:14 +0000 (15:23 +0100)]
Try loading with safe path using LOAD_LIBRARY_SEARCH_SYSTEM32 first

* autoload.cc (dll_load): Move safe loading from std_dll_init here.
Add code to handle systems supporting LOAD_LIBRARY_SEARCH flags.
Add comments to explain what the code is doing.  Fix up comment
preceeding this function.
(std_dll_init): Move safe loading code to dll_load.
* wincap.h (wincaps::has_load_lib_search_flags): New element.
        * wincap.cc: Implement above element throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix previous fix for generating unique inode numbers for sockets
Corinna Vinschen [Mon, 11 Jan 2016 18:10:45 +0000 (19:10 +0100)]
Fix previous fix for generating unique inode numbers for sockets

* fhandler.h (fhandler_base::get_plain_ino): New inline method.
Add comment to explain what it's supposed to be used for.
* fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Create
filename using inode number.
(fhandler_socket::fstat): Generate inode number from filename if
ino is not set (that's the case in a stat(2) call).
* pipe.cc: Throughout, use get_plain_ino when appropriate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoRevert "autoload.cc: Drop using full paths for system DLLs"
Corinna Vinschen [Mon, 11 Jan 2016 17:46:01 +0000 (18:46 +0100)]
Revert "autoload.cc: Drop using full paths for system DLLs"

This reverts commit 4b104ce07070e32363a217a554441a8b4df69d12.

The DLLs always guaranteed to be loaded from the system dir are only
those in the KnownDLLs list.  We're using some DLLs not in that list on
all supported OSes, thus we need to make sure to use full paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoReturn unique inode numbers when calling stat/fstat on pipes and IP sockets
Corinna Vinschen [Mon, 11 Jan 2016 11:35:41 +0000 (12:35 +0100)]
Return unique inode numbers when calling stat/fstat on pipes and IP sockets

        * fhandler.h (class fhandler_base): Convert unique_id to int64_t.
        (fhandler_base::set_ino): New protected inline method.
        (fhandler_base::get_unique_id): Convert to int64_t.
        (fhandler_base::set_unique_id): New inline method taking int64_t.
        (fhandler_pipe::fstat): Declare.
        (fhandler_pipe::init): Take extra parameter.
        (fhandler_pipe::create): Ditto.
        * fhandler_socket.cc (fhandler_socket::init_events): Set inode number
        to serial number.
        (fhandler_socket::fstat): Set device to DEV_TCP_MAJOR.  Create st_ino
        from get_ino.
        * include/cygwin/signal.h (struct _sigcommune): Replace
        _si_pipe_fhandler with _si_pipe_unique_id.
        * pinfo.h (_pinfo::pipe_fhandler): Take unique id instead of HANDLE.
        * pinfo.cc (commune_process): Accommodate change to _si_pipe_unique_id.
        (_pinfo::commune_request): Ditto.
        (_pinfo::pipe_fhandler): Ditto.
        * pipe.cc (fhandler_pipe::init): Take unique id as argument and set
        inode number and unique_id from there.
        (fhandler_pipe::open): Rework to find any matching pipe from unique
        id in filename.
        (fhandler_pipe::get_proc_fd_name): Create filename using inode number.
        (fhandler_pipe::create): Generate and return unique id from process pid
        and pipe_unique_id.  In outer method, call init with additional unique
        id as parameter.
        (fhandler_pipe::fstat): New method.
        (pipe_worker): Accommodate using 64 bit inode number in filename.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoselect(2): Drop checking descriptors in case of immediate timeout.
Corinna Vinschen [Mon, 11 Jan 2016 09:36:33 +0000 (10:36 +0100)]
select(2): Drop checking descriptors in case of immediate timeout.

* select.cc (select): Call sel.poll only if sel.wait returned
select_ok.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd release message for previous commit
Corinna Vinschen [Sat, 9 Jan 2016 14:05:21 +0000 (15:05 +0100)]
Add release message for previous commit

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoselect: Don't timeout without setting descriptor arrays to all zero
Corinna Vinschen [Sat, 9 Jan 2016 13:53:06 +0000 (14:53 +0100)]
select: Don't timeout without setting descriptor arrays to all zero

        * select.cc (copyfd_set): Remove.
        (select): Don't copy local wait fd arrays over to returned fd arrays
        since bits set there are not accounted for in return value.  Zero out
        returned fd arrays instead.  Always call sel.poll even in case of a
        timeout.  Always zero out fd array when timing out.  Convert while/do
        to do/while for clarity.  Use dedicated variable as return value to
        decouple return value from artificial return code from sel.wait.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDo not treat the command line or environment like paths
Johannes Schindelin [Thu, 17 Dec 2015 15:22:49 +0000 (16:22 +0100)]
Do not treat the command line or environment like paths

* dcrt0.cc (dll_crt0_1), environ.cc (environ_init, getwinenveq,
build_env), strfuncs.cc (sys_wcstombs, sys_wcstombs_alloc),
wchar.c (sys_wcstombs, sys_wcstombs_alloc): avoid mis-conversions
of text that does not, actually, refer to a path or file name

Detailed explanation:

Our WCS -> UTF conversion handles the private Unicode page specially
to allow for otherwise invalid file names. However, this handling makes
no sense for command-lines, nor environment variables, which we would
rather convert verbatim.

As a stop-gap solution, let's just introduce a version of the
sys_wcstombs() function that specifically excludes that file name
conversion magic.

The proper solution is to change sys_wcstombs() to assume that it is not
a path that wants to be converted, and introduce sys_wcstombs_path()
that does, but that is a bigger task which we leave for another patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
8 years agoDeprecate all winsup ChangeLog files
Corinna Vinschen [Thu, 7 Jan 2016 20:16:01 +0000 (21:16 +0100)]
Deprecate all winsup ChangeLog files

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygpath: Try to return system directories with correct case
Corinna Vinschen [Thu, 7 Jan 2016 20:07:56 +0000 (21:07 +0100)]
cygpath: Try to return system directories with correct case

* cygpath.cc (do_sysfolders): Drop lame workaround to fix case of
directory returned by GetSystemDirectoryW.  Try to fix case of
any path returned by this function in case it has to return a
POSIX path to support case-sensitivity.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoselect: Set exceptfd bit if fetching mailslot info fails
Corinna Vinschen [Thu, 7 Jan 2016 17:01:44 +0000 (18:01 +0100)]
select: Set exceptfd bit if fetching mailslot info fails

* select.cc (peek_mailslot): Set except_ready if GetMailslotInfo fails.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoselect.cc: Fit comments into 80 columns
Corinna Vinschen [Thu, 7 Jan 2016 16:56:33 +0000 (17:56 +0100)]
select.cc: Fit comments into 80 columns

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoConvert utmp{x}name to int, return useful value. Define _PATH_UTMPX
Corinna Vinschen [Thu, 7 Jan 2016 14:40:40 +0000 (15:40 +0100)]
Convert utmp{x}name to int, return useful value.  Define _PATH_UTMPX

* syscalls.cc (utmpname): Convert to int.  Return 0 if strdup
worked, -1 otherwise.
* include/utmpx.h (_PATH_UTMPX): Define as _PATH_UTMP.
(utmpxname): Declare as int function.
* include/sys/utmp.h (utmpname): Ditto.
* include/cygwin/version.h: Bump API minor version.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop use of not yet available type acl_perm_t
Corinna Vinschen [Thu, 7 Jan 2016 12:28:12 +0000 (13:28 +0100)]
Drop use of not yet available type acl_perm_t

* sec_acl.cc (__aclcalcmask): Use mode_t instead of acl_perm_t

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDeprecate Cygwin ChangeLog file
Corinna Vinschen [Thu, 7 Jan 2016 12:23:05 +0000 (13:23 +0100)]
Deprecate Cygwin ChangeLog file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.074494 seconds and 5 git commands to generate.