Commit Graph

42 Commits

Author SHA1 Message Date
Andy Koppe d8ccbcdacc Drop non-reserved parameter names from sys/signal.h
Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header.
2018-08-29 17:46:27 +02:00
Yaakov Selkowitz 70ee6b17df ansification: remove _EXFUN, _EXFUN_NOTHROW
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:29 -06:00
Martin Aberg 1251555311 newlib: Availability of _kill() in sys/signal.h
Make prototype of _kill() always visible when _COMPILING_NEWLIB is
defined. This makes <sys/signal.h> consistent with the use of
_COMPILING_NEWLIB in <sys/unistd.h>, <sys/times.h>, etc.
2017-12-18 19:58:05 +01:00
Thomas Preud'homme 0c081aa62c Fix guard for siginfo_t and pthread_t definition
Commit 8a3b3bb4d7 changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.

This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
2017-06-19 13:00:05 +02:00
Yaakov Selkowitz dde6af6f82 Export XSI sigpause
There are two common sigpause variants, both of which take an int argument.
If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
which removes the given signal from the process's signal mask; otherwise
you get the BSD version, which sets the process's signal mask to the given
value.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:23:52 -05:00
Yaakov Selkowitz 8a3b3bb4d7 Feature test macros overhaul: signal.h (part 3)
Notably, sigaction and friends are POSIX, but the form of sigpause
currently provided is BSD.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:15 -05:00
Sebastian Huber 9bb91b6c6b Resurrect <machine/types.h> for <sys/types.h>
Resurrect <machine/_user_types.h> for use in <sys/types.h>.  Newlib
targets may provide an own version of <machine/types.h> in their machine
directory to add custom user types for <sys/types.h>.  Check the
_SYS_TYPES_H header guard to prevent a direct include of
<machine/types.h>, since the <machine/types.h> file is a Newlib
speciality.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:08:19 +02:00
Yaakov Selkowitz d3f203d091 Feature test macros overhaul: signal.h (part 2)
Move the sig*set macros following the functions inside their feature
test macro conditional.

This fixes the build on bare-metal targets following
commit 5c78499ae2.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
Acked-by: Corinna Vinschen <vinschen@redhat.com>
2016-03-18 11:22:32 -05:00
Yaakov Selkowitz 5c78499ae2 Feature test macros overhaul: signal.h
Use proper internal macros for BSD sig_t and GNU sighandler_t.

sigaltstack and friends are XSI even in SUSv4 but in glibc are
nonetheless handled as POSIX.1-2008 (not 2001).

The requirement for the ucontext_t typedef in signal.h was XSI prior to
POSIX.1-2008.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:09:03 -05:00
Sebastian Huber 01885f533d FreeBSD compatibility for <sys/select.h>
* libc/include/sys/_sigset.h: New.
	* libc/include/sys/select.h: Do not include <sys/types.h> and
	<sys/time.h> to avoid cyclic header file dependencies.  Include
	specialized header files instead.
	(sigset_t): Conditionally define.
	* libc/include/sys/signal.h (sigset_t): Likewise.
	* libc/include/sys/time.h: Include <sys/select.h> if
	__BSD_VISIBLE.
	* libc/include/sys/types.h: Likewise.
2015-12-14 15:39:44 +01:00
James Greenhalgh 4eca8ea0cf Always declare "kill" in include/sys/signal.h
Hi,

As I mentioned recently [1], newlib is providing a "kill" symbol to link
against, without declaring "kill" in signal.h. This is confusing for the
libgfortran build, which tries to link against kill (which succeeds), then
tries to use it (which triggers -Werror=implicit-function-declaration).

This patch implements my suggestion in that thread - making the declaration
of 'kill' in libc/include/sys/signal.h unconditional.

I've tested this by building a modified libgfortran on AArch64/ARM to see
that the Werror goes away, and the libgfortran build succeeds.

Is something like this OK for newlib? If so, can someone please commit
it on my behalf, as I have no commit access here.

Otherwise, what is your preferred direction for me to take this patch?

Thanks,
James
2015-08-25 16:17:14 +02:00
Yaakov Selkowitz 9f3100c958 sys/signal.h: include sys/ucontext.h on Cygwin per POSIX.1-2008
* libc/include/sys/signal.h [__CYGWIN__]: include <sys/ucontext.h>
if compiling for POSIX.1-2008.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-08-18 11:05:41 +02:00
Corinna Vinschen 2b615b47d4 sys/signal.h requires sys/cdefs.h
* libc/include/sys/signal.h: Include forgotten sys/cdefs.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-22 10:49:29 +02:00
Corinna Vinschen 6442e914d9 Use MINSIGSTKSZ and SIGSTKSZ from newlib for Cygwin as well
* libc/include/sys/signal.h: Move altstack macros completely
	outside of rtems block.

	* include/cygwin/signal.h: Remove definitions of MINSIGSTKSZ
	and SIGSTKSZ here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 19:05:51 +02:00
Corinna Vinschen 22465796ed Preliminary infrastructure to implement alternate stack
* libc/include/sys/signal.h: Define SS_ONSTACK and SS_DISABLE
	unconditionally.
	(sigaltstack): Enable prototype on Cygwin.

	* common.din (sigaltstack): Export.
	* cygtls.cc (_cygtls::init_thread): Initialize altstack.
	* cygtls.h (__tlsstack_t): Rename from __stack_t to distinguish
	more clearly from stack_t.  Accommodate throughout.
	(_cygtls): Add altstack member.
	* exceptions.cc (exception::handle): Set SIGSEGV handler to SIG_DFL
	if we encounter a stack overflow, and no alternate stack has been
	defined.
	* include/cygwin/signal.h (MINSIGSTKSZ): Define
	(SIGSTKSZ): Define.
	(SA_ONSTACK): Define.
	* signal.cc (sigaltstack): New function.
	* tlsoffset.h: Regenerate.
	* tlsoffset64.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-19 16:12:45 +02:00
Jon TURNEY 38a8d3e216 Make stack_t typedef generally available
* libc/include/sys/signal.h (stack_t): Make typedef generally
	available.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:10 +02:00
Sebastian Huber b161b155c8 Add and use latest <sys/timespec.h> from FreeBSD
* libc/include/sys/_timespec.h: Import from FreeBSD.
        * libc/include/sys/timespec.h: Likewise.
        * libc/include/time.h: Include <sys/timespec.h>.
       	* libc/include/sys/types.h (timespec): Delete.
        (itimerspec): Likewise.
        * libc/include/machine/time.h: Include <sys/_timespec.h>.
        * libc/include/sys/sched.h: Likewise.
        * libc/include/sys/signal.h: Likewise.
        * libc/include/sys/stat.h: Likewise.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-11 15:45:38 +01:00
Corinna Vinschen a800b3ae9c * libc/include/sys/signal.h [__SPU__] (kill): Declare. 2014-12-04 09:15:50 +00:00
Corinna Vinschen d5fd6aeb6d * libc/include/sys/signal.h: Declare sigaltstack for RTEMS only. 2014-08-18 18:18:10 +00:00
Joel Sherrill 6042d39486 2014-08-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sys/signal.h: Add sigaltstack() support.
2014-08-18 14:03:35 +00:00
Corinna Vinschen f9b3628010 * libc/include/sys/signal.h (sigset_t): Don't define when building
for Cygwin.
2012-10-26 09:23:46 +00:00
Corinna Vinschen 1f232abc89 Throughout, run newlib with -Wall -Werror option and fix bugs and
compiler warnings found this way.

	* libc/stdio/freopen.c (_freopen_r): Fix bug setting _flags.

	* libc/include/stdio.h (_rename): Define when building newlib.
	* libc/include/sys/signal.h (_kill): Ditto.
	* libc/include/sys/stat.h (_mkdir): Ditto.
	* libc/include/sys/time.h (_gettimeofday): Ditto.
	* libc/include/sys/times.h (_times): Ditto.
	* libc/include/sys/wait.h (_wait): Ditto.
	* libc/locale/lmessages.c (empty): Don't define for Cygwin.
	* libc/locale/lmonetary.c (cnv): Ditto.
	* libc/locale/nl_langinfo.c (nl_langinfo): Ditto for variable s.
	* libc/posix/collate.c: Throughout cast to avoid compiler warning.
	* libc/posix/engine.c (matcher): Initialize dp to avoid compiler
	warning.
	* libc/posix/glob.c: Disable on Cygwin.  Explain why.
	* libc/posix/regcomp.c: Fix "uninitialized" compiler warnings.
	(dissect): Deliberately silence gcc compiler warning.  Add comment to
	explain why.
	* libc/posix/wordexp.c (wordexp): Remove num_bytes variable since result
	is never used.
	* libc/posix/popen.c (popen): Ditto for variable last.
	* libc/reent/mkdirr.c: Include sys/stat.h.
	* libc/reent/renamer.c: Include stdio.h.
	* libc/search/hash.c:  Throughout use underscored variants of the stat
	function family.
	(init_hash): Add missing definition for the __USE_INTERNAL_STAT64 case.
	* libc/search/hash_bigkey.c (__big_insert): Add parenthesis to avoid
	compiler warning.
	* libc/search/hash_page.c (overflow_page): Initalize freep to NULL to
	avoid compiler warning.
	* libc/stdio/asiprintf.c (_asiprintf_r): Cast unsigned char * to char *
	to avoid compiler warning.
	(asiprintf): Ditto.
	* libc/stdio/asprintf.c (_asprintf_r): Ditto.
	(asprintf): Ditto.
	* libc/stdio/vasiprintf.c (_vasiprintf_r): Ditto.
	* libc/stdio/vasprintf.c (_vasprintf_r): Ditto.
	* libc/stdio/mktemp.c (_gettemp): Cast to unsigned char in call to
	isdigit to avoid compiler warning.
	* libc/stdio/vfprintf.c (_VFPRINTF_R): Initialize variables used for
	grouping to avoid compiler warning.  Only define and set nseps and
	nrepeats if they are really used.
	* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Ditto.  Only define state if
	it is really used.
	* libc/stdio/vfscanf.c (u_char): Revert to be defined as unsigned char.
	(__SVFSCANF_R): Cast fmt in call to __mbtowc.
	* libc/stdlib/mbtowc_r.c (JIS_state_table): Disable when building
	Cygwin.
	(JIS_action_table): Ditto.
	* libc/stdlib/wctomb_r.c (__utf8_wctomb): Add parenthesis to avoid
	compiler warning.
	* libc/string/strcasestr.c: Deliberately silence gcc compiler warning.
	Add comment to explain why.
	* libc/time/strptime.c (strptime): Cast to unsigned char in calls to
	isspace to avoid compiler warning.
	* libm/math/e_atan2.c (__ieee754_atan2): Add parenthesis to avoid
	compiler warning.
	* libm/math/e_exp.c (__ieee754_exp): Initialize k to 0 to avoid
	compiler warning.  Drop setting it to 0 later.
	* libm/math/ef_exp.c (__ieee754_expf): Ditto.
	* libm/math/e_pow.c (__ieee754_pow): Add braces to avoid compiler
	warning.
	* libm/math/ef_pow.c (__ieee754_powf): Ditto.
	* libm/math/er_lgamma.c (__ieee754_lgamma_r): Initialize nadj to 0 to
	avoid compiler warning.
	* libm/math/erf_lgamma.c (__ieee754_lgammaf_r): Ditto.
	* libm/math/e_rem_pio2.c (__ieee754_rem_pio2): Ditto for variable z.
	* libm/common/sf_round.c (roundf): Remove signbit variable since result
	is never used.
2012-08-08 11:04:18 +00:00
Corinna Vinschen 060e5c9785 * libc/include/sys/signal.h (_sig_func_ptr): Define with int parameter
per POSIX.  Explain in comment.
2011-04-19 08:02:59 +00:00
Jeff Johnston 81c59927a9 2009-10-13 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* libc/include/sys/signal.h: Include <sys/types.h> always.
        [__CYGWIN__, __rtems__]: Define kill first argument as pid_t per
        standards.
2009-10-13 17:31:49 +00:00
Jeff Johnston e163e3e138 2006-04-18 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/signal.h (sigdelset, sigfillset, sigismember): New macros.
        (sigaddset, sigemptyset): Add return code.
2006-04-18 20:06:09 +00:00
Christopher Faylor b08d08c7c4 * libc/include/sys/signal.h: Move <signal.h> include to bottom of file so that
all relevant definitions have been handled for use in the include.
2004-10-28 15:06:47 +00:00
Jeff Johnston 73131c2d20 2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/signal.h: If <signal.h> didn't include
        this header file, include <signal.h> to account for
        applications that take advantage that the two header
        files are the same in glibc.
2004-10-08 17:40:57 +00:00
Jeff Johnston 9f13ccb356 2004-01-08 Joel Sherrill <joel@oarcorp.com>
* libc/sys/rtems/sys/queue.h: New file.
        * libc/include/sys/signal.h: Reflect renumbering of signals to
        fit into 32-bit mask.
        * libc/include/sys/unistd.h: Add fdatasync() prototype.
        * libc/sys/rtems/crt0.c: Add more symbols which may be implicitly
        required.  In particular, add the reentrant variants of libc calls.
        * libc/sys/rtems/sys/dirent.h: Add scandir() prototype.
2004-01-08 19:25:21 +00:00
Christopher Faylor 93f8e67384 * libc/include/sys/signal.h: Use system specific signal file when building on
cygwin.
2003-11-28 21:05:51 +00:00
Jeff Johnston 9cef8ef52b 2002-07-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/signal.h (SIG_IGN, SIG_DFL, SIG_ERR): Change
        to use _sig_func_ptr type casted constants.
        (_sig_func_ptr): Typedef moved to sys/signal.h.
        * libc/include/sys/signal.h (_sig_func_ptr): Typedef added.
        For __rtems, use POSIX definition, otherwise default to ANSI.
        * libc/sys/linux/sys/signal.h (_sig_func_ptr): Typedef added.
2002-07-24 18:18:07 +00:00
Thomas Fitzsimmons 4bb6112fb1 * libc/include/sys/signal.h [__CYGWIN__]: Issue error message
when _CYGWIN_TYPES_H is not defined.
2002-01-28 18:03:54 +00:00
Thomas Fitzsimmons 8d3455521a * libc/include/sys/signal.h: Revert 2002-01-23 change. 2002-01-25 00:47:44 +00:00
Thomas Fitzsimmons bcc49082f6 * libc/include/sys/signal.h: Remove pthread_kill declaration
when __CYGWIN__ is defined.
2002-01-24 00:52:27 +00:00
Christopher Faylor 333d609843 * libc/posix/execvp.c: Remove obsolete CYGWIN32 considerations throughout.
* signal.h: Change comment to reflect __CYGWIN__ rather than __CYGWIN32__.
* popen.c (popen): Use __CYGWIN_ rather than __CYGWIN32__.
* system.c (_system_r): Ditto.
2001-10-22 16:40:26 +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
Christopher Faylor b24ee7499c * libc/include/sys/signal.h: Always include sys/types.h under Cygwin. 2001-02-15 06:42:35 +00:00
Jeff Johnston 8915d10a26 2001-02-08 Edward M. Lee <tailbert@yahoo.com>
* libc/include/grp.h: add prototype for initgroups.
        * libc/include/stdio.h: fix prototype for putw.
        * libc/include/sys/signal.h: add prototype for killpg.
        * libc/include/sys/stat.h: enable mknod/lstat for CYGWIN.
        * libc/include/sys/unistd.h: add prototypes for getpgid, setpgrp,
        vhangup and remove duplicate sysconf prototype.
2001-02-09 00:13:54 +00:00
Christopher Faylor e45ab89012 * libc/include/sys/signal.h: Add some SA_* defines for Cygwin. 2001-01-12 05:36:12 +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
Christopher Faylor e0997f5a0f Fix spelling error. 2000-11-05 22:11:37 +00:00
Christopher Faylor d2dd57657c * libc/include/ctype.h: __CYGWIN32__ -> __CYGWIN__
* libc/include/malloc.h: Ditto.
* libc/include/process.h: Ditto.
* libc/include/stdio.h: Ditto.
* libc/include/stdlib.h: Ditto.
* libc/include/time.h: Ditto.
* libc/include/machine/setjmp.h: Ditto.
* libc/include/sys/errno.h: Ditto.
* libc/include/sys/signal.h: Ditto.
* libc/include/sys/stat.h: Ditto.
* libc/include/sys/time.h: Ditto.
* libc/include/sys/unistd.h: Ditto.
* libc/include/string.h: Ditto.  strsignal should return a const char *.
2000-05-30 17:18:05 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00