FIONBIO is defined in sys/termios.h and asm/socket.h. Align the comments.
Remove unused REAL_FIONBIO.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
u_char, u_short, u_int, u_long are BSD-only types. Remove them from
Cygwin headers which are supposed to be used in a non-BSD scenario.
Drop special Cygwin handling of those types in sys/types.h.
newlib:
* libc/include/sys/types.h (u_char,u_short,u_int,u_long): Drop
Cygwin exception.
cygwin:
* fhandler_socket.cc (fhandler_socket::ioctl): Accommodate change
in include/asm/socket.h. Continue using u_long since that's the
MS type here.
* include/asm/socket.h: Since the type given in _IOR/_IOW macros
is only used for its sizeof, replace u_long with equivalent long.
* netdb.h (getnetbyaddr): Fix prototype.
* netinet/ip.h: Replace old BSD-only types with generically defined
old BSD types (u_char -> u_int8_t, etc).
* netinet/tcp.h: Ditto.
* netinet/udp.h: Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The u_intN_t types are BSD types but sanctioned by POSIX. They are
always defined when using Glibc headers so we follow suit.
newlib:
* libc/include/sys/types.h: Drop outdated __INTTYPES_DEFINED__
macro. Always define u_intN_t types.
cygwin:
* include/cygwin/types.h: Remove definition of u_intN_t types.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
So far any group in the user's token could be used as primary group.
Windows doesn't check if the primary group is enabled or not, it just
has no meaning. From a POSIXy point of view it can lead to weird
results though.
* uinfo.cc (check_token_membership): New static function.
(internal_getlogin): Only allow enabled groups as primary group.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
A user token can be up to 64K in size. Using 32K buffers for TOKEN_GROUPS
may be insufficient.
* uinfo.cc (get_logon_sid): Use 64K buffers for the TOKEN_GROUPS
array.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
A user token can be up to 64K in size. The group list might take a lot
of that so use tmp_pathbuf allocated space rather than stack space
allocted via alloca. In create_token the TOKEN_GROUP was allocated via
malloc, but the code is needlessly complicated. Simplify by using
tmp_pathbuf as well.
* sec_auth.cc (verify_token): Allocate TOKEN_GROUP via tmp_pathbuf.
(create_token): Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
As long as we're not building in C++14 mode, the definition of the
sized delete operator results in a compatibility warning.
* cxx.cc (operator delete): Disable C++14 warning for sized variant.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
When compiling with -std=c++14 (the default for gcc 6.0+), the sized
deallocation operator must be defined to prevent undefined symbols when
linking.
winsup/cygwin/ChangeLog:
cxx.cc (operator delete(void *p, size_t)): Define.
Signed-off-by: Peter Foley <pefoley2@pefoley.com>
The latest version of the mingw headers have been updated to make
DnsRecordListFree an alias of DnsFree when targeting Windows XP or later.
Use DnsFree directly, avoiding the wrapper function.
/home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
undefined reference to `DnsFree'
winsup/cygwin/ChangeLog
autoload.cc: Load DnsFree rather then DnsRecordListFree
libc/minires-os-if.cc (cygwin_query): Use DnsFree rather then DnsRecordListFree
Signed-off-by: Peter Foley <pefoley2@pefoley.com>
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>
/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>
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>
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>
* 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.
* 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.
* 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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>