types.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#pragma ident "%Z%%M% %I% %E% SMI"
#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.
*/
typedef int32_t t_scalar_t;
typedef uint32_t t_uscalar_t;
#else
typedef long t_scalar_t; /* historical versions */
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;
typedef char *caddr_t; /* ?<core address> type */
typedef long daddr_t; /* <disk address> type */
typedef short cnt_t; /* ?<count> type */
#define _PTRDIFF_T
typedef long ptrdiff_t; /* pointer difference */
#else
typedef int ptrdiff_t; /* (historical version) */
#endif
#endif
/*
* VM-related types
*/
typedef long spgcnt_t; /* signed number of pages */
typedef short sysid_t;
typedef short index_t;
typedef void *timeout_id_t; /* opaque handle from timeout(9F) */
typedef void *bufcall_id_t; /* opaque handle from bufcall(9F) */
/*
* 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
typedef long off_t; /* offsets within files */
#endif
#if defined(_LARGEFILE64_SOURCE)
#ifdef _LP64
#else
#endif
#endif /* _LARGEFILE64_SOURCE */
#endif /* _OFF_T */
typedef long blkcnt_t; /* count of file blocks */
#endif
#if defined(_LARGEFILE64_SOURCE)
#ifdef _LP64
#else
#endif
#endif /* _LARGEFILE64_SOURCE */
#ifdef _LP64
typedef int blksize_t; /* used for block sizes */
#else
typedef long blksize_t; /* used for block sizes */
#endif
#if defined(__XOPEN_OR_POSIX)
#else
#endif /* defined(__XOPEN_OR_POSIX) */
/*
* 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;
typedef longlong_t offset_t;
typedef u_longlong_t u_offset_t;
typedef u_longlong_t len_t;
typedef u_longlong_t diskaddr_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
typedef long id_t; /* (historical version) */
#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
typedef long suseconds_t; /* signed # of microseconds */
#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.)
*/
typedef ushort_t cpu_flag_t;
/*
* 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.
*/
typedef short o_dev_t; /* old device type */
typedef short o_nlink_t; /* old file link type */
typedef short o_pid_t; /* old process id type */
/*
* POSIX and XOPEN Declarations
*/
typedef int key_t; /* IPC key type */
#else
#endif
#ifndef _UID_T
#define _UID_T
typedef int uid_t; /* UID type */
#else
typedef long uid_t; /* (historical version) */
#endif
#endif /* _UID_T */
/*
* Any changes made to here should be reflected in corresponding
* files as described in comments.
*/
/* "Magic numbers" tagging synchronization object types */
typedef struct _pthread_mutex { /* = mutex_t in synch.h */
struct {
union {
struct {
struct {
typedef struct _pthread_cond { /* = cond_t in synch.h */
struct {
/*
* UNIX 98 Extension
*/
typedef struct _pthread_rwlock { /* = rwlock_t in synch.h */
/*
* SUSV3
*/
typedef struct {
typedef pthread_mutex_t pthread_spinlock_t;
/*
* 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;
typedef int pid_t; /* process id type */
#else
typedef long pid_t; /* (historical version) */
#endif
#define _SIZE_T
#else
#endif
#endif /* _SIZE_T */
#ifndef _SSIZE_T
#define _SSIZE_T
typedef long ssize_t; /* size of something in bytes or -1 */
#else
typedef int ssize_t; /* (historical version) */
#endif
#endif /* _SSIZE_T */
#define _TIME_T
typedef long time_t; /* time of day in seconds */
#endif /* _TIME_T */
#define _CLOCK_T
typedef long clock_t; /* relative time in a specified resolution */
#endif /* ifndef _CLOCK_T */
#ifndef _CLOCKID_T
#define _CLOCKID_T
typedef int clockid_t; /* clock identifier type */
#endif /* ifndef _CLOCKID_T */
#ifndef _TIMER_T
#define _TIMER_T
typedef int timer_t; /* timer identifier type */
#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)
#if defined(_LP64)
/* min value of a "long int" */
#define LONG_MAX 9223372036854775807L
/* max value of a "long int" */
#define ULONG_MAX 18446744073709551615UL
/* max of "unsigned long int" */
#else /* _ILP32 */
/* min value of a "long int" */
#endif
#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.
*/
#define P_MYID (-1)
#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 */