source: rtems-libbsd/rtemsbsd/freebsd/machine/rtems-bsd-config.h.in @ 14d4d7a

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 14d4d7a was 14d4d7a, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 6, 2012 at 6:05:53 PM

rtems-bsd-config.h.in: Add FreeBSD macros missing in RTEMS

The following were assumed to be present by multiple libc
methods or networking commands:

+ _PATH_DEVNULL ==> /dev/null
+ SIZE_T_MAX ==> SIZE_MAX
+ O_EXLOCK ==> O_EXCL

  • Property mode set to 100644
File size: 6.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_machine
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_
24#define _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_
25
26/* We compile for RTEMS and FreeBSD */
27#define __rtems__ 1
28#define __FreeBSD__ 1
29#define __BSD_VISIBLE 1
30
31/* XXX hack so /opt.../machine/param.h can disable MSIZE and use this one */
32#define __NEW_RTEMS_BSD__
33
34#ifndef _RTEMS_BSD_BSD_HH_
35/* General defines to activate BSD kernel parts */
36#define _KERNEL 1
37
38/* Disable standard system headers */
39#undef _SYS_UNISTD_H
40#define _SYS_UNISTD_H 1
41#undef _SYS_TTYCOM_H_
42#define _SYS_TTYCOM_H_ 1
43
44/* Disable some quirks in the standard headers */
45#define _POSIX_SOURCE 1
46
47/* We need POSIX threads */
48#define _POSIX_THREADS 1
49
50#endif /* !_RTEMS_BSD_BSD_HH_ */
51
52/* Type set from the C standard */
53#include <stdarg.h>
54#include <stddef.h>
55#include <stdint.h>
56#include <limits.h>
57#include <string.h>
58#include <stdio.h>
59#include <stdlib.h>
60#include <errno.h>
61#include <sys/types.h>
62
63/* Ensure that we are RTEMS compatible and can use RTEMS */
64#include <rtems.h>
65#include <rtems/error.h>
66#include <rtems/chain.h>
67#include <rtems/libio.h>
68
69#ifndef _RTEMS_BSD_BSD_HH_
70/* Ensure that we can use POSIX threads */
71#include <pthread.h>
72
73/* The BSD kernel is not a POSIX source */
74#undef _POSIX_SOURCE
75
76/* Symbol undefines */
77#undef MAXPATHLEN
78
79#endif /* !_RTEMS_BSD_BSD_HH_ */
80
81/* Networking */
82#define IPSEC 1
83#define INET  1
84#define INET6 1
85#define TCP_SIGNATURE 1
86
87/* Integer type definitions */
88
89#define __INT_MAX INT_MAX
90#define GID_MAX   UINT_MAX  /* max value for a gid_t */
91#define UID_MAX   UINT_MAX  /* max value for a uid_t */
92
93#define __int8_t int8_t
94#define __int16_t int16_t
95#define __int32_t int32_t
96#define __int64_t int64_t
97
98#define __int_least8_t int_least8_t
99#define __int_least16_t int_least16_t
100#define __int_least32_t int_least32_t
101#define __int_least64_t int_least64_t
102
103#define __int_fast8_t int_fast8_t
104#define __int_fast16_t int_fast16_t
105#define __int_fast32_t int_fast32_t
106#define __int_fast64_t int_fast64_t
107
108#define __uint8_t uint8_t
109#define __uint16_t uint16_t
110#define __uint32_t uint32_t
111#define __uint64_t uint64_t
112
113#define __uint_least8_t uint_least8_t
114#define __uint_least16_t uint_least16_t
115#define __uint_least32_t uint_least32_t
116#define __uint_least64_t uint_least64_t
117
118#define __uint_fast8_t uint_fast8_t
119#define __uint_fast16_t uint_fast16_t
120#define __uint_fast32_t uint_fast32_t
121#define __uint_fast64_t uint_fast64_t
122
123#define __intfptr_t intptr_t
124#define __uintfptr_t uintptr_t
125
126#define __intptr_t intptr_t
127#define __uintptr_t uintptr_t
128
129#define __intmax_t intmax_t
130#define __uintmax_t uintmax_t
131
132#define __register_t int
133#define __u_register_t unsigned int
134
135#define __float_t float
136#define __double_t double
137
138#define __vm_offset_t uintptr_t
139#define __vm_ooffset_t uint64_t
140#define __vm_paddr_t uintptr_t
141#define __vm_pindex_t uint64_t
142#define __vm_size_t uintptr_t
143
144#define __clock_t clock_t
145#define __cpumask_t unsigned int
146#define __critical_t intptr_t
147#define __ptrdiff_t ptrdiff_t
148#define __segsz_t intptr_t
149#define __time_t time_t
150
151#define __va_list va_list
152
153#undef __size_t
154#define __size_t size_t
155
156#define _CLOCKID_T_DECLARED 1
157#define _DEV_T_DECLARED 1
158#define _GID_T_DECLARED 1
159#define _MODE_T_DECLARED 1
160#define _OFF_T_DECLARED 1
161#define _PID_T_DECLARED 1
162#define _SSIZE_T_DECLARED 1
163#define _TIMER_T_DECLARED 1
164#define _TIME_T_DECLARED 1
165#define _UID_T_DECLARED 1
166#define _USECONDS_T_DECLARED 1
167#define _FSBLKCNT_T_DECLARED 1
168#define _BLKSIZE_T_DECLARED 1
169#define _BLKCNT_T_DECLARED 1
170
171#define __dev_t _bsd_dev_t
172#define __gid_t _bsd_gid_t
173#define __off_t _bsd_off_t
174#define __pid_t _bsd_pid_t
175#define __uid_t _bsd_uid_t
176
177/* Missing error number */
178//#define ENOIOCTL EINVAL
179
180/* multiple user space methods and commands use this */
181#ifndef _PATH_DEVNULL
182#define _PATH_DEVNULL "/dev/null"
183#endif
184
185/* used by some user space code */
186#ifndef SIZE_T_MAX
187#define SIZE_T_MAX SIZE_MAX
188#endif
189
190/* used by some user space code */
191#ifndef O_EXLOCK
192#define O_EXLOCK O_EXCL
193#endif
194
195/* from limits.h on FreeBSD */
196#ifndef _POSIX_HOST_NAME_MAX
197#define _POSIX_HOST_NAME_MAX    255
198#endif
199
200#ifndef _RTEMS_BSD_BSD_HH_
201/* Symbol rename */
202
203#include <freebsd/machine/rtems-bsd-symbols.h>
204
205#define gets _bsd_gets
206#define realloc _bsd_realloc
207#define reallocf _bsd_reallocf
208#define setenv _bsd_setenv
209#define abs _bsd_abs
210#define labs _bsd_labs
211
212#define ticks _Watchdog_Ticks_since_boot
213
214/* Debug */
215
216void rtems_bsd_assert_func(const char *file, int line, const char *func, const char *expr);
217
218#define BSD_PRINTF(fmt, ...) printf("%s: " fmt, __func__, ##__VA_ARGS__)
219
220#define BSD_PANIC(fmt, ...) panic("%s: " fmt "\n",  __func__, ##__VA_ARGS__)
221
222#ifdef NDEBUG
223# define BSD_ASSERT(expr) ((void) 0)
224#else
225# define BSD_ASSERT(expr) ((expr) ? (void) 0 : rtems_bsd_assert_func(__FILE__, __LINE__, __func__, #expr))
226#endif
227
228#define BSD_ASSERT_SC(sc) BSD_ASSERT((sc) == RTEMS_SUCCESSFUL)
229
230#define BSD_ASSERT_RV(rv) BSD_ASSERT((rv) == 0)
231
232/* General definitions */
233
234#define BSD_TASK_PRIORITY_NORMAL 120
235
236#define BSD_TASK_PRIORITY_TIMER 110
237
238#define BSD_TASK_PRIORITY_INTERRUPT 100
239
240#define BSD_TASK_PRIORITY_RESOURCE_OWNER 100
241
242/* FIXME */
243#define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024)
244
245#define M_RTEMS_HEAP 0
246
247#define BSD_MAXIMUM_SLEEP_QUEUES 32
248
249extern rtems_chain_control rtems_bsd_lock_chain;
250
251extern rtems_chain_control rtems_bsd_mtx_chain;
252
253extern rtems_chain_control rtems_bsd_sx_chain;
254
255extern rtems_chain_control rtems_bsd_condvar_chain;
256
257extern rtems_chain_control rtems_bsd_callout_chain;
258
259extern rtems_chain_control rtems_bsd_thread_chain;
260
261extern rtems_chain_control rtems_bsd_malloc_chain;
262
263/* CPU definitions */
264#define cpu_spinwait()    /* nothing */
265
266#endif /* !_RTEMS_BSD_BSD_HH_ */
267
268#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ */
Note: See TracBrowser for help on using the repository browser.