random ai stuff

This commit is contained in:
matst80
2025-11-21 18:12:55 +01:00
commit 60f5783a26
187 changed files with 25197 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
/* $OpenBSD: _types.h,v 1.2 2008/03/16 19:42:57 otto Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_
#include <machine/_types.h>
typedef unsigned long __cpuid_t; /* CPU id */
typedef __int32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
typedef __uint32_t __gid_t; /* group id */
typedef __uint32_t __id_t; /* may contain pid, uid or gid */
typedef __uint32_t __in_addr_t; /* base type for internet address */
typedef __uint16_t __in_port_t; /* IP port type */
typedef __uint32_t __ino_t; /* inode number */
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __uint32_t __mode_t; /* permissions */
typedef __uint32_t __nlink_t; /* link count */
typedef __int32_t __pid_t; /* process id */
typedef __uint64_t __rlim_t; /* resource limit */
typedef __uint8_t __sa_family_t; /* sockaddr address family type */
typedef __int32_t __segsz_t; /* segment size */
typedef __uint32_t __socklen_t; /* length type for network syscalls */
typedef __int32_t __swblk_t; /* swap offset */
typedef __uint32_t __uid_t; /* user id */
typedef __uint32_t __useconds_t; /* microseconds */
typedef __int32_t __suseconds_t; /* microseconds (signed) */
typedef __uint64_t __fsblkcnt_t; /* file system block count */
typedef __uint64_t __fsfilcnt_t; /* file system file count */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
__int64_t __mbstateL; /* for alignment */
} __mbstate_t;
#endif /* !_SYS__TYPES_H_ */

View File

@@ -0,0 +1,388 @@
/* $OpenBSD: cdefs.h,v 1.32 2012/01/03 16:56:58 kettenis Exp $ */
/* $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
*/
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
#include <machine/cdefs.h>
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
/*
* Macro to test if we're using a specific version of gcc or later.
*/
#ifdef __GNUC__
#define __GNUC_PREREQ__(ma, mi) \
((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)))
#else
#define __GNUC_PREREQ__(ma, mi) 0
#endif
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus) || defined(__PCC__)
#define __inline inline /* convert to C++ keyword */
#else
#if !defined(__GNUC__) && !defined(lint)
#define __inline /* delete GCC keyword */
#endif /* !__GNUC__ && !lint */
#endif /* !__cplusplus */
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#if defined(_MSC_VER)
#include <windows.h>
#elif !defined(__GNUC__) && !defined(lint)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
#endif /* !__GNUC__ && !lint */
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* Programs using the ANSI C keywords const, inline etc. as normal
* identifiers should define -DNO_ANSI_KEYWORDS.
*/
#ifndef NO_ANSI_KEYWORDS
#define const __const /* convert ANSI C keywords */
#define inline __inline
#define signed __signed
#define volatile __volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !(__STDC__ || __cplusplus) */
/*
* GCC1 and some versions of GCC2 declare dead (non-returning) and
* pure (no side effects) functions using "volatile" and "const";
* unfortunately, these then cause warnings under "-ansi -pedantic".
* GCC >= 2.5 uses the __attribute__((attrs)) style. All of these
* work for GNU C++ (modulo a slight glitch in the C++ grammar in
* the distribution version of 2.5.5).
*/
#if !__GNUC_PREREQ__(2, 5) && !defined(__PCC__)
#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile
#define __pure __const
#elif defined(lint)
#define __dead /* NORETURN */
#endif
#elif !defined(__STRICT_ANSI__)
#define __dead __attribute__((__noreturn__))
#define __pure __attribute__((__const__))
#endif
#if __GNUC_PREREQ__(2, 7)
#define __unused __attribute__((__unused__))
#else
#define __unused /* delete */
#endif
#if __GNUC_PREREQ__(3, 1)
#define __used __attribute__((__used__))
#else
#define __used __unused /* suppress -Wunused warnings */
#endif
/*
* __returns_twice makes the compiler not assume the function
* only returns once. This affects registerisation of variables:
* even local variables need to be in memory across such a call.
* Example: setjmp()
*/
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((returns_twice))
#else
#define __returns_twice
#endif
/*
* __only_inline makes the compiler only use this function definition
* for inlining; references that can't be inlined will be left as
* external references instead of generating a local copy. The
* matching library should include a simple extern definition for
* the function to handle those references. c.f. ctype.h
*/
#ifdef __GNUC__
# if __GNUC_PREREQ__(4, 2)
#define __only_inline extern __inline __attribute__((__gnu_inline__))
# else
#define __only_inline extern __inline
# endif
#else
#define __only_inline static __inline
#endif
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that
* code blocks can be reordered such that the predicted path
* sees a more linear flow, thus improving cache behavior, etc.
*
* The following two macros provide us with a way to utilize this
* compiler feature. Use __predict_true() if you expect the expression
* to evaluate to true, and __predict_false() if you expect the
* expression to evaluate to false.
*
* A few notes about usage:
*
* * Generally, __predict_false() error condition checks (unless
* you have some _strong_ reason to do otherwise, in which case
* document it), and/or __predict_true() `no-error' condition
* checks, assuming you want to optimize for the no-error case.
*
* * Other than that, if you don't know the likelihood of a test
* succeeding from empirical or other `hard' evidence, don't
* make predictions.
*
* * These are meant to be used in places that are run `a lot'.
* It is wasteful to make predictions in code that is run
* seldomly (e.g. at subsystem initialization time) as the
* basic block reordering that this affects can often generate
* larger code.
*/
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
#define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
#else
#define __predict_true(exp) ((exp) != 0)
#define __predict_false(exp) ((exp) != 0)
#endif
/* Delete pseudo-keywords wherever they are not available or needed. */
#ifndef __dead
#define __dead
#define __pure
#endif
#if __GNUC_PREREQ__(2, 7) || defined(__PCC__)
#define __packed __attribute__((__packed__))
#elif defined(lint)
#define __packed
#endif
#if !__GNUC_PREREQ__(2, 8)
#define __extension__
#endif
#if __GNUC_PREREQ__(2, 8) || defined(__PCC__)
#define __statement(x) __extension__(x)
#elif defined(lint)
#define __statement(x) (0)
#else
#define __statement(x) (x)
#endif
#if __GNUC_PREREQ__(3, 0)
#define __malloc __attribute__((__malloc__))
#else
#define __malloc
#endif
/*
* "The nice thing about standards is that there are so many to choose from."
* There are a number of "feature test macros" specified by (different)
* standards that determine which interfaces and types the header files
* should expose.
*
* Because of inconsistencies in these macros, we define our own
* set in the private name space that end in _VISIBLE. These are
* always defined and so headers can test their values easily.
* Things can get tricky when multiple feature macros are defined.
* We try to take the union of all the features requested.
*
* The following macros are guaranteed to have a value after cdefs.h
* has been included:
* __POSIX_VISIBLE
* __XPG_VISIBLE
* __ISO_C_VISIBLE
* __BSD_VISIBLE
*/
/*
* X/Open Portability Guides and Single Unix Specifications.
* _XOPEN_SOURCE XPG3
* _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4
* _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2
* _XOPEN_SOURCE == 500 XPG5
* _XOPEN_SOURCE == 520 XPG5v2
* _XOPEN_SOURCE == 600 POSIX 1003.1-2001 with XSI
* _XOPEN_SOURCE == 700 POSIX 1003.1-2008 with XSI
*
* The XPG spec implies a specific value for _POSIX_C_SOURCE.
*/
#ifdef _XOPEN_SOURCE
# if (_XOPEN_SOURCE - 0 >= 700)
# define __XPG_VISIBLE 700
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200809L
# elif (_XOPEN_SOURCE - 0 >= 600)
# define __XPG_VISIBLE 600
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
# elif (_XOPEN_SOURCE - 0 >= 520)
# define __XPG_VISIBLE 520
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 199506L
# elif (_XOPEN_SOURCE - 0 >= 500)
# define __XPG_VISIBLE 500
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 199506L
# elif (_XOPEN_SOURCE_EXTENDED - 0 == 1)
# define __XPG_VISIBLE 420
# elif (_XOPEN_VERSION - 0 >= 4)
# define __XPG_VISIBLE 400
# else
# define __XPG_VISIBLE 300
# endif
#endif
/*
* POSIX macros, these checks must follow the XOPEN ones above.
*
* _POSIX_SOURCE == 1 1003.1-1988 (superseded by _POSIX_C_SOURCE)
* _POSIX_C_SOURCE == 1 1003.1-1990
* _POSIX_C_SOURCE == 2 1003.2-1992
* _POSIX_C_SOURCE == 199309L 1003.1b-1993
* _POSIX_C_SOURCE == 199506L 1003.1c-1995, 1003.1i-1995,
* and the omnibus ISO/IEC 9945-1:1996
* _POSIX_C_SOURCE == 200112L 1003.1-2001
* _POSIX_C_SOURCE == 200809L 1003.1-2008
*
* The POSIX spec implies a specific value for __ISO_C_VISIBLE, though
* this may be overridden by the _ISOC99_SOURCE macro later.
*/
#ifdef _POSIX_C_SOURCE
# if (_POSIX_C_SOURCE - 0 >= 200809)
# define __POSIX_VISIBLE 200809
# define __ISO_C_VISIBLE 1999
# elif (_POSIX_C_SOURCE - 0 >= 200112)
# define __POSIX_VISIBLE 200112
# define __ISO_C_VISIBLE 1999
# elif (_POSIX_C_SOURCE - 0 >= 199506)
# define __POSIX_VISIBLE 199506
# define __ISO_C_VISIBLE 1990
# elif (_POSIX_C_SOURCE - 0 >= 199309)
# define __POSIX_VISIBLE 199309
# define __ISO_C_VISIBLE 1990
# elif (_POSIX_C_SOURCE - 0 >= 2)
# define __POSIX_VISIBLE 199209
# define __ISO_C_VISIBLE 1990
# else
# define __POSIX_VISIBLE 199009
# define __ISO_C_VISIBLE 1990
# endif
#elif defined(_POSIX_SOURCE)
# define __POSIX_VISIBLE 198808
# define __ISO_C_VISIBLE 0
#endif
/*
* _ANSI_SOURCE means to expose ANSI C89 interfaces only.
* If the user defines it in addition to one of the POSIX or XOPEN
* macros, assume the POSIX/XOPEN macro(s) should take precedence.
*/
#if defined(_ANSI_SOURCE) && !defined(__POSIX_VISIBLE) && \
!defined(__XPG_VISIBLE)
# define __POSIX_VISIBLE 0
# define __XPG_VISIBLE 0
# define __ISO_C_VISIBLE 1990
#endif
/*
* _ISOC99_SOURCE and __STDC_VERSION__ override any of the other macros since
* they are non-exclusive.
*/
#if defined(_ISOC99_SOURCE) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) || \
(defined(__cplusplus) && __cplusplus >= 201103)
# undef __ISO_C_VISIBLE
# define __ISO_C_VISIBLE 1999
#endif
/*
* Finally deal with BSD-specific interfaces that are not covered
* by any standards. We expose these when none of the POSIX or XPG
* macros is defined or if the user explicitly asks for them.
*/
#if !defined(_BSD_SOURCE) && \
(defined(_ANSI_SOURCE) || defined(__XPG_VISIBLE) || defined(__POSIX_VISIBLE))
# define __BSD_VISIBLE 0
#endif
/*
* Default values.
*/
#ifndef __XPG_VISIBLE
# define __XPG_VISIBLE 700
#endif
#ifndef __POSIX_VISIBLE
# define __POSIX_VISIBLE 200809
#endif
#ifndef __ISO_C_VISIBLE
# define __ISO_C_VISIBLE 1999
#endif
#ifndef __BSD_VISIBLE
# define __BSD_VISIBLE 1
#endif
#endif /* !_SYS_CDEFS_H_ */

View File

@@ -0,0 +1,243 @@
/* $OpenBSD: types.h,v 1.32 2011/03/19 18:26:06 deraadt Exp $ */
/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.4 (Berkeley) 1/21/94
*/
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <machine/endian.h>
#if __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned char unchar; /* Sys V compatibility */
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
typedef unsigned long ulong; /* Sys V compatibility */
typedef __cpuid_t cpuid_t; /* CPU id */
typedef __register_t register_t; /* register-sized type */
#endif /* __BSD_VISIBLE */
/*
* XXX The exact-width bit types should only be exposed if __BSD_VISIBLE
* but the rest of the includes are not ready for that yet.
*/
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
#endif
#ifndef _INT8_T_DEFINED_
#define _INT8_T_DEFINED_
typedef __int8_t int8_t;
#endif
#ifndef _UINT8_T_DEFINED_
#define _UINT8_T_DEFINED_
typedef __uint8_t uint8_t;
#endif
#ifndef _INT16_T_DEFINED_
#define _INT16_T_DEFINED_
typedef __int16_t int16_t;
#endif
#ifndef _UINT16_T_DEFINED_
#define _UINT16_T_DEFINED_
typedef __uint16_t uint16_t;
#endif
#ifndef _INT32_T_DEFINED_
#define _INT32_T_DEFINED_
typedef __int32_t int32_t;
#endif
#ifndef _UINT32_T_DEFINED_
#define _UINT32_T_DEFINED_
typedef __uint32_t uint32_t;
#endif
#ifndef _INT64_T_DEFINED_
#define _INT64_T_DEFINED_
typedef __int64_t int64_t;
#endif
#ifndef _UINT64_T_DEFINED_
#define _UINT64_T_DEFINED_
typedef __uint64_t uint64_t;
#endif
/* BSD-style unsigned bits types */
typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
/* quads, deprecated in favor of 64 bit int types */
typedef __int64_t quad_t;
typedef __uint64_t u_quad_t;
typedef quad_t * qaddr_t;
#if __BSD_VISIBLE
/* VM system types */
typedef __vaddr_t vaddr_t;
typedef __paddr_t paddr_t;
typedef __vsize_t vsize_t;
typedef __psize_t psize_t;
#endif /* __BSD_VISIBLE */
/* Standard system types */
typedef char * caddr_t; /* core address */
typedef __int32_t daddr32_t; /* 32-bit disk address */
typedef __int64_t daddr_t; /* 64-bit disk address */
typedef __int64_t daddr64_t; /* 64-bit disk address */
typedef __dev_t dev_t; /* device number */
typedef __fixpt_t fixpt_t; /* fixed point number */
typedef __gid_t gid_t; /* group id */
typedef __id_t id_t; /* may contain pid, uid or gid */
typedef __ino_t ino_t; /* inode number */
typedef __key_t key_t; /* IPC key (for Sys V IPC) */
typedef __mode_t mode_t; /* permissions */
typedef __nlink_t nlink_t; /* link count */
typedef __pid_t pid_t; /* process id */
typedef __rlim_t rlim_t; /* resource limit */
typedef __segsz_t segsz_t; /* segment size */
typedef __swblk_t swblk_t; /* swap offset */
typedef __uid_t uid_t; /* user id */
typedef __useconds_t useconds_t; /* microseconds */
typedef __suseconds_t suseconds_t; /* microseconds (signed) */
typedef __fsblkcnt_t fsblkcnt_t; /* file system block count */
typedef __fsfilcnt_t fsfilcnt_t; /* file system file count */
/*
* XPG4.2 states that inclusion of <netinet/in.h> must pull these
* in and that inclusion of <sys/socket.h> must pull in sa_family_t.
* We put these here because there are other headers that require
* these types and <sys/socket.h> and <netinet/in.h> will indirectly
* include <sys/types.h>.
* XXX - now that we have protected versions these should move.
*/
typedef __in_addr_t in_addr_t; /* base type for internet address */
typedef __in_port_t in_port_t; /* IP port type */
typedef __sa_family_t sa_family_t; /* sockaddr address family type */
typedef __socklen_t socklen_t; /* length type for network syscalls */
/*
* The following types may be defined in multiple header files.
*/
#ifndef _CLOCK_T_DEFINED_
#define _CLOCK_T_DEFINED_
typedef __clock_t clock_t;
#endif
#ifndef _CLOCKID_T_DEFINED_
#define _CLOCKID_T_DEFINED_
typedef __clockid_t clockid_t;
#endif
#ifndef _SIZE_T_DEFINED_
#define _SIZE_T_DEFINED_
typedef __size_t size_t;
#endif
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
typedef __ssize_t ssize_t;
#endif
#ifndef _TIME_T_DEFINED_
#define _TIME_T_DEFINED_
typedef __time_t time_t;
#endif
#ifndef _TIMER_T_DEFINED_
#define _TIMER_T_DEFINED_
typedef __timer_t timer_t;
#endif
#ifndef _OFF_T_DEFINED_
#define _OFF_T_DEFINED_
typedef __off_t off_t;
#endif
/*
* These belong in unistd.h, but are placed here too to ensure that
* long arguments will be promoted to off_t if the program fails to
* include that header or explicitly cast them to off_t.
*/
#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 /* __BSD_VISIBLE && !_KERNEL */
#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 __BSD_VISIBLE
#include <sys/select.h> /* must be after type declarations */
#endif
#if defined(__STDC__) && defined(_KERNEL)
/*
* Forward structure declarations for function prototypes. We include the
* common structures that cross subsystem boundaries here; others are mostly
* used in the same place that the structure is defined.
*/
struct proc;
struct pgrp;
struct ucred;
struct rusage;
struct file;
struct buf;
struct tty;
struct uio;
#endif
#endif /* !_SYS_TYPES_H_ */

View File

@@ -0,0 +1,159 @@
/* $OpenBSD: unistd.h,v 1.19 2011/10/15 23:35:29 guenther Exp $ */
/* $NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)unistd.h 8.2 (Berkeley) 1/7/94
*/
#ifndef _SYS_UNISTD_H_
#define _SYS_UNISTD_H_
#include <sys/cdefs.h>
/* compile-time symbolic constants */
/* implementation supports job control */
#define _POSIX_JOB_CONTROL 1
/* saved set-user-ID and set-group-ID */
#define _POSIX_SAVED_IDS 1
#define _POSIX_VERSION 199009L
#define _POSIX2_VERSION 199212L
/* execution-time symbolic constants */
/* chown requires appropriate privileges */
#define _POSIX_CHOWN_RESTRICTED 1
/* too-long path components generate errors */
#define _POSIX_NO_TRUNC 1
/* may disable terminal special characters */
#define _POSIX_VDISABLE (0377)
/* file synchronization is available */
#define _POSIX_FSYNC 1
/* access function */
#define F_OK 0 /* test for existence of file */
#define X_OK 0x01 /* test for execute or search permission */
#define W_OK 0x02 /* test for write permission */
#define R_OK 0x04 /* test for read permission */
/* whence values for lseek(2) */
#define SEEK_SET 0 /* set file offset to offset */
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
#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
#define L_XTND SEEK_END
/* the parameters argument passed to the __tfork() syscall */
struct __tfork {
void *tf_tcb;
pid_t *tf_tid;
int tf_flags;
};
#endif
/* configurable pathname variables */
#define _PC_LINK_MAX 1
#define _PC_MAX_CANON 2
#define _PC_MAX_INPUT 3
#define _PC_NAME_MAX 4
#define _PC_PATH_MAX 5
#define _PC_PIPE_BUF 6
#define _PC_CHOWN_RESTRICTED 7
#define _PC_NO_TRUNC 8
#define _PC_VDISABLE 9
/* configurable system variables */
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
#define _SC_CLK_TCK 3
#define _SC_NGROUPS_MAX 4
#define _SC_OPEN_MAX 5
#define _SC_JOB_CONTROL 6
#define _SC_SAVED_IDS 7
#define _SC_VERSION 8
#define _SC_BC_BASE_MAX 9
#define _SC_BC_DIM_MAX 10
#define _SC_BC_SCALE_MAX 11
#define _SC_BC_STRING_MAX 12
#define _SC_COLL_WEIGHTS_MAX 13
#define _SC_EXPR_NEST_MAX 14
#define _SC_LINE_MAX 15
#define _SC_RE_DUP_MAX 16
#define _SC_2_VERSION 17
#define _SC_2_C_BIND 18
#define _SC_2_C_DEV 19
#define _SC_2_CHAR_TERM 20
#define _SC_2_FORT_DEV 21
#define _SC_2_FORT_RUN 22
#define _SC_2_LOCALEDEF 23
#define _SC_2_SW_DEV 24
#define _SC_2_UPE 25
#define _SC_STREAM_MAX 26
#define _SC_TZNAME_MAX 27
#define _SC_PAGESIZE 28
#define _SC_PAGE_SIZE _SC_PAGESIZE /* 1170 compatibility */
#define _SC_FSYNC 29
#define _SC_XOPEN_SHM 30
#define _SC_SEM_NSEMS_MAX 31
#define _SC_SEM_VALUE_MAX 32
#define _SC_HOST_NAME_MAX 33
/* P1003.1c */
#define _SC_GETGR_R_SIZE_MAX 100
#define _SC_GETPW_R_SIZE_MAX 101
#define _SC_LOGIN_NAME_MAX 102
#define _SC_THREAD_SAFE_FUNCTIONS 103
#ifdef notyet
#define _SC_THREAD_DESTRUCTOR_ITERATIONS
#define _SC_THREAD_KEYS_MAX
#define _SC_THREAD_STACK_MIN
#define _SC_THREAD_THREADS_MAX
#define _SC_TTY_NAME_MAX
#define _SC_THREADS
#define _SC_THREAD_ATTR_STACKADDR
#define _SC_THREAD_ATTR_STACKSIZE
#define _SC_THREAD_PRIORITY_SCHEDULING
#define _SC_THREAD_PRIO_INHERIT
#define _SC_THREAD_PRIO_PROTECT
#define _SC_THREAD_PROCESS_SHARED
#endif
#define _SC_PHYS_PAGES 500
#define _SC_AVPHYS_PAGES 501
#define _SC_NPROCESSORS_CONF 502
#define _SC_NPROCESSORS_ONLN 503
/* configurable system strings */
#define _CS_PATH 1
#endif /* !_SYS_UNISTD_H_ */