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 /freebsd/sys/sys | |
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 '')
111 files changed, 2894 insertions, 1514 deletions
diff --git a/freebsd/sys/sys/_bus_dma.h b/freebsd/sys/sys/_bus_dma.h index 8d60c957..91318d01 100644 --- a/freebsd/sys/sys/_bus_dma.h +++ b/freebsd/sys/sys/_bus_dma.h @@ -27,8 +27,8 @@ * */ -#ifndef _SYS__BUS_DMA_HH_ -#define _SYS__BUS_DMA_HH_ +#ifndef _SYS__BUS_DMA_H_ +#define _SYS__BUS_DMA_H_ typedef int bus_dmasync_op_t; @@ -60,4 +60,4 @@ typedef enum { typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t); -#endif /* !_SYS__BUS_DMA_HH_ */ +#endif /* !_SYS__BUS_DMA_H_ */ diff --git a/freebsd/sys/sys/_lock.h b/freebsd/sys/sys/_lock.h index eb13f2aa..457ffd4d 100644 --- a/freebsd/sys/sys/_lock.h +++ b/freebsd/sys/sys/_lock.h @@ -28,9 +28,13 @@ * $FreeBSD$ */ -#ifndef _SYS__LOCK_HH_ -#define _SYS__LOCK_HH_ +#ifndef _SYS__LOCK_H_ +#define _SYS__LOCK_H_ +#ifdef __rtems__ +#include <rtems.h> +#include <rtems/chain.h> +#endif struct lock_object { #ifdef __rtems__ rtems_chain_node lo_node; @@ -44,4 +48,4 @@ struct lock_object { #endif /* __rtems__ */ }; -#endif /* !_SYS__LOCK_HH_ */ +#endif /* !_SYS__LOCK_H_ */ diff --git a/freebsd/sys/sys/_lockmgr.h b/freebsd/sys/sys/_lockmgr.h index 616cae4e..0b99e1a4 100644 --- a/freebsd/sys/sys/_lockmgr.h +++ b/freebsd/sys/sys/_lockmgr.h @@ -28,11 +28,11 @@ * $FreeBSD$ */ -#ifndef _SYS__LOCKMGR_HH_ -#define _SYS__LOCKMGR_HH_ +#ifndef _SYS__LOCKMGR_H_ +#define _SYS__LOCKMGR_H_ #ifdef DEBUG_LOCKS -#include <freebsd/sys/_stack.h> +#include <sys/_stack.h> #endif struct lock { diff --git a/freebsd/sys/sys/_mutex.h b/freebsd/sys/sys/_mutex.h index eac45780..9bf2d39f 100644 --- a/freebsd/sys/sys/_mutex.h +++ b/freebsd/sys/sys/_mutex.h @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _SYS__MUTEX_HH_ -#define _SYS__MUTEX_HH_ +#ifndef _SYS__MUTEX_H_ +#define _SYS__MUTEX_H_ /* * Sleep/spin mutex. @@ -41,4 +41,4 @@ struct mtx { #endif /* __rtems__ */ }; -#endif /* !_SYS__MUTEX_HH_ */ +#endif /* !_SYS__MUTEX_H_ */ diff --git a/freebsd/sys/sys/_rmlock.h b/freebsd/sys/sys/_rmlock.h index 87fe1ee8..dba7affd 100644 --- a/freebsd/sys/sys/_rmlock.h +++ b/freebsd/sys/sys/_rmlock.h @@ -29,14 +29,14 @@ * $FreeBSD$ */ -#ifndef _SYS__RMLOCK_HH_ -#define _SYS__RMLOCK_HH_ +#ifndef _SYS__RMLOCK_H_ +#define _SYS__RMLOCK_H_ /* * XXXUPS remove as soon as we have per cpu variable * linker sets and can define rm_queue in _rm_lock.h */ -#include <freebsd/sys/pcpu.h> +#include <sys/pcpu.h> /* * Mostly reader/occasional writer lock. */ @@ -52,7 +52,7 @@ struct rmlock { }; #else /* __rtems__ */ - #include <freebsd/sys/rwlock.h> + #include <sys/rwlock.h> #define rmlock rwlock #endif /* __rtems__ */ @@ -64,4 +64,4 @@ struct rm_priotracker { LIST_ENTRY(rm_priotracker) rmp_qentry; }; -#endif /* !_SYS__RMLOCK_HH_ */ +#endif /* !_SYS__RMLOCK_H_ */ diff --git a/freebsd/sys/sys/_rwlock.h b/freebsd/sys/sys/_rwlock.h index 536ba1dd..c5adac0e 100644 --- a/freebsd/sys/sys/_rwlock.h +++ b/freebsd/sys/sys/_rwlock.h @@ -29,8 +29,8 @@ * $FreeBSD$ */ -#ifndef _SYS__RWLOCK_HH_ -#define _SYS__RWLOCK_HH_ +#ifndef _SYS__RWLOCK_H_ +#define _SYS__RWLOCK_H_ /* * Reader/writer lock. @@ -40,4 +40,4 @@ struct rwlock { volatile uintptr_t rw_lock; }; -#endif /* !_SYS__RWLOCK_HH_ */ +#endif /* !_SYS__RWLOCK_H_ */ diff --git a/freebsd/sys/sys/_semaphore.h b/freebsd/sys/sys/_semaphore.h index e0d5eff2..df3c5da1 100644 --- a/freebsd/sys/sys/_semaphore.h +++ b/freebsd/sys/sys/_semaphore.h @@ -25,15 +25,15 @@ * * $FreeBSD$ */ -#ifndef __SEMAPHORE_HH_ -#define __SEMAPHORE_HH_ +#ifndef __SEMAPHORE_H_ +#define __SEMAPHORE_H_ typedef intptr_t semid_t; struct timespec; #ifndef _KERNEL -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /* * Semaphore definitions. @@ -70,4 +70,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* __SEMAPHORE_HH_ */ +#endif /* __SEMAPHORE_H_ */ diff --git a/freebsd/sys/sys/_sigset.h b/freebsd/sys/sys/_sigset.h index 52028110..06826701 100644 --- a/freebsd/sys/sys/_sigset.h +++ b/freebsd/sys/sys/_sigset.h @@ -35,8 +35,8 @@ * $FreeBSD$ */ -#ifndef _SYS__SIGSET_HH_ -#define _SYS__SIGSET_HH_ +#ifndef _SYS__SIGSET_H_ +#define _SYS__SIGSET_H_ /* * sigset_t macros. @@ -56,4 +56,4 @@ typedef struct __sigset { typedef unsigned int osigset_t; #endif -#endif /* !_SYS__SIGSET_HH_ */ +#endif /* !_SYS__SIGSET_H_ */ diff --git a/freebsd/sys/sys/_sx.h b/freebsd/sys/sys/_sx.h index ff8f821e..699316b6 100644 --- a/freebsd/sys/sys/_sx.h +++ b/freebsd/sys/sys/_sx.h @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _SYS__SX_HH_ -#define _SYS__SX_HH_ +#ifndef _SYS__SX_H_ +#define _SYS__SX_H_ /* * Shared/exclusive lock main structure definition. @@ -41,4 +41,4 @@ struct sx { #endif /* __rtems__ */ }; -#endif /* !_SYS__SX_HH_ */ +#endif /* !_SYS__SX_H_ */ diff --git a/freebsd/sys/sys/_task.h b/freebsd/sys/sys/_task.h index efea7fc8..2a51e1b0 100644 --- a/freebsd/sys/sys/_task.h +++ b/freebsd/sys/sys/_task.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS__TASK_HH_ -#define _SYS__TASK_HH_ +#ifndef _SYS__TASK_H_ +#define _SYS__TASK_H_ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> /* * Each task includes a function which is called from @@ -47,4 +47,4 @@ struct task { void *ta_context; /* argument for handler */ }; -#endif /* !_SYS__TASK_HH_ */ +#endif /* !_SYS__TASK_H_ */ diff --git a/freebsd/sys/sys/_timeval.h b/freebsd/sys/sys/_timeval.h index 936ffd88..c1edd5c8 100644 --- a/freebsd/sys/sys/_timeval.h +++ b/freebsd/sys/sys/_timeval.h @@ -1 +1,56 @@ -/* EMPTY */ +/*- + * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> + * 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. + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _SYS__TIMEVAL_H_ +#define _SYS__TIMEVAL_H_ + +#ifndef __rtems__ +#include <rtems/bsd/sys/_types.h> + +#ifndef _SUSECONDS_T_DECLARED +typedef __suseconds_t suseconds_t; +#define _SUSECONDS_T_DECLARED +#endif + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +/* + * Structure returned by gettimeofday(2) system call, and used in other calls. + */ +struct timeval { + time_t tv_sec; /* seconds */ + suseconds_t tv_usec; /* and microseconds */ +}; +#else /* __rtems__ */ +#include <rtems/bsd/sys/time.h> +#endif /* __rtems__ */ + +#endif /* !_SYS__TIMEVAL_H_ */ diff --git a/freebsd/sys/sys/acl.h b/freebsd/sys/sys/acl.h index f8c20c73..ec2e025b 100644 --- a/freebsd/sys/sys/acl.h +++ b/freebsd/sys/sys/acl.h @@ -33,12 +33,12 @@ * Support for POSIX.1e and NFSv4 access control lists. */ -#ifndef _SYS_ACL_HH_ -#define _SYS_ACL_HH_ +#ifndef _SYS_ACL_H_ +#define _SYS_ACL_H_ -#include <freebsd/sys/param.h> -#include <freebsd/sys/queue.h> -#include <freebsd/vm/uma.h> +#include <rtems/bsd/sys/param.h> +#include <sys/queue.h> +#include <vm/uma.h> /* * POSIX.1e and NFSv4 ACL types and related constants. @@ -404,4 +404,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_ACL_HH_ */ +#endif /* !_SYS_ACL_H_ */ diff --git a/freebsd/sys/sys/aio.h b/freebsd/sys/sys/aio.h index cff3d78c..03f6b34e 100644 --- a/freebsd/sys/sys/aio.h +++ b/freebsd/sys/sys/aio.h @@ -16,11 +16,11 @@ * $FreeBSD$ */ -#ifndef _SYS_AIO_HH_ -#define _SYS_AIO_HH_ +#ifndef _SYS_AIO_H_ +#define _SYS_AIO_H_ -#include <freebsd/sys/types.h> -#include <freebsd/sys/signal.h> +#include <rtems/bsd/sys/types.h> +#include <sys/signal.h> /* * Returned by aio_cancel: diff --git a/freebsd/sys/sys/ata.h b/freebsd/sys/sys/ata.h index df4cea71..cacb1ea0 100644 --- a/freebsd/sys/sys/ata.h +++ b/freebsd/sys/sys/ata.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_ATA_HH_ -#define _SYS_ATA_HH_ +#ifndef _SYS_ATA_H_ +#define _SYS_ATA_H_ -#include <freebsd/sys/ioccom.h> +#include <sys/ioccom.h> /* ATA/ATAPI device parameters */ struct ata_params { @@ -557,4 +557,4 @@ struct ata_ioc_raid_status { #define IOCATARAIDADDSPARE _IOW('a', 203, struct ata_ioc_raid_config) #define IOCATARAIDREBUILD _IOW('a', 204, int) -#endif /* _SYS_ATA_HH_ */ +#endif /* _SYS_ATA_H_ */ diff --git a/freebsd/sys/sys/bitstring.h b/freebsd/sys/sys/bitstring.h index a2b70ba8..125ef51d 100644 --- a/freebsd/sys/sys/bitstring.h +++ b/freebsd/sys/sys/bitstring.h @@ -32,8 +32,8 @@ * $FreeBSD$ */ -#ifndef _SYS_BITSTRING_HH_ -#define _SYS_BITSTRING_HH_ +#ifndef _SYS_BITSTRING_H_ +#define _SYS_BITSTRING_H_ typedef unsigned char bitstr_t; @@ -143,4 +143,4 @@ typedef unsigned char bitstr_t; *(value) = _value; \ } while (0) -#endif /* !_SYS_BITSTRING_HH_ */ +#endif /* !_SYS_BITSTRING_H_ */ diff --git a/freebsd/sys/sys/buf.h b/freebsd/sys/sys/buf.h index 88e55d95..6cc68ee9 100644 --- a/freebsd/sys/sys/buf.h +++ b/freebsd/sys/sys/buf.h @@ -35,13 +35,13 @@ * $FreeBSD$ */ -#ifndef _SYS_BUF_HH_ -#define _SYS_BUF_HH_ +#ifndef _SYS_BUF_H_ +#define _SYS_BUF_H_ -#include <freebsd/sys/bufobj.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/lockmgr.h> +#include <sys/bufobj.h> +#include <sys/queue.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/lockmgr.h> struct bio; struct buf; @@ -255,8 +255,8 @@ struct buf { */ extern const char *buf_wmesg; /* Default buffer lock message */ #define BUF_WMESG "bufwait" -#include <freebsd/sys/proc.h> /* XXX for curthread */ -#include <freebsd/sys/mutex.h> +#include <sys/proc.h> /* XXX for curthread */ +#include <sys/mutex.h> /* * Initialize a lock. @@ -333,7 +333,7 @@ extern const char *buf_wmesg; /* Default buffer lock message */ #define BUF_ASSERT_UNHELD(bp) #endif -#ifdef _SYS_PROC_HH_ /* Avoid #include <freebsd/sys/proc.h> pollution */ +#ifdef _SYS_PROC_H_ /* Avoid #include <sys/proc.h> pollution */ /* * When initiating asynchronous I/O, change ownership of the lock to the * kernel. Once done, the lock may legally released by biodone. The @@ -523,4 +523,4 @@ void bunpin_wait(struct buf *); #endif /* _KERNEL */ -#endif /* !_SYS_BUF_HH_ */ +#endif /* !_SYS_BUF_H_ */ diff --git a/freebsd/sys/sys/buf_ring.h b/freebsd/sys/sys/buf_ring.h index dbdf6206..59853e42 100644 --- a/freebsd/sys/sys/buf_ring.h +++ b/freebsd/sys/sys/buf_ring.h @@ -27,18 +27,18 @@ * */ -#ifndef _SYS_BUF_RING_HH_ -#define _SYS_BUF_RING_HH_ +#ifndef _SYS_BUF_RING_H_ +#define _SYS_BUF_RING_H_ -#include <freebsd/machine/cpu.h> +#include <machine/cpu.h> #if defined(INVARIANTS) && !defined(DEBUG_BUFRING) #define DEBUG_BUFRING 1 #endif #ifdef DEBUG_BUFRING -#include <freebsd/sys/lock.h> -#include <freebsd/sys/mutex.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/mutex.h> #endif struct buf_ring { diff --git a/freebsd/sys/sys/bufobj.h b/freebsd/sys/sys/bufobj.h index 896e4ff8..916b2565 100644 --- a/freebsd/sys/sys/bufobj.h +++ b/freebsd/sys/sys/bufobj.h @@ -46,14 +46,14 @@ * once things starts to crystalize. */ -#ifndef _SYS_BUFOBJ_HH_ -#define _SYS_BUFOBJ_HH_ +#ifndef _SYS_BUFOBJ_H_ +#define _SYS_BUFOBJ_H_ #if defined(_KERNEL) || defined(_KVM_VNODE) -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> struct bufobj; struct buf_ops; @@ -128,4 +128,4 @@ int bufsync(struct bufobj *bo, int waitfor); void bufbdflush(struct bufobj *bo, struct buf *bp); #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ -#endif /* _SYS_BUFOBJ_HH_ */ +#endif /* _SYS_BUFOBJ_H_ */ diff --git a/freebsd/sys/sys/bus.h b/freebsd/sys/sys/bus.h index 8dc54d08..6c1128e3 100644 --- a/freebsd/sys/sys/bus.h +++ b/freebsd/sys/sys/bus.h @@ -26,11 +26,11 @@ * $FreeBSD$ */ -#ifndef _SYS_BUS_HH_ -#define _SYS_BUS_HH_ +#ifndef _SYS_BUS_H_ +#define _SYS_BUS_H_ -#include <freebsd/machine/_limits.h> -#include <freebsd/sys/_bus_dma.h> +#include <machine/_limits.h> +#include <sys/_bus_dma.h> /** * @defgroup NEWBUS newbus - a generic framework for managing devices @@ -76,8 +76,8 @@ struct u_device { #ifdef _KERNEL -#include <freebsd/sys/queue.h> -#include <freebsd/sys/kobj.h> +#include <sys/queue.h> +#include <sys/kobj.h> /** * devctl hooks. Typically one should use the devctl_notify @@ -547,8 +547,8 @@ void bus_set_pass(int pass); /* * Some common device interfaces. */ -#include <freebsd/local/device_if.h> -#include <freebsd/local/bus_if.h> +#include <rtems/bsd/local/device_if.h> +#include <rtems/bsd/local/bus_if.h> struct module; @@ -745,4 +745,4 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \ bus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c)) #endif /* _KERNEL */ -#endif /* !_SYS_BUS_HH_ */ +#endif /* !_SYS_BUS_H_ */ diff --git a/freebsd/sys/sys/bus_dma.h b/freebsd/sys/sys/bus_dma.h index 1bcde10a..0dad3267 100644 --- a/freebsd/sys/sys/bus_dma.h +++ b/freebsd/sys/sys/bus_dma.h @@ -69,10 +69,10 @@ */ /* $FreeBSD$ */ -#ifndef _BUS_DMA_HH_ -#define _BUS_DMA_HH_ +#ifndef _BUS_DMA_H_ +#define _BUS_DMA_H_ -#include <freebsd/sys/_bus_dma.h> +#include <sys/_bus_dma.h> /* * Machine independent interface for mapping physical addresses to peripheral @@ -274,4 +274,4 @@ void _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map); #endif /* __sparc64__ */ -#endif /* _BUS_DMA_HH_ */ +#endif /* _BUS_DMA_H_ */ diff --git a/freebsd/sys/sys/callout.h b/freebsd/sys/sys/callout.h index 4686a4db..2d43d149 100644 --- a/freebsd/sys/sys/callout.h +++ b/freebsd/sys/sys/callout.h @@ -35,10 +35,10 @@ * $FreeBSD$ */ -#ifndef _SYS_CALLOUT_HH_ -#define _SYS_CALLOUT_HH_ +#ifndef _SYS_CALLOUT_H_ +#define _SYS_CALLOUT_H_ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> struct lock_object; @@ -100,4 +100,4 @@ void callout_tick(void); #endif -#endif /* _SYS_CALLOUT_HH_ */ +#endif /* _SYS_CALLOUT_H_ */ diff --git a/freebsd/sys/sys/condvar.h b/freebsd/sys/sys/condvar.h index 54cfe9eb..51da8170 100644 --- a/freebsd/sys/sys/condvar.h +++ b/freebsd/sys/sys/condvar.h @@ -26,11 +26,11 @@ * $FreeBSD$ */ -#ifndef _SYS_CONDVAR_HH_ -#define _SYS_CONDVAR_HH_ +#ifndef _SYS_CONDVAR_H_ +#define _SYS_CONDVAR_H_ #ifndef LOCORE -#include <freebsd/sys/queue.h> +#include <sys/queue.h> struct lock_object; struct thread; @@ -43,6 +43,10 @@ TAILQ_HEAD(cv_waitq, thread); * and is held across calls to cv_signal() and cv_broadcast(). It is an * optimization to avoid looking up the sleep queue if there are no waiters. */ +#ifdef __rtems__ +#include <pthread.h> +#include <rtems/chain.h> +#endif struct cv { #ifdef __rtems__ rtems_chain_node cv_node; @@ -84,4 +88,4 @@ void cv_broadcastpri(struct cv *cvp, int pri); #endif /* _KERNEL */ #endif /* !LOCORE */ -#endif /* _SYS_CONDVAR_HH_ */ +#endif /* _SYS_CONDVAR_H_ */ diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h index 86e29c4d..694bbb36 100644 --- a/freebsd/sys/sys/conf.h +++ b/freebsd/sys/sys/conf.h @@ -37,13 +37,13 @@ * $FreeBSD$ */ -#ifndef _SYS_CONF_HH_ -#define _SYS_CONF_HH_ +#ifndef _SYS_CONF_H_ +#define _SYS_CONF_H_ #ifdef _KERNEL -#include <freebsd/sys/eventhandler.h> +#include <sys/eventhandler.h> #else -#include <freebsd/sys/queue.h> +#include <sys/queue.h> #endif struct snapdata; @@ -348,4 +348,4 @@ extern int dumping; /* system is dumping */ #endif /* _KERNEL */ -#endif /* !_SYS_CONF_HH_ */ +#endif /* !_SYS_CONF_H_ */ diff --git a/freebsd/sys/sys/cpu.h b/freebsd/sys/sys/cpu.h index 3e6729db..c16091e1 100644 --- a/freebsd/sys/sys/cpu.h +++ b/freebsd/sys/sys/cpu.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_CPU_HH_ -#define _SYS_CPU_HH_ +#ifndef _SYS_CPU_H_ +#define _SYS_CPU_H_ -#include <freebsd/sys/eventhandler.h> +#include <sys/eventhandler.h> /* * CPU device support. @@ -170,4 +170,4 @@ EVENTHANDLER_DECLARE(cpufreq_levels_changed, cpufreq_levels_notify_fn); /* Estimate the current clock rate for the given CPU id. */ int cpu_est_clockrate(int cpu_id, uint64_t *rate); -#endif /* !_SYS_CPU_HH_ */ +#endif /* !_SYS_CPU_H_ */ diff --git a/freebsd/sys/sys/ctype.h b/freebsd/sys/sys/ctype.h index b7b4ad5a..5022d40c 100644 --- a/freebsd/sys/sys/ctype.h +++ b/freebsd/sys/sys/ctype.h @@ -34,8 +34,8 @@ * $FreeBSD$ */ -#ifndef _SYS_CTYPE_HH_ -#define _SYS_CTYPE_HH_ +#ifndef _SYS_CTYPE_H_ +#define _SYS_CTYPE_H_ #ifdef _KERNEL @@ -54,4 +54,4 @@ #define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) #endif -#endif /* !_SYS_CTYPE_HH_ */ +#endif /* !_SYS_CTYPE_H_ */ diff --git a/freebsd/sys/sys/domain.h b/freebsd/sys/sys/domain.h index 0b44e9fd..2563cb6e 100644 --- a/freebsd/sys/sys/domain.h +++ b/freebsd/sys/sys/domain.h @@ -30,8 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_DOMAIN_HH_ -#define _SYS_DOMAIN_HH_ +#ifndef _SYS_DOMAIN_H_ +#define _SYS_DOMAIN_H_ /* * Structure per communications domain. @@ -103,4 +103,4 @@ void vnet_domain_uninit(void *); #endif /* _KERNEL */ -#endif /* !_SYS_DOMAIN_HH_ */ +#endif /* !_SYS_DOMAIN_H_ */ diff --git a/freebsd/sys/sys/endian.h b/freebsd/sys/sys/endian.h index 5c95d748..921fac41 100644 --- a/freebsd/sys/sys/endian.h +++ b/freebsd/sys/sys/endian.h @@ -26,12 +26,12 @@ * $FreeBSD$ */ -#ifndef _SYS_ENDIAN_HH_ -#define _SYS_ENDIAN_HH_ +#ifndef _SYS_ENDIAN_H_ +#define _SYS_ENDIAN_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_types.h> -#include <freebsd/machine/endian.h> +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> +#include <machine/rtems-bsd-endian.h> #ifndef _UINT16_T_DECLARED typedef __uint16_t uint16_t; @@ -197,4 +197,4 @@ le64enc(void *pp, uint64_t u) le32enc(p + 4, u >> 32); } -#endif /* _SYS_ENDIAN_HH_ */ +#endif /* _SYS_ENDIAN_H_ */ diff --git a/freebsd/sys/sys/event.h b/freebsd/sys/sys/event.h index 1af716d7..d92eb55d 100644 --- a/freebsd/sys/sys/event.h +++ b/freebsd/sys/sys/event.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_EVENT_HH_ -#define _SYS_EVENT_HH_ +#ifndef _SYS_EVENT_H_ +#define _SYS_EVENT_H_ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> #define EVFILT_READ (-1) #define EVFILT_WRITE (-2) @@ -264,7 +264,7 @@ extern int kqueue_del_filteropts(int filt); #else /* !_KERNEL */ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> struct timespec; __BEGIN_DECLS @@ -276,4 +276,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_EVENT_HH_ */ +#endif /* !_SYS_EVENT_H_ */ diff --git a/freebsd/sys/sys/eventhandler.h b/freebsd/sys/sys/eventhandler.h index 1472df18..0da999d0 100644 --- a/freebsd/sys/sys/eventhandler.h +++ b/freebsd/sys/sys/eventhandler.h @@ -29,10 +29,10 @@ #ifndef SYS_EVENTHANDLER_H #define SYS_EVENTHANDLER_H -#include <freebsd/sys/lock.h> -#include <freebsd/sys/ktr.h> -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/queue.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/ktr.h> +#include <sys/mutex.h> +#include <sys/queue.h> struct eventhandler_entry { TAILQ_ENTRY(eventhandler_entry) ee_link; diff --git a/freebsd/sys/sys/eventvar.h b/freebsd/sys/sys/eventvar.h index 8712cfdc..bdb3adf5 100644 --- a/freebsd/sys/sys/eventvar.h +++ b/freebsd/sys/sys/eventvar.h @@ -26,14 +26,14 @@ * $FreeBSD$ */ -#ifndef _SYS_EVENTVAR_HH_ -#define _SYS_EVENTVAR_HH_ +#ifndef _SYS_EVENTVAR_H_ +#define _SYS_EVENTVAR_H_ #ifndef _KERNEL #error "no user-servicable parts inside" #endif -#include <freebsd/sys/_task.h> +#include <sys/_task.h> #define KQ_NEVENTS 8 /* minimize copy{in,out} calls */ #define KQEXTENT 256 /* linear growth by this amount */ @@ -62,4 +62,4 @@ struct kqueue { struct task kq_task; }; -#endif /* !_SYS_EVENTVAR_HH_ */ +#endif /* !_SYS_EVENTVAR_H_ */ diff --git a/freebsd/sys/sys/fcntl.h b/freebsd/sys/sys/fcntl.h index 82646c7f..00f79279 100644 --- a/freebsd/sys/sys/fcntl.h +++ b/freebsd/sys/sys/fcntl.h @@ -35,8 +35,8 @@ * $FreeBSD$ */ -#ifndef _SYS_FCNTL_HH_ -#define _SYS_FCNTL_HH_ +#ifndef _SYS_FCNTL_H_ +#define _SYS_FCNTL_H_ /* * This file includes the definitions for open and fcntl @@ -44,8 +44,8 @@ * related kernel definitions. */ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_types.h> +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; @@ -293,4 +293,4 @@ int flock(int, int); __END_DECLS #endif -#endif /* !_SYS_FCNTL_HH_ */ +#endif /* !_SYS_FCNTL_H_ */ diff --git a/freebsd/sys/sys/file.h b/freebsd/sys/sys/file.h index 21b8e413..5ba6aee2 100644 --- a/freebsd/sys/sys/file.h +++ b/freebsd/sys/sys/file.h @@ -30,18 +30,18 @@ * $FreeBSD$ */ -#ifndef _SYS_FILE_HH_ -#define _SYS_FILE_HH_ +#ifndef _SYS_FILE_H_ +#define _SYS_FILE_H_ #ifndef _KERNEL -#include <freebsd/sys/types.h> /* XXX */ -#include <freebsd/sys/fcntl.h> -#include <freebsd/sys/unistd.h> +#include <rtems/bsd/sys/types.h> /* XXX */ +#include <sys/fcntl.h> +#include <rtems/bsd/sys/unistd.h> #else -#include <freebsd/sys/queue.h> -#include <freebsd/sys/refcount.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <sys/queue.h> +#include <sys/refcount.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> struct stat; struct thread; diff --git a/freebsd/sys/sys/filedesc.h b/freebsd/sys/sys/filedesc.h index fab6d93b..718f2e8b 100644 --- a/freebsd/sys/sys/filedesc.h +++ b/freebsd/sys/sys/filedesc.h @@ -30,16 +30,16 @@ * $FreeBSD$ */ -#ifndef _SYS_FILEDESC_HH_ -#define _SYS_FILEDESC_HH_ +#ifndef _SYS_FILEDESC_H_ +#define _SYS_FILEDESC_H_ -#include <freebsd/sys/queue.h> -#include <freebsd/sys/event.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/priority.h> -#include <freebsd/sys/sx.h> +#include <sys/queue.h> +#include <sys/event.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/priority.h> +#include <sys/sx.h> -#include <freebsd/machine/_limits.h> +#include <machine/_limits.h> /* * This structure is used for the management of descriptors. It may be @@ -142,4 +142,4 @@ fget_locked(struct filedesc *fdp, int fd) #endif /* _KERNEL */ -#endif /* !_SYS_FILEDESC_HH_ */ +#endif /* !_SYS_FILEDESC_H_ */ diff --git a/freebsd/sys/sys/filio.h b/freebsd/sys/sys/filio.h index 899d3458..1710ba45 100644 --- a/freebsd/sys/sys/filio.h +++ b/freebsd/sys/sys/filio.h @@ -35,10 +35,10 @@ * $FreeBSD$ */ -#ifndef _SYS_FILIO_HH_ -#define _SYS_FILIO_HH_ +#ifndef _SYS_FILIO_H_ +#define _SYS_FILIO_H_ -#include <freebsd/sys/ioccom.h> +#include <sys/ioccom.h> /* Generic file-descriptor ioctl's. */ #define FIOCLEX _IO('f', 1) /* set close on exec on fd */ @@ -61,4 +61,4 @@ struct fiodgname_arg { #define FIOSEEKDATA _IOWR('f', 97, off_t) /* SEEK_DATA */ #define FIOSEEKHOLE _IOWR('f', 98, off_t) /* SEEK_HOLE */ -#endif /* !_SYS_FILIO_HH_ */ +#endif /* !_SYS_FILIO_H_ */ diff --git a/freebsd/sys/sys/hash.h b/freebsd/sys/sys/hash.h index 91dd4fcc..fcbe6b69 100644 --- a/freebsd/sys/sys/hash.h +++ b/freebsd/sys/sys/hash.h @@ -26,9 +26,9 @@ * $FreeBSD$ */ -#ifndef _SYS_HASH_HH_ -#define _SYS_HASH_HH_ -#include <freebsd/sys/types.h> +#ifndef _SYS_HASH_H_ +#define _SYS_HASH_H_ +#include <rtems/bsd/sys/types.h> /* Convenience */ #ifndef HASHINIT @@ -118,4 +118,4 @@ hash32_strne(const void *buf, size_t len, int end, const char **ep, return hash; } -#endif /* !_SYS_HASH_HH_ */ +#endif /* !_SYS_HASH_H_ */ diff --git a/freebsd/sys/sys/interrupt.h b/freebsd/sys/sys/interrupt.h index e43d0047..c1df1c76 100644 --- a/freebsd/sys/sys/interrupt.h +++ b/freebsd/sys/sys/interrupt.h @@ -26,11 +26,11 @@ * $FreeBSD$ */ -#ifndef _SYS_INTERRUPT_HH_ -#define _SYS_INTERRUPT_HH_ +#ifndef _SYS_INTERRUPT_H_ +#define _SYS_INTERRUPT_H_ -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> struct intr_event; struct intr_thread; diff --git a/freebsd/sys/sys/jail.h b/freebsd/sys/sys/jail.h index f501c0b2..2e259f24 100644 --- a/freebsd/sys/sys/jail.h +++ b/freebsd/sys/sys/jail.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _SYS_JAIL_HH_ -#define _SYS_JAIL_HH_ +#ifndef _SYS_JAIL_H_ +#define _SYS_JAIL_H_ #ifdef _KERNEL struct jail_v0 { @@ -116,11 +116,11 @@ int jail_remove(int); #else /* _KERNEL */ -#include <freebsd/sys/queue.h> -#include <freebsd/sys/sysctl.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/_task.h> +#include <sys/queue.h> +#include <sys/sysctl.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/mutex.h> +#include <sys/_task.h> #define JAIL_MAX 999999 @@ -131,7 +131,7 @@ MALLOC_DECLARE(M_PRISON); #if defined(_KERNEL) || defined(_WANT_PRISON) -#include <freebsd/sys/osd.h> +#include <sys/osd.h> #define HOSTUUIDLEN 64 @@ -382,4 +382,4 @@ int prison_priv_check(struct ucred *cred, int priv); int sysctl_jail_param(struct sysctl_oid *, void *, int , struct sysctl_req *); #endif /* _KERNEL */ -#endif /* !_SYS_JAIL_HH_ */ +#endif /* !_SYS_JAIL_H_ */ diff --git a/freebsd/sys/sys/kenv.h b/freebsd/sys/sys/kenv.h index 497eb2f2..0a30ddb3 100644 --- a/freebsd/sys/sys/kenv.h +++ b/freebsd/sys/sys/kenv.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_KENV_HH_ -#define _SYS_KENV_HH_ +#ifndef _SYS_KENV_H_ +#define _SYS_KENV_H_ /* * Constants for the kenv(2) syscall @@ -40,4 +40,4 @@ #define KENV_MNAMELEN 128 /* Maximum name length (for the syscall) */ #define KENV_MVALLEN 128 /* Maximum value length (for the syscall) */ -#endif /* !_SYS_KENV_HH_ */ +#endif /* !_SYS_KENV_H_ */ diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h index 2bcc58ed..e2cc2678 100644 --- a/freebsd/sys/sys/kernel.h +++ b/freebsd/sys/sys/kernel.h @@ -42,15 +42,15 @@ * $FreeBSD$ */ -#ifndef _SYS_KERNEL_HH_ -#define _SYS_KERNEL_HH_ +#ifndef _SYS_KERNEL_H_ +#define _SYS_KERNEL_H_ -#include <freebsd/sys/linker_set.h> +#include <sys/linker_set.h> #ifdef _KERNEL /* for intrhook below */ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> /* Global variables for the kernel. */ @@ -421,4 +421,4 @@ struct intr_config_hook { int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); -#endif /* !_SYS_KERNEL_HH_*/ +#endif /* !_SYS_KERNEL_H_*/ diff --git a/freebsd/sys/sys/kobj.h b/freebsd/sys/sys/kobj.h index 385159aa..3143bea4 100644 --- a/freebsd/sys/sys/kobj.h +++ b/freebsd/sys/sys/kobj.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_KOBJ_HH_ -#define _SYS_KOBJ_HH_ +#ifndef _SYS_KOBJ_H_ +#define _SYS_KOBJ_H_ /* * Forward declarations @@ -254,4 +254,4 @@ kobj_method_t* kobj_lookup_method(kobj_class_t cls, */ int kobj_error_method(void); -#endif /* !_SYS_KOBJ_HH_ */ +#endif /* !_SYS_KOBJ_H_ */ diff --git a/freebsd/sys/sys/kthread.h b/freebsd/sys/sys/kthread.h index 6fe442e3..390463f3 100644 --- a/freebsd/sys/sys/kthread.h +++ b/freebsd/sys/sys/kthread.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_KTHREAD_HH_ -#define _SYS_KTHREAD_HH_ +#ifndef _SYS_KTHREAD_H_ +#define _SYS_KTHREAD_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /*- * A kernel process descriptor; used to start "internal" daemons. @@ -76,4 +76,4 @@ int kthread_suspend(struct thread *, int); void kthread_suspend_check(struct thread *); -#endif /* !_SYS_KTHREAD_HH_ */ +#endif /* !_SYS_KTHREAD_H_ */ diff --git a/freebsd/sys/sys/ktr.h b/freebsd/sys/sys/ktr.h index 3942b92e..5fbe2947 100644 --- a/freebsd/sys/sys/ktr.h +++ b/freebsd/sys/sys/ktr.h @@ -33,8 +33,8 @@ * Wraparound kernel trace buffer support. */ -#ifndef _SYS_KTR_HH_ -#define _SYS_KTR_HH_ +#ifndef _SYS_KTR_H_ +#define _SYS_KTR_H_ /* * Trace classes @@ -279,4 +279,4 @@ void ktr_tracepoint(u_int mask, const char *file, int line, #endif /* !LOCORE */ -#endif /* !_SYS_KTR_HH_ */ +#endif /* !_SYS_KTR_H_ */ diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h index 943ac34b..4675caa3 100644 --- a/freebsd/sys/sys/libkern.h +++ b/freebsd/sys/sys/libkern.h @@ -30,13 +30,13 @@ * $FreeBSD$ */ -#ifndef _SYS_LIBKERN_HH_ -#define _SYS_LIBKERN_HH_ +#ifndef _SYS_LIBKERN_H_ +#define _SYS_LIBKERN_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/types.h> +#include <sys/cdefs.h> +#include <rtems/bsd/sys/types.h> #ifdef _KERNEL -#include <freebsd/sys/systm.h> +#include <sys/systm.h> #endif #ifndef __rtems__ @@ -192,4 +192,4 @@ strrchr(const char *p, int ch) #define FNM_IGNORECASE FNM_CASEFOLD #define FNM_FILE_NAME FNM_PATHNAME -#endif /* !_SYS_LIBKERN_HH_ */ +#endif /* !_SYS_LIBKERN_H_ */ diff --git a/freebsd/sys/sys/limits.h b/freebsd/sys/sys/limits.h index b2850e20..633a7f70 100644 --- a/freebsd/sys/sys/limits.h +++ b/freebsd/sys/sys/limits.h @@ -1,9 +1,104 @@ -#include <sys/types.h> -#include <limits.h> +/*- + * Copyright (c) 1988, 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. + * + * $FreeBSD$ + */ -#define __FD_SETSIZE 1024 -#define FD_SETSIZE __FD_SETSIZE +#ifndef _SYS_LIMITS_H_ +#define _SYS_LIMITS_H_ -#define __CHAR_BIT CHAR_BIT /* number of bits in a char */ +#include <sys/cdefs.h> +#include <machine/_limits.h> +#ifndef __rtems__ +#define CHAR_BIT __CHAR_BIT /* number of bits in a char */ +#define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */ +#define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */ + +#define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */ + +#ifdef __CHAR_UNSIGNED__ +#define CHAR_MAX UCHAR_MAX /* max value for a char */ +#define CHAR_MIN 0 /* min value for a char */ +#else +#define CHAR_MAX SCHAR_MAX +#define CHAR_MIN SCHAR_MIN +#endif + +#define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */ +#define SHRT_MAX __SHRT_MAX /* max value for a short */ +#define SHRT_MIN __SHRT_MIN /* min value for a short */ + +#define UINT_MAX __UINT_MAX /* max value for an unsigned int */ +#define INT_MAX __INT_MAX /* max value for an int */ +#define INT_MIN __INT_MIN /* min value for an int */ + +#define ULONG_MAX __ULONG_MAX /* max for an unsigned long */ +#define LONG_MAX __LONG_MAX /* max for a long */ +#define LONG_MIN __LONG_MIN /* min for a long */ + +#ifdef __LONG_LONG_SUPPORTED +#define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */ +#define LLONG_MAX __LLONG_MAX /* max for a long long */ +#define LLONG_MIN __LLONG_MIN /* min for a long long */ +#endif + +#if __POSIX_VISIBLE || __XSI_VISIBLE +#define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */ +#endif + +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */ + +#define OFF_MAX __OFF_MAX /* max value for an off_t */ +#define OFF_MIN __OFF_MIN /* min value for an off_t */ +#endif +#endif /* __rtems__ */ + +#if __BSD_VISIBLE +#define GID_MAX UINT_MAX /* max value for a gid_t */ +#define UID_MAX UINT_MAX /* max value for a uid_t */ + +#define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */ +#define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ +#define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */ +#endif + +#ifndef __rtems__ +#if __XSI_VISIBLE +#define LONG_BIT __LONG_BIT +#define WORD_BIT __WORD_BIT +#endif + +#if __POSIX_VISIBLE +#define MQ_PRIO_MAX 64 +#endif +#endif /* __rtems__ */ + +#endif /* !_SYS_LIMITS_H_ */ diff --git a/freebsd/sys/sys/linker.h b/freebsd/sys/sys/linker.h index 449fa1ec..896b0c8c 100644 --- a/freebsd/sys/sys/linker.h +++ b/freebsd/sys/sys/linker.h @@ -26,13 +26,13 @@ * $FreeBSD$ */ -#ifndef _SYS_LINKER_HH_ -#define _SYS_LINKER_HH_ +#ifndef _SYS_LINKER_H_ +#define _SYS_LINKER_H_ #ifdef _KERNEL -#include <freebsd/machine/elf.h> -#include <freebsd/sys/kobj.h> +#include <machine/elf.h> +#include <sys/kobj.h> #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_LINKER); @@ -331,7 +331,7 @@ struct kld_sym_lookup { #ifndef _KERNEL -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS int kldload(const char* _file); @@ -346,4 +346,4 @@ __END_DECLS #endif -#endif /* !_SYS_LINKER_HH_ */ +#endif /* !_SYS_LINKER_H_ */ diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h index 2dd056bc..fc04fe0d 100644 --- a/freebsd/sys/sys/linker_set.h +++ b/freebsd/sys/sys/linker_set.h @@ -27,8 +27,8 @@ * $FreeBSD$ */ -#ifndef _SYS_LINKER_SET_HH_ -#define _SYS_LINKER_SET_HH_ +#ifndef _SYS_LINKER_SET_H_ +#define _SYS_LINKER_SET_H_ #ifndef _SYS_CDEFS_H_ #error this file needs sys/cdefs.h as a prerequisite @@ -111,4 +111,4 @@ #define SET_COUNT(set) \ (SET_LIMIT(set) - SET_BEGIN(set)) -#endif /* _SYS_LINKER_SET_HH_ */ +#endif /* _SYS_LINKER_SET_H_ */ diff --git a/freebsd/sys/sys/lock_profile.h b/freebsd/sys/sys/lock_profile.h index 92eb512f..579113a7 100644 --- a/freebsd/sys/sys/lock_profile.h +++ b/freebsd/sys/sys/lock_profile.h @@ -28,16 +28,16 @@ */ -#ifndef _SYS_LOCK_PROFILE_HH_ -#define _SYS_LOCK_PROFILE_HH_ +#ifndef _SYS_LOCK_PROFILE_H_ +#define _SYS_LOCK_PROFILE_H_ struct lock_profile_object; LIST_HEAD(lpohead, lock_profile_object); #ifdef _KERNEL #ifdef LOCK_PROFILING -#include <freebsd/machine/cpufunc.h> -#include <freebsd/sys/lock.h> +#include <machine/cpufunc.h> +#include <rtems/bsd/sys/lock.h> #ifndef USE_CPU_NANOSECONDS u_int64_t nanoseconds(void); @@ -72,4 +72,4 @@ lock_profile_obtain_lock_failed(struct lock_object *lo, int *contested, #endif /* _KERNEL */ -#endif /* _SYS_LOCK_PROFILE_HH_ */ +#endif /* _SYS_LOCK_PROFILE_H_ */ diff --git a/freebsd/sys/sys/lockmgr.h b/freebsd/sys/sys/lockmgr.h index 2020eb83..3d0aad0b 100644 --- a/freebsd/sys/sys/lockmgr.h +++ b/freebsd/sys/sys/lockmgr.h @@ -28,13 +28,13 @@ * $FreeBSD$ */ -#ifndef _SYS_LOCKMGR_HH_ -#define _SYS_LOCKMGR_HH_ +#ifndef _SYS_LOCKMGR_H_ +#define _SYS_LOCKMGR_H_ -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_lockmgr.h> -#include <freebsd/sys/_mutex.h> -#include <freebsd/sys/_rwlock.h> +#include <sys/_lock.h> +#include <sys/_lockmgr.h> +#include <sys/_mutex.h> +#include <sys/_rwlock.h> #define LK_SHARE 0x01 #define LK_SHARED_WAITERS 0x02 @@ -56,7 +56,7 @@ #ifdef _KERNEL #if !defined(LOCK_FILE) || !defined(LOCK_LINE) -#error "LOCK_FILE and LOCK_LINE not defined, include <sys/lock.h> before" +#error "LOCK_FILE and LOCK_LINE not defined, include <rtems/bsd/sys/lock.h> before" #endif struct thread; @@ -192,4 +192,4 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk, #endif /* _KERNEL */ -#endif /* !_SYS_LOCKMGR_HH_ */ +#endif /* !_SYS_LOCKMGR_H_ */ diff --git a/freebsd/sys/sys/mac.h b/freebsd/sys/sys/mac.h index f261c7ff..0aa89608 100644 --- a/freebsd/sys/sys/mac.h +++ b/freebsd/sys/sys/mac.h @@ -44,8 +44,8 @@ * http://www.TrustedBSD.org/ */ -#ifndef _SYS_MAC_HH_ -#define _SYS_MAC_HH_ +#ifndef _SYS_MAC_H_ +#define _SYS_MAC_H_ #ifndef _POSIX_MAC #define _POSIX_MAC @@ -108,4 +108,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_MAC_HH_ */ +#endif /* !_SYS_MAC_H_ */ diff --git a/freebsd/sys/sys/malloc.h b/freebsd/sys/sys/malloc.h index faca480d..d70fd21c 100644 --- a/freebsd/sys/sys/malloc.h +++ b/freebsd/sys/sys/malloc.h @@ -32,13 +32,13 @@ * $FreeBSD$ */ -#ifndef _SYS_MALLOC_HH_ -#define _SYS_MALLOC_HH_ +#ifndef _SYS_MALLOC_H_ +#define _SYS_MALLOC_H_ -#include <freebsd/sys/param.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <rtems/bsd/sys/param.h> +#include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> #define MINALLOCSIZE UMA_SMALLEST_UNIT @@ -186,4 +186,4 @@ void *reallocf(void *addr, unsigned long size, struct malloc_type *type, struct malloc_type *malloc_desc2type(const char *desc); #endif /* _KERNEL */ -#endif /* !_SYS_MALLOC_HH_ */ +#endif /* !_SYS_MALLOC_H_ */ diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h index 5988760e..148e9cd1 100644 --- a/freebsd/sys/sys/mbuf.h +++ b/freebsd/sys/sys/mbuf.h @@ -31,16 +31,16 @@ * $FreeBSD$ */ -#ifndef _SYS_MBUF_HH_ -#define _SYS_MBUF_HH_ +#ifndef _SYS_MBUF_H_ +#define _SYS_MBUF_H_ /* XXX: These includes suck. Sorry! */ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> #ifdef _KERNEL -#include <freebsd/sys/systm.h> -#include <freebsd/vm/uma.h> +#include <sys/systm.h> +#include <vm/uma.h> #ifdef WITNESS -#include <freebsd/sys/lock.h> +#include <rtems/bsd/sys/lock.h> #endif #endif @@ -1029,4 +1029,4 @@ m_tag_find(struct mbuf *m, int type, struct m_tag *start) #endif -#endif /* !_SYS_MBUF_HH_ */ +#endif /* !_SYS_MBUF_H_ */ diff --git a/freebsd/sys/sys/md5.h b/freebsd/sys/sys/md5.h index 9bf97cd6..e98b7afb 100644 --- a/freebsd/sys/sys/md5.h +++ b/freebsd/sys/sys/md5.h @@ -25,8 +25,8 @@ These notices must be retained in any copies of any part of this documentation and/or software. */ -#ifndef _SYS_MD5_HH_ -#define _SYS_MD5_HH_ +#ifndef _SYS_MD5_H_ +#define _SYS_MD5_H_ #define MD5_BLOCK_LENGTH 64 #define MD5_DIGEST_LENGTH 16 @@ -39,7 +39,7 @@ typedef struct MD5Context { unsigned char buffer[64]; /* input buffer */ } MD5_CTX; -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS void MD5Init (MD5_CTX *); @@ -50,4 +50,4 @@ char * MD5File(const char *, char *); char * MD5FileChunk(const char *, char *, off_t, off_t); char * MD5Data(const void *, unsigned int, char *); __END_DECLS -#endif /* _SYS_MD5_HH_ */ +#endif /* _SYS_MD5_H_ */ diff --git a/freebsd/sys/sys/mman.h b/freebsd/sys/sys/mman.h index 2d90a14d..4872d631 100644 --- a/freebsd/sys/sys/mman.h +++ b/freebsd/sys/sys/mman.h @@ -1,3 +1,238 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/mman.h> +/*- + * 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. + * + * @(#)mman.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD$ + */ +#ifndef _SYS_MMAN_H_ +#define _SYS_MMAN_H_ + +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> + +#if __BSD_VISIBLE +/* + * Inheritance for minherit() + */ +#define INHERIT_SHARE 0 +#define INHERIT_COPY 1 +#define INHERIT_NONE 2 +#endif + +/* + * Protections are chosen from these bits, or-ed together + */ +#define PROT_NONE 0x00 /* no permissions */ +#define PROT_READ 0x01 /* pages can be read */ +#define PROT_WRITE 0x02 /* pages can be written */ +#define PROT_EXEC 0x04 /* pages can be executed */ + +/* + * Flags contain sharing type and options. + * Sharing types; choose one. + */ +#define MAP_SHARED 0x0001 /* share changes */ +#define MAP_PRIVATE 0x0002 /* changes are private */ +#if __BSD_VISIBLE +#define MAP_COPY MAP_PRIVATE /* Obsolete */ +#endif + +/* + * Other flags + */ +#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ + +#if __BSD_VISIBLE +#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ +#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ +#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */ +#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */ +#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ +#define MAP_STACK 0x0400 /* region grows down, like a stack */ +#define MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */ + +/* + * Mapping type + */ +#define MAP_FILE 0x0000 /* map from file (default) */ +#define MAP_ANON 0x1000 /* allocated from memory, swap space */ + +/* + * Extended flags + */ +#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */ +#endif /* __BSD_VISIBLE */ + +#if __POSIX_VISIBLE >= 199309 +/* + * Process memory locking + */ +#define MCL_CURRENT 0x0001 /* Lock only current memory */ +#define MCL_FUTURE 0x0002 /* Lock all future memory as well */ +#endif + +/* + * Error return from mmap() + */ +#define MAP_FAILED ((void *)-1) + +/* + * msync() flags + */ +#define MS_SYNC 0x0000 /* msync synchronously */ +#define MS_ASYNC 0x0001 /* return immediately */ +#define MS_INVALIDATE 0x0002 /* invalidate all cached data */ + +/* + * Advice to madvise + */ +#define _MADV_NORMAL 0 /* no further special treatment */ +#define _MADV_RANDOM 1 /* expect random page references */ +#define _MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define _MADV_WILLNEED 3 /* will need these pages */ +#define _MADV_DONTNEED 4 /* dont need these pages */ + +#if __BSD_VISIBLE +#define MADV_NORMAL _MADV_NORMAL +#define MADV_RANDOM _MADV_RANDOM +#define MADV_SEQUENTIAL _MADV_SEQUENTIAL +#define MADV_WILLNEED _MADV_WILLNEED +#define MADV_DONTNEED _MADV_DONTNEED +#define MADV_FREE 5 /* dont need these pages, and junk contents */ +#define MADV_NOSYNC 6 /* try to avoid flushes to physical media */ +#define MADV_AUTOSYNC 7 /* revert to default flushing strategy */ +#define MADV_NOCORE 8 /* do not include these pages in a core file */ +#define MADV_CORE 9 /* revert to including pages in a core file */ +#define MADV_PROTECT 10 /* protect process from pageout kill */ + +/* + * Return bits from mincore + */ +#define MINCORE_INCORE 0x1 /* Page is incore */ +#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ +#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ +#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ +#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ +#define MINCORE_SUPER 0x20 /* Page is a "super" page */ + +/* + * Anonymous object constant for shm_open(). + */ +#define SHM_ANON ((char *)1) +#endif /* __BSD_VISIBLE */ + +/* + * XXX missing POSIX_TYPED_MEM_* macros and + * posix_typed_mem_info structure. + */ +#if __POSIX_VISIBLE >= 200112 +#define POSIX_MADV_NORMAL _MADV_NORMAL +#define POSIX_MADV_RANDOM _MADV_RANDOM +#define POSIX_MADV_SEQUENTIAL _MADV_SEQUENTIAL +#define POSIX_MADV_WILLNEED _MADV_WILLNEED +#define POSIX_MADV_DONTNEED _MADV_DONTNEED +#endif + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifdef _KERNEL +#include <vm/vm.h> + +struct shmfd { + size_t shm_size; + vm_object_t shm_object; + int shm_refs; + uid_t shm_uid; + gid_t shm_gid; + mode_t shm_mode; + + /* + * Values maintained solely to make this a better-behaved file + * descriptor for fstat() to run on. + */ + struct timespec shm_atime; + struct timespec shm_mtime; + struct timespec shm_ctime; + struct timespec shm_birthtime; + + struct label *shm_label; /* MAC label */ +}; + +int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, + vm_object_t *obj); + +#else /* !_KERNEL */ + +__BEGIN_DECLS +/* + * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(), + * posix_typed_mem_open(). + */ +#if __BSD_VISIBLE +int getpagesizes(size_t *, int); +int madvise(void *, size_t, int); +int mincore(const void *, size_t, char *); +int minherit(void *, size_t, int); +#endif +int mlock(const void *, size_t); +#ifndef _MMAP_DECLARED +#define _MMAP_DECLARED +void * mmap(void *, size_t, int, int, int, off_t); +#endif +int mprotect(const void *, size_t, int); +int msync(void *, size_t, int); +int munlock(const void *, size_t); +int munmap(void *, size_t); +#if __POSIX_VISIBLE >= 200112 +int posix_madvise(void *, size_t, int); +#endif +#if __POSIX_VISIBLE >= 199309 +int mlockall(int); +int munlockall(void); +int shm_open(const char *, int, mode_t); +int shm_unlink(const char *); +#endif +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_SYS_MMAN_H_ */ diff --git a/freebsd/sys/sys/module.h b/freebsd/sys/sys/module.h index 3b67ad5a..782770a7 100644 --- a/freebsd/sys/sys/module.h +++ b/freebsd/sys/sys/module.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_MODULE_HH_ -#define _SYS_MODULE_HH_ +#ifndef _SYS_MODULE_H_ +#define _SYS_MODULE_H_ /* * Module metadata types @@ -94,7 +94,7 @@ struct mod_metadata { #ifdef _KERNEL -#include <freebsd/sys/linker_set.h> +#include <sys/linker_set.h> #define MODULE_METADATA(uniquifier, type, data, cval) \ static struct mod_metadata _mod_metadata##uniquifier = { \ @@ -204,7 +204,7 @@ struct module_stat { #ifndef _KERNEL -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS int modnext(int _modid); @@ -215,4 +215,4 @@ __END_DECLS #endif -#endif /* !_SYS_MODULE_HH_ */ +#endif /* !_SYS_MODULE_H_ */ diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h index 9ec6915d..fcf80bd5 100644 --- a/freebsd/sys/sys/mount.h +++ b/freebsd/sys/sys/mount.h @@ -30,15 +30,15 @@ * $FreeBSD$ */ -#ifndef _SYS_MOUNT_HH_ -#define _SYS_MOUNT_HH_ +#ifndef _SYS_MOUNT_H_ +#define _SYS_MOUNT_H_ -#include <freebsd/sys/ucred.h> -#include <freebsd/sys/queue.h> +#include <sys/ucred.h> +#include <sys/queue.h> #ifdef _KERNEL -#include <freebsd/sys/lock.h> -#include <freebsd/sys/lockmgr.h> -#include <freebsd/sys/_mutex.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/lockmgr.h> +#include <sys/_mutex.h> #endif /* @@ -663,7 +663,7 @@ vfs_statfs_t __vfs_statfs; VN_KNOTE((vp), (hint), 0); \ } while (0) -#include <freebsd/sys/module.h> +#include <sys/module.h> /* * Version numbers. @@ -771,7 +771,7 @@ vfs_sysctl_t vfs_stdsysctl; #else /* !_KERNEL */ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> struct stat; @@ -795,4 +795,4 @@ __END_DECLS #endif /* _KERNEL */ -#endif /* !_SYS_MOUNT_HH_ */ +#endif /* !_SYS_MOUNT_H_ */ diff --git a/freebsd/sys/sys/mqueue.h b/freebsd/sys/sys/mqueue.h index 80d40479..36e89fa2 100644 --- a/freebsd/sys/sys/mqueue.h +++ b/freebsd/sys/sys/mqueue.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_MQUEUE_HH_ -#define _SYS_MQUEUE_HH_ +#ifndef _SYS_MQUEUE_H_ +#define _SYS_MQUEUE_H_ struct mq_attr { long mq_flags; /* Message queue flags. */ diff --git a/freebsd/sys/sys/mutex.h b/freebsd/sys/sys/mutex.h index 0e8e1739..3e4a1701 100644 --- a/freebsd/sys/sys/mutex.h +++ b/freebsd/sys/sys/mutex.h @@ -29,24 +29,24 @@ * $FreeBSD$ */ -#ifndef _SYS_MUTEX_HH_ -#define _SYS_MUTEX_HH_ +#ifndef _SYS_MUTEX_H_ +#define _SYS_MUTEX_H_ #ifndef LOCORE -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> #ifdef _KERNEL -#include <freebsd/sys/pcpu.h> -#include <freebsd/sys/lock_profile.h> -#include <freebsd/sys/lockstat.h> -#include <freebsd/machine/atomic.h> -#include <freebsd/machine/cpufunc.h> +#include <sys/pcpu.h> +#include <sys/lock_profile.h> +#include <sys/lockstat.h> +#include <machine/atomic.h> +#include <machine/cpufunc.h> #endif /* _KERNEL_ */ #endif /* !LOCORE */ -#include <freebsd/machine/mutex.h> +#include <machine/mutex.h> #ifdef _KERNEL @@ -337,7 +337,7 @@ extern struct mtx_pool *mtxpool_lockbuilder; extern struct mtx_pool *mtxpool_sleep; #ifndef LOCK_DEBUG -#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/mutex.h> +#error LOCK_DEBUG not defined, include <rtems/bsd/sys/lock.h> before <sys/mutex.h> #endif #if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE) #define mtx_lock_flags(m, opts) \ @@ -471,4 +471,4 @@ struct mtx_args { #endif /* _KERNEL */ #endif /* !LOCORE */ -#endif /* _SYS_MUTEX_HH_ */ +#endif /* _SYS_MUTEX_H_ */ diff --git a/freebsd/sys/sys/osd.h b/freebsd/sys/sys/osd.h index a1989de0..63d536fa 100644 --- a/freebsd/sys/sys/osd.h +++ b/freebsd/sys/sys/osd.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_OSD_HH_ -#define _SYS_OSD_HH_ +#ifndef _SYS_OSD_H_ +#define _SYS_OSD_H_ -#include <freebsd/sys/queue.h> +#include <sys/queue.h> /* * Lock key: @@ -98,4 +98,4 @@ void osd_exit(u_int type, struct osd *osd); #endif /* _KERNEL */ -#endif /* !_SYS_OSD_HH_ */ +#endif /* !_SYS_OSD_H_ */ diff --git a/freebsd/sys/sys/pciio.h b/freebsd/sys/sys/pciio.h index c4a5abf8..a0c4560e 100644 --- a/freebsd/sys/sys/pciio.h +++ b/freebsd/sys/sys/pciio.h @@ -28,10 +28,10 @@ * */ -#ifndef _SYS_PCIIO_HH_ -#define _SYS_PCIIO_HH_ +#ifndef _SYS_PCIIO_H_ +#define _SYS_PCIIO_H_ -#include <freebsd/sys/ioccom.h> +#include <sys/ioccom.h> #define PCI_MAXNAMELEN 16 @@ -122,4 +122,4 @@ struct pci_bar_io { #define PCIOCATTACHED _IOWR('p', 4, struct pci_io) #define PCIOCGETBAR _IOWR('p', 6, struct pci_bar_io) -#endif /* !_SYS_PCIIO_HH_ */ +#endif /* !_SYS_PCIIO_H_ */ diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h index ce84f15a..48a3bccb 100644 --- a/freebsd/sys/sys/pcpu.h +++ b/freebsd/sys/sys/pcpu.h @@ -30,19 +30,19 @@ * $FreeBSD$ */ -#ifndef _SYS_PCPU_HH_ -#define _SYS_PCPU_HH_ +#ifndef _SYS_PCPU_H_ +#define _SYS_PCPU_H_ #ifdef LOCORE #error "no assembler-serviceable parts inside" #endif -#include <freebsd/sys/queue.h> +#include <sys/queue.h> #ifndef __rtems__ -#include <freebsd/sys/vmmeter.h> +#include <sys/vmmeter.h> #endif -#include <freebsd/sys/resource.h> -#include <freebsd/machine/pcpu.h> +#include <rtems/bsd/sys/resource.h> +#include <machine/pcpu.h> /* * Define a set for pcpu data. @@ -230,4 +230,4 @@ void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size); #endif /* _KERNEL */ -#endif /* !_SYS_PCPU_HH_ */ +#endif /* !_SYS_PCPU_H_ */ diff --git a/freebsd/sys/sys/poll.h b/freebsd/sys/sys/poll.h index 1d09405a..c955f321 100644 --- a/freebsd/sys/sys/poll.h +++ b/freebsd/sys/sys/poll.h @@ -28,10 +28,10 @@ * $FreeBSD$ */ -#ifndef _SYS_POLL_HH_ -#define _SYS_POLL_HH_ +#ifndef _SYS_POLL_H_ +#define _SYS_POLL_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /* * This file is intended to be compatible with the traditional poll.h. @@ -101,4 +101,4 @@ __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_POLL_HH_ */ +#endif /* !_SYS_POLL_H_ */ diff --git a/freebsd/sys/sys/priority.h b/freebsd/sys/sys/priority.h index dbaa5eaa..9bbd2de8 100644 --- a/freebsd/sys/sys/priority.h +++ b/freebsd/sys/sys/priority.h @@ -31,8 +31,8 @@ * $FreeBSD$ */ -#ifndef _SYS_PRIORITY_HH_ -#define _SYS_PRIORITY_HH_ +#ifndef _SYS_PRIORITY_H_ +#define _SYS_PRIORITY_H_ /* * Process priority specifications. @@ -127,4 +127,4 @@ struct priority { u_char pri_user; /* User priority based on p_cpu and p_nice. */ }; -#endif /* !_SYS_PRIORITY_HH_ */ +#endif /* !_SYS_PRIORITY_H_ */ diff --git a/freebsd/sys/sys/priv.h b/freebsd/sys/sys/priv.h index 78342669..6939e144 100644 --- a/freebsd/sys/sys/priv.h +++ b/freebsd/sys/sys/priv.h @@ -32,8 +32,8 @@ /* * Privilege checking interface for BSD kernel. */ -#ifndef _SYS_PRIV_HH_ -#define _SYS_PRIV_HH_ +#ifndef _SYS_PRIV_H_ +#define _SYS_PRIV_H_ /* * Privilege list, sorted loosely by kernel subsystem. @@ -515,4 +515,4 @@ int priv_check_cred(struct ucred *cred, int priv, int flags); #endif /* __rtems__ */ #endif -#endif /* !_SYS_PRIV_HH_ */ +#endif /* !_SYS_PRIV_H_ */ diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h index 43c2044c..cd10421e 100644 --- a/freebsd/sys/sys/proc.h +++ b/freebsd/sys/sys/proc.h @@ -35,35 +35,35 @@ * $FreeBSD$ */ -#ifndef _SYS_PROC_HH_ -#define _SYS_PROC_HH_ +#ifndef _SYS_PROC_H_ +#define _SYS_PROC_H_ -#include <freebsd/sys/callout.h> /* For struct callout. */ -#include <freebsd/sys/event.h> /* For struct klist. */ -#include <freebsd/sys/condvar.h> +#include <sys/callout.h> /* For struct callout. */ +#include <sys/event.h> /* For struct klist. */ +#include <sys/condvar.h> #ifndef _KERNEL -#include <freebsd/sys/filedesc.h> +#include <sys/filedesc.h> #endif -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/lock_profile.h> -#include <freebsd/sys/_mutex.h> -#include <freebsd/sys/osd.h> -#include <freebsd/sys/priority.h> -#include <freebsd/sys/rtprio.h> /* XXX. */ -#include <freebsd/sys/runq.h> -#include <freebsd/sys/resource.h> -#include <freebsd/sys/sigio.h> -#include <freebsd/sys/signal.h> -#include <freebsd/sys/signalvar.h> +#include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/lock_profile.h> +#include <sys/_mutex.h> +#include <sys/osd.h> +#include <sys/priority.h> +#include <sys/rtprio.h> /* XXX. */ +#include <sys/runq.h> +#include <rtems/bsd/sys/resource.h> +#include <sys/sigio.h> +#include <sys/signal.h> +#include <sys/signalvar.h> #ifndef _KERNEL -#include <freebsd/sys/time.h> /* For structs itimerval, timeval. */ +#include <rtems/bsd/sys/time.h> /* For structs itimerval, timeval. */ #else -#include <freebsd/sys/pcpu.h> +#include <sys/pcpu.h> #endif -#include <freebsd/sys/ucontext.h> -#include <freebsd/sys/ucred.h> -#include <freebsd/machine/proc.h> /* Machine-dependent proc substruct. */ +#include <sys/ucontext.h> +#include <sys/ucred.h> +#include <machine/proc.h> /* Machine-dependent proc substruct. */ /* * One structure allocated per session. @@ -926,4 +926,4 @@ void thr_exit1(void); #endif /* _KERNEL */ -#endif /* !_SYS_PROC_HH_ */ +#endif /* !_SYS_PROC_H_ */ diff --git a/freebsd/sys/sys/protosw.h b/freebsd/sys/sys/protosw.h index 5b8e9f03..b55af4b7 100644 --- a/freebsd/sys/sys/protosw.h +++ b/freebsd/sys/sys/protosw.h @@ -30,8 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_PROTOSW_HH_ -#define _SYS_PROTOSW_HH_ +#ifndef _SYS_PROTOSW_H_ +#define _SYS_PROTOSW_H_ /* Forward declare these structures referenced from prototypes below. */ struct mbuf; diff --git a/freebsd/sys/sys/queue.h b/freebsd/sys/sys/queue.h index e303641a..f0bae8d9 100644 --- a/freebsd/sys/sys/queue.h +++ b/freebsd/sys/sys/queue.h @@ -30,10 +30,10 @@ * $FreeBSD$ */ -#ifndef _SYS_QUEUE_HH_ -#define _SYS_QUEUE_HH_ +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /* * This file defines four types of data structures: singly-linked lists, @@ -633,4 +633,4 @@ struct { \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) -#endif /* !_SYS_QUEUE_HH_ */ +#endif /* !_SYS_QUEUE_H_ */ diff --git a/freebsd/sys/sys/random.h b/freebsd/sys/sys/random.h index e5dea939..5cf1611e 100644 --- a/freebsd/sys/sys/random.h +++ b/freebsd/sys/sys/random.h @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_RANDOM_HH_ -#define _SYS_RANDOM_HH_ +#ifndef _SYS_RANDOM_H_ +#define _SYS_RANDOM_H_ #ifdef _KERNEL @@ -63,4 +63,4 @@ extern struct harvest_select harvest; #endif /* _KERNEL */ -#endif /* _SYS_RANDOM_HH_ */ +#endif /* _SYS_RANDOM_H_ */ diff --git a/freebsd/sys/sys/reboot.h b/freebsd/sys/sys/reboot.h index c2ffd30e..6b8e25e6 100644 --- a/freebsd/sys/sys/reboot.h +++ b/freebsd/sys/sys/reboot.h @@ -30,8 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_REBOOT_HH_ -#define _SYS_REBOOT_HH_ +#ifndef _SYS_REBOOT_H_ +#define _SYS_REBOOT_H_ /* * Arguments to reboot system call. These are passed to diff --git a/freebsd/sys/sys/refcount.h b/freebsd/sys/sys/refcount.h index 6ec2417e..848b69ca 100644 --- a/freebsd/sys/sys/refcount.h +++ b/freebsd/sys/sys/refcount.h @@ -32,10 +32,10 @@ #ifndef __SYS_REFCOUNT_HH__ #define __SYS_REFCOUNT_HH__ -#include <freebsd/machine/atomic.h> +#include <machine/atomic.h> #ifdef _KERNEL -#include <freebsd/sys/systm.h> +#include <sys/systm.h> #else #define KASSERT(exp, msg) /* */ #endif diff --git a/freebsd/sys/sys/resourcevar.h b/freebsd/sys/sys/resourcevar.h index 53901f39..688bc22d 100644 --- a/freebsd/sys/sys/resourcevar.h +++ b/freebsd/sys/sys/resourcevar.h @@ -30,14 +30,14 @@ * $FreeBSD$ */ -#ifndef _SYS_RESOURCEVAR_HH_ -#define _SYS_RESOURCEVAR_HH_ +#ifndef _SYS_RESOURCEVAR_H_ +#define _SYS_RESOURCEVAR_H_ -#include <freebsd/sys/resource.h> -#include <freebsd/sys/queue.h> +#include <rtems/bsd/sys/resource.h> +#include <sys/queue.h> #ifdef _KERNEL -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> #endif /* @@ -140,4 +140,4 @@ void uihashinit(void); void uihold(struct uidinfo *uip); #endif /* _KERNEL */ -#endif /* !_SYS_RESOURCEVAR_HH_ */ +#endif /* !_SYS_RESOURCEVAR_H_ */ diff --git a/freebsd/sys/sys/rman.h b/freebsd/sys/sys/rman.h index 3f909a22..ba06cc04 100644 --- a/freebsd/sys/sys/rman.h +++ b/freebsd/sys/sys/rman.h @@ -29,14 +29,14 @@ * $FreeBSD$ */ -#ifndef _SYS_RMAN_HH_ -#define _SYS_RMAN_HH_ 1 +#ifndef _SYS_RMAN_H_ +#define _SYS_RMAN_H_ 1 #ifndef _KERNEL -#include <freebsd/sys/queue.h> +#include <sys/queue.h> #else -#include <freebsd/machine/_bus.h> -#include <freebsd/machine/resource.h> +#include <machine/_bus.h> +#include <machine/resource.h> #endif #define RF_ALLOCATED 0x0001 /* resource has been reserved */ @@ -152,4 +152,4 @@ extern struct rman_head rman_head; #endif /* _KERNEL */ -#endif /* !_SYS_RMAN_HH_ */ +#endif /* !_SYS_RMAN_H_ */ diff --git a/freebsd/sys/sys/rmlock.h b/freebsd/sys/sys/rmlock.h index ec676b74..04a1e79c 100644 --- a/freebsd/sys/sys/rmlock.h +++ b/freebsd/sys/sys/rmlock.h @@ -29,12 +29,12 @@ * $FreeBSD$ */ -#ifndef _SYS_RMLOCK_HH_ -#define _SYS_RMLOCK_HH_ +#ifndef _SYS_RMLOCK_H_ +#define _SYS_RMLOCK_H_ -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_rmlock.h> +#include <sys/mutex.h> +#include <sys/_lock.h> +#include <sys/_rmlock.h> #ifdef _KERNEL @@ -68,7 +68,7 @@ void _rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker); * Public interface for lock operations. */ #ifndef LOCK_DEBUG -#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/rmlock.h> +#error LOCK_DEBUG not defined, include <rtems/bsd/sys/lock.h> before <sys/rmlock.h> #endif #if LOCK_DEBUG > 0 @@ -135,4 +135,4 @@ struct rm_args_flags { rm_destroy, (rm)) #endif /* _KERNEL */ -#endif /* !_SYS_RMLOCK_HH_ */ +#endif /* !_SYS_RMLOCK_H_ */ diff --git a/freebsd/sys/sys/rtprio.h b/freebsd/sys/sys/rtprio.h index 0694c119..7ffdb732 100644 --- a/freebsd/sys/sys/rtprio.h +++ b/freebsd/sys/sys/rtprio.h @@ -31,10 +31,10 @@ * $FreeBSD$ */ -#ifndef _SYS_RTPRIO_HH_ -#define _SYS_RTPRIO_HH_ +#ifndef _SYS_RTPRIO_H_ +#define _SYS_RTPRIO_H_ -#include <freebsd/sys/priority.h> +#include <sys/priority.h> /* * Process realtime-priority specifications to rtprio. @@ -82,11 +82,11 @@ void pri_to_rtp(struct thread *, struct rtprio *); #endif #ifndef _KERNEL -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS int rtprio(int, pid_t, struct rtprio *); int rtprio_thread(int, lwpid_t, struct rtprio *); __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SYS_RTPRIO_HH_ */ +#endif /* !_SYS_RTPRIO_H_ */ diff --git a/freebsd/sys/sys/runq.h b/freebsd/sys/sys/runq.h index ce2dada1..50c00eb6 100644 --- a/freebsd/sys/sys/runq.h +++ b/freebsd/sys/sys/runq.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _RUNQ_HH_ -#define _RUNQ_HH_ +#ifndef _RUNQ_H_ +#define _RUNQ_H_ -#include <freebsd/machine/runq.h> +#include <machine/runq.h> struct thread; diff --git a/freebsd/sys/sys/rwlock.h b/freebsd/sys/sys/rwlock.h index c3d6ee7a..82e95c4b 100644 --- a/freebsd/sys/sys/rwlock.h +++ b/freebsd/sys/sys/rwlock.h @@ -29,17 +29,17 @@ * $FreeBSD$ */ -#ifndef _SYS_RWLOCK_HH_ -#define _SYS_RWLOCK_HH_ +#ifndef _SYS_RWLOCK_H_ +#define _SYS_RWLOCK_H_ -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_rwlock.h> -#include <freebsd/sys/lock_profile.h> -#include <freebsd/sys/lockstat.h> +#include <sys/_lock.h> +#include <sys/_rwlock.h> +#include <sys/lock_profile.h> +#include <sys/lockstat.h> #ifdef _KERNEL -#include <freebsd/sys/pcpu.h> -#include <freebsd/machine/atomic.h> +#include <sys/pcpu.h> +#include <machine/atomic.h> #endif #ifdef __rtems__ @@ -155,7 +155,7 @@ void _rw_assert(struct rwlock *rw, int what, const char *file, int line); */ #ifndef LOCK_DEBUG -#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/rwlock.h> +#error LOCK_DEBUG not defined, include <rtems/bsd/sys/lock.h> before <sys/rwlock.h> #endif #if LOCK_DEBUG > 0 || defined(RWLOCK_NOINLINE) #define rw_wlock(rw) _rw_wlock((rw), LOCK_FILE, LOCK_LINE) @@ -248,4 +248,4 @@ struct rw_args_flags { #endif #endif /* _KERNEL */ -#endif /* !_SYS_RWLOCK_HH_ */ +#endif /* !_SYS_RWLOCK_H_ */ diff --git a/freebsd/sys/sys/sbuf.h b/freebsd/sys/sys/sbuf.h index 6b270d3d..ee74ce5b 100644 --- a/freebsd/sys/sys/sbuf.h +++ b/freebsd/sys/sys/sbuf.h @@ -28,10 +28,10 @@ * $FreeBSD$ */ -#ifndef _SYS_SBUF_HH_ -#define _SYS_SBUF_HH_ +#ifndef _SYS_SBUF_H_ +#define _SYS_SBUF_H_ -#include <freebsd/sys/_types.h> +#include <rtems/bsd/sys/_types.h> /* * Structure definition diff --git a/freebsd/sys/sys/select.h b/freebsd/sys/sys/select.h index 03f7d851..f348f54e 100644 --- a/freebsd/sys/sys/select.h +++ b/freebsd/sys/sys/select.h @@ -1,3 +1,114 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/select.h> +/*- + * Copyright (c) 1992, 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. + * + * $FreeBSD$ + */ +#ifndef _SYS_SELECT_H_ +#define _SYS_SELECT_H_ + +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> + +#include <sys/_sigset.h> +#include <sys/_timeval.h> +#include <rtems/bsd/sys/timespec.h> + +#ifndef __rtems__ +typedef unsigned long __fd_mask; +#if __BSD_VISIBLE +typedef __fd_mask fd_mask; +#endif + +#ifndef _SIGSET_T_DECLARED +#define _SIGSET_T_DECLARED +typedef __sigset_t sigset_t; +#endif + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024U +#endif + +#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ +#if __BSD_VISIBLE +#define NFDBITS _NFDBITS +#endif + +#ifndef _howmany +#define _howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct fd_set { + __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; +} fd_set; +#if __BSD_VISIBLE +#define fds_bits __fds_bits +#endif + +#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) +#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) +#if __BSD_VISIBLE +#define FD_COPY(f, t) (void)(*(t) = *(f)) +#endif +#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) +#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) +#define FD_ZERO(p) do { \ + fd_set *_p; \ + __size_t _n; \ + \ + _p = (p); \ + _n = _howmany(FD_SETSIZE, _NFDBITS); \ + while (_n > 0) \ + _p->__fds_bits[--_n] = 0; \ +} while (0) +#else /* __rtems__ */ +#include <rtems/bsd/sys/types.h> +#include <rtems/bsd/sys/time.h> +#include <sys/signal.h> +#endif /* __rtems__ */ + +#ifndef _KERNEL + +__BEGIN_DECLS +int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, + const struct timespec *__restrict, const sigset_t *__restrict); +#ifndef _SELECT_DECLARED +#define _SELECT_DECLARED +/* XXX missing restrict type-qualifier */ +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif +__END_DECLS +#endif /* !_KERNEL */ + +#endif /* _SYS_SELECT_H_ */ diff --git a/freebsd/sys/sys/selinfo.h b/freebsd/sys/sys/selinfo.h index da20189b..39e540f7 100644 --- a/freebsd/sys/sys/selinfo.h +++ b/freebsd/sys/sys/selinfo.h @@ -30,10 +30,10 @@ * $FreeBSD$ */ -#ifndef _SYS_SELINFO_HH_ -#define _SYS_SELINFO_HH_ +#ifndef _SYS_SELINFO_H_ +#define _SYS_SELINFO_H_ -#include <freebsd/sys/event.h> /* for struct klist */ +#include <sys/event.h> /* for struct klist */ struct selfd; TAILQ_HEAD(selfdlist, selfd); @@ -61,4 +61,4 @@ void selwakeuppri(struct selinfo *sip, int pri); void seltdfini(struct thread *td); #endif -#endif /* !_SYS_SELINFO_HH_ */ +#endif /* !_SYS_SELINFO_H_ */ diff --git a/freebsd/sys/sys/sf_buf.h b/freebsd/sys/sys/sf_buf.h index 5dbcd5ef..af420652 100644 --- a/freebsd/sys/sys/sf_buf.h +++ b/freebsd/sys/sys/sf_buf.h @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef _SYS_SF_BUF_HH_ -#define _SYS_SF_BUF_HH_ +#ifndef _SYS_SF_BUF_H_ +#define _SYS_SF_BUF_H_ -#include <freebsd/machine/sf_buf.h> +#include <machine/sf_buf.h> /* * Options to sf_buf_alloc() are specified through its flags argument. This @@ -53,4 +53,4 @@ struct sf_buf * void sf_buf_free(struct sf_buf *sf); void sf_buf_mext(void *addr, void *args); -#endif /* !_SYS_SF_BUF_HH_ */ +#endif /* !_SYS_SF_BUF_H_ */ diff --git a/freebsd/sys/sys/sigio.h b/freebsd/sys/sys/sigio.h index dc29d948..62ece6d4 100644 --- a/freebsd/sys/sys/sigio.h +++ b/freebsd/sys/sys/sigio.h @@ -30,8 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_SIGIO_HH_ -#define _SYS_SIGIO_HH_ +#ifndef _SYS_SIGIO_H_ +#define _SYS_SIGIO_H_ /* * This structure holds the information needed to send a SIGIO or @@ -64,4 +64,4 @@ int fsetown(pid_t pgid, struct sigio **sigiop); void funsetown(struct sigio **sigiop); void funsetownlst(struct sigiolst *sigiolst); -#endif /* _SYS_SIGIO_HH_ */ +#endif /* _SYS_SIGIO_H_ */ diff --git a/freebsd/sys/sys/smp.h b/freebsd/sys/sys/smp.h index c73bec25..619eba81 100644 --- a/freebsd/sys/sys/smp.h +++ b/freebsd/sys/sys/smp.h @@ -9,8 +9,8 @@ * $FreeBSD$ */ -#ifndef _SYS_SMP_HH_ -#define _SYS_SMP_HH_ +#ifndef _SYS_SMP_H_ +#define _SYS_SMP_H_ #ifdef _KERNEL @@ -180,4 +180,4 @@ void smp_rendezvous_cpus(cpumask_t, void *arg); #endif /* !LOCORE */ #endif /* _KERNEL */ -#endif /* _SYS_SMP_HH_ */ +#endif /* _SYS_SMP_H_ */ diff --git a/freebsd/sys/sys/sockbuf.h b/freebsd/sys/sys/sockbuf.h index 5de6f6eb..b8e66999 100644 --- a/freebsd/sys/sys/sockbuf.h +++ b/freebsd/sys/sys/sockbuf.h @@ -30,12 +30,12 @@ * * $FreeBSD$ */ -#ifndef _SYS_SOCKBUF_HH_ -#define _SYS_SOCKBUF_HH_ -#include <freebsd/sys/selinfo.h> /* for struct selinfo */ -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> -#include <freebsd/sys/_sx.h> +#ifndef _SYS_SOCKBUF_H_ +#define _SYS_SOCKBUF_H_ +#include <sys/selinfo.h> /* for struct selinfo */ +#include <sys/_lock.h> +#include <sys/_mutex.h> +#include <sys/_sx.h> #define SB_MAX (256*1024) /* default for max chars in sockbuf */ @@ -220,4 +220,4 @@ void sblastmbufchk(struct sockbuf *, const char *, int); #endif /* _KERNEL */ -#endif /* _SYS_SOCKBUF_HH_ */ +#endif /* _SYS_SOCKBUF_H_ */ diff --git a/freebsd/sys/sys/socket.h b/freebsd/sys/sys/socket.h index 39138881..9481e5c4 100644 --- a/freebsd/sys/sys/socket.h +++ b/freebsd/sys/sys/socket.h @@ -1,2 +1,691 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/socket.h> +/*- + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * 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. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $FreeBSD$ + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> +#include <sys/_iovec.h> +#define _NO_NAMESPACE_POLLUTION +#include <machine/rtems-bsd-param.h> +#undef _NO_NAMESPACE_POLLUTION + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Data types. + */ +#if __BSD_VISIBLE +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif +#endif + +#ifndef _SA_FAMILY_T_DECLARED +typedef __sa_family_t sa_family_t; +#define _SA_FAMILY_T_DECLARED +#endif + +#ifndef _SOCKLEN_T_DECLARED +typedef __socklen_t socklen_t; +#define _SOCKLEN_T_DECLARED +#endif + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + +#if __BSD_VISIBLE +#ifndef _UID_T_DECLARED +typedef __uid_t uid_t; +#define _UID_T_DECLARED +#endif +#endif + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#if __BSD_VISIBLE +#define SOCK_RDM 4 /* reliably-delivered message */ +#endif +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#if __BSD_VISIBLE +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#endif +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#if __BSD_VISIBLE +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ +#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ +#define SO_NOSIGPIPE 0x0800 /* no SIGPIPE from EPIPE */ +#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */ +#define SO_BINTIME 0x2000 /* timestamp received dgram traffic */ +#endif +#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */ +#define SO_NO_DDP 0x8000 /* disable direct data placement */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#if __BSD_VISIBLE +#define SO_LABEL 0x1009 /* socket's MAC label */ +#define SO_PEERLABEL 0x1010 /* socket's peer's MAC label */ +#define SO_LISTENQLIMIT 0x1011 /* socket's backlog limit */ +#define SO_LISTENQLEN 0x1012 /* socket's complete queue length */ +#define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ +#define SO_SETFIB 0x1014 /* use this FIB to route */ +#endif + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +#if __BSD_VISIBLE +struct accept_filter_arg { + char af_name[16]; + char af_arg[256-16]; +}; +#endif + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#if __BSD_VISIBLE +#define AF_LOCAL AF_UNIX /* local to host (pipes, portals) */ +#endif +#define AF_UNIX 1 /* standardized name for AF_LOCAL */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#if __BSD_VISIBLE +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NETBIOS 6 /* SMB protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* European computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ +#define AF_ISDN 26 /* Integrated Services Digital Network*/ +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ +#define pseudo_AF_KEY 27 /* Internal key-management function */ +#endif +#define AF_INET6 28 /* IPv6 */ +#if __BSD_VISIBLE +#define AF_NATM 29 /* native ATM access */ +#define AF_ATM 30 /* ATM */ +#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers + * in interface output routine + */ +#define AF_NETGRAPH 32 /* Netgraph sockets */ +#define AF_SLOW 33 /* 802.3ad slow protocol */ +#define AF_SCLUSTER 34 /* Sitara cluster protocol */ +#define AF_ARP 35 +#define AF_BLUETOOTH 36 /* Bluetooth sockets */ +#define AF_IEEE80211 37 /* IEEE 802.11 protocol */ +#define AF_MAX 38 +/* + * When allocating a new AF_ constant, please only allocate + * even numbered constants for FreeBSD until 134 as odd numbered AF_ + * constants 39-133 are now reserved for vendors. + */ +#define AF_VENDOR00 39 +#define AF_VENDOR01 41 +#define AF_VENDOR02 43 +#define AF_VENDOR03 45 +#define AF_VENDOR04 47 +#define AF_VENDOR05 49 +#define AF_VENDOR06 51 +#define AF_VENDOR07 53 +#define AF_VENDOR08 55 +#define AF_VENDOR09 57 +#define AF_VENDOR10 59 +#define AF_VENDOR11 61 +#define AF_VENDOR12 63 +#define AF_VENDOR13 65 +#define AF_VENDOR14 67 +#define AF_VENDOR15 69 +#define AF_VENDOR16 71 +#define AF_VENDOR17 73 +#define AF_VENDOR18 75 +#define AF_VENDOR19 77 +#define AF_VENDOR20 79 +#define AF_VENDOR21 81 +#define AF_VENDOR22 83 +#define AF_VENDOR23 85 +#define AF_VENDOR24 87 +#define AF_VENDOR25 89 +#define AF_VENDOR26 91 +#define AF_VENDOR27 93 +#define AF_VENDOR28 95 +#define AF_VENDOR29 97 +#define AF_VENDOR30 99 +#define AF_VENDOR31 101 +#define AF_VENDOR32 103 +#define AF_VENDOR33 105 +#define AF_VENDOR34 107 +#define AF_VENDOR35 109 +#define AF_VENDOR36 111 +#define AF_VENDOR37 113 +#define AF_VENDOR38 115 +#define AF_VENDOR39 117 +#define AF_VENDOR40 119 +#define AF_VENDOR41 121 +#define AF_VENDOR42 123 +#define AF_VENDOR43 125 +#define AF_VENDOR44 127 +#define AF_VENDOR45 129 +#define AF_VENDOR46 131 +#define AF_VENDOR47 133 +#endif + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned char sa_len; /* total length */ + sa_family_t sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; +#if __BSD_VISIBLE +#define SOCK_MAXADDRLEN 255 /* longest possible addresses */ + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; +#endif + +#ifndef _STRUCT_SOCKADDR_STORAGE_DECLARED +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 128U +#define _SS_ALIGNSIZE (sizeof(__int64_t)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { + unsigned char ss_len; /* address length */ + sa_family_t ss_family; /* address family */ + char __ss_pad1[_SS_PAD1SIZE]; + __int64_t __ss_align; /* force desired struct alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; +#define _STRUCT_SOCKADDR_STORAGE_DECLARED +#endif + +#if __BSD_VISIBLE +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NETBIOS AF_NETBIOS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX +#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP +#define PF_ISDN AF_ISDN +#define PF_KEY pseudo_AF_KEY +#define PF_INET6 AF_INET6 +#define PF_NATM AF_NATM +#define PF_ATM AF_ATM +#define PF_NETGRAPH AF_NETGRAPH +#define PF_SLOW AF_SLOW +#define PF_SCLUSTER AF_SCLUSTER +#define PF_ARP AF_ARP +#define PF_BLUETOOTH AF_BLUETOOTH + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +#define CTL_NET_NAMES { \ + { 0, 0 }, \ + { "unix", CTLTYPE_NODE }, \ + { "inet", CTLTYPE_NODE }, \ + { "implink", CTLTYPE_NODE }, \ + { "pup", CTLTYPE_NODE }, \ + { "chaos", CTLTYPE_NODE }, \ + { "xerox_ns", CTLTYPE_NODE }, \ + { "iso", CTLTYPE_NODE }, \ + { "emca", CTLTYPE_NODE }, \ + { "datakit", CTLTYPE_NODE }, \ + { "ccitt", CTLTYPE_NODE }, \ + { "ibm_sna", CTLTYPE_NODE }, \ + { "decnet", CTLTYPE_NODE }, \ + { "dec_dli", CTLTYPE_NODE }, \ + { "lat", CTLTYPE_NODE }, \ + { "hylink", CTLTYPE_NODE }, \ + { "appletalk", CTLTYPE_NODE }, \ + { "route", CTLTYPE_NODE }, \ + { "link_layer", CTLTYPE_NODE }, \ + { "xtp", CTLTYPE_NODE }, \ + { "coip", CTLTYPE_NODE }, \ + { "cnt", CTLTYPE_NODE }, \ + { "rtip", CTLTYPE_NODE }, \ + { "ipx", CTLTYPE_NODE }, \ + { "sip", CTLTYPE_NODE }, \ + { "pip", CTLTYPE_NODE }, \ + { "isdn", CTLTYPE_NODE }, \ + { "key", CTLTYPE_NODE }, \ + { "inet6", CTLTYPE_NODE }, \ + { "natm", CTLTYPE_NODE }, \ + { "atm", CTLTYPE_NODE }, \ + { "hdrcomplete", CTLTYPE_NODE }, \ + { "netgraph", CTLTYPE_NODE }, \ + { "snp", CTLTYPE_NODE }, \ + { "scp", CTLTYPE_NODE }, \ +} + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_IFMALIST 4 /* return multicast address list */ +#define NET_RT_MAXID 5 + +#define CTL_NET_RT_NAMES { \ + { 0, 0 }, \ + { "dump", CTLTYPE_STRUCT }, \ + { "flags", CTLTYPE_STRUCT }, \ + { "iflist", CTLTYPE_STRUCT }, \ + { "ifmalist", CTLTYPE_STRUCT }, \ +} +#endif /* __BSD_VISIBLE */ + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 128 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + void *msg_name; /* optional address */ + socklen_t msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + void *msg_control; /* ancillary data, see below */ + socklen_t msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_NOTIFICATION 0x2000 /* SCTP notification */ +#if __BSD_VISIBLE +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_EOF 0x100 /* data completes connection */ +#define MSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs */ +#define MSG_COMPAT 0x8000 /* used in sendit() */ +#endif +#ifdef _KERNEL +#define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */ +#endif +#if __BSD_VISIBLE +#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */ +#endif + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + socklen_t cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +#if __BSD_VISIBLE +/* + * While we may have more groups than this, the cmsgcred struct must + * be able to fit in an mbuf and we have historically supported a + * maximum of 16 groups. +*/ +#define CMGROUP_MAX 16 + +/* + * Credentials structure, used to verify the identity of a peer + * process that has sent us a message. This is allocated by the + * peer process but filled in by the kernel. This prevents the + * peer from lying about its identity. (Note that cmcred_groups[0] + * is the effective GID.) + */ +struct cmsgcred { + pid_t cmcred_pid; /* PID of sending process */ + uid_t cmcred_uid; /* real UID of sending process */ + uid_t cmcred_euid; /* effective UID of sending process */ + gid_t cmcred_gid; /* real GID of sending process */ + short cmcred_ngroups; /* number or groups */ + gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ +}; + +/* + * Socket credentials. + */ +struct sockcred { + uid_t sc_uid; /* real user id */ + uid_t sc_euid; /* effective user id */ + gid_t sc_gid; /* real group id */ + gid_t sc_egid; /* effective group id */ + int sc_ngroups; /* number of supplemental groups */ + gid_t sc_groups[1]; /* variable length */ +}; + +/* + * Compute size of a sockcred structure with groups. + */ +#define SOCKCREDSIZE(ngrps) \ + (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) + +#endif /* __BSD_VISIBLE */ + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \ + _ALIGN(sizeof(struct cmsghdr))) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + ((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \ + ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \ + _ALIGN(sizeof(struct cmsghdr)) > \ + (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)0 : \ + (struct cmsghdr *)((char *)(cmsg) + \ + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len))) + +/* + * RFC 2292 requires to check msg_controllen, in case that the kernel returns + * an empty list for some reasons. + */ +#define CMSG_FIRSTHDR(mhdr) \ + ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(mhdr)->msg_control : \ + (struct cmsghdr *)NULL) + +#if __BSD_VISIBLE +/* RFC 2292 additions */ +#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l)) +#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) +#endif + +#ifdef _KERNEL +#define CMSG_ALIGN(n) _ALIGN(n) +#endif + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ +#if __BSD_VISIBLE +#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ +#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ +#define SCM_BINTIME 0x04 /* timestamp (struct bintime) */ +#endif + +#if __BSD_VISIBLE +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + char *msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + char *msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; +#endif + +/* + * howto arguments for shutdown(2), specified by Posix.1g. + */ +#define SHUT_RD 0 /* shut down the reading side */ +#define SHUT_WR 1 /* shut down the writing side */ +#define SHUT_RDWR 2 /* shut down both sides */ + +/* we cheat and use the SHUT_XX defines for these */ +#define PRU_FLUSH_RD SHUT_RD +#define PRU_FLUSH_WR SHUT_WR +#define PRU_FLUSH_RDWR SHUT_RDWR + + +#if __BSD_VISIBLE +/* + * sendfile(2) header/trailer struct + */ +struct sf_hdtr { + struct iovec *headers; /* pointer to an array of header struct iovec's */ + int hdr_cnt; /* number of header iovec's */ + struct iovec *trailers; /* pointer to an array of trailer struct iovec's */ + int trl_cnt; /* number of trailer iovec's */ +}; + +/* + * Sendfile-specific flag(s) + */ +#define SF_NODISKIO 0x00000001 +#define SF_MNOWAIT 0x00000002 +#define SF_SYNC 0x00000004 +#endif + +#ifndef _KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept(int, struct sockaddr * __restrict, socklen_t * __restrict); +int bind(int, const struct sockaddr *, socklen_t); +int connect(int, const struct sockaddr *, socklen_t); +int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); +int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); +int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); +int listen(int, int); +ssize_t recv(int, void *, size_t, int); +ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict); +ssize_t recvmsg(int, struct msghdr *, int); +ssize_t send(int, const void *, size_t, int); +ssize_t sendto(int, const void *, + size_t, int, const struct sockaddr *, socklen_t); +ssize_t sendmsg(int, const struct msghdr *, int); +#if __BSD_VISIBLE +int sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int); +int setfib(int); +#endif +int setsockopt(int, int, int, const void *, socklen_t); +int shutdown(int, int); +int sockatmark(int); +int socket(int, int, int); +int socketpair(int, int, int, int *); +__END_DECLS + +#endif /* !_KERNEL */ + +#ifdef _KERNEL +struct socket; + +struct tcpcb *so_sototcpcb(struct socket *so); +struct inpcb *so_sotoinpcb(struct socket *so); +struct sockbuf *so_sockbuf_snd(struct socket *); +struct sockbuf *so_sockbuf_rcv(struct socket *); + +int so_state_get(const struct socket *); +void so_state_set(struct socket *, int); + +int so_options_get(const struct socket *); +void so_options_set(struct socket *, int); + +int so_error_get(const struct socket *); +void so_error_set(struct socket *, int); + +int so_linger_get(const struct socket *); +void so_linger_set(struct socket *, int); + +struct protosw *so_protosw_get(const struct socket *); +void so_protosw_set(struct socket *, struct protosw *); + +void so_sorwakeup_locked(struct socket *so); +void so_sowwakeup_locked(struct socket *so); + +void so_sorwakeup(struct socket *so); +void so_sowwakeup(struct socket *so); + +void so_lock(struct socket *so); +void so_unlock(struct socket *so); + +void so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg); + +#endif + + +#endif /* !_SYS_SOCKET_H_ */ diff --git a/freebsd/sys/sys/socketvar.h b/freebsd/sys/sys/socketvar.h index 5c3a9b4d..88990831 100644 --- a/freebsd/sys/sys/socketvar.h +++ b/freebsd/sys/sys/socketvar.h @@ -1,2 +1,393 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/socketvar.h> +/*- + * Copyright (c) 1982, 1986, 1990, 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. + * + * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 + * + * $FreeBSD$ + */ + +#ifndef _SYS_SOCKETVAR_H_ +#define _SYS_SOCKETVAR_H_ + +#include <sys/queue.h> /* for TAILQ macros */ +#include <sys/selinfo.h> /* for struct selinfo */ +#include <sys/_lock.h> +#include <sys/_mutex.h> +#include <sys/_sx.h> +#include <sys/sockbuf.h> +#include <sys/sockstate.h> +#ifdef _KERNEL +#include <sys/sockopt.h> +#endif + +struct vnet; + +/* + * Kernel structure per socket. + * Contains send and receive buffer queues, + * handle on protocol and pointer to protocol + * private data and error information. + */ +typedef u_quad_t so_gen_t; + +struct socket; + +/*- + * Locking key to struct socket: + * (a) constant after allocation, no locking required. + * (b) locked by SOCK_LOCK(so). + * (c) locked by SOCKBUF_LOCK(&so->so_rcv). + * (d) locked by SOCKBUF_LOCK(&so->so_snd). + * (e) locked by ACCEPT_LOCK(). + * (f) not locked since integer reads/writes are atomic. + * (g) used only as a sleep/wakeup address, no value. + * (h) locked by global mutex so_global_mtx. + */ +struct socket { + int so_count; /* (b) reference count */ + short so_type; /* (a) generic type, see socket.h */ + short so_options; /* from socket call, see socket.h */ + short so_linger; /* time to linger while closing */ + short so_state; /* (b) internal state flags SS_* */ + int so_qstate; /* (e) internal state flags SQ_* */ + void *so_pcb; /* protocol control block */ + struct vnet *so_vnet; /* network stack instance */ + struct protosw *so_proto; /* (a) protocol handle */ +/* + * Variables for connection queuing. + * Socket where accepts occur is so_head in all subsidiary sockets. + * If so_head is 0, socket is not related to an accept. + * For head socket so_incomp queues partially completed connections, + * while so_comp is a queue of connections ready to be accepted. + * If a connection is aborted and it has so_head set, then + * it has to be pulled out of either so_incomp or so_comp. + * We allow connections to queue up based on current queue lengths + * and limit on number of queued connections for this socket. + */ + struct socket *so_head; /* (e) back pointer to listen socket */ + TAILQ_HEAD(, socket) so_incomp; /* (e) queue of partial unaccepted connections */ + TAILQ_HEAD(, socket) so_comp; /* (e) queue of complete unaccepted connections */ + TAILQ_ENTRY(socket) so_list; /* (e) list of unaccepted connections */ + u_short so_qlen; /* (e) number of unaccepted connections */ + u_short so_incqlen; /* (e) number of unaccepted incomplete + connections */ + u_short so_qlimit; /* (e) max number queued connections */ + short so_timeo; /* (g) connection timeout */ + u_short so_error; /* (f) error affecting connection */ + struct sigio *so_sigio; /* [sg] information for async I/O or + out of band data (SIGURG) */ + u_long so_oobmark; /* (c) chars to oob mark */ + TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */ + + struct sockbuf so_rcv, so_snd; + + struct ucred *so_cred; /* (a) user credentials */ + struct label *so_label; /* (b) MAC label for socket */ + struct label *so_peerlabel; /* (b) cached MAC label for peer */ + /* NB: generation count must not be first. */ + so_gen_t so_gencnt; /* (h) generation count */ + void *so_emuldata; /* (b) private data for emulators */ + struct so_accf { + struct accept_filter *so_accept_filter; + void *so_accept_filter_arg; /* saved filter args */ + char *so_accept_filter_str; /* saved user args */ + } *so_accf; + int so_fibnum; /* routing domain for this socket */ +}; + +/* + * Global accept mutex to serialize access to accept queues and + * fields associated with multiple sockets. This allows us to + * avoid defining a lock order between listen and accept sockets + * until such time as it proves to be a good idea. + */ +extern struct mtx accept_mtx; +#define ACCEPT_LOCK_ASSERT() mtx_assert(&accept_mtx, MA_OWNED) +#define ACCEPT_UNLOCK_ASSERT() mtx_assert(&accept_mtx, MA_NOTOWNED) +#define ACCEPT_LOCK() mtx_lock(&accept_mtx) +#define ACCEPT_UNLOCK() mtx_unlock(&accept_mtx) + +/* + * Per-socket mutex: we reuse the receive socket buffer mutex for space + * efficiency. This decision should probably be revisited as we optimize + * locking for the socket code. + */ +#define SOCK_MTX(_so) SOCKBUF_MTX(&(_so)->so_rcv) +#define SOCK_LOCK(_so) SOCKBUF_LOCK(&(_so)->so_rcv) +#define SOCK_OWNED(_so) SOCKBUF_OWNED(&(_so)->so_rcv) +#define SOCK_UNLOCK(_so) SOCKBUF_UNLOCK(&(_so)->so_rcv) +#define SOCK_LOCK_ASSERT(_so) SOCKBUF_LOCK_ASSERT(&(_so)->so_rcv) + +/* + * Socket state bits stored in so_qstate. + */ +#define SQ_INCOMP 0x0800 /* unaccepted, incomplete connection */ +#define SQ_COMP 0x1000 /* unaccepted, complete connection */ + +/* + * Externalized form of struct socket used by the sysctl(3) interface. + */ +struct xsocket { + size_t xso_len; /* length of this structure */ + struct socket *xso_so; /* makes a convenient handle sometimes */ + short so_type; + short so_options; + short so_linger; + short so_state; + caddr_t so_pcb; /* another convenient handle */ + int xso_protocol; + int xso_family; + u_short so_qlen; + u_short so_incqlen; + u_short so_qlimit; + short so_timeo; + u_short so_error; + pid_t so_pgid; + u_long so_oobmark; + struct xsockbuf so_rcv, so_snd; + uid_t so_uid; /* XXX */ +}; + +#ifdef _KERNEL + +/* + * Macros for sockets and socket buffering. + */ + +/* + * Flags to sblock(). + */ +#define SBL_WAIT 0x00000001 /* Wait if not immediately available. */ +#define SBL_NOINTR 0x00000002 /* Force non-interruptible sleep. */ +#define SBL_VALID (SBL_WAIT | SBL_NOINTR) + +/* + * Do we need to notify the other side when I/O is possible? + */ +#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \ + SB_UPCALL | SB_AIO | SB_KNOTE)) != 0) + +/* do we have to send all at once on a socket? */ +#define sosendallatonce(so) \ + ((so)->so_proto->pr_flags & PR_ATOMIC) + +/* can we read something from so? */ +#define soreadabledata(so) \ + ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ + !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error) +#define soreadable(so) \ + (soreadabledata(so) || ((so)->so_rcv.sb_state & SBS_CANTRCVMORE)) + +/* can we write something to so? */ +#define sowriteable(so) \ + ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ + (((so)->so_state&SS_ISCONNECTED) || \ + ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ + ((so)->so_snd.sb_state & SBS_CANTSENDMORE) || \ + (so)->so_error) + +/* + * soref()/sorele() ref-count the socket structure. Note that you must + * still explicitly close the socket, but the last ref count will free + * the structure. + */ +#define soref(so) do { \ + SOCK_LOCK_ASSERT(so); \ + ++(so)->so_count; \ +} while (0) + +#define sorele(so) do { \ + ACCEPT_LOCK_ASSERT(); \ + SOCK_LOCK_ASSERT(so); \ + if ((so)->so_count <= 0) \ + panic("sorele"); \ + if (--(so)->so_count == 0) \ + sofree(so); \ + else { \ + SOCK_UNLOCK(so); \ + ACCEPT_UNLOCK(); \ + } \ +} while (0) + +#define sotryfree(so) do { \ + ACCEPT_LOCK_ASSERT(); \ + SOCK_LOCK_ASSERT(so); \ + if ((so)->so_count == 0) \ + sofree(so); \ + else { \ + SOCK_UNLOCK(so); \ + ACCEPT_UNLOCK(); \ + } \ +} while(0) + +/* + * In sorwakeup() and sowwakeup(), acquire the socket buffer lock to + * avoid a non-atomic test-and-wakeup. However, sowakeup is + * responsible for releasing the lock if it is called. We unlock only + * if we don't call into sowakeup. If any code is introduced that + * directly invokes the underlying sowakeup() primitives, it must + * maintain the same semantics. + */ +#define sorwakeup_locked(so) do { \ + SOCKBUF_LOCK_ASSERT(&(so)->so_rcv); \ + if (sb_notify(&(so)->so_rcv)) \ + sowakeup((so), &(so)->so_rcv); \ + else \ + SOCKBUF_UNLOCK(&(so)->so_rcv); \ +} while (0) + +#define sorwakeup(so) do { \ + SOCKBUF_LOCK(&(so)->so_rcv); \ + sorwakeup_locked(so); \ +} while (0) + +#define sowwakeup_locked(so) do { \ + SOCKBUF_LOCK_ASSERT(&(so)->so_snd); \ + if (sb_notify(&(so)->so_snd)) \ + sowakeup((so), &(so)->so_snd); \ + else \ + SOCKBUF_UNLOCK(&(so)->so_snd); \ +} while (0) + +#define sowwakeup(so) do { \ + SOCKBUF_LOCK(&(so)->so_snd); \ + sowwakeup_locked(so); \ +} while (0) + +struct accept_filter { + char accf_name[16]; + int (*accf_callback) + (struct socket *so, void *arg, int waitflag); + void * (*accf_create) + (struct socket *so, char *arg); + void (*accf_destroy) + (struct socket *so); + SLIST_ENTRY(accept_filter) accf_next; +}; + +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_ACCF); +MALLOC_DECLARE(M_PCB); +MALLOC_DECLARE(M_SONAME); +#endif + +extern int maxsockets; +extern u_long sb_max; +extern struct uma_zone *socket_zone; +extern so_gen_t so_gencnt; + +struct mbuf; +struct sockaddr; +struct ucred; +struct uio; + +/* 'which' values for socket upcalls. */ +#define SO_RCV 1 +#define SO_SND 2 + +/* Return values for socket upcalls. */ +#define SU_OK 0 +#define SU_ISCONNECTED 1 + +/* + * From uipc_socket and friends + */ +int sockargs(struct mbuf **mp, caddr_t buf, int buflen, int type); +int getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len); +void soabort(struct socket *so); +int soaccept(struct socket *so, struct sockaddr **nam); +int socheckuid(struct socket *so, uid_t uid); +int sobind(struct socket *so, struct sockaddr *nam, struct thread *td); +int soclose(struct socket *so); +int soconnect(struct socket *so, struct sockaddr *nam, struct thread *td); +int soconnect2(struct socket *so1, struct socket *so2); +int socow_setup(struct mbuf *m0, struct uio *uio); +int socreate(int dom, struct socket **aso, int type, int proto, + struct ucred *cred, struct thread *td); +int sodisconnect(struct socket *so); +struct sockaddr *sodupsockaddr(const struct sockaddr *sa, int mflags); +void sofree(struct socket *so); +void sohasoutofband(struct socket *so); +int solisten(struct socket *so, int backlog, struct thread *td); +void solisten_proto(struct socket *so, int backlog); +int solisten_proto_check(struct socket *so); +struct socket * + sonewconn(struct socket *head, int connstatus); + + +int sopoll(struct socket *so, int events, struct ucred *active_cred, + struct thread *td); +int sopoll_generic(struct socket *so, int events, + struct ucred *active_cred, struct thread *td); +int soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio, + struct mbuf **mp0, struct mbuf **controlp, int *flagsp); +int soreceive_stream(struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, + int *flagsp); +int soreceive_dgram(struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, + int *flagsp); +int soreceive_generic(struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, + int *flagsp); +int soreserve(struct socket *so, u_long sndcc, u_long rcvcc); +void sorflush(struct socket *so); +int sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags, + struct thread *td); +int sosend_dgram(struct socket *so, struct sockaddr *addr, + struct uio *uio, struct mbuf *top, struct mbuf *control, + int flags, struct thread *td); +int sosend_generic(struct socket *so, struct sockaddr *addr, + struct uio *uio, struct mbuf *top, struct mbuf *control, + int flags, struct thread *td); +int soshutdown(struct socket *so, int how); +void sotoxsocket(struct socket *so, struct xsocket *xso); +void soupcall_clear(struct socket *so, int which); +void soupcall_set(struct socket *so, int which, + int (*func)(struct socket *, void *, int), void *arg); +void sowakeup(struct socket *so, struct sockbuf *sb); +int selsocket(struct socket *so, int events, struct timeval *tv, + struct thread *td); + +/* + * Accept filter functions (duh). + */ +int accept_filt_add(struct accept_filter *filt); +int accept_filt_del(char *name); +struct accept_filter *accept_filt_get(char *name); +#ifdef ACCEPT_FILTER_MOD +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet_accf); +#endif +int accept_filt_generic_mod_event(module_t mod, int event, void *data); +#endif + +#endif /* _KERNEL */ + +#endif /* !_SYS_SOCKETVAR_H_ */ diff --git a/freebsd/sys/sys/sockio.h b/freebsd/sys/sys/sockio.h index 319dc783..4c1c4839 100644 --- a/freebsd/sys/sys/sockio.h +++ b/freebsd/sys/sys/sockio.h @@ -30,10 +30,10 @@ * $FreeBSD$ */ -#ifndef _SYS_SOCKIO_HH_ -#define _SYS_SOCKIO_HH_ +#ifndef _SYS_SOCKIO_H_ +#define _SYS_SOCKIO_H_ -#include <freebsd/sys/ioccom.h> +#include <sys/ioccom.h> /* Socket ioctl's. */ #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ @@ -125,4 +125,4 @@ #define SIOCDIFGROUP _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */ #define SIOCGIFGMEMB _IOWR('i', 138, struct ifgroupreq) /* get members */ -#endif /* !_SYS_SOCKIO_HH_ */ +#endif /* !_SYS_SOCKIO_H_ */ diff --git a/freebsd/sys/sys/sockopt.h b/freebsd/sys/sys/sockopt.h index 09dc5599..69d6c6dc 100644 --- a/freebsd/sys/sys/sockopt.h +++ b/freebsd/sys/sys/sockopt.h @@ -30,8 +30,8 @@ * * $FreeBSD$ */ -#ifndef _SYS_SOCKOPT_HH_ -#define _SYS_SOCKOPT_HH_ +#ifndef _SYS_SOCKOPT_H_ +#define _SYS_SOCKOPT_H_ #ifndef _KERNEL #error "no user-servicable parts inside" @@ -69,4 +69,4 @@ int do_setopt_accept_filter(struct socket *so, struct sockopt *sopt); int so_setsockopt(struct socket *so, int level, int optname, void *optval, size_t optlen); -#endif /* _SYS_SOCKOPT_HH_ */ +#endif /* _SYS_SOCKOPT_H_ */ diff --git a/freebsd/sys/sys/sockstate.h b/freebsd/sys/sys/sockstate.h index a6c4149d..52c85b76 100644 --- a/freebsd/sys/sys/sockstate.h +++ b/freebsd/sys/sys/sockstate.h @@ -30,8 +30,8 @@ * * $FreeBSD$ */ -#ifndef _SYS_SOCKTATE_HH_ -#define _SYS_SOCKTATE_HH_ +#ifndef _SYS_SOCKTATE_H_ +#define _SYS_SOCKTATE_H_ /* * Socket state bits. @@ -80,4 +80,4 @@ void socantrcvmore(struct socket *so); void socantrcvmore_locked(struct socket *so); void socantsendmore(struct socket *so); void socantsendmore_locked(struct socket *so); -#endif /* _SYS_SOCKTATE_HH_ */ +#endif /* _SYS_SOCKTATE_H_ */ diff --git a/freebsd/sys/sys/stddef.h b/freebsd/sys/sys/stddef.h index 85de99d8..df51c369 100644 --- a/freebsd/sys/sys/stddef.h +++ b/freebsd/sys/sys/stddef.h @@ -26,17 +26,17 @@ * $FreeBSD$ */ -#ifndef _SYS_STDDEF_HH_ -#define _SYS_STDDEF_HH_ - -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_null.h> -#include <freebsd/machine/_types.h> +#ifndef _SYS_STDDEF_H_ +#define _SYS_STDDEF_H_ +#include <sys/cdefs.h> #ifndef __rtems__ +#include <sys/_null.h> +#include <machine/_types.h> + typedef __ptrdiff_t ptrdiff_t; #define offsetof(type, field) __offsetof(type, field) #endif /* __rtems__ */ -#endif /* !_SYS_STDDEF_HH_ */ +#endif /* !_SYS_STDDEF_H_ */ diff --git a/freebsd/sys/sys/stdint.h b/freebsd/sys/sys/stdint.h index 10bab732..74e4a0ce 100644 --- a/freebsd/sys/sys/stdint.h +++ b/freebsd/sys/sys/stdint.h @@ -26,13 +26,14 @@ * $FreeBSD$ */ -#ifndef _SYS_STDINT_HH_ -#define _SYS_STDINT_HH_ +#ifndef _SYS_STDINT_H_ +#define _SYS_STDINT_H_ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_types.h> +#include <sys/cdefs.h> +#include <rtems/bsd/sys/_types.h> -#include <freebsd/machine/_stdint.h> +#ifndef __rtems__ +#include <machine/_stdint.h> #ifndef _INT8_T_DECLARED typedef __int8_t int8_t; @@ -102,5 +103,6 @@ typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; #define _INTPTR_T_DECLARED #endif +#endif /* __rtems__ */ -#endif /* !_SYS_STDINT_HH_ */ +#endif /* !_SYS_STDINT_H_ */ diff --git a/freebsd/sys/sys/sx.h b/freebsd/sys/sys/sx.h index e6a22c13..dc19023c 100644 --- a/freebsd/sys/sys/sx.h +++ b/freebsd/sys/sys/sx.h @@ -29,17 +29,17 @@ * $FreeBSD$ */ -#ifndef _SYS_SX_HH_ -#define _SYS_SX_HH_ +#ifndef _SYS_SX_H_ +#define _SYS_SX_H_ -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_sx.h> +#include <sys/_lock.h> +#include <sys/_sx.h> #ifdef _KERNEL -#include <freebsd/sys/pcpu.h> -#include <freebsd/sys/lock_profile.h> -#include <freebsd/sys/lockstat.h> -#include <freebsd/machine/atomic.h> +#include <sys/pcpu.h> +#include <sys/lock_profile.h> +#include <sys/lockstat.h> +#include <machine/atomic.h> #endif #ifdef __rtems__ @@ -210,7 +210,7 @@ __sx_sunlock(struct sx *sx, const char *file, int line) * Public interface for lock operations. */ #ifndef LOCK_DEBUG -#error "LOCK_DEBUG not defined, include <sys/lock.h> before <sys/sx.h>" +#error "LOCK_DEBUG not defined, include <rtems/bsd/sys/lock.h> before <sys/sx.h>" #endif #if (LOCK_DEBUG > 0) || defined(SX_NOINLINE) #define sx_xlock(sx) (void)_sx_xlock((sx), 0, LOCK_FILE, LOCK_LINE) @@ -304,4 +304,4 @@ int sx_xlocked(struct sx *sx); #endif /* _KERNEL */ -#endif /* !_SYS_SX_HH_ */ +#endif /* !_SYS_SX_H_ */ diff --git a/freebsd/sys/sys/sysctl.h b/freebsd/sys/sys/sysctl.h index 11ed653d..35c0e984 100644 --- a/freebsd/sys/sys/sysctl.h +++ b/freebsd/sys/sys/sysctl.h @@ -1,2 +1,762 @@ -#include <freebsd/bsd.h> -#include <freebsd/sys/sysctl.h> +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Mike Karels at Berkeley Software Design, Inc. + * + * 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. + * + * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD$ + */ + +#ifndef _SYS_SYSCTL_H_ +#define _SYS_SYSCTL_H_ + +#include <sys/queue.h> + +struct thread; +/* + * Definitions for sysctl call. The sysctl call uses a hierarchical name + * for objects that can be examined or modified. The name is expressed as + * a sequence of integers. Like a file path name, the meaning of each + * component depends on its place in the hierarchy. The top-level and kern + * identifiers are defined here, and other identifiers are defined in the + * respective subsystem header files. + */ + +#define CTL_MAXNAME 24 /* largest number of components supported */ + +/* + * Each subsystem defined by sysctl defines a list of variables + * for that subsystem. Each name is either a node with further + * levels defined below it, or it is a leaf of some particular + * type given below. Each sysctl level defines a set of name/type + * pairs to be used by sysctl(8) in manipulating the subsystem. + */ +struct ctlname { + char *ctl_name; /* subsystem name */ + int ctl_type; /* type of name */ +}; + +#define CTLTYPE 0xf /* Mask for the type */ +#define CTLTYPE_NODE 1 /* name is a node */ +#define CTLTYPE_INT 2 /* name describes an integer */ +#define CTLTYPE_STRING 3 /* name describes a string */ +#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ +#define CTLTYPE_OPAQUE 5 /* name describes a structure */ +#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ +#define CTLTYPE_UINT 6 /* name describes an unsigned integer */ +#define CTLTYPE_LONG 7 /* name describes a long */ +#define CTLTYPE_ULONG 8 /* name describes an unsigned long */ + +#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ +#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ +#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) +#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ +#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ +#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ +#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ +#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ +#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */ +#define CTLMASK_SECURE 0x00F00000 /* Secure level */ +#define CTLFLAG_TUN 0x00080000 /* Tunable variable */ +#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */ +#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */ +#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) + +/* + * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. + * + * Secure when the securelevel is raised to at least N. + */ +#define CTLSHIFT_SECURE 20 +#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)) +#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)) +#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)) + +/* + * USE THIS instead of a hardwired number from the categories below + * to get dynamically assigned sysctl entries using the linker-set + * technology. This is the way nearly all new sysctl variables should + * be implemented. + * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); + */ +#define OID_AUTO (-1) + +/* + * The starting number for dynamically-assigned entries. WARNING! + * ALL static sysctl entries should have numbers LESS than this! + */ +#define CTL_AUTO_START 0x100 + +#ifdef _KERNEL +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ + struct sysctl_req *req + +/* definitions for sysctl_req 'lock' member */ +#define REQ_UNLOCKED 0 /* not locked and not wired */ +#define REQ_LOCKED 1 /* locked and not wired */ +#define REQ_WIRED 2 /* locked and wired */ + +/* definitions for sysctl_req 'flags' member */ +#if defined(__amd64__) || defined(__ia64__) +#define SCTL_MASK32 1 /* 32 bit emulation */ +#endif + +/* + * This describes the access space for a sysctl request. This is needed + * so that we can use the interface from the kernel or from user-space. + */ +struct sysctl_req { + struct thread *td; /* used for access checking */ + int lock; /* locking/wiring state */ + void *oldptr; + size_t oldlen; + size_t oldidx; + int (*oldfunc)(struct sysctl_req *, const void *, size_t); +#ifndef __rtems__ + void *newptr; +#else /* __rtems__ */ + const void *newptr; +#endif /* __rtems__ */ + size_t newlen; + size_t newidx; + int (*newfunc)(struct sysctl_req *, void *, size_t); + size_t validlen; + int flags; +}; + +SLIST_HEAD(sysctl_oid_list, sysctl_oid); + +/* + * This describes one "oid" in the MIB tree. Potentially more nodes can + * be hidden behind it, expanded by the handler. + */ +struct sysctl_oid { + struct sysctl_oid_list *oid_parent; + SLIST_ENTRY(sysctl_oid) oid_link; + int oid_number; + u_int oid_kind; + void *oid_arg1; + int oid_arg2; + const char *oid_name; + int (*oid_handler)(SYSCTL_HANDLER_ARGS); + const char *oid_fmt; + int oid_refcnt; + const char *oid_descr; +}; + +#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) +#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) + +int sysctl_handle_int(SYSCTL_HANDLER_ARGS); +int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS); +int sysctl_handle_long(SYSCTL_HANDLER_ARGS); +int sysctl_handle_quad(SYSCTL_HANDLER_ARGS); +int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS); +int sysctl_handle_string(SYSCTL_HANDLER_ARGS); +int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); + +int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS); +int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS); +int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); + +/* + * These functions are used to add/remove an oid from the mib. + */ +void sysctl_register_oid(struct sysctl_oid *oidp); +void sysctl_unregister_oid(struct sysctl_oid *oidp); + +/* Declare a static oid to allow child oids to be added to it. */ +#ifndef __rtems__ +#define SYSCTL_DECL(name) \ + extern struct sysctl_oid_list sysctl_##name##_children +#else /* __rtems__ */ +#define SYSCTL_DECL(name) \ + extern struct sysctl_oid_list _bsd_sysctl_##name##_children +#endif /* __rtems__ */ + +/* Hide these in macros */ +#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \ + (oid_ptr)->oid_arg1 +#define SYSCTL_CHILDREN_SET(oid_ptr, val) \ + (oid_ptr)->oid_arg1 = (val); +#ifndef __rtems__ +#define SYSCTL_STATIC_CHILDREN(oid_name) \ + (&sysctl_##oid_name##_children) +#else /* __rtems__ */ +#define SYSCTL_STATIC_CHILDREN(oid_name) \ + (&_bsd_sysctl_##oid_name##_children) +#endif /* __rtems__ */ + +/* === Structs and macros related to context handling === */ + +/* All dynamically created sysctls can be tracked in a context list. */ +struct sysctl_ctx_entry { + struct sysctl_oid *entry; + TAILQ_ENTRY(sysctl_ctx_entry) link; +}; + +TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); + +#ifndef __rtems__ +#define SYSCTL_NODE_CHILDREN(parent, name) \ + sysctl_##parent##_##name##_children +#else /* __rtems__ */ +#define SYSCTL_NODE_CHILDREN(parent, name) \ + _bsd_sysctl_##parent##_##name##_children +#endif /* __rtems__ */ + +#ifndef NO_SYSCTL_DESCR +#define __DESCR(d) d +#else +#define __DESCR(d) "" +#endif + +/* This constructs a "raw" MIB oid. */ +#ifndef __rtems__ +#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ + static struct sysctl_oid sysctl__##parent##_##name = { \ + &sysctl_##parent##_children, { NULL }, nbr, kind, \ + a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ + DATA_SET(sysctl_set, sysctl__##parent##_##name) +#else /* __rtems__ */ +#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ + static struct sysctl_oid sysctl__##parent##_##name = { \ + &_bsd_sysctl_##parent##_children, { NULL }, nbr, kind, \ + a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ + DATA_SET(sysctl_set, sysctl__##parent##_##name) +#endif /* __rtems__ */ + +#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr)) + +/* This constructs a node from which other oids can hang. */ +#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ + struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \ + (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr) + +#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ + NULL, 0, handler, "N", __DESCR(descr)) + +/* Oid for a string. len can be 0 to indicate '\0' termination. */ +#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ + arg, len, sysctl_handle_string, "A", descr) + +#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ + arg, len, sysctl_handle_string, "A", __DESCR(descr)) + +/* Oid for an int. If ptr is NULL, val is returned. */ +#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "I", descr) + +#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "I", __DESCR(descr)) + +/* Oid for an unsigned int. If ptr is NULL, val is returned. */ +#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "IU", descr) + +#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "IU", __DESCR(descr)) + +#define SYSCTL_XINT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "IX", descr) + +#define SYSCTL_ADD_XINT(ctx, parent, nbr, name, access, ptr, val, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_int, "IX", __DESCR(descr)) + +/* Oid for a long. The pointer must be non NULL. */ +#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_long, "L", descr) + +#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|CTLFLAG_MPSAFE|(access), \ + ptr, 0, sysctl_handle_long, "L", __DESCR(descr)) + +/* Oid for an unsigned long. The pointer must be non NULL. */ +#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_long, "LU", __DESCR(descr)) + +#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ + ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)) + +#define SYSCTL_XLONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_long, "LX", __DESCR(descr)) + +#define SYSCTL_ADD_XLONG(ctx, parent, nbr, name, access, ptr, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ + ptr, 0, sysctl_handle_long, "LX", __DESCR(descr)) + +/* Oid for a quad. The pointer must be non NULL. */ +#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_quad, "Q", __DESCR(descr)) + +#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ + ptr, 0, sysctl_handle_quad, "Q", __DESCR(descr)) + +/* Oid for an opaque object. Specified by a pointer and a length. */ +#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, len, sysctl_handle_opaque, fmt, descr) + +#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)) + +/* Oid for a struct. Specified by a pointer and a type. */ +#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, sizeof(struct type), sysctl_handle_opaque, \ + "S," #type, descr) + +#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ + ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr)) + +/* Oid for a procedure. Specified by a pointer and an arg. */ +#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ + SYSCTL_OID(parent, nbr, name, (access), \ + ptr, arg, handler, fmt, descr) + +#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, (access), \ + ptr, arg, handler, fmt, __DESCR(descr)) + +/* + * A macro to generate a read-only sysctl to indicate the presense of optional + * kernel features. + */ +#define FEATURE(name, desc) \ + SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD, 0, 1, desc) + +#endif /* _KERNEL */ + +/* + * Top-level identifiers + */ +#define CTL_UNSPEC 0 /* unused */ +#define CTL_KERN 1 /* "high kernel": proc, limits */ +#define CTL_VM 2 /* virtual memory */ +#define CTL_VFS 3 /* filesystem, mount type is next */ +#define CTL_NET 4 /* network, see socket.h */ +#define CTL_DEBUG 5 /* debugging parameters */ +#define CTL_HW 6 /* generic cpu/io */ +#define CTL_MACHDEP 7 /* machine dependent */ +#define CTL_USER 8 /* user-level */ +#define CTL_P1003_1B 9 /* POSIX 1003.1B */ +#define CTL_MAXID 10 /* number of valid top-level ids */ + +#define CTL_NAMES { \ + { 0, 0 }, \ + { "kern", CTLTYPE_NODE }, \ + { "vm", CTLTYPE_NODE }, \ + { "vfs", CTLTYPE_NODE }, \ + { "net", CTLTYPE_NODE }, \ + { "debug", CTLTYPE_NODE }, \ + { "hw", CTLTYPE_NODE }, \ + { "machdep", CTLTYPE_NODE }, \ + { "user", CTLTYPE_NODE }, \ + { "p1003_1b", CTLTYPE_NODE }, \ +} + +/* + * CTL_KERN identifiers + */ +#define KERN_OSTYPE 1 /* string: system version */ +#define KERN_OSRELEASE 2 /* string: system release */ +#define KERN_OSREV 3 /* int: system revision */ +#define KERN_VERSION 4 /* string: compile time info */ +#define KERN_MAXVNODES 5 /* int: max vnodes */ +#define KERN_MAXPROC 6 /* int: max processes */ +#define KERN_MAXFILES 7 /* int: max open files */ +#define KERN_ARGMAX 8 /* int: max arguments to exec */ +#define KERN_SECURELVL 9 /* int: system security level */ +#define KERN_HOSTNAME 10 /* string: hostname */ +#define KERN_HOSTID 11 /* int: host identifier */ +#define KERN_CLOCKRATE 12 /* struct: struct clockrate */ +#define KERN_VNODE 13 /* struct: vnode structures */ +#define KERN_PROC 14 /* struct: process entries */ +#define KERN_FILE 15 /* struct: file entries */ +#define KERN_PROF 16 /* node: kernel profiling info */ +#define KERN_POSIX1 17 /* int: POSIX.1 version */ +#define KERN_NGROUPS 18 /* int: # of supplemental group ids */ +#define KERN_JOB_CONTROL 19 /* int: is job control available */ +#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ +#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ +#define KERN_NISDOMAINNAME 22 /* string: YP domain name */ +#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ +#define KERN_OSRELDATE 24 /* int: kernel release date */ +#define KERN_NTP_PLL 25 /* node: NTP PLL control */ +#define KERN_BOOTFILE 26 /* string: name of booted kernel */ +#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ +#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ +#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */ +#define KERN_IPC 30 /* node: anything related to IPC */ +#define KERN_DUMMY 31 /* unused */ +#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ +#define KERN_USRSTACK 33 /* int: address of USRSTACK */ +#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ +#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */ +#define KERN_HOSTUUID 36 /* string: host UUID identifier */ +#define KERN_ARND 37 /* int: from arc4rand() */ +#define KERN_MAXID 38 /* number of valid kern ids */ + +#define CTL_KERN_NAMES { \ + { 0, 0 }, \ + { "ostype", CTLTYPE_STRING }, \ + { "osrelease", CTLTYPE_STRING }, \ + { "osrevision", CTLTYPE_INT }, \ + { "version", CTLTYPE_STRING }, \ + { "maxvnodes", CTLTYPE_INT }, \ + { "maxproc", CTLTYPE_INT }, \ + { "maxfiles", CTLTYPE_INT }, \ + { "argmax", CTLTYPE_INT }, \ + { "securelevel", CTLTYPE_INT }, \ + { "hostname", CTLTYPE_STRING }, \ + { "hostid", CTLTYPE_UINT }, \ + { "clockrate", CTLTYPE_STRUCT }, \ + { "vnode", CTLTYPE_STRUCT }, \ + { "proc", CTLTYPE_STRUCT }, \ + { "file", CTLTYPE_STRUCT }, \ + { "profiling", CTLTYPE_NODE }, \ + { "posix1version", CTLTYPE_INT }, \ + { "ngroups", CTLTYPE_INT }, \ + { "job_control", CTLTYPE_INT }, \ + { "saved_ids", CTLTYPE_INT }, \ + { "boottime", CTLTYPE_STRUCT }, \ + { "nisdomainname", CTLTYPE_STRING }, \ + { "update", CTLTYPE_INT }, \ + { "osreldate", CTLTYPE_INT }, \ + { "ntp_pll", CTLTYPE_NODE }, \ + { "bootfile", CTLTYPE_STRING }, \ + { "maxfilesperproc", CTLTYPE_INT }, \ + { "maxprocperuid", CTLTYPE_INT }, \ + { "ipc", CTLTYPE_NODE }, \ + { "dummy", CTLTYPE_INT }, \ + { "ps_strings", CTLTYPE_INT }, \ + { "usrstack", CTLTYPE_INT }, \ + { "logsigexit", CTLTYPE_INT }, \ + { "iov_max", CTLTYPE_INT }, \ + { "hostuuid", CTLTYPE_STRING }, \ + { "arc4rand", CTLTYPE_OPAQUE }, \ +} + +/* + * CTL_VFS identifiers + */ +#define CTL_VFS_NAMES { \ + { "vfsconf", CTLTYPE_STRUCT }, \ +} + +/* + * KERN_PROC subtypes + */ +#define KERN_PROC_ALL 0 /* everything */ +#define KERN_PROC_PID 1 /* by process id */ +#define KERN_PROC_PGRP 2 /* by process group id */ +#define KERN_PROC_SESSION 3 /* by session of pid */ +#define KERN_PROC_TTY 4 /* by controlling tty */ +#define KERN_PROC_UID 5 /* by effective uid */ +#define KERN_PROC_RUID 6 /* by real uid */ +#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ +#define KERN_PROC_PROC 8 /* only return procs */ +#define KERN_PROC_SV_NAME 9 /* get syscall vector name */ +#define KERN_PROC_RGID 10 /* by real group id */ +#define KERN_PROC_GID 11 /* by effective group id */ +#define KERN_PROC_PATHNAME 12 /* path to executable */ +#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ +#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ +#define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ +#define KERN_PROC_INC_THREAD 0x10 /* + * modifier for pid, pgrp, tty, + * uid, ruid, gid, rgid and proc + * This effectively uses 16-31 + */ +#define KERN_PROC_VMMAP 32 /* VM map entries for process */ +#define KERN_PROC_FILEDESC 33 /* File descriptors for process */ +#define KERN_PROC_GROUPS 34 /* process groups */ + +/* + * KERN_IPC identifiers + */ +#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ +#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ +#define KIPC_SOMAXCONN 3 /* int: max length of connection q */ +#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ +#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ +#define KIPC_MAX_HDR 6 /* int: max total length of headers */ +#define KIPC_MAX_DATALEN 7 /* int: max length of data? */ + +/* + * CTL_HW identifiers + */ +#define HW_MACHINE 1 /* string: machine class */ +#define HW_MODEL 2 /* string: specific machine model */ +#define HW_NCPU 3 /* int: number of cpus */ +#define HW_BYTEORDER 4 /* int: machine byte order */ +#define HW_PHYSMEM 5 /* int: total memory */ +#define HW_USERMEM 6 /* int: non-kernel memory */ +#define HW_PAGESIZE 7 /* int: software page size */ +#define HW_DISKNAMES 8 /* strings: disk drive names */ +#define HW_DISKSTATS 9 /* struct: diskstats[] */ +#define HW_FLOATINGPT 10 /* int: has HW floating point? */ +#define HW_MACHINE_ARCH 11 /* string: machine architecture */ +#define HW_REALMEM 12 /* int: 'real' memory */ +#define HW_MAXID 13 /* number of valid hw ids */ + +#define CTL_HW_NAMES { \ + { 0, 0 }, \ + { "machine", CTLTYPE_STRING }, \ + { "model", CTLTYPE_STRING }, \ + { "ncpu", CTLTYPE_INT }, \ + { "byteorder", CTLTYPE_INT }, \ + { "physmem", CTLTYPE_ULONG }, \ + { "usermem", CTLTYPE_ULONG }, \ + { "pagesize", CTLTYPE_INT }, \ + { "disknames", CTLTYPE_STRUCT }, \ + { "diskstats", CTLTYPE_STRUCT }, \ + { "floatingpoint", CTLTYPE_INT }, \ + { "machine_arch", CTLTYPE_STRING }, \ + { "realmem", CTLTYPE_ULONG }, \ +} + +/* + * CTL_USER definitions + */ +#define USER_CS_PATH 1 /* string: _CS_PATH */ +#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ +#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ +#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ +#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ +#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ +#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ +#define USER_LINE_MAX 8 /* int: LINE_MAX */ +#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ +#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ +#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ +#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ +#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ +#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ +#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ +#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ +#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ +#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ +#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ +#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ +#define USER_MAXID 21 /* number of valid user ids */ + +#define CTL_USER_NAMES { \ + { 0, 0 }, \ + { "cs_path", CTLTYPE_STRING }, \ + { "bc_base_max", CTLTYPE_INT }, \ + { "bc_dim_max", CTLTYPE_INT }, \ + { "bc_scale_max", CTLTYPE_INT }, \ + { "bc_string_max", CTLTYPE_INT }, \ + { "coll_weights_max", CTLTYPE_INT }, \ + { "expr_nest_max", CTLTYPE_INT }, \ + { "line_max", CTLTYPE_INT }, \ + { "re_dup_max", CTLTYPE_INT }, \ + { "posix2_version", CTLTYPE_INT }, \ + { "posix2_c_bind", CTLTYPE_INT }, \ + { "posix2_c_dev", CTLTYPE_INT }, \ + { "posix2_char_term", CTLTYPE_INT }, \ + { "posix2_fort_dev", CTLTYPE_INT }, \ + { "posix2_fort_run", CTLTYPE_INT }, \ + { "posix2_localedef", CTLTYPE_INT }, \ + { "posix2_sw_dev", CTLTYPE_INT }, \ + { "posix2_upe", CTLTYPE_INT }, \ + { "stream_max", CTLTYPE_INT }, \ + { "tzname_max", CTLTYPE_INT }, \ +} + +#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ +#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ +#define CTL_P1003_1B_MEMLOCK 3 /* boolean */ +#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ +#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ +#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ +#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ +#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ +#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ +#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ +#define CTL_P1003_1B_FSYNC 11 /* boolean */ +#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ +#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ +#define CTL_P1003_1B_TIMERS 14 /* boolean */ +#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ +#define CTL_P1003_1B_AIO_MAX 16 /* int */ +#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ +#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ +#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ +#define CTL_P1003_1B_PAGESIZE 20 /* int */ +#define CTL_P1003_1B_RTSIG_MAX 21 /* int */ +#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ +#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ +#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ +#define CTL_P1003_1B_TIMER_MAX 25 /* int */ + +#define CTL_P1003_1B_MAXID 26 + +#define CTL_P1003_1B_NAMES { \ + { 0, 0 }, \ + { "asynchronous_io", CTLTYPE_INT }, \ + { "mapped_files", CTLTYPE_INT }, \ + { "memlock", CTLTYPE_INT }, \ + { "memlock_range", CTLTYPE_INT }, \ + { "memory_protection", CTLTYPE_INT }, \ + { "message_passing", CTLTYPE_INT }, \ + { "prioritized_io", CTLTYPE_INT }, \ + { "priority_scheduling", CTLTYPE_INT }, \ + { "realtime_signals", CTLTYPE_INT }, \ + { "semaphores", CTLTYPE_INT }, \ + { "fsync", CTLTYPE_INT }, \ + { "shared_memory_objects", CTLTYPE_INT }, \ + { "synchronized_io", CTLTYPE_INT }, \ + { "timers", CTLTYPE_INT }, \ + { "aio_listio_max", CTLTYPE_INT }, \ + { "aio_max", CTLTYPE_INT }, \ + { "aio_prio_delta_max", CTLTYPE_INT }, \ + { "delaytimer_max", CTLTYPE_INT }, \ + { "mq_open_max", CTLTYPE_INT }, \ + { "pagesize", CTLTYPE_INT }, \ + { "rtsig_max", CTLTYPE_INT }, \ + { "nsems_max", CTLTYPE_INT }, \ + { "sem_value_max", CTLTYPE_INT }, \ + { "sigqueue_max", CTLTYPE_INT }, \ + { "timer_max", CTLTYPE_INT }, \ +} + +#ifdef _KERNEL + +/* + * Declare some common oids. + */ +#ifdef __rtems__ +#define sysctl__children _bsd_sysctl__children +#endif /* __rtems__ */ +extern struct sysctl_oid_list sysctl__children; +SYSCTL_DECL(_kern); +SYSCTL_DECL(_kern_features); +SYSCTL_DECL(_kern_ipc); +SYSCTL_DECL(_kern_proc); +SYSCTL_DECL(_kern_sched); +SYSCTL_DECL(_kern_sched_stats); +SYSCTL_DECL(_sysctl); +SYSCTL_DECL(_vm); +SYSCTL_DECL(_vm_stats); +SYSCTL_DECL(_vm_stats_misc); +SYSCTL_DECL(_vfs); +SYSCTL_DECL(_net); +SYSCTL_DECL(_debug); +SYSCTL_DECL(_debug_sizeof); +SYSCTL_DECL(_dev); +SYSCTL_DECL(_hw); +SYSCTL_DECL(_hw_bus); +SYSCTL_DECL(_hw_bus_devices); +SYSCTL_DECL(_hw_bus_info); +SYSCTL_DECL(_machdep); +SYSCTL_DECL(_user); +SYSCTL_DECL(_compat); +SYSCTL_DECL(_regression); +SYSCTL_DECL(_security); +SYSCTL_DECL(_security_bsd); + +extern char machine[]; +extern char osrelease[]; +extern char ostype[]; +extern char kern_ident[]; + +/* Dynamic oid handling */ +struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, + struct sysctl_oid_list *parent, int nbr, const char *name, + int kind, void *arg1, int arg2, + int (*handler) (SYSCTL_HANDLER_ARGS), + const char *fmt, const char *descr); +void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name); +int sysctl_move_oid(struct sysctl_oid *oidp, + struct sysctl_oid_list *parent); +int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse); +int sysctl_ctx_init(struct sysctl_ctx_list *clist); +int sysctl_ctx_free(struct sysctl_ctx_list *clist); +struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); +struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); +int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); + +int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old, +#ifndef __rtems__ + size_t *oldlenp, void *new, size_t newlen, +#else /* __rtems__ */ + size_t *oldlenp, const void *newp, size_t newlen, +#endif /* __rtems__ */ + size_t *retval, int flags); +#ifndef __rtems__ +int kernel_sysctlbyname(struct thread *td, char *name, + void *old, size_t *oldlenp, void *new, size_t newlen, + size_t *retval, int flags); +int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, + size_t *oldlenp, int inkernel, void *new, size_t newlen, + size_t *retval, int flags); +#endif /* __rtems__ */ +int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, + int *nindx, struct sysctl_req *req); +void sysctl_lock(void); +void sysctl_unlock(void); +int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); + +#ifndef __rtems__ +#else /* !_KERNEL */ +#endif /* __rtems__ */ +#include <sys/cdefs.h> + +__BEGIN_DECLS +int sysctl(int *, u_int, void *, size_t *, void *, size_t); +int sysctlbyname(const char *, void *, size_t *, void *, size_t); +int sysctlnametomib(const char *, int *, size_t *); +__END_DECLS +#endif /* _KERNEL */ + +#endif /* !_SYS_SYSCTL_H_ */ diff --git a/freebsd/sys/sys/syslog.h b/freebsd/sys/sys/syslog.h index a4aba4a1..5407a67e 100644 --- a/freebsd/sys/sys/syslog.h +++ b/freebsd/sys/sys/syslog.h @@ -186,15 +186,15 @@ CODE facilitynames[] = { * __va_list from <sys/_types.h> and use it. */ #include <sys/cdefs.h> -#include <sys/_types.h> +#include <rtems/bsd/sys/_types.h> __BEGIN_DECLS void closelog(void); void openlog(const char *, int, int); int setlogmask(int); -void syslog(int, const char *, ...); /* JRS __printflike(2, 3); */ +void syslog(int, const char *, ...) __printflike(2, 3); #if __BSD_VISIBLE -void vsyslog(int, const char *, __va_list); /* JRS __printflike(2, 0); */ +void vsyslog(int, const char *, __va_list) __printflike(2, 0); #endif __END_DECLS diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h index 731626ee..1ab467d0 100644 --- a/freebsd/sys/sys/systm.h +++ b/freebsd/sys/sys/systm.h @@ -35,15 +35,15 @@ * $FreeBSD$ */ -#ifndef _SYS_SYSTM_HH_ -#define _SYS_SYSTM_HH_ +#ifndef _SYS_SYSTM_H_ +#define _SYS_SYSTM_H_ -#include <freebsd/machine/atomic.h> -#include <freebsd/machine/cpufunc.h> -#include <freebsd/sys/callout.h> -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/stdint.h> /* for people using printf mainly */ +#include <machine/atomic.h> +#include <machine/cpufunc.h> +#include <sys/callout.h> +#include <sys/cdefs.h> +#include <sys/queue.h> +#include <sys/stdint.h> /* for people using printf mainly */ extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* boot() has been called. */ @@ -279,7 +279,7 @@ struct timeval; void adjust_timeout_calltodo(struct timeval *time_change); #endif /* APM_FIXUP_CALLTODO */ -#include <freebsd/sys/libkern.h> +#include <sys/libkern.h> /* Initialize the world */ void consinit(void); @@ -420,4 +420,4 @@ bitcount32(uint32_t x) return (x); } -#endif /* !_SYS_SYSTM_HH_ */ +#endif /* !_SYS_SYSTM_H_ */ diff --git a/freebsd/sys/sys/taskqueue.h b/freebsd/sys/sys/taskqueue.h index d5da47a9..bf2e4ee3 100644 --- a/freebsd/sys/sys/taskqueue.h +++ b/freebsd/sys/sys/taskqueue.h @@ -26,15 +26,15 @@ * $FreeBSD$ */ -#ifndef _SYS_TASKQUEUE_HH_ -#define _SYS_TASKQUEUE_HH_ +#ifndef _SYS_TASKQUEUE_H_ +#define _SYS_TASKQUEUE_H_ #ifndef _KERNEL #error "no user-servicable parts inside" #endif -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_task.h> +#include <sys/queue.h> +#include <sys/_task.h> struct taskqueue; struct thread; @@ -158,4 +158,4 @@ struct taskqueue *taskqueue_create_fast(const char *name, int mflags, taskqueue_enqueue_fn enqueue, void *context); -#endif /* !_SYS_TASKQUEUE_HH_ */ +#endif /* !_SYS_TASKQUEUE_H_ */ diff --git a/freebsd/sys/sys/timepps.h b/freebsd/sys/sys/timepps.h index 1e5e84fc..4f3ce646 100644 --- a/freebsd/sys/sys/timepps.h +++ b/freebsd/sys/sys/timepps.h @@ -12,11 +12,11 @@ * timing interfaces. */ -#ifndef _SYS_TIMEPPS_HH_ -#define _SYS_TIMEPPS_HH_ +#ifndef _SYS_TIMEPPS_H_ +#define _SYS_TIMEPPS_H_ -#include <freebsd/sys/ioccom.h> -#include <freebsd/sys/time.h> +#include <sys/ioccom.h> +#include <rtems/bsd/sys/time.h> #define PPS_API_VERS_1 1 @@ -197,4 +197,4 @@ time_pps_kcbind(pps_handle_t handle, const int kernel_consumer, #endif /* KERNEL */ -#endif /* !_SYS_TIMEPPS_HH_ */ +#endif /* !_SYS_TIMEPPS_H_ */ diff --git a/freebsd/sys/sys/timetc.h b/freebsd/sys/sys/timetc.h index 6b1c9b91..d5a818b4 100644 --- a/freebsd/sys/sys/timetc.h +++ b/freebsd/sys/sys/timetc.h @@ -9,8 +9,8 @@ * $FreeBSD$ */ -#ifndef _SYS_TIMETC_HH_ -#define _SYS_TIMETC_HH_ +#ifndef _SYS_TIMETC_H_ +#define _SYS_TIMETC_H_ #ifndef _KERNEL #error "no user-serviceable parts inside" @@ -75,4 +75,4 @@ void tc_ticktock(void); SYSCTL_DECL(_kern_timecounter); #endif -#endif /* !_SYS_TIMETC_HH_ */ +#endif /* !_SYS_TIMETC_H_ */ diff --git a/freebsd/sys/sys/timex.h b/freebsd/sys/sys/timex.h index 838a0e05..c34b5892 100644 --- a/freebsd/sys/sys/timex.h +++ b/freebsd/sys/sys/timex.h @@ -65,7 +65,7 @@ * ntp_gettime - NTP user application interface * * SYNOPSIS - * #include <freebsd/sys/timex.h> + * #include <sys/timex.h> * * int ntp_gettime(struct ntptimeval *ntv); * @@ -80,8 +80,8 @@ * ntp_adjtime - NTP daemon application interface * * SYNOPSIS - * #include <freebsd/sys/timex.h> - * #include <freebsd/sys/syscall.h> + * #include <sys/timex.h> + * #include <sys/syscall.h> * * int syscall(SYS_ntp_adjtime, tptr); * int SYS_ntp_adjtime; @@ -93,13 +93,13 @@ * STA_NANO bit in the status word. See the description below for * further information. */ -#ifndef _SYS_TIMEX_HH_ -#define _SYS_TIMEX_HH_ 1 +#ifndef _SYS_TIMEX_H_ +#define _SYS_TIMEX_H_ 1 #define NTP_API 4 /* NTP API version */ #ifndef __rtems__ #ifndef MSDOS /* Microsoft specific */ -#include <freebsd/sys/syscall.h> +#include <sys/syscall.h> #endif /* MSDOS */ #endif @@ -225,7 +225,7 @@ struct timex { #ifdef _KERNEL void ntp_update_second(int64_t *adjustment, time_t *newsec); #else /* !_KERNEL */ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> __BEGIN_DECLS int ntp_adjtime(struct timex *); @@ -235,4 +235,4 @@ __END_DECLS #endif /* __FreeBSD__ */ -#endif /* !_SYS_TIMEX_HH_ */ +#endif /* !_SYS_TIMEX_H_ */ diff --git a/freebsd/sys/sys/tree.h b/freebsd/sys/sys/tree.h index ed0b9a27..1cce7278 100644 --- a/freebsd/sys/sys/tree.h +++ b/freebsd/sys/sys/tree.h @@ -27,10 +27,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _SYS_TREE_HH_ -#define _SYS_TREE_HH_ +#ifndef _SYS_TREE_H_ +#define _SYS_TREE_H_ -#include <freebsd/sys/cdefs.h> +#include <sys/cdefs.h> /* * This file defines data structures for different types of trees: @@ -762,4 +762,4 @@ name##_RB_MINMAX(struct name *head, int val) \ ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ (x) = (y)) -#endif /* _SYS_TREE_HH_ */ +#endif /* _SYS_TREE_H_ */ diff --git a/freebsd/sys/sys/tty.h b/freebsd/sys/sys/tty.h index a56d38fb..2cf454ef 100644 --- a/freebsd/sys/sys/tty.h +++ b/freebsd/sys/sys/tty.h @@ -29,20 +29,20 @@ * $FreeBSD$ */ -#ifndef _SYS_TTY_HH_ -#define _SYS_TTY_HH_ - -#include <freebsd/sys/param.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/condvar.h> -#include <freebsd/sys/selinfo.h> +#ifndef _SYS_TTY_H_ +#define _SYS_TTY_H_ + +#include <rtems/bsd/sys/param.h> +#include <sys/queue.h> +#include <rtems/bsd/sys/lock.h> +#include <sys/mutex.h> +#include <sys/condvar.h> +#include <sys/selinfo.h> #ifndef __rtems__ -#include <freebsd/sys/termios.h> +#include <sys/termios.h> #endif -#include <freebsd/sys/ttycom.h> -#include <freebsd/sys/ttyqueue.h> +#include <sys/ttycom.h> +#include <sys/ttyqueue.h> struct cdev; struct file; @@ -209,9 +209,9 @@ int pts_alloc_external(int fd, struct thread *td, struct file *fp, struct cdev *dev, const char *name); /* Drivers and line disciplines also need to call these. */ -#include <freebsd/sys/ttydisc.h> -#include <freebsd/sys/ttydevsw.h> -#include <freebsd/sys/ttyhook.h> +#include <sys/ttydisc.h> +#include <sys/ttydevsw.h> +#include <sys/ttyhook.h> #endif /* _KERNEL */ -#endif /* !_SYS_TTY_HH_ */ +#endif /* !_SYS_TTY_H_ */ diff --git a/freebsd/sys/sys/ttycom.h b/freebsd/sys/sys/ttycom.h index cf7cba42..60b6145e 100644 --- a/freebsd/sys/sys/ttycom.h +++ b/freebsd/sys/sys/ttycom.h @@ -35,10 +35,10 @@ * $FreeBSD$ */ -#ifndef _SYS_TTYCOM_HH_ -#define _SYS_TTYCOM_HH_ +#ifndef _SYS_TTYCOM_H_ +#define _SYS_TTYCOM_H_ -#include <freebsd/sys/ioccom.h> +#include <sys/ioccom.h> /* * Tty ioctl's except for those supported only for backwards compatibility @@ -143,4 +143,4 @@ struct winsize { #define NETGRAPHDISC 6 /* Netgraph tty node discipline */ #define H4DISC 7 /* Netgraph Bluetooth H4 discipline */ -#endif /* !_SYS_TTYCOM_HH_ */ +#endif /* !_SYS_TTYCOM_H_ */ diff --git a/freebsd/sys/sys/ttydevsw.h b/freebsd/sys/sys/ttydevsw.h index a4035585..e2278c3a 100644 --- a/freebsd/sys/sys/ttydevsw.h +++ b/freebsd/sys/sys/ttydevsw.h @@ -29,12 +29,12 @@ * $FreeBSD$ */ -#ifndef _SYS_TTYDEVSW_HH_ -#define _SYS_TTYDEVSW_HH_ +#ifndef _SYS_TTYDEVSW_H_ +#define _SYS_TTYDEVSW_H_ -#ifndef _SYS_TTY_HH_ +#ifndef _SYS_TTY_H_ #error "can only be included through <sys/tty.h>" -#endif /* !_SYS_TTY_HH_ */ +#endif /* !_SYS_TTY_H_ */ /* * Driver routines that are called from the line discipline to adjust @@ -166,4 +166,4 @@ ttydevsw_free(struct tty *tp) tp->t_devsw->tsw_free(tty_softc(tp)); } -#endif /* !_SYS_TTYDEVSW_HH_ */ +#endif /* !_SYS_TTYDEVSW_H_ */ diff --git a/freebsd/sys/sys/ttydisc.h b/freebsd/sys/sys/ttydisc.h index 00194988..2ea54666 100644 --- a/freebsd/sys/sys/ttydisc.h +++ b/freebsd/sys/sys/ttydisc.h @@ -29,12 +29,12 @@ * $FreeBSD$ */ -#ifndef _SYS_TTYDISC_HH_ -#define _SYS_TTYDISC_HH_ +#ifndef _SYS_TTYDISC_H_ +#define _SYS_TTYDISC_H_ -#ifndef _SYS_TTY_HH_ +#ifndef _SYS_TTY_H_ #error "can only be included through <sys/tty.h>" -#endif /* !_SYS_TTY_HH_ */ +#endif /* !_SYS_TTY_H_ */ struct cv; struct thread; @@ -83,4 +83,4 @@ ttydisc_write_poll(struct tty *tp) return ttyoutq_bytesleft(&tp->t_outq); } -#endif /* !_SYS_TTYDISC_HH_ */ +#endif /* !_SYS_TTYDISC_H_ */ diff --git a/freebsd/sys/sys/ttyhook.h b/freebsd/sys/sys/ttyhook.h index a15fbbb7..2a6d0887 100644 --- a/freebsd/sys/sys/ttyhook.h +++ b/freebsd/sys/sys/ttyhook.h @@ -26,12 +26,12 @@ * $FreeBSD$ */ -#ifndef _SYS_TTYHOOK_HH_ -#define _SYS_TTYHOOK_HH_ +#ifndef _SYS_TTYHOOK_H_ +#define _SYS_TTYHOOK_H_ -#ifndef _SYS_TTY_HH_ +#ifndef _SYS_TTY_H_ #error "can only be included through <sys/tty.h>" -#endif /* !_SYS_TTY_HH_ */ +#endif /* !_SYS_TTY_H_ */ struct tty; @@ -144,4 +144,4 @@ ttyhook_close(struct tty *tp) tp->t_hook->th_close(tp); } -#endif /* !_SYS_TTYHOOK_HH_ */ +#endif /* !_SYS_TTYHOOK_H_ */ diff --git a/freebsd/sys/sys/ttyqueue.h b/freebsd/sys/sys/ttyqueue.h index b9228bdc..2d1a565a 100644 --- a/freebsd/sys/sys/ttyqueue.h +++ b/freebsd/sys/sys/ttyqueue.h @@ -29,12 +29,12 @@ * $FreeBSD$ */ -#ifndef _SYS_TTYQUEUE_HH_ -#define _SYS_TTYQUEUE_HH_ +#ifndef _SYS_TTYQUEUE_H_ +#define _SYS_TTYQUEUE_H_ -#ifndef _SYS_TTY_HH_ +#ifndef _SYS_TTY_H_ #error "can only be included through <sys/tty.h>" -#endif /* !_SYS_TTY_HH_ */ +#endif /* !_SYS_TTY_H_ */ struct tty; struct ttyinq_block; @@ -175,4 +175,4 @@ ttyoutq_bytesused(struct ttyoutq *to) } #endif /* _KERNEL */ -#endif /* !_SYS_TTYQUEUE_HH_ */ +#endif /* !_SYS_TTYQUEUE_H_ */ diff --git a/freebsd/sys/sys/ucred.h b/freebsd/sys/sys/ucred.h index 917cc750..a8934cec 100644 --- a/freebsd/sys/sys/ucred.h +++ b/freebsd/sys/sys/ucred.h @@ -30,10 +30,10 @@ * $FreeBSD$ */ -#ifndef _SYS_UCRED_HH_ -#define _SYS_UCRED_HH_ +#ifndef _SYS_UCRED_H_ +#define _SYS_UCRED_H_ -#include <freebsd/bsm/audit.h> +#include <bsm/audit.h> /* * Credentials. @@ -107,4 +107,4 @@ void crsetgroups(struct ucred *cr, int n, gid_t *groups); int groupmember(gid_t gid, struct ucred *cred); #endif /* _KERNEL */ -#endif /* !_SYS_UCRED_HH_ */ +#endif /* !_SYS_UCRED_H_ */ diff --git a/freebsd/sys/sys/un.h b/freebsd/sys/sys/un.h index 1f4731e6..a858abf4 100644 --- a/freebsd/sys/sys/un.h +++ b/freebsd/sys/sys/un.h @@ -34,7 +34,7 @@ #define _SYS_UN_H_ #include <sys/cdefs.h> -#include <sys/_types.h> +#include <rtems/bsd/sys/_types.h> #ifndef _SA_FAMILY_T_DECLARED typedef __sa_family_t sa_family_t; diff --git a/freebsd/sys/sys/user.h b/freebsd/sys/sys/user.h index df788c06..7ca16ad0 100644 --- a/freebsd/sys/sys/user.h +++ b/freebsd/sys/sys/user.h @@ -32,34 +32,34 @@ * $FreeBSD$ */ -#ifndef _SYS_USER_HH_ -#define _SYS_USER_HH_ +#ifndef _SYS_USER_H_ +#define _SYS_USER_H_ -#include <freebsd/machine/pcb.h> +#include <machine/pcb.h> #ifndef _KERNEL /* stuff that *used* to be included by user.h, or is now needed */ -#include <freebsd/sys/errno.h> -#include <freebsd/sys/time.h> -#include <freebsd/sys/resource.h> -#include <freebsd/sys/ucred.h> -#include <freebsd/sys/uio.h> -#include <freebsd/sys/queue.h> -#include <freebsd/sys/_lock.h> -#include <freebsd/sys/_mutex.h> -#include <freebsd/sys/proc.h> -#include <freebsd/vm/vm.h> /* XXX */ -#include <freebsd/vm/vm_param.h> /* XXX */ -#include <freebsd/vm/pmap.h> /* XXX */ -#include <freebsd/vm/vm_map.h> /* XXX */ +#include <rtems/bsd/sys/errno.h> +#include <rtems/bsd/sys/time.h> +#include <rtems/bsd/sys/resource.h> +#include <sys/ucred.h> +#include <sys/uio.h> +#include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> +#include <sys/proc.h> +#include <vm/vm.h> /* XXX */ +#include <vm/vm_param.h> /* XXX */ +#include <vm/pmap.h> /* XXX */ +#include <vm/vm_map.h> /* XXX */ #endif /* !_KERNEL */ -#ifndef _SYS_RESOURCEVAR_HH_ -#include <freebsd/sys/resourcevar.h> +#ifndef _SYS_RESOURCEVAR_H_ +#include <sys/resourcevar.h> #endif -#ifndef _SYS_SIGNALVAR_HH_ -#include <freebsd/sys/signalvar.h> +#ifndef _SYS_SIGNALVAR_H_ +#include <sys/signalvar.h> #endif -#ifndef _SYS_SOCKET_VAR_HH_ -#include <freebsd/sys/socket.h> +#ifndef _SYS_SOCKET_VAR_H_ +#include <sys/socket.h> #endif /* diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h index 3a470074..6c866c7f 100644 --- a/freebsd/sys/sys/vmmeter.h +++ b/freebsd/sys/sys/vmmeter.h @@ -30,8 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_VMMETER_HH_ -#define _SYS_VMMETER_HH_ +#ifndef _SYS_VMMETER_H_ +#define _SYS_VMMETER_H_ /* * System wide statistics counters. diff --git a/freebsd/sys/sysctl.h b/freebsd/sys/sysctl.h deleted file mode 100644 index b2a421f5..00000000 --- a/freebsd/sys/sysctl.h +++ /dev/null @@ -1,762 +0,0 @@ -/*- - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Karels at Berkeley Software Design, Inc. - * - * 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. - * - * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ - */ - -#ifndef _SYS_SYSCTL_HH_ -#define _SYS_SYSCTL_HH_ - -#include <freebsd/sys/queue.h> - -struct thread; -/* - * Definitions for sysctl call. The sysctl call uses a hierarchical name - * for objects that can be examined or modified. The name is expressed as - * a sequence of integers. Like a file path name, the meaning of each - * component depends on its place in the hierarchy. The top-level and kern - * identifiers are defined here, and other identifiers are defined in the - * respective subsystem header files. - */ - -#define CTL_MAXNAME 24 /* largest number of components supported */ - -/* - * Each subsystem defined by sysctl defines a list of variables - * for that subsystem. Each name is either a node with further - * levels defined below it, or it is a leaf of some particular - * type given below. Each sysctl level defines a set of name/type - * pairs to be used by sysctl(8) in manipulating the subsystem. - */ -struct ctlname { - char *ctl_name; /* subsystem name */ - int ctl_type; /* type of name */ -}; - -#define CTLTYPE 0xf /* Mask for the type */ -#define CTLTYPE_NODE 1 /* name is a node */ -#define CTLTYPE_INT 2 /* name describes an integer */ -#define CTLTYPE_STRING 3 /* name describes a string */ -#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ -#define CTLTYPE_OPAQUE 5 /* name describes a structure */ -#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ -#define CTLTYPE_UINT 6 /* name describes an unsigned integer */ -#define CTLTYPE_LONG 7 /* name describes a long */ -#define CTLTYPE_ULONG 8 /* name describes an unsigned long */ - -#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ -#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ -#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) -#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ -#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ -#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ -#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ -#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ -#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */ -#define CTLMASK_SECURE 0x00F00000 /* Secure level */ -#define CTLFLAG_TUN 0x00080000 /* Tunable variable */ -#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */ -#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */ -#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) - -/* - * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. - * - * Secure when the securelevel is raised to at least N. - */ -#define CTLSHIFT_SECURE 20 -#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)) -#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)) -#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)) - -/* - * USE THIS instead of a hardwired number from the categories below - * to get dynamically assigned sysctl entries using the linker-set - * technology. This is the way nearly all new sysctl variables should - * be implemented. - * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); - */ -#define OID_AUTO (-1) - -/* - * The starting number for dynamically-assigned entries. WARNING! - * ALL static sysctl entries should have numbers LESS than this! - */ -#define CTL_AUTO_START 0x100 - -#ifdef _KERNEL -#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ - struct sysctl_req *req - -/* definitions for sysctl_req 'lock' member */ -#define REQ_UNLOCKED 0 /* not locked and not wired */ -#define REQ_LOCKED 1 /* locked and not wired */ -#define REQ_WIRED 2 /* locked and wired */ - -/* definitions for sysctl_req 'flags' member */ -#if defined(__amd64__) || defined(__ia64__) -#define SCTL_MASK32 1 /* 32 bit emulation */ -#endif - -/* - * This describes the access space for a sysctl request. This is needed - * so that we can use the interface from the kernel or from user-space. - */ -struct sysctl_req { - struct thread *td; /* used for access checking */ - int lock; /* locking/wiring state */ - void *oldptr; - size_t oldlen; - size_t oldidx; - int (*oldfunc)(struct sysctl_req *, const void *, size_t); -#ifndef __rtems__ - void *newptr; -#else /* __rtems__ */ - const void *newptr; -#endif /* __rtems__ */ - size_t newlen; - size_t newidx; - int (*newfunc)(struct sysctl_req *, void *, size_t); - size_t validlen; - int flags; -}; - -SLIST_HEAD(sysctl_oid_list, sysctl_oid); - -/* - * This describes one "oid" in the MIB tree. Potentially more nodes can - * be hidden behind it, expanded by the handler. - */ -struct sysctl_oid { - struct sysctl_oid_list *oid_parent; - SLIST_ENTRY(sysctl_oid) oid_link; - int oid_number; - u_int oid_kind; - void *oid_arg1; - int oid_arg2; - const char *oid_name; - int (*oid_handler)(SYSCTL_HANDLER_ARGS); - const char *oid_fmt; - int oid_refcnt; - const char *oid_descr; -}; - -#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) -#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) - -int sysctl_handle_int(SYSCTL_HANDLER_ARGS); -int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS); -int sysctl_handle_long(SYSCTL_HANDLER_ARGS); -int sysctl_handle_quad(SYSCTL_HANDLER_ARGS); -int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS); -int sysctl_handle_string(SYSCTL_HANDLER_ARGS); -int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); - -int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS); -int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS); -int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); - -/* - * These functions are used to add/remove an oid from the mib. - */ -void sysctl_register_oid(struct sysctl_oid *oidp); -void sysctl_unregister_oid(struct sysctl_oid *oidp); - -/* Declare a static oid to allow child oids to be added to it. */ -#ifndef __rtems__ -#define SYSCTL_DECL(name) \ - extern struct sysctl_oid_list sysctl_##name##_children -#else /* __rtems__ */ -#define SYSCTL_DECL(name) \ - extern struct sysctl_oid_list _bsd_sysctl_##name##_children -#endif /* __rtems__ */ - -/* Hide these in macros */ -#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \ - (oid_ptr)->oid_arg1 -#define SYSCTL_CHILDREN_SET(oid_ptr, val) \ - (oid_ptr)->oid_arg1 = (val); -#ifndef __rtems__ -#define SYSCTL_STATIC_CHILDREN(oid_name) \ - (&sysctl_##oid_name##_children) -#else /* __rtems__ */ -#define SYSCTL_STATIC_CHILDREN(oid_name) \ - (&_bsd_sysctl_##oid_name##_children) -#endif /* __rtems__ */ - -/* === Structs and macros related to context handling === */ - -/* All dynamically created sysctls can be tracked in a context list. */ -struct sysctl_ctx_entry { - struct sysctl_oid *entry; - TAILQ_ENTRY(sysctl_ctx_entry) link; -}; - -TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); - -#ifndef __rtems__ -#define SYSCTL_NODE_CHILDREN(parent, name) \ - sysctl_##parent##_##name##_children -#else /* __rtems__ */ -#define SYSCTL_NODE_CHILDREN(parent, name) \ - _bsd_sysctl_##parent##_##name##_children -#endif /* __rtems__ */ - -#ifndef NO_SYSCTL_DESCR -#define __DESCR(d) d -#else -#define __DESCR(d) "" -#endif - -/* This constructs a "raw" MIB oid. */ -#ifndef __rtems__ -#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - static struct sysctl_oid sysctl__##parent##_##name = { \ - &sysctl_##parent##_children, { NULL }, nbr, kind, \ - a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ - DATA_SET(sysctl_set, sysctl__##parent##_##name) -#else /* __rtems__ */ -#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - static struct sysctl_oid sysctl__##parent##_##name = { \ - &_bsd_sysctl_##parent##_children, { NULL }, nbr, kind, \ - a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \ - DATA_SET(sysctl_set, sysctl__##parent##_##name) -#endif /* __rtems__ */ - -#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr)) - -/* This constructs a node from which other oids can hang. */ -#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ - struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \ - (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr) - -#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", __DESCR(descr)) - -/* Oid for a string. len can be 0 to indicate '\0' termination. */ -#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ - arg, len, sysctl_handle_string, "A", descr) - -#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ - arg, len, sysctl_handle_string, "A", __DESCR(descr)) - -/* Oid for an int. If ptr is NULL, val is returned. */ -#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "I", descr) - -#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "I", __DESCR(descr)) - -/* Oid for an unsigned int. If ptr is NULL, val is returned. */ -#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "IU", descr) - -#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "IU", __DESCR(descr)) - -#define SYSCTL_XINT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "IX", descr) - -#define SYSCTL_ADD_XINT(ctx, parent, nbr, name, access, ptr, val, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_int, "IX", __DESCR(descr)) - -/* Oid for a long. The pointer must be non NULL. */ -#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_long, "L", descr) - -#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|CTLFLAG_MPSAFE|(access), \ - ptr, 0, sysctl_handle_long, "L", __DESCR(descr)) - -/* Oid for an unsigned long. The pointer must be non NULL. */ -#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_long, "LU", __DESCR(descr)) - -#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ - ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)) - -#define SYSCTL_XLONG(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_long, "LX", __DESCR(descr)) - -#define SYSCTL_ADD_XLONG(ctx, parent, nbr, name, access, ptr, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ - ptr, 0, sysctl_handle_long, "LX", __DESCR(descr)) - -/* Oid for a quad. The pointer must be non NULL. */ -#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ - ptr, val, sysctl_handle_quad, "Q", __DESCR(descr)) - -#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ - ptr, 0, sysctl_handle_quad, "Q", __DESCR(descr)) - -/* Oid for an opaque object. Specified by a pointer and a length. */ -#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, descr) - -#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)) - -/* Oid for a struct. Specified by a pointer and a type. */ -#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, sizeof(struct type), sysctl_handle_opaque, \ - "S," #type, descr) - -#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr)) - -/* Oid for a procedure. Specified by a pointer and an arg. */ -#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ - SYSCTL_OID(parent, nbr, name, (access), \ - ptr, arg, handler, fmt, descr) - -#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, (access), \ - ptr, arg, handler, fmt, __DESCR(descr)) - -/* - * A macro to generate a read-only sysctl to indicate the presense of optional - * kernel features. - */ -#define FEATURE(name, desc) \ - SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD, 0, 1, desc) - -#endif /* _KERNEL */ - -/* - * Top-level identifiers - */ -#define CTL_UNSPEC 0 /* unused */ -#define CTL_KERN 1 /* "high kernel": proc, limits */ -#define CTL_VM 2 /* virtual memory */ -#define CTL_VFS 3 /* filesystem, mount type is next */ -#define CTL_NET 4 /* network, see socket.h */ -#define CTL_DEBUG 5 /* debugging parameters */ -#define CTL_HW 6 /* generic cpu/io */ -#define CTL_MACHDEP 7 /* machine dependent */ -#define CTL_USER 8 /* user-level */ -#define CTL_P1003_1B 9 /* POSIX 1003.1B */ -#define CTL_MAXID 10 /* number of valid top-level ids */ - -#define CTL_NAMES { \ - { 0, 0 }, \ - { "kern", CTLTYPE_NODE }, \ - { "vm", CTLTYPE_NODE }, \ - { "vfs", CTLTYPE_NODE }, \ - { "net", CTLTYPE_NODE }, \ - { "debug", CTLTYPE_NODE }, \ - { "hw", CTLTYPE_NODE }, \ - { "machdep", CTLTYPE_NODE }, \ - { "user", CTLTYPE_NODE }, \ - { "p1003_1b", CTLTYPE_NODE }, \ -} - -/* - * CTL_KERN identifiers - */ -#define KERN_OSTYPE 1 /* string: system version */ -#define KERN_OSRELEASE 2 /* string: system release */ -#define KERN_OSREV 3 /* int: system revision */ -#define KERN_VERSION 4 /* string: compile time info */ -#define KERN_MAXVNODES 5 /* int: max vnodes */ -#define KERN_MAXPROC 6 /* int: max processes */ -#define KERN_MAXFILES 7 /* int: max open files */ -#define KERN_ARGMAX 8 /* int: max arguments to exec */ -#define KERN_SECURELVL 9 /* int: system security level */ -#define KERN_HOSTNAME 10 /* string: hostname */ -#define KERN_HOSTID 11 /* int: host identifier */ -#define KERN_CLOCKRATE 12 /* struct: struct clockrate */ -#define KERN_VNODE 13 /* struct: vnode structures */ -#define KERN_PROC 14 /* struct: process entries */ -#define KERN_FILE 15 /* struct: file entries */ -#define KERN_PROF 16 /* node: kernel profiling info */ -#define KERN_POSIX1 17 /* int: POSIX.1 version */ -#define KERN_NGROUPS 18 /* int: # of supplemental group ids */ -#define KERN_JOB_CONTROL 19 /* int: is job control available */ -#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ -#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ -#define KERN_NISDOMAINNAME 22 /* string: YP domain name */ -#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ -#define KERN_OSRELDATE 24 /* int: kernel release date */ -#define KERN_NTP_PLL 25 /* node: NTP PLL control */ -#define KERN_BOOTFILE 26 /* string: name of booted kernel */ -#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ -#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ -#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */ -#define KERN_IPC 30 /* node: anything related to IPC */ -#define KERN_DUMMY 31 /* unused */ -#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ -#define KERN_USRSTACK 33 /* int: address of USRSTACK */ -#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ -#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */ -#define KERN_HOSTUUID 36 /* string: host UUID identifier */ -#define KERN_ARND 37 /* int: from arc4rand() */ -#define KERN_MAXID 38 /* number of valid kern ids */ - -#define CTL_KERN_NAMES { \ - { 0, 0 }, \ - { "ostype", CTLTYPE_STRING }, \ - { "osrelease", CTLTYPE_STRING }, \ - { "osrevision", CTLTYPE_INT }, \ - { "version", CTLTYPE_STRING }, \ - { "maxvnodes", CTLTYPE_INT }, \ - { "maxproc", CTLTYPE_INT }, \ - { "maxfiles", CTLTYPE_INT }, \ - { "argmax", CTLTYPE_INT }, \ - { "securelevel", CTLTYPE_INT }, \ - { "hostname", CTLTYPE_STRING }, \ - { "hostid", CTLTYPE_UINT }, \ - { "clockrate", CTLTYPE_STRUCT }, \ - { "vnode", CTLTYPE_STRUCT }, \ - { "proc", CTLTYPE_STRUCT }, \ - { "file", CTLTYPE_STRUCT }, \ - { "profiling", CTLTYPE_NODE }, \ - { "posix1version", CTLTYPE_INT }, \ - { "ngroups", CTLTYPE_INT }, \ - { "job_control", CTLTYPE_INT }, \ - { "saved_ids", CTLTYPE_INT }, \ - { "boottime", CTLTYPE_STRUCT }, \ - { "nisdomainname", CTLTYPE_STRING }, \ - { "update", CTLTYPE_INT }, \ - { "osreldate", CTLTYPE_INT }, \ - { "ntp_pll", CTLTYPE_NODE }, \ - { "bootfile", CTLTYPE_STRING }, \ - { "maxfilesperproc", CTLTYPE_INT }, \ - { "maxprocperuid", CTLTYPE_INT }, \ - { "ipc", CTLTYPE_NODE }, \ - { "dummy", CTLTYPE_INT }, \ - { "ps_strings", CTLTYPE_INT }, \ - { "usrstack", CTLTYPE_INT }, \ - { "logsigexit", CTLTYPE_INT }, \ - { "iov_max", CTLTYPE_INT }, \ - { "hostuuid", CTLTYPE_STRING }, \ - { "arc4rand", CTLTYPE_OPAQUE }, \ -} - -/* - * CTL_VFS identifiers - */ -#define CTL_VFS_NAMES { \ - { "vfsconf", CTLTYPE_STRUCT }, \ -} - -/* - * KERN_PROC subtypes - */ -#define KERN_PROC_ALL 0 /* everything */ -#define KERN_PROC_PID 1 /* by process id */ -#define KERN_PROC_PGRP 2 /* by process group id */ -#define KERN_PROC_SESSION 3 /* by session of pid */ -#define KERN_PROC_TTY 4 /* by controlling tty */ -#define KERN_PROC_UID 5 /* by effective uid */ -#define KERN_PROC_RUID 6 /* by real uid */ -#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ -#define KERN_PROC_PROC 8 /* only return procs */ -#define KERN_PROC_SV_NAME 9 /* get syscall vector name */ -#define KERN_PROC_RGID 10 /* by real group id */ -#define KERN_PROC_GID 11 /* by effective group id */ -#define KERN_PROC_PATHNAME 12 /* path to executable */ -#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ -#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ -#define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ -#define KERN_PROC_INC_THREAD 0x10 /* - * modifier for pid, pgrp, tty, - * uid, ruid, gid, rgid and proc - * This effectively uses 16-31 - */ -#define KERN_PROC_VMMAP 32 /* VM map entries for process */ -#define KERN_PROC_FILEDESC 33 /* File descriptors for process */ -#define KERN_PROC_GROUPS 34 /* process groups */ - -/* - * KERN_IPC identifiers - */ -#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ -#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ -#define KIPC_SOMAXCONN 3 /* int: max length of connection q */ -#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ -#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ -#define KIPC_MAX_HDR 6 /* int: max total length of headers */ -#define KIPC_MAX_DATALEN 7 /* int: max length of data? */ - -/* - * CTL_HW identifiers - */ -#define HW_MACHINE 1 /* string: machine class */ -#define HW_MODEL 2 /* string: specific machine model */ -#define HW_NCPU 3 /* int: number of cpus */ -#define HW_BYTEORDER 4 /* int: machine byte order */ -#define HW_PHYSMEM 5 /* int: total memory */ -#define HW_USERMEM 6 /* int: non-kernel memory */ -#define HW_PAGESIZE 7 /* int: software page size */ -#define HW_DISKNAMES 8 /* strings: disk drive names */ -#define HW_DISKSTATS 9 /* struct: diskstats[] */ -#define HW_FLOATINGPT 10 /* int: has HW floating point? */ -#define HW_MACHINE_ARCH 11 /* string: machine architecture */ -#define HW_REALMEM 12 /* int: 'real' memory */ -#define HW_MAXID 13 /* number of valid hw ids */ - -#define CTL_HW_NAMES { \ - { 0, 0 }, \ - { "machine", CTLTYPE_STRING }, \ - { "model", CTLTYPE_STRING }, \ - { "ncpu", CTLTYPE_INT }, \ - { "byteorder", CTLTYPE_INT }, \ - { "physmem", CTLTYPE_ULONG }, \ - { "usermem", CTLTYPE_ULONG }, \ - { "pagesize", CTLTYPE_INT }, \ - { "disknames", CTLTYPE_STRUCT }, \ - { "diskstats", CTLTYPE_STRUCT }, \ - { "floatingpoint", CTLTYPE_INT }, \ - { "machine_arch", CTLTYPE_STRING }, \ - { "realmem", CTLTYPE_ULONG }, \ -} - -/* - * CTL_USER definitions - */ -#define USER_CS_PATH 1 /* string: _CS_PATH */ -#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ -#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ -#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ -#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ -#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ -#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ -#define USER_LINE_MAX 8 /* int: LINE_MAX */ -#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ -#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ -#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ -#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ -#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ -#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ -#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ -#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ -#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ -#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ -#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ -#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ -#define USER_MAXID 21 /* number of valid user ids */ - -#define CTL_USER_NAMES { \ - { 0, 0 }, \ - { "cs_path", CTLTYPE_STRING }, \ - { "bc_base_max", CTLTYPE_INT }, \ - { "bc_dim_max", CTLTYPE_INT }, \ - { "bc_scale_max", CTLTYPE_INT }, \ - { "bc_string_max", CTLTYPE_INT }, \ - { "coll_weights_max", CTLTYPE_INT }, \ - { "expr_nest_max", CTLTYPE_INT }, \ - { "line_max", CTLTYPE_INT }, \ - { "re_dup_max", CTLTYPE_INT }, \ - { "posix2_version", CTLTYPE_INT }, \ - { "posix2_c_bind", CTLTYPE_INT }, \ - { "posix2_c_dev", CTLTYPE_INT }, \ - { "posix2_char_term", CTLTYPE_INT }, \ - { "posix2_fort_dev", CTLTYPE_INT }, \ - { "posix2_fort_run", CTLTYPE_INT }, \ - { "posix2_localedef", CTLTYPE_INT }, \ - { "posix2_sw_dev", CTLTYPE_INT }, \ - { "posix2_upe", CTLTYPE_INT }, \ - { "stream_max", CTLTYPE_INT }, \ - { "tzname_max", CTLTYPE_INT }, \ -} - -#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ -#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ -#define CTL_P1003_1B_MEMLOCK 3 /* boolean */ -#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ -#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ -#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ -#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ -#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ -#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ -#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ -#define CTL_P1003_1B_FSYNC 11 /* boolean */ -#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ -#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ -#define CTL_P1003_1B_TIMERS 14 /* boolean */ -#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ -#define CTL_P1003_1B_AIO_MAX 16 /* int */ -#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ -#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ -#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ -#define CTL_P1003_1B_PAGESIZE 20 /* int */ -#define CTL_P1003_1B_RTSIG_MAX 21 /* int */ -#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ -#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ -#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ -#define CTL_P1003_1B_TIMER_MAX 25 /* int */ - -#define CTL_P1003_1B_MAXID 26 - -#define CTL_P1003_1B_NAMES { \ - { 0, 0 }, \ - { "asynchronous_io", CTLTYPE_INT }, \ - { "mapped_files", CTLTYPE_INT }, \ - { "memlock", CTLTYPE_INT }, \ - { "memlock_range", CTLTYPE_INT }, \ - { "memory_protection", CTLTYPE_INT }, \ - { "message_passing", CTLTYPE_INT }, \ - { "prioritized_io", CTLTYPE_INT }, \ - { "priority_scheduling", CTLTYPE_INT }, \ - { "realtime_signals", CTLTYPE_INT }, \ - { "semaphores", CTLTYPE_INT }, \ - { "fsync", CTLTYPE_INT }, \ - { "shared_memory_objects", CTLTYPE_INT }, \ - { "synchronized_io", CTLTYPE_INT }, \ - { "timers", CTLTYPE_INT }, \ - { "aio_listio_max", CTLTYPE_INT }, \ - { "aio_max", CTLTYPE_INT }, \ - { "aio_prio_delta_max", CTLTYPE_INT }, \ - { "delaytimer_max", CTLTYPE_INT }, \ - { "mq_open_max", CTLTYPE_INT }, \ - { "pagesize", CTLTYPE_INT }, \ - { "rtsig_max", CTLTYPE_INT }, \ - { "nsems_max", CTLTYPE_INT }, \ - { "sem_value_max", CTLTYPE_INT }, \ - { "sigqueue_max", CTLTYPE_INT }, \ - { "timer_max", CTLTYPE_INT }, \ -} - -#ifdef _KERNEL - -/* - * Declare some common oids. - */ -#ifdef __rtems__ -#define sysctl__children _bsd_sysctl__children -#endif /* __rtems__ */ -extern struct sysctl_oid_list sysctl__children; -SYSCTL_DECL(_kern); -SYSCTL_DECL(_kern_features); -SYSCTL_DECL(_kern_ipc); -SYSCTL_DECL(_kern_proc); -SYSCTL_DECL(_kern_sched); -SYSCTL_DECL(_kern_sched_stats); -SYSCTL_DECL(_sysctl); -SYSCTL_DECL(_vm); -SYSCTL_DECL(_vm_stats); -SYSCTL_DECL(_vm_stats_misc); -SYSCTL_DECL(_vfs); -SYSCTL_DECL(_net); -SYSCTL_DECL(_debug); -SYSCTL_DECL(_debug_sizeof); -SYSCTL_DECL(_dev); -SYSCTL_DECL(_hw); -SYSCTL_DECL(_hw_bus); -SYSCTL_DECL(_hw_bus_devices); -SYSCTL_DECL(_hw_bus_info); -SYSCTL_DECL(_machdep); -SYSCTL_DECL(_user); -SYSCTL_DECL(_compat); -SYSCTL_DECL(_regression); -SYSCTL_DECL(_security); -SYSCTL_DECL(_security_bsd); - -extern char machine[]; -extern char osrelease[]; -extern char ostype[]; -extern char kern_ident[]; - -/* Dynamic oid handling */ -struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, - struct sysctl_oid_list *parent, int nbr, const char *name, - int kind, void *arg1, int arg2, - int (*handler) (SYSCTL_HANDLER_ARGS), - const char *fmt, const char *descr); -void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name); -int sysctl_move_oid(struct sysctl_oid *oidp, - struct sysctl_oid_list *parent); -int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse); -int sysctl_ctx_init(struct sysctl_ctx_list *clist); -int sysctl_ctx_free(struct sysctl_ctx_list *clist); -struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, - struct sysctl_oid *oidp); -struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, - struct sysctl_oid *oidp); -int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, - struct sysctl_oid *oidp); - -int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old, -#ifndef __rtems__ - size_t *oldlenp, void *new, size_t newlen, -#else /* __rtems__ */ - size_t *oldlenp, const void *newp, size_t newlen, -#endif /* __rtems__ */ - size_t *retval, int flags); -#ifndef __rtems__ -int kernel_sysctlbyname(struct thread *td, char *name, - void *old, size_t *oldlenp, void *new, size_t newlen, - size_t *retval, int flags); -int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, - size_t *oldlenp, int inkernel, void *new, size_t newlen, - size_t *retval, int flags); -#endif /* __rtems__ */ -int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, - int *nindx, struct sysctl_req *req); -void sysctl_lock(void); -void sysctl_unlock(void); -int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); - -#ifndef __rtems__ -#else /* !_KERNEL */ -#endif /* __rtems__ */ -#include <freebsd/sys/cdefs.h> - -__BEGIN_DECLS -int sysctl(int *, u_int, void *, size_t *, void *, size_t); -int sysctlbyname(const char *, void *, size_t *, void *, size_t); -int sysctlnametomib(const char *, int *, size_t *); -__END_DECLS -#endif /* _KERNEL */ - -#endif /* !_SYS_SYSCTL_HH_ */ diff --git a/freebsd/sys/syslimits.h b/freebsd/sys/syslimits.h deleted file mode 100644 index 936ffd88..00000000 --- a/freebsd/sys/syslimits.h +++ /dev/null @@ -1 +0,0 @@ -/* EMPTY */ diff --git a/freebsd/sys/syslog.h b/freebsd/sys/syslog.h deleted file mode 100644 index 11f7c8e6..00000000 --- a/freebsd/sys/syslog.h +++ /dev/null @@ -1,203 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1988, 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. - * - * @(#)syslog.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ - */ - -#ifndef _SYS_SYSLOG_HH_ -#define _SYS_SYSLOG_HH_ - -#define _PATH_LOG "/var/run/log" -#define _PATH_LOG_PRIV "/var/run/logpriv" -#define _PATH_OLDLOG "/dev/log" /* backward compatibility */ - -/* - * priorities/facilities are encoded into a single 32-bit quantity, where the - * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility - * (0-big number). Both the priorities and the facilities map roughly - * one-to-one to strings in the syslogd(8) source code. This mapping is - * included in this file. - * - * priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but significant condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ - /* extract priority */ -#define LOG_PRI(p) ((p) & LOG_PRIMASK) -#define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) - -#ifdef SYSLOG_NAMES -#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ - /* mark "facility" */ -#define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) -typedef struct _code { - const char *c_name; - int c_val; -} CODE; - -CODE prioritynames[] = { - { "alert", LOG_ALERT, }, - { "crit", LOG_CRIT, }, - { "debug", LOG_DEBUG, }, - { "emerg", LOG_EMERG, }, - { "err", LOG_ERR, }, - { "error", LOG_ERR, }, /* DEPRECATED */ - { "info", LOG_INFO, }, - { "none", INTERNAL_NOPRI, }, /* INTERNAL */ - { "notice", LOG_NOTICE, }, - { "panic", LOG_EMERG, }, /* DEPRECATED */ - { "warn", LOG_WARNING, }, /* DEPRECATED */ - { "warning", LOG_WARNING, }, - { NULL, -1, } -}; -#endif - -/* facility codes */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* network news subsystem */ -#define LOG_UUCP (8<<3) /* UUCP subsystem */ -#define LOG_CRON (9<<3) /* clock daemon */ -#define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ - /* Facility #10 clashes in DEC UNIX, where */ - /* it's defined as LOG_MEGASAFE for AdvFS */ - /* event logging. */ -#define LOG_FTP (11<<3) /* ftp daemon */ -#define LOG_NTP (12<<3) /* NTP subsystem */ -#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ -#define LOG_CONSOLE (14<<3) /* /dev/console output */ - - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* current number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - /* facility of pri */ -#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) - -#ifdef SYSLOG_NAMES -CODE facilitynames[] = { - { "auth", LOG_AUTH, }, - { "authpriv", LOG_AUTHPRIV, }, - { "console", LOG_CONSOLE, }, - { "cron", LOG_CRON, }, - { "daemon", LOG_DAEMON, }, - { "ftp", LOG_FTP, }, - { "kern", LOG_KERN, }, - { "lpr", LOG_LPR, }, - { "mail", LOG_MAIL, }, - { "mark", INTERNAL_MARK, }, /* INTERNAL */ - { "news", LOG_NEWS, }, - { "ntp", LOG_NTP, }, - { "security", LOG_SECURITY, }, - { "syslog", LOG_SYSLOG, }, - { "user", LOG_USER, }, - { "uucp", LOG_UUCP, }, - { "local0", LOG_LOCAL0, }, - { "local1", LOG_LOCAL1, }, - { "local2", LOG_LOCAL2, }, - { "local3", LOG_LOCAL3, }, - { "local4", LOG_LOCAL4, }, - { "local5", LOG_LOCAL5, }, - { "local6", LOG_LOCAL6, }, - { "local7", LOG_LOCAL7, }, - { NULL, -1, } -}; -#endif - -#ifdef _KERNEL -#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ -#endif - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything. - * LOG_NDELAY is the inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ -#define LOG_PERROR 0x20 /* log to stderr as well */ - -#ifdef _KERNEL - -#else /* not _KERNEL */ - -/* - * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two - * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one - * of them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include syslog.h, so we get - * __va_list from <sys/_types.h> and use it. - */ -#include <freebsd/sys/cdefs.h> -#include <freebsd/sys/_types.h> - -__BEGIN_DECLS -void closelog(void); -void openlog(const char *, int, int); -int setlogmask(int); -void syslog(int, const char *, ...) __printflike(2, 3); -#if __BSD_VISIBLE -void vsyslog(int, const char *, __va_list) __printflike(2, 0); -#endif -__END_DECLS - -#endif /* !_KERNEL */ - -#endif |