Commit Graph

11059 Commits

Author SHA1 Message Date
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
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
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
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 43e5ee83fe Feature test macros overhaul: time.h
Throughout, replace __STRICT_ANSI__ with the proper internal macros.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:10 -05:00
Yaakov Selkowitz 84ba25226c Feature test macros overhaul: stdlib.h
Throughout, simplify the C99/C11 conditionals, and replace
__STRICT_ANSI__ with the proper internal POSIX macros.  The _*_r
reentrant functions need not be guarded (and most haven't been) because
such names in the global scope are reserved to the implementation.

atoff is unique to newlib.

dtoa is not actually exported (_dtoa_r is used internally), is
nonstandard, and the declaration conflicts with the code included in
MySQL, NSPR, and SpiderMonkey.

mktemp was removed in POSIX.1-2001.

The qsort_r declarations are reordered so that the GNU version retains
precedence.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:06 -05:00
Yaakov Selkowitz 86a724b8c0 Feature test macros overhaul: limits.h
Simplify the C99 conditional, and use the internal macro for GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:08:57 -05:00
Yaakov Selkowitz d94d983d1b Feature test macros overhaul: fnmatch.h
Use the proper internal macro for GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:08:54 -05:00
Yaakov Selkowitz d2937299fa Feature test macros overhaul: dirent.h
MAXNAMLEN is a BSDism.

Use the proper internal macros instead of !_POSIX_SOURCE.  telldir and
seekdir are XSI, scandir and alphasort are POSIX.1-2008, and scandirat
is GNU.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:08:51 -05:00
Corinna Vinschen 446d0d355f add release message for commit 4c9bb3e
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-17 17:58:43 +01:00
Corinna Vinschen 4c9bb3e0f9 Propagate correct Windows error if executable can't be opened
* spawn.cc (av::setup): Set last Win32 error if NtOpenFile fails.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-17 17:46:11 +01:00
Thomas Wolff aa2d448093 Add release message for commit 7346568 2016-03-17 08:59:17 +01:00
Thomas Wolff 734656818a Make requested console reports work
cf https://cygwin.com/ml/cygwin-patches/2012-q3/msg00019.html

This enables the following ESC sequences:
ESC[c sends primary device attributes
ESC[>c sends secondary device attributes
ESC[6n sends cursor position report

    * fhandler.h (class dev_console): Add console read-ahead buffer.
    (class fhandler_console): Add peek function for it (for select).
    * fhandler_console.cc (fhandler_console::setup): Init buffer.
    (fhandler_console::read): Check console read-aheader buffer.
    (fhandler_console::char_command): Put responses to terminal
    requests (device status and cursor position reports) into
    common console buffer (shared between CONOUT/CONIN)
    instead of fhandler buffer (separated).
    * select.cc (peek_console): Check console read-ahead buffer.
2016-03-16 10:25:34 +01:00
Jon Turney e8e379ff1d Attempt to fix Coverity issues in ssp
* ssp.c (lookup_thread_id): Consistently check if tix is a null
	pointer.
	(run_program): Annotate that STATUS_BREAKPOINT falls-through to
	STATUS_SINGLE_STEP case.
	(main): Guard against high_pc-low_pc overflow and malloc failure.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2016-03-15 13:25:57 +00:00
Corinna Vinschen 7176a85cd4 cygwin_getaddrinfo: workaround Winsock getaddrinfo issue with broken DNS
Add experimental code to workaround the issue described in the thread
starting at

  https://cygwin.com/ml/cygwin/2015-07/msg00350.html

There's a hint in https://communities.vmware.com/message/2577858#2577858
that this problem is related to using the AI_ALL flag.

This patch checks if GetAddrInfoW returned with WSANO_RECOVERY and if
the AI_ALL flag was set, it retries GetAddrInfo without the AI_ALL flag.

	* net.cc (cygwin_getaddrinfo): Add experimental code to retry
	GetAddrInfoW without AI_ALL flag if it returned with WSANO_RECOVERY.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-14 17:57:22 +01:00
Corinna Vinschen f75114fc59 Don't write NULL SID ACE if it's not necessary.
If the ACL is supposed to reflect only standard POSIX permissions,
and if the permissions are so that user has more perms than group
and group has more perms than other, we don't really need the NULL
SID ACE.  If the permissions are that simple, get_posix_access will
not call AuthZ.

	* sec_acl.cc (set_posix_perms): Don't write NULL SID ACE if it's
	not required.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13 16:02:55 +01:00
Corinna Vinschen ddc91e5b2b Update Cygwin release message text with latest bugfixes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13 00:20:39 +01:00
Corinna Vinschen fcd8a0d4f4 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>
2016-03-12 17:57:34 +01:00
Corinna Vinschen fc180edcf4 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>
2016-03-12 17:56:21 +01:00
Corinna Vinschen 018fa93e2b 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>
2016-03-12 16:39:19 +01:00
Corinna Vinschen 5b972d5b29 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>
2016-03-11 22:50:24 +01:00
Václav Haisman b5476c81d2 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
2016-03-11 14:01:25 +01:00
Mark Geisert d0cf3b7c02 Documentation covering profiling Cygwin programs. 2016-03-11 11:08:01 +01:00
Corinna Vinschen bf81f082cd Add release message for commit 8b1ede3ce1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10 20:48:04 +01:00