MentOS  0.8.0
The Mentoring Operating System
stddef.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #ifndef NULL
10 #define NULL ((void *)0)
11 #endif
12 
13 #ifndef EOF
15 #define EOF (-1)
16 #endif
17 
19 #define BUFSIZ 512
20 
22 typedef long signed int ptrdiff_t;
23 
25 typedef unsigned char byte_t;
26 
28 typedef unsigned long size_t;
29 
31 typedef long ssize_t;
32 
34 typedef unsigned int ino_t;
35 
37 typedef unsigned int dev_t;
38 
40 typedef int uid_t;
41 
43 typedef int gid_t;
44 
46 typedef long int off_t;
47 
49 typedef unsigned int mode_t;
50 
52 typedef unsigned int pgprot_t;
53 
56 #define offsetof(type, member) \
57  ((size_t) & (((type *)0)->member))
58 
60 #if 1
61 #define container_of(ptr, type, member) \
62  ((type *)((char *)(1 ? (ptr) : &((type *)0)->member) - offsetof(type, member)))
63 #else
64 #define container_of(ptr, type, member) \
65  ((type *)((char *)ptr - offsetof(type, member)))
66 #endif
67 
69 #define alignof(type) offsetof( \
70  struct { char c; type member; }, member)
71 
73 #define count_of(x) ((sizeof(x) / sizeof((x)[0])) / ((size_t)(!(sizeof(x) % sizeof((x)[0])))))
74 
82 #define swap(a, b) \
83  do { \
84  typeof(a) temp = (a); \
85  (a) = (b); \
86  (b) = temp; \
87  } while (0)
unsigned int pgprot_t
This data-type is used to set protection bits of pages.
Definition: stddef.h:52
unsigned char byte_t
Define the byte type.
Definition: stddef.h:25
int gid_t
The type of group-id.
Definition: stddef.h:43
long ssize_t
Define the generic signed size type.
Definition: stddef.h:31
long int off_t
The type of offset.
Definition: stddef.h:46
unsigned int dev_t
Used for device IDs.
Definition: stddef.h:37
unsigned int ino_t
Define the type of an inode.
Definition: stddef.h:34
long signed int ptrdiff_t
Is the signed integer type of the result of subtracting two pointers.
Definition: stddef.h:22
unsigned long size_t
Define the generic size type.
Definition: stddef.h:28
unsigned int mode_t
The type of mode.
Definition: stddef.h:49
int uid_t
The type of user-id.
Definition: stddef.h:40