1 | /* $Id: shtypes.h 2243 2009-01-10 02:24:02Z bird $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * Wrapper for missing types and such.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2007-2009 knut st. osmundsen <[email protected]>
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * This file is part of kBuild.
|
---|
10 | *
|
---|
11 | * kBuild is free software; you can redistribute it and/or modify
|
---|
12 | * it under the terms of the GNU General Public License as published by
|
---|
13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
14 | * (at your option) any later version.
|
---|
15 | *
|
---|
16 | * kBuild is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with kBuild; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___shtypes_h___
|
---|
28 | #define ___shtypes_h___
|
---|
29 |
|
---|
30 | #include "k/kTypes.h" /* Use these, not the ones below. */
|
---|
31 |
|
---|
32 | #include <sys/types.h>
|
---|
33 | #include <stdlib.h>
|
---|
34 | #ifndef _MSC_VER
|
---|
35 | # include <sys/signal.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifdef _MSC_VER
|
---|
39 | # include <io.h> /* intptr_t and uintptr_t */
|
---|
40 | typedef signed char int8_t;
|
---|
41 | typedef unsigned char uint8_t;
|
---|
42 | typedef short int16_t;
|
---|
43 | typedef unsigned short uint16_t;
|
---|
44 | typedef int int32_t;
|
---|
45 | typedef unsigned int uint32_t;
|
---|
46 | typedef _int64 int64_t;
|
---|
47 | typedef unsigned _int64 uint64_t;
|
---|
48 |
|
---|
49 | #define INT16_C(c) (c)
|
---|
50 | #define INT32_C(c) (c)
|
---|
51 | #define INT64_C(c) (c ## LL)
|
---|
52 |
|
---|
53 | #define UINT8_C(c) (c)
|
---|
54 | #define UINT16_C(c) (c)
|
---|
55 | #define UINT32_C(c) (c ## U)
|
---|
56 | #define UINT64_C(c) (c ## ULL)
|
---|
57 |
|
---|
58 | #define INTMAX_C(c) (c ## LL)
|
---|
59 | #define UINTMAX_C(c) (c ## ULL)
|
---|
60 |
|
---|
61 | #undef INT8_MIN
|
---|
62 | #define INT8_MIN (-0x7f-1)
|
---|
63 | #undef INT16_MIN
|
---|
64 | #define INT16_MIN (-0x7fff-1)
|
---|
65 | #undef INT32_MIN
|
---|
66 | #define INT32_MIN (-0x7fffffff-1)
|
---|
67 | #undef INT64_MIN
|
---|
68 | #define INT64_MIN (-0x7fffffffffffffffLL-1)
|
---|
69 |
|
---|
70 | #undef INT8_MAX
|
---|
71 | #define INT8_MAX 0x7f
|
---|
72 | #undef INT16_MAX
|
---|
73 | #define INT16_MAX 0x7fff
|
---|
74 | #undef INT32_MAX
|
---|
75 | #define INT32_MAX 0x7fffffff
|
---|
76 | #undef INT64_MAX
|
---|
77 | #define INT64_MAX 0x7fffffffffffffffLL
|
---|
78 |
|
---|
79 | #undef UINT8_MAX
|
---|
80 | #define UINT8_MAX 0xff
|
---|
81 | #undef UINT16_MAX
|
---|
82 | #define UINT16_MAX 0xffff
|
---|
83 | #undef UINT32_MAX
|
---|
84 | #define UINT32_MAX 0xffffffffU
|
---|
85 | #undef UINT64_MAX
|
---|
86 | #define UINT64_MAX 0xffffffffffffffffULL
|
---|
87 |
|
---|
88 | typedef int pid_t;
|
---|
89 | typedef unsigned short uid_t;
|
---|
90 | typedef unsigned short gid_t;
|
---|
91 | typedef int mode_t;
|
---|
92 | typedef intptr_t ssize_t;
|
---|
93 |
|
---|
94 | #else
|
---|
95 | # include <stdint.h>
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | struct shinstance;
|
---|
99 | typedef struct shinstance shinstance;
|
---|
100 |
|
---|
101 | #ifdef _MSC_VER
|
---|
102 | typedef uint32_t shsigset_t;
|
---|
103 | #else
|
---|
104 | typedef sigset_t shsigset_t;
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | typedef void (*shsig_t)(shinstance *, int);
|
---|
108 | typedef struct shsigaction
|
---|
109 | {
|
---|
110 | shsig_t sh_handler;
|
---|
111 | shsigset_t sh_mask;
|
---|
112 | int sh_flags;
|
---|
113 | } shsigaction_t;
|
---|
114 |
|
---|
115 | #endif
|
---|
116 |
|
---|