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>
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>
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>
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>
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>
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:
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>
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>
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>
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.
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>
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>
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>
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>
* 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>
* autoload.cc (wsock_init): Use MAKEWORD macro to create requested
version rather than handcrafted expression.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* 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>
* 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>
This reverts commit 4b104ce070.
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>
* 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>
* 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>
* 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>
* 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>