]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
7 years agoUse allocation granularity as the 'page_size' in /proc/<pid>/status as well, for...
Erik M. Bray [Wed, 16 Nov 2016 14:50:34 +0000 (15:50 +0100)]
Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm

7 years agostatm should report memory as multiples of allocation_granularity instead of page_size
Erik M. Bray [Wed, 16 Nov 2016 14:36:41 +0000 (15:36 +0100)]
statm should report memory as multiples of allocation_granularity instead of page_size

that ensures that values in statm mupltiplied by POSIX _SC_PAGESIZE give the correct values

7 years agosys/cdefs.h: Define __hidden as empty on Cygwin
Corinna Vinschen [Tue, 8 Nov 2016 15:14:43 +0000 (16:14 +0100)]
sys/cdefs.h: Define __hidden as empty on Cygwin

Non-default visibility attributes are unsupported on PE/COFF, so don't
use in __hidden definition for Cygwin.  Add comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoUse external header file for kernel space time
Sebastian Huber [Thu, 27 Oct 2016 06:38:17 +0000 (08:38 +0200)]
Use external header file for kernel space time

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoAdd kernel space header for <sys/lock.h> for RTEMS
Sebastian Huber [Thu, 27 Oct 2016 06:38:16 +0000 (08:38 +0200)]
Add kernel space header for <sys/lock.h> for RTEMS

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoUse external header file for kernel space types
Sebastian Huber [Thu, 27 Oct 2016 06:38:15 +0000 (08:38 +0200)]
Use external header file for kernel space types

The FreeBSD kernel types are not used in Newlib.  Provide them via an
external header file to decouple Newlib and FreeBSD updates for RTEMS.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoProvide cap_ioctl_t for RTEMS
Sebastian Huber [Thu, 27 Oct 2016 06:38:14 +0000 (08:38 +0200)]
Provide cap_ioctl_t for RTEMS

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
8 years agoFix pdf build failure with texinfo 6.1.0
Thomas Preudhomme [Tue, 25 Oct 2016 15:11:09 +0000 (16:11 +0100)]
Fix pdf build failure with texinfo 6.1.0

Hi,

make pdf on Ubuntu 16.04 fail with:

newlib/libc/libc.texinfo:9: Missing @endcsname inserted.

After a lot of fiddling the reason appears to be the combination of concept
and function index despite a lack of concept index entries. Arguably texinfo
should not error in that case but here we are, newlib will fail to build its
documentation on some systems because of this. Since libc.texinfo only
contains function index entries this patch simply removes the combination of
indices. It does the same for libm.texinfo which has concept index entries but
no function index entries.

Tested by running make pdf, make dvi, make info and make html successfully.
libc.pdf appears to have only one index as expected.

== Proposed commit message ==

Fix pdf build failure with texinfo 6.1.0 as provided in Ubuntu 16.04. Index
combination in libc.texinfo and libm.texinfo fails because both file have only
one type of index entries. Removing index combination is thus harmless and
solves the problem.

Is this ok for master?

Best regards,

Thomas

8 years agoProvide vm_page_t for RTEMS via <machine/_types.h>
Sebastian Huber [Tue, 25 Oct 2016 06:34:24 +0000 (08:34 +0200)]
Provide vm_page_t for RTEMS via <machine/_types.h>

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
8 years agoProvide rman_res_t for RTEMS via <machine/types.h>
Sebastian Huber [Tue, 25 Oct 2016 05:13:50 +0000 (07:13 +0200)]
Provide rman_res_t for RTEMS via <machine/types.h>

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
8 years agoProvide __intmax_t and __uintmax_t
Sebastian Huber [Tue, 25 Oct 2016 05:13:49 +0000 (07:13 +0200)]
Provide __intmax_t and __uintmax_t

Provide __intmax_t and __uintmax_t via <machine/_default_types.h> and
define intmax_t and uintmax_t in <sys/_stdint.h> for FreeBSD
compatibility.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
8 years agoFix typo in <sys/_stdint.h>
Sebastian Huber [Tue, 25 Oct 2016 05:13:48 +0000 (07:13 +0200)]
Fix typo in <sys/_stdint.h>

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
8 years agoFix ShellExecuteW comment
Corinna Vinschen [Mon, 24 Oct 2016 09:23:55 +0000 (11:23 +0200)]
Fix ShellExecuteW comment

ShellExecuteW long path behaviour is now stable: It doesn't work since
Windows 8.1.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agopldd: Fix resource leak and missing check if fopen failed
Corinna Vinschen [Sun, 23 Oct 2016 15:22:34 +0000 (17:22 +0200)]
pldd: Fix resource leak and missing check if fopen failed

Fixes Coverity CID 66903

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agopasswd: Fix potential buffer overflow
Corinna Vinschen [Sun, 23 Oct 2016 15:16:30 +0000 (17:16 +0200)]
passwd: Fix potential buffer overflow

Fixes Coverity CID 66956

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agomkgroup/mkpasswd: Fix potential buffer overwrite in corner case
Corinna Vinschen [Sun, 23 Oct 2016 15:02:24 +0000 (17:02 +0200)]
mkgroup/mkpasswd: Fix potential buffer overwrite in corner case

Fixes Coverity CIDs 60076, 60077 and 60081

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agogetfacl: Don't trust length of incoming user/groupname
Corinna Vinschen [Sun, 23 Oct 2016 14:52:28 +0000 (16:52 +0200)]
getfacl: Don't trust length of incoming user/groupname

Fixes Coverity CIDs 60079 and 60080

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agotzset: Fix array length given to GetGeoInfoW
Corinna Vinschen [Sun, 23 Oct 2016 14:45:21 +0000 (16:45 +0200)]
tzset: Fix array length given to GetGeoInfoW

Fixes Coverity CID 66916

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agostrace: Fix Coverity issues
Corinna Vinschen [Sun, 23 Oct 2016 14:38:48 +0000 (16:38 +0200)]
strace: Fix Coverity issues

CID 66964: Don't trust environment variable without length check
CID 66968: Add missing va_end

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Use snprintf instead of multiple strcat
Corinna Vinschen [Sun, 23 Oct 2016 14:16:22 +0000 (16:16 +0200)]
cygcheck: Use snprintf instead of multiple strcat

This not only simplifies the code but also fixes potential
memory corruption

Fixes Coverity CID 66952

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Eenable output of Vista++ FS flags
Corinna Vinschen [Sun, 23 Oct 2016 13:57:40 +0000 (15:57 +0200)]
cygcheck: Eenable output of Vista++ FS flags

Also, code cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Eliminate dead code
Corinna Vinschen [Sat, 22 Oct 2016 20:57:03 +0000 (22:57 +0200)]
cygcheck: Eliminate dead code

Fixes Coverity CID 66907

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Fix broken test for invalid wcstombs conversion reading symlinks
Corinna Vinschen [Sat, 22 Oct 2016 20:53:29 +0000 (22:53 +0200)]
cygcheck: Fix broken test for invalid wcstombs conversion reading symlinks

Fixes Coverity CID 66905

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Fix check for Cygwin symlink
Corinna Vinschen [Sat, 22 Oct 2016 20:44:25 +0000 (22:44 +0200)]
cygcheck: Fix check for Cygwin symlink

Fixes Coverity CID 66904 and 66906

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agostrace: Add comment trying to explain confusing code
Corinna Vinschen [Sat, 22 Oct 2016 20:39:31 +0000 (22:39 +0200)]
strace: Add comment trying to explain confusing code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agocygcheck: Close with pclose what has been opened with popen
Corinna Vinschen [Sat, 22 Oct 2016 20:14:34 +0000 (22:14 +0200)]
cygcheck: Close with pclose what has been opened with popen

Fixes Coverity CID 66900

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agotowupper: Eliminate dead code
Corinna Vinschen [Sat, 22 Oct 2016 20:00:51 +0000 (22:00 +0200)]
towupper: Eliminate dead code

Fixes Coverity CID 59865

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix a potential buffer overflow in wscanf family
Corinna Vinschen [Sat, 22 Oct 2016 19:43:28 +0000 (21:43 +0200)]
Fix a potential buffer overflow in wscanf family

Fixes Coverity CID 60046

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoget_alt_digits: Fix typo in allocation
Corinna Vinschen [Sat, 22 Oct 2016 19:29:10 +0000 (21:29 +0200)]
get_alt_digits: Fix typo in allocation

adi->digit is an array of CHAR *, not of CHAR **.

Fixes Coverity CID 60043

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoRemove unreachable code from passwd(1)
Corinna Vinschen [Sat, 22 Oct 2016 19:20:28 +0000 (21:20 +0200)]
Remove unreachable code from passwd(1)

Fixed Coverity CID 66966

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoActually return value from __cp_index
Corinna Vinschen [Sat, 22 Oct 2016 19:08:44 +0000 (21:08 +0200)]
Actually return value from  __cp_index

Fixes Coverty CID 153470

Also drop redundant declaration of __cp_index.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop redundant checks for NULL input string in wctomb helper funcs
Corinna Vinschen [Sat, 22 Oct 2016 18:28:08 +0000 (20:28 +0200)]
Drop redundant checks for NULL input string in wctomb helper funcs

Fixes Coverity CIDs 153465 and 153466

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix check for empty locale string in newlocale
Corinna Vinschen [Sat, 22 Oct 2016 18:22:20 +0000 (20:22 +0200)]
Fix check for empty locale string in newlocale

The original test is broken.  It tests for a NULL locale which
isn't just wrong, it simply can't occur at this point due to an
earlier check for a NULL locale string.  Thus, the locale info
for a category is never taken from the environment.

Fixes Coverty CID 153467.

Also, add comment.

Also, add some parens for readability.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd _PC_CASE_INSENSITIVE to [f]pathconf
Ken Brown [Thu, 20 Oct 2016 19:35:54 +0000 (15:35 -0400)]
Add _PC_CASE_INSENSITIVE to [f]pathconf

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>
8 years agoFix SetThreadName with gdb 7.10 on x86
Jon Turney [Sun, 11 Sep 2016 12:37:54 +0000 (13:37 +0100)]
Fix SetThreadName with gdb 7.10 on x86

Additionally to eccefd97, we need to ensure the exception handler is
installed for the _ljfault used to implement _try/_except to get called.

Also use the correct macro for x86 conditional compilation.

Addresses https://cygwin.com/ml/cygwin/2016-09/msg00143.html

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoUpdate FAQ answer about setting an early breakpoint
Jon Turney [Sun, 11 Sep 2016 12:41:32 +0000 (13:41 +0100)]
Update FAQ answer about setting an early breakpoint

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoDon't check directories always case-insensitive in rename(2)
Corinna Vinschen [Wed, 19 Oct 2016 11:26:03 +0000 (13:26 +0200)]
Don't check directories always case-insensitive in rename(2)

Long-standing problem in one of the corner cases of rename(2):
If we rename a directory a check is performed to see if newpath is
identical to oldpath or a subdir of oldpath. This check is
(accidentally? no hints anywhere in ChangeLogs or code) performed
case-insensitive for as long as we use Unicode paths and NT functions.
This leads to the problems described in
https://cygwin.com/ml/cygwin/2016-09/msg00264.html

Change this to be conditional case-sensitive as all other checks but
let's take this with a grain of salt.  There may be corner-cases in
this corner-case which require to chek parts of the path always
case-insensitive.  Off the top of my head I can't construct such a
case but that's no proof they don't exist :}

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd release msg for 5a3496c
Corinna Vinschen [Wed, 19 Oct 2016 10:53:58 +0000 (12:53 +0200)]
Add release msg for 5a3496c

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix regression in console charset handling
Corinna Vinschen [Wed, 19 Oct 2016 10:48:40 +0000 (12:48 +0200)]
Fix regression in console charset handling

Commit d16a5630 dropped usage of cygheap's locale functions
in favor of local on-the-fly usage of UTF-8 instead of ASCII.
This allowed to use the current local rather than a fixed
system-wide locale set at startup time.  d16a5630 just missed
to add the ASCII->UTF-8 conversion in the console as well.

Fixes https://cygwin.com/ml/cygwin/2016-10/msg00000.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoBump Cygwin version to 2.6.1
Corinna Vinschen [Wed, 19 Oct 2016 10:52:06 +0000 (12:52 +0200)]
Bump Cygwin version to 2.6.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMake ctype_.c and ctype_.h agree on _ctype_b type
Thomas Preud'homme [Tue, 6 Sep 2016 10:26:55 +0000 (11:26 +0100)]
Make ctype_.c and ctype_.h agree on _ctype_b type

_ctype_b is defined in ctype_.c as a const char array for non cygwin
targets allowing negative ctype index but as a char array for the same
targets in ctype_.h, giving type conflict at compile time.  This is
because the cygwin targets are not treated specially in the latter file.
This patch adds the necessary logic for cygwin targets in ctype_.h.

8 years agodlopen: on x/lib search x/bin if exe is in x/bin newlib-snapshot-20160923
Michael Haubenwallner [Fri, 2 Sep 2016 11:57:20 +0000 (13:57 +0200)]
dlopen: on x/lib search x/bin if exe is in x/bin

On 09/02/2016 11:03 AM, Corinna Vinschen wrote:
> On Sep  2 10:46, Michael Haubenwallner wrote:
>> On 09/01/2016 03:32 PM, Corinna Vinschen wrote:
>>> You could just use the global variable program_invocation_name.  If in
>>> doubt, use the Windows path global_progname and convert it to full POSIX
>>> via cygwin_conv_path.
>>
>> Patch updated, using global_progname now.
>
> Looks good and you're right to do it this way since I just noticed
> that program_invocation_name may return a relative pathname.

Yep.

> Btw., in other calls which require the full POSIX path we use
> mount_table->conv_to_posix_path instead of cygwin_conv_path (see
> e. g. fillout_pinfo()).  It's a bit faster.  Maybe something for a
> followup patch.

No problem - attached.
This renders the original patch 4/4 valid again.

> Note for some later improvement:  I really wonder why we don't store
> the absolute POSIX path of the current executable globally yet...

Same here.

Thanks!
/haubi/

>From f7255edd33cb4abe34f27188aab8dccdfa5dd2a0 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 31 Aug 2016 18:05:11 +0200
Subject: [PATCH 3/4] dlopen: on x/lib search x/bin if exe is in x/bin

citing https://cygwin.com/ml/cygwin-developers/2016-08/msg00020.html
> Consider the file /usr/bin/cygz.dll:
> - dlopen (libz.so)            success
> - dlopen (/usr/bin/libz.so)   success
> - dlopen (/usr/lib/libz.so)   fails

* dlfcn.c (dlopen): For dlopen("x/lib/N"), when the application
executable is in "x/bin/", search for "x/bin/N" before "x/lib/N".

8 years agodlopen (pathfinder): try each basename per dir
Michael Haubenwallner [Wed, 31 Aug 2016 18:07:07 +0000 (20:07 +0200)]
dlopen (pathfinder): try each basename per dir

Rather than searching all search dirs per one basename,
search for all basenames within per one search dir.

pathfinder.h (check_path_access): Interchange dir- and basename-loops.

8 years agodlopen: switch to new pathfinder class
Michael Haubenwallner [Wed, 31 Aug 2016 18:07:06 +0000 (20:07 +0200)]
dlopen: switch to new pathfinder class

Instead of find_exec, without changing behaviour use new pathfinder
class with new allocator_interface around tmp_pathbuf and new vstrlist
class.
* pathfinder.h (pathfinder): New file.
* vstrlist.h (allocator_interface, allocated_type, vstrlist): New file.
* dlfcn.cc (dlopen): Avoid redundant GetModuleHandleExW with RTLD_NOLOAD
and RTLD_NODELETE.  Switch to new pathfinder class, using
(tmp_pathbuf_allocator): New class.
(get_full_path_of_dll): Drop.

8 years agoFix typo in strerror doc cygwin-2_6_0-release
Corinna Vinschen [Wed, 31 Aug 2016 11:43:19 +0000 (13:43 +0200)]
Fix typo in strerror doc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agostrace: Don't print exception info for SetThreadName exception
Corinna Vinschen [Wed, 31 Aug 2016 10:15:29 +0000 (12:15 +0200)]
strace: Don't print exception info for SetThreadName exception

The new functionality to set the thread name for debugging purposes
creates exception debugging events.  These are printed out when running
strace.  Since these exceptions have nothing to do with real exceptions
but are, like breakpoint execptions, expected and non-fatal, don't print
exception info for them.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix passwd getting error 1265 when running on newer Windows
Corinna Vinschen [Wed, 31 Aug 2016 10:08:34 +0000 (12:08 +0200)]
Fix passwd getting error 1265 when running on newer Windows

On Windows 8.1 and later, the NetUserChangePassword call apparently
doesn't accept the usual "\\server" string anymore, but requires to
use the "domain" instead, otherwise it emits en error code 1265,
ERROR_DOWNGRADE_DETECTED.  Since this is accepted by pre-8.1 as well,
use the domain indiscriminately when calling NetUserChangePassword
from passwd(1).

While at it, do some minor cleanup in passwd.c.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd release message for commit 3d3ab82
Yaakov Selkowitz [Tue, 30 Aug 2016 15:53:35 +0000 (10:53 -0500)]
Add release message for commit 3d3ab82

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoFix off_t typedef on Cygwin64
Yaakov Selkowitz [Mon, 29 Aug 2016 20:30:59 +0000 (15:30 -0500)]
Fix off_t typedef on Cygwin64

While both long and long long are 64-bits on x86_64, they are distinct types,
and long was used prior to commit 477463a2011ba81907a753df9ce7a71b6563db54.
Changing this breaks the linking of previously compiled C++ functions with
off_t arguments on 64-bit Cygwin with newly compiled code, as the mangling of
long (l) and long long (x) differ.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
8 years agoChange return type from locale_t to struct __locale_t * as well
Corinna Vinschen [Thu, 25 Aug 2016 15:27:37 +0000 (17:27 +0200)]
Change return type from locale_t to struct __locale_t * as well

Complements commit 14228e2.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop duplicate _ctype_ declaration from ctype_.h
Corinna Vinschen [Thu, 25 Aug 2016 14:05:12 +0000 (16:05 +0200)]
Drop duplicate _ctype_ declaration from ctype_.h

It's already defined in ctype.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDrop global __ctype_ptr__ entirely in favor of using locale_t::ctype_ptr
Corinna Vinschen [Thu, 25 Aug 2016 12:18:31 +0000 (14:18 +0200)]
Drop global __ctype_ptr__ entirely in favor of using locale_t::ctype_ptr

Keep __ctype_ptr__ available on Cygwin only, for backward compatibility
with existing apps referencing it via the ctype macros.

Otherwise initialize __global_locale.ctype_ptr and __C_locale.ctype_ptr
and use them throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix formatting
Corinna Vinschen [Thu, 25 Aug 2016 10:06:17 +0000 (12:06 +0200)]
Fix formatting

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix SetThreadName with current gdb
Jon Turney [Thu, 25 Aug 2016 09:06:47 +0000 (10:06 +0100)]
Fix SetThreadName with current gdb

Wrap SetThreadName()'s call to RaiseException() in __try/__except/__endtry,
so that if the attached debugger doesn't know about MS_VC_EXCEPTION (e.g.
current gdb and probably strace as well) and continues exception processing,
we ignore it, rather than dying due an unhandled exception.

Also remove an unnecessary cast in the RaiseException() invocation.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agoUse struct __locale_t * for reentrent locale functions
Corinna Vinschen [Thu, 25 Aug 2016 07:53:01 +0000 (09:53 +0200)]
Use struct __locale_t * for reentrent locale functions

This fixes a build problem since locale_t is only defined if
__POSIX_VISIBLE >= 200809.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd strerror_l prototype, change str[n]casecmp_l feature tests
Brian Inglis [Wed, 24 Aug 2016 20:36:31 +0000 (14:36 -0600)]
Add strerror_l prototype, change str[n]casecmp_l feature tests

strerror_l prototype was missing.
str[n]casecmp_l feature tests in string.h vs. strings.h were transposed.

8 years agoAvoid crash when calling __localeconv_l with __C_locale
Corinna Vinschen [Wed, 24 Aug 2016 17:46:55 +0000 (19:46 +0200)]
Avoid crash when calling __localeconv_l with __C_locale

__C_locale is const.  Thus, overwriting the lconv values in __localeconv_l
will try to write to a R/O region.  Given the lconv values in __C_locale
are initialized, there's no reason to write them in __localeconv_l at all.
Just return &__C_locale.lconv.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoInclude winsup.h prior to including other headers
Corinna Vinschen [Wed, 24 Aug 2016 08:19:53 +0000 (10:19 +0200)]
Include winsup.h prior to including other headers

Otherwise _GNU_SOURCE is not set when needed in sys/features.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoUse #if __GNU_VISIBLE, not #ifdef __GNU_VISIBLE
Corinna Vinschen [Wed, 24 Aug 2016 08:18:54 +0000 (10:18 +0200)]
Use #if __GNU_VISIBLE, not #ifdef __GNU_VISIBLE

sys/features.h always defines __GNU_VISIBLE, either as 0 or 1.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agostrerror_l: Fix copy-and-paste typo
Eric Blake [Tue, 23 Aug 2016 19:36:06 +0000 (14:36 -0500)]
strerror_l: Fix copy-and-paste typo

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agoClarify Cygwin's support for Win32 paths
Ken Brown [Tue, 23 Aug 2016 17:24:49 +0000 (13:24 -0400)]
Clarify Cygwin's support for Win32 paths

See https://www.cygwin.com/ml/cygwin/2016-08/msg00431.html.

8 years agoAdd missing LF in release text
Corinna Vinschen [Tue, 23 Aug 2016 16:57:16 +0000 (18:57 +0200)]
Add missing LF in release text

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoMention strerror_l in libc/string/strings.tex
Corinna Vinschen [Tue, 23 Aug 2016 16:15:55 +0000 (18:15 +0200)]
Mention strerror_l in libc/string/strings.tex

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd __get_C_locale inline function and fix new locale code for !_MB_CAPABLE targets
Corinna Vinschen [Tue, 23 Aug 2016 10:49:23 +0000 (12:49 +0200)]
Add __get_C_locale inline function and fix new locale code for !_MB_CAPABLE targets

Only access "C" locale using the new __get_C_locale inline function.
Enable __global_locale for !_MB_CAPABLE targets.  Accommodate !_MB_CAPABLE
targets in new locale code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoExport and document strerror_l, strptime_l, wcsftime_l from Cygwin
Corinna Vinschen [Tue, 23 Aug 2016 15:50:21 +0000 (17:50 +0200)]
Export and document strerror_l, strptime_l, wcsftime_l from Cygwin

Bump Cygwin API minor number.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoImplement GNU extension strptime_l
Corinna Vinschen [Tue, 23 Aug 2016 15:42:47 +0000 (17:42 +0200)]
Implement GNU extension strptime_l

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoImplement GNU extension wcsftime_l
Corinna Vinschen [Tue, 23 Aug 2016 15:41:50 +0000 (17:41 +0200)]
Implement GNU extension wcsftime_l

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoImplement missing POSIX-1.2008 function strerror_l
Corinna Vinschen [Tue, 23 Aug 2016 15:49:24 +0000 (17:49 +0200)]
Implement missing POSIX-1.2008 function strerror_l

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd missing declarations of str{n}casecmp_l to strings.h.
Corinna Vinschen [Tue, 23 Aug 2016 15:40:03 +0000 (17:40 +0200)]
Add missing declarations of str{n}casecmp_l to strings.h.

Per glibc, both funcs are defined as GNU visible in strings.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoSend thread names to debugger
Jon Turney [Wed, 27 Jul 2016 23:40:23 +0000 (00:40 +0100)]
Send thread names to debugger

GDB since commit 24cdb46e [1] can report and use these names.

Add utility function SetThreadName(), which sends a thread name to the
debugger.

Use that:
- to set the default thread name for main thread and newly created pthreads.
- in pthread_setname_np() for user thread names.
- for helper thread names in cygthread::create()
- for helper threads which are created directly with CreateThread.

Note that there can still be anonymous threads, created by system or
injected DLLs.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=24cdb46e9f0a694b4fbc11085e094857f08c0419

8 years agoAdd pthread_getname_np and pthread_setname_np
Jon Turney [Mon, 22 Aug 2016 17:43:05 +0000 (18:43 +0100)]
Add pthread_getname_np and pthread_setname_np

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

8 years agoFix stray closing brace
Corinna Vinschen [Tue, 23 Aug 2016 11:08:01 +0000 (13:08 +0200)]
Fix stray closing brace

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd/change a few #ifdef comments in locale code for clearness
Corinna Vinschen [Tue, 23 Aug 2016 10:43:40 +0000 (12:43 +0200)]
Add/change a few #ifdef comments in locale code for clearness

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoRemove erroneous POSIX guards for reentrant locale functions
Corinna Vinschen [Tue, 23 Aug 2016 10:39:42 +0000 (12:39 +0200)]
Remove erroneous POSIX guards for reentrant locale functions

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoReference __global_locale only via __get_global_locale.
Corinna Vinschen [Tue, 23 Aug 2016 10:38:28 +0000 (12:38 +0200)]
Reference __global_locale only via __get_global_locale.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAvoid truncating from long double to double in sinhl().
David Wohlferd [Mon, 22 Aug 2016 07:51:12 +0000 (00:51 -0700)]
Avoid truncating from long double to double in sinhl().

This routine makes a call to fabs instead of fabsl(), causing truncation.

Clang complains (warning: absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value).

Signed-off-by: David Wohlferd <dw@LimeGreenSocks.com>
8 years agosqrt: Fix NaN propagation for IEEE Std 754-2008
Ray Donnelly [Wed, 6 Apr 2016 01:59:53 +0000 (02:59 +0100)]
sqrt: Fix NaN propagation for IEEE Std 754-2008

The R language has some hacks specifically for mingw-w64 that
were caused by our handling of NaNs in sqrt(x). R uses a
special valued NaN to mean 'Not Available' and expects it to
be retained through various calculations. Our sqrt(x) doesn't
do this, instead it normalises such a NaN (retaining sign).

From:

http://wwwf.imperial.ac.uk/~drmii/M3SC_2016/IEEE_2008_4610935.pdf

"6.2.3 NaN propagation

An operation that propagates a NaN operand to its result and
has a single NaN as an input should produce a NaN with the
payload of the input NaN if representable in the destination
format."

There might even be a slight speed-up from this too.

Thanks to Duncan Murdoch for finding the reference.

8 years agoRemove extern declaration of __locale_cjk_lang in string/local.h
Corinna Vinschen [Sun, 21 Aug 2016 10:14:32 +0000 (12:14 +0200)]
Remove extern declaration of __locale_cjk_lang in string/local.h

Now that __locale_cjk_lang is an inline function in setlocale.h and
setlocale.h is included, the declaration doesn't make sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoDocument nl_langinfo_l and separate POSIX from GNU extensions in release message
Corinna Vinschen [Sat, 20 Aug 2016 15:24:16 +0000 (17:24 +0200)]
Document nl_langinfo_l and separate POSIX from GNU extensions in release message

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoImplement missing POSIX function nl_langinfo_l
Corinna Vinschen [Sat, 20 Aug 2016 15:22:41 +0000 (17:22 +0200)]
Implement missing POSIX function nl_langinfo_l

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>
8 years agoIntroduce __current_locale_charset/__locale_charset
Corinna Vinschen [Sat, 20 Aug 2016 14:05:56 +0000 (16:05 +0200)]
Introduce __current_locale_charset/__locale_charset

The former __locale_charset always fetched the current locale's charset.
We need the per-locale charset, too, in future. Rename __locale_charset
to __current_locale_charset and change __locale_charset to take a
locale_t as parameter.  Accommodate througout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoOnly define __getreent inline function when building newlib or Cygwin
Corinna Vinschen [Sat, 20 Aug 2016 14:03:14 +0000 (16:03 +0200)]
Only define __getreent inline function when building newlib or Cygwin

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>
8 years agoAdd release message for commit eb61113
Corinna Vinschen [Fri, 19 Aug 2016 15:25:31 +0000 (17:25 +0200)]
Add release message for commit eb61113

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd release message for commit a871644
Corinna Vinschen [Fri, 19 Aug 2016 14:54:56 +0000 (16:54 +0200)]
Add release message for commit a871644

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoSimplify "Windows-standard-like" permissions
Corinna Vinschen [Fri, 19 Aug 2016 14:50:04 +0000 (16:50 +0200)]
Simplify "Windows-standard-like" permissions

Commit 97d0449 left a bit to be desired.  First, the fact that any
new-style ACL couldn't be "standard ACL" anymore was very much over
the top.  On one hand Admins and SYSTEM ACEs are not supposed to be
masked, but on the other hand we *must* create the CLASS_OBJ
because otherwise we don't have information about masking the
execute perms for both groups.  The ACL would also fail aclcheck.

And while get_posix_access now returns the "is standard acl" flag,
it hasn't been utilized by set_created_file_access.  Rather,
set_created_file_access has simply continued to check for
nentries > MIN_ACL_ENTRIES, which led to all kinds of weird group
and CLASS_OBJ perms.  The new code now always manipulates CLASS_OBJ
perms if a CLASS_OBJ is present, and it always manipulates group perms
if the ACL has been marked as "standard" ACL.

Another problem (not related to commit 97d0449) is the order
get_posix_access adds missing perms.  CLASS_OBJ perms are computed
*before* missing GROUP_OBJ perms have been added.  Thus the CLASS_OBJ
perms could be too tight and led to additional, buggy DENY ACEs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix outdated S_JUSTCREATED comment
Corinna Vinschen [Fri, 19 Aug 2016 14:27:07 +0000 (16:27 +0200)]
Fix outdated S_JUSTCREATED comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix html build
Thomas Preud'homme [Thu, 18 Aug 2016 14:31:28 +0000 (15:31 +0100)]
Fix html build

8 years agoFix html build with makeinfo 5.2
Thomas Preudhomme [Fri, 19 Aug 2016 08:10:38 +0000 (09:10 +0100)]
Fix html build with makeinfo 5.2

HTML build fails with makeinfo 5.2 with the following error:

libgloss/doc/porting.texi:73: @menu seen before first @node
libgloss/doc/porting.texi:73: perhaps your @top node should be wrapped in
@ifnottex rather than @ifinfo?

Following the advice indeed solve the issue while still allowing pdf, dvi and
info builds to work.

8 years agoReinstantiate Cygwin function called `__getreent'
Corinna Vinschen [Thu, 18 Aug 2016 12:27:05 +0000 (14:27 +0200)]
Reinstantiate Cygwin function called `__getreent'

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>
8 years agoRevert "Fix __getreent function for Cygwin"
Corinna Vinschen [Thu, 18 Aug 2016 12:26:42 +0000 (14:26 +0200)]
Revert "Fix __getreent function for Cygwin"

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>
8 years agoWorkaround AzureAD shortcomings
Corinna Vinschen [Mon, 8 Aug 2016 07:45:34 +0000 (09:45 +0200)]
Workaround AzureAD shortcomings

No real domain, no DC, no infos via NetUserGetInfo... nothing.  Just nothing.

Use fixed uid 0x1000 (4096) for AzureAD user and gid 0x1001 (4097) for
AzureAD group.  Note that this group is part of the user token, but it's
not the primary group.  The primary group SID is, unfortunately, the
user's SID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoFix __getreent function for Cygwin
Corinna Vinschen [Thu, 18 Aug 2016 08:27:14 +0000 (10:27 +0200)]
Fix __getreent function for Cygwin

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>
8 years agoFix pdf build failure wrt documentation of is*_l functions
Thomas Preudhomme [Wed, 17 Aug 2016 16:05:07 +0000 (17:05 +0100)]
Fix pdf build failure wrt documentation of is*_l functions

make pdf on arm-none-eabi targets fails to build after the reorganization in
baf0c9fcb56e5cf8f54357bf8d8646b51b236886 to fold is*_l documentation in their
is* counterpart. This is due two issues:

1) newlib/libc/ctype/ctype.tex still including the def file for the long versions
2) missing angle brackets in .c files for some of is*_l functions

This patch fixes the issues and allows make pdf to succeeds.

8 years agoAdd release message for commit c02ac89
Corinna Vinschen [Wed, 17 Aug 2016 09:17:26 +0000 (11:17 +0200)]
Add release message for commit c02ac89

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAdd -i/--input option to locale(1)
Corinna Vinschen [Wed, 17 Aug 2016 08:58:04 +0000 (10:58 +0200)]
Add -i/--input option to locale(1)

The default UI language returned by GetUserDefaultUILanguage does not
necessarily reflect what the user really wants.  E. g., the system could
be en_US, but the desired language is en_CA, without having a CA langpack
installed.

Changing the settings under "Languages" and changing the keyboard layout
is only affecting the so-called  "Input language", while what's returned
by GetUserDefaultUILanguage is the "Display language".  Changing the
latter requires installing MUI langpacks.

Thus, we introduce a way to fetch the "Input language" using the -i or
--input option.

Also clean up documentation of locale(1).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoConstify __locale_ctype_ptr and __locale_ctype_ptr_l
Corinna Vinschen [Wed, 17 Aug 2016 07:40:28 +0000 (09:40 +0200)]
Constify __locale_ctype_ptr and __locale_ctype_ptr_l

Remove _MB_CAPABLE-only _CONST in ctype.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoActually return pointers in locale categroy accessor functions
Corinna Vinschen [Tue, 16 Aug 2016 14:23:51 +0000 (16:23 +0200)]
Actually return pointers in locale categroy accessor functions

Commit 6e7ce50 was broken.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAlways fall back to __ctype_ptr__ in isXXX_l functions.
Corinna Vinschen [Tue, 16 Aug 2016 14:22:12 +0000 (16:22 +0200)]
Always fall back to __ctype_ptr__ in isXXX_l functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoAvoid "implicit declaration of function ‘strtold_l’" in wcstold.c
Corinna Vinschen [Tue, 16 Aug 2016 14:21:19 +0000 (16:21 +0200)]
Avoid "implicit declaration of function ‘strtold_l’" in wcstold.c

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
8 years agoUse era_info_t and alt_digits_t on _WANT_C99_TIME_FORMATS targets only
Corinna Vinschen [Tue, 16 Aug 2016 13:26:01 +0000 (15:26 +0200)]
Use era_info_t and alt_digits_t on _WANT_C99_TIME_FORMATS targets only

Using era_info_t and alt_digits_t indiscriminately in strftime and
strftime_l breaks targets not wanting C99 time formats.

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