mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 05:40:40 +08:00
Update due to Newlib 2017-06-07 changes
The following files are now provided by Newlib: * arpa/inet.h * net/if.h * netinet/in.h * netinet/tcp.h * sys/socket.h * sys/uio.h * sys/un.h The <sys/param.h> and <sys/cpuset.h> are now compatible enough to be used directly. Update #2833.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
#include <rtems/bsd/sys/param.h>
|
@@ -1,107 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1991, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, 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.
|
||||
* 3. 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.
|
||||
*
|
||||
* @(#)types.h 8.6 (Berkeley) 2/19/95
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_BSD_MACHINE_BITSTRING_H_
|
||||
#define _RTEMS_BSD_MACHINE_BITSTRING_H_
|
||||
|
||||
#ifndef _SYS_BITSTRING_H_
|
||||
#error "the header file <sys/bitstring.h> must be included first"
|
||||
#endif
|
||||
|
||||
#ifdef __POPCNT__
|
||||
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
|
||||
#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
|
||||
#define __bitcount16(x) __builtin_popcount((__uint16_t)(x))
|
||||
#define __bitcountl(x) __builtin_popcountl((unsigned long)(x))
|
||||
#define __bitcount(x) __builtin_popcount((unsigned int)(x))
|
||||
#else
|
||||
/*
|
||||
* Population count algorithm using SWAR approach
|
||||
* - "SIMD Within A Register".
|
||||
*/
|
||||
static __inline __uint16_t
|
||||
__bitcount16(__uint16_t _x)
|
||||
{
|
||||
|
||||
_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
|
||||
_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
|
||||
_x = (_x + (_x >> 4)) & 0x0f0f;
|
||||
_x = (_x + (_x >> 8)) & 0x00ff;
|
||||
return (_x);
|
||||
}
|
||||
|
||||
static __inline __uint32_t
|
||||
__bitcount32(__uint32_t _x)
|
||||
{
|
||||
|
||||
_x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
|
||||
_x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
|
||||
_x = (_x + (_x >> 4)) & 0x0f0f0f0f;
|
||||
_x = (_x + (_x >> 8));
|
||||
_x = (_x + (_x >> 16)) & 0x000000ff;
|
||||
return (_x);
|
||||
}
|
||||
|
||||
#ifdef __LP64__
|
||||
static __inline __uint64_t
|
||||
__bitcount64(__uint64_t _x)
|
||||
{
|
||||
|
||||
_x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
|
||||
_x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
|
||||
_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
|
||||
_x = (_x + (_x >> 8));
|
||||
_x = (_x + (_x >> 16));
|
||||
_x = (_x + (_x >> 32)) & 0x000000ff;
|
||||
return (_x);
|
||||
}
|
||||
|
||||
#define __bitcountl(x) __bitcount64((unsigned long)(x))
|
||||
#else
|
||||
static __inline __uint64_t
|
||||
__bitcount64(__uint64_t _x)
|
||||
{
|
||||
|
||||
return (__bitcount32(_x >> 32) + __bitcount32(_x));
|
||||
}
|
||||
|
||||
#define __bitcountl(x) __bitcount32((unsigned long)(x))
|
||||
#endif
|
||||
#define __bitcount(x) __bitcount32((unsigned int)(x))
|
||||
#endif
|
||||
|
||||
#endif /* !_RTEMS_BSD_MACHINE_BITSTRING_H_ */
|
@@ -47,7 +47,7 @@
|
||||
#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_
|
||||
#define _RTEMS_BSD_MACHINE_RTEMS_BSD_BUS_DMA_H_
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
@@ -55,6 +55,7 @@
|
||||
/* General define to activate BSD kernel parts */
|
||||
#define _KERNEL 1
|
||||
|
||||
#include <machine/rtems-bsd-version.h>
|
||||
#include <machine/rtems-bsd-kernel-namespace.h>
|
||||
|
||||
/* Assert */
|
||||
@@ -69,6 +70,8 @@ void rtems_bsd_assert_func(const char *file, int line, const char *func, const c
|
||||
|
||||
/* General definitions */
|
||||
|
||||
#define MACHINE_ARCH "rtems"
|
||||
|
||||
#define M_RTEMS_HEAP 0
|
||||
|
||||
#define BSD_DEFAULT_FIB 0
|
||||
@@ -83,4 +86,10 @@ void rtems_bsd_assert_func(const char *file, int line, const char *func, const c
|
||||
|
||||
#define kdb_active 0
|
||||
|
||||
/* pseudo-errors returned inside kernel to modify return to process */
|
||||
#define ERESTART (-1) /* restart syscall */
|
||||
#define EJUSTRETURN (-2) /* don't modify regs, just return */
|
||||
#define ENOIOCTL (-3) /* ioctl not handled by this layer */
|
||||
#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
|
||||
|
||||
#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_KERNEL_SPACE_H_ */
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup rtems_bsd_machine
|
||||
*
|
||||
* @brief TODO.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_BSD_MACHINE_PARAM_H_
|
||||
#define _RTEMS_BSD_MACHINE_PARAM_H_
|
||||
|
||||
#include <machine/param.h>
|
||||
|
||||
#define _ALIGNBYTES ALIGNBYTES
|
||||
|
||||
#define _ALIGN(p) ALIGN(p)
|
||||
|
||||
#define MAXCPU 1
|
||||
|
||||
#define CACHE_LINE_SHIFT 7
|
||||
|
||||
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
|
||||
|
||||
#define MAXPAGESIZES 1 /* maximum number of supported page sizes */
|
||||
|
||||
#define MACHINE_ARCH "rtems"
|
||||
|
||||
#endif /* _RTEMS_BSD_MACHINE_PARAM_H_ */
|
@@ -40,7 +40,7 @@
|
||||
#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_THREAD_H_
|
||||
#define _RTEMS_BSD_MACHINE_RTEMS_BSD_THREAD_H_
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
|
@@ -42,6 +42,7 @@
|
||||
|
||||
#define __FreeBSD__ 1
|
||||
|
||||
#include <machine/rtems-bsd-version.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
1
rtemsbsd/include/machine/rtems-bsd-version.h
Normal file
1
rtemsbsd/include/machine/rtems-bsd-version.h
Normal file
@@ -0,0 +1 @@
|
||||
#define __FreeBSD_version 1200018
|
@@ -1,150 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2008 Nokia Corporation
|
||||
* 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 unmodified, 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 ``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 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 _RTEMS_BSD_SYS_CPUSET_H_
|
||||
#define _RTEMS_BSD_SYS_CPUSET_H_
|
||||
|
||||
#include <sys/_cpuset.h>
|
||||
#include <sys/_bitset.h>
|
||||
#include <sys/bitset.h>
|
||||
|
||||
#define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS)
|
||||
|
||||
#define CPU_CLR(n, p) BIT_CLR(CPU_SETSIZE, n, p)
|
||||
#define CPU_COPY(f, t) BIT_COPY(CPU_SETSIZE, f, t)
|
||||
#define CPU_ISSET(n, p) BIT_ISSET(CPU_SETSIZE, n, p)
|
||||
#define CPU_SET(n, p) BIT_SET(CPU_SETSIZE, n, p)
|
||||
#define CPU_ZERO(p) BIT_ZERO(CPU_SETSIZE, p)
|
||||
#define CPU_FILL(p) BIT_FILL(CPU_SETSIZE, p)
|
||||
#define CPU_SETOF(n, p) BIT_SETOF(CPU_SETSIZE, n, p)
|
||||
#define CPU_EMPTY(p) BIT_EMPTY(CPU_SETSIZE, p)
|
||||
#define CPU_ISFULLSET(p) BIT_ISFULLSET(CPU_SETSIZE, p)
|
||||
#define CPU_SUBSET(p, c) BIT_SUBSET(CPU_SETSIZE, p, c)
|
||||
#define CPU_OVERLAP(p, c) BIT_OVERLAP(CPU_SETSIZE, p, c)
|
||||
#define CPU_CMP(p, c) BIT_CMP(CPU_SETSIZE, p, c)
|
||||
#define CPU_OR(d, s) BIT_OR(CPU_SETSIZE, d, s)
|
||||
#define CPU_AND(d, s) BIT_AND(CPU_SETSIZE, d, s)
|
||||
#define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s)
|
||||
#define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_SET_ATOMIC_ACQ(n, p) BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p)
|
||||
#define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p)
|
||||
#define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
|
||||
#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
|
||||
#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p)
|
||||
#define CPU_COUNT(p) BIT_COUNT(CPU_SETSIZE, p)
|
||||
#define CPUSET_FSET BITSET_FSET(_NCPUWORDS)
|
||||
#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER
|
||||
|
||||
/*
|
||||
* Valid cpulevel_t values.
|
||||
*/
|
||||
#define CPU_LEVEL_ROOT 1 /* All system cpus. */
|
||||
#define CPU_LEVEL_CPUSET 2 /* Available cpus for which. */
|
||||
#define CPU_LEVEL_WHICH 3 /* Actual mask/id for which. */
|
||||
|
||||
/*
|
||||
* Valid cpuwhich_t values.
|
||||
*/
|
||||
#define CPU_WHICH_TID 1 /* Specifies a thread id. */
|
||||
#define CPU_WHICH_PID 2 /* Specifies a process id. */
|
||||
#define CPU_WHICH_CPUSET 3 /* Specifies a set id. */
|
||||
#define CPU_WHICH_IRQ 4 /* Specifies an irq #. */
|
||||
#define CPU_WHICH_JAIL 5 /* Specifies a jail id. */
|
||||
#define CPU_WHICH_DOMAIN 6 /* Specifies a NUMA domain id. */
|
||||
|
||||
/*
|
||||
* Reserved cpuset identifiers.
|
||||
*/
|
||||
#define CPUSET_INVALID -1
|
||||
#define CPUSET_DEFAULT 0
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/queue.h>
|
||||
|
||||
LIST_HEAD(setlist, cpuset);
|
||||
|
||||
/*
|
||||
* cpusets encapsulate cpu binding information for one or more threads.
|
||||
*
|
||||
* a - Accessed with atomics.
|
||||
* s - Set at creation, never modified. Only a ref required to read.
|
||||
* c - Locked internally by a cpuset lock.
|
||||
*
|
||||
* The bitmask is only modified while holding the cpuset lock. It may be
|
||||
* read while only a reference is held but the consumer must be prepared
|
||||
* to deal with inconsistent results.
|
||||
*/
|
||||
struct cpuset {
|
||||
cpuset_t cs_mask; /* bitmask of valid cpus. */
|
||||
volatile u_int cs_ref; /* (a) Reference count. */
|
||||
int cs_flags; /* (s) Flags from below. */
|
||||
cpusetid_t cs_id; /* (s) Id or INVALID. */
|
||||
struct cpuset *cs_parent; /* (s) Pointer to our parent. */
|
||||
LIST_ENTRY(cpuset) cs_link; /* (c) All identified sets. */
|
||||
LIST_ENTRY(cpuset) cs_siblings; /* (c) Sibling set link. */
|
||||
struct setlist cs_children; /* (c) List of children. */
|
||||
};
|
||||
|
||||
#define CPU_SET_ROOT 0x0001 /* Set is a root set. */
|
||||
#define CPU_SET_RDONLY 0x0002 /* No modification allowed. */
|
||||
|
||||
extern cpuset_t *cpuset_root;
|
||||
struct prison;
|
||||
struct proc;
|
||||
struct thread;
|
||||
|
||||
struct cpuset *cpuset_thread0(void);
|
||||
struct cpuset *cpuset_ref(struct cpuset *);
|
||||
void cpuset_rel(struct cpuset *);
|
||||
int cpuset_setthread(lwpid_t id, cpuset_t *);
|
||||
int cpuset_setithread(lwpid_t id, int cpu);
|
||||
int cpuset_create_root(struct prison *, struct cpuset **);
|
||||
int cpuset_setproc_update_set(struct proc *, struct cpuset *);
|
||||
int cpuset_which(cpuwhich_t, id_t, struct proc **,
|
||||
struct thread **, struct cpuset **);
|
||||
|
||||
char *cpusetobj_strprint(char *, const cpuset_t *);
|
||||
int cpusetobj_strscan(cpuset_t *, const char *);
|
||||
#ifdef DDB
|
||||
void ddb_display_cpuset(const cpuset_t *);
|
||||
#endif
|
||||
|
||||
#else
|
||||
__BEGIN_DECLS
|
||||
int cpuset(cpusetid_t *);
|
||||
int cpuset_setid(cpuwhich_t, id_t, cpusetid_t);
|
||||
int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);
|
||||
int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *);
|
||||
int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *);
|
||||
__END_DECLS
|
||||
#endif
|
||||
#endif /* !_RTEMS_BSD_SYS_CPUSET_H_ */
|
@@ -1,198 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, 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.
|
||||
*
|
||||
* @(#)errno.h 8.5 (Berkeley) 1/21/94
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_BSD_SYS_ERRNO_H_
|
||||
#define _RTEMS_BSD_SYS_ERRNO_H_
|
||||
|
||||
#ifndef _KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef __rtems__
|
||||
__BEGIN_DECLS
|
||||
int * __error(void);
|
||||
__END_DECLS
|
||||
#define errno (* __error())
|
||||
#endif /* __rtems__ */
|
||||
#endif
|
||||
|
||||
#ifndef __rtems__
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* Device not configured */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EDEADLK 11 /* Resource deadlock avoided */
|
||||
/* 11 was EAGAIN */
|
||||
#define ENOMEM 12 /* Cannot allocate memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#endif
|
||||
#define EBUSY 16 /* Device busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* Operation not supported by device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate ioctl for device */
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#endif
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only filesystem */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33 /* Numerical argument out of domain */
|
||||
#define ERANGE 34 /* Result too large */
|
||||
|
||||
/* non-blocking and interrupt i/o */
|
||||
#define EAGAIN 35 /* Resource temporarily unavailable */
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define EINPROGRESS 36 /* Operation now in progress */
|
||||
#define EALREADY 37 /* Operation already in progress */
|
||||
|
||||
/* ipc/network software -- argument errors */
|
||||
#define ENOTSOCK 38 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 39 /* Destination address required */
|
||||
#define EMSGSIZE 40 /* Message too long */
|
||||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 42 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 43 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 45 /* Operation not supported */
|
||||
#define ENOTSUP EOPNOTSUPP /* Operation not supported */
|
||||
#define EPFNOSUPPORT 46 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
||||
#define EADDRINUSE 48 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
|
||||
|
||||
/* ipc/network software -- operational errors */
|
||||
#define ENETDOWN 50 /* Network is down */
|
||||
#define ENETUNREACH 51 /* Network is unreachable */
|
||||
#define ENETRESET 52 /* Network dropped connection on reset */
|
||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
||||
#define ECONNRESET 54 /* Connection reset by peer */
|
||||
#define ENOBUFS 55 /* No buffer space available */
|
||||
#define EISCONN 56 /* Socket is already connected */
|
||||
#define ENOTCONN 57 /* Socket is not connected */
|
||||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
|
||||
#define ETOOMANYREFS 59 /* Too many references: can't splice */
|
||||
#define ETIMEDOUT 60 /* Operation timed out */
|
||||
#define ECONNREFUSED 61 /* Connection refused */
|
||||
|
||||
#define ELOOP 62 /* Too many levels of symbolic links */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
#define ENAMETOOLONG 63 /* File name too long */
|
||||
|
||||
/* should be rearranged */
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define EHOSTDOWN 64 /* Host is down */
|
||||
#define EHOSTUNREACH 65 /* No route to host */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
#define ENOTEMPTY 66 /* Directory not empty */
|
||||
|
||||
/* quotas & mush */
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define EPROCLIM 67 /* Too many processes */
|
||||
#define EUSERS 68 /* Too many users */
|
||||
#define EDQUOT 69 /* Disc quota exceeded */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE 70 /* Stale NFS file handle */
|
||||
#define EREMOTE 71 /* Too many levels of remote in path */
|
||||
#define EBADRPC 72 /* RPC struct is bad */
|
||||
#define ERPCMISMATCH 73 /* RPC version wrong */
|
||||
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
|
||||
#define EPROGMISMATCH 75 /* Program version wrong */
|
||||
#define EPROCUNAVAIL 76 /* Bad procedure for program */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#define ENOLCK 77 /* No locks available */
|
||||
#define ENOSYS 78 /* Function not implemented */
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define EAUTH 80 /* Authentication error */
|
||||
#define ENEEDAUTH 81 /* Need authenticator */
|
||||
#define EIDRM 82 /* Identifier removed */
|
||||
#define ENOMSG 83 /* No message of desired type */
|
||||
#define EOVERFLOW 84 /* Value too large to be stored in data type */
|
||||
#define ECANCELED 85 /* Operation canceled */
|
||||
#define EILSEQ 86 /* Illegal byte sequence */
|
||||
#define ENOATTR 87 /* Attribute not found */
|
||||
|
||||
#define EDOOFUS 88 /* Programming error */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#define EBADMSG 89 /* Bad message */
|
||||
#define EMULTIHOP 90 /* Multihop attempted */
|
||||
#define ENOLINK 91 /* Link has been severed */
|
||||
#define EPROTO 92 /* Protocol error */
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define ENOTCAPABLE 93 /* Capabilities insufficient */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define ELAST 93 /* Must be equal largest errno */
|
||||
#endif /* _POSIX_SOURCE */
|
||||
#else /* __rtems__ */
|
||||
#include <errno.h>
|
||||
#endif /* __rtems__ */
|
||||
|
||||
#ifdef _KERNEL
|
||||
/* pseudo-errors returned inside kernel to modify return to process */
|
||||
#define ERESTART (-1) /* restart syscall */
|
||||
#define EJUSTRETURN (-2) /* don't modify regs, just return */
|
||||
#define ENOIOCTL (-3) /* ioctl not handled by this layer */
|
||||
#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,357 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, 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.
|
||||
*
|
||||
* @(#)param.h 8.3 (Berkeley) 4/4/95
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_BSD_SYS_PARAM_H_
|
||||
#define _RTEMS_BSD_SYS_PARAM_H_
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <sys/param.h>
|
||||
#include <sys/_bitset.h>
|
||||
#endif /* __rtems__ */
|
||||
#include <sys/_null.h>
|
||||
|
||||
#define BSD 199506 /* System version (year & month). */
|
||||
#define BSD4_3 1
|
||||
#define BSD4_4 1
|
||||
|
||||
/*
|
||||
* __FreeBSD_version numbers are documented in the Porter's Handbook.
|
||||
* If you bump the version for any reason, you should update the documentation
|
||||
* there.
|
||||
* Currently this lives here:
|
||||
*
|
||||
* doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
|
||||
*
|
||||
* scheme is: <major><two digit minor>Rxx
|
||||
* 'R' is in the range 0 to 4 if this is a release branch or
|
||||
* x.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is
|
||||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 1200018 /* Master, propagated to newvers */
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define P_OSREL_SIGWAIT 700000
|
||||
#define P_OSREL_SIGSEGV 700004
|
||||
#define P_OSREL_MAP_ANON 800104
|
||||
#define P_OSREL_MAP_FSTRICT 1100036
|
||||
#define P_OSREL_SHUTDOWN_ENOTCONN 1100077
|
||||
|
||||
#define P_OSREL_MAJOR(x) ((x) / 100000)
|
||||
#endif
|
||||
|
||||
#ifndef LOCORE
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Machine-independent constants (some used in following include files).
|
||||
* Redefined constants are from POSIX 1003.1 limits file.
|
||||
*
|
||||
* MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
|
||||
* MAXLOGNAME should be == UT_NAMESIZE+1 (see <utmp.h>)
|
||||
*/
|
||||
#include <sys/syslimits.h>
|
||||
|
||||
#define MAXCOMLEN 19 /* max command name remembered */
|
||||
#define MAXINTERP PATH_MAX /* max interpreter file name length */
|
||||
#define MAXLOGNAME 33 /* max login name length (incl. NUL) */
|
||||
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
|
||||
#define NCARGS ARG_MAX /* max bytes for an exec function */
|
||||
#define NGROUPS (NGROUPS_MAX+1) /* max number groups */
|
||||
#define NOFILE OPEN_MAX /* max open files per process */
|
||||
#define NOGROUP 65535 /* marker for empty group set member */
|
||||
#define MAXHOSTNAMELEN 256 /* max hostname size */
|
||||
#define SPECNAMELEN 63 /* max length of devicename */
|
||||
|
||||
/* More types and definitions used throughout the kernel. */
|
||||
#ifdef _KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
#include <rtems/bsd/sys/errno.h>
|
||||
#ifndef LOCORE
|
||||
#include <sys/time.h>
|
||||
#include <sys/priority.h>
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _KERNEL
|
||||
/* Signals. */
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
|
||||
/* Machine type dependent parameters. */
|
||||
#include <machine/rtems-bsd-param.h>
|
||||
#ifndef _KERNEL
|
||||
#include <sys/limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef _NO_NAMESPACE_POLLUTION
|
||||
|
||||
#ifndef DEV_BSHIFT
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#endif
|
||||
#define DEV_BSIZE (1<<DEV_BSHIFT)
|
||||
|
||||
#ifndef BLKDEV_IOSIZE
|
||||
#define BLKDEV_IOSIZE PAGE_SIZE /* default block device I/O size */
|
||||
#endif
|
||||
#ifndef DFLTPHYS
|
||||
#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */
|
||||
#endif
|
||||
#ifndef MAXPHYS
|
||||
#define MAXPHYS (128 * 1024) /* max raw I/O transfer size */
|
||||
#endif
|
||||
#ifndef MAXDUMPPGS
|
||||
#define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than PAGE_SIZE.
|
||||
*/
|
||||
#ifndef MSIZE
|
||||
#define MSIZE 256 /* size of an mbuf */
|
||||
#endif /* MSIZE */
|
||||
|
||||
#ifndef MCLSHIFT
|
||||
#define MCLSHIFT 11 /* convert bytes to mbuf clusters */
|
||||
#endif /* MCLSHIFT */
|
||||
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
|
||||
|
||||
#define MJUMPAGESIZE PAGE_SIZE /* jumbo cluster 4k */
|
||||
#define MJUM9BYTES (9 * 1024) /* jumbo cluster 9k */
|
||||
#define MJUM16BYTES (16 * 1024) /* jumbo cluster 16k */
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value
|
||||
* for all data types (int, long, ...). The result is u_long and
|
||||
* must be cast to any desired pointer type.
|
||||
*/
|
||||
#ifndef _ALIGNBYTES
|
||||
#define _ALIGNBYTES (sizeof(long) - 1)
|
||||
#endif
|
||||
#ifndef _ALIGN
|
||||
#define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ALIGNED_POINTER is a boolean macro that checks whether an address
|
||||
* is valid to fetch data elements of type t from on this architecture.
|
||||
* This does not reflect the optimal alignment, just the possibility
|
||||
* (within reasonable limits).
|
||||
*/
|
||||
#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
|
||||
|
||||
/*
|
||||
* Some macros for units conversion
|
||||
*/
|
||||
|
||||
/* clicks to bytes */
|
||||
#ifndef ctob
|
||||
#define ctob(x) ((x)<<PAGE_SHIFT)
|
||||
#endif
|
||||
|
||||
/* bytes to clicks */
|
||||
#ifndef btoc
|
||||
#define btoc(x) (((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* btodb() is messy and perhaps slow because `bytes' may be an off_t. We
|
||||
* want to shift an unsigned type to avoid sign extension and we don't
|
||||
* want to widen `bytes' unnecessarily. Assume that the result fits in
|
||||
* a daddr_t.
|
||||
*/
|
||||
#ifndef btodb
|
||||
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
|
||||
(sizeof (bytes) > sizeof(long) \
|
||||
? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
|
||||
: (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
|
||||
#endif
|
||||
|
||||
#ifndef dbtob
|
||||
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
|
||||
((off_t)(db) << DEV_BSHIFT)
|
||||
#endif
|
||||
|
||||
#endif /* _NO_NAMESPACE_POLLUTION */
|
||||
|
||||
#define PRIMASK 0x0ff
|
||||
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
|
||||
#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
|
||||
#define PBDRY 0x400 /* for PCATCH stop is done on the user boundary */
|
||||
|
||||
#define NZERO 0 /* default "nice" */
|
||||
|
||||
#define NBBY 8 /* number of bits in a byte */
|
||||
#define NBPW sizeof(int) /* number of bytes per word (integer) */
|
||||
|
||||
#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
|
||||
|
||||
#define NODEV (dev_t)(-1) /* non-existent device */
|
||||
|
||||
/*
|
||||
* File system parameters and macros.
|
||||
*
|
||||
* MAXBSIZE - Filesystems are made out of blocks of at most MAXBSIZE bytes
|
||||
* per block. MAXBSIZE may be made larger without effecting
|
||||
* any existing filesystems as long as it does not exceed MAXPHYS,
|
||||
* and may be made smaller at the risk of not being able to use
|
||||
* filesystems which require a block size exceeding MAXBSIZE.
|
||||
*
|
||||
* BKVASIZE - Nominal buffer space per buffer, in bytes. BKVASIZE is the
|
||||
* minimum KVM memory reservation the kernel is willing to make.
|
||||
* Filesystems can of course request smaller chunks. Actual
|
||||
* backing memory uses a chunk size of a page (PAGE_SIZE).
|
||||
*
|
||||
* If you make BKVASIZE too small you risk seriously fragmenting
|
||||
* the buffer KVM map which may slow things down a bit. If you
|
||||
* make it too big the kernel will not be able to optimally use
|
||||
* the KVM memory reserved for the buffer cache and will wind
|
||||
* up with too-few buffers.
|
||||
*
|
||||
* The default is 16384, roughly 2x the block size used by a
|
||||
* normal UFS filesystem.
|
||||
*/
|
||||
#define MAXBSIZE 65536 /* must be power of 2 */
|
||||
#define BKVASIZE 16384 /* must be power of 2 */
|
||||
#define BKVAMASK (BKVASIZE-1)
|
||||
|
||||
/*
|
||||
* MAXPATHLEN defines the longest permissible path length after expanding
|
||||
* symbolic links. It is used to allocate a temporary buffer from the buffer
|
||||
* pool in which to do the name expansion, hence should be a power of two,
|
||||
* and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
|
||||
* maximum number of symbolic links that may be expanded in a path name.
|
||||
* It should be set high enough to allow all legitimate uses, but halt
|
||||
* infinite loops reasonably quickly.
|
||||
*/
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#define MAXSYMLINKS 32
|
||||
|
||||
/* Bit map related macros. */
|
||||
#define setbit(a,i) (((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))
|
||||
#define clrbit(a,i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))
|
||||
#define isset(a,i) \
|
||||
(((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))
|
||||
#define isclr(a,i) \
|
||||
((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
||||
|
||||
/* Macros for counting and rounding. */
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
#endif
|
||||
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
#define rounddown(x, y) (((x)/(y))*(y))
|
||||
#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */
|
||||
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
|
||||
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
|
||||
#define powerof2(x) ((((x)-1)&(x))==0)
|
||||
|
||||
/* Macros for min/max. */
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Basic byte order function prototypes for non-inline functions.
|
||||
*/
|
||||
#ifndef LOCORE
|
||||
#ifndef _BYTEORDER_PROTOTYPED
|
||||
#define _BYTEORDER_PROTOTYPED
|
||||
__BEGIN_DECLS
|
||||
__uint32_t htonl(__uint32_t);
|
||||
__uint16_t htons(__uint16_t);
|
||||
__uint32_t ntohl(__uint32_t);
|
||||
__uint16_t ntohs(__uint16_t);
|
||||
__END_DECLS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
#ifndef _BYTEORDER_FUNC_DEFINED
|
||||
#define _BYTEORDER_FUNC_DEFINED
|
||||
#define htonl(x) __htonl(x)
|
||||
#define htons(x) __htons(x)
|
||||
#define ntohl(x) __ntohl(x)
|
||||
#define ntohs(x) __ntohs(x)
|
||||
#endif /* !_BYTEORDER_FUNC_DEFINED */
|
||||
#endif /* lint */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Scale factor for scaled integers used to count %cpu time and load avgs.
|
||||
*
|
||||
* The number of CPU `tick's that map to a unique `%age' can be expressed
|
||||
* by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
|
||||
* can be calculated (assuming 32 bits) can be closely approximated using
|
||||
* the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
|
||||
*
|
||||
* For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
|
||||
* FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
|
||||
*/
|
||||
#define FSHIFT 11 /* bits to right of fixed binary point */
|
||||
#define FSCALE (1<<FSHIFT)
|
||||
|
||||
#define dbtoc(db) /* calculates devblks to pages */ \
|
||||
((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
|
||||
|
||||
#define ctodb(db) /* calculates pages to devblks */ \
|
||||
((db) << (PAGE_SHIFT - DEV_BSHIFT))
|
||||
|
||||
/*
|
||||
* Given the pointer x to the member m of the struct s, return
|
||||
* a pointer to the containing structure.
|
||||
*/
|
||||
#define member2struct(s, m, x) \
|
||||
((struct s *)(void *)((char *)(x) - offsetof(struct s, m)))
|
||||
|
||||
/*
|
||||
* Access a variable length array that has been declared as a fixed
|
||||
* length array.
|
||||
*/
|
||||
#define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])
|
||||
|
||||
#endif /* _RTEMS_BSD_SYS_PARAM_H_ */
|
@@ -1,60 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2008 Nokia Corporation
|
||||
* 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 unmodified, 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 ``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 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__CPUSET_H_
|
||||
#define _SYS__CPUSET_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef __rtems__
|
||||
#define CPU_SETSIZE MAXCPU
|
||||
#endif /* __rtems__ */
|
||||
#endif
|
||||
|
||||
#define CPU_MAXSIZE 128
|
||||
|
||||
#ifndef CPU_SETSIZE
|
||||
#define CPU_SETSIZE CPU_MAXSIZE
|
||||
#endif
|
||||
|
||||
#ifndef __rtems__
|
||||
#define _NCPUBITS (sizeof(long) * NBBY) /* bits per mask */
|
||||
#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS)
|
||||
|
||||
typedef struct _cpuset {
|
||||
long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
|
||||
} cpuset_t;
|
||||
#else /* __rtems__ */
|
||||
#include <sys/cpuset.h>
|
||||
|
||||
typedef cpu_set_t cpuset_t;
|
||||
#endif /* __rtems__ */
|
||||
|
||||
#endif /* !_SYS__CPUSET_H_ */
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* See the source file for legal information
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kobj.h>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <netipsec/ipsec.h>
|
||||
|
||||
|
@@ -42,7 +42,7 @@ extern "C" {
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@@ -32,7 +32,7 @@
|
||||
* - defaultrouter
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
|
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <rtems/bsd.h>
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-support.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-chunk.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <rtems/score/apimutex.h>
|
||||
|
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-thread.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@@ -46,11 +46,11 @@
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
#include <sys/mutex.h>*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <rtems/bsd/sys/errno.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sysproto.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/osd.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-support.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-muteximpl.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-thread.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-page.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-thread.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
|
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/local/opt_cpu.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
|
@@ -48,7 +48,7 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
#include <machine/rtems-bsd-muteximpl.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include <machine/rtems-bsd-muteximpl.h>
|
||||
#include <machine/rtems-bsd-thread.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <rtems/bsd/sys/lock.h>
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include <machine/rtems-bsd-thread.h>
|
||||
#include <machine/rtems-bsd-support.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@@ -55,7 +55,7 @@
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
|
@@ -28,7 +28,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/bus.h>
|
||||
|
@@ -48,7 +48,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/local/opt_evdev.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/bus.h>
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/condvar.h>
|
||||
|
@@ -54,7 +54,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/stddef.h>
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
@@ -137,7 +137,7 @@ static int lpc_otg_clk_ctrl(uint32_t otg_clk_ctrl)
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/stddef.h>
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
@@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/stddef.h>
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <dev/usb/usb_otg_transceiver.h>
|
||||
|
||||
|
@@ -92,12 +92,13 @@
|
||||
#include <rtems/termiostypes.h>
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#include <rtems/rtemspppd.h>
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@@ -84,12 +84,12 @@
|
||||
|
||||
#if NPPP > 0
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
|
Reference in New Issue
Block a user