summaryrefslogtreecommitdiffstats
path: root/fastos/src/vespa/fastos/types.h
blob: 08ad40ac8becca5cd1ba8465064f4b636ea0c66a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
//****************************************************************************
/**
 * @file
 * Type definitions used in FastOS.
 * @author  Oivind H. Danielsen
 * @date    Creation date: 2000-01-18
 *****************************************************************************/


#pragma once

/**
 * @def __STDC_LIMIT_MACROS
 * According to C99, C++ implementations will only define UINT64_MAX
 * etc when __STDC_LIMIT_MACROS is defined when including stdint.h.
 * UINT64_C etc will only be defined when __STDC_CONSTANT_MACROS is
 * defined.  Since this file can be included from any of the files
 * below, we define the behaviour here.
 */
#ifndef __STDC_LIMIT_MACROS
  #define __STDC_LIMIT_MACROS 1
#endif
#ifndef __STDC_CONSTANT_MACROS
  #define __STDC_CONSTANT_MACROS 1
#endif
#ifndef __STDC_FORMAT_MACROS
  #define __STDC_FORMAT_MACROS
#endif

#include <assert.h>

#include <pthread.h>
#include <sys/mman.h>

#ifdef __TYPES_H_PTHREAD_U98
#undef __USE_UNIX98
#endif

#include <sys/types.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#include <rpc/types.h>
#include <stdarg.h>
#include <ctype.h>

#ifndef __USE_UNIX98
#define __TYPES_H_UNISTD_U98
#define __USE_UNIX98
#endif
#include <unistd.h>
#ifdef __TYPES_H_UNISTD_U98
#undef __USE_UNIX98
#endif

#include <dirent.h>

#include <sys/socket.h>

#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

#include <sys/resource.h>
#include <signal.h>

#include <sys/time.h>
#include <time.h>

#ifndef __USE_GNU
#define __USE_GNU  /* for O_DIRECT define */
#define __TYPES_H_DIRECTIO_GNU
#endif

#include <fcntl.h>

#ifdef __TYPES_H_DIRECTIO_GNU
#undef __USE_GNU  /* for O_DIRECT define */
#endif

#include <stdio.h>
#include <stdlib.h>

#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <limits.h>
#include <float.h>
#include <netinet/tcp.h>
#include <inttypes.h>
#include <getopt.h>

#if (__WORDSIZE == 64)

#else
  #error "Only LP 64 environments are supported."
#endif

#define FASTOS_PREFIX(a) FastOS_##a

#define FASTOS_EMFILE_VERIFIED (-1)
#ifdef EMFILE
#undef  FASTOS_EMFILE_VERIFIED
#define FASTOS_EMFILE_VERIFIED EMFILE
#endif

#define FASTOS_ENFILE_VERIFIED (-1)
#ifdef ENFILE
#undef  FASTOS_ENFILE_VERIFIED
#define FASTOS_ENFILE_VERIFIED ENFILE
#endif