summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ctype.h18
-rw-r--r--include/dirent.h37
-rw-r--r--include/fnmatch.h8
-rw-r--r--include/glob.h18
-rw-r--r--include/grp.h22
-rw-r--r--include/limits.h28
-rw-r--r--include/math.h30
-rw-r--r--include/netdb.h19
-rw-r--r--include/pwd.h17
-rw-r--r--include/setjmp.h17
-rw-r--r--include/signal.h25
-rw-r--r--include/stdio.h87
-rw-r--r--include/stdlib.h123
-rw-r--r--include/string.h28
-rw-r--r--include/time.h32
-rw-r--r--include/unistd.h188
-rw-r--r--sys/arch/alpha/include/endian.h4
-rw-r--r--sys/arch/amd64/include/endian.h4
-rw-r--r--sys/arch/arm/include/endian.h6
-rw-r--r--sys/arch/hppa/include/endian.h4
-rw-r--r--sys/arch/hppa64/include/endian.h4
-rw-r--r--sys/arch/i386/include/endian.h4
-rw-r--r--sys/arch/m68k/include/endian.h4
-rw-r--r--sys/arch/m88k/include/endian.h4
-rw-r--r--sys/arch/mips64/include/endian.h8
-rw-r--r--sys/arch/powerpc/include/endian.h5
-rw-r--r--sys/arch/sparc/include/endian.h4
-rw-r--r--sys/arch/sparc64/include/endian.h4
-rw-r--r--sys/arch/vax/include/endian.h4
-rw-r--r--sys/netinet6/in6.h16
-rw-r--r--sys/sys/dirent.h19
-rw-r--r--sys/sys/endian.h92
-rw-r--r--sys/sys/errno.h39
-rw-r--r--sys/sys/fcntl.h23
-rw-r--r--sys/sys/limits.h11
-rw-r--r--sys/sys/midiio.h13
-rw-r--r--sys/sys/mount.h9
-rw-r--r--sys/sys/select.h12
-rw-r--r--sys/sys/sem.h9
-rw-r--r--sys/sys/shm.h13
-rw-r--r--sys/sys/siginfo.h8
-rw-r--r--sys/sys/signal.h24
-rw-r--r--sys/sys/stat.h29
-rw-r--r--sys/sys/sysctl.h3
-rw-r--r--sys/sys/syslimits.h13
-rw-r--r--sys/sys/termios.h76
-rw-r--r--sys/sys/time.h20
-rw-r--r--sys/sys/types.h20
-rw-r--r--sys/sys/uio.h6
-rw-r--r--sys/sys/unistd.h6
-rw-r--r--sys/sys/wait.h25
51 files changed, 693 insertions, 549 deletions
diff --git a/include/ctype.h b/include/ctype.h
index 25f551d9c09..c43774d6ef5 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctype.h,v 1.18 2005/08/08 05:53:00 espie Exp $ */
+/* $OpenBSD: ctype.h,v 1.19 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
@@ -39,6 +39,7 @@
#ifndef _CTYPE_H_
#define _CTYPE_H_
+
#include <sys/cdefs.h>
#define _U 0x01
@@ -78,13 +79,17 @@ int isxdigit(int);
int tolower(int);
int toupper(int);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
+ || __XPG_VISIBLE > 600
int isblank(int);
+#endif
+
+#if __BSD_VISIBLE || __XPG_VISIBLE
int isascii(int);
int toascii(int);
int _tolower(int);
int _toupper(int);
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
#endif /* __GNUC__ || _ANSI_LIBRARY || lint */
@@ -159,12 +164,15 @@ __CTYPE_INLINE int toupper(int c)
return ((_toupper_tab_ + 1)[c]);
}
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
+ || __XPG_VISIBLE > 600
__CTYPE_INLINE int isblank(int c)
{
return (c == ' ' || c == '\t');
}
+#endif
+#if __BSD_VISIBLE || __XPG_VISIBLE
__CTYPE_INLINE int isascii(int c)
{
return ((unsigned int)c <= 0177);
@@ -184,7 +192,7 @@ __CTYPE_INLINE int _toupper(int c)
{
return (c - 'a' + 'A');
}
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
#endif /* !_ANSI_LIBRARY && !lint */
diff --git a/include/dirent.h b/include/dirent.h
index e32e1f0cea4..05e5c83cd61 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirent.h,v 1.14 2005/06/18 18:09:42 millert Exp $ */
+/* $OpenBSD: dirent.h,v 1.15 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */
/*-
@@ -35,10 +35,12 @@
#ifndef _DIRENT_H_
#define _DIRENT_H_
+#include <sys/cdefs.h>
+
/*
* POSIX doesn't mandate this, but X/Open XPG 4.2 does.
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
#include <sys/types.h>
#endif
@@ -48,11 +50,11 @@
*/
#include <sys/dirent.h>
-#ifdef _POSIX_SOURCE
-typedef void * DIR;
-#else
-
+#if __BSD_VISIBLE || __XPG_VISIBLE
#define d_ino d_fileno /* backward compatibility */
+#endif
+
+#if __BSD_VISIBLE
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
@@ -80,31 +82,36 @@ typedef struct _dirdesc {
#define NULL __null
#else
#define NULL 0L
-#endif
-#endif
+#endif /* __GNUG__ */
+#endif /* !NULL */
-#endif /* _POSIX_SOURCE */
+#else /* !__BSD_VISIBLE */
-#ifndef _KERNEL
+typedef void * DIR;
-#include <sys/cdefs.h>
+#endif /* !__BSD_VISIBLE */
+#ifndef _KERNEL
__BEGIN_DECLS
DIR *opendir(const char *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
int closedir(DIR *);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
DIR *__opendir2(const char *, int);
-long telldir(const DIR *);
-void seekdir(DIR *, long);
int scandir(const char *, struct dirent ***,
int (*)(struct dirent *), int (*)(const void *, const void *));
int alphasort(const void *, const void *);
int getdirentries(int, char *, int, long *)
__attribute__ ((__bounded__(__string__,2,3)));
-#endif /* not POSIX */
+#endif /* __BSD_VISIBLE */
+#if __XPG_VISIBLE
+long telldir(const DIR *);
+void seekdir(DIR *, long);
+#endif
+#if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500
int readdir_r(DIR *, struct dirent *, struct dirent **);
+#endif
__END_DECLS
#endif /* !_KERNEL */
diff --git a/include/fnmatch.h b/include/fnmatch.h
index 8e4173c744a..4b27d06c3db 100644
--- a/include/fnmatch.h
+++ b/include/fnmatch.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fnmatch.h,v 1.7 2003/06/02 19:34:12 millert Exp $ */
+/* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
/*-
@@ -35,21 +35,21 @@
#ifndef _FNMATCH_H_
#define _FNMATCH_H_
+#include <sys/cdefs.h>
+
#define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOSYS 2 /* Function not supported (unused). */
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
#define FNM_IGNORECASE FNM_CASEFOLD
#define FNM_FILE_NAME FNM_PATHNAME
#endif
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
int fnmatch(const char *, const char *, int);
__END_DECLS
diff --git a/include/glob.h b/include/glob.h
index 5c9e7465405..fdd33bcb297 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.h,v 1.9 2004/10/07 16:56:11 millert Exp $ */
+/* $OpenBSD: glob.h,v 1.10 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp $ */
/*
@@ -62,7 +62,6 @@ typedef struct {
int (*gl_stat)(const char *, struct stat *);
} glob_t;
-/* Flags */
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
#define GLOB_ERR 0x0004 /* Return on error. */
@@ -71,7 +70,12 @@ typedef struct {
#define GLOB_NOSORT 0x0020 /* Don't sort. */
#define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
-#ifndef _POSIX_SOURCE
+#define GLOB_NOSPACE (-1) /* Malloc call failed. */
+#define GLOB_ABORTED (-2) /* Unignored error. */
+#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
+#define GLOB_NOSYS (-4) /* Function not supported. */
+
+#if __BSD_VISIBLE
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
@@ -79,15 +83,9 @@ typedef struct {
#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
#define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */
+#define GLOB_ABEND GLOB_ABORTED /* backward compatibility */
#endif
-/* Error values returned by glob(3) */
-#define GLOB_NOSPACE (-1) /* Malloc call failed. */
-#define GLOB_ABORTED (-2) /* Unignored error. */
-#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
-#define GLOB_NOSYS (-4) /* Function not supported. */
-#define GLOB_ABEND GLOB_ABORTED
-
__BEGIN_DECLS
int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree(glob_t *);
diff --git a/include/grp.h b/include/grp.h
index 5197d44cef9..f4012eb6582 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: grp.h,v 1.7 2003/06/25 21:06:33 deraadt Exp $ */
+/* $OpenBSD: grp.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */
/*-
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
#define _PATH_GROUP "/etc/group"
#endif
@@ -56,21 +56,21 @@ struct group {
__BEGIN_DECLS
struct group *getgrgid(gid_t);
-int getgrgid_r(gid_t, struct group *, char *,
- size_t, struct group **);
struct group *getgrnam(const char *);
-int getgrnam_r(const char *, struct group *, char *,
- size_t, struct group **);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
+int getgrgid_r(gid_t, struct group *, char *,
+ size_t, struct group **);
+int getgrnam_r(const char *, struct group *, char *,
+ size_t, struct group **);
+#endif
+#if __BSD_VISIBLE
void setgrfile(const char *);
-#ifndef _XOPEN_SOURCE
-char *group_from_gid(gid_t, int);
int setgroupent(int);
-#endif /* !_XOPEN_SOURCE */
-#endif /* !_POSIX_SOURCE */
+char *group_from_gid(gid_t, int);
+#endif
__END_DECLS
#endif /* !_GRP_H_ */
diff --git a/include/limits.h b/include/limits.h
index 5784cf192f3..938b64a4342 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.11 2004/06/09 17:32:10 millert Exp $ */
+/* $OpenBSD: limits.h,v 1.12 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */
/*
@@ -35,7 +35,9 @@
#ifndef _LIMITS_H_
#define _LIMITS_H_
-#if !defined(_ANSI_SOURCE)
+#include <sys/cdefs.h>
+
+#if __POSIX_VISIBLE
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 25
#define _POSIX_LINK_MAX 8
@@ -62,12 +64,17 @@
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX _POSIX_RE_DUP_MAX
-/* P1003.1c */
+#if __POSIX_VISIBLE >= 200112
#define _POSIX_TTY_NAME_MAX 260
#define _POSIX_LOGIN_NAME_MAX MAXLOGNAME
-#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
-#define PASS_MAX 128
+#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
+#define LOGIN_NAME_MAX MAXLOGNAME
+#endif
+#endif /* __POSIX_VISIBLE */
+
+#if __XPG_VISIBLE
+#define PASS_MAX 128 /* _PASSWORD_LEN from <pwd.h> */
#define NL_ARGMAX 9
#define NL_LANGMAX 14
@@ -77,15 +84,12 @@
#define NL_TEXTMAX 255
#define TMP_MAX 308915776
-#endif /* !_POSIX_C_SOURCE || _XOPEN_SOURCE */
-
-#endif /* !_ANSI_SOURCE */
-
-/* where does this belong? it is defined by P1003.1c */
-#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
-#define LOGIN_NAME_MAX MAXLOGNAME
+#endif /* __XPG_VISIBLE */
#include <sys/limits.h>
+
+#if __POSIX_VISIBLE
#include <sys/syslimits.h>
+#endif
#endif /* !_LIMITS_H_ */
diff --git a/include/math.h b/include/math.h
index 77d59695876..ac89992e5f3 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math.h,v 1.10 2005/11/17 20:07:40 otto Exp $ */
+/* $OpenBSD: math.h,v 1.11 2005/12/13 00:35:22 millert Exp $ */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -17,6 +17,8 @@
#ifndef _MATH_H_
#define _MATH_H_
+#include <sys/cdefs.h>
+
/*
* ANSI/POSIX
*/
@@ -36,7 +38,7 @@ typedef double double_t;
/*
* XOPEN/SVID
*/
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __XPG_VISIBLE
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
@@ -58,8 +60,9 @@ typedef double double_t;
#endif
extern int signgam;
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
-#if !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
#define _LIB_VERSION_TYPE enum fdversion
@@ -105,11 +108,8 @@ struct exception {
#define TLOSS 5
#define PLOSS 6
-#endif /* !_XOPEN_SOURCE */
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
-
-#include <sys/cdefs.h>
__BEGIN_DECLS
/*
* ANSI/POSIX
@@ -141,7 +141,7 @@ extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __XPG_VISIBLE
extern double erf(double);
extern double erfc(double);
extern double gamma(double);
@@ -157,7 +157,7 @@ extern double y0(double);
extern double y1(double);
extern double yn(int, double);
-#if !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 500
extern double acosh(double);
extern double asinh(double);
extern double atanh(double);
@@ -200,10 +200,10 @@ extern double log1p(double);
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
-#ifdef _REENTRANT
+#if __BSD_VISIBLE || defined(_REENTRANT)
extern double gamma_r(double, int *);
extern double lgamma_r(double, int *);
-#endif /* _REENTRANT */
+#endif /* __BSD_VISIBLE || _REENTRANT */
/* float versions of ANSI/POSIX functions */
@@ -289,13 +289,13 @@ extern float log1pf(float);
* signgam back by reference as the second argument; user must
* allocate space for signgam.
*/
-#ifdef _REENTRANT
+#if __BSD_VISIBLE || defined(_REENTRANT)
extern float gammaf_r(float, int *);
extern float lgammaf_r(float, int *);
-#endif /* _REENTRANT */
+#endif /* __BSD_VISIBLE || _REENTRANT */
-#endif /* !_XOPEN_SOURCE */
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 500 */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
__END_DECLS
#endif /* _MATH_H_ */
diff --git a/include/netdb.h b/include/netdb.h
index d8b4261c2a5..9e35bb5e5f3 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netdb.h,v 1.24 2005/06/08 18:32:32 millert Exp $ */
+/* $OpenBSD: netdb.h,v 1.25 2005/12/13 00:35:22 millert Exp $ */
/*
* ++Copyright++ 1980, 1983, 1988, 1993
@@ -88,9 +88,6 @@
#define _NETDB_H_
#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#endif
#include <sys/cdefs.h>
#define _PATH_HEQUIV "/etc/hosts.equiv"
@@ -236,7 +233,7 @@ struct rrsetinfo {
struct rdatainfo *rri_sigs; /* individual signatures */
};
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
struct servent_data {
void *fp;
char **aliases;
@@ -258,11 +255,11 @@ __BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endprotoent(void);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
void endprotoent_r(struct protoent_data *);
#endif
void endservent(void);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
void endservent_r(struct servent_data *);
#endif
struct hostent *gethostbyaddr(const void *, socklen_t, int);
@@ -275,7 +272,7 @@ struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
struct protoent *getprotobynumber(int);
struct protoent *getprotoent(void);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
int getprotobyname_r(const char *, struct protoent *,
struct protoent_data *);
int getprotobynumber_r(int, struct protoent *,
@@ -285,7 +282,7 @@ int getprotoent_r(struct protoent *, struct protoent_data *);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
int getservbyname_r(const char *, const char *, struct servent *,
struct servent_data *);
int getservbyport_r(int, const char *, struct servent *,
@@ -298,11 +295,11 @@ void sethostent(int);
/* void sethostfile(const char *); */
void setnetent(int);
void setprotoent(int);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
void setprotoent_r(int, struct protoent_data *);
#endif
void setservent(int);
-#ifndef POSIX_SOURCE
+#if __BSD_VISIBLE
void setservent_r(int, struct servent_data *);
#endif
diff --git a/include/pwd.h b/include/pwd.h
index 7d6003f8a02..4d3d649560d 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd.h,v 1.17 2004/07/13 21:09:47 millert Exp $ */
+/* $OpenBSD: pwd.h,v 1.18 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: pwd.h,v 1.9 1996/05/15 21:36:45 jtc Exp $ */
/*-
@@ -41,9 +41,10 @@
#ifndef _PWD_H_
#define _PWD_H_
+#include <sys/cdefs.h>
#include <sys/types.h>
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_MASTERPASSWD "/etc/master.passwd"
#define _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
@@ -89,14 +90,15 @@ struct passwd {
time_t pw_expire; /* account expiration */
};
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
struct passwd *getpwuid(uid_t);
struct passwd *getpwnam(const char *);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE || __XPG_VISIBLE
struct passwd *getpwent(void);
-#ifndef _XOPEN_SOURCE
+void setpwent(void);
+void endpwent(void);
+#endif
+#if __BSD_VISIBLE
int setpassent(int);
char *user_from_uid(uid_t, int);
char *bcrypt_gensalt(u_int8_t);
@@ -104,9 +106,6 @@ char *bcrypt(const char *, const char *);
char *md5crypt(const char *, const char *);
struct passwd *pw_dup(const struct passwd *);
#endif
-void setpwent(void);
-void endpwent(void);
-#endif
__END_DECLS
#endif /* !_PWD_H_ */
diff --git a/include/setjmp.h b/include/setjmp.h
index ef02e9083e0..28bce8a7830 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: setjmp.h,v 1.4 2003/06/02 19:34:12 millert Exp $ */
+/* $OpenBSD: setjmp.h,v 1.5 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: setjmp.h,v 1.11 1994/12/20 10:35:44 cgd Exp $ */
/*-
@@ -40,30 +40,29 @@
#ifndef _SETJMP_H_
#define _SETJMP_H_
+#include <sys/cdefs.h>
#include <machine/setjmp.h>
-#ifndef _ANSI_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
typedef long sigjmp_buf[_JBLEN + 1];
-#endif /* not ANSI */
+#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
typedef long jmp_buf[_JBLEN];
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
int setjmp(jmp_buf);
void longjmp(jmp_buf, int);
-#ifndef _ANSI_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
int sigsetjmp(sigjmp_buf, int);
void siglongjmp(sigjmp_buf, int);
-#endif /* not ANSI */
+#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __XPG_VISIBLE
int _setjmp(jmp_buf);
void _longjmp(jmp_buf, int);
void longjmperror(void);
-#endif /* neither ANSI nor POSIX */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
__END_DECLS
#endif /* !_SETJMP_H_ */
diff --git a/include/signal.h b/include/signal.h
index fd50069fda9..807afb501e2 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.8 2004/05/03 17:25:00 millert Exp $ */
+/* $OpenBSD: signal.h,v 1.9 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */
/*-
@@ -35,20 +35,21 @@
#ifndef _USER_SIGNAL_H
#define _USER_SIGNAL_H
+#include <sys/cdefs.h>
#include <sys/signal.h>
-#if !defined(_ANSI_SOURCE)
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#include <sys/types.h>
#endif
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE
extern __const char *__const sys_signame[_NSIG];
extern __const char *__const sys_siglist[_NSIG];
#endif
__BEGIN_DECLS
int raise(int);
-#ifndef _ANSI_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
void (*bsd_signal(int, void (*)(int)))(int);
int kill(pid_t, int);
int sigaction(int, const struct sigaction *, struct sigaction *);
@@ -99,20 +100,24 @@ extern __inline int sigismember(const sigset_t *set, int signo) {
#define sigemptyset(set) (*(set) = 0, 0)
#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
int killpg(pid_t, int);
-int sigblock(int);
int siginterrupt(int, int);
int sigpause(int);
int sigreturn(struct sigcontext *);
-int sigsetmask(int);
int sigstack(const struct sigstack *, struct sigstack *);
int sigaltstack(const struct sigaltstack *, struct sigaltstack *);
-int sigvec(int, struct sigvec *, struct sigvec *);
+#if __BSD_VISIBLE
void psignal(unsigned int, const char *);
+int sigblock(int);
+int sigsetmask(int);
+int sigvec(int, struct sigvec *, struct sigvec *);
+#endif
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
int sigwait(const sigset_t *, int *);
-#endif /* !_POSIX_SOURCE */
-#endif /* !_ANSI_SOURCE */
+#endif
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
+#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
__END_DECLS
#endif /* !_USER_SIGNAL_H */
diff --git a/include/stdio.h b/include/stdio.h
index 8329e00d298..26d2f40cd04 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdio.h,v 1.32 2005/05/11 18:39:19 espie Exp $ */
+/* $OpenBSD: stdio.h,v 1.33 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */
/*-
@@ -38,11 +38,12 @@
#ifndef _STDIO_H_
#define _STDIO_H_
-#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)
+#include <sys/cdefs.h>
+
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#include <sys/types.h>
#endif
-#include <sys/cdefs.h>
#include <machine/ansi.h>
#ifdef _BSD_SIZE_T_
@@ -184,7 +185,7 @@ __END_DECLS
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
-#ifndef _ANSI_SOURCE
+#if __BSD_VISIBLE || __XPG_VISIBLE
#define P_tmpdir "/tmp/"
#endif
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
@@ -235,7 +236,7 @@ size_t fwrite(const void *, size_t, size_t, FILE *)
int getc(FILE *);
int getchar(void);
char *gets(char *);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__SYS_ERRLIST)
+#if __BSD_VISIBLE && !defined(__SYS_ERRLIST)
#define __SYS_ERRLIST
extern int sys_nerr; /* perror(3) external variables */
@@ -260,12 +261,34 @@ int ungetc(int, FILE *);
int vfprintf(FILE *, const char *, _BSD_VA_LIST_);
int vprintf(const char *, _BSD_VA_LIST_);
int vsprintf(char *, const char *, _BSD_VA_LIST_);
+
+#if __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE
+int snprintf(char *, size_t, const char *, ...)
+ __attribute__((__format__ (printf, 3, 4)))
+ __attribute__((__nonnull__ (3)))
+ __attribute__((__bounded__ (__string__,1,2)));
+int vfscanf(FILE *, const char *, _BSD_VA_LIST_)
+ __attribute__((__format__ (scanf, 2, 0)))
+ __attribute__((__nonnull__ (2)));
+int vscanf(const char *, _BSD_VA_LIST_)
+ __attribute__((__format__ (scanf, 1, 0)))
+ __attribute__((__nonnull__ (1)));
+int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_)
+ __attribute__((__format__ (printf, 3, 0)))
+ __attribute__((__nonnull__ (3)))
+ __attribute__((__bounded__(__string__,1,2)));
+int vsscanf(const char *, const char *, _BSD_VA_LIST_)
+ __attribute__((__format__ (scanf, 2, 0)))
+ __attribute__((__nonnull__ (2)));
+#endif /* __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE */
+
__END_DECLS
+
/*
* Functions defined in POSIX 1003.1.
*/
-#ifndef _ANSI_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */
@@ -275,13 +298,30 @@ char *ctermid_r(char *);
char *cuserid(char *);
FILE *fdopen(int, const char *);
int fileno(FILE *);
+
+#if __POSIX_VISIBLE >= 199209
+int pclose(FILE *);
+FILE *popen(const char *, const char *);
+#endif
+
+#if __POSIX_VISIBLE >= 199506
void flockfile(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
+
+/*
+ * These are normally used through macros as defined below, but POSIX
+ * requires functions as well.
+ */
int getc_unlocked(FILE *);
-int putc_unlocked(int, FILE *);
int getchar_unlocked(void);
+int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
+#endif /* __POSIX_VISIBLE >= 199506 */
+
+#if __XPG_VISIBLE
+char *tempnam(const char *, const char *);
+#endif
__END_DECLS
#ifndef _POSIX_THREADS
@@ -290,13 +330,12 @@ __END_DECLS
# define funlockfile(fp) /* nothing */
#endif
-
-#endif /* not ANSI */
+#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
/*
* Routines that are purely local.
*/
-#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE
__BEGIN_DECLS
int asprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))
@@ -304,32 +343,12 @@ int asprintf(char **, const char *, ...)
char *fgetln(FILE *, size_t *);
int fpurge(FILE *);
int getw(FILE *);
-int pclose(FILE *);
-FILE *popen(const char *, const char *);
int putw(int, FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
-char *tempnam(const char *, const char *);
-int snprintf(char *, size_t, const char *, ...)
- __attribute__((__format__ (printf, 3, 4)))
- __attribute__((__nonnull__ (3)))
- __attribute__((__bounded__ (__string__,1,2)));
int vasprintf(char **, const char *, _BSD_VA_LIST_)
__attribute__((__format__ (printf, 2, 0)))
__attribute__((__nonnull__ (2)));
-int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_)
- __attribute__((__format__ (printf, 3, 0)))
- __attribute__((__nonnull__ (3)))
- __attribute__((__bounded__(__string__,1,2)));
-int vscanf(const char *, _BSD_VA_LIST_)
- __attribute__((__format__ (scanf, 1, 0)))
- __attribute__((__nonnull__ (1)));
-int vsscanf(const char *, const char *, _BSD_VA_LIST_)
- __attribute__((__format__ (scanf, 2, 0)))
- __attribute__((__nonnull__ (2)));
-int vfscanf(FILE *, const char *, _BSD_VA_LIST_)
- __attribute__((__format__ (scanf, 2, 0)))
- __attribute__((__nonnull__ (2)));
__END_DECLS
/*
@@ -344,7 +363,7 @@ FILE *funopen(const void *,
__END_DECLS
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
/*
* Functions internal to the implementation.
@@ -392,7 +411,7 @@ static __inline int __sputc(int _c, FILE *_p) {
#define clearerr(p) __sclearerr(p)
#endif
-#ifndef _ANSI_SOURCE
+#if __POSIX_VISIBLE
#define fileno(p) __sfileno(p)
#endif
@@ -405,12 +424,12 @@ static __inline int __sputc(int _c, FILE *_p) {
* The macro implementations of putc and putc_unlocked are not
* fully POSIX compliant; they do not set errno on failure
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#ifndef _POSIX_THREADS
#define putc(x, fp) __sputc(x, fp)
#endif /* _POSIX_THREADS */
#define putc_unlocked(x, fp) __sputc(x, fp)
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#endif /* lint */
#define getchar() getc(stdin)
diff --git a/include/stdlib.h b/include/stdlib.h
index 244764cc99e..ea714e429a7 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdlib.h,v 1.34 2005/05/27 17:45:56 millert Exp $ */
+/* $OpenBSD: stdlib.h,v 1.35 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
/*-
@@ -36,7 +36,8 @@
#define _STDLIB_H_
#include <machine/ansi.h>
-#if !defined(_ANSI_SOURCE) /* for quad_t, etc. */
+#include <sys/cdefs.h>
+#if __BSD_VISIBLE /* for quad_t, etc. */
#include <sys/types.h>
#endif
@@ -63,7 +64,7 @@ typedef struct {
long rem; /* remainder */
} ldiv_t;
-#if !defined(_ANSI_SOURCE)
+#if __BSD_VISIBLE
typedef struct {
quad_t quot; /* quotient */
quad_t rem; /* remainder */
@@ -105,7 +106,6 @@ int atexit(void (*)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
-long long atoll(const char *);
void *bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *));
void *calloc(size_t, size_t);
@@ -119,28 +119,15 @@ char *gcvt(double, int, char *);
char *getenv(const char *);
long labs(long);
ldiv_t ldiv(long, long);
-long long
- llabs(long long);
void *malloc(size_t);
-char *mkdtemp(char *);
-int mkstemp(char *);
-int mkstemps(char *, int);
-char *mktemp(char *);
void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
int rand(void);
-int rand_r(unsigned int *);
void *realloc(void *, size_t);
void srand(unsigned);
double strtod(const char *, char **);
long strtol(const char *, char **, int);
-long long
- strtoll(const char *, char **, int);
-long long
- strtonum(const char *, long long, long long, const char **);
unsigned long
strtoul(const char *, char **, int);
-unsigned long long
- strtoull(const char *, char **, int);
int system(const char *);
/* these are currently just stubs */
@@ -150,7 +137,73 @@ int wctomb(char *, wchar_t);
int mbtowc(wchar_t *, const char *, size_t);
size_t wcstombs(char *, const wchar_t *, size_t);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500 || \
+ defined(_REENTRANT)
+int rand_r(unsigned int *);
+#endif
+
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 400
+double drand48(void);
+double erand48(unsigned short[3]);
+long jrand48(unsigned short[3]);
+void lcong48(unsigned short[7]);
+long lrand48(void);
+long mrand48(void);
+long nrand48(unsigned short[3]);
+unsigned short *seed48(unsigned short[3]);
+void srand48(long);
+
+int putenv(const char *);
+#endif
+
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
+long a64l(const char *);
+char *l64a(long);
+
+char *initstate(unsigned int, char *, size_t)
+ __attribute__((__bounded__ (__string__,2,3)));
+long random(void);
+char *setstate(const char *);
+void srandom(unsigned int);
+
+int mkstemp(char *);
+char *mktemp(char *);
+
+char *realpath(const char *, char *);
+
+int setkey(const char *);
+
+int ttyslot(void);
+
+void *valloc(size_t); /* obsoleted by malloc() */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
+
+/*
+ * ISO C99
+ */
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
+long long
+ atoll(const char *);
+long long
+ llabs(long long);
+long long
+ strtoll(const char *, char **, int);
+unsigned long long
+ strtoull(const char *, char **, int);
+#endif
+
+/*
+ * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 600
+int setenv(const char *, const char *, int);
+void unsetenv(const char *);
+#endif
+
+#if __BSD_VISIBLE
#if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2)
void *alloca(int); /* built-in for gcc */
#else
@@ -174,23 +227,20 @@ int daemon(int, int);
char *devname(int, int);
int getloadavg(double [], int);
-long a64l(const char *);
-char *l64a(long);
-
void cfree(void *);
#ifndef _GETOPT_DEFINED_
#define _GETOPT_DEFINED_
int getopt(int, char * const *, const char *);
extern char *optarg; /* getopt(3) external variables */
-extern int opterr;
-extern int optind;
-extern int optopt;
-extern int optreset;
+extern int opterr, optind, optopt, optreset;
int getsubopt(char **, char * const *, char **);
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* _GETOPT_DEFINED_ */
+char *mkdtemp(char *);
+int mkstemps(char *, int);
+
int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
int radixsort(const unsigned char **, int, const unsigned char *,
@@ -198,17 +248,10 @@ int radixsort(const unsigned char **, int, const unsigned char *,
int sradixsort(const unsigned char **, int, const unsigned char *,
unsigned);
-char *initstate(unsigned int, char *, size_t)
- __attribute__((__bounded__ (__string__,2,3)));
-long random(void);
-char *realpath(const char *, char *);
-char *setstate(const char *);
-void srandom(unsigned int);
void srandomdev(void);
+long long
+ strtonum(const char *, long long, long long, const char **);
-int putenv(const char *);
-int setenv(const char *, const char *, int);
-void unsetenv(const char *);
void setproctitle(const char *, ...)
__attribute__((__format__ (__printf__, 1, 2)));
@@ -217,21 +260,11 @@ qdiv_t qdiv(quad_t, quad_t);
quad_t strtoq(const char *, char **, int);
u_quad_t strtouq(const char *, char **, int);
-double drand48(void);
-double erand48(unsigned short[3]);
-long jrand48(unsigned short[3]);
-void lcong48(unsigned short[7]);
-long lrand48(void);
-long mrand48(void);
-long nrand48(unsigned short[3]);
-unsigned short *seed48(unsigned short[3]);
-void srand48(long);
-
u_int32_t arc4random(void);
void arc4random_stir(void);
void arc4random_addrandom(unsigned char *, int)
__attribute__((__bounded__ (__string__,1,2)));
-#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
__END_DECLS
diff --git a/include/string.h b/include/string.h
index 745be2d62c0..7a3c533702b 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: string.h,v 1.15 2005/03/30 03:04:16 deraadt Exp $ */
+/* $OpenBSD: string.h,v 1.16 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */
/*-
@@ -34,6 +34,8 @@
#ifndef _STRING_H_
#define _STRING_H_
+
+#include <sys/cdefs.h>
#include <machine/ansi.h>
#ifdef _BSD_SIZE_T_
@@ -49,8 +51,6 @@ typedef _BSD_SIZE_T_ size_t;
#endif
#endif
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
void *memchr(const void *, int, size_t);
int memcmp(const void *, const void *, size_t);
@@ -69,8 +69,6 @@ int strcoll(const char *, const char *);
char *strcpy(char *, const char *);
size_t strcspn(const char *, const char *);
char *strerror(int);
-int strerror_r(int, char *, size_t)
- __attribute__ ((__bounded__(__string__,2,3)));
size_t strlen(const char *);
char *strncat(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3)));
@@ -86,8 +84,12 @@ char *strtok_r(char *, const char *, char **);
size_t strxfrm(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3)));
-/* Nonstandard routines */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE || __XPG_VISIBLE
+void *memccpy(void *, const void *, int, size_t)
+ __attribute__ ((__bounded__(__buffer__,1,4)));
+#endif
+
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t)
__attribute__ ((__bounded__(__buffer__,1,3)))
@@ -96,18 +98,24 @@ void bzero(void *, size_t)
__attribute__ ((__bounded__(__buffer__,1,2)));
int ffs(int);
char *index(const char *, int);
-void *memccpy(void *, const void *, int, size_t)
- __attribute__ ((__bounded__(__buffer__,1,4)));
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, size_t);
char *strdup(const char *);
+#endif
+
+#if __BSD_VISIBLE || __XPG_VISIBLE >= 600
+int strerror_r(int, char *, size_t)
+ __attribute__ ((__bounded__(__string__,2,3)));
+#endif
+
+#if __BSD_VISIBLE
char *strcasestr(const char *, const char *);
size_t strlcat(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3)));
size_t strlcpy(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3)));
void strmode(int, char *);
-int strncasecmp(const char *, const char *, size_t);
char *strsep(char **, const char *);
char *strsignal(int);
#endif
diff --git a/include/time.h b/include/time.h
index 1e4e933c1f5..41ebba4a73a 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.h,v 1.16 2003/08/01 17:38:33 avsm Exp $ */
+/* $OpenBSD: time.h,v 1.17 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
/*
@@ -41,6 +41,7 @@
#ifndef _TIME_H_
#define _TIME_H_
+#include <sys/cdefs.h>
#include <machine/ansi.h>
#ifndef NULL
@@ -66,7 +67,23 @@ typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
-#define CLOCKS_PER_SEC 100
+#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
+/*
+ * Frequency of the clock ticks reported by times(). Deprecated - use
+ * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
+ */
+#define CLK_TCK 100
+#endif
+
+#define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */
+
+#ifndef _TIMESPEC_DECLARED
+#define _TIMESPEC_DECLARED
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+#endif
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
@@ -82,8 +99,6 @@ struct tm {
char *tm_zone; /* timezone abbreviation */
};
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
struct timespec;
char *asctime(const struct tm *);
@@ -105,19 +120,18 @@ struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
int nanosleep(const struct timespec *, struct timespec *);
-#if !defined(_ANSI_SOURCE)
-#define CLK_TCK 100
+#if __POSIX_VISIBLE
extern char *tzname[2];
void tzset(void);
-#endif /* not ANSI */
+#endif
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE
char *timezone(int, int);
void tzsetwall(void);
time_t timelocal(struct tm *);
time_t timegm(struct tm *);
time_t timeoff(struct tm *, const long);
-#endif /* neither ANSI nor POSIX */
+#endif
__END_DECLS
#endif /* !_TIME_H_ */
diff --git a/include/unistd.h b/include/unistd.h
index 8bca390bb48..0c732d11405 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unistd.h,v 1.56 2005/11/24 02:09:13 deraadt Exp $ */
+/* $OpenBSD: unistd.h,v 1.57 2005/12/13 00:35:22 millert Exp $ */
/* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */
/*-
@@ -43,6 +43,13 @@
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
+#if __XPG_VISIBLE || __POSIX_VISIBLE >= 200112
+#define F_ULOCK 0 /* unlock locked section */
+#define F_LOCK 1 /* lock a section for exclusive use */
+#define F_TLOCK 2 /* test and lock a section for exclusive use */
+#define F_TEST 3 /* test a section for locks by other procs */
+#endif
+
#ifndef NULL
#ifdef __GNUG__
#define NULL __null
@@ -58,9 +65,6 @@ unsigned int alarm(unsigned int);
int chdir(const char *);
int chown(const char *, uid_t, gid_t);
int close(int);
-size_t confstr(int, char *, size_t)
- __attribute__((__bounded__(__string__,2,3)));
-char *cuserid(char *);
int dup(int);
int dup2(int, int);
int execl(const char *, const char *, ...)
@@ -82,14 +86,9 @@ uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t *);
char *getlogin(void);
-int getlogin_r(char *, size_t)
- __attribute__((__bounded__(__string__,1,2)))
- __attribute__((__bounded__(__minbytes__,1,32)));
pid_t getpgrp(void);
pid_t getpid(void);
-pid_t getpgid(pid_t);
pid_t getppid(void);
-pid_t getsid(pid_t);
uid_t getuid(void);
int isatty(int);
int link(const char *, const char *);
@@ -101,76 +100,129 @@ ssize_t read(int, void *, size_t)
__attribute__((__bounded__(__buffer__,2,3)));
int rmdir(const char *);
int setgid(gid_t);
-int setpgid(pid_t, pid_t);
-pid_t setsid(void);
int setuid(uid_t);
unsigned int sleep(unsigned int);
long sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
char *ttyname(int);
-int ttyname_r(int, char *, size_t)
- __attribute__((__bounded__(__string__,2,3)));
int unlink(const char *);
ssize_t write(int, const void *, size_t)
__attribute__((__bounded__(__buffer__,2,3)));
-#ifndef _POSIX_SOURCE
+#if __POSIX_VISIBLE || __XPG_VISIBLE >= 300
+pid_t setsid(void);
+int setpgid(pid_t, pid_t);
+#endif
-/* structure timeval required for select() */
-#include <sys/time.h>
+#if __POSIX_VISIBLE >= 199209 || __XPG_VISIBLE
+size_t confstr(int, char *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
+#ifndef _GETOPT_DEFINED_
+#define _GETOPT_DEFINED_
+int getopt(int, char * const *, const char *);
+extern char *optarg; /* getopt(3) external variables */
+extern int opterr, optind, optopt, optreset;
+/* XXX - getsubopt does not belong here */
+int getsubopt(char **, char * const *, char **);
+extern char *suboptarg; /* getsubopt(3) external variable */
+#endif /* _GETOPT_DEFINED_ */
+#endif
-/*
- * X/Open CAE Specification Issue 5 Version 2
- */
-#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
- (_XOPEN_VERSION - 0) >= 500
+#if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE
+int fsync(int);
+int ftruncate(int, off_t);
+int getlogin_r(char *, size_t)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,1,32)));
+#endif
+
+#if __XPG_VISIBLE || __BSD_VISIBLE
+char *crypt(const char *, const char *);
+int encrypt(char *, int);
+int fchdir(int);
+int fchown(int, uid_t, gid_t);
+long gethostid(void);
+char *getwd(char *)
+ __attribute__ ((__bounded__(__minbytes__,1,1024)));
+int lchown(const char *, uid_t, gid_t);
+int mkstemp(char *);
+char *mktemp(char *);
+int nice(int);
+int readlink(const char *, char *, size_t)
+ __attribute__ ((__bounded__(__string__,2,3)));
+int setkey(const char *);
+int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
+int setregid(gid_t, gid_t);
+int setreuid(uid_t, uid_t);
+void swab(const void *, void *, size_t);
+void sync(void);
+int truncate(const char *, off_t);
+unsigned int ualarm(unsigned int, unsigned int);
+int usleep(useconds_t);
+pid_t vfork(void);
+#endif
+
+#if __XPG_VISIBLE >= 420
+pid_t getpgid(pid_t);
+pid_t getsid(pid_t);
+#endif
+
+#if __XPG_VISIBLE >= 500
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
+int ttyname_r(int, char *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
#endif
-int acct(const char *);
-void *brk(void *);
+#if __BSD_VISIBLE || __XPG_VISIBLE <= 500
+/* Interfaces withdrawn by X/Open Issue 5 Version 0 */
+void *brk(void *);
int chroot(const char *);
-#if !defined(_XOPEN_SOURCE)
-int closefrom(int);
+int getdtablesize(void);
+int getpagesize(void);
+char *getpass(const char *);
+void *sbrk(int);
#endif
-char *crypt(const char *, const char *);
+
+#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420
+int lockf(int, int, off_t);
+#endif
+
+#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 || __BSD_VISIBLE
+int symlink(const char *, const char *);
+int gethostname(char *, size_t)
+ __attribute__ ((__bounded__(__string__,1,2)));
+int setegid(gid_t);
+int seteuid(uid_t);
+#endif
+
+#if __BSD_VISIBLE
+int acct(const char *);
+int closefrom(int);
int des_cipher(const char *, char *, int32_t, int);
int des_setkey(const char *key);
-int encrypt(char *, int);
void endusershell(void);
int exect(const char *, char * const *, char * const *);
-int fchdir(int);
-int fchown(int, uid_t, gid_t);
char *fflagstostr(u_int32_t);
-int fsync(int);
-int ftruncate(int, off_t);
int getdomainname(char *, size_t)
__attribute__ ((__bounded__(__string__,1,2)));
-int getdtablesize(void);
int getgrouplist(const char *, gid_t, gid_t *, int *);
-long gethostid(void);
-int gethostname(char *, size_t)
- __attribute__ ((__bounded__(__string__,1,2)));
mode_t getmode(const void *, mode_t);
-int getpagesize(void);
int getresgid(gid_t *, gid_t *, gid_t *);
int getresuid(uid_t *, uid_t *, uid_t *);
-char *getpass(const char *);
char *getusershell(void);
-char *getwd(char *)
- __attribute__ ((__bounded__(__minbytes__,1,1024)));
int initgroups(const char *, gid_t);
int iruserok(u_int32_t, int, const char *, const char *);
int iruserok_sa(const void *, int, int, const char *, const char *);
-int lchown(const char *, uid_t, gid_t);
+int issetugid(void);
+char *mkdtemp(char *);
+int mkstemps(char *, int);
int nfssvc(int, void *);
-int nice(int);
void psignal(unsigned int, const char *);
-extern __const char *__const sys_siglist[];
int profil(char *, size_t, unsigned long, unsigned int)
__attribute__ ((__bounded__(__string__,1,2)));
+int quotactl(const char *, int, int, char *);
int rcmd(char **, int, const char *,
const char *, const char *, int *);
int rcmd_af(char **, int, const char *,
@@ -179,75 +231,33 @@ int rcmdsh(char **, int, const char *,
const char *, const char *, char *);
char *re_comp(const char *);
int re_exec(const char *);
-int readlink(const char *, char *, size_t)
- __attribute__ ((__bounded__(__string__,2,3)));
int reboot(int);
int revoke(const char *);
int rfork(int opts);
int rresvport(int *);
int rresvport_af(int *, int);
int ruserok(const char *, int, const char *, const char *);
-int quotactl(const char *, int, int, char *);
-void *sbrk(int);
-
-#if !defined(_XOPEN_SOURCE) && !defined(_SELECT_DEFINED_)
-#define _SELECT_DEFINED_
+#ifndef _SELECT_DEFINED_
+#define _SELECT_DECLARED
+struct timeval;
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
-
int setdomainname(const char *, size_t);
-int setegid(gid_t);
-int seteuid(uid_t);
int setgroups(int, const gid_t *);
int sethostid(long);
int sethostname(const char *, size_t);
-int setkey(const char *);
int setlogin(const char *);
void *setmode(const char *);
-int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
-int setregid(gid_t, gid_t);
int setresgid(gid_t, gid_t, gid_t);
int setresuid(uid_t, uid_t, uid_t);
-int setreuid(uid_t, uid_t);
int setrgid(gid_t);
int setruid(uid_t);
void setusershell(void);
int strtofflags(char **, u_int32_t *, u_int32_t *);
-void swab(const void *, void *, size_t);
int swapctl(int cmd, const void *arg, int misc);
-int symlink(const char *, const char *);
-void sync(void);
int syscall(int, ...);
-int truncate(const char *, off_t);
-int ttyslot(void);
-unsigned int ualarm(unsigned int, unsigned int);
-int usleep(useconds_t);
-void *valloc(size_t); /* obsoleted by malloc() */
-pid_t vfork(void);
-int issetugid(void);
-
-#ifndef _GETOPT_DEFINED_
-#define _GETOPT_DEFINED_
-int getopt(int, char * const *, const char *);
-extern char *optarg; /* getopt(3) external variables */
-extern int opterr;
-extern int optind;
-extern int optopt;
-extern int optreset;
-int getsubopt(char **, char * const *, char **);
-extern char *suboptarg; /* getsubopt(3) external variable */
-#endif /* _GETOPT_DEFINED_ */
-#endif /* !_POSIX_SOURCE */
-
-#if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
- !defined(_XOPEN_SOURCE)) || \
- (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
-#define F_ULOCK 0
-#define F_LOCK 1
-#define F_TLOCK 2
-#define F_TEST 3
-int lockf(int, int, off_t);
-#endif /* (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || ... */
+extern __const char *__const sys_siglist[]; /* XXX - also in signal.h */
+#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_UNISTD_H_ */
diff --git a/sys/arch/alpha/include/endian.h b/sys/arch/alpha/include/endian.h
index c0cf7b8d91e..49b4f4dcdd3 100644
--- a/sys/arch/alpha/include/endian.h
+++ b/sys/arch/alpha/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.11 2003/06/03 21:09:01 deraadt Exp $ */
+/* $OpenBSD: endian.h,v 1.12 2005/12/13 00:35:22 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -27,7 +27,7 @@
#ifndef _ALPHA_ENDIAN_H_
#define _ALPHA_ENDIAN_H_
-#define BYTE_ORDER LITTLE_ENDIAN
+#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/amd64/include/endian.h b/sys/arch/amd64/include/endian.h
index 9e2734b8b7c..7cdd9bfb1e6 100644
--- a/sys/arch/amd64/include/endian.h
+++ b/sys/arch/amd64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.2 2005/12/12 13:19:15 jsg Exp $ */
+/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:22 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -56,7 +56,7 @@
#endif /* __GNUC__ */
-#define BYTE_ORDER LITTLE_ENDIAN
+#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sys/endian.h>
#endif /* _I386_ENDIAN_H_ */
diff --git a/sys/arch/arm/include/endian.h b/sys/arch/arm/include/endian.h
index 8c4ab24c701..75f93114cc3 100644
--- a/sys/arch/arm/include/endian.h
+++ b/sys/arch/arm/include/endian.h
@@ -1,9 +1,9 @@
-/* $OpenBSD: endian.h,v 1.2 2005/01/20 15:04:54 drahn Exp $ */
+/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */
#ifdef __ARMEB__
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#else
-#define BYTE_ORDER LITTLE_ENDIAN
+#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#define __STRICT_ALIGNMENT
#include <sys/endian.h>
diff --git a/sys/arch/hppa/include/endian.h b/sys/arch/hppa/include/endian.h
index 110a0d02a75..c374e90f092 100644
--- a/sys/arch/hppa/include/endian.h
+++ b/sys/arch/hppa/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.9 2004/06/28 14:37:54 mickey Exp $ */
+/* $OpenBSD: endian.h,v 1.10 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -29,7 +29,7 @@
#ifndef _HPPA_ENDIAN_H_
#define _HPPA_ENDIAN_H_
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/hppa64/include/endian.h b/sys/arch/hppa64/include/endian.h
index 3138bcc84d8..06909204a77 100644
--- a/sys/arch/hppa64/include/endian.h
+++ b/sys/arch/hppa64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
+/* $OpenBSD: endian.h,v 1.2 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -20,7 +20,7 @@
#ifndef _HPPA64_ENDIAN_H_
#define _HPPA64_ENDIAN_H_
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/i386/include/endian.h b/sys/arch/i386/include/endian.h
index b1993b41e5a..ad37919f31c 100644
--- a/sys/arch/i386/include/endian.h
+++ b/sys/arch/i386/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.13 2003/06/03 20:31:07 deraadt Exp $ */
+/* $OpenBSD: endian.h,v 1.14 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -64,7 +64,7 @@
#endif /* __GNUC__ */
-#define BYTE_ORDER LITTLE_ENDIAN
+#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sys/endian.h>
#endif /* _I386_ENDIAN_H_ */
diff --git a/sys/arch/m68k/include/endian.h b/sys/arch/m68k/include/endian.h
index 92457f57523..e341404cf14 100644
--- a/sys/arch/m68k/include/endian.h
+++ b/sys/arch/m68k/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.14 2004/10/16 14:26:01 miod Exp $ */
+/* $OpenBSD: endian.h,v 1.15 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -52,7 +52,7 @@
#endif /* __GNUC__ */
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#endif /* _M68K_ENDIAN_H_ */
diff --git a/sys/arch/m88k/include/endian.h b/sys/arch/m88k/include/endian.h
index 3e430e883e6..dd5d886e685 100644
--- a/sys/arch/m88k/include/endian.h
+++ b/sys/arch/m88k/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.2 2005/09/06 19:28:22 miod Exp $ */
+/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -27,7 +27,7 @@
#ifndef __M88K_ENDIAN_H__
#define __M88K_ENDIAN_H__
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/mips64/include/endian.h b/sys/arch/mips64/include/endian.h
index adefa87f000..45269edc520 100644
--- a/sys/arch/mips64/include/endian.h
+++ b/sys/arch/mips64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.3 2004/08/10 21:10:56 pefo Exp $ */
+/* $OpenBSD: endian.h,v 1.4 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -30,13 +30,13 @@
#define _MIPS64_ENDIAN_H_
#if defined(__MIPSEL__)
-#define BYTE_ORDER 1234 /* Little endian */
+#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#if defined(__MIPSEB__)
-#define BYTE_ORDER 4321 /* Big endian */
+#define _BYTE_ORDER _BIG_ENDIAN
#endif
-#if !defined(BYTE_ORDER) && !defined(lint)
+#if !defined(_BYTE_ORDER) && !defined(lint)
#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
#endif
diff --git a/sys/arch/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h
index 28a0ca68314..5438566fb76 100644
--- a/sys/arch/powerpc/include/endian.h
+++ b/sys/arch/powerpc/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.12 2003/06/03 21:09:02 deraadt Exp $ */
+/* $OpenBSD: endian.h,v 1.13 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -27,7 +27,8 @@
#ifndef _POWERPC_ENDIAN_H_
#define _POWERPC_ENDIAN_H_
-#define BYTE_ORDER BIG_ENDIAN
+#undef _BYTE_ORDER /* XXX - gcc may define _BYTE_ORDER too */
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/sparc/include/endian.h b/sys/arch/sparc/include/endian.h
index b4f7f11ec46..82f6ad18685 100644
--- a/sys/arch/sparc/include/endian.h
+++ b/sys/arch/sparc/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.11 2003/06/03 21:09:02 deraadt Exp $ */
+/* $OpenBSD: endian.h,v 1.12 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -27,7 +27,7 @@
#ifndef _SPARC_ENDIAN_H_
#define _SPARC_ENDIAN_H_
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/sparc64/include/endian.h b/sys/arch/sparc64/include/endian.h
index 128d8fc1d15..1dfdb42972d 100644
--- a/sys/arch/sparc64/include/endian.h
+++ b/sys/arch/sparc64/include/endian.h
@@ -1,9 +1,9 @@
-/* $OpenBSD: endian.h,v 1.1.1.1 2001/08/18 04:16:40 jason Exp $ */
+/* $OpenBSD: endian.h,v 1.2 2005/12/13 00:35:23 millert Exp $ */
#ifndef _SPARC64_ENDIAN_H_
#define _SPARC64_ENDIAN_H_
-#define BYTE_ORDER BIG_ENDIAN
+#define _BYTE_ORDER _BIG_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
diff --git a/sys/arch/vax/include/endian.h b/sys/arch/vax/include/endian.h
index 3ad6d5f5012..6c0578df68b 100644
--- a/sys/arch/vax/include/endian.h
+++ b/sys/arch/vax/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.12 2004/10/16 14:26:03 miod Exp $ */
+/* $OpenBSD: endian.h,v 1.13 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -56,7 +56,7 @@
#endif /* __GNUC__ */
-#define BYTE_ORDER LITTLE_ENDIAN
+#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sys/endian.h>
#endif /* _VAX_ENDIAN_H_ */
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index bf1e04e31af..157e7651622 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.36 2004/06/21 23:50:37 tholo Exp $ */
+/* $OpenBSD: in6.h,v 1.37 2005/12/13 00:35:23 millert Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -133,7 +133,7 @@ struct in6_addr {
/*
* Socket address for IPv6
*/
-#ifndef _XOPEN_SOURCE
+#if __BSD_VISIBLE
#define SIN6_LEN
#endif
struct sockaddr_in6 {
@@ -198,6 +198,7 @@ extern const struct in6_addr in6mask128;
/*
* Definition of some useful macros to handle IP6 addresses
*/
+#if __BSD_VISIBLE
#define IN6ADDR_ANY_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
@@ -213,12 +214,15 @@ extern const struct in6_addr in6mask128;
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
+#endif
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
+#if __BSD_VISIBLE
extern const struct in6_addr in6addr_nodelocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allrouters;
+#endif
/*
* Equality
@@ -230,9 +234,11 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
#define IN6_ARE_ADDR_EQUAL(a, b) \
(bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#else
+#if __BSD_VISIBLE
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#endif
+#endif
/*
* Unspecified
@@ -366,7 +372,7 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
/*
* IP6 route structure
*/
-#ifndef _XOPEN_SOURCE
+#if __BSD_VISIBLE
struct route_in6 {
struct rtentry *ro_rt;
struct sockaddr_in6 ro_dst;
@@ -453,7 +459,7 @@ struct in6_pktinfo {
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
-#ifndef _XOPEN_SOURCE
+#if __BSD_VISIBLE
/*
* Definitions for inet6 sysctl operations.
*
@@ -636,7 +642,7 @@ struct in6_pktinfo {
&ip6_maxfrags, \
}
-#endif /* !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
struct cmsghdr;
diff --git a/sys/sys/dirent.h b/sys/sys/dirent.h
index d212affe094..a74875f39e7 100644
--- a/sys/sys/dirent.h
+++ b/sys/sys/dirent.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirent.h,v 1.6 2005/06/18 18:09:43 millert Exp $ */
+/* $OpenBSD: dirent.h,v 1.7 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: dirent.h,v 1.12 1996/04/09 20:55:25 cgd Exp $ */
/*-
@@ -32,6 +32,11 @@
* @(#)dirent.h 8.3 (Berkeley) 8/10/94
*/
+#ifndef _SYS_DIRENT_H_
+#define _SYS_DIRENT_H_
+
+#include <sys/cdefs.h>
+
/*
* The dirent structure defines the format of directory entries returned by
* the getdirentries(2) system call.
@@ -48,14 +53,15 @@ struct dirent {
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
-#ifdef _POSIX_SOURCE
- char d_name[255 + 1]; /* name must be no longer than this */
-#else
+#if __BSD_VISIBLE
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
+#else
+ char d_name[255 + 1]; /* name must be no longer than this */
#endif
};
+#if __BSD_VISIBLE
/*
* File types
*/
@@ -74,7 +80,6 @@ struct dirent {
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
-#if defined(_KERNEL)
/*
* The DIRENT_SIZE macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct dirent
@@ -84,4 +89,6 @@ struct dirent {
#define DIRENT_SIZE(dp) \
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
-#endif /* !_KERNEL */
+#endif /* __BSD_VISIBLE */
+
+#endif /* _SYS_DIRENT_H_ */
diff --git a/sys/sys/endian.h b/sys/sys/endian.h
index c520501d290..b6fa3a4f9d9 100644
--- a/sys/sys/endian.h
+++ b/sys/sys/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.14 2004/01/11 19:17:31 brad Exp $ */
+/* $OpenBSD: endian.h,v 1.15 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -29,22 +29,25 @@
* has to be dealt with in the specific machine/endian.h file for that port.
*
* This file is meant to be included from a little- or big-endian port's
- * machine/endian.h after setting BYTE_ORDER to either 1234 for little endian
+ * machine/endian.h after setting _BYTE_ORDER to either 1234 for little endian
* or 4321 for big..
*/
#ifndef _SYS_ENDIAN_H_
#define _SYS_ENDIAN_H_
-#ifndef _POSIX_SOURCE
-
#include <sys/cdefs.h>
-#define LITTLE_ENDIAN 1234
-
+#define _LITTLE_ENDIAN 1234
+#define _BIG_ENDIAN 4321
+#define _PDP_ENDIAN 3412
-#define BIG_ENDIAN 4321
-#define PDP_ENDIAN 3412
+#if __BSD_VISIBLE
+#define LITTLE_ENDIAN _LITTLE_ENDIAN
+#define BIG_ENDIAN _BIG_ENDIAN
+#define PDP_ENDIAN _PDP_ENDIAN
+#define BYTE_ORDER _BYTE_ORDER
+#endif
#ifdef __GNUC__
@@ -109,21 +112,21 @@
#ifdef MD_SWAP
#if __GNUC__
-#define swap16(x) __extension__({ \
+#define __swap16(x) __extension__({ \
u_int16_t __swap16_x = (x); \
\
__builtin_constant_p(x) ? __swap16gen(__swap16_x) : \
__swap16md(__swap16_x); \
})
-#define swap32(x) __extension__({ \
+#define __swap32(x) __extension__({ \
u_int32_t __swap32_x = (x); \
\
__builtin_constant_p(x) ? __swap32gen(__swap32_x) : \
__swap32md(__swap32_x); \
})
-#define swap64(x) __extension__({ \
+#define __swap64(x) __extension__({ \
u_int64_t __swap64_x = (x); \
\
__builtin_constant_p(x) ? __swap64gen(__swap64_x) : \
@@ -133,12 +136,12 @@
#endif /* __GNUC__ */
#else /* MD_SWAP */
-#define swap16 __swap16gen
-#define swap32 __swap32gen
-#define swap64 __swap64gen
+#define __swap16 __swap16gen
+#define __swap32 __swap32gen
+#define __swap64 __swap64gen
#endif /* MD_SWAP */
-#define swap16_multi(v, n) do { \
+#define __swap16_multi(v, n) do { \
size_t __swap16_multi_n = (n); \
u_int16_t *__swap16_multi_v = (v); \
\
@@ -149,6 +152,12 @@
} \
} while (0)
+#if __BSD_VISIBLE
+#define swap16 __swap16
+#define swap32 __swap32
+#define swap64 __swap64
+#define swap16_multi __swap16_multi
+
__BEGIN_DECLS
u_int64_t htobe64(u_int64_t);
u_int32_t htobe32(u_int32_t);
@@ -164,8 +173,9 @@ u_int64_t letoh64(u_int64_t);
u_int32_t letoh32(u_int32_t);
u_int16_t letoh16(u_int16_t);
__END_DECLS
+#endif /* __BSD_VISIBLE */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if _BYTE_ORDER == _LITTLE_ENDIAN
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
@@ -175,12 +185,13 @@ __END_DECLS
#define _QUAD_LOWWORD 0
#endif
-#define htobe16 swap16
-#define htobe32 swap32
-#define htobe64 swap64
-#define betoh16 swap16
-#define betoh32 swap32
-#define betoh64 swap64
+#if __BSD_VISIBLE
+#define htobe16 __swap16
+#define htobe32 __swap32
+#define htobe64 __swap64
+#define betoh16 __swap16
+#define betoh32 __swap32
+#define betoh64 __swap64
#define htole16(x) (x)
#define htole32(x) (x)
@@ -188,10 +199,16 @@ __END_DECLS
#define letoh16(x) (x)
#define letoh32(x) (x)
#define letoh64(x) (x)
+#endif /* __BSD_VISIBLE */
+
+#define htons(x) __swap16(x)
+#define htonl(x) __swap32(x)
+#define ntohs(x) __swap16(x)
+#define ntohl(x) __swap32(x)
-#endif /* BYTE_ORDER */
+#endif /* _BYTE_ORDER */
-#if BYTE_ORDER == BIG_ENDIAN
+#if _BYTE_ORDER == _BIG_ENDIAN
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
@@ -201,12 +218,13 @@ __END_DECLS
#define _QUAD_LOWWORD 1
#endif
-#define htole16 swap16
-#define htole32 swap32
-#define htole64 swap64
-#define letoh16 swap16
-#define letoh32 swap32
-#define letoh64 swap64
+#if __BSD_VISIBLE
+#define htole16 __swap16
+#define htole32 __swap32
+#define htole64 __swap64
+#define letoh16 __swap16
+#define letoh32 __swap32
+#define letoh64 __swap64
#define htobe16(x) (x)
#define htobe32(x) (x)
@@ -214,18 +232,20 @@ __END_DECLS
#define betoh16(x) (x)
#define betoh32(x) (x)
#define betoh64(x) (x)
+#endif /* __BSD_VISIBLE */
-#endif /* BYTE_ORDER */
+#define htons(x) (x)
+#define htonl(x) (x)
+#define ntohs(x) (x)
+#define ntohl(x) (x)
-#define htons htobe16
-#define htonl htobe32
-#define ntohs betoh16
-#define ntohl betoh32
+#endif /* _BYTE_ORDER */
+#if __BSD_VISIBLE
#define NTOHL(x) (x) = ntohl((u_int32_t)(x))
#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
#define HTONL(x) (x) = htonl((u_int32_t)(x))
#define HTONS(x) (x) = htons((u_int16_t)(x))
+#endif
-#endif /* _POSIX_SOURCE */
#endif /* _SYS_ENDIAN_H_ */
diff --git a/sys/sys/errno.h b/sys/sys/errno.h
index 581341b7610..65e38841aed 100644
--- a/sys/sys/errno.h
+++ b/sys/sys/errno.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: errno.h,v 1.14 2005/06/17 21:48:03 espie Exp $ */
+/* $OpenBSD: errno.h,v 1.15 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: errno.h,v 1.10 1996/01/20 01:33:53 jtc Exp $ */
/*
@@ -38,17 +38,18 @@
*/
#ifndef _KERNEL
+#include <sys/cdefs.h>
+
extern int errno; /* global error number */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__SYS_ERRLIST)
+#if __BSD_VISIBLE && !defined(__SYS_ERRLIST)
#define __SYS_ERRLIST
extern int sys_nerr;
extern char *sys_errlist[];
-#endif
+#endif /* __BSD_VISIBLE && !defined(__SYS_ERRLIST) */
#if !defined(errno) && !defined(_STANDALONE)
-#include <sys/cdefs.h>
__BEGIN_DECLS
int *__errno(void);
int *___errno(void);
@@ -73,7 +74,7 @@ __END_DECLS
#define ENOMEM 12 /* Cannot allocate memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ENOTBLK 15 /* Block device required */
#endif
#define EBUSY 16 /* Device busy */
@@ -111,13 +112,13 @@ __END_DECLS
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
-#endif /* _POSIX_SOURCE */
+#endif
#define EOPNOTSUPP 45 /* Operation not supported */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define EPFNOSUPPORT 46 /* Protocol family not supported */
-#endif /* _POSIX_SOURCE */
+#endif
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
@@ -131,10 +132,10 @@ __END_DECLS
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#define ETIMEDOUT 60 /* Operation timed out */
#define ECONNREFUSED 61 /* Connection refused */
@@ -142,34 +143,34 @@ __END_DECLS
#define ENAMETOOLONG 63 /* File name too long */
/* should be rearranged */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#define EDQUOT 69 /* Disk quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define EREMOTE 71 /* Too many levels of remote in path */
#define EBADRPC 72 /* RPC struct is bad */
#define ERPCMISMATCH 73 /* RPC version wrong */
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#define EPROGMISMATCH 75 /* Program version wrong */
#define EPROCUNAVAIL 76 /* Bad procedure for program */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#define ENOLCK 77 /* No locks available */
#define ENOSYS 78 /* Function not implemented */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define EFTYPE 79 /* Inappropriate file type or format */
#define EAUTH 80 /* Authentication error */
#define ENEEDAUTH 81 /* Need authenticator */
@@ -177,7 +178,7 @@ __END_DECLS
#define ENOATTR 83 /* Attribute not found */
#define EILSEQ 84 /* Illegal byte sequence */
#define ELAST 84 /* Must be equal largest errno */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
/* pseudo-errors returned inside kernel to modify return to process */
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 5e66bd9a07f..14d57244d94 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fcntl.h,v 1.9 2003/06/02 23:28:21 millert Exp $ */
+/* $OpenBSD: fcntl.h,v 1.10 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: fcntl.h,v 1.8 1995/03/26 20:24:12 jtc Exp $ */
/*-
@@ -46,6 +46,7 @@
* related kernel definitions.
*/
+#include <sys/cdefs.h>
#ifndef _KERNEL
#include <sys/types.h>
#endif
@@ -71,20 +72,22 @@
* FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
* which was documented to use FREAD/FWRITE, continues to work.
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define FREAD 0x0001
#define FWRITE 0x0002
#endif
#define O_NONBLOCK 0x0004 /* no delay */
#define O_APPEND 0x0008 /* set append mode */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define O_SHLOCK 0x0010 /* open with shared file lock */
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
-#define O_FSYNC O_SYNC /* backwards compatibility */
+#define O_FSYNC 0x0080 /* backwards compatibility */
#define O_NOFOLLOW 0x0100 /* if path is a symlink, don't follow */
#endif
+#if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 420
#define O_SYNC 0x0080 /* synchronous writes */
+#endif
#define O_CREAT 0x0200 /* create if nonexistant */
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
@@ -124,7 +127,7 @@
* and by fcntl. We retain the F* names for the kernel f_flags field
* and for backward compatibility for fcntl.
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define FAPPEND O_APPEND /* kernel/compat */
#define FASYNC O_ASYNC /* kernel/compat */
#define FFSYNC O_SYNC /* kernel */
@@ -143,7 +146,7 @@
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
-#ifndef _POSIX_SOURCE
+#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 500
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
@@ -177,7 +180,7 @@ struct flock {
};
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
/* lock operations for flock(2) */
#define LOCK_SH 0x01 /* shared file lock */
#define LOCK_EX 0x02 /* exclusive file lock */
@@ -187,15 +190,13 @@ struct flock {
#ifndef _KERNEL
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
int open(const char *, int, ...);
int creat(const char *, mode_t);
int fcntl(int, int, ...);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
int flock(int, int);
-#endif /* !_POSIX_SOURCE */
+#endif
__END_DECLS
#endif
diff --git a/sys/sys/limits.h b/sys/sys/limits.h
index 4f39d185b8e..ff856320e92 100644
--- a/sys/sys/limits.h
+++ b/sys/sys/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.5 2004/09/16 13:10:57 miod Exp $ */
+/* $OpenBSD: limits.h,v 1.6 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
@@ -26,6 +26,8 @@
#ifndef _SYS_LIMITS_H_
#define _SYS_LIMITS_H_
+#include <sys/cdefs.h>
+
/* Common definitions for limits.h. */
/*
@@ -78,8 +80,7 @@
# define LONG_MIN (-0x7fffffffL-1)/* min value for a long */
#endif
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
- defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
# define ULLONG_MAX 0xffffffffffffffffULL
/* max value for unsigned long long */
# define LLONG_MAX 0x7fffffffffffffffLL
@@ -88,13 +89,13 @@
/* min value for a signed long long */
#endif
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
# define UID_MAX UINT_MAX /* max value for a uid_t */
# define GID_MAX UINT_MAX /* max value for a gid_t */
#endif
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
+#if __XPG_VISIBLE
# ifdef __LP64__
# define LONG_BIT 64
# else
diff --git a/sys/sys/midiio.h b/sys/sys/midiio.h
index 9bba9458a2d..a079375505a 100644
--- a/sys/sys/midiio.h
+++ b/sys/sys/midiio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: midiio.h,v 1.2 2002/03/14 03:16:12 millert Exp $ */
+/* $OpenBSD: midiio.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: midiio.h,v 1.7 1998/11/25 22:17:07 augustss Exp $ */
/*-
@@ -45,15 +45,8 @@
* for naming.
*/
-#ifndef _POSIX_SOURCE
-#define __MIDIIO_UNSET_POSIX_SOURCE
-#define _POSIX_SOURCE /* make sure we don't get all the gunk */
-#endif
-#include <machine/endian.h>
-#ifdef __MIDIIO_UNSET_POSIX_SOURCE
-#undef _POSIX_SOURCE
-#undef __MIDIIO_UNSET_POSIX_SOURCE
-#endif
+#include <sys/cdefs.h>
+#include <machine/endian.h> /* for _QUAD_LOWWORD */
/*
* ioctl() commands for /dev/midi##
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 73f31adadd1..46f6eb7e3b7 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.66 2005/12/06 20:18:57 pedro Exp $ */
+/* $OpenBSD: mount.h,v 1.67 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -35,6 +35,7 @@
#ifndef _SYS_MOUNT_H_
#define _SYS_MOUNT_H_
+#include <sys/cdefs.h>
#ifndef _KERNEL
#include <sys/ucred.h>
#endif
@@ -598,8 +599,6 @@ int vfs_register(struct vfsconf *);
int vfs_unregister(struct vfsconf *);
#else /* _KERNEL */
-#include <sys/cdefs.h>
-
#ifndef _SYS_STAT_H_
struct stat;
#endif
@@ -612,11 +611,11 @@ int getmntinfo(struct statfs **, int);
int mount(const char *, const char *, int, void *);
int statfs(const char *, struct statfs *);
int unmount(const char *, int);
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
int fhopen(const fhandle_t *, int);
int fhstat(const fhandle_t *, struct stat *);
int fhstatfs(const fhandle_t *, struct statfs *);
-#endif /* !_POSIX_C_SOURCE */
+#endif /* __BSD_VISIBLE */
__END_DECLS
diff --git a/sys/sys/select.h b/sys/sys/select.h
index 1f6a0df5b09..1d098a745da 100644
--- a/sys/sys/select.h
+++ b/sys/sys/select.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: select.h,v 1.7 2005/11/21 18:16:46 millert Exp $ */
+/* $OpenBSD: select.h,v 1.8 2005/12/13 00:35:23 millert Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -34,7 +34,8 @@
#ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_
-#include <sys/time.h>
+#include <sys/cdefs.h>
+#include <sys/time.h> /* for types and struct timeval */
/*
* Select uses bit masks of file descriptors in longs. These macros
@@ -48,7 +49,7 @@
/*
* We don't want to pollute the namespace with select(2) internals.
- * Non-underscore versions are exposed later.
+ * Non-underscore versions are exposed later #if __BSD_VISIBLE
*/
#define __NBBY 8 /* number of bits in a byte */
typedef int32_t __fd_mask;
@@ -73,19 +74,18 @@ typedef struct fd_set {
#define FD_ZERO(p) memset(p, 0, sizeof(*(p)))
#endif
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
#define NBBY __NBBY
#define fd_mask __fd_mask
#define NFDBITS __NFDBITS
#ifndef howmany
#define howmany(x, y) __howmany(x, y)
#endif
-#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifndef _KERNEL
#ifndef _SELECT_DEFINED_
#define _SELECT_DEFINED_
-#include <sys/cdefs.h>
__BEGIN_DECLS
struct timeval;
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
diff --git a/sys/sys/sem.h b/sys/sys/sem.h
index 21dd32758b0..f686d689864 100644
--- a/sys/sys/sem.h
+++ b/sys/sys/sem.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.h,v 1.18 2004/07/15 11:24:46 millert Exp $ */
+/* $OpenBSD: sem.h,v 1.19 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */
/*
@@ -10,12 +10,13 @@
#ifndef _SYS_SEM_H_
#define _SYS_SEM_H_
+#include <sys/cdefs.h>
#ifndef _SYS_IPC_H_
#include <sys/ipc.h>
#endif
#include <sys/queue.h>
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
/* sem-specific sysctl variables corresponding to members of struct seminfo */
#define KERN_SEMINFO_SEMMNI 1 /* int: # of semaphore identifiers */
@@ -42,7 +43,7 @@
{ "semaem", CTLTYPE_INT }, \
}
-#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
struct sem {
unsigned short semval; /* semaphore value */
@@ -205,8 +206,6 @@ extern struct semid_ds **sema; /* semaphore id list */
#endif /* _KERNEL */
#ifndef _KERNEL
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
int semctl(int, int, int, ...);
int __semctl(int, int, int, union semun *);
diff --git a/sys/sys/shm.h b/sys/sys/shm.h
index 86bc981540b..2dad3ed281a 100644
--- a/sys/sys/shm.h
+++ b/sys/sys/shm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: shm.h,v 1.19 2004/07/15 11:24:46 millert Exp $ */
+/* $OpenBSD: shm.h,v 1.20 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */
/*
@@ -39,11 +39,12 @@
#ifndef _SYS_SHM_H_
#define _SYS_SHM_H_
+#include <sys/cdefs.h>
#ifndef _SYS_IPC_H_
#include <sys/ipc.h>
#endif
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
/* shm-specific sysctl variables corresponding to members of struct shminfo */
#define KERN_SHMINFO_SHMMAX 1 /* int: max shm segment size (bytes) */
@@ -69,7 +70,7 @@
#define SHM_R IPC_R
#define SHM_W IPC_W
-#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
/*
* Shared memory operation flags for shmat(2).
@@ -134,7 +135,7 @@ struct shmid_ds35 {
};
#endif
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
/*
* System V style catch-all structure for shared memory constants that
* might be of interest to user programs. Do we really want/need this?
@@ -151,7 +152,7 @@ struct shm_sysctl_info {
struct shminfo shminfo;
struct shmid_ds shmids[1];
};
-#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
extern struct shminfo shminfo;
@@ -175,8 +176,6 @@ int shmctl1(struct proc *, int, int, caddr_t,
#else /* !_KERNEL */
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
void *shmat(int, const void *, int);
int shmctl(int, int, struct shmid_ds *);
diff --git a/sys/sys/siginfo.h b/sys/sys/siginfo.h
index ed630cd63bd..d2b1ba4504d 100644
--- a/sys/sys/siginfo.h
+++ b/sys/sys/siginfo.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: siginfo.h,v 1.8 2003/06/02 04:04:54 deraadt Exp $ */
+/* $OpenBSD: siginfo.h,v 1.9 2005/12/13 00:35:23 millert Exp $ */
/*
* Copyright (c) 1997 Theo de Raadt
@@ -27,6 +27,8 @@
#ifndef _SYS_SIGINFO_H
#define _SYS_SIGINFO_H
+
+#include <sys/cdefs.h>
union sigval {
int sival_int; /* integer value */
@@ -46,7 +48,7 @@ union sigval {
#define SI_QUEUE (-2) /* user generated signal via sigqueue()*/
#define SI_TIMER (-3) /* from timer expiration */
-#if !defined(_POSIX_C_SOURCE)
+#if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE
/*
* The machine dependent signal codes (SIGILL, SIGFPE,
* SIGSEGV, and SIGBUS)
@@ -83,7 +85,7 @@ union sigval {
#define BUS_OBJERR 3 /* object specific hardware error */
#define NSIGBUS 3
-#endif /* _POSIX_C_SOURCE */
+#endif /* __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE */
/*
* SIGTRAP signal codes
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index 345941d3b24..b078ca43e32 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.17 2005/05/24 18:06:10 millert Exp $ */
+/* $OpenBSD: signal.h,v 1.18 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */
/*
@@ -45,7 +45,7 @@
#define _NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __BSD_VISIBLE
#define NSIG _NSIG
#endif
@@ -55,7 +55,7 @@
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* abort() */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#endif
@@ -74,14 +74,14 @@
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define SIGIO 23 /* input/output possible signal */
#endif
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#endif
@@ -96,7 +96,7 @@
#define SIG_IGN (void (*)(int))1
#define SIG_ERR (void (*)(int))-1
-#ifndef _ANSI_SOURCE
+#if __POSIX_VISIBLE || __XPG_VISIBLE
typedef unsigned int sigset_t;
#include <sys/siginfo.h>
@@ -117,7 +117,7 @@ struct sigaction {
#define sa_handler __sigaction_u.__sa_handler
#define sa_sigaction __sigaction_u.__sa_sigaction
-#ifndef _POSIX_SOURCE
+#if __XPG_VISIBLE >= 500
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system on signal return */
#define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
@@ -126,9 +126,11 @@ struct sigaction {
#ifdef COMPAT_SUNOS
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
#endif
-#endif
+#endif /* __XPG_VISIBLE >= 500 */
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
+#if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
#define SA_SIGINFO 0x0040 /* generate siginfo_t */
+#endif
/*
* Flags for sigprocmask:
@@ -136,8 +138,9 @@ struct sigaction {
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
+#endif /* __POSIX_VISIBLE || __XPG_VISIBLE */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
typedef void (*sig_t)(int); /* type of signal function */
/*
@@ -193,8 +196,7 @@ typedef struct sigcontext ucontext_t;
#define BADSIG SIG_ERR
-#endif /* !_POSIX_SOURCE */
-#endif /* !_ANSI_SOURCE */
+#endif /* __BSD_VISIBLE */
/*
* For historical reasons; programs expect signal's return value to be
diff --git a/sys/sys/stat.h b/sys/sys/stat.h
index d4a39f6fb4d..6edbf971feb 100644
--- a/sys/sys/stat.h
+++ b/sys/sys/stat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stat.h,v 1.15 2005/06/18 18:09:43 millert Exp $ */
+/* $OpenBSD: stat.h,v 1.16 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: stat.h,v 1.20 1996/05/16 22:17:49 cgd Exp $ */
/*-
@@ -40,6 +40,7 @@
#ifndef _SYS_STAT_H_
#define _SYS_STAT_H_
+#include <sys/cdefs.h>
#include <sys/time.h>
#ifdef _KERNEL
@@ -91,7 +92,7 @@ struct stat {
gid_t st_gid; /* group ID of the file's group */
dev_t st_rdev; /* device type */
int32_t st_lspare0;
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */
struct timespec st_ctimespec; /* time of last file status change */
@@ -102,14 +103,14 @@ struct stat {
long st_mtimensec; /* nsec of last data modification */
time_t st_ctime; /* time of last file status change */
long st_ctimensec; /* nsec of last file status change */
-#endif
+#endif /* __BSD_VISIBLE */
off_t st_size; /* file size, in bytes */
int64_t st_blocks; /* blocks allocated for file */
u_int32_t st_blksize; /* optimal blocksize for I/O */
u_int32_t st_flags; /* user defined flags for file */
u_int32_t st_gen; /* file generation number */
int32_t st_lspare1;
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
struct timespec __st_birthtimespec; /* time of file creation */
#else
time_t __st_birthtime; /* time of file creation */
@@ -117,7 +118,7 @@ struct stat {
#endif
int64_t st_qspare[2];
};
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define st_atime st_atimespec.tv_sec
#define st_atimensec st_atimespec.tv_nsec
#define st_mtime st_mtimespec.tv_sec
@@ -128,7 +129,7 @@ struct stat {
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define S_ISTXT 0001000 /* sticky bit */
#endif
@@ -137,7 +138,7 @@ struct stat {
#define S_IWUSR 0000200 /* W for owner */
#define S_IXUSR 0000100 /* X for owner */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR
@@ -153,7 +154,7 @@ struct stat {
#define S_IWOTH 0000002 /* W for other */
#define S_IXOTH 0000001 /* X for other */
-#ifndef _POSIX_SOURCE
+#if __XPG_VISIBLE || __BSD_VISIBLE
#define S_IFMT 0170000 /* type of file mask */
#define S_IFIFO 0010000 /* named pipe (fifo) */
#define S_IFCHR 0020000 /* character special */
@@ -170,12 +171,12 @@ struct stat {
#define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
#define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
-#ifndef _POSIX_SOURCE
+#if __POSIX_VISIBLE >= 200112 || __BSD_VISIBLE
#define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
#define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */
#endif
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 00777 */
/* 07777 */
#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
@@ -209,12 +210,10 @@ struct stat {
#define OPAQUE (UF_OPAQUE)
#define APPEND (UF_APPEND | SF_APPEND)
#define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE)
-#endif
-#endif
+#endif /* _KERNEL */
+#endif /* __BSD_VISIBLE */
#ifndef _KERNEL
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
int chmod(const char *, mode_t);
int fstat(int, struct stat *);
@@ -223,7 +222,7 @@ int mkdir(const char *, mode_t);
int mkfifo(const char *, mode_t);
int stat(const char *, struct stat *);
mode_t umask(mode_t);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
int chflags(const char *, unsigned int);
int fchflags(int, unsigned int);
int fchmod(int, mode_t);
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index a51e00ed3c3..41ed2f82800 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.84 2005/10/26 17:22:00 mickey Exp $ */
+/* $OpenBSD: sysctl.h,v 1.85 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -459,6 +459,7 @@ struct kinfo_proc2 {
char p_emul[KI_EMULNAMELEN]; /* syscall emulation name */
u_int64_t p_rlim_rss_cur; /* RLIM_T: soft limit for rss */
u_int64_t p_cpuid; /* LONG: CPU id */
+ u_int64_t p_vm_map_size; /* VSIZE_T: virtual size */
};
/*
diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h
index f2812262dff..82561c0dfe6 100644
--- a/sys/sys/syslimits.h
+++ b/sys/sys/syslimits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslimits.h,v 1.8 2004/05/31 18:34:41 millert Exp $ */
+/* $OpenBSD: syslimits.h,v 1.9 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: syslimits.h,v 1.12 1995/10/05 05:26:19 thorpej Exp $ */
/*
@@ -32,7 +32,9 @@
* @(#)syslimits.h 8.1 (Berkeley) 6/2/93
*/
-#if !defined(_ANSI_SOURCE)
+#include <sys/cdefs.h>
+
+#if __POSIX_VISIBLE || __XPG_VISIBLE
#define ARG_MAX (256 * 1024) /* max bytes for an exec function */
#define CHILD_MAX 80 /* max simultaneous processes */
#define LINK_MAX 32767 /* max file link count */
@@ -57,10 +59,9 @@
#define RE_DUP_MAX 255 /* max RE's in interval notation */
#endif
-#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
+#if __XPG_VISIBLE
#define IOV_MAX 1024 /* max # of iov's (readv,sendmsg,etc) */
#define NZERO 20 /* default "nice" */
-#endif /* !_POSIX_C_SOURCE || _XOPEN_SOURCE */
-
-#endif
+#endif /* __XPG_VISIBLE */
+#endif /* __POSIX_VISIBLE || __XPG_VISIBLE */
diff --git a/sys/sys/termios.h b/sys/sys/termios.h
index 653819114ef..6a60d36637c 100644
--- a/sys/sys/termios.h
+++ b/sys/sys/termios.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: termios.h,v 1.9 2003/08/28 16:59:34 jmc Exp $ */
+/* $OpenBSD: termios.h,v 1.10 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: termios.h,v 1.14 1996/04/09 20:55:41 cgd Exp $ */
/*
@@ -35,6 +35,8 @@
#ifndef _SYS_TERMIOS_H_
#define _SYS_TERMIOS_H_
+#include <sys/cdefs.h>
+
/*
* Special Control Characters
*
@@ -44,33 +46,33 @@
*/
#define VEOF 0 /* ICANON */
#define VEOL 1 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VEOL2 2 /* ICANON */
#endif
#define VERASE 3 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VWERASE 4 /* ICANON */
#endif
#define VKILL 5 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VREPRINT 6 /* ICANON */
#endif
/* 7 spare 1 */
#define VINTR 8 /* ISIG */
#define VQUIT 9 /* ISIG */
#define VSUSP 10 /* ISIG */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VDSUSP 11 /* ISIG */
#endif
#define VSTART 12 /* IXON, IXOFF */
#define VSTOP 13 /* IXON, IXOFF */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VLNEXT 14 /* IEXTEN */
#define VDISCARD 15 /* IEXTEN */
#endif
#define VMIN 16 /* !ICANON */
#define VTIME 17 /* !ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VSTATUS 18 /* ICANON */
/* 19 spare 2 */
#endif
@@ -78,7 +80,7 @@
#define _POSIX_VDISABLE (0377)
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0)
#endif
@@ -96,51 +98,54 @@
#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
#define IXON 0x00000200 /* enable output flow control */
#define IXOFF 0x00000400 /* enable input flow control */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define IXANY 0x00000800 /* any char will restart after stop */
#define IUCLC 0x00001000 /* translate upper to lower case */
#define IMAXBEL 0x00002000 /* ring bell on input queue full */
-#endif /*_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
/*
* Output flags - software output processing
*/
#define OPOST 0x00000001 /* enable following output processing */
-#ifndef _POSIX_SOURCE
+#if __XPG_VISIBLE
#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
+#endif
+#if __BSD_VISIBLE
#define OXTABS 0x00000004 /* expand tabs to spaces */
#define ONOEOT 0x00000008 /* discard EOT's (^D) on output */
+#endif
+#if __XPG_VISIBLE
#define OCRNL 0x00000010 /* map CR to NL */
#define OLCUC 0x00000020 /* translate lower case to upper case */
#define ONOCR 0x00000040 /* No CR output at column 0 */
#define ONLRET 0x00000080 /* NL performs the CR function */
-#endif /*_POSIX_SOURCE */
+#endif /* __XPG_VISIBLE */
/*
* Control flags - hardware control of terminal
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define CIGNORE 0x00000001 /* ignore control flags */
#endif
#define CSIZE 0x00000300 /* character size mask */
-#define CS5 0x00000000 /* 5 bits (pseudo) */
-#define CS6 0x00000100 /* 6 bits */
-#define CS7 0x00000200 /* 7 bits */
-#define CS8 0x00000300 /* 8 bits */
+#define CS5 0x00000000 /* 5 bits (pseudo) */
+#define CS6 0x00000100 /* 6 bits */
+#define CS7 0x00000200 /* 7 bits */
+#define CS8 0x00000300 /* 8 bits */
#define CSTOPB 0x00000400 /* send 2 stop bits */
#define CREAD 0x00000800 /* enable receiver */
#define PARENB 0x00001000 /* parity enable */
#define PARODD 0x00002000 /* odd parity, else even */
#define HUPCL 0x00004000 /* hang up on last close */
#define CLOCAL 0x00008000 /* ignore modem status lines */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define CRTSCTS 0x00010000 /* RTS/CTS full-duplex flow control */
#define CRTS_IFLOW CRTSCTS /* XXX compat */
#define CCTS_OFLOW CRTSCTS /* XXX compat */
#define MDMBUF 0x00100000 /* DTR/DCD hardware flow control */
#define CHWFLOW (MDMBUF|CRTSCTS) /* all types of hw flow control */
-#endif
-
+#endif /* __BSD_VISIBLE */
/*
* "Local" flags - dumping ground for other state
@@ -150,31 +155,31 @@
* input flag.
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ECHOKE 0x00000001 /* visual erase for line kill */
-#endif /*_POSIX_SOURCE */
+#endif
#define ECHOE 0x00000002 /* visually erase chars */
#define ECHOK 0x00000004 /* echo NL after line kill */
#define ECHO 0x00000008 /* enable echoing */
#define ECHONL 0x00000010 /* echo NL even if ECHO is off */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */
-#endif /*_POSIX_SOURCE */
+#endif
#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
#define ICANON 0x00000100 /* canonicalize input lines */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */
-#endif /*_POSIX_SOURCE */
+#endif
#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
#define EXTPROC 0x00000800 /* external processing */
#define TOSTOP 0x00400000 /* stop background jobs from output */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define FLUSHO 0x00800000 /* output being flushed (state) */
#define XCASE 0x01000000 /* canonical upper/lower case */
#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
#define PENDIN 0x20000000 /* XXX retype pending input (state) */
-#endif /*_POSIX_SOURCE */
+#endif
#define NOFLSH 0x80000000 /* don't flush after interrupt */
typedef unsigned int tcflag_t;
@@ -197,7 +202,7 @@ struct termios {
#define TCSANOW 0 /* make change immediate */
#define TCSADRAIN 1 /* drain output, then change */
#define TCSAFLUSH 2 /* drain output, flush input */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define TCSASOFT 0x10 /* flag - don't alter h.w. state */
#endif
@@ -220,7 +225,7 @@ struct termios {
#define B9600 9600
#define B19200 19200
#define B38400 38400
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define B7200 7200
#define B14400 14400
#define B28800 28800
@@ -230,7 +235,7 @@ struct termios {
#define B230400 230400
#define EXTA 19200
#define EXTB 38400
-#endif /* !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifndef _KERNEL
@@ -256,16 +261,15 @@ int tcflow(int, int);
int tcflush(int, int);
int tcsendbreak(int, int);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
void cfmakeraw(struct termios *);
int cfsetspeed(struct termios *, speed_t);
-#endif /* !_POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_KERNEL */
-#ifndef _POSIX_SOURCE
-
+#if __BSD_VISIBLE
/*
* Include tty ioctl's that aren't just for backwards compatibility
* with the old tty driver. These ioctl definitions were previously
@@ -279,6 +283,6 @@ __END_DECLS
*/
#endif /* !_SYS_TERMIOS_H_ */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#include <sys/ttydefaults.h>
#endif
diff --git a/sys/sys/time.h b/sys/sys/time.h
index 64e029dffb3..5125db547f3 100644
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.h,v 1.20 2005/11/29 00:28:18 deraadt Exp $ */
+/* $OpenBSD: time.h,v 1.21 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
/*
@@ -35,8 +35,13 @@
#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
+#include <sys/cdefs.h>
#include <sys/types.h>
+#if __XPG_VISIBLE >= 420 && __XPG_VISIBLE < 600
+#include <sys/select.h>
+#endif
+
/*
* Structure returned by gettimeofday(2) system call,
* and used in other calls.
@@ -46,6 +51,8 @@ struct timeval {
long tv_usec; /* and microseconds */
};
+#ifndef _TIMESPEC_DECLARED
+#define _TIMESPEC_DECLARED
/*
* Structure defined by POSIX.1b to be like a timeval.
*/
@@ -53,6 +60,7 @@ struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
+#endif
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
@@ -306,11 +314,12 @@ int ppsratecheck(struct timeval *, int *, int);
#else /* !_KERNEL */
#include <time.h>
-#ifndef _POSIX_SOURCE
-#include <sys/cdefs.h>
-
+#if __BSD_VISIBLE || __XPG_VISIBLE
__BEGIN_DECLS
+#if __BSD_VISIBLE
int adjtime(const struct timeval *, struct timeval *);
+#endif
+#if __XPG_VISIBLE
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
@@ -320,8 +329,9 @@ int gettimeofday(struct timeval *, struct timezone *);
int setitimer(int, const struct itimerval *, struct itimerval *);
int settimeofday(const struct timeval *, const struct timezone *);
int utimes(const char *, const struct timeval *);
+#endif /* __XPG_VISIBLE */
__END_DECLS
-#endif /* !POSIX */
+#endif /* __BSD_VISIBLE || __XPG_VISIBLE */
#endif /* !_KERNEL */
diff --git a/sys/sys/types.h b/sys/sys/types.h
index 89df14acf37..c71e948e6b6 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: types.h,v 1.27 2005/11/21 18:16:46 millert Exp $ */
+/* $OpenBSD: types.h,v 1.28 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
/*-
@@ -40,13 +40,12 @@
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
-/* Machine type dependent parameters. */
+#include <sys/cdefs.h>
#include <machine/types.h>
-
#include <machine/ansi.h>
#include <machine/endian.h>
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
@@ -134,26 +133,24 @@ typedef _BSD_OFF_T_ off_t;
* long arguments will be promoted to off_t if the program fails to
* include that header or explicitly cast them to off_t.
*/
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
-#ifndef _KERNEL
-#include <sys/cdefs.h>
+#if __BSD_VISIBLE && !defined(_KERNEL)
__BEGIN_DECLS
off_t lseek(int, off_t, int);
int ftruncate(int, off_t);
int truncate(const char *, off_t);
__END_DECLS
-#endif /* !_KERNEL */
-#endif /* !defined(_POSIX_SOURCE) ... */
+#endif /* __BSD_VISIBLE && !_KERNEL */
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
/* Major, minor numbers, dev_t's. */
#define major(x) ((int32_t)(((u_int32_t)(x) >> 8) & 0xff))
#define minor(x) ((int32_t)((x) & 0xff) | (((x) & 0xffff0000) >> 8))
#define makedev(x,y) ((dev_t)((((x) & 0xff) << 8) | ((y) & 0xff) | (((y) & 0xffff00) << 8)))
#endif
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
#include <sys/select.h> /* must be after type declarations */
+#endif
#if defined(__STDC__) && defined(_KERNEL)
/*
@@ -171,5 +168,4 @@ struct tty;
struct uio;
#endif
-#endif /* !defined(_POSIX_SOURCE) ... */
#endif /* !_SYS_TYPES_H_ */
diff --git a/sys/sys/uio.h b/sys/sys/uio.h
index 0dde7978a52..476a85eab34 100644
--- a/sys/sys/uio.h
+++ b/sys/sys/uio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uio.h,v 1.12 2005/11/16 15:15:49 uwe Exp $ */
+/* $OpenBSD: uio.h,v 1.13 2005/12/13 00:35:23 millert Exp $ */
/* $NetBSD: uio.h,v 1.12 1996/02/09 18:25:45 christos Exp $ */
/*
@@ -71,10 +71,10 @@ struct uio {
#include <sys/cdefs.h>
__BEGIN_DECLS
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+#if __BSD_VISIBLE
ssize_t preadv(int, const struct iovec *, int, off_t);
ssize_t pwritev(int, const struct iovec *, int, off_t);
-#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
+#endif /* __BSD_VISIBLE */
ssize_t readv(int, const struct iovec *, int);
ssize_t writev(int, const struct iovec *, int);
__END_DECLS
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 9f56a8917c0..88a77bcf42e 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unistd.h,v 1.12 2004/05/07 18:39:19 millert Exp $ */
+/* $OpenBSD: unistd.h,v 1.13 2005/12/13 00:35:24 millert Exp $ */
/* $NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $ */
/*
@@ -35,6 +35,8 @@
#ifndef _SYS_UNISTD_H_
#define _SYS_UNISTD_H_
+#include <sys/cdefs.h>
+
/* compile-time symbolic constants */
#define _POSIX_JOB_CONTROL /* implementation supports job control */
@@ -64,7 +66,7 @@
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
/* old BSD whence values for lseek(2); renamed by POSIX 1003.1 */
#define L_SET SEEK_SET
#define L_INCR SEEK_CUR
diff --git a/sys/sys/wait.h b/sys/sys/wait.h
index 71afd1c51cc..85558e71c2b 100644
--- a/sys/sys/wait.h
+++ b/sys/sys/wait.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wait.h,v 1.11 2003/08/03 19:25:49 millert Exp $ */
+/* $OpenBSD: wait.h,v 1.12 2005/12/13 00:35:24 millert Exp $ */
/* $NetBSD: wait.h,v 1.11 1996/04/09 20:55:51 cgd Exp $ */
/*
@@ -35,6 +35,8 @@
#ifndef _SYS_WAIT_H_
#define _SYS_WAIT_H_
+#include <sys/cdefs.h>
+
/*
* This file holds definitions relevent to the wait4 system call
* and the alternate interfaces that use it (wait, wait3, waitpid).
@@ -44,11 +46,10 @@
* Macros to test the exit status returned by wait
* and extract the relevant values.
*/
-#ifdef _POSIX_SOURCE
-#define _W_INT(i) (i)
-#else
+#if __BSD_VISIBLE
#define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */
-#define WCOREFLAG 0200
+#else
+#define _W_INT(i) (i)
#endif
#define _WSTATUS(x) (_W_INT(x) & 0177)
@@ -61,7 +62,8 @@
#define WIFEXITED(x) (_WSTATUS(x) == 0)
#define WEXITSTATUS(x) ((_W_INT(x) >> 8) & 0xff)
#define WIFCONTINUED(x) ((_W_INT(x) & _WCONTINUED) == _WCONTINUED)
-#ifndef _POSIX_SOURCE
+#if __XPG_VISIBLE
+#define WCOREFLAG 0200
#define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG)
#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
@@ -79,14 +81,12 @@
*/
#define WNOHANG 1 /* don't hang in wait */
#define WUNTRACED 2 /* tell about stopped, untraced children */
-#ifndef _POSIX_SOURCE
+#if __XPG_VISIBLE
#define WALTSIG 4 /* wait for child with alternate exit signal */
#endif
#define WCONTINUED 8 /* report a job control continued process */
-#ifndef _POSIX_SOURCE
-/* POSIX extensions and 4.2/4.3 compatibility: */
-
+#if __BSD_VISIBLE
/*
* Tokens for special values of the "pid" parameter to wait4.
*/
@@ -145,18 +145,17 @@ union wait {
#define w_stopsig w_S.w_Stopsig
#define WSTOPPED _WSTOPPED
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
#ifndef _KERNEL
#include <sys/types.h>
-#include <sys/cdefs.h>
__BEGIN_DECLS
struct rusage; /* forward declaration */
pid_t wait(int *);
pid_t waitpid(pid_t, int *, int);
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
pid_t wait3(int *, int, struct rusage *);
pid_t wait4(pid_t, int *, int, struct rusage *);
#endif