150 lines
3.7 KiB
Groff
150 lines
3.7 KiB
Groff
.\" @(#)types.5 1.1 92/07/30 SMI; from UCB 4.2
|
|
.TH TYPES 5 "19 October 1987"
|
|
.SH NAME
|
|
types \- primitive system data types
|
|
.SH SYNOPSIS
|
|
.B #include <sys/types.h>
|
|
.SH DESCRIPTION
|
|
.IX "types file" "" "\fLtypes\fP \(em primitive system data types"
|
|
.IX "primitive system data types" "" "primitive system data types \(em \fLtypes\fP"
|
|
.IX "system data types" "" "system data types \(em \fLtypes\fP"
|
|
.IX "data types" "" "data types \(em \fLtypes\fP"
|
|
.LP
|
|
The data types defined in the include file
|
|
are used in the
|
|
system code; some data of these types
|
|
are accessible to user code:
|
|
.LP
|
|
.nf
|
|
.ft B
|
|
.ta \w'typedef\ \ 'u +\w'minor(x)\ \ 'u +\w' short\ \ 'u
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef _TYPES_
|
|
#define _TYPES_
|
|
|
|
/*
|
|
* Basic system types.
|
|
*/
|
|
|
|
#include <sys/sysmacros.h>
|
|
|
|
typedef unsigned char u_char;
|
|
typedef unsigned short u_short;
|
|
typedef unsigned int u_int;
|
|
typedef unsigned long u_long;
|
|
typedef unsigned short ushort; /* System V compatibility */
|
|
typedef unsigned int uint; /* System V compatibility */
|
|
|
|
#ifdef vax
|
|
typedef struct _physadr { int r[1]; } *physadr;
|
|
typedef struct label_t {
|
|
int val[14];
|
|
} label_t;
|
|
#endif
|
|
#ifdef mc68000
|
|
typedef struct _physadr { short r[1]; } *physadr;
|
|
typedef struct label_t {
|
|
int val[13];
|
|
} label_t;
|
|
#endif
|
|
#ifdef sparc
|
|
typedef struct _physadr { int r[1]; } *physadr;
|
|
typedef struct label_t {
|
|
int val[2];
|
|
} label_t;
|
|
#endif
|
|
#ifdef i386
|
|
typedef struct _physadr { short r[1]; } *physadr;
|
|
typedef struct label_t {
|
|
int val[8];
|
|
} label_t;
|
|
#endif
|
|
typedef struct _quad { long val[2]; } quad;
|
|
typedef long daddr_t;
|
|
typedef char * caddr_t;
|
|
typedef u_long ino_t;
|
|
typedef long swblk_t;
|
|
typedef int size_t;
|
|
typedef long time_t;
|
|
typedef short dev_t;
|
|
typedef long off_t;
|
|
typedef u_short uid_t;
|
|
typedef u_short gid_t;
|
|
typedef long key_t;
|
|
|
|
#define NBBY 8 /* 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).
|
|
*/
|
|
#ifndef FD_SETSIZE
|
|
#define FD_SETSIZE 256
|
|
#endif
|
|
|
|
typedef long fd_mask;
|
|
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
|
|
#ifndef howmany
|
|
#ifdef sun386
|
|
#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y)))
|
|
#else
|
|
#define howmany(x, y) (((x)+((y)-1))/(y))
|
|
#endif
|
|
#endif
|
|
|
|
typedef struct fd_set {
|
|
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
|
|
} fd_set;
|
|
|
|
typedef char * addr_t;
|
|
|
|
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
|
|
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
|
|
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
|
|
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
|
|
|
|
#ifdef sparc
|
|
/*
|
|
* routines that call setjmp have strange control flow graphs,
|
|
* since a call to a routine that calls resume/longjmp will eventually
|
|
* return at the setjmp site, not the original call site. This
|
|
* utterly wrecks control flow analysis.
|
|
*/
|
|
extern int setjmp();
|
|
#pragma unknown_control_flow(setjmp)
|
|
#endif sparc
|
|
|
|
#endif _TYPES_
|
|
.ft R
|
|
.fi
|
|
.LP
|
|
The form
|
|
.I daddr_t
|
|
is used for disk addresses,
|
|
.\"except in an inode on disk,
|
|
see
|
|
.BR fs (5).
|
|
Times are encoded in seconds since 00:00:00
|
|
.SM GMT\s0,
|
|
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
|
|
.I label_t
|
|
variables are used to save the processor state
|
|
while another process is running.
|
|
.SH SEE ALSO
|
|
.BR adb (1),
|
|
.BR lseek (2),
|
|
.BR time (3C),
|
|
.BR fs (5)
|