Commit Graph

16985 Commits

Author SHA1 Message Date
Corinna Vinschen fe508576ef Sync toplevel with upstream GCC.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-22 10:25:20 +01:00
Corinna Vinschen 445036bb98 Remove Mingw.org from FAQ, or replace with Mingw-w64.
* faq-api.xml: Change MingW to Mingw-w64.
	* faq-programming.xml: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-21 21:09:23 +01:00
Peter Foley 3ba2c39fb2 Add nonnull annotation to posix_memalign.
GCC 6.0+ asserts that the memptr argument to the builtin function
posix_memalign is nonnull.
Add the necessary annotation to the prototype and
remove the now unnecessary check to fix a warning.

newlib/Changelog
newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
non-null.

winsup/cygwin/ChangeLog
malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-21 20:27:16 +01:00
Peter Foley 6699e21ffb Remove misleading indentation
GCC 6.0+ warns on misleading indentation, so fix it.

winsup/cygserver/ChangeLog
* sysv_msg.cc (msgsnd): Fix misleading indentation.
* sysv_msg.cc (msgrcv): Ditto.
* sysv_sem.cc (semop): Ditto.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-21 20:16:01 +01:00
Sebastian Huber 08537d88f6 Move arc4random Cygwin only code to Cygwin
Keep the Newlib arc4random.c identical to the OpenBSD upstream version.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>.
2016-03-21 11:12:19 +01:00
Corinna Vinschen 2519f0ef0c srandom: Replace accessing /dev/random by equivalent getentropy call
/dev/random calls getentropy.  So there's no good reason to go out of
our way to open /dev/random just to call getentropy anyway.

	* random.cc (srandomdev): Drop opening /dev/random in favor of
	calling getentropy.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-20 22:29:03 +01:00
Corinna Vinschen 58988463cc Revert "Use high-resolution timebases for select()."
This reverts commit 6e70fd315a.

Revert accidental push
2016-03-20 21:59:47 +01:00
Corinna Vinschen bf0f4baf95 Revert "Debug printfs."
This reverts commit 9f82de59a0.

Revert accidental push
2016-03-20 21:59:43 +01:00
Corinna Vinschen 66dc7d731a Revert "Improve and simplify select()."
This reverts commit 472d0a228c.

Revert accidental push
2016-03-20 21:59:27 +01:00
Corinna Vinschen 1cca343e47 Drop redundant arc4random prototypes from cygwin/stdlib.h
Newlib's default stdlib.h now defines these functions so we can
drop them from the Cygwin-specific header.  Remove the arc4random_stir
and arc4random_uniform prototypes entirely.  They shouldn't be used
by applications anymore.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-20 21:30:58 +01:00
Corinna Vinschen f7f26f65ab Allow machine-dependent arc4 locking
newlib:
	* libc/stdlib/arc4random.h: Remove Cygwin-specific locking code.
	Conditionalize arc4 locking.  Check for _ARC4_LOCK_INIT being
	undefined to fall back to default implementation.

cygwin:
	* include/machine/_arc4random.h: New file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-20 21:30:08 +01:00
John Hood 472d0a228c Improve and simplify select().
* cygwait.h (cygwait_us) Remove; this reverts previous changes.
	* select.h: Eliminate redundant select_stuff::select_loop state.
	* select.cc (select): Eliminate redundant
	select_stuff::select_loop state.  Eliminate redundant code for
	zero timeout.  Do not return early on early timer return.
	(select_stuff::wait): Eliminate redundant
	select_stuff::select_loop state.
2016-03-20 15:26:32 +01:00
John Hood 9f82de59a0 Debug printfs.
* fhandler.cc (fhandler_base::get_readahead): Add debug code.
	* fhandler_console.cc (fhandler_console::read): Add debug code.
	* select.cc (pselect): Add debug code.
	(peek_console): Add debug code.
2016-03-20 15:26:31 +01:00
John Hood 6e70fd315a Use high-resolution timebases for select().
* cygwait.h: Add cygwait_us() methods.
	* select.h: Change prototype for select_stuff::wait() for larger
	microsecond timeouts.
	* select.cc (pselect): Convert from old cygwin_select().
	Implement microsecond timeouts.
	(cygwin_select): Rewrite as a wrapper on pselect().
	(select): Implement microsecond timeouts.
	(select_stuff::wait): Implement microsecond timeouts with a timer
	object.
2016-03-20 15:26:31 +01:00
John Hood 313fcaf1bc * winsup/testsuite/configure: chmod a+x 2016-03-20 15:21:24 +01:00
John Hood b92b47b7bc Move get_nonascii_key into fhandler_console.
* fhandler.h (fhandler_console): Move get_nonascii_key() from
	select.c into this class.
	* select.cc (peek_console): Move get_nonascii_key() into
	fhandler_console class.
2016-03-20 14:14:27 +01:00
Peter Foley 3bc912c02b respect datarootdir
Recent versions of autoconf define datadir/infodir in terms of
datarootdir. Add it.

winsup/ChangeLog
* Makefile.in: define datarootdir

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 12:36:40 +01:00
Peter Foley 5bc753c5a2 Fix strict aliasing
Fix a strict aliasing error detected by gcc 6.0+

winsup/cygwin/ChangeLog
* pinfo.cc (winpids::enum_process): Fix strict aliasing.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 12:31:42 +01:00
Peter Foley 0611132f04 Fix typoed comparison
winsup/cygwin/ChangeLog
* thread.cc (semaphore::open): Fix mistaken conditional.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 12:19:35 +01:00
Peter Foley 1eb7cb2553 The address of an class always evaluates to true
winsup/cygwin/pinfo.cc:465:14: error: the compiler can assume that the
address of 'tc' will always evaluate to 'true' [-Werror=address]

winsup/cygwin/ChangeLog
* pinfo.cc (_pinfo::set_ctty): remove always true check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 12:16:42 +01:00
Peter Foley 2f310e44c4 Remove misleading indentation
* syscalls.cc (getpriority): Fix misleading indentation.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 11:58:57 +01:00
Peter Foley dc85a189a4 Add necessary braces to if statements
The missing braces cause only the first expression to be guarded by the
else clause.

winsup/cygwin/ChangeLog
* fhandler_disk_file.cc (facl): Add missing braces to if statement.
* mount.cc (dos_drive_mappings): Add missing braces to if statement.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 11:55:08 +01:00
Peter Foley 922e21a3ea Remove dead code from fhandler_console.
This if is unconditionally false, so remove it.

winsup/cygwin/fhandler_console.cc: In member function 'bool dev_console::fillin(HANDLE)':
winsup/cygwin/fhandler_console.cc:740:22: error: self-comparison always evaluates to false [-Werror=tautological-compare]
       if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
           ~~~~~~~~~~~^~~~~~~~~~~~~
winsup/cygwin/fhandler_console.cc:740:50: error: self-comparison always evaluates to false [-Werror=tautological-compare]
       if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
                                       ~~~~~~~~~~~^~~~~~~~~~~~~

winsup/cygwin/ChangeLog
* fhandle_console.cc (fillin): remove dead code

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 11:54:49 +01:00
Peter Foley c0b6fc54b1 Remove unused and unsafe call to __builtin_frame_address
initial_sp has been unused since commit fbf23e3 back in 2000.
Keep the value, so as to avoid changing the offset of magic_biscuit.

winsup/cygwin/lib/_cygwin_crt0_common.cc:140:52:
error: calling 'void* __builtin_frame_address(unsigned int)' with a
nonzero argument is unsafe [-Werror=frame-address]
   u->initial_sp = (char *) __builtin_frame_address (1);

winsup/cygwin/ChangeLog
lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Initialize initial_sp
with nullptr.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-20 11:51:43 +01:00
Corinna Vinschen 3df400dc83 winsup: Move all old CVS Changelogs into CVSChangeLogs.old dir 2016-03-19 13:59:52 +01:00
Corinna Vinschen e42f66d00f Remove ill-advised cygwin_props
Cygwin_props have been invented to allow switching off the unique
installation keys in the first place, supposedly for debugging.
This never really was a good idea, after all we *want* the installations
to be independent and there's no good reason to break that, not even
for debugging purposes.

Other than that, cygwin_props were meant to be used for some other global
settings which never took place.  There's just no good reason to tweak
the DLL binary invisibly where a setting could be done in a file or the
environment.

This patch removes the cygwin_props entirely, including the related
settings in cygcheck.

cygwin:
	* cygprops.h: Remove file.
	* globals.cc (cygwin_props): Remove.
	* cygheap.cc (init_cygheap::init_installation_root): Drop removing
	installation key.

utils:
	* cygcheck.cc: Drop including cygprops.h.  Remove now unused option
	values.
	(unique_object_name_opt): Remove.
	(handle_unique_object_name): Remove function.
	(usage): Remove text for unique-object-names options.
	(longopts): Remove unique-object-names options.
	(main): Drop handling unique-object-names options.

doc:
	* utils.xml (cygcheck): Remove text for unique-object-names options.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-19 13:21:18 +01:00
Jeff Johnston d17977ccc7 Regenerate configure script. 2016-03-19 00:27:59 -04:00
Corinna Vinschen 83029bb69e Remove references to older Cygwin releases from documentation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 22:52:04 +01:00
Yaakov Selkowitz 97d1536d17 sparc64: move struct timeval to <sys/_timeval.h>
commit bb01594897 moved the struct timeval
declaration from <sys/time.h> to <sys/_timeval.h>, and commit
01885f533d changed <sys/select.h> to include
<sys/_timeval.h>.  Therefore, sparc64's own struct timeval needs to be
moved accordingly in order to avoid a conflict from the generic type.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Acked-by: Corinna Vinschen <vinschen@redhat.com>
2016-03-18 15:29:13 -05:00
Yaakov Selkowitz f049607eb0 Feature test macros overhaul: sparc64
sparc64 has a number of its own headers which override the generic ones.
These too need to use feature test macros properly.

These changes correspond to the generic fcntl.h and sys/stat.h changes
in commit d2df6d381b and
commit 069e400c91.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Acked-by: Corinna Vinschen <vinschen@redhat.com>
2016-03-18 15:29:05 -05:00
Howland, Craig D 19879c03c5 Cleanup macros in chacha_private.h to be target-type independent
* libc/stdlib/chacha_private.h (U8C, U32C): Remove un-necessary macros.
	(U8V, U32V): Drop masking.
2016-03-18 21:20:06 +01:00
Corinna Vinschen 8e2b2adb3d Only export arc4random_stir and arc4random_addrandom on Cygwin
Export to maintain backward compatibility, but don't let
	them do anything useful.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 21:12:12 +01:00
Yaakov Selkowitz d3f203d091 Feature test macros overhaul: signal.h (part 2)
Move the sig*set macros following the functions inside their feature
test macro conditional.

This fixes the build on bare-metal targets following
commit 5c78499ae2.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Acked-by: Corinna Vinschen <vinschen@redhat.com>
2016-03-18 11:22:32 -05:00
Yaakov Selkowitz f3ec63771b arm: fix build with newlib supplied syscalls enabled
In file included from libc/sys/arm/crt0.S:2:0:
libc/sys/arm/arm.h:32:25: fatal error: acle-compat.h: No such file or directory

acle-compat.h is libc/machine/arm.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-18 11:22:32 -05:00
Corinna Vinschen dcf31cdc99 Implement getentropy for Cygwin
* miscfuncs.cc (getentropy): Move fhandler_dev_random::crypt_gen_random
	here and rename to getentropy.  Fix type and return values to match
	getentropy requirements.
	* miscfuncs.h (getentropy): Add prototype.
	* fhandler.h (fhandler_dev_random::crypt_gen_random): Remove prototype.
	* fhandler_random.cc (fhandler_dev_random::crypt_gen_random): Drop.
	(fhandler_dev_random::write): Use getentropy instead.
	(fhandler_dev_random::read): Ditto.
	* fhandler_socket.cc (fhandler_socket::af_local_set_secret): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 14:46:20 +01:00
Corinna Vinschen e0fc33322d Delete Cygwin's arc4random in favor of new Newlib implementation
* Makefile.in (DLL_OFILES): Remove arc4random.o.
	* libc/arc4random.c: Remove file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 14:41:33 +01:00
Corinna Vinschen 7c96d6059c Arc4random locking: Check for threaded application on Cygwin
libc/stdlib/arc4random.h (_ARC4_LOCK): Special case Cygwin.
        (_ARC4_UNLOCK): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 14:40:26 +01:00
Corinna Vinschen 5ccdcf0219 Add arc4random_stir and arc4random_addrandom for OpenBSD compatibility
* libc/stdlib/arc4random.c (arc4random_stir): New function.
        (arc4random_addrandom): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-18 14:39:58 +01:00
Sebastian Huber f74cf1350e Add arc4random() etc. from OpenBSD 5.8
According to the OpenBSD man page, "A Replacement Call for Random".  It
offers high quality random numbers derived from input data obtained by
the OpenBSD specific getentropy() system call which is declared in
<unistd.h> and must be implemented for each Newlib port externally.  The
arc4random() functions are used for example in LibreSSL and OpenSSH.

Cygwin provides currently its own implementation of the arc4random
family.  Maybe it makes sense to use this getentropy() implementation:

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/crypto/getentropy_win.c?rev=1.4&content-type=text/x-cvsweb-markup

	* libc/include/stdlib.h (arc4random): Declare if __BSD_VISIBLE.
	(arc4random_buf): Likewise.
	(arc4random_uniform): Likewise.
	* libc/include/sys/unistd.h (getentropy): Likewise.
	* libc/include/machine/_arc4random.h: New file.
	* libc/stdlib/arc4random.c: Likewise.
	* libc/stdlib/arc4random.h: Likewise.
	* libc/stdlib/arc4random_uniform.c: Likewise.
	* libc/stdlib/chacha_private.h: Likewise.
	* libc/sys/rtems/include/machine/_arc4random.h: Likewise.
	* libc/stdlib/Makefile.am (EXTENDED_SOURCES): Add arc4random.c
	and arc4random_uniform.c.
	* libc/stdlib/Makefile.in: Regenerate.
2016-03-18 12:33:41 +01:00
Sebastian Huber 55c239d834 Add timingsafe_memcmp()
This function is used by LibreSSL and OpenSSH and is provided by the
OpenBSD libc.

	* libc/include/string.h (timingsafe_memcmp): Declare.
	* libc/string/timingsafe_memcmp.c: New file.
	* libc/string/Makefile.am: Add new file.
	* libc/string/Makefile.in: Regenerate.
2016-03-18 12:33:40 +01:00
Sebastian Huber 559fd77dda Add timingsafe_bcmp()
This function is used by LibreSSL and OpenSSH and is provided by the
OpenBSD libc.

	* libc/include/string.h (timingsafe_bcmp): Declare.
	* libc/string/timingsafe_bcmp.c: New file.
	* libc/string/Makefile.am: Add new file.
	* libc/string/Makefile.in: Regenerate.
2016-03-18 12:33:40 +01:00
Sebastian Huber 8740fa7fd0 Add explicit_bzero()
This function is used by LibreSSL and OpenSSH and is provided by the
OpenBSD libc.

	* libc/include/string.h (explicit_bzero): Declare.
	* libc/string/explicit_bzero.c: New file.
	* libc/string/Makefile.am: Add new file.
	* libc/string/Makefile.in: Regenerate.
2016-03-18 12:33:40 +01:00
Sebastian Huber a10dacbdac Guard ssize_t definition by _SSIZE_T_DECLARED
This guard is used by FreeBSD <sys/socket.h> for example.  The FreeBSD
network stack is used in RTEMS.

	* newlib/libc/include/sys/types.h (ssize_t): Guard by
	_SSIZE_T_DECLARED.
2016-03-18 12:28:55 +01:00
Yaakov Selkowitz 00d2fe1959 Cygwin: define byteswap.h inlines as macros
The bswap_* "functions" are macros in glibc, so they may be tested for
by the preprocessor (e.g. #ifdef bswap_16).

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:23 -05:00
Yaakov Selkowitz 3237fb31b3 Feature test macros overhaul: Cygwin headers
Use proper internal macros for BSD and GNU.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:22 -05:00
Yaakov Selkowitz 396942b0b5 Feature test macros overhaul: sys/types.h
The u_int/u_char/etc. BSD types are needed by Cygwin's netinet/*.h
headers, so they always need to be available.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:21 -05:00
Yaakov Selkowitz ee97c4b224 Revert "Remove inclusion of sys/select.h in sys/types.h for backward compat"
This BSDism is still in use (e.g. putty).

This reverts commit 088f7a7239.
2016-03-17 21:09:19 -05:00
Yaakov Selkowitz 04f288851a Feature test macros overhaul: sys/time.h
The inclusion of <sys/select.h> is required also by POSIX.1-2001.
setitimer is XSI, and futimesat is GNU.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:18 -05:00
Yaakov Selkowitz 069e400c91 Feature test macros overhaul: sys/stat.h
Replace all !_POSIX_SOURCE with BSD.  All *at functions depend on
ATFILE; futimens is POSIX.1-2008.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:16 -05:00
Yaakov Selkowitz 03c4ef1c51 Feature test macros overhaul: sys/select.h
Remove !_POSIX_SOURCE conditional; pselect is POSIX.1-2001.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:15 -05:00