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