Commit Graph

17356 Commits

Author SHA1 Message Date
Corinna Vinschen 7186b657e7 Improve timer handling in select.
Commit a23e6a35d8 introduced a timer
object to the WFMO handling in select_stuff::wait to allow sub-tickcount
timeout values in select.

Problems with this patch: The timer was created and destroyed on every
invocation of select_stuff::wait, thus potentially multiple times per
select.  Also, since the timer was prepended to the WFMO hande list,
the timer handle could shadow actual events on other objects, given that
WFMO checks the objects in the order they have been specified in the
HANDLE array.  The timer was also created/destroyed and added to the
HANDLE array even if it was not required.

This patch drops the local timer HANDLE and recycles the cw_timer HANDLE
in the cygtls area instead.  Thus we typically don't need to create the
timer in select at all, and we never have to destroy it.

The timer HANDLE is now also appended as last object to the HANDLE array,
and it's only added if actually needed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-06 16:48:38 +02:00
Corinna Vinschen 83834110a0 Fix condition in select which results in busy loop.
The check for current timestamp > start timestamp has an unwelcome
side effect:  The loop is not left as long as the current timestamp
hasn't been incremented.  This leads to busy loops of about one tick
(10 to 16 ms per MSDN).

This fixes https://cygwin.com/ml/cygwin/2016-05/msg00327.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-06 16:18:53 +02:00
Takashi Yano 7239bb7b3d Return at most one line of input in canonical mode
'man termios' says:
"A read(2) returns at most one line of input" in canonical mode.

On cygwin 2.5.1, read(2) returns all data in buffer if the buffer
size specified is large enough. This behaviour is correct in
noncanonical mode, but is not correct in canonical mode.

While checking this problem, I found a bug of tcflush().  tcflush()
flushes only partial data in the buffer.  The patch also fixes this bug.

The patch has also been tested against the problem reported in
https://cygwin.com/ml/cygwin/2016-05/msg00318.html.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-06 15:10:25 +02:00
Ken Brown 97349b7870 Allow 'make distclean' to clean winsup/cygwin
But don’t let it remove source files.
2016-06-06 11:52:19 +02:00
Corinna Vinschen 7abe634731 Only regenerate tlsoffsets{64}.h if cygtls.h can be compiled
The rule to make tlsoffset{64}.h has a flaw.  If cygtls.h can't be
built for whatever reason, it *still* regenerates tlsoffsets{64}.h,
just with size 0.  If the bug is not in cygtls.h itself, this behaviour
breaks further building, because fixing the problem won't result in
regenerating tlsoffset{64}.h.  Manual intervention is required.

Fix that by removing tlsoffsets{64}.h if gentls_offsets fails.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-06 11:44:54 +02:00
Yaakov Selkowitz f4edc7fd6d cygwin: include sys/types.h in sys/xattr.h
Using libattr's <xattr/xattr.h> requires consumers to explicitly include
<sys/types.h> first, but glibc's header in sys/ already contains the include.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-06-03 03:34:11 -05:00
Corinna Vinschen b0b99e39dc sched.cc: Use PROCESS_QUERY_INFORMATION for now
Temporarily revert to use PROCESS_QUERY_INFORMATION instead of
PROCESS_QUERY_LIMITED_INFORMATION to make sure every aspect of the
next release is still XP/2003 compatible.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-03 10:28:44 +02:00
Corinna Vinschen 211a942ad2 Revert "Cygwin hangs up if several keys are typed during outputting a lot of texts."
This reverts commit 252a07b0ad.

This change introduced a hang in certain scenarios, for an example
see https://cygwin.com/ml/cygwin/2016-05/msg00318.html
2016-06-01 17:04:24 +02:00
Corinna Vinschen 8a31aa37bc dlopen: Add dot to filename if no slash is present
We're appending a dot to the filename before calling LoadLibrary to
override ".dll" automagic.  This only worked for paths, not for simple
filenames since it required a slash in the pathname.  Fix that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-01 13:12:22 +02:00
Corinna Vinschen c496a068cf Cygwin: Add release messages for previous two commits
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-31 16:37:53 +02:00
Corinna Vinschen 5c759ab2f4 realpath: Handle Win32 and NT long path prefixes
So far drive letter paths have been handled special since path_conv
leaves the incoming path untouched except for converting backslashes
to forward slashes.  However, if the incoming path starts with a
long path prefix, the same problem occurs.  Therefore handle all
paths starting with a backslahs the same way.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-31 16:33:21 +02:00
Corinna Vinschen 357da5bc32 math.h: Replace usage of INT_MAX with __INT_MAX__
Using INT_MAX requires to include limits.h on most targets.
Math.h must not rely on that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-31 16:30:46 +02:00
Nick Clifton e6413b0a64 Add comment in the v850's crt0.S file noting that separate LMA and VMA addresses for data sections are not currently supported. 2016-05-26 12:08:47 +01:00
Anton Kolesov d1dcdb8886 arc: Have nops in _exit_halt only for ARCompact
ARCompact processors (ARC 600 and ARC 700) require three "nop"s after the
"flag 1" instruction. Later ARC processors do not have this requirement, so
it is possible to reduce size of "_exit_halt" for them.

libgloss/
2016-05-24  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* arc/crt0.S (_exit_halt): Insert nops only for ARCompact.
2016-05-25 12:15:51 +02:00
Anton Kolesov dd00a8e719 arc: Rework default exception handlers for ARC EM and HS
Initially crt0.S used a special function, declared as weak as a default
exception handler in interrupt vector table. To let user override individual
handlers, this function had multiple names - one for each IVT entry, which,
however, was terribly confusing for the debugger and user - because it
wasn't clear which symbol will be used as a function name in debugger.
Defining multiple separate functions - one for each handler, would resolve
the mess, but would increase code size of crt0.o.

To clean this up, this patch defines exception handlers as weak symbols as
well, but those are defined as just symbols, not functions, hence there
would be less confusion over what is what. At the same time, users still can
redefine exception handlers symbol by creating functions with respective
names.

libgloss/
2016-05-24  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* arc/crt0.S: Convert memory_error and friends to non-function
	  symbols.
2016-05-25 12:15:51 +02:00
Corinna Vinschen 030d86d04d TZ: Replace unreliable isupper calls on wchars
In case the TZ variable is empty, Cygwin fetches timezone info from
Windows.  Extracting the timezone short name uses isupper on wide chars.
Replace with explicit check for A <= character <= Z to be independent
of undefined behaviour.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-25 12:13:03 +02:00
Adam Dinwoodie 3b66731698 Git is Git, not GIT
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-24 12:09:10 +02:00
Corinna Vinschen 8d7b9a199c Fix typo and wrong URL in winsup/README
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-24 10:25:18 +02:00
Yaakov Selkowitz 95644157c1 Feature test macros: ctermid, cuserid
The proper location for these functions has always been <stdio.h>, however
XPG4 and SUSv2 did mandate a duplicate declaration in <unistd.h>.  cuserid
was dropped in SUSv3 (it was marked legacy since XPG4) and the ctermid
declaration in <unistd.h> was made optional and obsolete in SUSv4.

Fixes: https://cygwin.com/ml/cygwin/2016-05/msg00002.html
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-05-23 11:20:29 -05:00
Corinna Vinschen 4e434bf223 Add release message for previous mmap fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 21:50:41 +02:00
Corinna Vinschen 0aa738220b mmap: Fix size restriction of maps due to using 32 bit size type
Throughout mmap, size-related variables and parameters are still using
DWORD as type, which disallows mapping ranges > 4Gigs.  Fix this by
using SIZE_T throughout for those vars and parameters.
Also, drop unused off parameter from 1st variant of mmap_record::map_pages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 21:48:10 +02:00
Corinna Vinschen 2e62d68ba5 Add release message for scheduler fixes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 18:01:11 +02:00
Corinna Vinschen 4b51e4c142 Fix thread priority handling
So far pthread::postcreate() only sets the thread priority at all, only
if the inherit-scheduler attribute is PTHREAD_EXPLICIT_SCHED.  This
completely ignores the PTHREAD_INHERIT_SCHED case, since in contrast
to POSIX, a thread does not inherit its priority from the creating
thread, but always starts with THREAD_PRIORITY_NORMAL.

pthread_getschedparam() only returns what's stored in the thread attributes,
not the actual thread priority.

This patch fixes both problems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 17:45:24 +02:00
Corinna Vinschen 450f557fee Rewrite scheduler functions getting and setting process and thread priority
So far the scheduler priority handling is not POSIX compatible.
The priorities use a range of -14 up to +15, which means it's not clear
if the POSIX-required return value of -1 in case of an error is *really*
an error or just the valid priority value -1.  Even more confusing, -14
is the *max* value and 15 is the *min* value.  Last but not least this
range doesn't match the POSIX requirement of at least 32 priority values.

This patch cleans up scheduler priority handling and moves the valid
priority range to 1 (min) - 32 (max).  It also adds a function
sched_get_thread_priority() which will help to make thread priority
more POSIX-like.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 17:38:22 +02:00
Yaakov Selkowitz 6ac6e7c2bd libgloss/ft32: fix whitespace in Makefile
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-05-20 10:10:08 -05:00
John Hood 6dd601af66 Miscellaneous style cleanup, whitespace only. 2016-05-20 12:11:18 +02:00
John Hood e5665d8c93 Improve and simplify select().
* 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-05-20 12:00:58 +02:00
John Hood a23e6a35d8 Use high-resolution timebases for select().
* 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-05-20 12:00:38 +02:00
Anton Kolesov d5632bcfd4 Sync toplevel configure with upstream GCC.
This fixes a problem, where libgloss wouldn't be built for ARC processors,
even though it is actually supported. The original patch that introduced
support for ARC in libgloss hasn't been submitted to GCC maillist, hence
when top-level configure has been synced with GCC - this libgloss patch has
been effectively reverted.

Libgloss support for ARC has been accepted in GCC:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01148.html

ChangeLog

2016-05-17  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* configure.ac: Sync with upstream GCC.
	* configure: Regenerate.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2016-05-20 10:58:27 +02:00
Wilco Dijkstra e7b1ee2ea6 Add rawmemchr
Marcus Shawcroft wrote:
> This patch appears to have been munged by the mail system, can you
> repost as an attachment please.

Sure, I've attached the patch.

Wilco

Add a simple rawmemchr implementation. Use strlen for rawmemchr(s, '\0') as it is the
fastest way to search for '\0', and use memchr with an infinite size for other cases.
This is 3x faster for large sizes.

ChangeLog:
2016-04-22  Wilco Dijkstra  <wdijkstr@arm.com>

        * newlib/libc/machine/aarch64/Makefile.in: Add rawmemchr.S and
        rawmemchr-stub.c.
        * newlib/libc/machine/aarch64/Makefile.am: Likewise.
        * newlib/libc/machine/aarch64/rawmemchr.S (rawmemchr): Add rawmemchr.
        * newlib/libc/machine/aarch64/rawmemchr-stub.c (rawmemchr): Likewise.
2016-05-20 10:47:02 +02:00
Corinna Vinschen f6d9d8a182 Bump Cygwin DLL version to 2.5.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-18 21:27:57 +02:00
Corinna Vinschen 72ded59447 Make sure to have full configuration info in sys/_types.h.
The following testcase:

  $ cat > test.c <<EOF
  #include <sys/select.h>
  #include <sys/time.h>
  EOF
  $ gcc -c test.c

emits the following error:

  /usr/include/sys/reent.h:276:3: error: expected specifier-qualifier-list befor
e ‘_fpos64_t’
     _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int));
     ^

The reason is that the load order from sys/select.h includes sys/_types.h
before sys/config.h has been included from anywhere else.  sys/_types.h
defines _fpos64_t only if __LARGE64_FILES is defined, but it never is in
this scenario.  So sys/_types.h has to make sure to get the configuration
info by itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-18 21:05:31 +02:00
Jeff Johnston 5c02bcc086 Fix strlen using Thumb-2 with -Os -marm
2016-04-18  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * libc/machine/arm/strlen-stub.c: Check capabilities of architecture
        to decide which Thumb implementation to use and fall back to C
        implementation for architecture not supporting Thumb mode.
        * libc/machine/arm/strlen.S: Likewise.
2016-05-11 17:18:48 -04:00
Jeff Johnston d1d1378d13 Fix libgloss arc nsim specs file. 2016-05-11 12:45:55 -04:00
Jeff Johnston 93f5d7c739 Add port for Phoenix-RTOS in common configure files. 2016-05-09 15:23:58 -04:00
Jeff Johnston 36e32df9f8 Allow autoconf link-time tests to detect arc4random for RTEMS. 2016-05-09 12:37:27 -04:00
Jeff Johnston ba72ae0f93 Add Phoenix-RTOS port for ARM.
Port contributed by Jakub Sejdak <jakub.sejdak@phoesys.com>
2016-05-06 17:04:58 -04:00
Jeff Johnston 3312579f44 Fix libgloss/arc/nano.specs file. 2016-05-06 15:56:46 -04:00
Jeff Johnston 5c968d849a Fix white-space in libgloss/arc/Makefile.in. 2016-05-05 12:02:29 -04:00
Jeff Johnston de2a5d6cd3 Add _Thread_queue_Queue::_owner for RTEMS
Add _Thread_queue_Queue::_owner which will be used for the upcomming
priority inheritance implementation and an O(m) independence-preserving
protocol (OMIP) implementation.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-05-03 14:21:17 -04:00
Jeff Johnston 4f81837d78 Move _Thread_queue_Queue::_Lock for RTEMS
Move _Thread_queue_Queue::_Lock to begin of the structure.  On RTEMS,
the presence of a lock component in the thread queue structures actually
depends on the build-time RTEMS_SMP configuration option.  A move of
this part to the begin of the structure allows an implementation re-use
for the other parts.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-05-03 14:18:54 -04:00
Jeff Johnston f310e8d951 Always assign return value to passed pointer in time function.
If the passed t pointer is not a null pointer, always assign the return
value to the object it points to, regardless of whether the return value
is an error.

This is what the GNU C Library does, and this is also the expected
behavior according to the latest draft of the C programming language
standard (C11 ISO/IEC 9899:201x WG14 N1570, dated 2011-04-12):

Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
2016-05-02 16:11:26 -04:00
Jeff Johnston 58dd08ee50 Don't run UTF-8.exp test if newlib is not built with multibyte support.
Submitted on behalf of Yuriy Kolerov.

newlib/ChangeLog

2016-04-29  Yuriy Kolerov <yuriy.kolerov@synopsys.com>

        testsuite/newlib.locale/UTF-8.exp: Don't run if multibyte support is
        disabled.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
Signed-off-by: Anton Kolesov <anton.kolesov@synopsys.com>
2016-05-02 16:03:27 -04:00
Jeff Johnston 11afe8f6b6 Fix support ARC processors without barrel-shifter
crt0.S for ARC used to use instruction "asr.f lp_count, r3, 2" for all cores
except ARC601. However instructions which shift more than 1 bit are
optional, so this crt0.S didn't worked for all ARC cores.

Luckily this is a shift just by 2 bits on all occassions, so fix is trivial
- use two single-bit shifts.

libgloss/ChangeLog

2016-04-29  Anton Kolesov  <anton.kolesov@synopsys.com>

        * arc/crt0.S: Fix support for processors without barrel-shifter.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2016-05-02 12:04:40 -04:00
Jeff Johnston cd494f7038 Update crt0.S for ARC.
This is similar to commit 06537f05d4 to the
newlib for ARC.

GCC for ARC has been updated to provide consistent naming of preprocessor
definitions for different optional architecture features:

    * __ARC_BARREL_SHIFTER__ instead of __Xbarrel_shifter for
      -mbarrel-shifter
    * __ARCEM__ instead of __EM__ for ARC EM cores
    * __ARCHS__ instead of __HS__ for ARC HS cores
    * etc (not used in libgloss)

This patch updates crt0.S for ARC to use new definitions instead of a
deprecated ones. To ensure compatibility with older compiler new definitions
are also defined in crt0.S if needed, based on presence of deprecated
preprocessor definitions.

libgloss/ChangeLog

2016-04-29  Anton Kolesov  <Anton.Kolesov@synopsys.com>

        * arc/crt0.S: Use new GCC defines to detect processor features.
2016-05-02 11:58:47 -04:00
Jeff Johnston e90da68265 Add necessary infrastructure to support "nano" build of newlib.
ARC aproach to this feature is similiar to ARM's one here.

2016-04-29  Anton Kolesov  <anton.kolesov@synopsys.com>

        * arc/nano.specs: New file.
        * arc/Makefile.in: Support nano.specs.
        * arc/nsim.specs: Likewise.
2016-04-29 15:17:11 -04:00
Sebastian Huber 82768d9bab Provide FreeBSD types for <sys/types.h> on RTEMS
Provide the following types via <sys/types.h> on RTEMS for FreeBSD
compatibility if __BSD_VISIBLE

 * accmode_t,
 * cap_rights_t,
 * c_caddr_t,
 * cpulevel_t,
 * fixpt_t,
 * lwpid_t,
 * uintfptr_t,
 * vm_offset_t,
 * vm_ooffset_t,
 * vm_paddr_t,
 * vm_pindex_t, and
 * vm_size_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:29:04 +02:00
Sebastian Huber 51062c856b Always provide register_t via <sys/types.h>
Always provide register_t via <sys/types.h> for glibc and BSD
compatibility.  Define __BIT_TYPES_DEFINED__ to 1 like glibc for legacy
header files.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:28:13 +02:00
Corinna Vinschen 878e65d354 Simplify guard against defining pthread types on Cygwin
* libc/include/sys/types.h: Fix a comment about Cygwin.  Simplify
	guarding pthread types against inclusion on Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-21 10:27:29 +02:00
Corinna Vinschen 8cb99e8ba4 Remove cygwin/types.h 2016-04-21 10:12:02 +02:00