diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-09 22:52:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-10 09:08:23 +0200 |
commit | e599318e912d8836c59d8b5202e3e31a6b8dcae9 (patch) | |
tree | 1172b8b830a1c3236e45c834c2b80e01325ea144 /rtemsbsd/include | |
parent | Move files to match FreeBSD layout (diff) | |
download | rtems-libbsd-e599318e912d8836c59d8b5202e3e31a6b8dcae9.tar.bz2 |
Update files to match FreeBSD layout
Add compatibility with Newlib header files. Some FreeBSD header files
are mapped by the translation script:
o rtems/bsd/sys/_types.h
o rtems/bsd/sys/errno.h
o rtems/bsd/sys/lock.h
o rtems/bsd/sys/param.h
o rtems/bsd/sys/resource.h
o rtems/bsd/sys/time.h
o rtems/bsd/sys/timespec.h
o rtems/bsd/sys/types.h
o rtems/bsd/sys/unistd.h
It is now possible to include <sys/socket.h> directly for example.
Generate one Makefile which builds everything including tests.
Diffstat (limited to 'rtemsbsd/include')
38 files changed, 622 insertions, 264 deletions
diff --git a/rtemsbsd/include/machine/_bus.h b/rtemsbsd/include/machine/_bus.h index 436fb584..3891cb15 100644 --- a/rtemsbsd/include/machine/_bus.h +++ b/rtemsbsd/include/machine/_bus.h @@ -1 +1 @@ -#include <freebsd/machine/bus.h> +#include <machine/bus.h> diff --git a/rtemsbsd/include/machine/_limits.h b/rtemsbsd/include/machine/_limits.h index 46cac302..c7187c60 100644 --- a/rtemsbsd/include/machine/_limits.h +++ b/rtemsbsd/include/machine/_limits.h @@ -7,24 +7,43 @@ */ /* - * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH - * Obere Lagerstr. 30 + * Dornierstr. 4 * 82178 Puchheim * Germany * <rtems@embedded-brains.de> * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #ifndef _RTEMS_BSD_MACHINE__LIMITS_H_ #define _RTEMS_BSD_MACHINE__LIMITS_H_ -#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ -#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" -#endif +#include <limits.h> + +#define __CHAR_BIT CHAR_BIT + +#define __INT_MAX INT_MAX #endif /* _RTEMS_BSD_MACHINE__LIMITS_H_ */ diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h index 18689dec..28558905 100644 --- a/rtemsbsd/include/machine/bus.h +++ b/rtemsbsd/include/machine/bus.h @@ -213,15 +213,15 @@ bus_space_free(bus_space_tag_t bst __unused, bus_space_handle_t bsh, bus_size_t #if defined(__i386__) - #include <freebsd/machine/bus_space-i386.h> + #include <machine/bus_space-i386.h> #elif defined(__ppc__) - #include <freebsd/machine/bus_space-simple_memory.h> + #include <machine/bus_space-simple_memory.h> #else #warning "Bus space routines not implemented for this architecture!!" #warning "Defaulting to simple-memory Bus space routines!!" - #include <freebsd/machine/bus_space-simple_memory.h> + #include <machine/bus_space-simple_memory.h> #endif -#include <freebsd/machine/bus_dma.h> +#include <machine/bus_dma.h> #endif /* _RTEMS_BSD_MACHINE_BUS_H_ */ diff --git a/rtemsbsd/include/machine/bus_dma.h b/rtemsbsd/include/machine/bus_dma.h index 44ed7762..d4a1cfb8 100644 --- a/rtemsbsd/include/machine/bus_dma.h +++ b/rtemsbsd/include/machine/bus_dma.h @@ -27,6 +27,6 @@ #error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" #endif -#include <freebsd/sys/bus_dma.h> +#include <sys/bus_dma.h> #endif /* _RTEMS_BSD_MACHINE_BUS_DMA_H_ */ diff --git a/rtemsbsd/include/machine/bus_space-i386.h b/rtemsbsd/include/machine/bus_space-i386.h index 748d883d..67868001 100644 --- a/rtemsbsd/include/machine/bus_space-i386.h +++ b/rtemsbsd/include/machine/bus_space-i386.h @@ -114,9 +114,9 @@ #ifndef _RTEMS_BSD_MACHINE_BUS_I386_H_ #define _RTEMS_BSD_MACHINE_BUS_I386_H_ -#include <freebsd/machine/_bus.h> -#include <freebsd/machine/cpufunc.h> -#include <freebsd/machine/resource.h> +#include <machine/_bus.h> +#include <machine/cpufunc.h> +#include <machine/resource.h> #if 0 #define I386_BUS_SPACE_IO SYS_RES_IOPORT diff --git a/rtemsbsd/include/machine/elf.h b/rtemsbsd/include/machine/elf.h index 936ffd88..e69de29b 100644 --- a/rtemsbsd/include/machine/elf.h +++ b/rtemsbsd/include/machine/elf.h @@ -1 +0,0 @@ -/* EMPTY */ diff --git a/rtemsbsd/include/machine/mutex.h b/rtemsbsd/include/machine/mutex.h index 8ab14405..7b36e6b9 100644 --- a/rtemsbsd/include/machine/mutex.h +++ b/rtemsbsd/include/machine/mutex.h @@ -7,24 +7,39 @@ */ /* - * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH - * Obere Lagerstr. 30 + * Dornierstr. 4 * 82178 Puchheim * Germany * <rtems@embedded-brains.de> * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #ifndef _RTEMS_BSD_MACHINE_MUTEX_H_ #define _RTEMS_BSD_MACHINE_MUTEX_H_ -#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ -#error "the header file <freebsd/machine/rtems-bsd-config.h> must be included first" -#endif +/* Empty */ #endif /* _RTEMS_BSD_MACHINE_MUTEX_H_ */ diff --git a/rtemsbsd/include/machine/pcb.h b/rtemsbsd/include/machine/pcb.h index 936ffd88..e69de29b 100644 --- a/rtemsbsd/include/machine/pcb.h +++ b/rtemsbsd/include/machine/pcb.h @@ -1 +0,0 @@ -/* EMPTY */ diff --git a/rtemsbsd/include/machine/resource.h b/rtemsbsd/include/machine/resource.h index 9b143810..35ad0924 100644 --- a/rtemsbsd/include/machine/resource.h +++ b/rtemsbsd/include/machine/resource.h @@ -1,10 +1,32 @@ -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ -#define SYS_RES_IRQ 1 /* interrupt lines */ -#define SYS_RES_DRQ 2 /* isa dma lines */ -#define SYS_RES_MEMORY 3 /* i/o memory */ -#define SYS_RES_IOPORT 4 /* i/o ports */ -#define SYS_RES_GPIO 5 /* general purpose i/o */ +/* + * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ -#endif /* !_MACHINE_RESOURCE_H_ */ +#ifndef _RTEMS_BSD_MACHINE_RESOURCE_H_ +#define _RTEMS_BSD_MACHINE_RESOURCE_H_ + +#define SYS_RES_IRQ 1 +#define SYS_RES_DRQ 2 +#define SYS_RES_MEMORY 3 +#define SYS_RES_IOPORT 4 +#define SYS_RES_GPIO 5 + +#endif /* _RTEMS_BSD_MACHINE_RESOURCE_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-bus-dma.h b/rtemsbsd/include/machine/rtems-bsd-bus-dma.h index e9115e42..5cff23b1 100644 --- a/rtemsbsd/include/machine/rtems-bsd-bus-dma.h +++ b/rtemsbsd/include/machine/rtems-bsd-bus-dma.h @@ -47,12 +47,12 @@ #ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_ #define _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_ -#include <freebsd/sys/param.h> -#include <freebsd/sys/types.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/systm.h> -#include <freebsd/machine/bus.h> +#include <rtems/bsd/sys/param.h> +#include <rtems/bsd/sys/types.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/mutex.h> +#include <sys/systm.h> +#include <machine/bus.h> struct bus_dma_tag { bus_dma_tag_t parent; diff --git a/rtemsbsd/include/machine/rtems-bsd-config.h.in b/rtemsbsd/include/machine/rtems-bsd-config.h.in index 655d319a..64dce1cc 100644 --- a/rtemsbsd/include/machine/rtems-bsd-config.h.in +++ b/rtemsbsd/include/machine/rtems-bsd-config.h.in @@ -23,33 +23,14 @@ #ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ #define _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ -/* We compile for RTEMS and FreeBSD */ -#define __rtems__ 1 -#define __FreeBSD__ 1 -#define __BSD_VISIBLE 1 - /* XXX hack so /opt.../machine/param.h can disable MSIZE and use this one */ #define __NEW_RTEMS_BSD__ -#include <sys/cdefs.h> - -#ifndef _RTEMS_BSD_BSD_HH_ /* General defines to activate BSD kernel parts */ #define _KERNEL 1 -/* Disable standard system headers */ -#undef _SYS_UNISTD_H -#define _SYS_UNISTD_H 1 -#undef _SYS_TTYCOM_H_ -#define _SYS_TTYCOM_H_ 1 - -/* Disable some quirks in the standard headers */ -#define _POSIX_SOURCE 1 - -/* We need POSIX threads */ -#define _POSIX_THREADS 1 - -#endif /* !_RTEMS_BSD_BSD_HH_ */ +#include <sys/cdefs.h> +#include <sys/types.h> /* Type set from the C standard */ #include <stdarg.h> @@ -59,8 +40,6 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> -#include <sys/types.h> /* Ensure that we are RTEMS compatible and can use RTEMS */ #include <rtems.h> @@ -68,7 +47,6 @@ #include <rtems/chain.h> #include <rtems/libio.h> -#ifndef _RTEMS_BSD_BSD_HH_ /* Ensure that we can use POSIX threads */ #include <pthread.h> @@ -78,8 +56,6 @@ /* Symbol undefines */ #undef MAXPATHLEN -#endif /* !_RTEMS_BSD_BSD_HH_ */ - /* Networking */ #define IPSEC 1 #define INET 1 @@ -88,131 +64,26 @@ /* Integer type definitions */ -#define __INT_MAX INT_MAX -#define GID_MAX UINT_MAX /* max value for a gid_t */ -#define UID_MAX UINT_MAX /* max value for a uid_t */ - -#define __int8_t int8_t -#define __int16_t int16_t -#define __int32_t int32_t -#define __int64_t int64_t - -#define __int_least8_t int_least8_t -#define __int_least16_t int_least16_t -#define __int_least32_t int_least32_t -#define __int_least64_t int_least64_t - -#define __int_fast8_t int_fast8_t -#define __int_fast16_t int_fast16_t -#define __int_fast32_t int_fast32_t -#define __int_fast64_t int_fast64_t - -#define __uint8_t uint8_t -#define __uint16_t uint16_t -#define __uint32_t uint32_t -#define __uint64_t uint64_t - -#define __uint_least8_t uint_least8_t -#define __uint_least16_t uint_least16_t -#define __uint_least32_t uint_least32_t -#define __uint_least64_t uint_least64_t - -#define __uint_fast8_t uint_fast8_t -#define __uint_fast16_t uint_fast16_t -#define __uint_fast32_t uint_fast32_t -#define __uint_fast64_t uint_fast64_t - -#define __intfptr_t intptr_t -#define __uintfptr_t uintptr_t - -#define __intptr_t intptr_t -#define __uintptr_t uintptr_t - -#define __intmax_t intmax_t -#define __uintmax_t uintmax_t - -#define __register_t int -#define __u_register_t unsigned int - #define __float_t float #define __double_t double -#define __vm_offset_t uintptr_t -#define __vm_ooffset_t uint64_t -#define __vm_paddr_t uintptr_t -#define __vm_pindex_t uint64_t -#define __vm_size_t uintptr_t - #define __clock_t clock_t #define __cpumask_t unsigned int #define __critical_t intptr_t #define __ptrdiff_t ptrdiff_t -#define __segsz_t intptr_t #define __time_t time_t -#define __va_list va_list - -#undef __size_t -#define __size_t size_t - #define _CLOCKID_T_DECLARED 1 -#define _DEV_T_DECLARED 1 -#define _GID_T_DECLARED 1 -#define _MODE_T_DECLARED 1 -#define _OFF_T_DECLARED 1 -#define _PID_T_DECLARED 1 -#define _SSIZE_T_DECLARED 1 #define _TIMER_T_DECLARED 1 #define _TIME_T_DECLARED 1 -#define _UID_T_DECLARED 1 #define _USECONDS_T_DECLARED 1 #define _FSBLKCNT_T_DECLARED 1 #define _BLKSIZE_T_DECLARED 1 #define _BLKCNT_T_DECLARED 1 -#define __dev_t _bsd_dev_t -#define __gid_t _bsd_gid_t -#define __off_t _bsd_off_t -#define __pid_t _bsd_pid_t -#define __uid_t _bsd_uid_t - -/* Missing error number */ -//#define ENOIOCTL EINVAL - -/* multiple user space methods and commands use this */ -#ifndef _PATH_DEVNULL -#define _PATH_DEVNULL "/dev/null" -#endif - -/* used by some user space code */ -#ifndef SIZE_T_MAX -#define SIZE_T_MAX SIZE_MAX -#endif - -/* used by some user space code */ -#ifndef O_EXLOCK -#define O_EXLOCK O_EXCL -#endif - -/* used by some user space code */ -#if !defined O_NOFOLLOW -#define O_NOFOLLOW 0 -#endif - -/* used by some user space code */ -#ifndef O_SHLOCK -#define O_SHLOCK 0 -#endif - -/* from limits.h on FreeBSD */ -#ifndef _POSIX_HOST_NAME_MAX -#define _POSIX_HOST_NAME_MAX 255 -#endif - -#ifndef _RTEMS_BSD_BSD_HH_ /* Symbol rename */ -#include <freebsd/machine/rtems-bsd-symbols.h> +#include <machine/rtems-bsd-symbols.h> #define gets _bsd_gets #define realloc _bsd_realloc @@ -276,6 +147,4 @@ extern rtems_chain_control rtems_bsd_malloc_chain; /* CPU definitions */ #define cpu_spinwait() /* nothing */ -#endif /* !_RTEMS_BSD_BSD_HH_ */ - #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-devicet.h b/rtemsbsd/include/machine/rtems-bsd-devicet.h index 2db95850..9c59577b 100644 --- a/rtemsbsd/include/machine/rtems-bsd-devicet.h +++ b/rtemsbsd/include/machine/rtems-bsd-devicet.h @@ -41,7 +41,7 @@ #include <stdarg.h> #include <stdio.h> -#include <freebsd/sys/queue.h> +#include <sys/queue.h> typedef struct device *device_t; diff --git a/rtemsbsd/include/machine/rtems-bsd-endian.h b/rtemsbsd/include/machine/rtems-bsd-endian.h new file mode 100644 index 00000000..006a9f37 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-endian.h @@ -0,0 +1,107 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_ENDIAN_H +#define _RTEMS_BSD_MACHINE_ENDIAN_H + +#include <machine/endian.h> +#include <stdint.h> + +#if __BSD_VISIBLE + +#define _BYTE_ORDER BYTE_ORDER +#define _BIG_ENDIAN BIG_ENDIAN +#define _LITTLE_ENDIAN LITTLE_ENDIAN + +#if BYTE_ORDER == BIG_ENDIAN +#define __ntohl(x) ((uint32_t) (x)) +#define __ntohs(x) ((uint16_t) (x)) +#define __htonl(x) ((uint32_t) (x)) +#define __htons(x) ((uint16_t) (x)) +#else +#define __ntohl(x) (__bswap32(x)) +#define __ntohs(x) (__bswap16(x)) +#define __htonl(x) (__bswap32(x)) +#define __htons(x) (__bswap16(x)) +#endif + +static inline uint16_t +__bswap16(uint16_t v) +{ +#ifdef __GNUC__ + return __builtin_bswap16(v); +#else + return (uint16_t) ((v >> 8) + | ((v & 0xffU) << 8)); +#endif +} + +static inline uint32_t +__bswap32(uint32_t v) +{ +#ifdef __GNUC__ + return __builtin_bswap32(v); +#else + return (uint32_t) ((v >> 24) + | ((v >> 8) && 0xff00U) + | ((v & 0xff00U) << 8) + | ((v & 0xffU) << 24)); +#endif +} + +static inline uint64_t +__bswap64(uint64_t v) +{ +#ifdef __GNUC__ + return __builtin_bswap64(v); +#else + return (uint64_t) ((v >> 56) + | ((v >> 40) && 0xff00U) + | ((v >> 24) && 0xff0000U) + | ((v >> 8) && 0xff000000U) + | ((v & 0xff000000U) << 8) + | ((v & 0xff0000U) << 24) + | ((v & 0xff00U) << 40) + | ((v & 0xffU) << 56)); +#endif +} + +#endif /* __BSD_VISIBLE */ + +#endif /* _RTEMS_BSD_MACHINE_ENDIAN_H */ diff --git a/rtemsbsd/include/machine/rtems-bsd-param.h b/rtemsbsd/include/machine/rtems-bsd-param.h new file mode 100644 index 00000000..ffcbf926 --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-param.h @@ -0,0 +1,59 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + */ + +/* + * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_PARAM_H_ +#define _RTEMS_BSD_MACHINE_PARAM_H_ + +#include <machine/param.h> + +#define _ALIGNBYTES ALIGNBYTES + +#define _ALIGN(p) ALIGN(p) + +#define MAXCPU 1 + +#define CACHE_LINE_SHIFT 7 + +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + +#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ + +#define MACHINE_ARCH "rtems" + +#endif /* _RTEMS_BSD_MACHINE_PARAM_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-symbols.h b/rtemsbsd/include/machine/rtems-bsd-symbols.h index 4c3be853..5ab4a756 100644 --- a/rtemsbsd/include/machine/rtems-bsd-symbols.h +++ b/rtemsbsd/include/machine/rtems-bsd-symbols.h @@ -23,7 +23,6 @@ #ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_SYMBOLS_H_ #define _RTEMS_BSD_MACHINE_RTEMS_BSD_SYMBOLS_H_ -#define bootverbose _bsd_bootverbose #define bus_activate_resource _bsd_bus_activate_resource #define bus_activate_resource _bsd_bus_activate_resource #define bus_activate_resource_desc _bsd_bus_activate_resource_desc diff --git a/rtemsbsd/include/machine/rtems-bsd-syscall-api.h b/rtemsbsd/include/machine/rtems-bsd-syscall-api.h new file mode 100644 index 00000000..7d53606b --- /dev/null +++ b/rtemsbsd/include/machine/rtems-bsd-syscall-api.h @@ -0,0 +1,59 @@ +/** + * @file + * + * @ingroup rtems_bsd_machine + * + * @brief TODO. + * + * This file helps to ensure that the system calls match the user space + * declaration. The user space declaration is normally not visible to the + * kernel space due to the _KERNEL guard. + */ + +/* + * Copyright (c) 2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSCALL_API_H_ +#define _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSCALL_API_H_ + +#include <sys/cdefs.h> +#include <sys/select.h> + +__BEGIN_DECLS + +int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, + const struct timespec *__restrict, const sigset_t *__restrict); + +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + +__END_DECLS + +#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSCALL_API_H_ */ diff --git a/rtemsbsd/include/machine/rtems-bsd-sysinit.h b/rtemsbsd/include/machine/rtems-bsd-sysinit.h index 0e31d3ec..6242d790 100644 --- a/rtemsbsd/include/machine/rtems-bsd-sysinit.h +++ b/rtemsbsd/include/machine/rtems-bsd-sysinit.h @@ -23,9 +23,9 @@ #ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSINIT_H_ #define _RTEMS_BSD_MACHINE_RTEMS_BSD_SYSINIT_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/kernel.h> +#include <sys/cdefs.h> +#include <sys/queue.h> +#include <sys/kernel.h> #define SYSINIT_NEED_FREEBSD_CORE \ SYSINIT_REFERENCE(configure1); \ diff --git a/rtemsbsd/include/machine/smp.h b/rtemsbsd/include/machine/smp.h index 936ffd88..e69de29b 100644 --- a/rtemsbsd/include/machine/smp.h +++ b/rtemsbsd/include/machine/smp.h @@ -1 +0,0 @@ -/* EMPTY */ diff --git a/rtemsbsd/include/machine/vm.h b/rtemsbsd/include/machine/vm.h index 936ffd88..e69de29b 100644 --- a/rtemsbsd/include/machine/vm.h +++ b/rtemsbsd/include/machine/vm.h @@ -1 +0,0 @@ -/* EMPTY */ diff --git a/rtemsbsd/include/poll.h b/rtemsbsd/include/poll.h index 48572ee4..06fb41ab 100644 --- a/rtemsbsd/include/poll.h +++ b/rtemsbsd/include/poll.h @@ -1,2 +1 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/poll.h> +#include <sys/poll.h> diff --git a/rtemsbsd/include/pthread_np.h b/rtemsbsd/include/pthread_np.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/pthread_np.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/rtems/bsd/bsd.h b/rtemsbsd/include/rtems/bsd/bsd.h index 6eafb4e5..d7348420 100644 --- a/rtemsbsd/include/rtems/bsd/bsd.h +++ b/rtemsbsd/include/rtems/bsd/bsd.h @@ -7,29 +7,44 @@ */ /* - * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. + * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH - * Obere Lagerstr. 30 + * Dornierstr. 4 * 82178 Puchheim * Germany * <rtems@embedded-brains.de> * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ -#ifndef _RTEMS_BSD_BSD_HH_ -#define _RTEMS_BSD_BSD_HH_ +#ifndef _RTEMS_BSD_BSD_H_ +#define _RTEMS_BSD_BSD_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <freebsd/machine/rtems-bsd-config.h> -#include <freebsd/machine/rtems-bsd-select.h> -#include <freebsd/machine/_align.h> +#include <rtems.h> rtems_status_code rtems_bsd_initialize(void); @@ -41,4 +56,4 @@ void rtems_bsd_shell_initialize(void); } #endif /* __cplusplus */ -#endif /* _RTEMS_BSD_BSD_HH_ */ +#endif /* _RTEMS_BSD_BSD_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/local/vnode_if.h b/rtemsbsd/include/rtems/bsd/local/vnode_if.h index c90e6c8e..367a8db7 100644 --- a/rtemsbsd/include/rtems/bsd/local/vnode_if.h +++ b/rtemsbsd/include/rtems/bsd/local/vnode_if.h @@ -6,8 +6,8 @@ */ extern struct vnodeop_desc vop_default_desc; -#include <freebsd/local/vnode_if_typedef.h> -#include <freebsd/local/vnode_if_newproto.h> +#include <rtems/bsd/local/vnode_if_typedef.h> +#include <rtems/bsd/local/vnode_if_newproto.h> struct vop_islocked_args { struct vop_generic_args a_gen; struct vnode *a_vp; diff --git a/rtemsbsd/include/rtems/bsd/sys/_types.h b/rtemsbsd/include/rtems/bsd/sys/_types.h index b9f4d392..e9acaf4e 100644 --- a/rtemsbsd/include/rtems/bsd/sys/_types.h +++ b/rtemsbsd/include/rtems/bsd/sys/_types.h @@ -26,11 +26,12 @@ * $FreeBSD$ */ -#ifndef _SYS__TYPES_HH_ -#define _SYS__TYPES_HH_ +#ifndef _RTEMS_BSD_SYS__TYPES_H_ +#define _RTEMS_BSD_SYS__TYPES_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/machine/_types.h> +#include <sys/cdefs.h> +#ifndef __rtems__ +#include <machine/_types.h> /* * Standard type definitions. @@ -101,5 +102,110 @@ typedef union { char __mbstate8[128]; __int64_t _mbstateL; /* for alignment */ } __mbstate_t; +#else /* __rtems__ */ +#include <sys/types.h> -#endif /* !_SYS__TYPES_HH_ */ +#ifdef __BSD_VISIBLE + +#include <machine/rtems-bsd-endian.h> +#include <stdarg.h> + +#define _INT8_T_DECLARED +#define _UINT8_T_DECLARED + +#define _INT16_T_DECLARED +#define _UINT16_T_DECLARED + +#define _INT32_T_DECLARED +#define _UINT32_T_DECLARED + +#define _INT64_T_DECLARED +#define _UINT64_T_DECLARED + +#define _INTPTR_T_DECLARED + +#ifdef _KERNEL + +typedef int boolean_t; + +typedef struct device *device_t; + +typedef intptr_t intfptr_t; +typedef uintptr_t uintfptr_t; + +typedef uint32_t intrmask_t; + +typedef char vm_memattr_t; + +#endif /* _KERNEL */ + +typedef int accmode_t; +#define _ACCMODE_T_DECLARED + +typedef const char *c_caddr_t; + +typedef uint32_t cpumask_t; + +typedef int cpusetid_t; + +#define _DEV_T_DECLARED + +typedef uint32_t __fixpt_t; +typedef __fixpt_t fixpt_t; + +#define _GID_T_DECLARED + +typedef uint32_t in_addr_t; +#define _IN_ADDR_T_DECLARED + +typedef uint16_t in_port_t; +#define _IN_PORT_T_DECLARED + +#define _MODE_T_DECLARED + +typedef _off_t __off_t; +#define _OFF_T_DECLARED + +#define _PID_T_DECLARED + +typedef int register_t; +typedef unsigned int u_register_t; + +typedef intptr_t segsz_t; + +#undef __size_t +typedef size_t __size_t; +#define _SIZE_T_DECLARED + +#define __ssize_t ssize_t +#define _SSIZE_T_DECLARED + +#define _UID_T_DECLARED + +#define __va_list va_list + +typedef uintptr_t vm_offset_t; +typedef uint64_t vm_ooffset_t; +typedef uintptr_t vm_paddr_t; +typedef uint64_t vm_pindex_t; +typedef uintptr_t vm_size_t; + +typedef int lwpid_t; +#define _LWPID_T_DECLARED + +typedef int64_t rlim_t; +#define _RLIM_T_DECLARED + +typedef uint8_t sa_family_t; +#define _SA_FAMILY_T_DECLARED + +typedef uint32_t socklen_t; +#define _SOCKLEN_T_DECLARED + +#define SIZE_T_MAX SIZE_MAX + +#endif /* __BSD_VISIBLE */ + +#endif /* __rtems__ */ + +#endif /* !_RTEMS_BSD_SYS__TYPES_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/errno.h b/rtemsbsd/include/rtems/bsd/sys/errno.h index 9b68014d..2ed71acc 100644 --- a/rtemsbsd/include/rtems/bsd/sys/errno.h +++ b/rtemsbsd/include/rtems/bsd/sys/errno.h @@ -35,11 +35,11 @@ * $FreeBSD$ */ -#ifndef _SYS_ERRNO_HH_ -#define _SYS_ERRNO_HH_ +#ifndef _RTEMS_BSD_SYS_ERRNO_H_ +#define _RTEMS_BSD_SYS_ERRNO_H_ #ifndef _KERNEL -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS int * __error(void); __END_DECLS @@ -181,6 +181,8 @@ __END_DECLS #ifndef _POSIX_SOURCE #define ELAST 93 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ +#else /* __rtems__ */ +#include <errno.h> #endif /* __rtems__ */ #ifdef _KERNEL diff --git a/rtemsbsd/include/rtems/bsd/sys/lock.h b/rtemsbsd/include/rtems/bsd/sys/lock.h index f86ec765..f252976c 100644 --- a/rtemsbsd/include/rtems/bsd/sys/lock.h +++ b/rtemsbsd/include/rtems/bsd/sys/lock.h @@ -29,11 +29,11 @@ * $FreeBSD$ */ -#ifndef _SYS_LOCK_HH_ -#define _SYS_LOCK_HH_ +#ifndef _RTEMS_BSD_SYS_LOCK_H_ +#define _RTEMS_BSD_SYS_LOCK_H_ -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> +#include <sys/queue.h> +#include <sys/_lock.h> struct lock_list_entry; struct thread; @@ -316,4 +316,4 @@ void witness_thread_exit(struct thread *); WITNESS_CHECKORDER(&(l)->lock_object, 0, LOCK_FILE, LOCK_LINE, NULL) #endif /* _KERNEL */ -#endif /* _SYS_LOCK_HH_ */ +#endif /* _RTEMS_BSD_SYS_LOCK_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/param.h b/rtemsbsd/include/rtems/bsd/sys/param.h index cd00ea4c..93e2ef44 100644 --- a/rtemsbsd/include/rtems/bsd/sys/param.h +++ b/rtemsbsd/include/rtems/bsd/sys/param.h @@ -35,10 +35,13 @@ * $FreeBSD$ */ -#ifndef _SYS_PARAM_HH_ -#define _SYS_PARAM_HH_ +#ifndef _RTEMS_BSD_SYS_PARAM_H_ +#define _RTEMS_BSD_SYS_PARAM_H_ -#include <freebsd/sys/_null.h> +#ifdef __rtems__ +#include <sys/param.h> +#endif /* __rtems__ */ +#include <sys/_null.h> #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 @@ -66,7 +69,7 @@ #endif #ifndef LOCORE -#include <freebsd/sys/types.h> +#include <rtems/bsd/sys/types.h> #endif /* @@ -76,11 +79,11 @@ * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>) * MAXLOGNAME should be == UT_NAMESIZE+1 (see <utmp.h>) */ -#include <freebsd/sys/syslimits.h> +#include <sys/syslimits.h> #define MAXCOMLEN 19 /* max command name remembered */ -#define MAXINTERP 32 /* max interpreter file name length */ -#define MAXLOGNAME 17 /* max login name length (incl. NUL) */ +#define MAXINTERP PATH_MAX /* max interpreter file name length */ +#define MAXLOGNAME 33 /* max login name length (incl. NUL) */ #define MAXUPRC CHILD_MAX /* max simultaneous processes */ #define NCARGS ARG_MAX /* max bytes for an exec function */ #define NGROUPS (NGROUPS_MAX+1) /* max number groups */ @@ -91,11 +94,11 @@ /* More types and definitions used throughout the kernel. */ #ifdef _KERNEL -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/errno.h> +#include <sys/cdefs.h> +#include <rtems/bsd/sys/errno.h> #ifndef LOCORE -#include <freebsd/sys/time.h> -#include <freebsd/sys/priority.h> +#include <rtems/bsd/sys/time.h> +#include <sys/priority.h> #endif #ifndef FALSE @@ -108,13 +111,13 @@ #ifndef _KERNEL /* Signals. */ -#include <freebsd/sys/signal.h> +#include <sys/signal.h> #endif /* Machine type dependent parameters. */ -#include <freebsd/machine/param.h> +#include <machine/rtems-bsd-param.h> #ifndef _KERNEL -#include <freebsd/sys/limits.h> +#include <sys/limits.h> #endif #ifndef _NO_NAMESPACE_POLLUTION @@ -329,4 +332,4 @@ __END_DECLS #define member2struct(s, m, x) \ ((struct s *)(void *)((char *)(x) - offsetof(struct s, m))) -#endif /* _SYS_PARAM_HH_ */ +#endif /* _RTEMS_BSD_SYS_PARAM_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/resource.h b/rtemsbsd/include/rtems/bsd/sys/resource.h index 74a43c34..09f68696 100644 --- a/rtemsbsd/include/rtems/bsd/sys/resource.h +++ b/rtemsbsd/include/rtems/bsd/sys/resource.h @@ -30,12 +30,12 @@ * $FreeBSD$ */ -#ifndef _SYS_RESOURCE_HH_ -#define _SYS_RESOURCE_HH_ +#ifndef _RTEMS_BSD_SYS_RESOURCE_H_ +#define _RTEMS_BSD_SYS_RESOURCE_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_timeval.h> -#include <freebsd/sys/_types.h> +#include <sys/cdefs.h> +#include <sys/_timeval.h> +#include <rtems/bsd/sys/_types.h> /* * Process priority specifications to get/setpriority. @@ -56,6 +56,7 @@ #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 +#ifndef __rtems__ #define RUSAGE_THREAD 1 struct rusage { @@ -78,6 +79,9 @@ struct rusage { long ru_nivcsw; /* involuntary " */ #define ru_last ru_nivcsw }; +#else /* __rtems__ */ +#include <sys/resource.h> +#endif /* __rtems__ */ /* * Resource limits @@ -173,4 +177,4 @@ int setrlimit(int, const struct rlimit *); __END_DECLS #endif /* _KERNEL */ -#endif /* !_SYS_RESOURCE_HH_ */ +#endif /* !_RTEMS_BSD_SYS_RESOURCE_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/time.h b/rtemsbsd/include/rtems/bsd/sys/time.h index f34af077..7dea42bd 100644 --- a/rtemsbsd/include/rtems/bsd/sys/time.h +++ b/rtemsbsd/include/rtems/bsd/sys/time.h @@ -30,12 +30,15 @@ * $FreeBSD$ */ -#ifndef _SYS_TIME_HH_ -#define _SYS_TIME_HH_ +#ifndef _RTEMS_BSD_SYS_TIME_H_ +#define _RTEMS_BSD_SYS_TIME_H_ -#include <freebsd/sys/_timeval.h> -#include <freebsd/sys/types.h> -#include <freebsd/sys/timespec.h> +#include <sys/_timeval.h> +#include <rtems/bsd/sys/types.h> +#include <rtems/bsd/sys/timespec.h> +#ifdef __rtems__ +#include <sys/time.h> +#endif /* __rtems__ */ #ifndef __rtems__ struct timezone { @@ -320,10 +323,10 @@ void timevaladd(struct timeval *t1, const struct timeval *t2); void timevalsub(struct timeval *t1, const struct timeval *t2); int tvtohz(struct timeval *tv); #else /* !_KERNEL */ -#include <freebsd/time.h> +#include <time.h> -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/select.h> +#include <sys/cdefs.h> +#include <sys/select.h> __BEGIN_DECLS int setitimer(int, const struct itimerval *, struct itimerval *); @@ -348,4 +351,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_TIME_HH_ */ +#endif /* !_RTEMS_BSD_SYS_TIME_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/timespec.h b/rtemsbsd/include/rtems/bsd/sys/timespec.h index 4ec4147e..19a4ba3e 100644 --- a/rtemsbsd/include/rtems/bsd/sys/timespec.h +++ b/rtemsbsd/include/rtems/bsd/sys/timespec.h @@ -1,10 +1,80 @@ -#define TIMEVAL_TO_TIMESPEC(tv, ts) \ - do { \ - (ts)->tv_sec = (tv)->tv_sec; \ - (ts)->tv_nsec = (tv)->tv_usec * 1000; \ - } while (0) -#define TIMESPEC_TO_TIMEVAL(tv, ts) \ - do { \ - (tv)->tv_sec = (ts)->tv_sec; \ - (tv)->tv_usec = (ts)->tv_nsec / 1000; \ - } while (0) +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 8.5 (Berkeley) 5/4/95 + * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp + * $FreeBSD$ + */ + +/* + * Prerequisites: <sys/cdefs.h>, <sys/_types.h> + */ + +#ifndef _RTEMS_BSD_SYS_TIMESPEC_H_ +#define _RTEMS_BSD_SYS_TIMESPEC_H_ + +#ifndef __rtems__ +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; +#else /* __rtems__ */ +#include <rtems/bsd/sys/types.h> +#endif /* __rtems__ */ + +#if __BSD_VISIBLE +#define TIMEVAL_TO_TIMESPEC(tv, ts) \ + do { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ + } while (0) +#define TIMESPEC_TO_TIMEVAL(tv, ts) \ + do { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ + } while (0) + +#endif /* __BSD_VISIBLE */ + +#ifndef __rtems__ +/* + * Structure defined by POSIX.1b to be like a itimerval, but with + * timespecs. Used in the timer_*() system calls. + */ +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; +#endif /* __rtems__ */ + +#endif /* _RTEMS_BSD_SYS_TIMESPEC_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/types.h b/rtemsbsd/include/rtems/bsd/sys/types.h index 38ae5c68..a8c47ef3 100644 --- a/rtemsbsd/include/rtems/bsd/sys/types.h +++ b/rtemsbsd/include/rtems/bsd/sys/types.h @@ -35,16 +35,17 @@ * $FreeBSD$ */ -#ifndef _SYS_TYPES_HH_ -#define _SYS_TYPES_HH_ +#ifndef _RTEMS_BSD_SYS_TYPES_H_ +#define _RTEMS_BSD_SYS_TYPES_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /* Machine type dependent parameters. */ -#include <freebsd/machine/endian.h> -#include <freebsd/sys/_types.h> +#include <machine/rtems-bsd-endian.h> +#include <rtems/bsd/sys/_types.h> -#include <freebsd/sys/_pthreadtypes.h> +#ifndef __rtems__ +#include <sys/_pthreadtypes.h> #if __BSD_VISIBLE typedef unsigned char u_char; @@ -318,7 +319,7 @@ typedef struct vm_page *vm_page_t; */ #if __BSD_VISIBLE -#include <freebsd/sys/select.h> +#include <sys/select.h> /* * minor() gives a cookie instead of an index since we don't want to @@ -356,5 +357,6 @@ __END_DECLS #endif /* !_KERNEL */ #endif /* __BSD_VISIBLE */ +#endif /* __rtems__ */ -#endif /* !_SYS_TYPES_HH_ */ +#endif /* !_RTEMS_BSD_SYS_TYPES_H_ */ diff --git a/rtemsbsd/include/rtems/bsd/sys/unistd.h b/rtemsbsd/include/rtems/bsd/sys/unistd.h index 2918d563..5c3208c7 100644 --- a/rtemsbsd/include/rtems/bsd/sys/unistd.h +++ b/rtemsbsd/include/rtems/bsd/sys/unistd.h @@ -30,11 +30,12 @@ * $FreeBSD$ */ -#ifndef _SYS_UNISTD_HH_ -#define _SYS_UNISTD_HH_ +#ifndef _RTEMS_BSD_SYS_UNISTD_H_ +#define _RTEMS_BSD_SYS_UNISTD_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> +#ifndef __rtems__ /* * POSIX options and option groups we unconditionally do or don't * implement. Those options which are implemented (or not) entirely @@ -158,6 +159,9 @@ /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ #define _PC_MIN_HOLE_SIZE 21 +#else /* __rtems__ */ +#include <unistd.h> +#endif /* __rtems__ */ #if __BSD_VISIBLE /* @@ -185,4 +189,4 @@ #endif /* __BSD_VISIBLE */ -#endif /* !_SYS_UNISTD_HH_ */ +#endif /* !_RTEMS_BSD_SYS_UNISTD_H_ */ diff --git a/rtemsbsd/include/sys/_pthreadtypes.h b/rtemsbsd/include/sys/_pthreadtypes.h index fa882cb5..936ffd88 100644 --- a/rtemsbsd/include/sys/_pthreadtypes.h +++ b/rtemsbsd/include/sys/_pthreadtypes.h @@ -1 +1 @@ -/* empty file */ +/* EMPTY */ diff --git a/rtemsbsd/include/sys/signalvar.h b/rtemsbsd/include/sys/signalvar.h index baa28bdd..936ffd88 100644 --- a/rtemsbsd/include/sys/signalvar.h +++ b/rtemsbsd/include/sys/signalvar.h @@ -1 +1 @@ -/* deliberately empty file */ +/* EMPTY */ diff --git a/rtemsbsd/include/vm/vm_extern.h b/rtemsbsd/include/vm/vm_extern.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/vm/vm_extern.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/vm/vm_kern.h b/rtemsbsd/include/vm/vm_kern.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/vm/vm_kern.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/vm/vm_object.h b/rtemsbsd/include/vm/vm_object.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/vm/vm_object.h @@ -0,0 +1 @@ +/* EMPTY */ diff --git a/rtemsbsd/include/vm/vm_page.h b/rtemsbsd/include/vm/vm_page.h new file mode 100644 index 00000000..936ffd88 --- /dev/null +++ b/rtemsbsd/include/vm/vm_page.h @@ -0,0 +1 @@ +/* EMPTY */ |