home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Headers / bsd / sys / types.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-27  |  4.8 KB  |  181 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1987 Carnegie-Mellon University
  4.  * All rights reserved.  The CMU software License Agreement specifies
  5.  * the terms and conditions for use and redistribution.
  6.  */
  7. /*
  8.  * HISTORY
  9.  *  7-Jan-93  Mac Gillon (mgillon) at NeXT
  10.  *    Integrated POSIX support
  11.  *
  12.  * 27-Sep-89  Morris Meyer (mmeyer) at NeXT
  13.  *    NFS 4.0 Changes: make uid_t and gid_t signed
  14.  *
  15.  * 02-Mar-87  Mike Accetta (mja) at Carnegie-Mellon University
  16.  *    CS_BUGFIX:  Restored previous unsigned fixes for _quad and
  17.  *    off_t types by Bill Bolosky although this time under a
  18.  *    different conditional and only under -DKERNEL so that, sigh,
  19.  *    user programs which import the file but don't use the type
  20.  *    consistently won't break.  Of course, lseek takes an off_t as
  21.  *    its second paramter which can be legitimately signed.  This
  22.  *    whole thing is a hack and I suspect that eventually someone is
  23.  *    going to have to end up rewriting some kernel code.
  24.  *    [ V5.1(F4) ]
  25.  *
  26.  * 24-Oct-86  Jonathan J. Chew (jjc) at Carnegie-Mellon University
  27.  *    Added 68000 dependent definition of "label_t" and "physadr".
  28.  *    Conditionalized on whether __ASSEMBLER__ is undefined.
  29.  *
  30.  *  7-Oct-86  David L. Black (dlb) at Carnegie-Mellon University
  31.  *    Merged Multimax changes.
  32.  *
  33.  * 24-Sep-86  Michael Young (mwyoung) at Carnegie-Mellon University
  34.  *    Moved boolean declaration to its own file.
  35.  *
  36.  * 23-Aug-86  Michael Young (mwyoung) at Carnegie-Mellon University
  37.  *    Renamed "machtypes.h" to "types.h".
  38.  *
  39.  * 16-Jul-86  Bill Bolosky (bolosky) at Carnegie-Mellon University
  40.  *    CS_GENERIC: changed type quad from longs to u_longs,
  41.  *    and off_t from int to u_long.
  42.  *
  43.  * 19-Feb-86  Bill Bolosky (bolosky) at Carnegie-Mellon University
  44.  *    romp: Added alternate definitions of label_t and physaddr.
  45.  *
  46.  * 25-Jan-86  Avadis Tevanian (avie) at Carnegie-Mellon University
  47.  *    Upgraded to 4.3.
  48.  *
  49.  * 15-Jun-85  Avadis Tevanian (avie) at Carnegie-Mellon University
  50.  *    Allow for nested calls of types.h.
  51.  */
  52.  
  53. #ifndef _TYPES_
  54. #define    _TYPES_
  55.  
  56. /*
  57.  * Copyright (c) 1982, 1986 Regents of the University of California.
  58.  * All rights reserved.  The Berkeley software License Agreement
  59.  * specifies the terms and conditions for redistribution.
  60.  *
  61.  *    @(#)types.h    7.1 (Berkeley) 6/4/86
  62.  */
  63.  
  64. #ifndef    __ASSEMBLER__
  65.  
  66. /* Machine type dependent parameters. */
  67. #include <machine/endian.h>
  68.  
  69. #if !defined(KERNEL) && defined(_POSIX_SOURCE)
  70.     #include <standards.h>
  71. #endif
  72.  
  73. #ifdef _NEXT_SOURCE
  74.     /*
  75.      * Basic system types and major/minor device 
  76.      * constructing/busting macros.
  77.      */
  78.  
  79.     /* major part of a device */
  80.     #define    major(x)    ((int)(((unsigned)(x)>>8)&0377))
  81.  
  82.     /* minor part of a device */
  83.     #define    minor(x)    ((int)((x)&0377))
  84.  
  85.     /* make a device number */
  86.     #define    makedev(x,y)    ((dev_t)(((x)<<8) | (y)))
  87.  
  88.     typedef    unsigned char    u_char;
  89.     typedef    unsigned short    u_short;
  90.     typedef    unsigned int    u_int;
  91.     typedef    unsigned long    u_long;
  92.     typedef    unsigned short    ushort;        /* sys III compat */
  93.  
  94.     #import    <bsd/machine/label_t.h>
  95.  
  96.     #ifdef    KERNEL
  97.         typedef    struct    _quad { u_long val[2]; } quad;
  98.     #else    KERNEL
  99.         typedef    struct    _quad { long val[2]; } quad;
  100.     #endif    KERNEL
  101.  
  102.     typedef    long    daddr_t;
  103.     typedef    char *    caddr_t;
  104.  
  105.     #ifndef _TIME_T
  106.         #define _TIME_T
  107.         typedef    long    time_t;
  108.     #endif /* _TIME_T */
  109. #endif /* _NEXT_SOURCE */
  110.  
  111. #if defined(_POSIX_SOURCE) || defined(_NEXT_SOURCE)
  112.     #ifndef _SIZE_T
  113.         #define     _SIZE_T
  114.         #ifdef __STRICT_BSD__
  115.             typedef long size_t;
  116.         #else    
  117.             typedef unsigned long size_t;
  118.         #endif /* __STRICT_BSD__ */
  119.     #endif  /* _SIZE_T */
  120.  
  121.     typedef    short    dev_t;
  122.     typedef    short    gid_t;
  123.     typedef    short    uid_t;
  124.     #ifdef _NEXT_SOURCE
  125.         typedef    u_long    ino_t;
  126.     #else
  127.         typedef unsigned long ino_t;
  128.     #endif
  129. #endif  /* _POSIX_SOURCE || _NEXT_SOURCE */
  130.  
  131. #ifdef KERNEL 
  132.     typedef    u_long    off_t;
  133. #else
  134.     typedef    long    off_t;
  135. #endif /* KERNEL */
  136.  
  137. #if defined(_POSIX_SOURCE)
  138.     typedef int    ssize_t;
  139.     typedef int    pid_t;
  140.     typedef unsigned short     mode_t;
  141.     typedef short    nlink_t;
  142. #endif  /* _POSIX_SOURCE */
  143.  
  144. #ifdef _NEXT_SOURCE
  145.     #define    NBBY    8    /* number of bits in a byte */
  146.     /*
  147.      * Select uses bit masks of file descriptors in longs.
  148.      * These macros manipulate such bit fields (the
  149.      * filesystem macros use chars). FD_SETSIZE may be
  150.      * defined by the user, but the default here should
  151.      * be >= NOFILE (param.h).
  152.      */
  153.     #ifndef    FD_SETSIZE
  154.         #define    FD_SETSIZE    256
  155.     #endif
  156.  
  157.     typedef long    fd_mask;
  158.     #define NFDBITS    (sizeof(fd_mask) * NBBY)
  159.                     /* bits per mask */
  160.     #ifndef howmany
  161.         #define    howmany(x, y)    (((x)+((y)-1))/(y))
  162.     #endif
  163.  
  164.     typedef    struct fd_set {
  165.         fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  166.     } fd_set;
  167.  
  168.     #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= \
  169.                     (1 << ((n) % NFDBITS)))
  170.     #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= \
  171.                     ~(1 << ((n) % NFDBITS)))
  172.     #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & \
  173.                     (1 << ((n) % NFDBITS)))
  174.     #define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  175. #endif /* _NEXT_SOURCE */
  176.  
  177. #include <machine/types.h>
  178.  
  179. #endif /* __ASSEMBLER__ */
  180. #endif /* _TYPES_ */
  181.