KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
_types.h
Go to the documentation of this file.
1/** \file sys/_types.h
2 \brief Internal typedefs.
3 \ingroup system_types
4
5 This file contains internal typedefs required by libc. You probably
6 shouldn't use any of these in your code. Most of these are copied from
7 newlib's %sys/_types.h.
8*/
9
10#ifndef _SYS__TYPES_H
11#define _SYS__TYPES_H
12
13#include <kos/cdefs.h>
14__BEGIN_DECLS
15
16#include <sys/lock.h>
17#include <newlib.h>
18#include <sys/_pthreadtypes.h>
19
20/** \addtogroup system_types
21 @{
22*/
23
24/* This part copied from newlib's sys/_types.h. */
25#ifndef __off_t_defined
26/** \brief File offset type. */
27typedef long _off_t;
29#endif
30
31#ifndef __dev_t_defined
32/** \brief Device ID type. */
33typedef short __dev_t;
34#endif
35
36#ifndef __uid_t_defined
37/** \brief User ID type. */
38typedef unsigned short __uid_t;
39#endif
40#ifndef __gid_t_defined
41/** \brief Group ID type. */
42typedef unsigned short __gid_t;
43#endif
44
45#ifndef __off64_t_defined
46/** \brief 64-bit file offset type. */
47__extension__ typedef long long _off64_t;
48#endif
49
50#ifndef __fpos_t_defined
51/** \brief File position type. */
52typedef long _fpos_t;
53#endif
54
55#ifdef __LARGE64_FILES
56#ifndef __fpos64_t_defined
57/** \brief 64-bit file position type. */
58typedef _off64_t _fpos64_t;
59#endif
60#endif
61
62#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
63/** \brief Signed size type. */
64typedef int _ssize_t;
65#else
66typedef long _ssize_t;
67#endif
68
69/** \cond */
70#define __need_wint_t
71#include <stddef.h>
72/** \endcond */
73
74#ifndef __mbstate_t_defined
75/** \brief Conversion state information.
76 \headerfile sys/_types.h
77*/
78typedef struct {
80 union {
81 wint_t __wch;
82 unsigned char __wchb[4];
83 } __value; /* Value so far. */
85#endif
86
87#ifndef __flock_t_defined
88/** \brief File lock type. */
89typedef __newlib_recursive_lock_t _flock_t;
90#endif
91
92#ifndef __iconv_t_defined
93/** \brief Iconv descriptor type. */
94typedef void *_iconv_t;
95#endif
96
97#ifndef __blkcnt_t_defined
98typedef long __blkcnt_t;
99#endif
100
101#ifndef __blksize_t_defined
102typedef long __blksize_t;
103#endif
104
105#ifndef __daddr_t_defined
106typedef long __daddr_t;
107#endif
108
109#ifndef __fsblkcnt_t_defined
110typedef unsigned long long __fsblkcnt_t;
111#endif
112
113#ifndef __fsfilcnt_t_defined
114typedef unsigned long __fsfilcnt_t;
115#endif
116
117#ifndef __id_t_defined
118typedef unsigned long __id_t;
119#endif
120
121#ifndef __ino_t_defined
122typedef unsigned long __ino_t;
123#endif
124
125#ifndef __pid_t_defined
126typedef int __pid_t;
127#endif
128
129#ifndef __key_t_defined
130typedef long __key_t;
131#endif
132
133#ifndef __mode_t_defined
134typedef unsigned long __mode_t;
135#endif
136
137typedef unsigned short __nlink_t;
138typedef long __suseconds_t; /* microseconds (signed) */
139typedef unsigned long __useconds_t; /* microseconds (unsigned) */
140
141#if __NEWLIB__ >= 3
142#define _TIME_T_ long long
143#else
144#define _TIME_T_ long
145#endif
147
148#ifndef __clockid_t_defined
149#define _CLOCKID_T_ unsigned long
150#endif
151
153
154#define _TIMER_T_ unsigned long
156
157#ifndef __clock_t_defined
158#define _CLOCK_T_ unsigned long /* clock() */
159#endif
160
162
163/* The architecture should define the macro BYTE_ORDER in <arch/types.h> to
164 equal one of these macros for code that looks for these BSD-style macros. */
165/** \brief Little Endian test macro */
166#define LITTLE_ENDIAN 1234
167
168/** \brief Big Endian test macro */
169#define BIG_ENDIAN 4321
170
171/** \brief PDP Endian test macro */
172#define PDP_ENDIAN 3412
173
174/* Sigh... for some reason, Newlib only bothers defining these on Cygwin...
175 We're only actually concerned with AT_SYMLINK_NOFOLLOW currently. These
176 should all be defined in <fcntl.h>, by the way. */
177#ifndef AT_EACCESS
178/** \brief Check access using effective user and group ID */
179#define AT_EACCESS 1
180#endif
181
182#ifndef AT_SYMLINK_NOFOLLOW
183/** \brief Do not follow symlinks */
184#define AT_SYMLINK_NOFOLLOW 2
185#endif
186
187#ifndef AT_SYMLINK_FOLLOW
188/** \brief Follow symbolic links */
189#define AT_SYMLINK_FOLLOW 4
190#endif
191
192#ifndef AT_REMOVEDIR
193/** \brief Remove directory instead of file */
194#define AT_REMOVEDIR 8
195#endif
196
197#ifndef IOV_MAX
198/** \brief Maximum length of an iovec, in elements. */
199#define IOV_MAX 1024
200#endif
201
202/* This is for old KOS source compatibility. */
203#include <arch/types.h>
204
205#if __GNUC_MINOR__ > 95 || __GNUC__ >= 3
206typedef __builtin_va_list __va_list;
207#else
208typedef char * __va_list;
209#endif
210
211/** @} */
212
213__END_DECLS
214
215#endif /* _SYS__TYPES_H */
216
217/* Grab our C11 time stuff if we got here from <time.h>. */
218#ifdef _TIME_H_
219#include <kos/time.h>
220#endif
221
222#ifdef _STDLIB_H_
223#include <kos/stdlib.h>
224#endif
Various common macros used throughout the codebase.
#define __extension__
Definition cdefs.h:200
_CLOCKID_T_ __clockid_t
Definition _types.h:152
long __blksize_t
Definition _types.h:102
_CLOCK_T_ __clock_t
Definition _types.h:161
unsigned long __ino_t
Definition _types.h:122
#define _CLOCKID_T_
Definition _types.h:149
long __daddr_t
Definition _types.h:106
unsigned short __uid_t
User ID type.
Definition _types.h:38
long long _off64_t
64-bit file offset type.
Definition _types.h:47
unsigned long __mode_t
Definition _types.h:134
unsigned long long __fsblkcnt_t
Definition _types.h:110
unsigned long __useconds_t
Definition _types.h:139
_TIME_T_ __time_t
Definition _types.h:146
__newlib_recursive_lock_t _flock_t
File lock type.
Definition _types.h:89
long _ssize_t
Definition _types.h:66
char * __va_list
Definition _types.h:208
short __dev_t
Device ID type.
Definition _types.h:33
long _off_t
File offset type.
Definition _types.h:27
_off_t __off_t
Definition _types.h:28
unsigned long __id_t
Definition _types.h:118
#define _CLOCK_T_
Definition _types.h:158
void * _iconv_t
Iconv descriptor type.
Definition _types.h:94
#define _TIME_T_
Definition _types.h:144
long _fpos_t
File position type.
Definition _types.h:52
int __pid_t
Definition _types.h:126
unsigned short __nlink_t
Definition _types.h:137
long __blkcnt_t
Definition _types.h:98
#define _TIMER_T_
Definition _types.h:154
_TIMER_T_ __timer_t
Definition _types.h:155
long __suseconds_t
Definition _types.h:138
unsigned long __fsfilcnt_t
Definition _types.h:114
long __key_t
Definition _types.h:130
unsigned short __gid_t
Group ID type.
Definition _types.h:42
KOS-specific patching for newlib's <sys/lock.h>
KOS-implementation of select POSIX extensions.
Conversion state information.
Definition _types.h:78
wint_t __wch
Definition _types.h:81
int __count
Definition _types.h:79
KOS-implementation of select C11 and POSIX extensions.
Common integer types.