Fork me on GitHub

root/include/fiwix/types.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/types.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_TYPES_H
   9 #define _FIWIX_TYPES_H
  10 
  11 typedef __signed__ char __s8;
  12 typedef unsigned char __u8;
  13 typedef __signed__ short int __s16;
  14 typedef unsigned short int __u16;
  15 typedef __signed__ int __s32;
  16 typedef unsigned int __u32;
  17 
  18 typedef __u16 __uid_t;
  19 typedef __u16 __gid_t;
  20 typedef __u32 __ino_t;
  21 typedef __u16 __mode_t;
  22 typedef __u16 __nlink_t;
  23 typedef __u32 __off_t;
  24 typedef __s32 __pid_t;
  25 typedef __s32 __ssize_t;
  26 typedef __u32 __size_t;
  27 typedef unsigned long int __clock_t;
  28 typedef __u32 __time_t;
  29 typedef __u16 __dev_t;
  30 typedef __u16 __key_t;
  31 typedef __s32 __blk_t;          /* must be signed in order to return -EIO */
  32 typedef __s32 __daddr_t;
  33 typedef unsigned long long int __loff_t;
  34 
  35 /* number of descriptors that can fit in an 'fd_set' */
  36 /* WARNING: this value must be the same as in the C Library */
  37 #define __FD_SETSIZE    64
  38 
  39 #define __NFDBITS       (sizeof(unsigned long int) * 8)
  40 #define __FDELT(d)      ((d) / __NFDBITS)
  41 #define __FDMASK(d)     (1 << ((d) % __NFDBITS))
  42 
  43 /* define the fd_set structure for select() */
  44 typedef struct {
  45         unsigned long int fds_bits[__FD_SETSIZE / __NFDBITS];
  46 } fd_set;
  47 
  48 #define __FD_ZERO(set)          (memset_b((void *) (set), 0, sizeof(fd_set)))
  49 #define __FD_SET(d, set)        ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
  50 #define __FD_CLR(d, set)        ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
  51 #define __FD_ISSET(d, set)      ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
  52 
  53 #endif /* _FIWIX_TYPES_H */

/* [previous][next][first][last][top][bottom][index][help] */