/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#include <sys/feature_tests.h>
#include <sys/isa_defs.h>
/*
* Machine dependent definitions moved to <sys/machtypes.h>.
*/
#include <sys/machtypes.h>
/*
* committee's working draft for the revision of the current ISO C standard,
* required by any standard but constitute a useful, general purpose set
* of type definitions which is namespace clean with respect to all standards.
*/
#ifdef _KERNEL
#include <sys/inttypes.h>
#else /* _KERNEL */
#include <sys/int_types.h>
#endif /* _KERNEL */
#if defined(_KERNEL) || defined(_SYSCALL32)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Strictly conforming ANSI C environments prior to the 1999
* the long long data type.
*/
#if defined(_LONGLONG_TYPE)
typedef long long longlong_t;
typedef unsigned long long u_longlong_t;
#else
/* used to reserve space and generate alignment */
typedef union {
double _d;
} longlong_t;
typedef union {
double _d;
} u_longlong_t;
#endif /* defined(_LONGLONG_TYPE) */
/*
* to use them instead of int32_t and uint32_t because DEC had
* shipped 64-bit wide.
*/
#else
typedef unsigned long t_uscalar_t;
#endif /* defined(_LP64) || defined(_I32LPx) */
/*
* POSIX Extensions
*/
typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned int uint_t;
typedef unsigned long ulong_t;
#define _PTRDIFF_T
#else
#endif
#endif
/*
* VM-related types
*/
typedef short sysid_t;
typedef short index_t;
/*
* The size of off_t and related types depends on the setting of
* _FILE_OFFSET_BITS. (Note that other system headers define other types
* related to those defined here.)
*
* If _LARGEFILE64_SOURCE is defined, variants of these types that are
* explicitly 64 bits wide become available.
*/
#ifndef _OFF_T
#define _OFF_T
#endif
#if defined(_LARGEFILE64_SOURCE)
#ifdef _LP64
#else
#endif
#endif /* _LARGEFILE64_SOURCE */
#endif /* _OFF_T */
#endif
#if defined(_LARGEFILE64_SOURCE)
#ifdef _LP64
#else
#endif
#endif /* _LARGEFILE64_SOURCE */
#ifdef _LP64
#else
#endif
#if defined(__XOPEN_OR_POSIX)
#else
#ifdef _KERNEL
#endif /* _KERNEL */
#endif /* defined(__XOPEN_OR_POSIX) */
#ifdef _KERNEL
#endif /* _KERNEL */
/*
* The {u,}pad64_t types can be used in structures such that those structures
* may be accessed by code produced by compilation environments which don't
* support a 64 bit integral datatype. The intention is not to allow
* use of these fields in such environments, but to maintain the alignment
* and offsets of the structure.
*
* Similar comments for {u,}pad128_t.
*
* Note that these types do NOT generate any stronger alignment constraints
* than those available in the underlying ABI. See <sys/isa_defs.h>
*/
#if defined(_INT64_TYPE)
#else
typedef union {
double _d;
} pad64_t;
typedef union {
double _d;
} upad64_t;
#endif
typedef union {
long double _q;
} pad128_t;
typedef union {
long double _q;
} upad128_t;
#endif
/*
* Definitions remaining from previous partial support for 64-bit file
* offsets. This partial support for devices greater than 2gb requires
* compiler support for long long.
*/
#ifdef _LONG_LONG_LTOH
typedef union {
struct {
} _p;
} lloff_t;
#endif
#ifdef _LONG_LONG_HTOL
typedef union {
struct {
} _p;
} lloff_t;
#endif
#ifdef _LONG_LONG_LTOH
typedef union {
struct {
} _p;
} lldaddr_t;
#endif
#ifdef _LONG_LONG_HTOL
typedef union {
struct {
} _p;
} lldaddr_t;
#endif
/*
* The following type is for various kinds of identifiers. The
* actual type must be the same for all since some system calls
* (such as sigsend) take arguments that may be any of these
* is used to indicate what type of id is being specified --
* a process id, process group id, session id, scheduling class id,
* user id, group id, project id, task id or zone id.
*/
typedef int id_t;
#else
#endif
/*
* Type useconds_t is an unsigned integral type capable of storing
* values at least in the range of zero to 1,000,000.
*/
#ifndef _SUSECONDS_T
#define _SUSECONDS_T
#endif /* _SUSECONDS_T */
/*
* Typedefs for dev_t components.
*/
#else
#endif
/*
* The data type of a thread priority.
*/
typedef short pri_t;
/*
* The data type for a CPU flags field. (Can be extended to larger unsigned
* types, if needed, limited by ability to update atomically.)
*/
/*
* For compatibility reasons the following typedefs (prefixed o_)
* can't grow regardless of the EFT definition. Although,
* applications should not explicitly use these typedefs
* they may be included via a system header definition.
* WARNING: These typedefs may be removed in a future
* release.
* ex. the definitions in s5inode.h (now obsoleted)
* remained small to preserve compatibility
* in the S5 file system type.
*/
/*
* POSIX and XOPEN Declarations
*/
#else
#endif
#ifndef _UID_T
#define _UID_T
#endif /* _UID_T */
/*
* Any changes made to here should be reflected in corresponding
* files as described in comments.
*/
/* "Magic numbers" tagging synchronization object types */
struct {
union {
struct {
struct {
struct {
/*
* UNIX 98 Extension
*/
/*
* SUSV3
*/
typedef struct {
/*
* attributes for threads, dynamically allocated by library
*/
typedef struct _pthread_attr {
void *__pthread_attrp;
/*
* attributes for mutex, dynamically allocated by library
*/
typedef struct _pthread_mutexattr {
void *__pthread_mutexattrp;
/*
* attributes for cond, dynamically allocated by library
*/
typedef struct _pthread_condattr {
void *__pthread_condattrp;
/*
* pthread_once
*/
typedef struct _once {
/*
* UNIX 98 Extensions
* attributes for rwlock, dynamically allocated by library
*/
typedef struct _pthread_rwlockattr {
void *__pthread_rwlockattrp;
/*
* SUSV3
* attributes for pthread_barrier_t, dynamically allocated by library
*/
typedef struct {
void *__pthread_barrierattrp;
#else
#endif
#define _SIZE_T
#else
#endif
#endif /* _SIZE_T */
#ifndef _SSIZE_T
#define _SSIZE_T
#else
#endif
#endif /* _SSIZE_T */
#define _TIME_T
#endif /* _TIME_T */
#define _CLOCK_T
#endif /* ifndef _CLOCK_T */
#ifndef _CLOCKID_T
#define _CLOCKID_T
#endif /* ifndef _CLOCKID_T */
#ifndef _TIMER_T
#define _TIMER_T
#endif /* ifndef _TIMER_T */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
/* BEGIN CSTYLED */
typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
/* END CSTYLED */
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
#if defined(_LP64)
/* min value of a "long int" */
/* max value of a "long int" */
/* max of "unsigned long int" */
#else /* _ILP32 */
/* min value of a "long int" */
#endif
/* min of "long long int" */
/* max of "long long int" */
/* max of "unsigned long long int" */
#endif /* defined(_KERNEL) */
/*
* The following is the value of type id_t to use to indicate the
* caller's current id. See procset.h for the type idtype_t
* which defines which kind of id is being specified.
*/
#ifndef NODEV
#ifdef _SYSCALL32
#endif /* _SYSCALL32 */
#endif /* NODEV */
/*
* The following value of type pfn_t is used to indicate
* invalid page frame number.
*/
/* BEGIN CSTYLED */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
/* END CSTYLED */
/*
* (The select macros used to be defined here).
*/
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
/*
* _VOID was defined to be either void or char but this is not
* required because previous SunOS compilers have accepted the void
* type. However, because many system header and source files use the
* void keyword, the volatile keyword, and ANSI C function prototypes,
* non-ANSI compilers cannot compile the system anyway. The _VOID macro
* should therefore not be used and remains for source compatibility
* only.
*/
/* CSTYLED */
#define _VOID void
#ifdef __cplusplus
}
#endif
#endif /* _SYS_TYPES_H */