Merge from vendor branch OPENPAM:
[dragonfly.git] / sys / sys / _posix.h
1 #ifndef _SYS__POSIX_H_
2 #define _SYS__POSIX_H_
3
4 /*-
5  * Copyright (c) 1998 HD Associates, Inc.
6  * All rights reserved.
7  * contact: dufault@hda.com
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $FreeBSD: src/sys/sys/_posix.h,v 1.6 1999/12/29 04:24:36 peter Exp $
31  * $DragonFly: src/sys/sys/_posix.h,v 1.2 2003/06/17 04:28:58 dillon Exp $
32  */
33
34 /*
35  * This is a stand alone header file to set up for feature specification
36  * defined to take place before the inclusion of any standard header.
37  * It should only handle pre-processor defines.
38  *
39  * See section B.2.7 of 1003.1b-1993 
40  *
41  */
42
43 #ifdef _KERNEL
44
45 #if !defined(KLD_MODULE)
46 #include "opt_posix.h"
47 #endif
48
49 /* Only kern_mib.c uses _POSIX_VERSION.  Introduce a kernel
50  * one to avoid other pieces of the kernel getting dependant
51  * on that.
52  * XXX Complain if you think this dumb.
53  */
54
55 /* Make P1003 structures visible for the kernel if
56  * the P1003_1B option is in effect.
57  */
58 #ifdef P1003_1B
59 #define _P1003_1B_VISIBLE
60 #ifndef _KPOSIX_VERSION
61 #define _KPOSIX_VERSION         199309L
62 #endif
63 #endif
64
65 #ifndef _KPOSIX_VERSION
66 #define _KPOSIX_VERSION         199009L
67 #endif
68
69 #define _P1003_1B_VISIBLE_HISTORICALLY
70
71 #else
72
73 /* Default to existing user space version.
74  */
75 #ifndef _POSIX_VERSION
76 #define _POSIX_VERSION          199009L
77 #endif
78
79 /* Test for visibility of P1003.1B features:
80  * If _POSIX_SOURCE and POSIX_C_SOURCE are completely undefined
81  * they show up.
82  *
83  * If they specify a version including P1003.1B then they show up.
84  *
85  * (Two macros are added to permit hiding new extensions while 
86  * keeping historic BSD features - that is not done now)
87  *
88  */
89
90 #if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
91  (_POSIX_VERSION  >= 199309L && defined(_POSIX_C_SOURCE) && \
92   _POSIX_C_SOURCE >= 199309L)
93 #define _P1003_1B_VISIBLE
94 #define _P1003_1B_VISIBLE_HISTORICALLY
95 #endif
96
97 #endif /* _KERNEL */
98 #endif /* _SYS__POSIX_H_ */