annotate lib/stddef.in.h @ 15727:144db791c6fa

Ensure EBADF returns for socket functions on mingw. * lib/accept.c (rpl_accept): Fail with error EBADF if the file descriptor is invalid. * lib/bind.c (rpl_bind): Likewise. * lib/connect.c (rpl_connect): Likewise. * lib/getpeername.c (rpl_getpeername): Likewise. * lib/getsockname.c (rpl_getsockname): Likewise. * lib/getsockopt.c (rpl_getsockopt): Likewise. * lib/listen.c (rpl_listen): Likewise. * lib/recv.c (rpl_recv): Likewise. * lib/recvfrom.c (rpl_recvfrom): Likewise. * lib/send.c (rpl_send): Likewise. * lib/sendto.c (rpl_sendto): Likewise. * lib/setsockopt.c (rpl_setsockopt): Likewise. * lib/shutdown.c (rpl_shutdown): Likewise.
author Bruno Haible <bruno@clisp.org>
date Wed, 21 Sep 2011 00:20:59 +0200
parents 5f709022a256
children 8250f2777afc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
1 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
2
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 13761
diff changeset
3 Copyright (C) 2009-2011 Free Software Foundation, Inc.
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
4
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8 any later version.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
13 GNU General Public License for more details.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
14
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
18
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
19 /* Written by Eric Blake. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
20
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
21 /*
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
22 * POSIX 2008 <stddef.h> for platforms that have issues.
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
23 * <http://www.opengroup.org/susv3xbd/stddef.h.html>
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
24 */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
25
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
26 #if __GNUC__ >= 3
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
27 @PRAGMA_SYSTEM_HEADER@
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
28 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
29 @PRAGMA_COLUMNS@
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
30
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
31 #if defined __need_wchar_t || defined __need_size_t \
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
32 || defined __need_ptrdiff_t || defined __need_NULL \
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
33 || defined __need_wint_t
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
34 /* Special invocation convention inside gcc header files. In
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
35 particular, gcc provides a version of <stddef.h> that blindly
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
36 redefines NULL even when __need_wint_t was defined, even though
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
37 wint_t is not normally provided by <stddef.h>. Hence, we must
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
38 remember if special invocation has ever been used to obtain wint_t,
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
39 in which case we need to clean up NULL yet again. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
40
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
41 # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
42 # ifdef __need_wint_t
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
43 # undef _@GUARD_PREFIX@_STDDEF_H
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
44 # define _GL_STDDEF_WINT_T
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
45 # endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
46 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
47 # endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
48
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
49 #else
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
50 /* Normal invocation convention. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
51
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
52 # ifndef _@GUARD_PREFIX@_STDDEF_H
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
53
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
54 /* The include_next requires a split double-inclusion guard. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
55
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
56 # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
57
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
58 # ifndef _@GUARD_PREFIX@_STDDEF_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
59 # define _@GUARD_PREFIX@_STDDEF_H
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
60
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
61 /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
62 #if @REPLACE_NULL@
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
63 # undef NULL
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
64 # ifdef __cplusplus
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
65 /* ISO C++ says that the macro NULL must expand to an integer constant
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
66 expression, hence '((void *) 0)' is not allowed in C++. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
67 # if __GNUG__ >= 3
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
68 /* GNU C++ has a __null macro that behaves like an integer ('int' or
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
69 'long') but has the same size as a pointer. Use that, to avoid
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
70 warnings. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
71 # define NULL __null
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
72 # else
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
73 # define NULL 0L
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
74 # endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
75 # else
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
76 # define NULL ((void *) 0)
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
77 # endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
78 #endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
79
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
80 /* Some platforms lack wchar_t. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
81 #if !@HAVE_WCHAR_T@
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
82 # define wchar_t int
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
83 #endif
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
84
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
85 # endif /* _@GUARD_PREFIX@_STDDEF_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
86 # endif /* _@GUARD_PREFIX@_STDDEF_H */
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
diff changeset
87 #endif /* __need_XXX */