OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/trunk/ecos-2.0/packages/net/tcpip/v2_0/include/sys
    from Rev 1254 to Rev 1765
    Reverse comparison

Rev 1254 → Rev 1765

/mbuf.h
0,0 → 1,476
//==========================================================================
//
// include/sys/mbuf.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: mbuf.h,v 1.14 1999/12/08 06:50:24 itojun Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
 
/*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)mbuf.h 8.5 (Berkeley) 2/19/95
*/
 
#ifndef _SYS_MBUF_H_
#define _SYS_MBUF_H_
 
#ifndef M_WAITOK
#include <sys/malloc.h>
#endif
 
/*
* Mbufs are of a single size, MSIZE (machine/param.h), which
* includes overhead. An mbuf may add a single "mbuf cluster" of size
* MCLBYTES (also in machine/param.h), which has no additional overhead
* and is used instead of the internal data area; this is done when
* at least MINCLSIZE of data must be stored.
*/
 
#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */
#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */
 
#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */
#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */
 
/*
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
* dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX)
* mtocl(x) - convert pointer within cluster to cluster index #
* cltom(x) - convert cluster # to ptr to beginning of cluster
*/
#define mtod(m,t) ((t)((m)->m_data))
#define dtom(x) ((struct mbuf *)((long)(x) & ~(MSIZE-1)))
#ifdef __ECOS
extern int cyg_mtocl(u_long);
extern struct mbuf *cyg_cltom(u_long);
#define mtocl(x) cyg_mtocl((u_long)x)
#define cltom(x) cyg_cltom((u_long)x)
#else
#define mtocl(x) (((u_long)(x) - (u_long)mbutl) >> MCLSHIFT)
#define cltom(x) ((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)))
#endif
 
/* header at beginning of each mbuf: */
struct m_hdr {
struct mbuf *mh_next; /* next buffer in chain */
struct mbuf *mh_nextpkt; /* next chain in queue/record */
caddr_t mh_data; /* location of data */
u_int mh_len; /* amount of data in this mbuf */
short mh_type; /* type of data in this mbuf */
short mh_flags; /* flags; see below */
};
 
/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */
struct pkthdr {
struct ifnet *rcvif; /* rcv interface */
int len; /* total packet length */
void *tdbi; /* pointer to struct tdb_ident */
/* XXX - pull in ip_ipsp.h */
};
 
/* description of external storage mapped into mbuf, valid if M_EXT set */
struct m_ext {
caddr_t ext_buf; /* start of buffer */
void (*ext_free) /* free routine if not the usual */
__P((struct mbuf *));
u_int ext_size; /* size of buffer, for ext_free */
void (*ext_ref) /* add a reference to the ext object */
__P((struct mbuf *));
void *ext_handle; /* handle for storage manager */
};
 
struct mbuf {
struct m_hdr m_hdr;
union {
struct {
struct pkthdr MH_pkthdr; /* M_PKTHDR set */
union {
struct m_ext MH_ext; /* M_EXT set */
char MH_databuf[MHLEN];
} MH_dat;
} MH;
char M_databuf[MLEN]; /* !M_PKTHDR, !M_EXT */
} M_dat;
};
#define m_next m_hdr.mh_next
#define m_len m_hdr.mh_len
#define m_data m_hdr.mh_data
#define m_type m_hdr.mh_type
#define m_flags m_hdr.mh_flags
#define m_nextpkt m_hdr.mh_nextpkt
#define m_act m_nextpkt
#define m_pkthdr M_dat.MH.MH_pkthdr
#define m_ext M_dat.MH.MH_dat.MH_ext
#define m_pktdat M_dat.MH.MH_dat.MH_databuf
#define m_dat M_dat.M_databuf
 
/* mbuf flags */
#define M_EXT 0x0001 /* has associated external storage */
#define M_PKTHDR 0x0002 /* start of record */
#define M_EOR 0x0004 /* end of record */
 
/* mbuf pkthdr flags, also in m_flags */
#define M_BCAST 0x0100 /* send/received as link-level broadcast */
#define M_MCAST 0x0200 /* send/received as link-level multicast */
#define M_CONF 0x0400 /* packet was encrypted (ESP-transport) */
#define M_AUTH 0x0800 /* packet was authenticated (AH) */
#if 0 /* NRL IPv6 */
#define M_TUNNEL 0x1000 /* packet was tunneled */
#define M_DAD 0x2000 /* Used on outbound packets to indicate that
* this is for duplicate address detection */
#endif
 
/* KAME IPv6 */
#define M_ANYCAST6 0x4000 /* received as IPv6 anycast */
#if 0 /*KAME IPSEC*/
#define M_AUTHIPHDR 0x0010 /* data origin authentication for IP header */
#define M_DECRYPTED 0x0020 /* confidentiality */
#endif
#define M_LOOP 0x0040 /* for Mbuf statistics */
#if 0 /*KAME IPSEC*/
#define M_AUTHIPDGM 0x0080 /* data origin authentication */
#endif
 
/* flags copied when copying m_pkthdr */
#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST|M_CONF|M_AUTH|M_ANYCAST6|M_LOOP)
 
/* mbuf types */
#define MT_FREE 0 /* should be on free list */
#define MT_DATA 1 /* dynamic (data) allocation */
#define MT_HEADER 2 /* packet header */
#define MT_SOCKET 3 /* socket structure */
#define MT_PCB 4 /* protocol control block */
#define MT_RTABLE 5 /* routing tables */
#define MT_HTABLE 6 /* IMP host tables */
#define MT_ATABLE 7 /* address resolution tables */
#define MT_SONAME 8 /* socket name */
#define MT_SOOPTS 10 /* socket options */
#define MT_FTABLE 11 /* fragment reassembly header */
#define MT_RIGHTS 12 /* access rights */
#define MT_IFADDR 13 /* interface address */
#define MT_CONTROL 14 /* extra-data protocol message */
#define MT_OOBDATA 15 /* expedited data */
 
/* flags to m_get/MGET */
#define M_DONTWAIT M_NOWAIT
#define M_WAIT M_WAITOK
 
#ifdef __ECOS
extern void *cyg_net_mbuf_alloc(int type, int flags);
extern void cyg_net_mbuf_free(caddr_t addr, int type);
#define MBUF_ALLOC(space, cast, size, type, flags) \
(space) = (cast)cyg_net_mbuf_alloc(type, flags)
#define MBUF_FREE(addr, type) cyg_net_mbuf_free((caddr_t)(addr), type)
#else
#define MBUF_ALLOC(space, cast, size, type, flags) \
MALLOC(space, cast, size, type, flags)
#define MBUF_FREE(addr, type) \
MFREE(addr, type)
#endif
 
/*
* mbuf utility macros:
*
* MBUFLOCK(code)
* prevents a section of code from from being interrupted by network
* drivers.
*/
#define MBUFLOCK(code) \
{ int ms = splimp(); \
{ code } \
splx(ms); \
}
 
/*
* mbuf allocation/deallocation macros:
*
* MGET(struct mbuf *m, int how, int type)
* allocates an mbuf and initializes it to contain internal data.
*
* MGETHDR(struct mbuf *m, int how, int type)
* allocates an mbuf and initializes it to contain a packet header
* and internal data.
*/
#define MGET(m, how, type) { \
MBUF_ALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
if (m) { \
(m)->m_type = (type); \
MBUFLOCK(mbstat.m_mtypes[type]++;) \
(m)->m_next = (struct mbuf *)NULL; \
(m)->m_nextpkt = (struct mbuf *)NULL; \
(m)->m_data = (m)->m_dat; \
(m)->m_flags = 0; \
} else \
(m) = m_retry((how), (type)); \
}
 
#define MGETHDR(m, how, type) { \
MBUF_ALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
if (m) { \
(m)->m_type = (type); \
MBUFLOCK(mbstat.m_mtypes[type]++;) \
(m)->m_next = (struct mbuf *)NULL; \
(m)->m_nextpkt = (struct mbuf *)NULL; \
(m)->m_data = (m)->m_pktdat; \
(m)->m_flags = M_PKTHDR; \
} else \
(m) = m_retryhdr((how), (type)); \
}
 
/*
* Mbuf cluster macros.
* MCLALLOC(caddr_t p, int how) allocates an mbuf cluster.
* MCLGET adds such clusters to a normal mbuf;
* the flag M_EXT is set upon success.
* MCLFREE releases a reference to a cluster allocated by MCLALLOC,
* freeing the cluster if the reference count has reached 0.
*
* Normal mbuf clusters are normally treated as character arrays
* after allocation, but use the first word of the buffer as a free list
* pointer while on the free list.
*/
union mcluster {
union mcluster *mcl_next;
char mcl_buf[MCLBYTES];
};
 
#define MCLALLOC(p, how) \
MBUFLOCK( \
if (mclfree == 0) \
(void)m_clalloc(1, (how)); \
if (((p) = (caddr_t)mclfree) != 0) { \
++mclrefcnt[mtocl(p)]; \
mbstat.m_clfree--; \
mclfree = ((union mcluster *)(p))->mcl_next; \
} \
)
 
#define MCLGET(m, how) \
{ MCLALLOC((m)->m_ext.ext_buf, (how)); \
if ((m)->m_ext.ext_buf != NULL) { \
(m)->m_data = (m)->m_ext.ext_buf; \
(m)->m_flags |= M_EXT; \
(m)->m_ext.ext_size = MCLBYTES; \
(m)->m_ext.ext_free = NULL; \
(m)->m_ext.ext_ref = NULL; \
(m)->m_ext.ext_handle = NULL; \
} \
}
 
#define MCLFREE(p) \
MBUFLOCK ( \
if (--mclrefcnt[mtocl(p)] == 0) { \
((union mcluster *)(p))->mcl_next = mclfree; \
mclfree = (union mcluster *)(p); \
mbstat.m_clfree++; \
} \
)
 
/*
* For cluster mbufs (regardless of header or not).
*/
#define MCL_ALIGN(m, len) \
{ (m)->m_data += (MCLBYTES - (len)) &~ (sizeof(long) -1); }
 
/*
* MFREE(struct mbuf *m, struct mbuf *n)
* Free a single mbuf and associated external storage.
* Place the successor, if any, in n.
*/
#define MFREE(m, n) \
{ MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \
if ((m)->m_flags & M_EXT) { \
if ((m)->m_ext.ext_free) \
(*((m)->m_ext.ext_free))(m); \
else \
MCLFREE((m)->m_ext.ext_buf); \
} \
(n) = (m)->m_next; \
MBUF_FREE((m), mbtypes[(m)->m_type]); \
}
 
/*
* Copy mbuf pkthdr from from to to.
* from must have M_PKTHDR set, and to must be empty.
*/
#define M_COPY_PKTHDR(to, from) { \
(to)->m_pkthdr = (from)->m_pkthdr; \
(to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
(to)->m_data = (to)->m_pktdat; \
}
 
/*
* Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
* an object of the specified size at the end of the mbuf, longword aligned.
*/
#define M_ALIGN(m, len) \
{ (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
/*
* As above, for mbufs allocated with m_gethdr/MGETHDR
* or initialized by M_COPY_PKTHDR.
*/
#define MH_ALIGN(m, len) \
{ (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
 
/*
* Compute the amount of space available
* before the current start of data in an mbuf.
*/
#define M_LEADINGSPACE(m) \
((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
(m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
(m)->m_data - (m)->m_dat)
 
/*
* Compute the amount of space available
* after the end of data in an mbuf.
*/
#define M_TRAILINGSPACE(m) \
((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
((m)->m_data + (m)->m_len) : \
&(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
 
/*
* Arrange to prepend space of size plen to mbuf m.
* If a new mbuf must be allocated, how specifies whether to wait.
* If how is M_DONTWAIT and allocation fails, the original mbuf chain
* is freed and m is set to NULL.
*/
#define M_PREPEND(m, plen, how) { \
if (M_LEADINGSPACE(m) >= (plen)) { \
(m)->m_data -= (plen); \
(m)->m_len += (plen); \
} else \
(m) = m_prepend((m), (plen), (how)); \
if ((m) && (m)->m_flags & M_PKTHDR) \
(m)->m_pkthdr.len += (plen); \
}
 
/* change mbuf to new type */
#define MCHTYPE(m, t) { \
MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
(m)->m_type = t;\
}
 
/* length to m_copy to copy all */
#define M_COPYALL 1000000000
 
/* compatiblity with 4.3 */
#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
 
/*
* Mbuf statistics.
*/
struct mbstat {
u_long m_mbufs; /* mbufs obtained from page pool */
u_long m_clusters; /* clusters obtained from page pool */
u_long m_spare; /* spare field */
u_long m_clfree; /* free clusters */
u_long m_drops; /* times failed to find space */
u_long m_wait; /* times waited for space */
u_long m_drain; /* times drained protocols for space */
u_short m_mtypes[256]; /* type specific mbuf allocations */
};
 
#ifdef _KERNEL
extern struct mbuf *mbutl; /* virtual address of mclusters */
extern char *mclrefcnt; /* cluster reference counts */
extern struct mbstat mbstat;
extern int nmbclusters;
union mcluster *mclfree;
extern int max_linkhdr; /* largest link-level header */
extern int max_protohdr; /* largest protocol header */
extern int max_hdr; /* largest link+protocol header */
extern int max_datalen; /* MHLEN - max_hdr */
extern int mbtypes[]; /* XXX */
extern int needqueuedrain; /* True if allocation failed at */
/* interrupt level */
 
void mbinit __P((void));
struct mbuf *m_copym2 __P((struct mbuf *, int, int, int));
struct mbuf *m_copym __P((struct mbuf *, int, int, int));
struct mbuf *m_free __P((struct mbuf *));
struct mbuf *m_get __P((int, int));
struct mbuf *m_getclr __P((int, int));
struct mbuf *m_gethdr __P((int, int));
struct mbuf *m_prepend __P((struct mbuf *, int, int));
struct mbuf *m_pullup __P((struct mbuf *, int));
struct mbuf *m_pullup2 __P((struct mbuf *, int));
struct mbuf *m_retry __P((int, int));
struct mbuf *m_retryhdr __P((int, int));
struct mbuf *m_split __P((struct mbuf *, int, int));
struct mbuf *m_inject __P((struct mbuf *, int, int, int));
void m_adj __P((struct mbuf *, int));
int m_clalloc __P((int, int));
void m_copyback __P((struct mbuf *, int, int, caddr_t));
void m_freem __P((struct mbuf *));
void m_reclaim __P((void));
void m_copydata __P((struct mbuf *, int, int, caddr_t));
void m_cat __P((struct mbuf *, struct mbuf *));
struct mbuf *m_devget __P((char *, int, int, struct ifnet *,
void (*) __P((const void *, void *, size_t))));
void m_zero __P((struct mbuf *));
int m_apply __P((struct mbuf *, int, int,
int (*)(caddr_t, caddr_t, unsigned int), caddr_t));
 
#endif
 
#endif // _SYS_MBUF_H_
/bsdtypes.h
0,0 → 1,197
//==========================================================================
//
// include/sys/types.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: types.h,v 1.15 1999/02/15 18:53:57 millert Exp $ */
/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
 
/*-
* Copyright (c) 1982, 1986, 1991, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)types.h 8.4 (Berkeley) 1/21/94
*/
 
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
 
/* Machine type dependent parameters. */
#include <machine/types.h>
 
#include <machine/ansi.h>
#include <machine/endian.h>
 
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
 
typedef unsigned char unchar; /* Sys V compatibility */
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
typedef unsigned long ulong; /* Sys V compatibility */
#endif
 
typedef u_int64_t u_quad_t; /* quads */
typedef int64_t quad_t;
typedef quad_t * qaddr_t;
 
typedef char * caddr_t; /* core address */
typedef int32_t daddr_t; /* disk address */
typedef u_int32_t fixpt_t; /* fixed point number */
typedef long key_t; /* IPC key (for Sys V IPC) */
typedef quad_t rlim_t; /* resource limit */
typedef int32_t segsz_t; /* segment size */
typedef int32_t swblk_t; /* swap offset */
typedef u_int32_t useconds_t; /* microseconds */
typedef int32_t suseconds_t; /* microseconds (signed) */
 
/*
* XPG4.2 states that inclusion of <netinet/in.h> must pull these
* in and that inclusion of <sys/socket.h> must pull in sa_family_t.
* We put there here because there are other headers that require
* these types and <sys/socket.h> and <netinet/in.h> will indirectly
* include <sys/types.h>. Thus we are compliant without too many hoops.
*/
typedef u_int32_t in_addr_t; /* base type for internet address */
typedef u_int16_t in_port_t; /* IP port type */
typedef u_int8_t sa_family_t; /* sockaddr address family type */
typedef u_int32_t socklen_t; /* length type for network syscalls */
 
/*
* These belong in unistd.h, but are placed here too to ensure that
* long arguments will be promoted to off_t if the program fails to
* include that header or explicitly cast them to off_t.
*/
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
off_t lseek __P((int, off_t, int));
int ftruncate __P((int, off_t));
int truncate __P((const char *, off_t));
__END_DECLS
#endif /* !_KERNEL */
#endif /* !defined(_POSIX_SOURCE) ... */
 
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
/* Major, minor numbers, dev_t's. */
#define major(x) ((int32_t)(((u_int32_t)(x) >> 8) & 0xff))
#define minor(x) ((int32_t)((x) & 0xff))
#define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
#endif
 
#if 0 //def _BSD_CLOCK_T_
typedef _BSD_CLOCK_T_ clock_t;
#undef _BSD_CLOCK_T_
#endif
 
#ifndef __ECOS
#if 0 //def _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#endif
 
#if 0 //def _BSD_SSIZE_T_
typedef _BSD_SSIZE_T_ ssize_t;
#undef _BSD_SSIZE_T_
#endif
 
#if 0 //def _BSD_TIME_T_
typedef _BSD_TIME_T_ time_t;
#undef _BSD_TIME_T_
#endif
 
#if 0 //def _BSD_CLOCKID_T_
typedef _BSD_CLOCKID_T_ clockid_t;
#undef _BSD_CLOCKID_T_
#endif
 
#if 0 //def _BSD_TIMER_T_
typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_
#endif
 
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
 
#if defined(__STDC__) && defined(_KERNEL)
/*
* Forward structure declarations for function prototypes. We include the
* common structures that cross subsystem boundaries here; others are mostly
* used in the same place that the structure is defined.
*/
struct proc;
struct pgrp;
struct ucred;
struct rusage;
struct file;
struct buf;
struct tty;
struct uio;
#endif
 
#endif /* !defined(_POSIX_SOURCE) ... */
#endif /* !_SYS_TYPES_H_ */
/endian.h
0,0 → 1,225
//==========================================================================
//
// include/sys/endian.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: endian.h,v 1.4 1999/07/21 05:58:25 csapuntz Exp $ */
 
/*-
* Copyright (c) 1997 Niklas Hallqvist. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Niklas Hallqvist.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*/
 
/*
* Generic definitions for little- and big-endian systems. Other endianesses
* has to be dealt with in the specific machine/endian.h file for that port.
*
* This file is meant to be included from a little- or big-endian port's
* machine/endian.h after setting BYTE_ORDER to either 1234 for little endian
* or 4321 for big..
*/
 
#ifndef _SYS_ENDIAN_H_
#define _SYS_ENDIAN_H_
 
#ifndef _POSIX_SOURCE
 
#include <sys/cdefs.h>
 
#define LITTLE_ENDIAN 1234
 
 
#define BIG_ENDIAN 4321
#define PDP_ENDIAN 3412
 
#ifdef __GNUC__
 
#define __swap16gen(x) ({ \
u_int16_t __swap16gen_x = (x); \
\
(u_int16_t)((__swap16gen_x & 0xff) << 8 | \
(__swap16gen_x & 0xff00) >> 8); \
})
 
#define __swap32gen(x) ({ \
u_int32_t __swap32gen_x = (x); \
\
(u_int32_t)((__swap32gen_x & 0xff) << 24 | \
(__swap32gen_x & 0xff00) << 8 | \
(__swap32gen_x & 0xff0000) >> 8 | \
(__swap32gen_x & 0xff000000) >> 24); \
})
 
#else /* __GNUC__ */
 
/* Note that these macros evaluate their arguments several times. */
#define __swap16gen(x) \
(u_int16_t)(((u_int16_t)(x) & 0xff) << 8 | ((u_int16_t)(x) & 0xff00) >> 8)
 
#define __swap32gen(x) \
(u_int32_t)(((u_int32_t)(x) & 0xff) << 24 | \
((u_int32_t)(x) & 0xff00) << 8 | ((u_int32_t)(x) & 0xff0000) >> 8 | \
((u_int32_t)(x) & 0xff000000) >> 24)
 
#endif /* __GNUC__ */
 
/*
* Define MD_SWAP if you provide swap{16,32}md functions/macros that are
* optimized for your architecture, These will be used for swap{16,32}
* unless the argument is a constant and we are using GCC, where we can
* take advantage of the CSE phase much better by using the generic version.
*/
#ifdef MD_SWAP
#if __GNUC__
 
#define swap16(x) ({ \
u_int16_t __swap16_x = (x); \
\
__builtin_constant_p(x) ? __swap16gen(__swap16_x) : \
__swap16md(__swap16_x); \
})
 
#define swap32(x) ({ \
u_int32_t __swap32_x = (x); \
\
__builtin_constant_p(x) ? __swap32gen(__swap32_x) : \
__swap32md(__swap32_x); \
})
 
#endif /* __GNUC__ */
 
#else /* MD_SWAP */
#define swap16 __swap16gen
#define swap32 __swap32gen
#endif /* MD_SWAP */
 
#define swap16_multi(v, n) do { \
size_t __swap16_multi_n = (n); \
u_int16_t *__swap16_multi_v = (v); \
\
while (__swap16_multi_n) { \
*__swap16_multi_v = swap16(*__swap16_multi_v); \
__swap16_multi_v++; \
__swap16_multi_n--; \
} \
} while (0)
 
__BEGIN_DECLS
u_int32_t htobe32 __P((u_int32_t));
u_int16_t htobe16 __P((u_int16_t));
u_int32_t betoh32 __P((u_int32_t));
u_int16_t betoh16 __P((u_int16_t));
 
u_int32_t htole32 __P((u_int32_t));
u_int16_t htole16 __P((u_int16_t));
u_int32_t letoh32 __P((u_int32_t));
u_int16_t letoh16 __P((u_int16_t));
__END_DECLS
 
#if BYTE_ORDER == LITTLE_ENDIAN
 
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
#define _QUAD_HIGHWORD 1
#endif
#ifndef _QUAD_LOWWORD
#define _QUAD_LOWWORD 0
#endif
 
#define htobe16 swap16
#define htobe32 swap32
#define betoh16 swap16
#define betoh32 swap32
 
#define htole16(x) (x)
#define htole32(x) (x)
#define letoh16(x) (x)
#define letoh32(x) (x)
 
#endif /* BYTE_ORDER */
 
#if BYTE_ORDER == BIG_ENDIAN
 
/* Can be overridden by machine/endian.h before inclusion of this file. */
#ifndef _QUAD_HIGHWORD
#define _QUAD_HIGHWORD 0
#endif
#ifndef _QUAD_LOWWORD
#define _QUAD_LOWWORD 1
#endif
 
#define htole16 swap16
#define htole32 swap32
#define letoh16 swap16
#define letoh32 swap32
 
#define htobe16(x) (x)
#define htobe32(x) (x)
#define betoh16(x) (x)
#define betoh32(x) (x)
 
#endif /* BYTE_ORDER */
 
#define htons htobe16
#define htonl htobe32
#define ntohs betoh16
#define ntohl betoh32
 
#define NTOHL(x) (x) = ntohl((u_int32_t)(x))
#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
#define HTONL(x) (x) = htonl((u_int32_t)(x))
#define HTONS(x) (x) = htons((u_int16_t)(x))
 
#endif /* _POSIX_SOURCE */
#endif /* _SYS_ENDIAN_H_ */
/time.h
0,0 → 1,242
//==========================================================================
//
// include/sys/time.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: time.h,v 1.9 1999/12/06 19:36:42 aaron Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
 
/*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.2 (Berkeley) 7/10/94
*/
 
#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_
 
#include <sys/types.h>
#include <time.h>
 
#if 0 //ndef __time_t_defined
typedef int time_t;
# define __time_t_defined
#endif
 
#if 0
 
/*
* Structure returned by gettimeofday(2) system call,
* and used in other calls.
*/
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
 
#endif
 
#if 0
/*
* Structure defined by POSIX.1b to be like a timeval.
*/
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif
 
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
 
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
#define DST_NONE 0 /* not on dst */
#define DST_USA 1 /* USA style dst */
#define DST_AUST 2 /* Australian style dst */
#define DST_WET 3 /* Western European dst */
#define DST_MET 4 /* Middle European dst */
#define DST_EET 5 /* Eastern European dst */
#define DST_CAN 6 /* Canada */
 
/* Operations on timevals. */
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
 
/* Operations on timespecs. */
#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
#define timespeccmp(tsp, usp, cmp) \
(((tsp)->tv_sec == (usp)->tv_sec) ? \
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
((tsp)->tv_sec cmp (usp)->tv_sec))
#define timespecadd(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
if ((vsp)->tv_nsec >= 1000000000L) { \
(vsp)->tv_sec++; \
(vsp)->tv_nsec -= 1000000000L; \
} \
} while (0)
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
if ((vsp)->tv_nsec < 0) { \
(vsp)->tv_sec--; \
(vsp)->tv_nsec += 1000000000L; \
} \
} while (0)
 
/*
* Names of the interval timers, and structure
* defining a timer setting.
*/
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
 
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
 
/*
* Getkerninfo clock information structure
*/
struct clockinfo {
int hz; /* clock frequency */
int tick; /* micro-seconds per hz tick */
int tickadj; /* clock skew rate for adjtime() */
int stathz; /* statistics clock frequency */
int profhz; /* profiling clock frequency */
};
 
#define CLOCK_REALTIME 0
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
 
#define TIMER_RELTIME 0x0 /* relative timer */
#ifndef TIMER_ABSTIME
#define TIMER_ABSTIME 0x1 /* absolute timer */
#endif
 
#if defined(_KERNEL) || defined(_STANDALONE)
int itimerfix __P((struct timeval *tv));
int itimerdecr __P((struct itimerval *itp, int usec));
void microtime __P((struct timeval *tv));
void settime __P((struct timeval *tv));
#else /* !_KERNEL */
 
#ifndef __ECOS
#include <time.h>
#endif
 
#if 0 //ndef _POSIX_SOURCE
#include <sys/cdefs.h>
 
__BEGIN_DECLS
int adjtime __P((const struct timeval *, struct timeval *));
int clock_getres __P((clockid_t, struct timespec *));
int clock_gettime __P((clockid_t, struct timespec *));
int clock_settime __P((clockid_t, const struct timespec *));
int futimes __P((int, const struct timeval *));
int getitimer __P((int, struct itimerval *));
int gettimeofday __P((struct timeval *, struct timezone *));
int nanosleep __P((const struct timespec *, struct timespec *));
int setitimer __P((int, const struct itimerval *, struct itimerval *));
int settimeofday __P((const struct timeval *, const struct timezone *));
int utimes __P((const char *, const struct timeval *));
__END_DECLS
#endif /* !POSIX */
 
#endif /* !_KERNEL */
 
#endif /* !_SYS_TIME_H_ */
/param.h
0,0 → 1,347
//==========================================================================
//
// include/sys/param.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: param.h,v 1.25 1999/09/23 08:25:01 deraadt Exp $ */
/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
 
/*-
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.2 (Berkeley) 1/21/94
*/
 
#ifndef _SYS_PARAM_H_
#define _SYS_PARAM_H_
 
#define BSD 199306 /* System version (year & month). */
#define BSD4_3 1
#define BSD4_4 1
 
#define OpenBSD 199912 /* OpenBSD version (year & month). */
#define OpenBSD2_6 1 /* OpenBSD 2.6 */
 
#ifndef NULL
#ifdef __GNUG__
#define NULL __null
#else
#define NULL 0
#endif
#endif
 
#ifndef _LOCORE
#include <sys/types.h>
#ifndef __ECOS
#include <sys/simplelock.h>
#endif
#endif
 
#ifndef __ECOS
/*
* 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 (see <utmp.h>)
*/
#include <sys/syslimits.h>
 
#define MAXCOMLEN 16 /* max command name remembered */
#define MAXINTERP 64 /* max interpreter file name length */
#define MAXLOGNAME 12 /* max login name length */
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS NGROUPS_MAX /* max number groups */
#define NOFILE OPEN_MAX /* max open files per process (soft) */
#define NOFILE_MAX 1024 /* max open files per process (hard) */
#define NOGROUP 65535 /* marker for empty group set member */
#endif
#define MAXHOSTNAMELEN 256 /* max hostname size */
 
/* More types and definitions used throughout the kernel. */
#ifdef _KERNEL
#include <sys/cdefs.h>
#include <sys/errno.h>
#include <sys/time.h>
#ifdef __ECOS
#include <cyg/io/file.h>
#else
#include <sys/resource.h>
#include <sys/ucred.h>
#include <sys/uio.h>
#endif
#endif
 
#ifndef __ECOS
/* Signals. */
#include <sys/signal.h>
#endif
 
#ifndef __ECOS
/*
* Priorities. Note that with 32 run queues, differences less than 4 are
* insignificant.
*/
#define PSWP 0
#define PVM 4
#define PINOD 8
#define PRIBIO 16
#define PVFS 20
#define PZERO 22 /* No longer magic, shouldn't be here. XXX */
#define PSOCK 24
#define PWAIT 32
#define PLOCK 36
#define PPAUSE 40
#define PUSER 50
#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */
 
#define PRIMASK 0x0ff
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
#endif
 
#define NBPW sizeof(int) /* number of bytes per word (integer) */
 
#ifndef __ECOS
#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
#define NODEV (dev_t)(-1) /* non-existent device */
 
/*
* Clustering of hardware pages on machines with ridiculously small
* page sizes is done here. The paging subsystem deals with units of
* CLSIZE pte's describing NBPG (from machine/machparam.h) pages each.
*/
#define CLBYTES (CLSIZE*NBPG)
#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
#define claligned(x) ((((int)(x))&CLOFSET)==0)
#define CLOFF CLOFSET
#define CLSHIFT (PGSHIFT+CLSIZELOG2)
 
#if CLSIZE==1
#define clbase(i) (i)
#define clrnd(i) (i)
#else
/* Give the base virtual address (first of CLSIZE). */
#define clbase(i) ((i) &~ (CLSIZE-1))
/* Round a number of clicks up to a whole cluster. */
#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
#endif
 
#define CBLOCK 64 /* Clist block size, must be a power of 2. */
#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
/* Data chars/clist. */
#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE)
#define CROUND (CBLOCK - 1) /* Clist rounding. */
 
/*
* File system parameters and macros.
*
* The file system is made out of blocks of at most MAXBSIZE units, with
* smaller units (fragments) only in the last direct block. MAXBSIZE
* primarily determines the size of buffers in the buffer pool. It may be
* made larger without any effect on existing file systems; however making
* it smaller makes some file systems unmountable.
*/
#ifndef MAXBSIZE /* XXX temp until sun3 DMA chaining */
#define MAXBSIZE MAXPHYS
#endif
#define MAXFRAG 8
 
/*
* MAXPATHLEN defines the longest permissable 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
 
#endif // __ECOS
 
/* Bit map related macros. */
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
 
/* Macros for counting and rounding. */
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#define powerof2(x) ((((x)-1)&(x))==0)
 
/* Macros for min/max. */
#ifndef _KERNEL
# ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
# endif
# ifndef MAX
# define MAX(a,b) (((a)>(b))?(a):(b))
# endif
#endif
 
#ifndef __ECOS
/*
* Constants for setting the parameters of the kernel memory allocator.
*
* 2 ** MINBUCKET is the smallest unit of memory that will be
* allocated. It must be at least large enough to hold a pointer.
*
* Units of memory less or equal to MAXALLOCSAVE will permanently
* allocate physical memory; requests for these size pieces of
* memory are quite fast. Allocations greater than MAXALLOCSAVE must
* always allocate and free physical memory; requests for these
* size allocations should be done infrequently as they will be slow.
*
* Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
* MAXALLOCSIZE must be a power of two.
*/
#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
#define MAXALLOCSAVE (2 * CLBYTES)
 
/*
* 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)
 
/*
* rfork() options.
*
* XXX currently, operations without RFPROC set are not supported.
*/
#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */
#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */
#define RFFDG (1<<2) /* copy fd table */
#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */
#define RFPROC (1<<4) /* change child (else changes curproc) */
#define RFMEM (1<<5) /* share `address space' */
#define RFNOWAIT (1<<6) /* parent need not wait() on child */
#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */
#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */
#define RFCFDG (1<<12) /* zero fd table */
#endif // __ECOS
 
#ifdef __ECOS
// Function mappings
 
extern int cyg_tsleep(void *, int, char *, int);
extern void cyg_wakeup(void *);
#define tsleep(e,p,w,t) cyg_tsleep(e,0,w,t)
#define wakeup(e) cyg_wakeup(e)
 
#ifdef CYGIMPL_TRACE_SPLX
extern cyg_uint32 cyg_splimp(const char *file, const int line);
extern cyg_uint32 cyg_splnet(const char *file, const int line);
extern cyg_uint32 cyg_splclock(const char *file, const int line);
extern cyg_uint32 cyg_splsoftnet(const char *file, const int line);
extern void cyg_splx(cyg_uint32, const char *file, const int line);
#define splimp() cyg_splimp(__FUNCTION__, __LINE__)
#define splnet() cyg_splnet(__FUNCTION__, __LINE__)
#define splclock() cyg_splclock(__FUNCTION__, __LINE__)
#define splsoftnet() cyg_splsoftnet(__FUNCTION__, __LINE__)
#define splx(x) cyg_splx(x, __FUNCTION__, __LINE__)
#define cyg_scheduler_lock() _cyg_scheduler_lock(__FUNCTION__, __LINE__)
#define cyg_scheduler_safe_lock() _cyg_scheduler_safe_lock(__FUNCTION__, __LINE__)
#define cyg_scheduler_unlock() _cyg_scheduler_unlock(__FUNCTION__, __LINE__)
#else
extern cyg_uint32 cyg_splimp(void);
extern cyg_uint32 cyg_splnet(void);
extern cyg_uint32 cyg_splclock(void);
extern cyg_uint32 cyg_splsoftnet(void);
extern cyg_uint32 cyg_splhigh(void);
extern void cyg_splx(cyg_uint32);
#define splimp cyg_splimp
#define splnet cyg_splnet
#define splclock cyg_splclock
#define splsoftnet cyg_splsoftnet
#define splhigh cyg_splhigh
#define splx cyg_splx
#endif
 
extern void cyg_panic(const char *msg, ...);
#define panic cyg_panic
 
// Namespace changes
#define route_reinit cyg_route_reinit
#define arc4random cyg_arc4random
#endif
 
/* Machine type dependent parameters. */
#include <machine/param.h>
#include <machine/limits.h>
 
#endif // __SYS_PARAM_H_
/socketvar.h
0,0 → 1,341
//==========================================================================
//
// include/sys/socketvar.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: socketvar.h,v 1.17 1999/12/08 06:50:24 itojun Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
 
/*-
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.1 (Berkeley) 6/2/93
*/
 
#ifndef _SYS_SOCKETVAR_H_
#define _SYS_SOCKETVAR_H_
 
#include <sys/bsdselect.h> /* for struct selinfo */
 
/*
* Kernel structure per socket.
* Contains send and receive buffer queues,
* handle on protocol and pointer to protocol
* private data and error information.
*/
struct socket {
short so_type; /* 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; /* internal state flags SS_*, below */
void *so_pcb; /* protocol control block */
struct protosw *so_proto; /* protocol handle */
/*
* Variables for connection queueing.
* 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_q0 queues partially completed connections,
* while so_q 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_q0 or so_q.
* 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; /* back pointer to accept socket */
struct socket *so_q0; /* queue of partial connections */
struct socket *so_q; /* queue of incoming connections */
short so_q0len; /* partials on so_q0 */
short so_qlen; /* number of connections on so_q */
short so_qlimit; /* max number queued connections */
short so_timeo; /* connection timeout */
u_short so_error; /* error affecting connection */
pid_t so_pgid; /* pgid for signals */
uid_t so_siguid; /* uid of process who set so_pgid */
uid_t so_sigeuid; /* euid of process who set so_pgid */
u_long so_oobmark; /* chars to oob mark */
/*
* Variables for socket buffering.
*/
struct sockbuf {
u_long sb_cc; /* actual chars in buffer */
u_long sb_hiwat; /* max actual char count */
u_long sb_mbcnt; /* chars of mbufs used */
u_long sb_mbmax; /* max chars of mbufs to use */
long sb_lowat; /* low water mark */
struct mbuf *sb_mb; /* the mbuf chain */
struct selinfo sb_sel; /* process selecting read/write */
short sb_flags; /* flags, see below */
short sb_timeo; /* timeout for read/write */
} so_rcv, so_snd;
#define SB_MAX (256*1024) /* default for max chars in sockbuf */
#define SB_LOCK 0x01 /* lock on data queue */
#define SB_WANT 0x02 /* someone is waiting to lock */
#define SB_WAIT 0x04 /* someone is waiting for data/space */
#define SB_SEL 0x08 /* someone is selecting */
#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
#define SB_NOINTR 0x40 /* operations not interruptible */
 
void *so_internal; /* Space for svr4 stream data */
void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf));
caddr_t so_upcallarg; /* Arg for above */
uid_t so_euid; /* who opened the socket */
uid_t so_ruid; /* who opened the socket */
};
 
/*
* Socket state bits.
*/
#define SS_NOFDREF 0x001 /* no file table ref any more */
#define SS_ISCONNECTED 0x002 /* socket connected to a peer */
#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */
#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */
#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */
#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */
#define SS_RCVATMARK 0x040 /* at mark on input */
#define SS_ISDISCONNECTED 0x800 /* socket disconnected from peer */
 
#define SS_PRIV 0x080 /* privileged for broadcast, raw... */
#define SS_NBIO 0x100 /* non-blocking ops */
#define SS_ASYNC 0x200 /* async i/o notify */
#define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */
#define SS_CONNECTOUT 0x1000 /* connect, not accept, at this end */
 
/*
* Macros for sockets and socket buffering.
*/
 
/*
* 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)) != 0)
 
/*
* How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
* This is problematical if the fields are unsigned, as the space might
* still be negative (cc > hiwat or mbcnt > mbmax). Should detect
* overflow and return 0. Should use "lmin" but it doesn't exist now.
*/
#define sbspace(sb) \
((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
 
/* 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 soreadable(so) \
((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
((so)->so_state & SS_CANTRCVMORE) || \
(so)->so_qlen || (so)->so_error)
 
/* 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_state & SS_CANTSENDMORE) || \
(so)->so_error)
 
/* adjust counters in sb reflecting allocation of m */
#define sballoc(sb, m) { \
(sb)->sb_cc += (m)->m_len; \
(sb)->sb_mbcnt += MSIZE; \
if ((m)->m_flags & M_EXT) \
(sb)->sb_mbcnt += (m)->m_ext.ext_size; \
}
 
/* adjust counters in sb reflecting freeing of m */
#define sbfree(sb, m) { \
(sb)->sb_cc -= (m)->m_len; \
(sb)->sb_mbcnt -= MSIZE; \
if ((m)->m_flags & M_EXT) \
(sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
}
 
/*
* Set lock on sockbuf sb; sleep if lock is already held.
* Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
* Returns error without lock if sleep is interrupted.
*/
#ifdef __ECOS
extern int sblock(struct sockbuf *sb, int wf);
extern void sbunlock(struct sockbuf *sb);
#else
#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
((sb)->sb_flags |= SB_LOCK), 0)
 
/* release lock on sockbuf sb */
#define sbunlock(sb) { \
(sb)->sb_flags &= ~SB_LOCK; \
if ((sb)->sb_flags & SB_WANT) { \
(sb)->sb_flags &= ~SB_WANT; \
wakeup((caddr_t)&(sb)->sb_flags); \
} \
}
#endif
 
#define sorwakeup(so) { sowakeup((so), &(so)->so_rcv); \
if ((so)->so_upcall) \
(*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \
}
 
#define sowwakeup(so) sowakeup((so), &(so)->so_snd)
 
#ifdef _KERNEL
u_long sb_max;
/* to catch callers missing new second argument to sonewconn: */
#define sonewconn(head, connstatus) sonewconn1((head), (connstatus))
struct socket *sonewconn1 __P((struct socket *head, int connstatus));
 
/* strings for sleep message: */
extern char netio[], netcon[], netcls[];
 
struct mbuf;
struct sockaddr;
struct proc;
struct msghdr;
struct stat;
 
/*
* File operations on sockets.
*/
#ifdef __ECOS
int soo_read __P((struct file *fp, struct uio *uio));
int soo_write __P((struct file *fp, struct uio *uio));
int soo_ioctl __P((struct file *fp, CYG_ADDRWORD cmd, CYG_ADDRWORD data));
int soo_select __P((struct file *fp, int which));
int soo_close __P((struct file *fp));
#else
int soo_read __P((struct file *fp, struct uio *uio, struct ucred *cred));
int soo_write __P((struct file *fp, struct uio *uio, struct ucred *cred));
int soo_ioctl __P((struct file *fp, u_long cmd, caddr_t data,
struct proc *p));
int soo_select __P((struct file *fp, int which, struct proc *p));
int soo_close __P((struct file *fp, struct proc *p));
#endif
 
int soo_stat __P((struct socket *, struct stat *));
int uipc_usrreq __P((struct socket *, int , struct mbuf *,
struct mbuf *, struct mbuf *));
void sbappend __P((struct sockbuf *sb, struct mbuf *m));
int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa,
struct mbuf *m0, struct mbuf *control));
int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0,
struct mbuf *control));
void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0));
void sbcheck __P((struct sockbuf *sb));
void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n));
struct mbuf *
sbcreatecontrol __P((caddr_t p, int size, int type, int level));
void sbdrop __P((struct sockbuf *sb, int len));
void sbdroprecord __P((struct sockbuf *sb));
void sbflush __P((struct sockbuf *sb));
void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0));
void sbrelease __P((struct sockbuf *sb));
int sbreserve __P((struct sockbuf *sb, u_long cc));
int sbwait __P((struct sockbuf *sb));
int sb_lock __P((struct sockbuf *sb));
int soabort __P((struct socket *so));
int soaccept __P((struct socket *so, struct mbuf *nam));
int sobind __P((struct socket *so, struct mbuf *nam));
void socantrcvmore __P((struct socket *so));
void socantsendmore __P((struct socket *so));
int soclose __P((struct socket *so));
int soconnect __P((struct socket *so, struct mbuf *nam));
int soconnect2 __P((struct socket *so1, struct socket *so2));
int socreate __P((int dom, struct socket **aso, int type, int proto));
int sodisconnect __P((struct socket *so));
void sofree __P((struct socket *so));
int sogetopt __P((struct socket *so, int level, int optname,
struct mbuf **mp));
void sohasoutofband __P((struct socket *so));
void soisconnected __P((struct socket *so));
void soisconnecting __P((struct socket *so));
void soisdisconnected __P((struct socket *so));
void soisdisconnecting __P((struct socket *so));
int solisten __P((struct socket *so, int backlog));
struct socket *
sonewconn1 __P((struct socket *head, int connstatus));
void soqinsque __P((struct socket *head, struct socket *so, int q));
int soqremque __P((struct socket *so, int q));
int soreceive __P((struct socket *so, struct mbuf **paddr, struct uio *uio,
struct mbuf **mp0, struct mbuf **controlp, int *flagsp));
int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc));
void sorflush __P((struct socket *so));
int sosend __P((struct socket *so, struct mbuf *addr, struct uio *uio,
struct mbuf *top, struct mbuf *control, int flags));
int sosetopt __P((struct socket *so, int level, int optname,
struct mbuf *m0));
int soshutdown __P((struct socket *so, int how));
void sowakeup __P((struct socket *so, struct sockbuf *sb));
int sockargs __P((struct mbuf **, caddr_t, socklen_t, int));
 
#ifdef __ECOS
int sendit __P((int, struct msghdr *, int, register_t *));
int recvit __P((int, struct msghdr *, caddr_t, register_t *));
#else
int sendit __P((struct proc *, int, struct msghdr *, int, register_t *));
int recvit __P((struct proc *, int, struct msghdr *, caddr_t,
register_t *));
#endif
#endif /* _KERNEL */
 
#endif // _SYS_SOCKETVAR_H_
/malloc.h
0,0 → 1,472
//==========================================================================
//
// include/sys/malloc.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: malloc.h,v 1.27 1999/12/08 06:50:24 itojun Exp $ */
/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
 
/*
* Copyright (c) 1987, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
*/
 
#ifndef _SYS_MALLOC_H_
#define _SYS_MALLOC_H_
 
/*
* flags to malloc
*/
#define M_WAITOK 0x0000
#define M_NOWAIT 0x0001
 
/*
* Types of memory to be allocated
*/
#define M_FREE 0 /* should be on free list */
#define M_MBUF 1 /* mbuf */
#define M_DEVBUF 2 /* device driver memory */
#define M_SOCKET 3 /* socket structure */
#define M_PCB 4 /* protocol control block */
#define M_RTABLE 5 /* routing tables */
#define M_HTABLE 6 /* IMP host tables */
#define M_FTABLE 7 /* fragment reassembly header */
#define M_ZOMBIE 8 /* zombie proc status */
#define M_IFADDR 9 /* interface address */
#define M_SOOPTS 10 /* socket options */
#define M_SONAME 11 /* socket name */
#define M_NAMEI 12 /* namei path name buffer */
#define M_GPROF 13 /* kernel profiling buffer */
#define M_IOCTLOPS 14 /* ioctl data buffer */
#define M_MAPMEM 15 /* mapped memory descriptors */
#define M_CRED 16 /* credentials */
#define M_PGRP 17 /* process group header */
#define M_SESSION 18 /* session header */
#define M_IOV 19 /* large iov's */
#define M_MOUNT 20 /* vfs mount struct */
#define M_FHANDLE 21 /* network file handle */
#define M_NFSREQ 22 /* NFS request header */
#define M_NFSMNT 23 /* NFS mount structure */
#define M_NFSNODE 24 /* NFS vnode private part */
#define M_VNODE 25 /* Dynamically allocated vnodes */
#define M_CACHE 26 /* Dynamically allocated cache entries */
#define M_DQUOT 27 /* UFS quota entries */
#define M_UFSMNT 28 /* UFS mount structure */
#define M_SHM 29 /* SVID compatible shared memory segments */
#define M_VMMAP 30 /* VM map structures */
#define M_VMMAPENT 31 /* VM map entry structures */
#define M_VMOBJ 32 /* VM object structure */
#define M_VMOBJHASH 33 /* VM object hash structure */
#define M_VMPMAP 34 /* VM pmap */
#define M_VMPVENT 35 /* VM phys-virt mapping entry */
#define M_VMPAGER 36 /* XXX: VM pager struct */
#define M_VMPGDATA 37 /* XXX: VM pager private data */
#define M_FILE 38 /* Open file structure */
#define M_FILEDESC 39 /* Open file descriptor table */
#define M_LOCKF 40 /* Byte-range locking structures */
#define M_PROC 41 /* Proc structures */
#define M_SUBPROC 42 /* Proc sub-structures */
#define M_SEGMENT 43 /* Segment for LFS */
#define M_LFSNODE 44 /* LFS vnode private part */
#define M_FFSNODE 45 /* FFS vnode private part */
#define M_MFSNODE 46 /* MFS vnode private part */
#define M_NQLEASE 47 /* Nqnfs lease */
#define M_NQMHOST 48 /* Nqnfs host address table */
#define M_NETADDR 49 /* Export host address structure */
#define M_NFSSVC 50 /* Nfs server structure */
#define M_NFSUID 51 /* Nfs uid mapping structure */
#define M_NFSD 52 /* Nfs server daemon structure */
#define M_IPMOPTS 53 /* internet multicast options */
#define M_IPMADDR 54 /* internet multicast address */
#define M_IFMADDR 55 /* link-level multicast address */
#define M_MRTABLE 56 /* multicast routing tables */
#define M_ISOFSMNT 57 /* ISOFS mount structure */
#define M_ISOFSNODE 58 /* ISOFS vnode private part */
#define M_MSDOSFSMNT 59 /* MSDOS FS mount structure */
#define M_MSDOSFSFAT 60 /* MSDOS FS fat table */
#define M_MSDOSFSNODE 61 /* MSDOS FS vnode private part */
#define M_TTYS 62 /* allocated tty structures */
#define M_EXEC 63 /* argument lists & other mem used by exec */
#define M_MISCFSMNT 64 /* miscfs mount structures */
#define M_MISCFSNODE 65 /* miscfs vnode private part */
#define M_ADOSFSMNT 66 /* adosfs mount structures */
#define M_ADOSFSNODE 67 /* adosfs vnode private part */
#define M_ANODE 68 /* adosfs anode structures and tables. */
#define M_IPQ 69 /* IP packet queue entry */
#define M_AFS 70 /* Andrew File System */
#define M_ADOSFSBITMAP 71 /* adosfs bitmap */
#define M_EXT2FSNODE 72 /* EXT2FS vnode private part */
#define M_PFIL 73 /* packer filter */
#define M_PFKEY 74 /* pfkey data */
#define M_TDB 75 /* Transforms database */
#define M_XDATA 76 /* IPsec data */
#define M_VFS 77 /* VFS file systems */
 
#define M_PAGEDEP 78 /* File page dependencies */
#define M_INODEDEP 79 /* Inode dependencies */
#define M_NEWBLK 80 /* New block allocation */
#define M_BMSAFEMAP 81 /* Block or frag allocated from cyl group map */
#define M_ALLOCDIRECT 82 /* Block or frag dependency for an inode */
#define M_INDIRDEP 83 /* Indirect block dependencies */
#define M_ALLOCINDIR 84 /* Block dependency for an indirect block */
#define M_FREEFRAG 85 /* Previously used frag for an inode */
#define M_FREEBLKS 86 /* Blocks freed from an inode */
#define M_FREEFILE 87 /* Inode deallocated */
#define M_DIRADD 88 /* New directory entry */
#define M_MKDIR 89 /* New directory */
#define M_DIRREM 90 /* Directory entry deleted */
#define M_VMPBUCKET 91 /* VM page buckets */
#define M_VMSWAP 92 /* VM swap structures */
 
#define M_DISCQ 93 /* IPv6 discq */
#define M_FRAGQ 94 /* IPv6 fragq */
#define M_SECA 95 /* Sec Assoc */
#if 0 /* NRL IPv6 */
#define M_I6IFP 96 /* IPv6 if info */
#endif
 
#define M_RAIDFRAME 97 /* Raidframe data */
 
#define M_UVMAMAP 98 /* UVM amap and realted */
#define M_UVMAOBJ 99 /* UVM aobj and realted */
#define M_POOL 100 /* Pool memory */
 
#define M_USB 101 /* USB general */
#define M_USBDEV 102 /* USB device driver */
#define M_USBHC 103 /* USB host controller */
 
/* KAME IPv6 */
#define M_IP6OPT 123 /* IPv6 options */
#define M_IP6NDP 124 /* IPv6 Neighbour Discovery */
#define M_IP6RR 125 /* IPv6 Router Renumbering Prefix */
#define M_RR_ADDR 126 /* IPv6 Router Renumbering Ifid */
 
#define M_PIPE 104 /* Pipe structures */
 
#define M_MEMDESC 105 /* Memory range */
 
#define M_TEMP 127 /* misc temporary data buffers */
#define M_LAST 128 /* Must be last type + 1 */
 
 
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
"mbuf", /* 1 M_MBUF */ \
"devbuf", /* 2 M_DEVBUF */ \
"socket", /* 3 M_SOCKET */ \
"pcb", /* 4 M_PCB */ \
"routetbl", /* 5 M_RTABLE */ \
"hosttbl", /* 6 M_HTABLE */ \
"fragtbl", /* 7 M_FTABLE */ \
"zombie", /* 8 M_ZOMBIE */ \
"ifaddr", /* 9 M_IFADDR */ \
"soopts", /* 10 M_SOOPTS */ \
"soname", /* 11 M_SONAME */ \
"namei", /* 12 M_NAMEI */ \
"gprof", /* 13 M_GPROF */ \
"ioctlops", /* 14 M_IOCTLOPS */ \
"mapmem", /* 15 M_MAPMEM */ \
"cred", /* 16 M_CRED */ \
"pgrp", /* 17 M_PGRP */ \
"session", /* 18 M_SESSION */ \
"iov", /* 19 M_IOV */ \
"mount", /* 20 M_MOUNT */ \
"fhandle", /* 21 M_FHANDLE */ \
"NFS req", /* 22 M_NFSREQ */ \
"NFS mount", /* 23 M_NFSMNT */ \
"NFS node", /* 24 M_NFSNODE */ \
"vnodes", /* 25 M_VNODE */ \
"namecache", /* 26 M_CACHE */ \
"UFS quota", /* 27 M_DQUOT */ \
"UFS mount", /* 28 M_UFSMNT */ \
"shm", /* 29 M_SHM */ \
"VM map", /* 30 M_VMMAP */ \
"VM mapent", /* 31 M_VMMAPENT */ \
"VM object", /* 32 M_VMOBJ */ \
"VM objhash", /* 33 M_VMOBJHASH */ \
"VM pmap", /* 34 M_VMPMAP */ \
"VM pvmap", /* 35 M_VMPVENT */ \
"VM pager", /* 36 M_VMPAGER */ \
"VM pgdata", /* 37 M_VMPGDATA */ \
"file", /* 38 M_FILE */ \
"file desc", /* 39 M_FILEDESC */ \
"lockf", /* 40 M_LOCKF */ \
"proc", /* 41 M_PROC */ \
"subproc", /* 42 M_SUBPROC */ \
"LFS segment", /* 43 M_SEGMENT */ \
"LFS node", /* 44 M_LFSNODE */ \
"FFS node", /* 45 M_FFSNODE */ \
"MFS node", /* 46 M_MFSNODE */ \
"NQNFS Lease", /* 47 M_NQLEASE */ \
"NQNFS Host", /* 48 M_NQMHOST */ \
"Export Host", /* 49 M_NETADDR */ \
"NFS srvsock", /* 50 M_NFSSVC */ \
"NFS uid", /* 51 M_NFSUID */ \
"NFS daemon", /* 52 M_NFSD */ \
"ip_moptions", /* 53 M_IPMOPTS */ \
"in_multi", /* 54 M_IPMADDR */ \
"ether_multi", /* 55 M_IFMADDR */ \
"mrt", /* 56 M_MRTABLE */ \
"ISOFS mount", /* 57 M_ISOFSMNT */ \
"ISOFS node", /* 58 M_ISOFSNODE */ \
"MSDOSFS mount", /* 59 M_MSDOSFSMNT */ \
"MSDOSFS fat", /* 60 M_MSDOSFSFAT */ \
"MSDOSFS node", /* 61 M_MSDOSFSNODE */ \
"ttys", /* 62 M_TTYS */ \
"exec", /* 63 M_EXEC */ \
"miscfs mount", /* 64 M_MISCFSMNT */ \
"miscfs node", /* 65 M_MISCFSNODE */ \
"adosfs mount", /* 66 M_ADOSFSMNT */ \
"adosfs node", /* 67 M_ADOSFSNODE */ \
"adosfs anode", /* 68 M_ANODE */ \
"IP queue ent", /* 69 M_IPQ */ \
"afs", /* 70 M_AFS */ \
"adosfs bitmap", /* 71 M_ADOSFSBITMAP */ \
"EXT2FS node", /* 72 M_EXT2FSNODE */ \
"pfil", /* 73 M_PFIL */ \
"pfkey data", /* 74 M_PFKEY */ \
"tdb", /* 75 M_TDB */ \
"xform_data", /* 76 M_XDATA */ \
"vfs", /* 77 M_VFS */ \
"pagedep", /* 78 M_PAGEDEP */ \
"inodedep", /* 79 M_INODEDEP */ \
"newblk", /* 80 M_NEWBLK */ \
"bmsafemap", /* 81 M_BMSAFEMAP */ \
"allocdirect", /* 82 M_ALLOCDIRECT */ \
"indirdep", /* 83 M_INDIRDEP */ \
"allocindir", /* 84 M_ALLOCINDIR */ \
"freefrag", /* 85 M_FREEFRAG */ \
"freeblks", /* 86 M_FREEBLKS */ \
"freefile", /* 87 M_FREEFILE */ \
"diradd", /* 88 M_DIRADD */ \
"mkdir", /* 89 M_MKDIR */ \
"dirrem", /* 90 M_DIRREM */ \
"VM page bucket", /* 91 M_VMPBUCKET */ \
"VM swap", /* 92 M_VMSWAP */ \
"IPv6 discq", /* 93 M_DISCQ */ \
"IPv6 fragq", /* 94 M_FRAGQ */ \
"Sec Assoc", /* 95 M_SECA */ \
"IPv6 if info", /* 96 M_I6IFP */ \
"RaidFrame data", /* 97 M_RAIDFRAME */ \
"UVM amap", /* 98 M_UVMAMAP */ \
"UVM aobj", /* 99 M_UVMAOBJ */ \
"pool", /* 100 M_POOL */ \
"USB", /* 101 M_USB */ \
"USB device", /* 102 M_USBDEV */ \
"USB HC", /* 103 M_USBHC */ \
"pipe", /* 104 M_PIPE */ \
"memdesc", /* 105 M_MEMDESC */ \
NULL, \
NULL, NULL, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL, \
NULL, \
"ip6_options", /* 123 M_IP6OPT */ \
"NDP", /* 124 M_IP6NDP */ \
"ip6rr", /* 125 M_IP6RR */ \
"rp_addr", /* 126 M_RR_ADDR */ \
"temp", /* 127 M_TEMP */ \
}
 
#ifndef __ECOS
struct kmemstats {
long ks_inuse; /* # of packets of this type currently in use */
long ks_calls; /* total packets of this type ever allocated */
long ks_memuse; /* total memory held in bytes */
u_short ks_limblocks; /* number of times blocked for hitting limit */
u_short ks_mapblocks; /* number of times blocked for kernel map */
long ks_maxused; /* maximum number ever used */
long ks_limit; /* most that are allowed to exist */
long ks_size; /* sizes of this thing that are allocated */
long ks_spare;
};
 
/*
* Array of descriptors that describe the contents of each page
*/
struct kmemusage {
short ku_indx; /* bucket index */
union {
u_short freecnt;/* for small allocations, free pieces in page */
u_short pagecnt;/* for large allocations, pages alloced */
} ku_un;
};
#define ku_freecnt ku_un.freecnt
#define ku_pagecnt ku_un.pagecnt
 
/*
* Set of buckets for each size of memory block that is retained
*/
struct kmembuckets {
caddr_t kb_next; /* list of free blocks */
caddr_t kb_last; /* last free block */
long kb_calls; /* total calls to allocate this size */
long kb_total; /* total number of blocks allocated */
long kb_totalfree; /* # of free elements in this bucket */
long kb_elmpercl; /* # of elements in this sized allocation */
long kb_highwat; /* high water mark */
long kb_couldfree; /* over high water mark and could free */
};
 
#ifdef _KERNEL
#define MINALLOCSIZE (1 << MINBUCKET)
#define BUCKETINDX(size) \
((size) <= (MINALLOCSIZE * 128) \
? (size) <= (MINALLOCSIZE * 8) \
? (size) <= (MINALLOCSIZE * 2) \
? (size) <= (MINALLOCSIZE * 1) \
? (MINBUCKET + 0) \
: (MINBUCKET + 1) \
: (size) <= (MINALLOCSIZE * 4) \
? (MINBUCKET + 2) \
: (MINBUCKET + 3) \
: (size) <= (MINALLOCSIZE* 32) \
? (size) <= (MINALLOCSIZE * 16) \
? (MINBUCKET + 4) \
: (MINBUCKET + 5) \
: (size) <= (MINALLOCSIZE * 64) \
? (MINBUCKET + 6) \
: (MINBUCKET + 7) \
: (size) <= (MINALLOCSIZE * 2048) \
? (size) <= (MINALLOCSIZE * 512) \
? (size) <= (MINALLOCSIZE * 256) \
? (MINBUCKET + 8) \
: (MINBUCKET + 9) \
: (size) <= (MINALLOCSIZE * 1024) \
? (MINBUCKET + 10) \
: (MINBUCKET + 11) \
: (size) <= (MINALLOCSIZE * 8192) \
? (size) <= (MINALLOCSIZE * 4096) \
? (MINBUCKET + 12) \
: (MINBUCKET + 13) \
: (size) <= (MINALLOCSIZE * 16384) \
? (MINBUCKET + 14) \
: (MINBUCKET + 15))
 
/*
* Turn virtual addresses into kmem map indicies
*/
#define kmemxtob(alloc) (kmembase + (alloc) * NBPG)
#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG)
#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> CLSHIFT])
 
/*
* Macro versions for the usual cases of malloc/free
*/
#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(_LKM)
#define MALLOC(space, cast, size, type, flags) \
(space) = (cast)malloc((u_long)(size), type, flags)
#define FREE(addr, type) free((caddr_t)(addr), type)
 
#else /* do not collect statistics */
#define MALLOC(space, cast, size, type, flags) do { \
register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \
long s = splimp(); \
if (kbp->kb_next == NULL) { \
(space) = (cast)malloc((u_long)(size), type, flags); \
} else { \
(space) = (cast)kbp->kb_next; \
kbp->kb_next = *(caddr_t *)(space); \
} \
splx(s); \
} while (0)
 
#define FREE(addr, type) do { \
register struct kmembuckets *kbp; \
register struct kmemusage *kup = btokup(addr); \
long s = splimp(); \
if (1 << kup->ku_indx > MAXALLOCSAVE) { \
free((caddr_t)(addr), type); \
} else { \
kbp = &bucket[kup->ku_indx]; \
if (kbp->kb_next == NULL) \
kbp->kb_next = (caddr_t)(addr); \
else \
*(caddr_t *)(kbp->kb_last) = (caddr_t)(addr); \
*(caddr_t *)(addr) = NULL; \
kbp->kb_last = (caddr_t)(addr); \
} \
splx(s); \
} while(0)
#endif /* do not collect statistics */
 
extern struct kmemstats kmemstats[];
extern struct kmemusage *kmemusage;
extern char *kmembase;
extern struct kmembuckets bucket[];
 
extern void *malloc __P((unsigned long size, int type, int flags));
extern void free __P((void *addr, int type));
 
#endif /* _KERNEL */
#endif // __ECOS
 
#if defined(__ECOS) && defined(_KERNEL)
extern void *cyg_net_malloc(u_long size, int type, int flags);
extern void cyg_net_free(caddr_t addr, int type);
#define MALLOC(space, cast, size, type, flags) \
(space) = (cast)cyg_net_malloc((u_long)(size), type, flags)
#define malloc(size, type, flags) cyg_net_malloc((u_long)size, type, flags)
#define FREE(addr, type) cyg_net_free((caddr_t)(addr), type)
#define free(addr, type) FREE(addr, type)
#endif
 
#endif /* !_SYS_MALLOC_H_ */
/domain.h
0,0 → 1,105
//==========================================================================
//
// include/sys/domain.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: domain.h,v 1.2 1996/03/03 12:11:38 niklas Exp $ */
/* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */
 
/*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)domain.h 8.1 (Berkeley) 6/2/93
*/
 
#ifndef _SYS_DOMAIN_H_
#define _SYS_DOMAIN_H_
 
/*
* Structure per communications domain.
*/
 
/*
* Forward structure declarations for function prototypes [sic].
*/
struct mbuf;
 
struct domain {
int dom_family; /* AF_xxx */
char *dom_name;
void (*dom_init) /* initialize domain data structures */
__P((void));
int (*dom_externalize) /* externalize access rights */
__P((struct mbuf *));
void (*dom_dispose) /* dispose of internalized rights */
__P((struct mbuf *));
struct protosw *dom_protosw, *dom_protoswNPROTOSW;
struct domain *dom_next;
int (*dom_rtattach) /* initialize routing table */
__P((void **, int));
int dom_rtoffset; /* an arg to rtattach, in bits */
int dom_maxrtkey; /* for routing layer */
};
 
#ifdef _KERNEL
struct domain *domains;
void domaininit __P((void));
#endif
 
#endif // _SYS_DOMAIN_H_
/bsdselect.h
0,0 → 1,58
//==========================================================================
//
// include/sys/select.h
//
// Support for 'select()' system call
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_
 
#include <pkgconf/system.h>
 
#ifdef CYGPKG_IO_FILEIO
 
#include <cyg/io/file.h>
 
void selwakeup __P((struct selinfo *));
 
#else
 
/*
* Used to maintain information about processes that wish to be
* notified when I/O becomes possible.
*/
struct selinfo {
void *unused;
};
 
void selrecord __P((void *selector, struct selinfo *));
void selwakeup __P((struct selinfo *));
 
#endif
 
#endif /* !_SYS_SELECT_H_ */
/ioccom.h
0,0 → 1,106
//==========================================================================
//
// include/sys/ioccom.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: ioccom.h,v 1.2 1996/03/03 12:11:49 niklas Exp $ */
/* $NetBSD: ioccom.h,v 1.4 1994/10/30 21:49:56 cgd Exp $ */
 
/*-
* Copyright (c) 1982, 1986, 1990, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)ioccom.h 8.2 (Berkeley) 3/28/94
*/
 
#ifndef _SYS_IOCCOM_H_
#define _SYS_IOCCOM_H_
 
/*
* Ioctl's have the command encoded in the lower word, and the size of
* any in or out parameters in the upper word. The high 3 bits of the
* upper word are used to encode the in/out status of the parameter.
*/
#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
#define IOCGROUP(x) (((x) >> 8) & 0xff)
 
#ifndef __ECOS
#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */
#endif
/* no parameters */
#define IOC_VOID (unsigned long)0x20000000
/* copy parameters out */
#define IOC_OUT (unsigned long)0x40000000
/* copy parameters in */
#define IOC_IN (unsigned long)0x80000000
/* copy paramters in and out */
#define IOC_INOUT (IOC_IN|IOC_OUT)
/* mask for IN/OUT/VOID */
#define IOC_DIRMASK (unsigned long)0xe0000000
 
#define _IOC(inout,group,num,len) \
(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
 
#endif /* !_SYS_IOCCOM_H_ */
/ioctl.h
0,0 → 1,125
//==========================================================================
//
// include/sys/ioctl.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: ioctl.h,v 1.3 1996/03/03 12:11:50 niklas Exp $ */
/* $NetBSD: ioctl.h,v 1.20 1996/01/30 18:21:47 thorpej Exp $ */
 
/*-
* Copyright (c) 1982, 1986, 1990, 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
*/
 
#ifndef _SYS_IOCTL_H_
#define _SYS_IOCTL_H_
 
#ifndef __ECOS
#include <sys/ttycom.h>
 
/*
* Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ
* and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
* nonwithstanding).
*/
struct ttysize {
unsigned short ts_lines;
unsigned short ts_cols;
unsigned short ts_xxx;
unsigned short ts_yyy;
};
#define TIOCGSIZE TIOCGWINSZ
#define TIOCSSIZE TIOCSWINSZ
#endif
 
#include <sys/ioccom.h>
 
#ifndef __ECOS
#include <sys/dkio.h>
#include <sys/filio.h>
#endif
#include <sys/sockio.h>
 
#ifndef _KERNEL
 
#include <sys/cdefs.h>
 
__BEGIN_DECLS
int ioctl __P((int, unsigned long, ...));
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_SYS_IOCTL_H_ */
 
/*
* Keep outside _SYS_IOCTL_H_
* Compatability with old terminal driver
*
* Source level -> #define USE_OLD_TTY
* Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
*/
#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD)
#include <sys/ioctl_compat.h>
#endif
/protosw.h
0,0 → 1,274
//==========================================================================
//
// include/sys/protosw.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: protosw.h,v 1.3 1996/04/21 22:31:54 deraadt Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
 
/*-
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
*/
 
#ifndef _SYS_PROTOSW_H_
#define _SYS_PROTOSW_H_
 
/*
* Protocol switch table.
*
* Each protocol has a handle initializing one of these structures,
* which is used for protocol-protocol and system-protocol communication.
*
* A protocol is called through the pr_init entry before any other.
* Thereafter it is called every 200ms through the pr_fasttimo entry and
* every 500ms through the pr_slowtimo for timer based actions.
* The system will call the pr_drain entry if it is low on space and
* this should throw away any non-critical data.
*
* Protocols pass data between themselves as chains of mbufs using
* the pr_input and pr_output hooks. Pr_input passes data up (towards
* UNIX) and pr_output passes it down (towards the imps); control
* information passes up and down on pr_ctlinput and pr_ctloutput.
* The protocol is responsible for the space occupied by any the
* arguments to these entries and must dispose it.
*
* The userreq routine interfaces protocols to the system and is
* described below.
*/
 
struct mbuf;
struct sockaddr;
struct socket;
struct domain;
 
struct protosw {
short pr_type; /* socket type used for */
struct domain *pr_domain; /* domain protocol a member of */
short pr_protocol; /* protocol number */
short pr_flags; /* see below */
 
/* protocol-protocol hooks */
void (*pr_input) /* input to protocol (from below) */
__P((struct mbuf *, ...));
int (*pr_output) /* output to protocol (from above) */
__P((struct mbuf *, ...));
void *(*pr_ctlinput) /* control input (from below) */
__P((int, struct sockaddr *, void *));
int (*pr_ctloutput) /* control output (from above) */
__P((int, struct socket *, int, int, struct mbuf **));
 
/* user-protocol hook */
int (*pr_usrreq) /* user request: see list below */
__P((struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *));
 
/* utility hooks */
void (*pr_init) /* initialization hook */
__P((void));
 
void (*pr_fasttimo) /* fast timeout (200ms) */
__P((void));
void (*pr_slowtimo) /* slow timeout (500ms) */
__P((void));
void (*pr_drain) /* flush any excess space possible */
__P((void));
int (*pr_sysctl) /* sysctl for protocol */
__P((int *, u_int, void *, size_t *, void *, size_t));
};
 
#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
#define PR_FASTHZ 5 /* 5 fast timeouts per second */
 
/*
* Values for pr_flags.
* PR_ADDR requires PR_ATOMIC;
* PR_ADDR and PR_CONNREQUIRED are mutually exclusive.
*/
#define PR_ATOMIC 0x01 /* exchange atomic messages only */
#define PR_ADDR 0x02 /* addresses given with messages */
#define PR_CONNREQUIRED 0x04 /* connection required by protocol */
#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */
#define PR_RIGHTS 0x10 /* passes capabilities */
 
/*
* The arguments to usrreq are:
* (*protosw[].pr_usrreq)(up, req, m, nam, opt);
* where up is a (struct socket *), req is one of these requests,
* m is a optional mbuf chain containing a message,
* nam is an optional mbuf chain containing an address,
* and opt is a pointer to a socketopt structure or nil.
* The protocol is responsible for disposal of the mbuf chain m,
* the caller is responsible for any space held by nam and opt.
* A non-zero return from usrreq gives an
* UNIX error number which should be passed to higher level software.
*/
#define PRU_ATTACH 0 /* attach protocol to up */
#define PRU_DETACH 1 /* detach protocol from up */
#define PRU_BIND 2 /* bind socket to address */
#define PRU_LISTEN 3 /* listen for connection */
#define PRU_CONNECT 4 /* establish connection to peer */
#define PRU_ACCEPT 5 /* accept connection from peer */
#define PRU_DISCONNECT 6 /* disconnect from peer */
#define PRU_SHUTDOWN 7 /* won't send any more data */
#define PRU_RCVD 8 /* have taken data; more room now */
#define PRU_SEND 9 /* send this data */
#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */
#define PRU_CONTROL 11 /* control operations on protocol */
#define PRU_SENSE 12 /* return status into m */
#define PRU_RCVOOB 13 /* retrieve out of band data */
#define PRU_SENDOOB 14 /* send out of band data */
#define PRU_SOCKADDR 15 /* fetch socket's address */
#define PRU_PEERADDR 16 /* fetch peer's address */
#define PRU_CONNECT2 17 /* connect two sockets */
/* begin for protocols internal use */
#define PRU_FASTTIMO 18 /* 200ms timeout */
#define PRU_SLOWTIMO 19 /* 500ms timeout */
#define PRU_PROTORCV 20 /* receive from below */
#define PRU_PROTOSEND 21 /* send to below */
 
#define PRU_NREQ 21
 
#ifdef PRUREQUESTS
char *prurequests[] = {
"ATTACH", "DETACH", "BIND", "LISTEN",
"CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN",
"RCVD", "SEND", "ABORT", "CONTROL",
"SENSE", "RCVOOB", "SENDOOB", "SOCKADDR",
"PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO",
"PROTORCV", "PROTOSEND",
};
#endif
 
/*
* The arguments to the ctlinput routine are
* (*protosw[].pr_ctlinput)(cmd, sa, arg);
* where cmd is one of the commands below, sa is a pointer to a sockaddr,
* and arg is an optional caddr_t argument used within a protocol family.
*/
#define PRC_IFDOWN 0 /* interface transition */
#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */
#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */
#define PRC_QUENCH 4 /* some one said to slow down */
#define PRC_MSGSIZE 5 /* message size forced drop */
#define PRC_HOSTDEAD 6 /* host appears to be down */
#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */
#define PRC_UNREACH_NET 8 /* no route to network */
#define PRC_UNREACH_HOST 9 /* no route to host */
#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */
#define PRC_UNREACH_PORT 11 /* bad port # */
/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */
#define PRC_UNREACH_SRCFAIL 13 /* source route failed */
#define PRC_REDIRECT_NET 14 /* net routing redirect */
#define PRC_REDIRECT_HOST 15 /* host routing redirect */
#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */
#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */
#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */
#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */
#define PRC_PARAMPROB 20 /* header incorrect */
 
#define PRC_NCMDS 21
 
#define PRC_IS_REDIRECT(cmd) \
((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST)
 
#ifdef PRCREQUESTS
char *prcrequests[] = {
"IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2",
"QUENCH", "MSGSIZE", "HOSTDEAD", "#7",
"NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH",
"#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT",
"TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS",
"PARAMPROB"
};
#endif
 
/*
* The arguments to ctloutput are:
* (*protosw[].pr_ctloutput)(req, so, level, optname, optval);
* req is one of the actions listed below, so is a (struct socket *),
* level is an indication of which protocol layer the option is intended.
* optname is a protocol dependent socket option request,
* optval is a pointer to a mbuf-chain pointer, for value-return results.
* The protocol is responsible for disposal of the mbuf chain *optval
* if supplied,
* the caller is responsible for any space held by *optval, when returned.
* A non-zero return from usrreq gives an
* UNIX error number which should be passed to higher level software.
*/
#define PRCO_GETOPT 0
#define PRCO_SETOPT 1
 
#define PRCO_NCMDS 2
 
#ifdef PRCOREQUESTS
char *prcorequests[] = {
"GETOPT", "SETOPT",
};
#endif
 
#ifdef _KERNEL
struct sockaddr;
struct protosw *pffindproto __P((int, int, int));
struct protosw *pffindtype __P((int, int));
void pfctlinput __P((int, struct sockaddr *));
#endif
 
#endif // _SYS_PROTOSW_H_
/kernel.h
0,0 → 1,104
//==========================================================================
//
// include/sys/kernel.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: kernel.h,v 1.5 1996/08/11 20:39:07 niklas Exp $ */
/* $NetBSD: kernel.h,v 1.11 1995/03/03 01:24:16 cgd Exp $ */
 
/*-
* Copyright (c) 1990, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
*/
 
/* Global variables for the kernel. */
 
/* 1.1 */
extern long hostid;
extern char hostname[MAXHOSTNAMELEN];
extern int hostnamelen;
extern char domainname[MAXHOSTNAMELEN];
extern int domainnamelen;
 
/* 1.2 */
extern volatile struct timeval mono_time;
extern struct timeval boottime;
extern struct timeval runtime;
extern volatile struct timeval ktime;
#define time ktime
extern struct timezone tz; /* XXX */
 
extern int tick; /* usec per tick (1000000 / hz) */
extern int tickfix; /* periodic tick adj. tick not integral */
extern int tickfixinterval; /* interval at which to apply adjustment */
extern int tickadj; /* "standard" clock skew, us./tick */
extern int hz; /* system clock's frequency */
extern int stathz; /* statistics clock's frequency */
extern int profhz; /* profiling clock's frequency */
extern int lbolt; /* once a second sleep address */
extern int tickdelta;
extern long timedelta;
 
 
/cdefs.h
0,0 → 1,173
//==========================================================================
//
// include/sys/cdefs.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: cdefs.h,v 1.5 1996/09/27 17:34:44 maja Exp $ */
/* $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $ */
 
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
*/
 
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
 
/*
* Gratuitous NetBSD gcc extensions we can do without.
*/
 
#ifdef __KPRINTF_ATTRIBUTE__
#undef __KPRINTF_ATTRIBUTE__
#endif
 
#include <machine/cdefs.h>
 
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS };
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
 
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
* in between its arguments. __CONCAT can also concatenate double-quoted
* strings produced by the __STRING macro, but this only works with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
 
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#if !defined(__GNUC__) && !defined(lint)
#define __inline /* delete GCC keyword */
#endif /* !__GNUC__ && !lint */
#endif /* !__cplusplus */
 
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
 
#if !defined(__GNUC__) && !defined(lint)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
#endif /* !__GNUC__ && !lint */
 
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* Programs using the ANSI C keywords const, inline etc. as normal
* identifiers should define -DNO_ANSI_KEYWORDS.
*/
#ifndef NO_ANSI_KEYWORDS
#define const __const /* convert ANSI C keywords */
#define inline __inline
#define signed __signed
#define volatile __volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !(__STDC__ || __cplusplus) */
 
/*
* GCC1 and some versions of GCC2 declare dead (non-returning) and
* pure (no side effects) functions using "volatile" and "const";
* unfortunately, these then cause warnings under "-ansi -pedantic".
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
* in the distribution version of 2.5.5).
*/
#if !defined(__GNUC__) || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 5)
#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define __dead __volatile
#define __pure __const
#endif
#endif
 
#ifdef __KPRINTF_ATTRIBUTE__
#define __kprintf_attribute__(a) __attribute__(a)
#else
#define __kprintf_attribute__(a)
#endif
 
/* Delete pseudo-keywords wherever they are not available or needed. */
#ifndef __dead
#define __dead
#define __pure
#endif
 
#endif /* !_SYS_CDEFS_H_ */
/queue.h
0,0 → 1,517
//==========================================================================
//
// include/sys/queue.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: queue.h,v 1.14 1999/09/08 08:20:04 espie Exp $ */
/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
 
/*
* Copyright (c) 1991, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
 
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
 
/*
* This file defines five types of data structures: singly-linked lists,
* lists, simple queues, tail queues, and circular queues.
*
*
* A singly-linked list is headed by a single forward pointer. The elements
* are singly linked for minimum space and pointer manipulation overhead at
* the expense of O(n) removal for arbitrary elements. New elements can be
* added to the list after an existing element or at the head of the list.
* Elements being removed from the head of the list should use the explicit
* macro for this purpose for optimum efficiency. A singly-linked list may
* only be traversed in the forward direction. Singly-linked lists are ideal
* for applications with large datasets and few or no removals or for
* implementing a LIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
* A simple queue is headed by a pair of pointers, one the head of the
* list and the other to the tail of the list. The elements are singly
* linked to save space, so elements can only be removed from the
* head of the list. New elements can be added to the list before or after
* an existing element, at the head of the list, or at the end of the
* list. A simple queue may only be traversed in the forward direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* A circle queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or after
* an existing element, at the head of the list, or at the end of the list.
* A circle queue may be traversed in either direction, but has a more
* complex end of list detection.
*
* For details on the use of these macros, see the queue(3) manual page.
*/
 
/*
* Singly-linked List definitions.
*/
#define SLIST_HEAD(name, type) \
struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List access methods.
*/
#define SLIST_FIRST(head) ((head)->slh_first)
#define SLIST_END(head) NULL
#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
 
#define SLIST_FOREACH(var, head, field) \
for((var) = SLIST_FIRST(head); \
(var) != SLIST_END(head); \
(var) = SLIST_NEXT(var, field))
 
/*
* Singly-linked List functions.
*/
#define SLIST_INIT(head) { \
SLIST_FIRST(head) = SLIST_END(head); \
}
 
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
(elm)->field.sle_next = (slistelm)->field.sle_next; \
(slistelm)->field.sle_next = (elm); \
} while (0)
 
#define SLIST_INSERT_HEAD(head, elm, field) do { \
(elm)->field.sle_next = (head)->slh_first; \
(head)->slh_first = (elm); \
} while (0)
 
#define SLIST_REMOVE_HEAD(head, field) do { \
(head)->slh_first = (head)->slh_first->field.sle_next; \
} while (0)
 
/*
* List definitions.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
 
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
 
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
 
/*
* List access methods
*/
#define LIST_FIRST(head) ((head)->lh_first)
#define LIST_END(head) NULL
#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
 
#define LIST_FOREACH(var, head, field) \
for((var) = LIST_FIRST(head); \
(var)!= LIST_END(head); \
(var) = LIST_NEXT(var, field))
 
/*
* List functions.
*/
#define LIST_INIT(head) do { \
LIST_FIRST(head) = LIST_END(head); \
} while (0)
 
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
} while (0)
 
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
} while (0)
 
#define LIST_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (0)
 
#define LIST_REMOVE(elm, field) do { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
} while (0)
 
#define LIST_REPLACE(elm, elm2, field) do { \
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
(elm2)->field.le_next->field.le_prev = \
&(elm2)->field.le_next; \
(elm2)->field.le_prev = (elm)->field.le_prev; \
*(elm2)->field.le_prev = (elm2); \
} while (0)
 
/*
* Simple queue definitions.
*/
#define SIMPLEQ_HEAD(name, type) \
struct name { \
struct type *sqh_first; /* first element */ \
struct type **sqh_last; /* addr of last next element */ \
}
 
#define SIMPLEQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).sqh_first }
 
#define SIMPLEQ_ENTRY(type) \
struct { \
struct type *sqe_next; /* next element */ \
}
 
/*
* Simple queue access methods.
*/
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
#define SIMPLEQ_END(head) NULL
#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
 
#define SIMPLEQ_FOREACH(var, head, field) \
for((var) = SIMPLEQ_FIRST(head); \
(var) != SIMPLEQ_END(head); \
(var) = SIMPLEQ_NEXT(var, field))
 
/*
* Simple queue functions.
*/
#define SIMPLEQ_INIT(head) do { \
(head)->sqh_first = NULL; \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)
 
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
(head)->sqh_first = (elm); \
} while (0)
 
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.sqe_next = NULL; \
*(head)->sqh_last = (elm); \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)
 
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
(head)->sqh_last = &(elm)->field.sqe_next; \
(listelm)->field.sqe_next = (elm); \
} while (0)
 
#define SIMPLEQ_REMOVE_HEAD(head, elm, field) do { \
if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)
 
/*
* Tail queue definitions.
*/
#define TAILQ_HEAD(name, type) \
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}
 
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
 
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}
 
/*
* tail queue access methods
*/
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_END(head) NULL
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
/* XXX */
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_EMPTY(head) \
(TAILQ_FIRST(head) == TAILQ_END(head))
 
#define TAILQ_FOREACH(var, head, field) \
for((var) = TAILQ_FIRST(head); \
(var) != TAILQ_END(head); \
(var) = TAILQ_NEXT(var, field))
 
/*
* Tail queue functions.
*/
#define TAILQ_INIT(head) do { \
(head)->tqh_first = NULL; \
(head)->tqh_last = &(head)->tqh_first; \
} while (0)
 
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
} while (0)
 
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
} while (0)
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
} while (0)
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
} while (0)
 
#define TAILQ_REMOVE(head, elm, field) do { \
if (((elm)->field.tqe_next) != NULL) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
} while (0)
 
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
(elm2)->field.tqe_next->field.tqe_prev = \
&(elm2)->field.le_next; \
else \
(head).tqh_last = &(elm2)->field.tqe_next; \
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
*(elm2)->field.tqe_prev = (elm2); \
} while (0)
 
/*
* Circular queue definitions.
*/
#define CIRCLEQ_HEAD(name, type) \
struct name { \
struct type *cqh_first; /* first element */ \
struct type *cqh_last; /* last element */ \
}
 
#define CIRCLEQ_HEAD_INITIALIZER(head) \
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
 
#define CIRCLEQ_ENTRY(type) \
struct { \
struct type *cqe_next; /* next element */ \
struct type *cqe_prev; /* previous element */ \
}
 
/*
* Circular queue access methods
*/
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
#define CIRCLEQ_END(head) ((void *)(head))
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
#define CIRCLEQ_EMPTY(head) \
(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
 
#define CIRCLEQ_FOREACH(var, head, field) \
for((var) = CIRCLEQ_FIRST(head); \
(var) != CIRCLEQ_END(head); \
(var) = CIRCLEQ_NEXT(var, field))
 
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
for((var) = CIRCLEQ_LAST(head); \
(var) != CIRCLEQ_END(head); \
(var) = CIRCLEQ_PREV(var, field))
 
/*
* Circular queue functions.
*/
#define CIRCLEQ_INIT(head) do { \
(head)->cqh_first = CIRCLEQ_END(head); \
(head)->cqh_last = CIRCLEQ_END(head); \
} while (0)
 
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
(elm)->field.cqe_prev = (listelm); \
if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
(head)->cqh_last = (elm); \
else \
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
(listelm)->field.cqe_next = (elm); \
} while (0)
 
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
(elm)->field.cqe_next = (listelm); \
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
(head)->cqh_first = (elm); \
else \
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
(listelm)->field.cqe_prev = (elm); \
} while (0)
 
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
(elm)->field.cqe_next = (head)->cqh_first; \
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
if ((head)->cqh_last == CIRCLEQ_END(head)) \
(head)->cqh_last = (elm); \
else \
(head)->cqh_first->field.cqe_prev = (elm); \
(head)->cqh_first = (elm); \
} while (0)
 
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.cqe_next = CIRCLEQ_END(head); \
(elm)->field.cqe_prev = (head)->cqh_last; \
if ((head)->cqh_first == CIRCLEQ_END(head)) \
(head)->cqh_first = (elm); \
else \
(head)->cqh_last->field.cqe_next = (elm); \
(head)->cqh_last = (elm); \
} while (0)
 
#define CIRCLEQ_REMOVE(head, elm, field) do { \
if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
(head)->cqh_last = (elm)->field.cqe_prev; \
else \
(elm)->field.cqe_next->field.cqe_prev = \
(elm)->field.cqe_prev; \
if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
(head)->cqh_first = (elm)->field.cqe_next; \
else \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
} while (0)
 
#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
CIRCLEQ_END(head)) \
(head).cqh_last = (elm2); \
else \
(elm2)->field.cqe_next->field.cqe_prev = (elm2); \
if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
CIRCLEQ_END(head)) \
(head).cqh_first = (elm2); \
else \
(elm2)->field.cqe_prev->field.cqe_next = (elm2); \
} while (0)
 
#endif /* !_SYS_QUEUE_H_ */
/errno.h
0,0 → 1,33
//==========================================================================
//
// include/sys/errno.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
// Just another name for the standard file
#include <errno.h>
/sockio.h
0,0 → 1,169
//==========================================================================
//
// include/sys/sockio.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: sockio.h,v 1.10 1999/12/08 06:50:24 itojun Exp $ */
/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */
 
/*-
* Copyright (c) 1982, 1986, 1990, 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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.
*
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
*/
 
#ifndef _SYS_SOCKIO_H_
#define _SYS_SOCKIO_H_
 
#include <sys/ioccom.h>
 
/* Socket ioctl's. */
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
 
#ifdef __ECOS
#define SIOCADDRT _IOW('r', 10, struct ecos_rtentry) /* add route */
#define SIOCDELRT _IOW('r', 11, struct ecos_rtentry) /* delete route */
#else
#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
#endif
 
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */
#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
#define SIOCGIFHWADDR _IOWR('i', 15, struct ifreq) /* get MAC address */
#ifdef __ECOS
#define SIOCSIFHWADDR _IOW('i',101, struct ifreq) /* set MAC address */
/* NB these two take a struct ifreq followed by the useful data */
#define SIOCGIFSTATSUD _IOWR('i',102, struct ifreq) /* get uptodate if stats */
#define SIOCGIFSTATS _IOWR('i',103, struct ifreq) /* get interface stats */
#endif
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */
#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */
#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */
#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */
#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
#define SIOCGIFDATA _IOWR('i', 27, struct ifreq) /* get if_data */
 
/* KAME IPv6 */
/* SIOCAIFALIAS? */
#define SIOCALIFADDR _IOW('i', 28, struct if_laddrreq) /* add IF addr */
#define SIOCGLIFADDR _IOWR('i', 29, struct if_laddrreq) /* get IF addr */
#define SIOCDLIFADDR _IOW('i', 30, struct if_laddrreq) /* delete IF addr */
 
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
#define SIOCGETVIFCNT _IOWR('u', 51, struct sioc_vif_req)/* vif pkt cnt */
#define SIOCGETSGCNT _IOWR('u', 52, struct sioc_sg_req) /* sg pkt cnt */
 
#define SIOCSIFMEDIA _IOWR('i', 53, struct ifreq) /* set net media */
#define SIOCGIFMEDIA _IOWR('i', 54, struct ifmediareq) /* get net media */
 
#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */
#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */
#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */
 
#define SIOCBRDGADD _IOWR('i', 60, struct ifbreq) /* add bridge ifs */
#define SIOCBRDGDEL _IOWR('i', 61, struct ifbreq) /* del bridge ifs */
#define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */
#define SIOCBRDGSIFFLGS _IOWR('i', 63, struct ifbreq) /* set brdg if flags */
#define SIOCBRDGSCACHE _IOWR('i', 64, struct ifbcachereq) /* set cache size */
#define SIOCBRDGGCACHE _IOWR('i', 65, struct ifbcachereq) /* get cache size */
#define SIOCBRDGIFS _IOWR('i', 66, struct ifbreq) /* get member ifs */
#define SIOCBRDGRTS _IOWR('i', 67, struct ifbaconf) /* get addresses */
#define SIOCBRDGSADDR _IOWR('i', 68, struct ifbareq) /* set addr flags */
#define SIOCBRDGSTO _IOWR('i', 69, struct ifbcachetoreq) /* cache timeout */
#define SIOCBRDGGTO _IOWR('i', 70, struct ifbcachetoreq) /* cache timeout */
#define SIOCBRDGDADDR _IOWR('i', 71, struct ifbareq) /* delete addr */
#define SIOCBRDGFLUSH _IOWR('i', 72, struct ifbreq) /* flush addr cache */
 
#define SIOCBRDGARL _IOWR('i', 77, struct ifbrlreq) /* add bridge rule */
#define SIOCBRDGFRL _IOWR('i', 78, struct ifbrlreq) /* flush brdg rules */
#define SIOCBRDGGRL _IOWR('i', 79, struct ifbrlconf)/* get bridge rules */
 
#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet mtu */
#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get ifnet mtu */
#define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */
#define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */
 
#ifdef __ECOS
#define FIONBIO _IOW('s', 80, int) /* set non-blocking I/O */
#define FIOASYNC _IOW('s', 81, int) /* set async I/O */
#define FIONREAD _IOR('s', 82, int) /* get number of avail chars */
#endif
 
#endif /* !_SYS_SOCKIO_H_ */
/syscallargs.h
0,0 → 1,1414
//==========================================================================
//
// include/sys/syscallargs.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: syscallargs.h,v 1.41 1999/08/08 00:32:22 niklas Exp $ */
 
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.37 1999/06/07 07:17:42 deraadt Exp
*/
 
#ifndef _SYS_SYSCALLARGS_H_
#define _SYS_SYSCALLARGS_H_
 
#define syscallarg(x) union { x datum; register_t pad; }
 
#ifdef __ECOS
#define SYSCALLARG(a,t) a.t.datum
#endif
 
#ifndef __ECOS
struct sys_exit_args {
syscallarg(int) rval;
};
#endif
 
struct sys_read_args {
syscallarg(int) fd;
syscallarg(void *) buf;
syscallarg(size_t) nbyte;
};
extern int sys_read(struct sys_read_args *, register_t *);
 
struct sys_write_args {
syscallarg(int) fd;
syscallarg(const void *) buf;
syscallarg(size_t) nbyte;
};
extern int sys_write(struct sys_write_args *, register_t *);
 
struct sys_open_args {
syscallarg(const char *) path;
syscallarg(int) flags;
syscallarg(int) mode;
};
 
struct sys_close_args {
syscallarg(int) fd;
};
 
#ifndef __ECOS
struct sys_wait4_args {
syscallarg(int) pid;
syscallarg(int *) status;
syscallarg(int) options;
syscallarg(struct rusage *) rusage;
};
 
struct compat_43_sys_creat_args {
syscallarg(const char *) path;
syscallarg(int) mode;
};
 
struct sys_link_args {
syscallarg(const char *) path;
syscallarg(const char *) link;
};
 
struct sys_unlink_args {
syscallarg(const char *) path;
};
 
struct sys_chdir_args {
syscallarg(const char *) path;
};
 
struct sys_fchdir_args {
syscallarg(int) fd;
};
 
struct sys_mknod_args {
syscallarg(const char *) path;
syscallarg(int) mode;
syscallarg(dev_t) dev;
};
 
struct sys_chmod_args {
syscallarg(const char *) path;
syscallarg(int) mode;
};
 
struct sys_chown_args {
syscallarg(const char *) path;
syscallarg(uid_t) uid;
syscallarg(gid_t) gid;
};
 
struct sys_obreak_args {
syscallarg(char *) nsize;
};
 
struct sys_ogetfsstat_args {
syscallarg(struct statfs *) buf;
syscallarg(long) bufsize;
syscallarg(int) flags;
};
 
struct compat_43_sys_lseek_args {
syscallarg(int) fd;
syscallarg(long) offset;
syscallarg(int) whence;
};
 
struct sys_mount_args {
syscallarg(const char *) type;
syscallarg(const char *) path;
syscallarg(int) flags;
syscallarg(void *) data;
};
 
struct sys_unmount_args {
syscallarg(const char *) path;
syscallarg(int) flags;
};
 
struct sys_setuid_args {
syscallarg(uid_t) uid;
};
 
struct sys_ptrace_args {
syscallarg(int) req;
syscallarg(pid_t) pid;
syscallarg(caddr_t) addr;
syscallarg(int) data;
};
 
struct sys_recvmsg_args {
syscallarg(int) s;
syscallarg(struct msghdr *) msg;
syscallarg(int) flags;
};
 
struct sys_sendmsg_args {
syscallarg(int) s;
syscallarg(const struct msghdr *) msg;
syscallarg(int) flags;
};
#endif
 
struct sys_recvfrom_args {
syscallarg(int) s;
syscallarg(void *) buf;
syscallarg(size_t) len;
syscallarg(int) flags;
syscallarg(struct sockaddr *) from;
syscallarg(socklen_t *) fromlenaddr;
};
extern int sys_recvfrom(struct sys_recvfrom_args *, register_t *);
 
struct sys_accept_args {
syscallarg(int) s;
syscallarg(struct sockaddr *) name;
syscallarg(socklen_t *) anamelen;
};
extern int sys_accept(struct sys_accept_args *, register_t *);
 
struct sys_getpeername_args {
syscallarg(int) fdes;
syscallarg(struct sockaddr *) asa;
syscallarg(int *) alen;
};
extern int sys_getpeername(struct sys_getpeername_args *, register_t *);
 
struct sys_getsockname_args {
syscallarg(int) fdes;
syscallarg(struct sockaddr *) asa;
syscallarg(socklen_t *) alen;
};
extern int sys_getsockname(struct sys_getsockname_args *, register_t *);
 
struct sys_access_args {
syscallarg(const char *) path;
syscallarg(int) flags;
};
 
#ifndef __ECOS
struct sys_chflags_args {
syscallarg(const char *) path;
syscallarg(u_int) flags;
};
 
struct sys_fchflags_args {
syscallarg(int) fd;
syscallarg(u_int) flags;
};
 
struct sys_kill_args {
syscallarg(int) pid;
syscallarg(int) signum;
};
 
struct compat_43_sys_stat_args {
syscallarg(const char *) path;
syscallarg(struct ostat *) ub;
};
 
struct compat_43_sys_lstat_args {
syscallarg(char *) path;
syscallarg(struct ostat *) ub;
};
 
struct sys_dup_args {
syscallarg(int) fd;
};
 
struct sys_profil_args {
syscallarg(caddr_t) samples;
syscallarg(size_t) size;
syscallarg(u_long) offset;
syscallarg(u_int) scale;
};
 
struct sys_ktrace_args {
syscallarg(const char *) fname;
syscallarg(int) ops;
syscallarg(int) facs;
syscallarg(pid_t) pid;
};
 
struct sys_sigaction_args {
syscallarg(int) signum;
syscallarg(const struct sigaction *) nsa;
syscallarg(struct sigaction *) osa;
};
 
struct sys_sigprocmask_args {
syscallarg(int) how;
syscallarg(sigset_t) mask;
};
 
struct sys_getlogin_args {
syscallarg(char *) namebuf;
syscallarg(u_int) namelen;
};
 
struct sys_setlogin_args {
syscallarg(const char *) namebuf;
};
 
struct sys_acct_args {
syscallarg(const char *) path;
};
 
struct sys_sigaltstack_args {
syscallarg(const struct sigaltstack *) nss;
syscallarg(struct sigaltstack *) oss;
};
#endif
 
struct sys_ioctl_args {
syscallarg(int) fd;
syscallarg(u_long) com;
syscallarg(void *) data;
};
extern int sys_ioctl(struct sys_ioctl_args *, register_t *);
 
#ifndef __ECOS
struct sys_reboot_args {
syscallarg(int) opt;
};
 
struct sys_revoke_args {
syscallarg(const char *) path;
};
 
struct sys_symlink_args {
syscallarg(const char *) path;
syscallarg(const char *) link;
};
 
struct sys_readlink_args {
syscallarg(const char *) path;
syscallarg(char *) buf;
syscallarg(size_t) count;
};
 
struct sys_execve_args {
syscallarg(const char *) path;
syscallarg(char *const *) argp;
syscallarg(char *const *) envp;
};
 
struct sys_umask_args {
syscallarg(int) newmask;
};
 
struct sys_chroot_args {
syscallarg(const char *) path;
};
 
struct compat_43_sys_fstat_args {
syscallarg(int) fd;
syscallarg(struct ostat *) sb;
};
 
struct compat_43_sys_getkerninfo_args {
syscallarg(int) op;
syscallarg(char *) where;
syscallarg(int *) size;
syscallarg(int) arg;
};
 
struct sys_omsync_args {
syscallarg(caddr_t) addr;
syscallarg(size_t) len;
};
 
struct sys_sbrk_args {
syscallarg(int) incr;
};
 
struct sys_sstk_args {
syscallarg(int) incr;
};
 
struct compat_43_sys_mmap_args {
syscallarg(caddr_t) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(long) pos;
};
 
struct sys_ovadvise_args {
syscallarg(int) anom;
};
 
struct sys_munmap_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
};
 
struct sys_mprotect_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
};
 
struct sys_madvise_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) behav;
};
 
struct sys_mincore_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(char *) vec;
};
 
struct sys_getgroups_args {
syscallarg(int) gidsetsize;
syscallarg(gid_t *) gidset;
};
 
struct sys_setgroups_args {
syscallarg(int) gidsetsize;
syscallarg(const gid_t *) gidset;
};
 
struct sys_setpgid_args {
syscallarg(pid_t) pid;
syscallarg(int) pgid;
};
 
struct sys_setitimer_args {
syscallarg(int) which;
syscallarg(const struct itimerval *) itv;
syscallarg(struct itimerval *) oitv;
};
 
struct sys_swapon_args {
syscallarg(const char *) name;
};
 
struct sys_getitimer_args {
syscallarg(int) which;
syscallarg(struct itimerval *) itv;
};
 
struct compat_43_sys_gethostname_args {
syscallarg(char *) hostname;
syscallarg(u_int) len;
};
 
struct compat_43_sys_sethostname_args {
syscallarg(char *) hostname;
syscallarg(u_int) len;
};
 
struct sys_dup2_args {
syscallarg(int) from;
syscallarg(int) to;
};
 
struct sys_fcntl_args {
syscallarg(int) fd;
syscallarg(int) cmd;
syscallarg(void *) arg;
};
#endif
 
struct sys_select_args {
syscallarg(int) nd;
syscallarg(fd_set *) in;
syscallarg(fd_set *) ou;
syscallarg(fd_set *) ex;
syscallarg(struct timeval *) tv;
};
extern int sys_select(struct sys_select_args *, register_t *);
 
#ifndef __ECOS
struct sys_fsync_args {
syscallarg(int) fd;
};
 
struct sys_setpriority_args {
syscallarg(int) which;
syscallarg(int) who;
syscallarg(int) prio;
};
#endif
 
struct sys_socket_args {
syscallarg(int) domain;
syscallarg(int) type;
syscallarg(int) protocol;
};
extern int sys_socket(struct sys_socket_args *, register_t *);
 
struct sys_connect_args {
syscallarg(int) s;
syscallarg(const struct sockaddr *) name;
syscallarg(socklen_t) namelen;
};
extern int sys_connect(struct sys_connect_args *, register_t *);
 
#ifndef __ECOS
struct compat_43_sys_accept_args {
syscallarg(int) s;
syscallarg(caddr_t) name;
syscallarg(int *) anamelen;
};
 
struct sys_getpriority_args {
syscallarg(int) which;
syscallarg(int) who;
};
 
struct compat_43_sys_send_args {
syscallarg(int) s;
syscallarg(caddr_t) buf;
syscallarg(int) len;
syscallarg(int) flags;
};
 
struct compat_43_sys_recv_args {
syscallarg(int) s;
syscallarg(caddr_t) buf;
syscallarg(int) len;
syscallarg(int) flags;
};
 
struct sys_sigreturn_args {
syscallarg(struct sigcontext *) sigcntxp;
};
#endif
 
struct sys_bind_args {
syscallarg(int) s;
syscallarg(const struct sockaddr *) name;
syscallarg(socklen_t) namelen;
};
extern int sys_bind(struct sys_bind_args *, register_t *);
 
struct sys_setsockopt_args {
syscallarg(int) s;
syscallarg(int) level;
syscallarg(int) name;
syscallarg(const void *) val;
syscallarg(socklen_t) valsize;
};
extern int sys_setsockopt(struct sys_setsockopt_args *, register_t *);
 
struct sys_listen_args {
syscallarg(int) s;
syscallarg(int) backlog;
};
extern int sys_listen(struct sys_listen_args *, register_t *);
 
#ifndef __ECOS
struct compat_43_sys_sigvec_args {
syscallarg(int) signum;
syscallarg(struct sigvec *) nsv;
syscallarg(struct sigvec *) osv;
};
 
struct compat_43_sys_sigblock_args {
syscallarg(int) mask;
};
 
struct compat_43_sys_sigsetmask_args {
syscallarg(int) mask;
};
 
struct sys_sigsuspend_args {
syscallarg(int) mask;
};
 
struct compat_43_sys_sigstack_args {
syscallarg(struct sigstack *) nss;
syscallarg(struct sigstack *) oss;
};
 
struct compat_43_sys_recvmsg_args {
syscallarg(int) s;
syscallarg(struct omsghdr *) msg;
syscallarg(int) flags;
};
 
struct compat_43_sys_sendmsg_args {
syscallarg(int) s;
syscallarg(caddr_t) msg;
syscallarg(int) flags;
};
 
struct sys_vtrace_args {
syscallarg(int) request;
syscallarg(int) value;
};
 
struct sys_gettimeofday_args {
syscallarg(struct timeval *) tp;
syscallarg(struct timezone *) tzp;
};
 
struct sys_getrusage_args {
syscallarg(int) who;
syscallarg(struct rusage *) rusage;
};
#endif
 
struct sys_getsockopt_args {
syscallarg(int) s;
syscallarg(int) level;
syscallarg(int) name;
syscallarg(void *) val;
syscallarg(socklen_t *) avalsize;
};
extern int sys_getsockopt(struct sys_getsockopt_args *, register_t *);
 
struct sys_readv_args {
syscallarg(int) fd;
syscallarg(const struct iovec *) iovp;
syscallarg(int) iovcnt;
};
 
struct sys_writev_args {
syscallarg(int) fd;
syscallarg(const struct iovec *) iovp;
syscallarg(int) iovcnt;
};
 
#ifndef __ECOS
struct sys_settimeofday_args {
syscallarg(const struct timeval *) tv;
syscallarg(const struct timezone *) tzp;
};
 
struct sys_fchown_args {
syscallarg(int) fd;
syscallarg(uid_t) uid;
syscallarg(gid_t) gid;
};
 
struct sys_fchmod_args {
syscallarg(int) fd;
syscallarg(int) mode;
};
 
struct compat_43_sys_recvfrom_args {
syscallarg(int) s;
syscallarg(caddr_t) buf;
syscallarg(size_t) len;
syscallarg(int) flags;
syscallarg(caddr_t) from;
syscallarg(int *) fromlenaddr;
};
 
struct compat_43_sys_setreuid_args {
syscallarg(int) ruid;
syscallarg(int) euid;
};
 
struct compat_43_sys_setregid_args {
syscallarg(int) rgid;
syscallarg(int) egid;
};
 
struct sys_rename_args {
syscallarg(const char *) from;
syscallarg(const char *) to;
};
 
struct compat_43_sys_truncate_args {
syscallarg(const char *) path;
syscallarg(long) length;
};
 
struct compat_43_sys_ftruncate_args {
syscallarg(int) fd;
syscallarg(long) length;
};
 
struct sys_flock_args {
syscallarg(int) fd;
syscallarg(int) how;
};
 
struct sys_mkfifo_args {
syscallarg(const char *) path;
syscallarg(int) mode;
};
#endif
 
struct sys_sendto_args {
syscallarg(int) s;
syscallarg(const void *) buf;
syscallarg(size_t) len;
syscallarg(int) flags;
syscallarg(const struct sockaddr *) to;
syscallarg(socklen_t) tolen;
};
extern int sys_sendto(struct sys_sendto_args *, register_t *);
 
struct sys_shutdown_args {
syscallarg(int) s;
syscallarg(int) how;
};
extern int sys_shutdown(struct sys_shutdown_args *, register_t *);
 
struct sys_socketpair_args {
syscallarg(int) domain;
syscallarg(int) type;
syscallarg(int) protocol;
syscallarg(int *) rsv;
};
 
#ifndef __ECOS
struct sys_mkdir_args {
syscallarg(const char *) path;
syscallarg(int) mode;
};
 
struct sys_rmdir_args {
syscallarg(const char *) path;
};
 
struct sys_utimes_args {
syscallarg(const char *) path;
syscallarg(const struct timeval *) tptr;
};
 
struct sys_adjtime_args {
syscallarg(const struct timeval *) delta;
syscallarg(struct timeval *) olddelta;
};
 
struct compat_43_sys_getpeername_args {
syscallarg(int) fdes;
syscallarg(caddr_t) asa;
syscallarg(socklen_t *) alen;
};
 
struct compat_43_sys_sethostid_args {
syscallarg(int32_t) hostid;
};
 
struct compat_43_sys_getrlimit_args {
syscallarg(int) which;
syscallarg(struct ogetrlimit *) rlp;
};
 
struct compat_43_sys_setrlimit_args {
syscallarg(int) which;
syscallarg(struct ogetrlimit *) rlp;
};
 
struct compat_43_sys_killpg_args {
syscallarg(int) pgid;
syscallarg(int) signum;
};
 
struct sys_quotactl_args {
syscallarg(const char *) path;
syscallarg(int) cmd;
syscallarg(int) uid;
syscallarg(char *) arg;
};
 
struct compat_43_sys_getsockname_args {
syscallarg(int) fdec;
syscallarg(caddr_t) asa;
syscallarg(int *) alen;
};
 
struct sys_nfssvc_args {
syscallarg(int) flag;
syscallarg(void *) argp;
};
 
struct compat_43_sys_getdirentries_args {
syscallarg(int) fd;
syscallarg(char *) buf;
syscallarg(int) count;
syscallarg(long *) basep;
};
 
struct sys_ostatfs_args {
syscallarg(const char *) path;
syscallarg(struct ostatfs *) buf;
};
 
struct sys_ofstatfs_args {
syscallarg(int) fd;
syscallarg(struct ostatfs *) buf;
};
 
struct sys_getfh_args {
syscallarg(const char *) fname;
syscallarg(fhandle_t *) fhp;
};
 
struct compat_09_sys_getdomainname_args {
syscallarg(char *) domainname;
syscallarg(int) len;
};
 
struct compat_09_sys_setdomainname_args {
syscallarg(char *) domainname;
syscallarg(int) len;
};
 
struct compat_09_sys_uname_args {
syscallarg(struct outsname *) name;
};
 
struct sys_sysarch_args {
syscallarg(int) op;
syscallarg(char *) parms;
};
 
struct compat_10_sys_semsys_args {
syscallarg(int) which;
syscallarg(int) a2;
syscallarg(int) a3;
syscallarg(int) a4;
syscallarg(int) a5;
};
 
struct compat_10_sys_msgsys_args {
syscallarg(int) which;
syscallarg(int) a2;
syscallarg(int) a3;
syscallarg(int) a4;
syscallarg(int) a5;
syscallarg(int) a6;
};
 
struct compat_10_sys_shmsys_args {
syscallarg(int) which;
syscallarg(int) a2;
syscallarg(int) a3;
syscallarg(int) a4;
};
 
struct sys_ntp_gettime_args {
syscallarg(struct ntptimeval *) ntvp;
};
 
struct sys_ntp_adjtime_args {
syscallarg(struct timex *) tp;
};
 
struct sys_setgid_args {
syscallarg(gid_t) gid;
};
 
struct sys_setegid_args {
syscallarg(gid_t) egid;
};
 
struct sys_seteuid_args {
syscallarg(uid_t) euid;
};
 
struct lfs_bmapv_args {
syscallarg(fsid_t *) fsidp;
syscallarg(struct block_info *) blkiov;
syscallarg(int) blkcnt;
};
 
struct lfs_markv_args {
syscallarg(fsid_t *) fsidp;
syscallarg(struct block_info *) blkiov;
syscallarg(int) blkcnt;
};
 
struct lfs_segclean_args {
syscallarg(fsid_t *) fsidp;
syscallarg(u_long) segment;
};
 
struct lfs_segwait_args {
syscallarg(fsid_t *) fsidp;
syscallarg(struct timeval *) tv;
};
 
struct sys_stat_args {
syscallarg(const char *) path;
syscallarg(struct stat *) ub;
};
 
struct sys_fstat_args {
syscallarg(int) fd;
syscallarg(struct stat *) sb;
};
 
struct sys_lstat_args {
syscallarg(const char *) path;
syscallarg(struct stat *) ub;
};
 
struct sys_pathconf_args {
syscallarg(const char *) path;
syscallarg(int) name;
};
 
struct sys_fpathconf_args {
syscallarg(int) fd;
syscallarg(int) name;
};
 
struct sys_swapctl_args {
syscallarg(int) cmd;
syscallarg(const void *) arg;
syscallarg(int) misc;
};
 
struct sys_getrlimit_args {
syscallarg(int) which;
syscallarg(struct rlimit *) rlp;
};
 
struct sys_setrlimit_args {
syscallarg(int) which;
syscallarg(const struct rlimit *) rlp;
};
 
struct sys_getdirentries_args {
syscallarg(int) fd;
syscallarg(char *) buf;
syscallarg(int) count;
syscallarg(long *) basep;
};
 
struct sys_mmap_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(long) pad;
syscallarg(off_t) pos;
};
 
struct sys_lseek_args {
syscallarg(int) fd;
syscallarg(int) pad;
syscallarg(off_t) offset;
syscallarg(int) whence;
};
 
struct sys_truncate_args {
syscallarg(const char *) path;
syscallarg(int) pad;
syscallarg(off_t) length;
};
 
struct sys_ftruncate_args {
syscallarg(int) fd;
syscallarg(int) pad;
syscallarg(off_t) length;
};
 
struct sys___sysctl_args {
syscallarg(int *) name;
syscallarg(u_int) namelen;
syscallarg(void *) old;
syscallarg(size_t *) oldlenp;
syscallarg(void *) new;
syscallarg(size_t) newlen;
};
 
struct sys_mlock_args {
syscallarg(const void *) addr;
syscallarg(size_t) len;
};
 
struct sys_munlock_args {
syscallarg(const void *) addr;
syscallarg(size_t) len;
};
 
struct sys_undelete_args {
syscallarg(const char *) path;
};
 
struct sys_futimes_args {
syscallarg(int) fd;
syscallarg(const struct timeval *) tptr;
};
 
struct sys_getpgid_args {
syscallarg(pid_t) pid;
};
 
struct sys_xfspioctl_args {
syscallarg(int) operation;
syscallarg(char *) a_pathP;
syscallarg(int) a_opcode;
syscallarg(struct ViceIoctl *) a_paramsP;
syscallarg(int) a_followSymlinks;
};
 
struct sys___osemctl_args {
syscallarg(int) semid;
syscallarg(int) semnum;
syscallarg(int) cmd;
syscallarg(union semun *) arg;
};
 
struct sys_semget_args {
syscallarg(key_t) key;
syscallarg(int) nsems;
syscallarg(int) semflg;
};
 
struct sys_semop_args {
syscallarg(int) semid;
syscallarg(struct sembuf *) sops;
syscallarg(u_int) nsops;
};
 
struct sys_semconfig_args {
syscallarg(int) flag;
};
 
struct sys_omsgctl_args {
syscallarg(int) msqid;
syscallarg(int) cmd;
syscallarg(struct omsqid_ds *) buf;
};
 
struct sys_msgget_args {
syscallarg(key_t) key;
syscallarg(int) msgflg;
};
 
struct sys_msgsnd_args {
syscallarg(int) msqid;
syscallarg(const void *) msgp;
syscallarg(size_t) msgsz;
syscallarg(int) msgflg;
};
 
struct sys_msgrcv_args {
syscallarg(int) msqid;
syscallarg(void *) msgp;
syscallarg(size_t) msgsz;
syscallarg(long) msgtyp;
syscallarg(int) msgflg;
};
 
struct sys_shmat_args {
syscallarg(int) shmid;
syscallarg(const void *) shmaddr;
syscallarg(int) shmflg;
};
 
struct sys_oshmctl_args {
syscallarg(int) shmid;
syscallarg(int) cmd;
syscallarg(struct oshmid_ds *) buf;
};
 
struct sys_shmdt_args {
syscallarg(const void *) shmaddr;
};
 
struct sys_shmget_args {
syscallarg(key_t) key;
syscallarg(int) size;
syscallarg(int) shmflg;
};
 
struct sys_clock_gettime_args {
syscallarg(clockid_t) clock_id;
syscallarg(struct timespec *) tp;
};
 
struct sys_clock_settime_args {
syscallarg(clockid_t) clock_id;
syscallarg(const struct timespec *) tp;
};
 
struct sys_clock_getres_args {
syscallarg(clockid_t) clock_id;
syscallarg(struct timespec *) tp;
};
 
struct sys_nanosleep_args {
syscallarg(const struct timespec *) rqtp;
syscallarg(struct timespec *) rmtp;
};
 
struct sys_minherit_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) inherit;
};
 
struct sys_rfork_args {
syscallarg(int) flags;
};
 
struct sys_poll_args {
syscallarg(struct pollfd *) fds;
syscallarg(unsigned long) nfds;
syscallarg(int) timeout;
};
 
struct sys_lchown_args {
syscallarg(const char *) path;
syscallarg(uid_t) uid;
syscallarg(gid_t) gid;
};
 
struct sys_getsid_args {
syscallarg(pid_t) pid;
};
 
struct sys_msync_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) flags;
};
 
struct sys___semctl_args {
syscallarg(int) semid;
syscallarg(int) semnum;
syscallarg(int) cmd;
syscallarg(union semun *) arg;
};
 
struct sys_shmctl_args {
syscallarg(int) shmid;
syscallarg(int) cmd;
syscallarg(struct shmid_ds *) buf;
};
 
struct sys_msgctl_args {
syscallarg(int) msqid;
syscallarg(int) cmd;
syscallarg(struct msqid_ds *) buf;
};
 
struct sys_getfsstat_args {
syscallarg(struct statfs *) buf;
syscallarg(size_t) bufsize;
syscallarg(int) flags;
};
 
struct sys_statfs_args {
syscallarg(const char *) path;
syscallarg(struct statfs *) buf;
};
 
struct sys_fstatfs_args {
syscallarg(int) fd;
syscallarg(struct statfs *) buf;
};
 
struct sys_pipe_args {
syscallarg(int *) fdp;
};
 
/*
* System call prototypes.
*/
 
int sys_exit __P((struct proc *, void *, register_t *));
int sys_fork __P((struct proc *, void *, register_t *));
int sys_read __P((struct proc *, void *, register_t *));
int sys_write __P((struct proc *, void *, register_t *));
int sys_open __P((struct proc *, void *, register_t *));
int sys_close __P((struct proc *, void *, register_t *));
int sys_wait4 __P((struct proc *, void *, register_t *));
int compat_43_sys_creat __P((struct proc *, void *, register_t *));
int sys_link __P((struct proc *, void *, register_t *));
int sys_unlink __P((struct proc *, void *, register_t *));
int sys_chdir __P((struct proc *, void *, register_t *));
int sys_fchdir __P((struct proc *, void *, register_t *));
int sys_mknod __P((struct proc *, void *, register_t *));
int sys_chmod __P((struct proc *, void *, register_t *));
int sys_chown __P((struct proc *, void *, register_t *));
int sys_obreak __P((struct proc *, void *, register_t *));
int sys_ogetfsstat __P((struct proc *, void *, register_t *));
int compat_43_sys_lseek __P((struct proc *, void *, register_t *));
int sys_getpid __P((struct proc *, void *, register_t *));
int sys_mount __P((struct proc *, void *, register_t *));
int sys_unmount __P((struct proc *, void *, register_t *));
int sys_setuid __P((struct proc *, void *, register_t *));
int sys_getuid __P((struct proc *, void *, register_t *));
int sys_geteuid __P((struct proc *, void *, register_t *));
int sys_ptrace __P((struct proc *, void *, register_t *));
int sys_recvmsg __P((struct proc *, void *, register_t *));
int sys_sendmsg __P((struct proc *, void *, register_t *));
int sys_recvfrom __P((struct proc *, void *, register_t *));
int sys_accept __P((struct proc *, void *, register_t *));
int sys_getpeername __P((struct proc *, void *, register_t *));
int sys_getsockname __P((struct proc *, void *, register_t *));
int sys_access __P((struct proc *, void *, register_t *));
int sys_chflags __P((struct proc *, void *, register_t *));
int sys_fchflags __P((struct proc *, void *, register_t *));
int sys_sync __P((struct proc *, void *, register_t *));
int sys_kill __P((struct proc *, void *, register_t *));
int compat_43_sys_stat __P((struct proc *, void *, register_t *));
int sys_getppid __P((struct proc *, void *, register_t *));
int compat_43_sys_lstat __P((struct proc *, void *, register_t *));
int sys_dup __P((struct proc *, void *, register_t *));
int sys_opipe __P((struct proc *, void *, register_t *));
int sys_getegid __P((struct proc *, void *, register_t *));
int sys_profil __P((struct proc *, void *, register_t *));
#ifdef KTRACE
int sys_ktrace __P((struct proc *, void *, register_t *));
#else
#endif
int sys_sigaction __P((struct proc *, void *, register_t *));
int sys_getgid __P((struct proc *, void *, register_t *));
int sys_sigprocmask __P((struct proc *, void *, register_t *));
int sys_getlogin __P((struct proc *, void *, register_t *));
int sys_setlogin __P((struct proc *, void *, register_t *));
int sys_acct __P((struct proc *, void *, register_t *));
int sys_sigpending __P((struct proc *, void *, register_t *));
int sys_sigaltstack __P((struct proc *, void *, register_t *));
int sys_ioctl __P((struct proc *, void *, register_t *));
int sys_reboot __P((struct proc *, void *, register_t *));
int sys_revoke __P((struct proc *, void *, register_t *));
int sys_symlink __P((struct proc *, void *, register_t *));
int sys_readlink __P((struct proc *, void *, register_t *));
int sys_execve __P((struct proc *, void *, register_t *));
int sys_umask __P((struct proc *, void *, register_t *));
int sys_chroot __P((struct proc *, void *, register_t *));
int compat_43_sys_fstat __P((struct proc *, void *, register_t *));
int compat_43_sys_getkerninfo __P((struct proc *, void *, register_t *));
int compat_43_sys_getpagesize __P((struct proc *, void *, register_t *));
int sys_omsync __P((struct proc *, void *, register_t *));
int sys_vfork __P((struct proc *, void *, register_t *));
int sys_sbrk __P((struct proc *, void *, register_t *));
int sys_sstk __P((struct proc *, void *, register_t *));
int compat_43_sys_mmap __P((struct proc *, void *, register_t *));
int sys_ovadvise __P((struct proc *, void *, register_t *));
int sys_munmap __P((struct proc *, void *, register_t *));
int sys_mprotect __P((struct proc *, void *, register_t *));
int sys_madvise __P((struct proc *, void *, register_t *));
int sys_mincore __P((struct proc *, void *, register_t *));
int sys_getgroups __P((struct proc *, void *, register_t *));
int sys_setgroups __P((struct proc *, void *, register_t *));
int sys_getpgrp __P((struct proc *, void *, register_t *));
int sys_setpgid __P((struct proc *, void *, register_t *));
int sys_setitimer __P((struct proc *, void *, register_t *));
int compat_43_sys_wait __P((struct proc *, void *, register_t *));
int sys_swapon __P((struct proc *, void *, register_t *));
int sys_getitimer __P((struct proc *, void *, register_t *));
int compat_43_sys_gethostname __P((struct proc *, void *, register_t *));
int compat_43_sys_sethostname __P((struct proc *, void *, register_t *));
int compat_43_sys_getdtablesize __P((struct proc *, void *, register_t *));
int sys_dup2 __P((struct proc *, void *, register_t *));
int sys_fcntl __P((struct proc *, void *, register_t *));
int sys_select __P((struct proc *, void *, register_t *));
int sys_fsync __P((struct proc *, void *, register_t *));
int sys_setpriority __P((struct proc *, void *, register_t *));
int sys_socket __P((struct proc *, void *, register_t *));
int sys_connect __P((struct proc *, void *, register_t *));
int compat_43_sys_accept __P((struct proc *, void *, register_t *));
int sys_getpriority __P((struct proc *, void *, register_t *));
int compat_43_sys_send __P((struct proc *, void *, register_t *));
int compat_43_sys_recv __P((struct proc *, void *, register_t *));
int sys_sigreturn __P((struct proc *, void *, register_t *));
int sys_bind __P((struct proc *, void *, register_t *));
int sys_setsockopt __P((struct proc *, void *, register_t *));
int sys_listen __P((struct proc *, void *, register_t *));
int compat_43_sys_sigvec __P((struct proc *, void *, register_t *));
int compat_43_sys_sigblock __P((struct proc *, void *, register_t *));
int compat_43_sys_sigsetmask __P((struct proc *, void *, register_t *));
int sys_sigsuspend __P((struct proc *, void *, register_t *));
int compat_43_sys_sigstack __P((struct proc *, void *, register_t *));
int compat_43_sys_recvmsg __P((struct proc *, void *, register_t *));
int compat_43_sys_sendmsg __P((struct proc *, void *, register_t *));
#ifdef TRACE
int sys_vtrace __P((struct proc *, void *, register_t *));
#else
#endif
int sys_gettimeofday __P((struct proc *, void *, register_t *));
int sys_getrusage __P((struct proc *, void *, register_t *));
int sys_getsockopt __P((struct proc *, void *, register_t *));
int sys_readv __P((struct proc *, void *, register_t *));
int sys_writev __P((struct proc *, void *, register_t *));
int sys_settimeofday __P((struct proc *, void *, register_t *));
int sys_fchown __P((struct proc *, void *, register_t *));
int sys_fchmod __P((struct proc *, void *, register_t *));
int compat_43_sys_recvfrom __P((struct proc *, void *, register_t *));
int compat_43_sys_setreuid __P((struct proc *, void *, register_t *));
int compat_43_sys_setregid __P((struct proc *, void *, register_t *));
int sys_rename __P((struct proc *, void *, register_t *));
int compat_43_sys_truncate __P((struct proc *, void *, register_t *));
int compat_43_sys_ftruncate __P((struct proc *, void *, register_t *));
int sys_flock __P((struct proc *, void *, register_t *));
int sys_mkfifo __P((struct proc *, void *, register_t *));
int sys_sendto __P((struct proc *, void *, register_t *));
int sys_shutdown __P((struct proc *, void *, register_t *));
int sys_socketpair __P((struct proc *, void *, register_t *));
int sys_mkdir __P((struct proc *, void *, register_t *));
int sys_rmdir __P((struct proc *, void *, register_t *));
int sys_utimes __P((struct proc *, void *, register_t *));
int sys_adjtime __P((struct proc *, void *, register_t *));
int compat_43_sys_getpeername __P((struct proc *, void *, register_t *));
int compat_43_sys_gethostid __P((struct proc *, void *, register_t *));
int compat_43_sys_sethostid __P((struct proc *, void *, register_t *));
int compat_43_sys_getrlimit __P((struct proc *, void *, register_t *));
int compat_43_sys_setrlimit __P((struct proc *, void *, register_t *));
int compat_43_sys_killpg __P((struct proc *, void *, register_t *));
int sys_setsid __P((struct proc *, void *, register_t *));
int sys_quotactl __P((struct proc *, void *, register_t *));
int compat_43_sys_quota __P((struct proc *, void *, register_t *));
int compat_43_sys_getsockname __P((struct proc *, void *, register_t *));
#if defined(NFSCLIENT) || defined(NFSSERVER)
int sys_nfssvc __P((struct proc *, void *, register_t *));
#else
#endif
int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *));
int sys_ostatfs __P((struct proc *, void *, register_t *));
int sys_ofstatfs __P((struct proc *, void *, register_t *));
#if defined(NFSCLIENT) || defined(NFSSERVER)
int sys_getfh __P((struct proc *, void *, register_t *));
#else
#endif
int compat_09_sys_getdomainname __P((struct proc *, void *, register_t *));
int compat_09_sys_setdomainname __P((struct proc *, void *, register_t *));
int compat_09_sys_uname __P((struct proc *, void *, register_t *));
int sys_sysarch __P((struct proc *, void *, register_t *));
#if defined(SYSVSEM) && !defined(alpha)
int compat_10_sys_semsys __P((struct proc *, void *, register_t *));
#else
#endif
#if defined(SYSVMSG) && !defined(alpha)
int compat_10_sys_msgsys __P((struct proc *, void *, register_t *));
#else
#endif
#if defined(SYSVSHM) && !defined(alpha)
int compat_10_sys_shmsys __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef NTP
int sys_ntp_gettime __P((struct proc *, void *, register_t *));
int sys_ntp_adjtime __P((struct proc *, void *, register_t *));
#else
#endif
int sys_setgid __P((struct proc *, void *, register_t *));
int sys_setegid __P((struct proc *, void *, register_t *));
int sys_seteuid __P((struct proc *, void *, register_t *));
#ifdef LFS
int lfs_bmapv __P((struct proc *, void *, register_t *));
int lfs_markv __P((struct proc *, void *, register_t *));
int lfs_segclean __P((struct proc *, void *, register_t *));
int lfs_segwait __P((struct proc *, void *, register_t *));
#else
#endif
int sys_stat __P((struct proc *, void *, register_t *));
int sys_fstat __P((struct proc *, void *, register_t *));
int sys_lstat __P((struct proc *, void *, register_t *));
int sys_pathconf __P((struct proc *, void *, register_t *));
int sys_fpathconf __P((struct proc *, void *, register_t *));
int sys_swapctl __P((struct proc *, void *, register_t *));
int sys_getrlimit __P((struct proc *, void *, register_t *));
int sys_setrlimit __P((struct proc *, void *, register_t *));
int sys_getdirentries __P((struct proc *, void *, register_t *));
int sys_mmap __P((struct proc *, void *, register_t *));
int sys_lseek __P((struct proc *, void *, register_t *));
int sys_truncate __P((struct proc *, void *, register_t *));
int sys_ftruncate __P((struct proc *, void *, register_t *));
int sys___sysctl __P((struct proc *, void *, register_t *));
int sys_mlock __P((struct proc *, void *, register_t *));
int sys_munlock __P((struct proc *, void *, register_t *));
int sys_undelete __P((struct proc *, void *, register_t *));
int sys_futimes __P((struct proc *, void *, register_t *));
int sys_getpgid __P((struct proc *, void *, register_t *));
int sys_xfspioctl __P((struct proc *, void *, register_t *));
#ifdef LKM
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
int sys_lkmnosys __P((struct proc *, void *, register_t *));
#else /* !LKM */
#endif /* !LKM */
#ifdef SYSVSEM
int sys___osemctl __P((struct proc *, void *, register_t *));
int sys_semget __P((struct proc *, void *, register_t *));
int sys_semop __P((struct proc *, void *, register_t *));
int sys_semconfig __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef SYSVMSG
int sys_omsgctl __P((struct proc *, void *, register_t *));
int sys_msgget __P((struct proc *, void *, register_t *));
int sys_msgsnd __P((struct proc *, void *, register_t *));
int sys_msgrcv __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef SYSVSHM
int sys_shmat __P((struct proc *, void *, register_t *));
int sys_oshmctl __P((struct proc *, void *, register_t *));
int sys_shmdt __P((struct proc *, void *, register_t *));
int sys_shmget __P((struct proc *, void *, register_t *));
#else
#endif
int sys_clock_gettime __P((struct proc *, void *, register_t *));
int sys_clock_settime __P((struct proc *, void *, register_t *));
int sys_clock_getres __P((struct proc *, void *, register_t *));
int sys_nanosleep __P((struct proc *, void *, register_t *));
int sys_minherit __P((struct proc *, void *, register_t *));
int sys_rfork __P((struct proc *, void *, register_t *));
int sys_poll __P((struct proc *, void *, register_t *));
int sys_issetugid __P((struct proc *, void *, register_t *));
int sys_lchown __P((struct proc *, void *, register_t *));
int sys_getsid __P((struct proc *, void *, register_t *));
int sys_msync __P((struct proc *, void *, register_t *));
#ifdef SYSVSEM
int sys___semctl __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef SYSVSHM
int sys_shmctl __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef SYSVMSG
int sys_msgctl __P((struct proc *, void *, register_t *));
#else
#endif
int sys_getfsstat __P((struct proc *, void *, register_t *));
int sys_statfs __P((struct proc *, void *, register_t *));
int sys_fstatfs __P((struct proc *, void *, register_t *));
int sys_pipe __P((struct proc *, void *, register_t *));
#endif
 
#endif // _SYS_SYSCALLARGS_H_
/socket.h
0,0 → 1,457
//==========================================================================
//
// include/sys/socket.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
/* $OpenBSD: socket.h,v 1.30 1999/12/08 06:50:24 itojun Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
 
/*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 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
*/
 
#ifndef _SYS_SOCKET_H_
#define _SYS_SOCKET_H_
 
/*
* Definitions related to sockets: types, address families, options.
*/
 
/*
* Types
*/
#define SOCK_STREAM 1 /* stream socket */
#define SOCK_DGRAM 2 /* datagram socket */
#define SOCK_RAW 3 /* raw-protocol interface */
#define SOCK_RDM 4 /* reliably-delivered message */
#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 */
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define SO_LINGER 0x0080 /* linger on close if data present */
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
 
/*
* 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 */
#define SO_NETPROC 0x1020 /* multiplex; network processing */
 
/*
* Structure used for manipulating linger option.
*/
struct linger {
int l_onoff; /* option on/off */
int l_linger; /* linger time */
};
 
/*
* 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 */
#define AF_LOCAL 1 /* local to host (pipes, portals) */
#define AF_UNIX AF_LOCAL /* backward compatibility */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#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_NS 6 /* XEROX NS 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_INET6 24 /* IPv6 */
#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 AF_NATM 27 /* native ATM access */
#define AF_ENCAP 28
#define AF_SIP 29 /* Simple Internet Protocol */
#define AF_KEY 30
#define AF_MAX 31
 
/*
* Structure used by kernel to store most
* addresses.
*/
struct sockaddr {
u_int8_t sa_len; /* total length */
sa_family_t sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
};
 
/*
* Sockaddr type which can hold any sockaddr type available
* in the system.
*
* Note: __ss_{len,family} is defined in RFC2553. During RFC2553 discussion
* the field name went back and forth between ss_len and __ss_len,
* and RFC2553 specifies it to be __ss_len. openbsd picked ss_len.
* For maximum portability, userland programmer would need to
* (1) make the code never touch ss_len portion (cast it into sockaddr and
* touch sa_len), or (2) add "-Dss_len=__ss_len" into CFLAGS to unify all
* occurences (including header file) to __ss_len.
*/
struct sockaddr_storage {
u_int8_t ss_len; /* total length */
sa_family_t ss_family; /* address family */
u_char __ss_pad1[6]; /* align to quad */
u_int64_t __ss_pad2; /* force alignment for stupid compilers */
u_char __ss_pad3[240]; /* pad to a total of 256 bytes */
};
 
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
*/
struct sockproto {
u_short sp_family; /* address family */
u_short sp_protocol; /* protocol */
};
 
/*
* 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_INET6 AF_INET6
#define PF_IMPLINK AF_IMPLINK
#define PF_PUP AF_PUP
#define PF_CHAOS AF_CHAOS
#define PF_NS AF_NS
#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_IPX AF_IPX /* same format as AF_NS */
#define PF_INET6 AF_INET6
#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */
#define PF_PIP pseudo_AF_PIP
#define PF_ISDN AF_ISDN
#define PF_NATM AF_NATM
#define PF_ENCAP AF_ENCAP
#define PF_SIP AF_SIP
#define PF_KEY AF_KEY
#define PF_MAX AF_MAX
 
/*
* These are the valid values for the "how" field used by shutdown(2).
*/
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
 
/*
* 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)))
 
/*
* 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 }, \
{ "inet6", CTLTYPE_NODE }, \
{ "pip", CTLTYPE_NODE }, \
{ "isdn", CTLTYPE_NODE }, \
{ "natm", CTLTYPE_NODE }, \
{ "encap", CTLTYPE_NODE }, \
{ "sip", CTLTYPE_NODE }, \
{ "key", 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_MAXID 4
 
#define CTL_NET_RT_NAMES { \
{ 0, 0 }, \
{ "dump", CTLTYPE_STRUCT }, \
{ "flags", CTLTYPE_STRUCT }, \
{ "iflist", CTLTYPE_STRUCT }, \
}
 
/*
* Maximum queue length specifiable by listen(2).
*/
#define SOMAXCONN 128
 
/*
* Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg.
*/
struct msghdr {
caddr_t msg_name; /* optional address */
socklen_t msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter/gather array */
u_int msg_iovlen; /* # elements in msg_iov */
caddr_t 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_DONTWAIT 0x80 /* this message should be nonblocking */
#define MSG_BCAST 0x100 /* this message rec'd as broadcast */
#define MSG_MCAST 0x200 /* this message rec'd as multicast */
 
/*
* 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[]; */
};
 
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1))
 
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
(((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)NULL : \
(struct cmsghdr *)((caddr_t)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len)))
 
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
 
/* Round len up to next alignment boundary */
#define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1))
 
/* Length of the contents of a control message of length len */
#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
 
/* Length of the space taken up by a padded control message of length len */
#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
 
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of int) */
#define SCM_CREDS 0x02 /* credientials (struct sockcred) */
 
/*
* 4.3 compat sockaddr, move to compat file later
*/
struct osockaddr {
u_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 {
caddr_t msg_name; /* optional address */
int msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter/gather array */
int msg_iovlen; /* # elements in msg_iov */
caddr_t msg_accrights; /* access rights sent/received */
int msg_accrightslen;
};
 
#define SA_LEN(x) ((x)->sa_len)
 
#ifndef _KERNEL
 
#include <sys/cdefs.h>
 
__BEGIN_DECLS
int accept __P((int, struct sockaddr *, socklen_t *));
int bind __P((int, const struct sockaddr *, socklen_t));
int connect __P((int, const struct sockaddr *, socklen_t));
int getpeername __P((int, struct sockaddr *, socklen_t *));
int getsockname __P((int, struct sockaddr *, socklen_t *));
int getsockopt __P((int, int, int, void *, socklen_t *));
int listen __P((int, int));
ssize_t recv __P((int, void *, size_t, int));
ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, socklen_t *));
ssize_t recvmsg __P((int, struct msghdr *, int));
ssize_t send __P((int, const void *, size_t, int));
ssize_t sendto __P((int, const void *,
size_t, int, const struct sockaddr *, socklen_t));
ssize_t sendmsg __P((int, const struct msghdr *, int));
int setsockopt __P((int, int, int, const void *, socklen_t));
int shutdown __P((int, int));
int socket __P((int, int, int));
int socketpair __P((int, int, int, int *));
__END_DECLS
#else
# if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_LINUX) || \
defined(COMPAT_HPUX) || defined(COMPAT_FREEBSD)
# define COMPAT_OLDSOCK
# define MSG_COMPAT 0x8000
# endif
 
void pfctlinput __P((int, struct sockaddr *));
#endif /* !_KERNEL */
 
#endif /* !_SYS_SOCKET_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.