Commit Graph

44 Commits

Author SHA1 Message Date
Yaakov Selkowitz f6417be2aa Cygwin: define _POSIX_ASYNCHRONOUS_IO
This feature is now available as of the recent AIO commits.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-07-25 10:48:55 -05:00
Yaakov Selkowitz 3e8fc7d9f2 ssp: add Object Size Checking common code
The Object Size Checking (-D_FORTIFY_SOURCE=*) functionality provides
wrappers around functions suspectible to buffer overflows.  While
independent from Stack Smashing Protection (-fstack-protector*), they
are often used and implemented together.

While GCC also provides an implementation in libssp, it is completely
broken (CVE-2016-4973, RHBZ#1324759) and seemingly unfixable, as there
is no reliable way for a preprocessor macro to trigger a link flag.
Therefore, adding this here is necessary to make it work.

Note that this does require building gcc with --disable-libssp and
gcc_cv_libc_provides_ssp=yes.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-29 11:25:39 -06:00
Yaakov Selkowitz f2b27ce620 cygwin: define _POSIX_TIMEOUTS
Since commit 8128f5482f, we have all the
non-tracing functions listed in posixoptions(7).  The tracing functions
are gated by their own option, and are obsolecent anyway.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28 10:26:00 -06:00
Corinna Vinschen 8322a87c16 cygwin: Set __STDC_ISO_10646__ to Unicode 5.2 value
Now that XP is not supported anymore we can freely do that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-26 11:49:58 +02:00
Gedare Bloom 338ce06971 Add _POSIX_SHARED_MEMORY_OBJECTS 2017-01-13 13:07:40 -06:00
Joel Sherrill 1a2741508b Add <devctl.h> per POSIX 1003.26-2003 2016-12-05 21:00:38 -06:00
Gedare Bloom 9a80679aae rtems: define _POSIX_CLOCK_SELECTION feature
Enable definition of clock_nanosleep() since it was added to RTEMS.

Signed-off-by: Joel Sherrill <joelemail@rtems.org>
2016-08-08 11:12:23 -05:00
Yaakov Selkowitz d55d03a87d cygwin: make POSIX/XSI version macros dependent on feature test macros
Each version of SUS specifies a different value for _POSIX_VERSION,
_POSIX2_VERSION, and _XOPEN_VERSION.  glibc also changes the value
of the other _POSIX2_ variables but not the _POSIX_* variables.

_POSIX_TIMERS should be set to a version number, not just 1.

The _POSIX_V7_* macros were missing, which was not noticed because
the V6 values were aliased in sysconf (<unistd.h>).

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-04-04 10:25:25 -05:00
Yaakov Selkowitz b9bbe1bccb Feature test macros overhaul: C++ TR1
While C++11 was the first version of the standard to use C99 functionality,
TR1 (for C++03) also does, and G++ does not distinguish between C++98 and
C++03, or when TR1 is in use.  Therefore, while not strictly correct for
"pure" C++98, enabling C99 for all C++ usage is the simplest solution (and
much better than always using -D_GNU_SOURCE as on Linux).

See thread starting: https://sourceware.org/ml/newlib/2016/msg00297.html

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-23 16:14:00 -05:00
Yaakov Selkowitz 6ba26630e0 Feature test macros overhaul: sys/features.h
This is the complete rework of the feature tests macros for better
compatibility with GNU libc, primarily based on the Linux man pages
documentation:

http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

The previous implementation was flawed in its approach that macros were
often used to hide symbols if defined (e.g. !defined __STRICT_ANSI__ or
!defined _POSIX_SOURCE), whereas the approach of glibc is that these macros
make symbols available when defined (e.g. defined _BSD_SOURCE, or as used
internally, #if __BSD_VISIBLE).  As much open-source software is written
with glibc in mind, this necessitated patching numerous packages just to
compile.

In particular, __STRICT_ANSI__ (which is defined by gcc -ansi or -std=c*)
was given too much importance.  This implementation limits the influence
of __STRICT_ANSI__ to controlling the default when no other feature test
macros are defined, and to the inclusion of <alloca.h> in <stdlib.h> as
documented.  These are the only places where __STRICT_ANSI__ should be
tested.

The following macros are now accepted: _ATFILE_SOURCE, _BSD_SOURCE,
_DEFAULT_SOURCE, _ISOC99_SOURCE, _ISOC11_SOURCE, _LARGEFILE_SOURCE,
_SVID_SOURCE, _XOPEN_SOURCE_EXTENDED.

The existing __*_VISIBLE internal macros have been kept mostly
compatible with the original BSD implementation, with some changes to
the criteria which controls them.  Several more macros in this style
have been added where needed for concision or accuracy.

Enabling C++11 or newer in the compiler also enables C99 and C11
functions.  Doing so should help move away from the need to define
_GNU_SOURCE in g++ for _GLIBCXX_USE_C99 support as on Linux:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:06:40 -05:00
Corinna Vinschen c716affcef sys/features.h: Update Cygwin POSIX option macros
* libc/include/sys/features.h: Set POSIX option macros from 200112L
	to 200809L for Cygwin.
	(_POSIX_SPAWN): Set to 200809L for Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-02-18 13:10:28 +01:00
Pieter du Preez 264b817b8e Define the newlib version macros in one place: _newlib_version.h.
Currently, the newlib version information needs to be updated in two places:
 - newlib/acinclude.m4
 - newlib/libc/include/sys/features.h

The goal of this patch is to:
 - supply a single location for defining the newlib version
   information: newlib/acinclude.m4
 - define __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__
   This is in line with what gcc does for its version macros. See:
   https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

This patch moves the definition of the _NEWLIB_VERSION, __NEWLIB__
and __NEWLIB_MINOR__ macros from newlib/libc/include/sys/features.h,
to the newly generated newlib/_newlib_version.h file. Additionally,
the __NEWLIB_PATCHLEVEL__ macro was created, for completeness.

In order to stay backwards compatible, newlib/_newlib_version.h gets
included by newlib/newlib.h and newlib/libc/include/sys/features.h.

Note: This patch does _not_ include the modifications to the following
files, as these should all be generated any way.
      *Makefile.in,
      *aclocal.m4,
      *configure
      stamp-* files

Signed-off-by: Pieter du Preez <pdupreez@gmail.com>
2016-02-17 16:04:09 -05:00
Václav Haisman 813da84442 POSIX barrier implementation, take 3
The attached patch should address all of the review comments.

Modifed change log:

Newlib:

	* libc/include/sys/features.h (_POSIX_BARRIERS): Define for Cygwin.
	* libc/include/sys/types.h (pthread_barrier_t)
	(pthread_barrierattr_t): Do not define for Cygwin.

Cygwin:

	* common.din (pthread_barrierattr_init)
	(pthread_barrierattr_setpshared, pthread_barrierattr_getpshared)
	(pthread_barrierattr_destroy, pthread_barrier_init)
	(pthread_barrier_destroy, pthread_barrier_wait): Export.
	* include/cygwin/types.h (pthread_barrierattr_t)
	(pthread_barrier_t): Declare.
	* include/pthread.h (PTHREAD_BARRIER_SERIAL_THREAD)
	(pthread_barrierattr_init, pthread_barrierattr_setpshared)
	(pthread_barrierattr_getpshared, pthread_barrierattr_destroy)
	(pthread_barrier_init, pthread_barrier_destroy)
	(pthread_barrier_wait): Declare.
	* thread.h (PTHREAD_BARRIER_MAGIC)
	(PTHREAD_BARRIERATTR_MAGIC): Define.
	(class pthread_barrierattr, class pthread_barrier): Declare.
	* thread.cc (delete_and_clear): New local helper function.
	(class pthread_barrierattr, class pthread_barrier): Implement.
	* miscfuncs.h (likely, unlikely): New macros.

--
VH
2016-02-13 16:03:15 +01:00
Jeff Johnston f0e3a51e9f 2014-12-26 Freddie Chopin <freddie_chopin@op.pl>
* libc/include/sys/features.h: update newlib version and copyright year
2015-01-05 17:31:28 +00:00
Jeff Johnston 99eb60455b 2014-09-17 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/features.h: Add __NEWLIB__ and
        __NEWLIB_MINOR__ macros.
2014-09-17 22:20:16 +00:00
Corinna Vinschen 1875ee55d3 Port newlib to x86_64-pc-cygwin.
* libc/include/sys/features.h: Redefine compilation environment
	definitions for Cygwin to cover 64 bit Cygwin.
	* libc/ctype/ctype_.c (_ctype_): Fix definition for 64 bit Cygwin.
	* libc/include/machine/setjmp.h: Change definition of _JBLEN to allow
	different values for 32 bit and 64 bit Cygwin.
	* libc/include/reent.h (stat64): Define as stat under Cygwin, instead
	of as __stat64.  Undef stat64 if not building Newlib.
	* libc/include/sys/stat.h (stat64): Define as stat under Cygwin.
2013-04-23 09:42:25 +00:00
Corinna Vinschen 9770af188f * libc/include/sys/cdefs.h: Align with latest FreeBSD file header.
* libc/include/sys/features.h (__GNUC_PREREQ__): Define.
2013-04-22 10:28:05 +00:00
Corinna Vinschen 5eceb3958e * libc/include/sys/features.h (__GNUC_PREREQ): Define. Use
throughout in place of explicit GNUC version checks.
	* libc/include/_ansi.h (_NOINLINE): Define.
	(_NOINLINE_STATIC): Define.
	* libc/stdio/vfprintf.c (__sbprintf): Define _NOINLINE_STATIC.
2012-10-16 18:45:24 +00:00
Yaakov Selkowitz 792c8bcff2 * libc/include/time.h [_POSIX_CLOCK_SELECTION] (clock_nanosleep):
Declare.
* libc/include/sys/features.h [__CYGWIN__] (_POSIX_CLOCK_SELECTION):
Define.
2011-07-20 19:41:15 +00:00
Yaakov Selkowitz 64a5e8a9a3 * libc/include/time.h (CLOCK_PROCESS_CPUTIME_ID): Rename from
CLOCK_PROCESS_CPUTIME.
(CLOCK_THREAD_CPUTIME_ID): Rename from CLOCK_THREAD_CPUTIME.
* libc/include/sys/features.h [__CYGWIN__] (_POSIX_CPUTIME): Define.
(_POSIX_THREAD_CPUTIME): Define.
2011-05-16 22:35:10 +00:00
Corinna Vinschen aaded2f90e * libc/include/sys/features.h (_POSIX_THREAD_ATTR_STACKADDR): Define
to 200112L for Cygwin.
2011-05-15 18:50:52 +00:00
Yaakov Selkowitz 5f555b0bd3 * libc/include/sys/features.h [__CYGWIN__] (_POSIX_SPIN_LOCKS): Define.
* libc/include/sys/types.h: Cygwin provides its own pthread_spinlock_t
typedef.
2011-05-02 16:05:06 +00:00
Corinna Vinschen 7cc6d7cfc6 * libc/include/sys/features.h: Define __STDC_ISO_10646__ for Cygwin.
* libc/include/wchar.h: Include features.h.
2011-01-27 11:55:01 +00:00
Corinna Vinschen f717289618 * libc/include/sys/features.h: Define _POSIX_MONOTONIC_CLOCK for Cygwin. 2010-08-09 08:29:22 +00:00
Corinna Vinschen 5e74a46f2f * libc/include/sys/features.h: Allow for _XOPEN_SOURCE to have an
empty definition.  Also add support for values of 500 or less.
2010-03-17 17:13:00 +00:00
Jeff Johnston 6fc25b2d1e 2010-03-02 Craig Howland <howland@LGSInnovations.com>
* libc/include/sys/features.h:  Add POSIX.1-permitted definition of
        _POSIX_C_SOURCE if not already defined and _XOPEN_SOURCE has an
        appropriate value.  Specifically, check for POSIX.1-2008 & 2001 values.
        * libc/include/sys/config.h:  Add #include <sys/features.h> so that all
        includes get the new check added to it.
2010-03-02 19:28:39 +00:00
Jeff Johnston 394660ec2f 2009-07-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sys/features.h: Enable UNIX98 mutex attributes
        for RTEMS.
2009-07-06 18:59:04 +00:00
Jeff Johnston a2c3c5dab4 2009-06-17 Michael Eager <eager@eagercon.com>
* libc/include/pthread.h: Support XMK (Xilinx) BSP, add RTEMS to
        PTHREAD_MUTEX_NORMAL.
        * libc/include/sys/features.h: Same.
        * libc/include/sys/types.h: Same.
2009-06-17 16:47:02 +00:00
Jeff Johnston 43b1cfeca5 2009-04-06 Ken Werner <ken.werner@de.ibm.com>
* libc/include/sys/features.h: Undefine _POSIX_TIMERS for spu.
        * libc/include/machine/time.h (nanosleep): Declare.
2009-04-06 22:04:33 +00:00
Jeff Johnston db48463a7f 2008-12-12 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/sys/features.h: Set RTEMS's _POSIX_MONOTONIC_CLOCK to
        200112L (SUSv3 compliance).
        Comment out RTEMS's _POSIX_SHARED_MEMORY_OBJECTS (Unsupported).
2008-12-12 17:16:03 +00:00
Corinna Vinschen a81a17c43b * libc/include/sys/features.h (_POSIX_V6_ILP32_OFF32): Always define.
(_POSIX_V6_LP64_OFF64): Ditto.
	(_POSIX_V6_LPBIG_OFFBIG): Ditto.
2008-12-04 13:58:11 +00:00
Jeff Johnston 01bf0593df 2008-10-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/time.h: Add CLOCK_MONOTONIC.
   * libc/include/sys/features.h: Define
   _POSIX_MONOTONIC_CLOCK for RTEMS.
2008-10-16 21:53:58 +00:00
Jeff Johnston 41e94f2488 2007-12-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/features.h: Add checks for C90 compilers using
        -ansi.
2007-12-19 18:51:19 +00:00
Jeff Johnston a8b08518c1 2007-06-13 Patrick Mansfield <patmans@us.ibm.com>
* libc/include/sys/features.h: Define _POSIX_TIMERS for spu.
        * libc/include/sys/unistd.h: Change usleep prototype to Posix
        form and move outside of OS flag checks.
        * libc/machine/spu/Makefile.am: Add sleep and usleep.
        * libc/machine/spu/Makefile.in: Regenerate.
        * libc/machine/spu/sleep.c: Copy libc/posix/sleep.c.
        * libc/machine/spu/usleep.c: Copy libc/posix/usleep.c.
2007-06-13 17:44:24 +00:00
Corinna Vinschen 4f7e59f268 * libc/include/sys/features.h: Add _POSIX_MESSAGE_PASSING for
Cygwin.
2007-02-14 10:07:02 +00:00
Corinna Vinschen d7e4c7a807 * libc/include/sys/features.h: Add _POSIX_SHARED_MEMORY_OBJECTS for
Cygwin.  Fix value of _POSIX_SEMAPHORES.  Fix formatting.
2007-02-08 13:34:20 +00:00
Corinna Vinschen 0e37a2e6e5 * libc/include/sys/features.h: Add definition of all supported
_POSIX_xxx values for Cygwin.
	* libc/include/sys/types.h (pthread_rwlock_t): Omit definition
	on Cygwin.
	(pthread_rwlockattr_t): Ditto.
	* libc/include/sys/unistd.h: Define all _SC_xxx values as
	required by SUSv3.  Unify formatting.
2007-02-07 17:19:35 +00:00
Jeff Johnston 23754b33c3 2006-09-13 Joel Sherrill <joel@oarcorp.com>
* libc/include/pthread.h: Add pthread barriers,
        rwlocks, and spinlocks.  Change const to
        _CONST and prefix parameter names with
        an underscore.
        * libc/include/sys/types.h: Add id and attribute
        types for barriers, wrlocks, and spinlocks.
        * libc/include/sys/features.h: Enable barriers,
        wrlocks, and spinlocks for RTEMS.
2006-09-13 22:09:27 +00:00
Corinna Vinschen a92822b747 * libc/include/sys/features.h: Define _POSIX_MEMLOCK_RANGE for Cygwin. 2005-10-18 18:39:46 +00:00
Christopher Faylor 733309f576 * libc/include/sys/features.h: Add _POSIX_TIMERS define for __CYGWIN__.
* libc/include/sys/reent.h (__getreent): Protect against possibly being
defined.
* libc/include/sys/unistd.h (fdatasync): Don't define for __CYGWIN__.
2004-02-09 02:22:01 +00:00
Christopher Faylor c82479b1e3 * libc/include/sys/features.h (_POSIX_SEMAPHORES): New Cygwin define. 2002-03-28 04:26:49 +00:00
Christopher Faylor 74f8cc634a * libc/include/sys/features.h: Add appropriate defines for Cygwin pthread
support.
* libc/include/sys/signal.h: Remove unneeded __CYGWIN__ protection.
* libc/include/sys/types.h: Protect __CYGWIN__ from the rtems pthreads types.
Include <cygwin/types.h> for the cygwin specific typedefs.
2001-04-12 00:05:57 +00:00
DJ Delorie 1376245a1f * libc/include/sys/features.h: __CYGWIN__ preferred over __CYGWIN32__ 2001-01-12 02:41:33 +00:00
Jeff Johnston 8fb3796385 2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
        * libc/sys/rtems/include/signal.h: Removed.
        * libc/sys/rtems/include/time.h: Removed.
        * libc/sys/rtems/sys/features.h: Removed.
        * libc/sys/rtems/sys/sched.h: Removed.
        * libc/sys/rtems/sys/siginfo.h: Removed.
        * libc/sys/rtems/sys/signal.h: Removed.
        * libc/sys/rtems/sys/time.h: Removed.
        * libc/sys/rtems/sys/times.h: Removed.
        definitions for time_t and clock_t since these are
        no longer in time.h.
        * libc/include/pthread.h: New file.
        * libc/include/sys/sched.h: New file.
        * libc/include/sys/features.h: New file.
        * libc/include/time.h: Removed duplicate definition of clock_t
        and time_t, get them from <sys/types.h> instead.  Add prototypes        for POSIX clock and timer functionality.
        * libc/sys/linux/sys/types.h: Changed to include
        * libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
        * libc/include/sys/signal.h: Add more complete set of POSIX
        signal functionality including real-time and threaded signals.
        * libc/include/sys/types.h: Add clock_t, time_t, struct
        timespec, and struct itimerspec.  Centralizing these makes
        things cleaner.  RTEMS uses 64-bit dev_t.
        Added numerous primitive definitions
        for pthreads including macros, pthread_attr_t,
        pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
        pthread_once_t, and pthread_t.
        * libc/include/sys/unistd.h: Added getlogin_r() prototype.
        If RTEMS follow POSIX on read(), write() and sbrk() prototype.
        Feature flags removed and moved to new file <sys/features.h>.
        Full set of POSIX sysconf() constants
2000-12-12 01:24:09 +00:00