199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1982, 1986, 1991, 1993, 1994
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The Regents of the University of California. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (c) UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All or some portions of this file are derived from material licensed
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to the University of California by American Telephone and Telegraph
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Co. or Unix System Laboratories, Inc. and are reproduced herein with
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the permission of UNIX System Laboratories, Inc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. Neither the name of the University nor the names of its contributors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * may be used to endorse or promote products derived from this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @(#)types.h 8.6 (Berkeley) 2/19/95
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SYS_TYPES_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SYS_TYPES_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/cdefs.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Machine type dependent parameters. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <machine/endian.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/_types.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/_pthreadtypes.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __BSD_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned char u_char;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned short u_short;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned int u_int;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned long u_long;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _KERNEL
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned short ushort; /* Sys V compatibility */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned int uint; /* Sys V compatibility */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/_stdint.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint16_t u_int16_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint32_t u_int32_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint64_t u_int64_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint64_t u_quad_t; /* quads (deprecated) */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __int64_t quad_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef quad_t * qaddr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef char * caddr_t; /* core address */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef const char * c_caddr_t; /* core address, pointer to const */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _BLKSIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __blksize_t blksize_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _BLKSIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __cpuwhich_t cpuwhich_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __cpulevel_t cpulevel_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __cpusetid_t cpusetid_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _BLKCNT_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __blkcnt_t blkcnt_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _BLKCNT_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _CLOCK_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __clock_t clock_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _CLOCK_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _CLOCKID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __clockid_t clockid_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _CLOCKID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __critical_t critical_t; /* Critical section value */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __int64_t daddr_t; /* disk address */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _DEV_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __dev_t dev_t; /* device number or struct cdev */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _DEV_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _FFLAGS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __fflags_t fflags_t; /* file flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _FFLAGS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __fixpt_t fixpt_t; /* fixed point number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __fsblkcnt_t fsblkcnt_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __fsfilcnt_t fsfilcnt_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _FSBLKCNT_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _GID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __gid_t gid_t; /* group id */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _GID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _IN_ADDR_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint32_t in_addr_t; /* base type for internet address */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _IN_ADDR_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _IN_PORT_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint16_t in_port_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _IN_PORT_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _ID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __id_t id_t; /* can hold a uid_t or pid_t */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _ID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _INO_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __ino_t ino_t; /* inode number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _INO_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _KEY_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __key_t key_t; /* IPC key (for Sys V IPC) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _KEY_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _LWPID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _LWPID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _MODE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __mode_t mode_t; /* permissions */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _MODE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _ACCMODE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __accmode_t accmode_t; /* access permissions */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _ACCMODE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _NLINK_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __nlink_t nlink_t; /* link count */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _NLINK_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _OFF_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __off_t off_t; /* file offset */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _OFF_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _PID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __pid_t pid_t; /* process id */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _PID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __register_t register_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _RLIM_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __rlim_t rlim_t; /* resource limit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _RLIM_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __int64_t sbintime_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __segsz_t segsz_t; /* segment size (in pages) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __size_t size_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SSIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __ssize_t ssize_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SSIZE_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SUSECONDS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __suseconds_t suseconds_t; /* microseconds (signed) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SUSECONDS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _TIME_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __time_t time_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _TIME_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _TIMER_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __timer_t timer_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _TIMER_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _MQD_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __mqd_t mqd_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _MQD_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __u_register_t u_register_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _UID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uid_t uid_t; /* user id */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _UID_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _USECONDS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __useconds_t useconds_t; /* microseconds (unsigned) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _USECONDS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _CAP_IOCTL_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _CAP_IOCTL_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned long cap_ioctl_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _CAP_RIGHTS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _CAP_RIGHTS_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct cap_rights;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct cap_rights cap_rights_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __vm_offset_t vm_offset_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __vm_ooffset_t vm_ooffset_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __vm_paddr_t vm_paddr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __vm_pindex_t vm_pindex_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __vm_size_t vm_size_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __rman_res_t rman_res_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef _KERNEL
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int boolean_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct device *device_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __intfptr_t intfptr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX this is fixed width for historical reasons. It should have had type
199767f8919635c4928607450d9e0abb932109ceToomas Soome * __int_fast32_t. Fixed-width types should not be used unless binary
199767f8919635c4928607450d9e0abb932109ceToomas Soome * compatibility is essential. Least-width types should be used even less
199767f8919635c4928607450d9e0abb932109ceToomas Soome * since they provide smaller benefits.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX should be MD.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX this is bogus in -current, but still used for spl*().
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uintfptr_t uintfptr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef __uint64_t uoff_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef char vm_memattr_t; /* memory attribute codes */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct vm_page *vm_page_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bool_true_false_are_defined 1
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define false 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define true 1
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int _Bool;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef _Bool bool;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !__bool_true_false_are_defined && !__cplusplus */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define offsetof(type, field) __offsetof(type, field)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The following are all things that really shouldn't exist in this header,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * since its purpose is to provide typedefs, not miscellaneous doodads.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __POPCNT__
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcount16(x) __builtin_popcount((__uint16_t)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcountl(x) __builtin_popcountl((unsigned long)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcount(x) __builtin_popcount((unsigned int)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Population count algorithm using SWAR approach
199767f8919635c4928607450d9e0abb932109ceToomas Soome * - "SIMD Within A Register".
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline __uint16_t
199767f8919635c4928607450d9e0abb932109ceToomas Soome__bitcount16(__uint16_t _x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 4)) & 0x0f0f;
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 8)) & 0x00ff;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (_x);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline __uint32_t
199767f8919635c4928607450d9e0abb932109ceToomas Soome__bitcount32(__uint32_t _x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 4)) & 0x0f0f0f0f;
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 8));
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 16)) & 0x000000ff;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (_x);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __LP64__
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline __uint64_t
199767f8919635c4928607450d9e0abb932109ceToomas Soome__bitcount64(__uint64_t _x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 8));
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 16));
199767f8919635c4928607450d9e0abb932109ceToomas Soome _x = (_x + (_x >> 32)) & 0x000000ff;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (_x);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcountl(x) __bitcount64((unsigned long)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline __uint64_t
199767f8919635c4928607450d9e0abb932109ceToomas Soome__bitcount64(__uint64_t _x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (__bitcount32(_x >> 32) + __bitcount32(_x));
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcountl(x) __bitcount32((unsigned long)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __bitcount(x) __bitcount32((unsigned int)(x))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if __BSD_VISIBLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/select.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * minor() gives a cookie instead of an index since we don't want to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * change the meanings of bits 0-15 or waste time and space shifting
199767f8919635c4928607450d9e0abb932109ceToomas Soome * bits 16-31 for devices that don't use them.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * These declarations belong elsewhere, but are repeated here and in
199767f8919635c4928607450d9e0abb932109ceToomas Soome * <stdio.h> to give broken programs a better chance of working with
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 64-bit off_t's.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _KERNEL
199767f8919635c4928607450d9e0abb932109ceToomas Soome__BEGIN_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _FTRUNCATE_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _FTRUNCATE_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint ftruncate(int, off_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _LSEEK_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _LSEEK_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soomeoff_t lseek(int, off_t, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _MMAP_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _MMAP_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid * mmap(void *, size_t, int, int, int, off_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _TRUNCATE_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _TRUNCATE_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint truncate(const char *, off_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome__END_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __BSD_VISIBLE */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_SYS_TYPES_H_ */