From d589e7527909a3120021572e24a9d86bdfb4c7d9 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Mon, 26 Apr 2004 11:46:52 +0000 Subject: 2004-04-26 Ralf Corsepius * libnetworking/netinet/igmp_var.h: Cosmetic updates from FreeBSD. * libnetworking/sys/sysctl.h: Update from FreeBSD. * libnetworking/sys/socketvar.h: Update from FreeBSD. --- cpukit/ChangeLog | 6 ++ cpukit/libnetworking/netinet/igmp_var.h | 7 +- cpukit/libnetworking/sys/socketvar.h | 134 ++++++++++++++++---------------- cpukit/libnetworking/sys/sysctl.h | 44 ++++++++--- 4 files changed, 108 insertions(+), 83 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 8728903635..72cb2505bd 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2004-04-26 Ralf Corsepius + + * libnetworking/netinet/igmp_var.h: Cosmetic updates from FreeBSD. + * libnetworking/sys/sysctl.h: Update from FreeBSD. + * libnetworking/sys/socketvar.h: Update from FreeBSD. + 2004-04-24 Ralf Corsepius * libnetworking/sys/protosw.h: More partial updates from FreeBSD. diff --git a/cpukit/libnetworking/netinet/igmp_var.h b/cpukit/libnetworking/netinet/igmp_var.h index b9855b3b8c..d515d80199 100644 --- a/cpukit/libnetworking/netinet/igmp_var.h +++ b/cpukit/libnetworking/netinet/igmp_var.h @@ -14,10 +14,6 @@ * 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. @@ -35,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 - * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.19 2002/03/19 21:25:46 alfred Exp $ + * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.20 2004/04/07 20:46:13 imp Exp $ */ #ifndef _NETINET_IGMP_VAR_H_ @@ -108,5 +104,4 @@ SYSCTL_DECL(_net_inet_igmp); { 0, 0 }, \ { "stats", CTLTYPE_STRUCT }, \ } - #endif diff --git a/cpukit/libnetworking/sys/socketvar.h b/cpukit/libnetworking/sys/socketvar.h index ec962c34b2..080fb0ab66 100644 --- a/cpukit/libnetworking/sys/socketvar.h +++ b/cpukit/libnetworking/sys/socketvar.h @@ -1,3 +1,5 @@ +/* $Id$ */ + /*- * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -31,7 +33,7 @@ * SUCH DAMAGE. * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 - * $Id$ + * $FreeBSD: src/sys/sys/socketvar.h,v 1.110 2004/03/01 03:14:23 rwatson Exp $ */ #ifndef _SYS_SOCKETVAR_H_ @@ -51,7 +53,7 @@ struct socket { 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 */ - caddr_t so_pcb; /* protocol control block */ + void *so_pcb; /* protocol control block */ struct protosw *so_proto; /* protocol handle */ /* * Variables for connection queuing. @@ -72,7 +74,7 @@ struct socket { short so_incqlen; /* number of unaccepted incomplete connections */ short so_qlimit; /* max number queued connections */ - u_long so_timeo; /* connection timeout */ + short so_timeo; /* connection timeout */ u_short so_error; /* error affecting connection */ pid_t so_pgid; /* pgid for signals */ u_long so_oobmark; /* chars to oob mark */ @@ -80,15 +82,15 @@ struct socket { * 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 */ + u_int sb_cc; /* actual chars in buffer */ + u_int sb_hiwat; /* max actual char count */ + u_int sb_mbcnt; /* chars of mbufs used */ + u_int sb_mbmax; /* max chars of mbufs to use */ + int 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 */ - u_long sb_timeo; /* timeout for read/write */ + int sb_timeo; /* timeout for read/write */ void (*sb_wakeup) __P((struct socket *, caddr_t)); caddr_t sb_wakeuparg; /* arg for above */ } so_rcv, so_snd; @@ -102,8 +104,8 @@ struct socket { #define SB_NOINTR 0x40 /* operations not interruptible */ caddr_t so_tpcb; /* Wisc. protocol control block XXX */ - void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); - caddr_t so_upcallarg; /* Arg for above */ + void (*so_upcall)(struct socket *, void *arg, int); + void *so_upcallarg; /* Arg for above */ uid_t so_uid; /* who opened the socket */ }; @@ -214,68 +216,68 @@ struct stat; /* * File operations on sockets. */ -int soo_ioctl __P((struct file *fp, int cmd, caddr_t data, - struct proc *p)); -int soo_select __P((struct file *fp, int which, struct proc *p)); -int soo_stat __P((struct socket *so, struct stat *ub)); +int soo_ioctl(struct file *fp, int cmd, caddr_t data, + struct proc *p); +int soo_select(struct file *fp, int which, struct proc *p); +int soo_stat(struct socket *so, struct stat *ub); /* * From uipc_socket and friends */ -int getsock __P((struct filedesc *fdp, int fdes, struct file **fpp)); -int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type)); -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)); +int getsock(struct filedesc *fdp, int fdes, struct file **fpp); +int sockargs(struct mbuf **mp, caddr_t buf, int buflen, int type); +void sbappend(struct sockbuf *sb, struct mbuf *m); +int sbappendaddr(struct sockbuf *sb, struct sockaddr *asa, + struct mbuf *m0, struct mbuf *control); +int sbappendcontrol(struct sockbuf *sb, struct mbuf *m0, + struct mbuf *control); +void sbappendrecord(struct sockbuf *sb, struct mbuf *m0); +void sbcheck(struct sockbuf *sb); +void sbcompress(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, - struct proc *p)); -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)); + sbcreatecontrol(caddr_t p, int size, int type, int level); +void sbdrop(struct sockbuf *sb, int len); +void sbdroprecord(struct sockbuf *sb); +void sbflush(struct sockbuf *sb); +void sbinsertoob(struct sockbuf *sb, struct mbuf *m0); +void sbrelease(struct sockbuf *sb); +int sbreserve(struct sockbuf *sb, u_long cc); +int sbwait(struct sockbuf *sb); +int sb_lock(struct sockbuf *sb); +int soabort(struct socket *so); +int soaccept(struct socket *so, struct mbuf *nam); +int sobind(struct socket *so, struct mbuf *nam); +void socantrcvmore(struct socket *so); +void socantsendmore(struct socket *so); +int soclose(struct socket *so); +int soconnect(struct socket *so, struct mbuf *nam); +int soconnect2(struct socket *so1, struct socket *so2); +int socreate(int dom, struct socket **aso, int type, int proto, + struct proc *p); +int sodisconnect(struct socket *so); +void sofree(struct socket *so); +int sogetopt(struct socket *so, int level, int optname, + struct mbuf **mp); +void sohasoutofband(struct socket *so); +void soisconnected(struct socket *so); +void soisconnecting(struct socket *so); +void soisdisconnected(struct socket *so); +void soisdisconnecting(struct socket *so); +int solisten(struct socket *so, int backlog); struct socket * - sodropablereq __P((struct socket *head)); + sodropablereq(struct socket *head); struct socket * - sonewconn1 __P((struct socket *head, int connstatus)); -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)); + sonewconn1(struct socket *head, int connstatus); +int soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, + struct mbuf **mp0, struct mbuf **controlp, int *flagsp); +int soreserve(struct socket *so, u_long sndcc, u_long rcvcc); +void sorflush(struct socket *so); +int sosend(struct socket *so, struct mbuf *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags); +int sosetopt(struct socket *so, int level, int optname, + struct mbuf *m0); +int soshutdown(struct socket *so, int how); +void sowakeup(struct socket *so, struct sockbuf *sb); #endif /* _KERNEL */ #endif /* !_SYS_SOCKETVAR_H_ */ diff --git a/cpukit/libnetworking/sys/sysctl.h b/cpukit/libnetworking/sys/sysctl.h index 3c7c89792a..64d46ba434 100644 --- a/cpukit/libnetworking/sys/sysctl.h +++ b/cpukit/libnetworking/sys/sysctl.h @@ -13,10 +13,6 @@ * 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. @@ -34,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/sys/sysctl.h,v 1.110 2002/10/20 22:48:08 phk Exp $ + * $FreeBSD: src/sys/sys/sysctl.h,v 1.128 2004/04/07 04:19:49 imp Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -52,14 +48,14 @@ struct thread; * respective subsystem header files. */ -#define CTL_MAXNAME 12 /* largest number of components supported */ +#define CTL_MAXNAME 24 /* largest number of components supported */ /* * Each subsystem defined by sysctl defines a list of variables * for that subsystem. Each name is either a node with further * levels defined below it, or it is a leaf of some particular * type given below. Each sysctl level defines a set of name/type - * pairs to be used by sysctl(1) in manipulating the subsystem. + * pairs to be used by sysctl(8) in manipulating the subsystem. */ struct ctlname { char *ctl_name; /* subsystem name */ @@ -86,6 +82,19 @@ struct ctlname { #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ #define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ #define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */ +#define CTLMASK_SECURE 0x00F00000 /* Secure level */ +#define CTLFLAG_TUN 0x00080000 /* Tunable variable */ +#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) + +/* + * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. + * + * Secure when the securelevel is raised to at least N. + */ +#define CTLSHIFT_SECURE 20 +#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)) +#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)) +#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)) /* * USE THIS instead of a hardwired number from the categories below @@ -126,6 +135,7 @@ struct sysctl_req { size_t newlen; size_t newidx; int (*newfunc)(struct sysctl_req *, void *, size_t); + size_t validlen; }; SLIST_HEAD(sysctl_oid_list, sysctl_oid); @@ -183,6 +193,9 @@ struct sysctl_ctx_entry { TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); +#define SYSCTL_NODE_CHILDREN(parent, name) \ + sysctl_##parent##_##name##_children + /* This constructs a "raw" MIB oid. */ #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ static struct sysctl_oid sysctl__##parent##_##name = { \ @@ -195,9 +208,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); /* This constructs a node from which other oids can hang. */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ - struct sysctl_oid_list sysctl_##parent##_##name##_children; \ + struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \ SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \ - (void*)&sysctl_##parent##_##name##_children, 0, handler, \ + (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, \ "N", descr) #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ @@ -240,7 +253,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access), \ ptr, 0, sysctl_handle_long, "L", descr) -/* Oid for a long. The pointer must be non NULL. */ +/* Oid for an unsigned long. The pointer must be non NULL. */ #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \ ptr, val, sysctl_handle_long, "LU", descr) @@ -403,6 +416,12 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define KERN_PROC_UID 5 /* by effective uid */ #define KERN_PROC_RUID 6 /* by real uid */ #define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ +#define KERN_PROC_PROC 8 /* only return procs */ +#define KERN_PROC_SV_NAME 9 /* get syscall vector name */ +#define KERN_PROC_INC_THREAD 0x10 /* + * modifier for pid, pgrp, tty, + * uid, ruid, and proc + */ /* * KERN_IPC identifiers @@ -572,6 +591,7 @@ SYSCTL_DECL(_compat); extern char machine[]; extern char osrelease[]; extern char ostype[]; +extern char kern_ident[]; /* Dynamic oid handling */ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, @@ -579,6 +599,8 @@ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, int kind, void *arg1, int arg2, int (*handler) (SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr); +int sysctl_move_oid(struct sysctl_oid *oidp, + struct sysctl_oid_list *parent); int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse); int sysctl_ctx_init(struct sysctl_ctx_list *clist); int sysctl_ctx_free(struct sysctl_ctx_list *clist); @@ -600,7 +622,7 @@ int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, size_t *retval); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); -void sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); +int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); #else /* !_KERNEL */ #include -- cgit v1.2.3