From owner-svn-src-user@FreeBSD.ORG Sun Jan 3 23:13:35 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C06CD106568F; Sun, 3 Jan 2010 23:13:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCB88FC1D; Sun, 3 Jan 2010 23:13:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o03NDZGU078870; Sun, 3 Jan 2010 23:13:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o03NDZGW078865; Sun, 3 Jan 2010 23:13:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201001032313.o03NDZGW078865@svn.freebsd.org> From: Kip Macy Date: Sun, 3 Jan 2010 23:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201448 - user/kmacy/releng_8_rump/lib/libunet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2010 23:13:35 -0000 Author: kmacy Date: Sun Jan 3 23:13:35 2010 New Revision: 201448 URL: http://svn.freebsd.org/changeset/base/201448 Log: further reduce undefined symbols Added: user/kmacy/releng_8_rump/lib/libunet/opt_maxusers.h (contents, props changed) Modified: user/kmacy/releng_8_rump/lib/libunet/Makefile user/kmacy/releng_8_rump/lib/libunet/unet_compat.c user/kmacy/releng_8_rump/lib/libunet/unet_glue.c Modified: user/kmacy/releng_8_rump/lib/libunet/Makefile ============================================================================== --- user/kmacy/releng_8_rump/lib/libunet/Makefile Sun Jan 3 22:29:06 2010 (r201447) +++ user/kmacy/releng_8_rump/lib/libunet/Makefile Sun Jan 3 23:13:35 2010 (r201448) @@ -9,10 +9,14 @@ PREFIX= ${.CURDIR}/../../sys LIB= unet UNET_KERN_COMMON_OBJS += \ + kern_environment.o \ + kern_event.o \ kern_mbuf.o \ kern_subr.o \ kern_sysctl.o \ subr_eventhandler.o \ + subr_param.o \ + subr_pcpu.o \ subr_sbuf.o \ uipc_accf.o \ uipc_mbuf.o \ @@ -26,7 +30,7 @@ UNET_NET_COMMON_OBJS += \ if.o \ if_clone.o \ if_dead.o \ - if_ether.o \ + if_ethersubr.o \ if_loop.o \ if_llatbl.o \ netisr.o \ @@ -38,6 +42,7 @@ UNET_NET_COMMON_OBJS += \ rtsock.o UNET_NETINET_COMMON_OBJS += \ + if_ether.o \ igmp.o \ in.o \ in_cksum.o \ @@ -86,7 +91,7 @@ UNET_GLUE_COMMON_OBJS = \ unet_glue.o # unet_init.o \ # unet_uipc_syscalls.o - +# unet_sys_generic.o UNET_COMMON_OBJS = \ ${UNET_KERN_COMMON_OBJS} \ @@ -103,6 +108,7 @@ CFLAGS+= -I${PREFIX} CFLAGS+= -I. CFLAGS+= -D_KERNEL CFLAGS+= -DUNET +CFLAGS+= -DMAXUSERS=32 CFLAGS+= -fno-builtin .include Added: user/kmacy/releng_8_rump/lib/libunet/opt_maxusers.h ============================================================================== Modified: user/kmacy/releng_8_rump/lib/libunet/unet_compat.c ============================================================================== --- user/kmacy/releng_8_rump/lib/libunet/unet_compat.c Sun Jan 3 22:29:06 2010 (r201447) +++ user/kmacy/releng_8_rump/lib/libunet/unet_compat.c Sun Jan 3 23:13:35 2010 (r201448) @@ -42,3 +42,11 @@ crfree(struct ucred *cr) free(cr); } } + +void +panic(const char *fmt, ...) +{ + + abort(); +} + Modified: user/kmacy/releng_8_rump/lib/libunet/unet_glue.c ============================================================================== --- user/kmacy/releng_8_rump/lib/libunet/unet_glue.c Sun Jan 3 22:29:06 2010 (r201447) +++ user/kmacy/releng_8_rump/lib/libunet/unet_glue.c Sun Jan 3 23:13:35 2010 (r201448) @@ -3,10 +3,41 @@ #include #include #include +#include #include +#include #include #include #include +#include + + +SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, + "Sysctl internal magic"); + +SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, + "High kernel, proc, limits &c"); + +SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0, + "Network, (see socket.h)"); + +MALLOC_DEFINE(M_IOV, "iov", "large iov's"); +MALLOC_DEFINE(M_DEVBUF, "devbuf", "device driver memory"); +MALLOC_DEFINE(M_TEMP, "temp", "misc temporary data buffers"); + +/* This is used in modules that need to work in both SMP and UP. */ +cpumask_t all_cpus; + +int mp_ncpus; +/* export this for libkvm consumers. */ +int mp_maxcpus = MAXCPU; + +volatile int smp_started; +u_int mp_maxid; + +int cold; + +static void timevalfix(struct timeval *); int prison_if(struct ucred *cred, struct sockaddr *sa) @@ -97,3 +128,150 @@ vsunlock(void *addr, size_t len) return (0); } + + +/* + * Check that a proposed value to load into the .it_value or + * .it_interval part of an interval timer is acceptable, and + * fix it to have at least minimal value (i.e. if it is less + * than the resolution of the clock, round it up.) + */ +int +itimerfix(struct timeval *tv) +{ + + if (tv->tv_sec < 0 || tv->tv_usec < 0 || tv->tv_usec >= 1000000) + return (EINVAL); + if (tv->tv_sec == 0 && tv->tv_usec != 0 && tv->tv_usec < tick) + tv->tv_usec = tick; + return (0); +} + +/* + * Decrement an interval timer by a specified number + * of microseconds, which must be less than a second, + * i.e. < 1000000. If the timer expires, then reload + * it. In this case, carry over (usec - old value) to + * reduce the value reloaded into the timer so that + * the timer does not drift. This routine assumes + * that it is called in a context where the timers + * on which it is operating cannot change in value. + */ +int +itimerdecr(struct itimerval *itp, int usec) +{ + + if (itp->it_value.tv_usec < usec) { + if (itp->it_value.tv_sec == 0) { + /* expired, and already in next interval */ + usec -= itp->it_value.tv_usec; + goto expire; + } + itp->it_value.tv_usec += 1000000; + itp->it_value.tv_sec--; + } + itp->it_value.tv_usec -= usec; + usec = 0; + if (timevalisset(&itp->it_value)) + return (1); + /* expired, exactly at end of interval */ +expire: + if (timevalisset(&itp->it_interval)) { + itp->it_value = itp->it_interval; + itp->it_value.tv_usec -= usec; + if (itp->it_value.tv_usec < 0) { + itp->it_value.tv_usec += 1000000; + itp->it_value.tv_sec--; + } + } else + itp->it_value.tv_usec = 0; /* sec is already 0 */ + return (0); +} + +/* + * Add and subtract routines for timevals. + * N.B.: subtract routine doesn't deal with + * results which are before the beginning, + * it just gets very confused in this case. + * Caveat emptor. + */ +void +timevaladd(struct timeval *t1, const struct timeval *t2) +{ + + t1->tv_sec += t2->tv_sec; + t1->tv_usec += t2->tv_usec; + timevalfix(t1); +} + +void +timevalsub(struct timeval *t1, const struct timeval *t2) +{ + + t1->tv_sec -= t2->tv_sec; + t1->tv_usec -= t2->tv_usec; + timevalfix(t1); +} + +static void +timevalfix(struct timeval *t1) +{ + + if (t1->tv_usec < 0) { + t1->tv_sec--; + t1->tv_usec += 1000000; + } + if (t1->tv_usec >= 1000000) { + t1->tv_sec++; + t1->tv_usec -= 1000000; + } +} + +/* + * ratecheck(): simple time-based rate-limit checking. + */ +int +ratecheck(struct timeval *lasttime, const struct timeval *mininterval) +{ + struct timeval tv, delta; + int rv = 0; + + getmicrouptime(&tv); /* NB: 10ms precision */ + delta = tv; + timevalsub(&delta, lasttime); + + /* + * check for 0,0 is so that the message will be seen at least once, + * even if interval is huge. + */ + if (timevalcmp(&delta, mininterval, >=) || + (lasttime->tv_sec == 0 && lasttime->tv_usec == 0)) { + *lasttime = tv; + rv = 1; + } + + return (rv); +} + +void +bintime(struct bintime *bt) +{ + + panic(""); +} + +void +getmicrouptime(struct timeval *tvp) +{ + + panic(""); +} + +void +getmicrotime(struct timeval *tvp) +{ + + panic(""); +} + +