Commit Graph

41 Commits

Author SHA1 Message Date
Konstantin Belousov
2dd7d0560a Hide ucontext_t and mcontext_t when neither POSIX nor XSI features are
enabled in the compilation environment, i.e. for ANSI C use of
#include <signal.h>.

Requested and reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2016-02-13 17:23:55 +00:00
Konstantin Belousov
90edf67ecf POSIX states that #include <signal.h> shall make both mcontext_t and
ucontext_t available.  Our code even has XXX comment about this.

Add a bit of compliance by moving struct __ucontext definition into
sys/_ucontext.h and including it into signal.h and sys/ucontext.h.

Several machine/ucontext.h headers were changed to use namespace-safe
types (like uint64_t->__uint64_t) to not depend on sys/types.h.
struct __stack_t from sys/signal.h is made always visible in private
namespace to satisfy sys/_ucontext.h requirements.

Apparently mips _types.h pollutes global namespace with f_register_t
type definition.  This commit does not try to fix the issue.

PR:	207079
Reported and tested by:	Ting-Wei Lan <lantw44@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-02-12 07:38:19 +00:00
Pedro F. Giffuni
153cbcd657 Make use of gcc attributes in some standard include headers.
The `nonnull' attribute specifies that some function parameters should be
non-null pointers.  This is very useful as it helps the compiler generate
warnings on suspicious code and can also enable some small optimizations.

Also start using 'alloc_size' attribute in the allocator functions.

This is an initial step to better integrate our libc with the compiler:
these attributes are fully supported by clang and they are also useful
for the static analyzer.

Note that due to some bogus internal procedure in the way gcc ports
are built they may require updating if they were built before r280801.

Relnotes:		yes
Hinted by:		Android's bionic libc
Differential Revision:	https://reviews.freebsd.org/D2107
2015-04-06 01:39:16 +00:00
Pedro F. Giffuni
28cdb3ee15 Temporarily revert 280458.
GCC is still carries an old version of cdefs.h which doesn't
accept multiple parameters for the nonnull attribute.

Since this issue probably affects many ports in the tree
we will revert it for now until gcc gets fixed.
2015-03-25 21:53:17 +00:00
Pedro F. Giffuni
512cd1357a Introduce nonnull attributes in the signal and pthread headers.
The `nonnull' attribute specifies that some function parameters should be
non-null pointers.  This is very useful as it helps the compiler generate
warnings on suspicious code and can also enable some small optimizations.
In clang this is also useful for the static analyzer.

While we could go on defining this all over the tree, it only
makes sense to annotate a subset of critical functions.

Hinted by:		Android's bionic libc
Differential Revision:	https://reviews.freebsd.org/D2101
2015-03-24 20:33:24 +00:00
Jilles Tjoelker
448f5f73dc include: Remove checks for __BSD_VISIBLE where redundant with __XSI_VISIBLE
or __POSIX_VISIBLE.

Whenever <sys/cdefs.h> sets __BSD_VISIBLE to non-zero, it also sets
__POSIX_VISIBLE and __XSI_VISIBLE to the newest version supported.

No functional change is intended.
2014-05-11 13:48:21 +00:00
Ed Schouten
f6ab8089c6 Replace __const by const in all non-contributed source code.
As C1X is close to being released, there is no need to wrap around a
feature that is already part of C90. Most of these files already use
`const' in different placed as well.
2011-12-13 13:32:56 +00:00
Konstantin Belousov
ba13377a7e Add restrict keyword to pthread_sigmask prototype and manpage.
MFC after:	1 week
2011-02-20 09:52:29 +00:00
Warner Losh
f2556687c6 Remove the Berkeley clause 3's.
Add a few $FreeBSD$
2010-02-16 19:39:50 +00:00
Olivier Houchard
536fb65904 Don't name parameters, for consistency with the rest of the file, and because
it breaks third-party apps.

Submitted by:	gahr
2009-12-22 22:15:52 +00:00
Konstantin Belousov
9a6ceacede Implement sighold, sigignore, sigpause, sigrelse, sigset functions
from SUSv4 XSI. Note that the functions are obsoleted, and only
provided to ease porting from System V-like systems. Since sigpause
already exists in compat with different interface, XSI sigpause is
named xsi_sigpause.

Reviewed by:	davidxu
MFC after:	3 weeks
2009-11-26 13:49:37 +00:00
David Schultz
1068c8150a Revert r190943, since the problem in ports seems to be fixed now.
It's amazing how a well-placed eyesore generates more motivation in a
day than email generates in three weeks.
2009-04-17 14:19:18 +00:00
David Schultz
84997ef7b0 GNU Pth has some fragile kludges that were broken by r189828.
I've discussed this with the Pth maintainer and no clear solution
has emerged on the ports side of things, so for now, hack around
the issue in signal.h.
2009-04-11 16:57:50 +00:00
David Schultz
48a3f7d9ae Fix the visibility of several prototypes. Also move pthread_kill() and
pthread_sigmask() to signal.h. In principle, this shouldn't break anything,
since they're already in signal.h on other systems, and the FreeBSD
manpage says that both pthread.h and signal.h need to be included to
get these functions.

Add a hack to declare pthread_t in the P1003.1-2008 namespace
in signal.h.
2009-03-14 20:10:14 +00:00
David Schultz
a5e88ed711 Add psignal to the POSIX.1-2008 namespace. 2009-03-04 03:32:56 +00:00
David Xu
d2c8dd81be Use __pid_t instead of pid_t for sigqueue as other functions. 2005-10-16 22:23:03 +00:00
David Xu
05e72fac12 Add sigqueue function prototype. 2005-10-14 13:12:27 +00:00
Jeff Roberson
a447cd8b28 - Define sigwait, sigtimedwait, and sigwaitinfo in terms of
kern_sigtimedwait() which is capable of supporting all of their semantics.
 - These should be POSIX compliant but more careful review is needed before
   we announce this.
2003-03-31 23:30:41 +00:00
Bruce Evans
0dfac89ae3 Fixed style bug near $FreeBSD$. VCS ids in copyrights should not be
separated by a blank line.
2002-10-16 07:01:10 +00:00
Mike Barcroft
ed583c2855 o Move forward declaration for struct timespec to a more appropriate
location.
o Don't prototype functions for which we don't have an implementation.
o Add forward declaration for struct __ucontext, previously this was
  forward declared in <sys/signal.h>.
o Add a comment about the size of NSIG.

PR:		35924
Submitted by:	bde
2002-10-14 14:13:37 +00:00
Mike Barcroft
3357acdd16 Assume POSIX/XSI is always visible in the __BSD_VISIBLE case. Fix a
mix-up with siginterrupt().
2002-10-13 00:29:06 +00:00
Mike Barcroft
54e4e385de Add restrict type-qualifier. 2002-10-12 16:13:41 +00:00
Mike Barcroft
eb74223b9f o Use relatively new visibility primitives from <sys/cdefs.h>.
o Add typedef for pid_t.
o Add comment about missing restrict type-qualifier.
o Remove unneeded includes (<sys/_posix.h> and <sys/time.h>).
2002-10-06 21:54:08 +00:00
Robert Drehmel
e31d11c36a Add the 'restrict' type qualifier to the prototypes of `sigaction',
`sigprocmask', `sigaltstack', and `sigwait' as well as to the
prototypes of the apparantly unimplemented functions `sigtimedwait'
and `sigwaitinfo'.  This complies with IEEE Std 1003.1-2001.
2002-10-02 10:53:44 +00:00
Mike Barcroft
abbd890233 o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
Warner Losh
bb28f3c29b Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +00:00
Daniel Eischen
3445a5f016 Oops, forgot to commit this (s/ucontext_t/struct __ucontext/). 2002-02-17 19:21:42 +00:00
Marcel Moolenaar
9102cd0abd Remove the inline versions of sigaddset, sigdelset, sigemptyset,
sigfillset and sigismember.

Submitted by: bde
1999-10-02 19:33:23 +00:00
Marcel Moolenaar
3cf3c5d9dd sigset_t change (part 5 of 5)
-----------------------------

Most of the userland changes are in libc. For both the alpha
and the i386 setjmp has been changed to accomodate for the
new sigset_t. Internally, libc is mostly rewritten to use the
new syscalls. The exception is in compat-43/sigcompat.c

The POSIX thread library has also been rewritten to use the
new sigset_t. Except, that it currently only handles NSIG
signals instead of the maximum _SIG_MAXSIG. This should not
be a problem because current applications don't use any
signals higher than NSIG.

There are version bumps for the following libraries:
  libdialog
  libreadline
  libc
  libc_r
  libedit
  libftpio
  libss

These libraries either a) have one of the modified structures
visible in the interface, or b) use sigset_t internally and
may cause breakage if new binaries are used against libraries
that don't have the sigset_t change. This not an immediate
issue, but will be as soon as applications start using the
new range to its fullest.

NOTE: libncurses already had an version bump and has not been
      given one now.

NOTE: doscmd is a real casualty and has been disconnected for
      the moment. Reconnection will eventually happen after
      doscmd has been fixed. I'm aware that being the last one
      to touch it, I'm automaticly promoted to being maintainer.
      According to good taste this means that I will receive a
      badge which either will be glued or mechanically stapled,
      drilled or otherwise violently forced onto me :-)

NOTE: pcvt/vttest cannot be compiled with -traditional. The
      change cause sys/types to be included along the way which
      contains the const and volatile modifiers. I don't consider
      this a solution, but more a workaround.
1999-09-29 15:18:46 +00:00
Peter Wemm
78121e79aa Add a strsignal(3) (like strerror(3)) for libc compatability with other
systems. NetBSD, Linux, SVR4 etc all have it.
1999-05-18 04:48:58 +00:00
John Birrell
5520d4646e Add the prototype for sigwait(). 1998-08-25 11:08:22 +00:00
Doug Rabson
c989e80e4d Move the include of <machine/ansi.h> to before <sys/signal.h>. 1998-08-05 08:51:48 +00:00
Peter Wemm
d919f8a34a nuke signanosleep(). 1998-05-14 11:33:04 +00:00
Peter Dufault
8a6472b723 Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work.  Changes:

Change all "posix4" to "p1003_1b".  Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.
1998-03-28 11:51:01 +00:00
Peter Dufault
7a2ac24c5f Put sigevent and AIO_LISTIO_MAX back in aio.h so
that kernels can be built.
1998-03-08 22:21:12 +00:00
Peter Dufault
aac4ad2c99 Reviewed by: bde
Changes to support building with _POSIX_SOURCE set to 199309L:

1. Add sys/_posix.h to handle those preprocessor defs that POSIX
says have effects when defined before including any header files;

2. Change POSIX4_VISIBLE back to _POSIX4_VISIBLE

3. Add _POSIX4_VISIBLE_HISTORICALLY for pre-existing BSD features now
defined in POSIX.  These show up when:

_POSIX_SOURCE and _POSIX_C_SOURCE are not set or
_POSIX_C_SOURCE is set >= 199309L

and vanish when:

_POSIX_SOURCE is set or _POSIX_C_SOURCE is < 199309L.

4. Explain these in man 9 posix4;

5. Include _posix.h and conditionalize on new feature test.
1998-03-08 17:25:38 +00:00
Peter Dufault
917e476dad Reviewed by: msmith, bde long ago
POSIX.4 headers and sysctl variables.  Nothing should change
unless POSIX4 is defined or _POSIX_VERSION is set to 199309.
1998-03-04 10:27:00 +00:00
Bruce Evans
70c780fe61 Added missing declaration of signanosleep(). 1998-01-16 12:44:20 +00:00
Sujal Patel
e862fa8cf2 Added missing prototype for sigaltstack() 1996-06-28 04:27:04 +00:00
Bruce Evans
943c18018b Fix standards conformance bugs in <signal.h>:
include/signal.h:
There was massive namespace pollution from including <sys/types.h>.
POSIX functions were declared even when _ANSI_SOURCE is defined.

sys.sys/signal.h:
NSIG was declared even if _ANSI_SOURCE or _POSIX_SOURCE is defined.
sig_atomic_t wasn't declared if _POSIX_SOURCE is defined.
Declare a typedef for signal handling functions and use it to
unobfuscate declarations and to avoid half-baked function types
that cause unwanted compiler warnings at certain warning levels.
Fix confusing comment about SA_RESTART.

sys/i386/include/signal.h:
This has to be included to get the declaration of sig_atomic_t even
when _ANSI_SOURCE is defined, so be more careful about polluting
the ANSI namespace.

Uniformize idempotency ifdefs.
1995-06-28 02:14:13 +00:00
Rodney W. Grimes
59deaec541 BSD 4.4 Lite Include Sources 1994-05-24 09:57:34 +00:00