TYPES(5) — Unix Programmer’s Manual
NAME
types − primitive system data types
SYNOPSIS
#include <sys/types.h>
DESCRIPTION
The data types defined in the include file are used in UNIX system code; some data of these types are accessible to user code:
/∗
∗ Copyright (c) 1982, 1986 Regents of the University of California.
∗ All rights reserved. The Berkeley software License Agreement
∗ specifies the terms and conditions for redistribution.
∗
∗@(#)types.h7.1 (Berkeley) 6/4/86
∗/
/∗
∗ Basic system types and major/minor device constructing/busting macros.
∗/
#ifndef _TYPES_
#define_TYPES_
/∗ major part of a device ∗/
#ifdefis68k
#definemajor(x)((int)(((unsigned)(x)>>8)&0077)) /∗ TRFS:imported dev ∗/
#elseis68k
#definemajor(x)((int)(((unsigned)(x)>>8)&0377))
#endifis68k
/∗ minor part of a device ∗/
#defineminor(x)((int)((x)&0377))
/∗ make a device number ∗/
#definemakedev(x,y)((dev_t)(((x)<<8) | (y)))
typedefunsigned charu_char;
typedefunsigned shortu_short;
typedefunsigned intu_int;
typedefunsigned longu_long;
typedefunsigned shortushort; /∗ System V compatibility ∗/
#ifdef vax
typedefstruct_physadr { int r[1]; } ∗physadr;
typedefstructlabel_t {
intval[14];
} label_t;
#endif
#ifdef mc68000
typedefstruct_physadr { int r[1]; } ∗physadr;
typedefstructlabel_t {
intval[14];
} label_t;
#endif
typedefstruct_quad { long val[2]; } quad;
typedeflongdaddr_t;
typedefchar ∗caddr_t;
#if (SYSV && !KERNEL)
typedefu_shortino_t;
#else /∗ SYSV && !KERNEL ∗/
typedefu_longino_t;
#endif /∗ SYSV && !KERNEL ∗/
typedeflongswblk_t;
typedeflongsize_t;
typedeflongtime_t;
typedefshortdev_t;
typedeflongoff_t;
typedeflongkey_t;
typedefu_shortuid_t;
typedefu_shortgid_t;
#defineNBBY8/∗ number of bits in a byte ∗/
/∗
∗ Select uses bit masks of file descriptors in longs.
∗ These macros manipulate such bit fields (the filesystem macros use chars).
∗ FD_SETSIZE may be defined by the user, but the default here
∗ should be >= NOFILE (param.h).
∗/
#ifndefFD_SETSIZE
#defineFD_SETSIZE256
#endif
typedef longfd_mask;
#define NFDBITS(sizeof(fd_mask) ∗ NBBY) /∗ bits per mask ∗/
#ifndef howmany
#definehowmany(x, y)((unsigned int)(((x)+((y)-1)))/(unsigned int)(y))
#endif
typedefstruct fd_set {
fd_maskfds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;
#defineFD_SET(n, p)((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#defineFD_CLR(n, p)((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#defineFD_ISSET(n, p)((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p)bzero((char ∗)(p), sizeof(∗(p)))
typedefunsigned charunchar; /∗ ISI: SYSV: ∗/
typedefunsigned intuint; /∗ ISI: SYSV: ∗/
typedefunsigned longulong; /∗ ISI: SYSV: ∗/
typedefshortcnt_t; /∗ ISI: SYSV: <count> type ∗/
typedeflongpaddr_t; /∗ ISI: SYSV: <physical address> type ∗/
typedefunsigned charuse_t; /∗ ISI: SYSV: use count for swap. ∗/
typedefshortindex_t; /∗ ISI: SYSV: ∗/
typedefshortlock_t; /∗ ISI: SYSV: lock work for busy wait ∗/
typedefshortsysid_t; /∗ ISI: SYSV: ∗/
/∗ Distributed UNIX hook ∗/
typedef struct cookie {/∗ ISI: SYSV: ∗/
longc_sysid;
long c_rcvd;
} ∗cookie_t;
#endif
The form daddr_t is used for disk addresses except in an i-node on disk, see fs(5). Times are encoded in seconds since 00:00:00 GMT, January 1, 1970. The major and minor parts of a device code specify kind and unit number of a device and are installation-dependent. Offsets are measured in bytes from the beginning of a file. The label_t variables are used to save the processor state while another process is running.
SEE ALSO
fs(5), time(3), lseek(2), adb(1)
4th Berkeley Distribution — May 15, 1985