From owner-svn-src-user@FreeBSD.ORG Thu Jan 1 03:08:07 2009 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 A75CB1065674; Thu, 1 Jan 2009 03:08:07 +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 961E98FC17; Thu, 1 Jan 2009 03:08:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n01387Sn042542; Thu, 1 Jan 2009 03:08:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n01387Wr042541; Thu, 1 Jan 2009 03:08:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901010308.n01387Wr042541@svn.freebsd.org> From: Kip Macy Date: Thu, 1 Jan 2009 03:08:07 +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: r186671 - user/kmacy/HEAD_fast_net/sys/kern 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: Thu, 01 Jan 2009 03:08:07 -0000 Author: kmacy Date: Thu Jan 1 03:08:07 2009 New Revision: 186671 URL: http://svn.freebsd.org/changeset/base/186671 Log: fix lock acquisition Modified: user/kmacy/HEAD_fast_net/sys/kern/kern_event.c Modified: user/kmacy/HEAD_fast_net/sys/kern/kern_event.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/kern/kern_event.c Thu Jan 1 02:29:57 2009 (r186670) +++ user/kmacy/HEAD_fast_net/sys/kern/kern_event.c Thu Jan 1 03:08:07 2009 (r186671) @@ -1672,7 +1672,6 @@ knote(struct knlist *list, long hint) list->kl_unlock(list->kl_lockarg); } - /* * add a knote to a knlist */ @@ -1684,12 +1683,10 @@ knlist_add(struct knlist *knl, struct kn KASSERT((kn->kn_status & (KN_INFLUX|KN_DETACHED)) == (KN_INFLUX|KN_DETACHED), ("knote not KN_INFLUX and KN_DETACHED")); if (!islocked) { - struct knlist *list = kn->kn_knlist; - - if (list->kl_lock != knlist_mtx_lock) - list->kl_lock(list->kl_lockarg); + if (knl->kl_lock != knlist_mtx_lock) + knl->kl_lock(knl->kl_lockarg); else - mtx_lock((struct mtx *)list->kl_lockarg); + mtx_lock((struct mtx *)knl->kl_lockarg); } SLIST_INSERT_HEAD(&knl->kl_list, kn, kn_selnext); if (!islocked) From owner-svn-src-user@FreeBSD.ORG Thu Jan 1 03:08:34 2009 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 EE22C1065672; Thu, 1 Jan 2009 03:08:34 +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 DC93E8FC16; Thu, 1 Jan 2009 03:08:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0138Yc0042738; Thu, 1 Jan 2009 03:08:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0138YGk042736; Thu, 1 Jan 2009 03:08:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901010308.n0138YGk042736@svn.freebsd.org> From: Kip Macy Date: Thu, 1 Jan 2009 03:08:34 +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: r186672 - user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet 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: Thu, 01 Jan 2009 03:08:35 -0000 Author: kmacy Date: Thu Jan 1 03:08:34 2009 New Revision: 186672 URL: http://svn.freebsd.org/changeset/base/186672 Log: use gcc __offsetof Modified: user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_compat.h user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_sync.c Modified: user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 1 03:08:07 2009 (r186671) +++ user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 1 03:08:34 2009 (r186672) @@ -1825,7 +1825,7 @@ typedef struct tcpiphdr tcpiphdr_t; #endif #ifndef offsetof -# define offsetof(t,m) (int)((&((t *)0L)->m)) +# define offsetof(t,m) (size_t)((&((t *)0L)->m)) #endif /* Modified: user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_sync.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_sync.c Thu Jan 1 03:08:07 2009 (r186671) +++ user/kmacy/HEAD_fast_net/sys/contrib/ipfilter/netinet/ip_sync.c Thu Jan 1 03:08:34 2009 (r186672) @@ -729,9 +729,9 @@ void *data; } nat = (nat_t *)data; - bzero((char *)n, offsetof(nat_t, nat_age)); + bzero((char *)n, __offsetof(nat_t, nat_age)); bcopy((char *)&nat->nat_age, (char *)&n->nat_age, - sizeof(*n) - offsetof(nat_t, nat_age)); + sizeof(*n) - __offsetof(nat_t, nat_age)); ipfsync_natorder(0, n); n->nat_sync = sl; From owner-svn-src-user@FreeBSD.ORG Thu Jan 1 03:10:12 2009 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 58D8A106566B; Thu, 1 Jan 2009 03:10:12 +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 47C028FC1F; Thu, 1 Jan 2009 03:10:12 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n013ACns042822; Thu, 1 Jan 2009 03:10:12 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n013ACBm042821; Thu, 1 Jan 2009 03:10:12 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901010310.n013ACBm042821@svn.freebsd.org> From: Kip Macy Date: Thu, 1 Jan 2009 03:10:12 +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: r186673 - user/kmacy/HEAD_fast_net/contrib/ipfilter/tools 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: Thu, 01 Jan 2009 03:10:12 -0000 Author: kmacy Date: Thu Jan 1 03:10:11 2009 New Revision: 186673 URL: http://svn.freebsd.org/changeset/base/186673 Log: update if_output call Modified: user/kmacy/HEAD_fast_net/contrib/ipfilter/tools/ipftest.c Modified: user/kmacy/HEAD_fast_net/contrib/ipfilter/tools/ipftest.c ============================================================================== --- user/kmacy/HEAD_fast_net/contrib/ipfilter/tools/ipftest.c Thu Jan 1 03:08:34 2009 (r186672) +++ user/kmacy/HEAD_fast_net/contrib/ipfilter/tools/ipftest.c Thu Jan 1 03:10:11 2009 (r186673) @@ -9,6 +9,9 @@ #include "ipt.h" #include #include +#include +#include +#include #if !defined(lint) static const char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-2000 Darren Reed"; @@ -282,16 +285,20 @@ char *argv[]; printf("--------------"); } else if ((opts & (OPT_BRIEF|OPT_NAT)) == (OPT_NAT|OPT_BRIEF)) printpacket(ip); - if (dir && (ifp != NULL) && IP_V(ip) && (m != NULL)) + if (dir && (ifp != NULL) && IP_V(ip) && (m != NULL)) { + struct route ro; + bzero(&ro, sizeof(ro)); #if defined(__sgi) && (IRIX < 60500) (*ifp->if_output)(ifp, (void *)m, NULL); #else # if TRU64 >= 1885 (*ifp->if_output)(ifp, (void *)m, NULL, 0, 0); # else - (*ifp->if_output)(ifp, (void *)m, NULL, 0); + (*ifp->if_output)(ifp, (void *)m, &ro); # endif #endif + } + if ((opts & (OPT_BRIEF|OPT_NAT)) != (OPT_NAT|OPT_BRIEF)) putchar('\n'); dir = 0; From owner-svn-src-user@FreeBSD.ORG Fri Jan 2 03:39:14 2009 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 602261065679; Fri, 2 Jan 2009 03:39:14 +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 496158FC0C; Fri, 2 Jan 2009 03:39:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n023dEvM086675; Fri, 2 Jan 2009 03:39:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n023dEcj086674; Fri, 2 Jan 2009 03:39:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901020339.n023dEcj086674@svn.freebsd.org> From: Kip Macy Date: Fri, 2 Jan 2009 03:39:14 +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: r186694 - user/kmacy/HEAD_fast_net/sys/netinet 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: Fri, 02 Jan 2009 03:39:14 -0000 Author: kmacy Date: Fri Jan 2 03:39:14 2009 New Revision: 186694 URL: http://svn.freebsd.org/changeset/base/186694 Log: - convert tcp_timer_activate over to using per-cpu callouts - don't acquire the tcbinfo lock exclusively in tcp_timer_rexmt unless needed for tcp_drop Modified: user/kmacy/HEAD_fast_net/sys/netinet/tcp_timer.c Modified: user/kmacy/HEAD_fast_net/sys/netinet/tcp_timer.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/netinet/tcp_timer.c Fri Jan 2 03:38:21 2009 (r186693) +++ user/kmacy/HEAD_fast_net/sys/netinet/tcp_timer.c Fri Jan 2 03:39:14 2009 (r186694) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -118,6 +119,8 @@ int tcp_maxpersistidle; /* max idle time in persist */ int tcp_maxidle; +#define INP_CPU(inp) ((inp)->inp_flowid % mp_maxid) + /* * Tcp protocol timeout routine called every 500 ms. * Updates timestamps used for TCP @@ -255,8 +258,8 @@ tcp_timer_2msl(void *xtp) } else { if (tp->t_state != TCPS_TIME_WAIT && (ticks - tp->t_rcvtime) <= tcp_maxidle) - callout_reset(&tp->t_timers->tt_2msl, tcp_keepintvl, - tcp_timer_2msl, tp); + callout_reset_on(&tp->t_timers->tt_2msl, tcp_keepintvl, + tcp_timer_2msl, tp, INP_CPU(inp)); else tp = tcp_close(tp); } @@ -340,9 +343,9 @@ tcp_timer_keep(void *xtp) tp->rcv_nxt, tp->snd_una - 1, 0); free(t_template, M_TEMP); } - callout_reset(&tp->t_timers->tt_keep, tcp_keepintvl, tcp_timer_keep, tp); + callout_reset_on(&tp->t_timers->tt_keep, tcp_keepintvl, tcp_timer_keep, tp, INP_CPU(inp)); } else - callout_reset(&tp->t_timers->tt_keep, tcp_keepidle, tcp_timer_keep, tp); + callout_reset_on(&tp->t_timers->tt_keep, tcp_keepidle, tcp_timer_keep, tp, INP_CPU(inp)); #ifdef TCPDEBUG if (inp->inp_socket->so_options & SO_DEBUG) @@ -447,15 +450,13 @@ tcp_timer_rexmt(void * xtp) CURVNET_SET(tp->t_vnet); INIT_VNET_INET(tp->t_vnet); int rexmt; - int headlocked; struct inpcb *inp; #ifdef TCPDEBUG int ostate; ostate = tp->t_state; #endif - INP_INFO_WLOCK(&V_tcbinfo); - headlocked = 1; + INP_INFO_RLOCK(&V_tcbinfo); inp = tp->t_inpcb; /* * XXXRW: While this assert is in fact correct, bugs in the tcpcb @@ -466,15 +467,16 @@ tcp_timer_rexmt(void * xtp) */ if (inp == NULL) { tcp_timer_race++; - INP_INFO_WUNLOCK(&V_tcbinfo); + INP_INFO_RUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } INP_WLOCK(inp); - if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt) + if ((inp->inp_vflag & INP_DROPPED) + || callout_pending(&tp->t_timers->tt_rexmt) || !callout_active(&tp->t_timers->tt_rexmt)) { + INP_INFO_RUNLOCK(&V_tcbinfo); INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } @@ -488,12 +490,22 @@ tcp_timer_rexmt(void * xtp) if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { tp->t_rxtshift = TCP_MAXRXTSHIFT; V_tcpstat.tcps_timeoutdrop++; + in_pcbref(inp); + INP_INFO_RUNLOCK(&V_tcbinfo); + INP_WUNLOCK(inp); + INP_INFO_WLOCK(&V_tcbinfo); + INP_WLOCK(inp); + if (in_pcbrele(inp)) { + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } tp = tcp_drop(tp, tp->t_softerror ? tp->t_softerror : ETIMEDOUT); + INP_INFO_WUNLOCK(&V_tcbinfo); goto out; } - INP_INFO_WUNLOCK(&V_tcbinfo); - headlocked = 0; + INP_INFO_RUNLOCK(&V_tcbinfo); if (tp->t_rxtshift == 1) { /* * first retransmit; record ssthresh and cwnd so they can @@ -597,8 +609,6 @@ out: #endif if (tp != NULL) INP_WUNLOCK(inp); - if (headlocked) - INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); } @@ -607,6 +617,8 @@ tcp_timer_activate(struct tcpcb *tp, int { struct callout *t_callout; void *f_callout; + struct inpcb *inp = tp->t_inpcb; + int cpu = INP_CPU(inp); switch (timer_type) { case TT_DELACK: @@ -635,7 +647,7 @@ tcp_timer_activate(struct tcpcb *tp, int if (delta == 0) { callout_stop(t_callout); } else { - callout_reset(t_callout, delta, f_callout, tp); + callout_reset_on(t_callout, delta, f_callout, tp, cpu); } } From owner-svn-src-user@FreeBSD.ORG Fri Jan 2 13:56:45 2009 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 D5844106564A; Fri, 2 Jan 2009 13:56:45 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C40778FC1B; Fri, 2 Jan 2009 13:56:45 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n02DujJ3099119; Fri, 2 Jan 2009 13:56:45 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n02DujO0099113; Fri, 2 Jan 2009 13:56:45 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200901021356.n02DujO0099113@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 2 Jan 2009 13:56:45 +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: r186702 - user/netchild/linuxulator-dtrace/src/sys/compat/linux 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: Fri, 02 Jan 2009 13:56:46 -0000 Author: netchild Date: Fri Jan 2 13:56:45 2009 New Revision: 186702 URL: http://svn.freebsd.org/changeset/base/186702 Log: - Add some more dtrace probes. - Convert my dtrace scripts to a 2-clause BSD license. - Extend the dtrace scripts with lock profiling statistics code and unsupported linuxulator functionality messages. - Remove some superflous function prototypes. This is only compile tested. Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c user/netchild/linuxulator-dtrace/src/sys/compat/linux/stats_timing.d Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d ============================================================================== --- user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d Fri Jan 2 13:48:02 2009 (r186701) +++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d Fri Jan 2 13:56:45 2009 (r186702) @@ -13,8 +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. 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 @@ -34,6 +32,8 @@ * Check if the emul lock is correctly acquired/released: * - no recursive locking * - no unlocking of already unlocked one + * + * Print stacktrace if the emul_lock is longer locked than about 10sec or more. */ linuxulator*::emul_locked @@ -47,6 +47,11 @@ linuxulator*::emul_locked linuxulator*::emul_locked { ++check[probeprov, arg0]; + + ts = timestamp; + spec = speculation(); + printf("Stacktrace of last lock operation of the emul_lock:\n"); + stack(); } linuxulator*::emul_unlock @@ -61,6 +66,14 @@ linuxulator*::emul_unlock linuxulator*::emul_unlock { + discard(spec); + spec = 0; --check[probeprov, arg0]; } +tick-10s +/spec != 0 && timestamp - ts >= 9999999000/ +{ + commit(spec); + spec = 0; +} Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d ============================================================================== --- user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d Fri Jan 2 13:48:02 2009 (r186701) +++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_error.d Fri Jan 2 13:56:45 2009 (r186702) @@ -13,8 +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. 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 @@ -30,11 +28,35 @@ * $FreeBSD$ */ -/* Report error conditions. */ +/* + * Report error conditions: + * - emulation errors (unsupportet stuff, unknown stuff, ...) + * - kernel errors (resource shortage, ...) + * - programming errors (errors which can happen, but should not happen) + */ linuxulator*:emul:proc_exit:child_clear_tid_error, linuxulator*:emul:proc_exit:futex_failed, -linuxulator*:emul:linux_schedtail:copyout_error +linuxulator*:emul:linux_schedtail:copyout_error, +linuxulator*:time:linux_clock_gettime:conversion_error, +linuxulator*:time:linux_clock_gettime:gettime_error, +linuxulator*:time:linux_clock_gettime:copyout_error, +linuxulator*:time:linux_clock_settime:conversion_error, +linuxulator*:time:linux_clock_settime:settime_error, +linuxulator*:time:linux_clock_settime:copyout_error, +linuxulator*:time:linux_clock_getres:conversion_error, +linuxulator*:time:linux_clock_getres:gettime_error, +linuxulator*:time:linux_clock_getres:copyout_error, +linuxulator*:time:linux_nanosleep:conversion_error, +linuxulator*:time:linux_nanosleep:nanosleep_error, +linuxulator*:time:linux_nanosleep:copyout_error, +linuxulator*:time:linux_nanosleep:copyin_error, +linuxulator*:time:linux_clock_nanosleep:copyin_error, +linuxulator*:time:linux_clock_nanosleep:conversion_error, +linuxulator*:time:linux_clock_nanosleep:copyout_error, +linuxulator*:time:linux_clock_nanosleep:nanosleep_error, +linuxulator*:sysctl:handle_string:copyout_error, +linuxulator*:sysctl:linux_sysctl:copyin_error { printf("ERROR: %s in %s:%s:%s\n", probename, probeprov, probemod, probefunc); stack(); @@ -42,7 +64,8 @@ linuxulator*:emul:linux_schedtail:copyou } linuxulator*:util:linux_driver_get_name_dev:nullcall, -linuxulator*:util:linux_driver_get_major_minor:nullcall +linuxulator*:util:linux_driver_get_major_minor:nullcall, +linuxulator*:time:linux_clock_getres:nullcall { printf("WARNING: %s:%s:%s:%s in application %s, maybe an application error?\n", probename, probeprov, probemod, probefunc, execname); stack(); @@ -56,3 +79,30 @@ linuxulator*:util:linux_driver_get_major /* ustack(); */ /* needs to be enabled when PID tracing is available in FreeBSD dtrace */ } +linuxulator*:time:linux_to_native_clockid:unknown_clockid +{ + printf("INFO: Application %s tried to use unknown clockid %d. Please report this to freebsd-emulation@FreeBSD.org.\n", execname, arg0); +} + +linuxulator*:time:linux_to_native_clockid:unsupported_clockid, +linuxulator*:time:linux_clock_nanosleep:unsupported_clockid +{ + printf("WARNING: Application %s tried to use unsupported clockid (%d), this may or may not be a problem for the application.\nPatches to support this clockid are welcome on the freebsd-emulation@FreeBSD.org mailinglist.\n", execname, arg0); +} + +linuxulator*:time:linux_clock_nanosleep:unsupported_flags +{ + printf("WARNING: Application %s tried to use unsupported flags (%d), this may or may not be a problem for the application.\nPatches to support those flags are welcome on the freebsd-emulation@FreeBSD.org mailinglist.\n", execname, arg0); +} + +linuxulator*:sysctl:linux_sysctl:wrong_length +{ + printf("ERROR: Application %s issued a sysctl which failed the length restrictions.\nThe length passed is %d, the min length supported is 1 and the max length supported is %d.\n", execname, arg0, arg1); + stack(); + /* ustack(); */ +} + +linuxulator*:sysctl:linux_sysctl:unsupported_sysctl +{ + printf("ERROR: Application %s issued an unsupported sysctl (%s).\nPatches to support this sysctl are welcome on the freebsd-emulation@FreeBSD.org mailinglist.\n", execname, arg0); +} Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c ============================================================================== --- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c Fri Jan 2 13:48:02 2009 (r186701) +++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_sysctl.c Fri Jan 2 13:56:45 2009 (r186702) @@ -30,12 +30,15 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_kdtrace.h" #include +#include #include #include #include #include +#include #include #include #include @@ -49,6 +52,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include #define LINUX_CTL_KERN 1 #define LINUX_CTL_VM 2 @@ -65,23 +69,59 @@ __FBSDID("$FreeBSD$"); #define LINUX_KERN_OSREV 3 #define LINUX_KERN_VERSION 4 +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); +LIN_SDT_PROBE_DEFINE(sysctl, handle_string, entry); +LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, entry, 0, + "struct l___sysctl_args *"); +LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, entry, 1, "char *"); +LIN_SDT_PROBE_DEFINE(sysctl, handle_string, copyout_error); +LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(sysctl, handle_string, return); +LIN_SDT_PROBE_ARGTYPE(sysctl, handle_string, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, entry); +LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, entry, 0, + "struct l___sysctl_args *"); +LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, copyin_error); +LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, wrong_length); +LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, wrong_length, 0, + "int"); +LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, wrong_length, 1, + "int"); +LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, unsupported_sysctl); +LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, unsupported_sysctl, 0, + "char *"); +LIN_SDT_PROBE_DEFINE(sysctl, linux_sysctl, return); +LIN_SDT_PROBE_ARGTYPE(sysctl, linux_sysctl, return, 0, "int"); + static int handle_string(struct l___sysctl_args *la, char *value) { int error; + LIN_SDT_PROBE(sysctl, handle_string, entry, la, value, 0, 0, 0); + if (la->oldval != 0) { l_int len = strlen(value); error = copyout(value, PTRIN(la->oldval), len + 1); if (!error && la->oldlenp != 0) error = copyout(&len, PTRIN(la->oldlenp), sizeof(len)); - if (error) + if (error) { + /* XXX: Separate probes for the 2 copyouts? */ + LIN_SDT_PROBE(sysctl, handle_string, copyout_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(sysctl, handle_string, return, error, + 0, 0, 0, 0); return (error); + } } - if (la->newval != 0) + if (la->newval != 0) { + LIN_SDT_PROBE(sysctl, handle_string, return, ENOTDIR, 0, 0, 0, + 0); return (ENOTDIR); + } + LIN_SDT_PROBE(sysctl, handle_string, return, 0, 0, 0, 0, 0); return (0); } @@ -92,17 +132,34 @@ linux_sysctl(struct thread *td, struct l struct sbuf *sb; l_int *mib; int error, i; + char *sysctl_string; + + LIN_SDT_PROBE(sysctl, linux_sysctl, entry, args->args, 0, 0, 0, 0); error = copyin(args->args, &la, sizeof(la)); - if (error) + if (error) { + LIN_SDT_PROBE(sysctl, linux_sysctl, copyin_error, error, 0, + 0, 0, 0); + LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0, 0, 0, + 0); return (error); + } - if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) + if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) { + LIN_SDT_PROBE(sysctl, linux_sysctl, wrong_length, la.nlen, + LINUX_CTL_MAXNAME, 0, 0, 0); + LIN_SDT_PROBE(sysctl, linux_sysctl, return, ENOTDIR, 0, 0, 0, + 0); return (ENOTDIR); + } mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int)); if (error) { + LIN_SDT_PROBE(sysctl, linux_sysctl, copyin_error, error, 0, + 0, 0, 0); + LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0, 0, 0, + 0); free(mib, M_TEMP); return (error); } @@ -116,6 +173,8 @@ linux_sysctl(struct thread *td, struct l case LINUX_KERN_VERSION: error = handle_string(&la, version); free(mib, M_TEMP); + LIN_SDT_PROBE(sysctl, linux_sysctl, return, error, 0, + 0, 0, 0); return (error); default: break; @@ -128,16 +187,23 @@ linux_sysctl(struct thread *td, struct l sb = sbuf_new(NULL, NULL, 20 + la.nlen * 5, SBUF_AUTOEXTEND); if (sb == NULL) { linux_msg(td, "sysctl is not implemented"); + LIN_SDT_PROBE(sysctl, linux_sysctl, unsupported_sysctl, + "ENOMEM", 0, 0, 0, 0); } else { sbuf_printf(sb, "sysctl "); for (i = 0; i < la.nlen; i++) sbuf_printf(sb, "%c%d", (i) ? ',' : '{', mib[i]); sbuf_printf(sb, "} is not implemented"); sbuf_finish(sb); - linux_msg(td, "%s", sbuf_data(sb)); + sysctl_string = sbuf_data(sb); + linux_msg(td, "%s", sysctl_string); + LIN_SDT_PROBE(sysctl, linux_sysctl, unsupported_sysctl, + sysctl_string, 0, 0, 0, 0); sbuf_delete(sb); } free(mib, M_TEMP); + + LIN_SDT_PROBE(sysctl, linux_sysctl, return, ENOTDIR, 0, 0, 0, 0); return (ENOTDIR); } Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c ============================================================================== --- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c Fri Jan 2 13:48:02 2009 (r186701) +++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_time.c Fri Jan 2 13:56:45 2009 (r186702) @@ -43,10 +43,13 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c #endif #include "opt_compat.h" +#include "opt_kdtrace.h" #include +#include #include #include +#include #include #include #include @@ -63,33 +66,154 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c #include #endif -static void native_to_linux_timespec(struct l_timespec *, - struct timespec *); -static int linux_to_native_timespec(struct timespec *, - struct l_timespec *); -static int linux_to_native_clockid(clockid_t *, clockid_t); +#include + +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); +LIN_SDT_PROBE_DEFINE(time, native_to_linux_timespec, entry); +LIN_SDT_PROBE_ARGTYPE(time, native_to_linux_timespec, entry, 0, + "struct l_timespec *"); +LIN_SDT_PROBE_ARGTYPE(time, native_to_linux_timespec, entry, 1, + "struct timespec *"); +LIN_SDT_PROBE_DEFINE(time, native_to_linux_timespec, return); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_timespec, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, entry, 0, + "struct timespec *"); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, entry, 1, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_timespec, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_timespec, return, 0, + "int"); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, entry, 0, + "clockid_t *"); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, entry, 1, + "clockid_t"); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, unsupported_clockid); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, unsupported_clockid, 0, + "clockid_t"); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, unknown_clockid); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, unknown_clockid, 0, + "clockid_t"); +LIN_SDT_PROBE_DEFINE(time, linux_to_native_clockid, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_to_native_clockid, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, entry, 0, "clockid_t"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, entry, 1, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, conversion_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, conversion_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, gettime_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, gettime_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, copyout_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_gettime, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_gettime, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, entry, 0, "clockid_t"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, entry, 1, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, conversion_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, conversion_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, settime_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, settime_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, copyin_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, copyin_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_settime, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_settime, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, entry, 0, "clockid_t"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, entry, 1, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, nullcall); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, conversion_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, conversion_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, getres_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, getres_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, copyout_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_getres, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_getres, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, entry, 0, + "const struct l_timespec *"); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, entry, 1, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, conversion_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, conversion_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, nanosleep_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, nanosleep_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, copyout_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, copyin_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, copyin_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_nanosleep, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_nanosleep, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, entry); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 0, + "clockid_t"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 1, + "int"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 2, + "struct l_timespec *"); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, entry, 3, + "struct l_timespec *"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, conversion_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, conversion_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, nanosleep_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, nanosleep_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, copyout_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, copyin_error); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, copyin_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, unsupported_flags); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, unsupported_flags, 0, "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, unsupported_clockid); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, unsupported_clockid, 0, + "int"); +LIN_SDT_PROBE_DEFINE(time, linux_clock_nanosleep, return); +LIN_SDT_PROBE_ARGTYPE(time, linux_clock_nanosleep, return, 0, "int"); static void native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) { + + LIN_SDT_PROBE(time, native_to_linux_timespec, entry, ltp, ntp, + 0, 0, 0); + ltp->tv_sec = ntp->tv_sec; ltp->tv_nsec = ntp->tv_nsec; + + LIN_SDT_PROBE(time, native_to_linux_timespec, return, 0, 0, + 0, 0, 0); } static int linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) { - if (ltp->tv_sec < 0 || ltp->tv_nsec > (l_long)999999999L) + + LIN_SDT_PROBE(time, linux_to_native_timespec, entry, ntp, ltp, + 0, 0, 0); + + if (ltp->tv_sec < 0 || ltp->tv_nsec > (l_long)999999999L) { + LIN_SDT_PROBE(time, linux_to_native_timespec, return, EINVAL, + 0, 0, 0, 0); return (EINVAL); + } ntp->tv_sec = ltp->tv_sec; ntp->tv_nsec = ltp->tv_nsec; + LIN_SDT_PROBE(time, linux_to_native_timespec, return, 0, 0, + 0, 0, 0); return (0); } static int linux_to_native_clockid(clockid_t *n, clockid_t l) { + + LIN_SDT_PROBE(time, linux_to_native_clockid, entry, n, l, + 0, 0, 0); + switch (l) { case LINUX_CLOCK_REALTIME: *n = CLOCK_REALTIME; @@ -101,11 +225,23 @@ linux_to_native_clockid(clockid_t *n, cl case LINUX_CLOCK_THREAD_CPUTIME_ID: case LINUX_CLOCK_REALTIME_HR: case LINUX_CLOCK_MONOTONIC_HR: + LIN_SDT_PROBE(time, linux_to_native_clockid, + unsupported_clockid, l, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_to_native_clockid, return, EINVAL, + 0, 0, 0, 0); + return (EINVAL); + break; default: + LIN_SDT_PROBE(time, linux_to_native_clockid, + unknown_clockid, l, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_to_native_clockid, return, EINVAL, + 0, 0, 0, 0); return (EINVAL); break; } + LIN_SDT_PROBE(time, linux_to_native_clockid, return, 0, 0, + 0, 0, 0); return (0); } @@ -117,15 +253,34 @@ linux_clock_gettime(struct thread *td, s clockid_t nwhich = 0; /* XXX: GCC */ struct timespec tp; + LIN_SDT_PROBE(time, linux_clock_gettime, entry, args->which, args->tp, + 0, 0, 0); + error = linux_to_native_clockid(&nwhich, args->which); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_gettime, conversion_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0, + 0); return (error); + } error = kern_clock_gettime(td, nwhich, &tp); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_gettime, gettime_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0, + 0); return (error); + } native_to_linux_timespec(<s, &tp); - return (copyout(<s, args->tp, sizeof lts)); + error = copyout(<s, args->tp, sizeof lts); + if (error != 0) + LIN_SDT_PROBE(time, linux_clock_gettime, copyout_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_gettime, return, error, 0, 0, 0, + 0); + return (error); } int @@ -136,17 +291,41 @@ linux_clock_settime(struct thread *td, s int error; clockid_t nwhich = 0; /* XXX: GCC */ + LIN_SDT_PROBE(time, linux_clock_settime, entry, args->which, args->tp, + 0, 0, 0); + error = linux_to_native_clockid(&nwhich, args->which); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_settime, conversion_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0, + 0); return (error); + } error = copyin(args->tp, <s, sizeof lts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_settime, copyin_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0, + 0); return (error); + } error = linux_to_native_timespec(&ts, <s); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_settime, conversion_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0, + 0); return (error); + } - return (kern_clock_settime(td, nwhich, &ts)); + error = kern_clock_settime(td, nwhich, &ts); + if (error != 0) + LIN_SDT_PROBE(time, linux_clock_settime, settime_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_settime, return, error, 0, 0, 0, + 0); + return (error); } int @@ -157,18 +336,41 @@ linux_clock_getres(struct thread *td, st int error; clockid_t nwhich = 0; /* XXX: GCC */ - if (args->tp == NULL) + LIN_SDT_PROBE(time, linux_clock_getres, entry, args->which, args->tp, + 0, 0, 0); + + if (args->tp == NULL) { + LIN_SDT_PROBE(time, linux_clock_getres, nullcall, 0, 0, 0, 0, + 0); + LIN_SDT_PROBE(time, linux_clock_getres, return, 0, 0, 0, 0, 0); return (0); + } error = linux_to_native_clockid(&nwhich, args->which); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_getres, conversion_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0, + 0); return (error); + } error = kern_clock_getres(td, nwhich, &ts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_getres, getres_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0, + 0); return (error); + } native_to_linux_timespec(<s, &ts); - return (copyout(<s, args->tp, sizeof lts)); + error = copyout(<s, args->tp, sizeof lts); + if (error != 0) + LIN_SDT_PROBE(time, linux_clock_getres, copyout_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_getres, return, error, 0, 0, 0, + 0); + return (error); } int @@ -179,9 +381,17 @@ linux_nanosleep(struct thread *td, struc struct timespec rqts, rmts; int error; + LIN_SDT_PROBE(time, linux_nanosleep, entry, args->rqtp, args->rmtp, + 0, 0, 0); + error = copyin(args->rqtp, &lrqts, sizeof lrqts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_nanosleep, copyin_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0, + 0); return (error); + } if (args->rmtp != NULL) rmtp = &rmts; @@ -189,19 +399,35 @@ linux_nanosleep(struct thread *td, struc rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_nanosleep, conversion_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0, + 0); return (error); + } error = kern_nanosleep(td, &rqts, rmtp); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_nanosleep, nanosleep_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_nanosleep, return, error, 0, 0, 0, + 0); return (error); + } if (args->rmtp != NULL) { native_to_linux_timespec(&lrmts, rmtp); error = copyout(&lrmts, args->rmtp, sizeof(lrmts)); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_nanosleep, copyout_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_nanosleep, return, error, + 0, 0, 0, 0); return (error); + } } + LIN_SDT_PROBE(time, linux_nanosleep, return, 0, 0, 0, 0, 0); return (0); } @@ -213,15 +439,33 @@ linux_clock_nanosleep(struct thread *td, struct timespec rqts, rmts; int error; - if (args->flags != 0) + LIN_SDT_PROBE(time, linux_clock_nanosleep, entry, args->which, + args->flags, args->rqtp, args->rmtp, 0); + + if (args->flags != 0) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, unsupported_flags, + args->flags, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, EINVAL, 0, + 0, 0, 0); return (EINVAL); /* XXX deal with TIMER_ABSTIME */ + } - if (args->which != LINUX_CLOCK_REALTIME) + if (args->which != LINUX_CLOCK_REALTIME) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, unsupported_clockid, + args->which, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, EINVAL, 0, + 0, 0, 0); return (EINVAL); + } error = copyin(args->rqtp, &lrqts, sizeof lrqts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, copyin_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0, + 0, 0, 0); return (error); + } if (args->rmtp != NULL) rmtp = &rmts; @@ -229,18 +473,34 @@ linux_clock_nanosleep(struct thread *td, rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, conversion_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0, + 0, 0, 0); return (error); + } error = kern_nanosleep(td, &rqts, rmtp); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, nanosleep_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, error, 0, + 0, 0, 0); return (error); + } if (args->rmtp != NULL) { native_to_linux_timespec(&lrmts, rmtp); error = copyout(&lrmts, args->rmtp, sizeof lrmts ); - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE(time, linux_clock_nanosleep, + copyout_error, error, 0, 0, 0, 0); + LIN_SDT_PROBE(time, linux_nanosleep, return, error, + 0, 0, 0, 0); return (error); + } } + LIN_SDT_PROBE(time, linux_clock_nanosleep, return, 0, 0, 0, 0, 0); return (0); } Modified: user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c ============================================================================== --- user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c Fri Jan 2 13:48:02 2009 (r186701) +++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/linux_uid16.c Fri Jan 2 13:56:45 2009 (r186702) @@ -28,14 +28,17 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_kdtrace.h" #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -49,6 +52,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include DUMMY(setfsuid16); DUMMY(setfsgid16); @@ -57,21 +61,101 @@ DUMMY(getresgid16); #define CAST_NOCHG(x) ((x == 0xFFFF) ? -1 : x) +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); +LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 0, "char *"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 1, "l_uid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, entry, 2, "l_gid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, conv_path); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, conv_path, 0, "char *"); +LIN_SDT_PROBE_DEFINE(uid16, linux_chown16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_chown16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 0, "char *"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 1, "l_uid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, entry, 2, "l_gid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, conv_path); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, conv_path, 0, "char *"); +LIN_SDT_PROBE_DEFINE(uid16, linux_lchown16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_lchown16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, entry, 0, "l_uint"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, entry, 1, "l_gid16_t *"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, copyin_error); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, copyin_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, priv_check_cred_error); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, priv_check_cred_error, 0, + "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgroups16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgroups16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, entry, 0, "l_uint"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, entry, 1, "l_gid16_t *"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, copyout_error); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, copyout_error, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getgroups16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgroups16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getgid16, entry); +LIN_SDT_PROBE_DEFINE(uid16, linux_getgid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getgid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getuid16, entry); +LIN_SDT_PROBE_DEFINE(uid16, linux_getuid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getuid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_getegid16, entry); +LIN_SDT_PROBE_DEFINE(uid16, linux_getegid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_getegid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_geteuid16, entry); +LIN_SDT_PROBE_DEFINE(uid16, linux_geteuid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_geteuid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgid16, entry, 0, "l_gid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setgid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setgid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setuid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setuid16, entry, 0, "l_uid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setuid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setuid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setregid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, entry, 0, "l_git16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, entry, 1, "l_git16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setregid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setregid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setreuid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, entry, 0, "l_uid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, entry, 1, "l_uid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setreuid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setreuid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setresgid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 0, "l_gid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 1, "l_gid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, entry, 2, "l_gid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setresgid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresgid16, return, 0, "int"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setresuid16, entry); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 0, "l_uid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 1, "l_uid16_t"); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, entry, 2, "l_uid16_t"); +LIN_SDT_PROBE_DEFINE(uid16, linux_setresuid16, return); +LIN_SDT_PROBE_ARGTYPE(uid16, linux_setresuid16, return, 0, "int"); + int linux_chown16(struct thread *td, struct linux_chown16_args *args) { char *path; int error; + LIN_SDT_PROBE(uid16, linux_chown16, entry, args->path, args->uid, + args->gid, 0, 0); + LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chown16)) - printf(ARGS(chown16, "%s, %d, %d"), path, args->uid, args->gid); -#endif + LIN_SDT_PROBE(uid16, linux_chown16, conv_path, path, 0, 0, 0, 0); + error = kern_chown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid), CAST_NOCHG(args->gid)); LFREEPATH(path); + + LIN_SDT_PROBE(uid16, linux_chown16, return, error, 0, 0, 0, 0); return (error); } @@ -81,16 +165,18 @@ linux_lchown16(struct thread *td, struct char *path; int error; + LIN_SDT_PROBE(uid16, linux_lchown16, entry, args->path, args->uid, + args->gid, 0, 0); + LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(lchown16)) - printf(ARGS(lchown16, "%s, %d, %d"), path, args->uid, - args->gid); -#endif + LIN_SDT_PROBE(uid16, linux_lchown16, conv_path, path, 0, 0, 0, 0); + error = kern_lchown(td, path, UIO_SYSSPACE, CAST_NOCHG(args->uid), CAST_NOCHG(args->gid)); LFREEPATH(path); + + LIN_SDT_PROBE(uid16, linux_lchown16, return, error, 0, 0, 0, 0); return (error); } @@ -103,17 +189,25 @@ linux_setgroups16(struct thread *td, str int ngrp, error; struct proc *p; -#ifdef DEBUG - if (ldebug(setgroups16)) - printf(ARGS(setgroups16, "%d, *"), args->gidsetsize); -#endif + LIN_SDT_PROBE(uid16, linux_setgroups16, entry, args->gidsetsize, + args->gidset, 0, 0, 0); ngrp = args->gidsetsize; - if (ngrp < 0 || ngrp >= NGROUPS) + if (ngrp < 0 || ngrp >= NGROUPS) { + LIN_SDT_PROBE(uid16, linux_setgroups16, return, EINVAL, 0, 0, + 0, 0); return (EINVAL); + } + error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t)); - if (error) + if (error) { + LIN_SDT_PROBE(uid16, linux_setgroups16, copyin_error, error, + 0, 0, 0, 0); + LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0, + 0, 0); return (error); + } + newcred = crget(); p = td->td_proc; PROC_LOCK(p); @@ -128,6 +222,11 @@ linux_setgroups16(struct thread *td, str if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS, 0)) != 0) { PROC_UNLOCK(p); crfree(newcred); + + LIN_SDT_PROBE(uid16, linux_setgroups16, priv_check_cred_error, + error, 0, 0, 0, 0); + LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0, + 0, 0); return (error); } @@ -149,6 +248,8 @@ linux_setgroups16(struct thread *td, str p->p_ucred = newcred; PROC_UNLOCK(p); crfree(oldcred); + + LIN_SDT_PROBE(uid16, linux_setgroups16, return, error, 0, 0, 0, 0); return (0); } @@ -160,10 +261,8 @@ linux_getgroups16(struct thread *td, str gid_t *bsd_gidset; int bsd_gidsetsz, ngrp, error; -#ifdef DEBUG - if (ldebug(getgroups16)) - printf(ARGS(getgroups16, "%d, *"), args->gidsetsize); -#endif + LIN_SDT_PROBE(uid16, linux_getgroups16, entry, args->gidsetsize, + args->gidset, 0, 0, 0); cred = td->td_ucred; bsd_gidset = cred->cr_groups; @@ -177,11 +276,16 @@ linux_getgroups16(struct thread *td, str if ((ngrp = args->gidsetsize) == 0) { td->td_retval[0] = bsd_gidsetsz; + + LIN_SDT_PROBE(uid16, linux_getgroups16, return, 0, 0, 0, 0, 0); return (0); } - if (ngrp < bsd_gidsetsz) + if (ngrp < bsd_gidsetsz) { + LIN_SDT_PROBE(uid16, linux_getgroups16, return, EINVAL, 0, 0, + 0, 0); return (EINVAL); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Jan 2 19:55:18 2009 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 8069A106568A; Fri, 2 Jan 2009 19:55:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 695578FC08; Fri, 2 Jan 2009 19:55:18 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n02JtIdl006120; Fri, 2 Jan 2009 19:55:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n02JtHRa006098; Fri, 2 Jan 2009 19:55:17 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200901021955.n02JtHRa006098@svn.freebsd.org> From: Sam Leffler Date: Fri, 2 Jan 2009 19:55:17 +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: r186703 - in user/sam/wifi: . lib/libarchive sys/conf sys/dev/syscons sys/dev/syscons/teken sys/kern sys/net80211 sys/pc98/cbus sys/security/audit sys/sparc64/include sys/sparc64/sparc6... 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: Fri, 02 Jan 2009 19:55:18 -0000 Author: sam Date: Fri Jan 2 19:55:17 2009 New Revision: 186703 URL: http://svn.freebsd.org/changeset/base/186703 Log: sync with HEAD Added: user/sam/wifi/sys/dev/syscons/scterm-teken.c - copied unchanged from r186686, head/sys/dev/syscons/scterm-teken.c user/sam/wifi/sys/dev/syscons/teken/ - copied from r186686, head/sys/dev/syscons/teken/ user/sam/wifi/sys/pc98/cbus/sctermvar.h - copied unchanged from r186686, head/sys/pc98/cbus/sctermvar.h Deleted: user/sam/wifi/sys/dev/syscons/scterm-dumb.c user/sam/wifi/sys/dev/syscons/scterm-sc.c user/sam/wifi/sys/dev/syscons/sctermvar.h Modified: user/sam/wifi/ (props changed) user/sam/wifi/lib/libarchive/archive_read_support_compression_gzip.c user/sam/wifi/sys/conf/files user/sam/wifi/sys/conf/files.amd64 user/sam/wifi/sys/conf/files.i386 user/sam/wifi/sys/conf/files.ia64 user/sam/wifi/sys/conf/files.powerpc user/sam/wifi/sys/conf/files.sparc64 user/sam/wifi/sys/dev/syscons/scterm.c user/sam/wifi/sys/dev/syscons/syscons.c user/sam/wifi/sys/dev/syscons/syscons.h user/sam/wifi/sys/kern/kern_mbuf.c user/sam/wifi/sys/kern/kern_sysctl.c user/sam/wifi/sys/kern/uipc_usrreq.c user/sam/wifi/sys/net80211/ieee80211_hostap.c user/sam/wifi/sys/net80211/ieee80211_node.c user/sam/wifi/sys/net80211/ieee80211_output.c user/sam/wifi/sys/net80211/ieee80211_wds.c user/sam/wifi/sys/pc98/cbus/scterm-sck.c user/sam/wifi/sys/security/audit/audit_pipe.c user/sam/wifi/sys/sparc64/include/tlb.h user/sam/wifi/sys/sparc64/sparc64/machdep.c user/sam/wifi/sys/sparc64/sparc64/pmap.c user/sam/wifi/sys/sys/elf64.h user/sam/wifi/sys/sys/elf_common.h user/sam/wifi/sys/sys/elf_generic.h user/sam/wifi/sys/sys/file.h user/sam/wifi/sys/sys/imgact_elf.h user/sam/wifi/sys/sys/link_elf.h user/sam/wifi/sys/vm/vm_map.c user/sam/wifi/sys/vm/vm_map.h user/sam/wifi/usr.sbin/mergemaster/mergemaster.8 user/sam/wifi/usr.sbin/mergemaster/mergemaster.sh user/sam/wifi/usr.sbin/sysinstall/menus.c Modified: user/sam/wifi/lib/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- user/sam/wifi/lib/libarchive/archive_read_support_compression_gzip.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/lib/libarchive/archive_read_support_compression_gzip.c Fri Jan 2 19:55:17 2009 (r186703) @@ -428,8 +428,9 @@ gzip_source_read(struct archive_read_sou "Failed to clean up gzip decompressor"); return (ARCHIVE_FATAL); } - /* Restart header parser with the next block. */ - state->header_state = state->header_done = 0; + /* zlib has been torn down */ + state->header_done = 0; + state->eof = 1; /* FALL THROUGH */ case Z_OK: /* Decompressor made some progress. */ /* If we filled our buffer, update stats and return. */ Modified: user/sam/wifi/sys/conf/files ============================================================================== --- user/sam/wifi/sys/conf/files Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files Fri Jan 2 19:55:17 2009 (r186703) @@ -75,6 +75,11 @@ pccarddevs.h standard \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" +teken_state.h optional sc \ + dependency "$S/dev/syscons/teken/gensequences $S/dev/syscons/teken/sequences" \ + compile-with "${AWK} -f $S/dev/syscons/teken/gensequences $S/dev/syscons/teken/sequences > teken_state.h" \ + no-obj no-implicit-rule before-depend \ + clean "teken_state.h" usbdevs.h optional usb \ dependency "$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \ compile-with "${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -h" \ @@ -1424,7 +1429,6 @@ dev/syscons/logo/logo_saver.c optional l dev/syscons/rain/rain_saver.c optional rain_saver dev/syscons/schistory.c optional sc dev/syscons/scmouse.c optional sc -dev/syscons/scterm-dumb.c optional sc dev/syscons/scterm.c optional sc dev/syscons/scvidctl.c optional sc dev/syscons/snake/snake_saver.c optional snake_saver Modified: user/sam/wifi/sys/conf/files.amd64 ============================================================================== --- user/sam/wifi/sys/conf/files.amd64 Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files.amd64 Fri Jan 2 19:55:17 2009 (r186703) @@ -196,9 +196,10 @@ dev/sio/sio_pci.c optional sio pci dev/sio/sio_puc.c optional sio puc dev/speaker/spkr.c optional speaker dev/syscons/apm/apm_saver.c optional apm_saver apm -dev/syscons/scterm-sc.c optional sc +dev/syscons/scterm-teken.c optional sc dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc +dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/atrtc.c standard Modified: user/sam/wifi/sys/conf/files.i386 ============================================================================== --- user/sam/wifi/sys/conf/files.i386 Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files.i386 Fri Jan 2 19:55:17 2009 (r186703) @@ -220,10 +220,11 @@ dev/sio/sio_puc.c optional sio puc dev/speaker/spkr.c optional speaker dev/sr/if_sr_isa.c optional sr isa dev/syscons/apm/apm_saver.c optional apm_saver apm -dev/syscons/scterm-sc.c optional sc +dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc +dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_i386.c optional uart dev/acpica/acpi_if.m standard dev/wpi/if_wpi.c optional wpi Modified: user/sam/wifi/sys/conf/files.ia64 ============================================================================== --- user/sam/wifi/sys/conf/files.ia64 Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files.ia64 Fri Jan 2 19:55:17 2009 (r186703) @@ -57,9 +57,10 @@ dev/fb/fb.c optional fb | vga dev/fb/vga.c optional vga dev/hwpmc/hwpmc_ia64.c optional hwpmc dev/kbd/kbd.c optional atkbd | sc | ukbd -dev/syscons/scterm-sc.c optional sc +dev/syscons/scterm-teken.c optional sc dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc +dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_ia64.c optional uart dev/acpica/acpi_if.m standard ia64/acpica/OsdEnvironment.c optional acpi Modified: user/sam/wifi/sys/conf/files.powerpc ============================================================================== --- user/sam/wifi/sys/conf/files.powerpc Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files.powerpc Fri Jan 2 19:55:17 2009 (r186703) @@ -39,8 +39,9 @@ dev/powermac_nvram/powermac_nvram.c opti dev/quicc/quicc_bfe_ocp.c optional quicc mpc85xx dev/scc/scc_bfe_macio.c optional scc powermac dev/syscons/scgfbrndr.c optional sc -dev/syscons/scterm-sc.c optional sc +dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc +dev/syscons/teken/teken.c optional sc dev/tsec/if_tsec.c optional tsec dev/tsec/if_tsec_ocp.c optional tsec mpc85xx dev/uart/uart_bus_ocp.c optional uart mpc85xx Modified: user/sam/wifi/sys/conf/files.sparc64 ============================================================================== --- user/sam/wifi/sys/conf/files.sparc64 Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/conf/files.sparc64 Fri Jan 2 19:55:17 2009 (r186703) @@ -55,8 +55,9 @@ dev/pcf/pcf_ebus.c optional pcf ebus dev/sound/sbus/cs4231.c optional snd_audiocs ebus | \ snd_audiocs sbus dev/syscons/scgfbrndr.c optional sc -dev/syscons/scterm-sc.c optional sc +dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc +dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_sparc64.c optional uart dev/uart/uart_kbd_sun.c optional uart sc kern/syscalls.c optional ktr Copied: user/sam/wifi/sys/dev/syscons/scterm-teken.c (from r186686, head/sys/dev/syscons/scterm-teken.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sam/wifi/sys/dev/syscons/scterm-teken.c Fri Jan 2 19:55:17 2009 (r186703, copy of r186686, head/sys/dev/syscons/scterm-teken.c) @@ -0,0 +1,504 @@ +/*- + * Copyright (c) 1999 Kazutaka YOKOTA + * All rights reserved. + * + * Copyright (c) 2008-2009 Ed Schouten + * 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 as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_syscons.h" + +#include +#include +#include +#include +#include + +#if defined(__sparc64__) || defined(__powerpc__) +#include +#else +#include +#endif + +#include + +#include + +static void scteken_revattr(unsigned char, teken_attr_t *); + +static sc_term_init_t scteken_init; +static sc_term_term_t scteken_term; +static sc_term_puts_t scteken_puts; +static sc_term_ioctl_t scteken_ioctl; +static sc_term_default_attr_t scteken_default_attr; +static sc_term_clear_t scteken_clear; +static sc_term_input_t scteken_input; +static void scteken_nop(void); + +typedef struct { + teken_t ts_teken; + int ts_busy; +} teken_stat; + +static teken_stat reserved_teken_stat; + +static sc_term_sw_t sc_term_scteken = { + { NULL, NULL }, + "scteken", /* emulator name */ + "teken terminal", /* description */ + "*", /* matching renderer */ + sizeof(teken_stat), /* softc size */ + 0, + scteken_init, + scteken_term, + scteken_puts, + scteken_ioctl, + (sc_term_reset_t *)scteken_nop, + scteken_default_attr, + scteken_clear, + (sc_term_notify_t *)scteken_nop, + scteken_input, +}; + +SCTERM_MODULE(scteken, sc_term_scteken); + +static tf_bell_t scteken_bell; +static tf_cursor_t scteken_cursor; +static tf_putchar_t scteken_putchar; +static tf_fill_t scteken_fill; +static tf_copy_t scteken_copy; +static tf_param_t scteken_param; +static tf_respond_t scteken_respond; + +static const teken_funcs_t scteken_funcs = { + .tf_bell = scteken_bell, + .tf_cursor = scteken_cursor, + .tf_putchar = scteken_putchar, + .tf_fill = scteken_fill, + .tf_copy = scteken_copy, + .tf_param = scteken_param, + .tf_respond = scteken_respond, +}; + +static int +scteken_init(scr_stat *scp, void **softc, int code) +{ + teken_stat *ts = scp->ts; + teken_pos_t tp; + + if (*softc == NULL) { + if (reserved_teken_stat.ts_busy) + return (EINVAL); + *softc = &reserved_teken_stat; + } + ts = *softc; + + switch (code) { + case SC_TE_COLD_INIT: + ++sc_term_scteken.te_refcount; + ts->ts_busy = 1; + /* FALLTHROUGH */ + case SC_TE_WARM_INIT: + teken_init(&ts->ts_teken, &scteken_funcs, scp); + + tp.tp_row = scp->ysize; + tp.tp_col = scp->xsize; + teken_set_winsize(&ts->ts_teken, &tp); + + tp.tp_row = scp->cursor_pos / scp->xsize; + tp.tp_col = scp->cursor_pos % scp->xsize; + teken_set_cursor(&ts->ts_teken, &tp); + break; + } + + return (0); +} + +static int +scteken_term(scr_stat *scp, void **softc) +{ + + if (*softc == &reserved_teken_stat) { + *softc = NULL; + reserved_teken_stat.ts_busy = 0; + } + --sc_term_scteken.te_refcount; + + return (0); +} + +static void +scteken_puts(scr_stat *scp, u_char *buf, int len) +{ + teken_stat *ts = scp->ts; + + scp->sc->write_in_progress++; + teken_input(&ts->ts_teken, buf, len); + scp->sc->write_in_progress--; +} + +static int +scteken_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, + struct thread *td) +{ + vid_info_t *vi; + + switch (cmd) { + case GIO_ATTR: /* get current attributes */ + *(int*)data = SC_NORM_ATTR; + return (0); + case CONS_GETINFO: /* get current (virtual) console info */ + /* XXX: INCORRECT! */ + vi = (vid_info_t *)data; + if (vi->size != sizeof(struct vid_info)) + return EINVAL; + vi->mv_norm.fore = SC_NORM_ATTR & 0x0f; + vi->mv_norm.back = (SC_NORM_ATTR >> 4) & 0x0f; + vi->mv_rev.fore = SC_NORM_ATTR & 0x0f; + vi->mv_rev.back = (SC_NORM_ATTR >> 4) & 0x0f; + /* + * The other fields are filled by the upper routine. XXX + */ + return (ENOIOCTL); + } + + return (ENOIOCTL); +} + +static void +scteken_default_attr(scr_stat *scp, int color, int rev_color) +{ + teken_stat *ts = scp->ts; + teken_attr_t ta; + + scteken_revattr(color, &ta); + teken_set_defattr(&ts->ts_teken, &ta); +} + +static void +scteken_clear(scr_stat *scp) +{ + + sc_move_cursor(scp, 0, 0); + sc_vtb_clear(&scp->vtb, scp->sc->scr_map[0x20], SC_NORM_ATTR << 8); + mark_all(scp); +} + +static int +scteken_input(scr_stat *scp, int c, struct tty *tp) +{ + + return FALSE; +} + +static void +scteken_nop(void) +{ + +} + +/* + * libteken routines. + */ + +static const unsigned char fgcolors_normal[TC_NCOLORS] = { + FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, + FG_BLUE, FG_MAGENTA, FG_CYAN, FG_LIGHTGREY, +}; + +static const unsigned char fgcolors_bold[TC_NCOLORS] = { + FG_DARKGREY, FG_LIGHTRED, FG_LIGHTGREEN, FG_YELLOW, + FG_LIGHTBLUE, FG_LIGHTMAGENTA, FG_LIGHTCYAN, FG_WHITE, +}; + +static const unsigned char bgcolors[TC_NCOLORS] = { + BG_BLACK, BG_RED, BG_GREEN, BG_BROWN, + BG_BLUE, BG_MAGENTA, BG_CYAN, BG_LIGHTGREY, +}; + +static void +scteken_revattr(unsigned char color, teken_attr_t *a) +{ + teken_color_t fg, bg; + + /* + * XXX: Reverse conversion of syscons to teken attributes. Not + * realiable. Maybe we should turn it into a 1:1 mapping one of + * these days? + */ + + a->ta_format = 0; + a->ta_fgcolor = TC_WHITE; + a->ta_bgcolor = TC_BLACK; + +#ifdef FG_BLINK + if (color & FG_BLINK) { + a->ta_format |= TF_BLINK; + color &= ~FG_BLINK; + } +#endif /* FG_BLINK */ + + for (fg = 0; fg < TC_NCOLORS; fg++) { + for (bg = 0; bg < TC_NCOLORS; bg++) { + if ((fgcolors_normal[fg] | bgcolors[bg]) == color) { + a->ta_fgcolor = fg; + a->ta_bgcolor = bg; + return; + } + + if ((fgcolors_bold[fg] | bgcolors[bg]) == color) { + a->ta_fgcolor = fg; + a->ta_bgcolor = bg; + a->ta_format |= TF_BOLD; + return; + } + } + } +} + +static inline unsigned int +scteken_attr(const teken_attr_t *a) +{ + unsigned int attr = 0; + + if (a->ta_format & TF_BOLD) + attr |= fgcolors_bold[a->ta_fgcolor]; + else + attr |= fgcolors_normal[a->ta_fgcolor]; + attr |= bgcolors[a->ta_bgcolor]; + +#ifdef FG_UNDERLINE + if (a->ta_format & TF_UNDERLINE) + attr |= FG_UNDERLINE; +#endif /* FG_UNDERLINE */ +#ifdef FG_BLINK + if (a->ta_format & TF_BLINK) + attr |= FG_BLINK; +#endif /* FG_BLINK */ + + return (attr << 8); +} + +static void +scteken_bell(void *arg) +{ + scr_stat *scp = arg; + + sc_bell(scp, scp->bell_pitch, scp->bell_duration); +} + +static void +scteken_cursor(void *arg, const teken_pos_t *p) +{ + scr_stat *scp = arg; + + sc_move_cursor(scp, p->tp_col, p->tp_row); +} + +static void +scteken_putchar(void *arg, const teken_pos_t *tp, teken_char_t c, + const teken_attr_t *a) +{ + scr_stat *scp = arg; + u_char *map; + u_char ch; + vm_offset_t p; + int cursor, attr; + +#ifdef TEKEN_UTF8 + if (c >= 0x80) { + /* XXX: Don't display UTF-8 yet. */ + attr = (FG_YELLOW|BG_RED) << 8; + ch = '?'; + } else +#endif /* TEKEN_UTF8 */ + { + attr = scteken_attr(a); + ch = c; + } + + map = scp->sc->scr_map; + + cursor = tp->tp_row * scp->xsize + tp->tp_col; + p = sc_vtb_pointer(&scp->vtb, cursor); + sc_vtb_putchar(&scp->vtb, p, map[ch], attr); + + mark_for_update(scp, cursor); + /* + * XXX: Why do we need this? Only marking `cursor' should be + * enough. Without this line, we get artifacts. + */ + mark_for_update(scp, imin(cursor + 1, scp->xsize * scp->ysize - 1)); +} + +static void +scteken_fill(void *arg, const teken_rect_t *r, teken_char_t c, + const teken_attr_t *a) +{ + scr_stat *scp = arg; + u_char *map; + u_char ch; + unsigned int width; + int attr, row; + +#ifdef TEKEN_UTF8 + if (c >= 0x80) { + /* XXX: Don't display UTF-8 yet. */ + attr = (FG_YELLOW|BG_RED) << 8; + ch = '?'; + } else +#endif /* TEKEN_UTF8 */ + { + attr = scteken_attr(a); + ch = c; + } + + map = scp->sc->scr_map; + + if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) { + /* Single contiguous region to fill. */ + sc_vtb_erase(&scp->vtb, r->tr_begin.tp_row * scp->xsize, + (r->tr_end.tp_row - r->tr_begin.tp_row) * scp->xsize, + map[ch], attr); + } else { + /* Fill display line by line. */ + width = r->tr_end.tp_col - r->tr_begin.tp_col; + + for (row = r->tr_begin.tp_row; row < r->tr_end.tp_row; row++) { + sc_vtb_erase(&scp->vtb, r->tr_begin.tp_row * + scp->xsize + r->tr_begin.tp_col, + width, map[ch], attr); + } + } + + /* Mark begin and end positions to be refreshed. */ + mark_for_update(scp, + r->tr_begin.tp_row * scp->xsize + r->tr_begin.tp_col); + mark_for_update(scp, + (r->tr_end.tp_row - 1) * scp->xsize + (r->tr_end.tp_col - 1)); + sc_remove_cutmarking(scp); +} + +static void +scteken_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p) +{ + scr_stat *scp = arg; + unsigned int width; + int src, dst, end; + +#ifndef SC_NO_HISTORY + /* + * We count a line of input as history if we perform a copy of + * one whole line upward. In other words: if a line of text gets + * overwritten by a rectangle that's right below it. + */ + if (scp->history != NULL && + r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize && + r->tr_begin.tp_row == p->tp_row + 1) { + sc_hist_save_one_line(scp, p->tp_row); + } +#endif + + if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) { + /* Single contiguous region to copy. */ + sc_vtb_move(&scp->vtb, r->tr_begin.tp_row * scp->xsize, + p->tp_row * scp->xsize, + (r->tr_end.tp_row - r->tr_begin.tp_row) * scp->xsize); + } else { + /* Copy line by line. */ + width = r->tr_end.tp_col - r->tr_begin.tp_col; + + if (p->tp_row < r->tr_begin.tp_row) { + /* Copy from top to bottom. */ + src = r->tr_begin.tp_row * scp->xsize + + r->tr_begin.tp_col; + end = r->tr_end.tp_row * scp->xsize + + r->tr_end.tp_col; + dst = p->tp_row * scp->xsize + p->tp_col; + + while (src < end) { + sc_vtb_move(&scp->vtb, src, dst, width); + + src += scp->xsize; + dst += scp->xsize; + } + } else { + /* Copy from bottom to top. */ + src = (r->tr_end.tp_row - 1) * scp->xsize + + r->tr_begin.tp_col; + end = r->tr_begin.tp_row * scp->xsize + + r->tr_begin.tp_col; + dst = (p->tp_row + r->tr_end.tp_row - + r->tr_begin.tp_row - 1) * scp->xsize + p->tp_col; + + while (src >= end) { + sc_vtb_move(&scp->vtb, src, dst, width); + + src -= scp->xsize; + dst -= scp->xsize; + } + } + } + + /* Mark begin and end positions to be refreshed. */ + mark_for_update(scp, + p->tp_row * scp->xsize + p->tp_col); + mark_for_update(scp, + (p->tp_row + r->tr_end.tp_row - r->tr_begin.tp_row - 1) * + scp->xsize + + (p->tp_col + r->tr_end.tp_col - r->tr_begin.tp_col - 1)); + sc_remove_cutmarking(scp); +} + +static void +scteken_param(void *arg, int cmd, int value) +{ + scr_stat *scp = arg; + + switch (cmd) { + case TP_SHOWCURSOR: + if (value) { + sc_change_cursor_shape(scp, + CONS_RESET_CURSOR|CONS_LOCAL_CURSOR, -1, -1); + } else { + sc_change_cursor_shape(scp, + CONS_HIDDEN_CURSOR|CONS_LOCAL_CURSOR, -1, -1); + } + break; + case TP_SWITCHVT: + sc_switch_scr(scp->sc, value); + break; + } +} + +static void +scteken_respond(void *arg, const void *buf, size_t len) +{ + scr_stat *scp = arg; + + sc_respond(scp, buf, len); +} Modified: user/sam/wifi/sys/dev/syscons/scterm.c ============================================================================== --- user/sam/wifi/sys/dev/syscons/scterm.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/dev/syscons/scterm.c Fri Jan 2 19:55:17 2009 (r186703) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include SET_DECLARE(scterm_set, sc_term_sw_t); Modified: user/sam/wifi/sys/dev/syscons/syscons.c ============================================================================== --- user/sam/wifi/sys/dev/syscons/syscons.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/dev/syscons/syscons.c Fri Jan 2 19:55:17 2009 (r186703) @@ -2741,6 +2741,16 @@ scinit(int unit, int flags) init_scp(sc, sc->first_vty, scp); sc_vtb_init(&scp->vtb, VTB_MEMORY, scp->xsize, scp->ysize, (void *)sc_buffer, FALSE); + + /* move cursors to the initial positions */ + if (col >= scp->xsize) + col = 0; + if (row >= scp->ysize) + row = scp->ysize - 1; + scp->xpos = col; + scp->ypos = row; + scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col; + if (sc_init_emulator(scp, SC_DFLT_TERM)) sc_init_emulator(scp, "*"); (*scp->tsw->te_default_attr)(scp, @@ -2764,15 +2774,6 @@ scinit(int unit, int flags) sc_vtb_copy(&scp->scr, 0, &scp->vtb, 0, scp->xsize*scp->ysize); #endif - /* move cursors to the initial positions */ - if (col >= scp->xsize) - col = 0; - if (row >= scp->ysize) - row = scp->ysize - 1; - scp->xpos = col; - scp->ypos = row; - scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col; - if (bios_value.cursor_end < scp->font_size) sc->dflt_curs_attr.base = scp->font_size - bios_value.cursor_end - 1; @@ -3569,7 +3570,7 @@ sc_show_font(scr_stat *scp, int page) #endif /* !SC_NO_FONT_LOADING */ void -sc_paste(scr_stat *scp, u_char *p, int count) +sc_paste(scr_stat *scp, const u_char *p, int count) { struct tty *tp; u_char *rmap; @@ -3584,6 +3585,22 @@ sc_paste(scr_stat *scp, u_char *p, int c } void +sc_respond(scr_stat *scp, const u_char *p, int count) +{ + struct tty *tp; + + tp = SC_DEV(scp->sc, scp->sc->cur_scp->index); + if (!tty_opened(tp)) + return; + for (; count > 0; --count) + ttydisc_rint(tp, *p++, 0); +#if 0 + /* XXX: we can't call ttydisc_rint_done() here! */ + ttydisc_rint_done(tp); +#endif +} + +void sc_bell(scr_stat *scp, int pitch, int duration) { if (cold || shutdown_in_progress || !enable_bell) Modified: user/sam/wifi/sys/dev/syscons/syscons.h ============================================================================== --- user/sam/wifi/sys/dev/syscons/syscons.h Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/dev/syscons/syscons.h Fri Jan 2 19:55:17 2009 (r186703) @@ -563,7 +563,8 @@ int sc_clean_up(scr_stat *scp); int sc_switch_scr(sc_softc_t *sc, u_int next_scr); void sc_alloc_scr_buffer(scr_stat *scp, int wait, int discard); int sc_init_emulator(scr_stat *scp, char *name); -void sc_paste(scr_stat *scp, u_char *p, int count); +void sc_paste(scr_stat *scp, const u_char *p, int count); +void sc_respond(scr_stat *scp, const u_char *p, int count); void sc_bell(scr_stat *scp, int pitch, int duration); /* schistory.c */ Modified: user/sam/wifi/sys/kern/kern_mbuf.c ============================================================================== --- user/sam/wifi/sys/kern/kern_mbuf.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/kern/kern_mbuf.c Fri Jan 2 19:55:17 2009 (r186703) @@ -420,6 +420,7 @@ mb_ctor_mbuf(void *mem, int size, void * m->m_pkthdr.csum_data = 0; m->m_pkthdr.tso_segsz = 0; m->m_pkthdr.ether_vtag = 0; + m->m_pkthdr.flowid = 0; SLIST_INIT(&m->m_pkthdr.tags); #ifdef MAC /* If the label init fails, fail the alloc */ @@ -644,6 +645,7 @@ mb_ctor_pack(void *mem, int size, void * m->m_pkthdr.csum_data = 0; m->m_pkthdr.tso_segsz = 0; m->m_pkthdr.ether_vtag = 0; + m->m_pkthdr.flowid = 0; SLIST_INIT(&m->m_pkthdr.tags); #ifdef MAC /* If the label init fails, fail the alloc */ Modified: user/sam/wifi/sys/kern/kern_sysctl.c ============================================================================== --- user/sam/wifi/sys/kern/kern_sysctl.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/kern/kern_sysctl.c Fri Jan 2 19:55:17 2009 (r186703) @@ -1371,8 +1371,11 @@ __sysctl(struct thread *td, struct sysct uap->new, uap->newlen, &j, 0); if (error && error != ENOMEM) return (error); - if (uap->oldlenp) - error = copyout(&j, uap->oldlenp, sizeof(j)); + if (uap->oldlenp) { + int i = copyout(&j, uap->oldlenp, sizeof(j)); + if (i) + return (i); + } return (error); } Modified: user/sam/wifi/sys/kern/uipc_usrreq.c ============================================================================== --- user/sam/wifi/sys/kern/uipc_usrreq.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/kern/uipc_usrreq.c Fri Jan 2 19:55:17 2009 (r186703) @@ -1229,14 +1229,14 @@ unp_connect(struct socket *so, struct so unp3->unp_addr = (struct sockaddr_un *) sa; sa = NULL; } + /* - * unp_peercred management: - * * The connecter's (client's) credentials are copied from its * process structure at the time of connect() (which is now). */ cru2x(td->td_ucred, &unp3->unp_peercred); unp3->unp_flags |= UNP_HAVEPC; + /* * The receiver's (server's) credentials are copied from the * unp_peercred member of socket on which the former called Modified: user/sam/wifi/sys/net80211/ieee80211_hostap.c ============================================================================== --- user/sam/wifi/sys/net80211/ieee80211_hostap.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/net80211/ieee80211_hostap.c Fri Jan 2 19:55:17 2009 (r186703) @@ -355,7 +355,7 @@ hostap_deliver_data(struct ieee80211vap if (mcopy != NULL) { int len, err; len = mcopy->m_pkthdr.len; - err = (ifp->if_transmit)(ifp, mcopy); + err = ifp->if_transmit(ifp, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mcopy */ } else { Modified: user/sam/wifi/sys/net80211/ieee80211_node.c ============================================================================== --- user/sam/wifi/sys/net80211/ieee80211_node.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/net80211/ieee80211_node.c Fri Jan 2 19:55:17 2009 (r186703) @@ -1334,6 +1334,10 @@ ieee80211_init_neighbor(struct ieee80211 if (ieee80211_ies_init(&ni->ni_ies, sp->ies, sp->ies_len)) { ieee80211_ies_expand(&ni->ni_ies); + if (ni->ni_ies.wme_ie != NULL) + ni->ni_flags |= IEEE80211_NODE_QOS; + else + ni->ni_flags &= ~IEEE80211_NODE_QOS; if (ni->ni_ies.ath_ie != NULL) ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); } Modified: user/sam/wifi/sys/net80211/ieee80211_output.c ============================================================================== --- user/sam/wifi/sys/net80211/ieee80211_output.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/net80211/ieee80211_output.c Fri Jan 2 19:55:17 2009 (r186703) @@ -266,7 +266,7 @@ ieee80211_start(struct ifnet *ifp) m->m_pkthdr.rcvif = (void *)ni; /* XXX defer if_start calls? */ - error = (parent->if_transmit)(parent, m); + error = parent->if_transmit(parent, m); if (error != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ ieee80211_free_node(ni); Modified: user/sam/wifi/sys/net80211/ieee80211_wds.c ============================================================================== --- user/sam/wifi/sys/net80211/ieee80211_wds.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/net80211/ieee80211_wds.c Fri Jan 2 19:55:17 2009 (r186703) @@ -278,7 +278,7 @@ ieee80211_dwds_mcast(struct ieee80211vap mcopy->m_flags |= M_MCAST | M_WDS; mcopy->m_pkthdr.rcvif = (void *) ni; - err = (parent->if_transmit)(parent, mcopy); + err = parent->if_transmit(parent, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mbuf */ ifp->if_oerrors++; Modified: user/sam/wifi/sys/pc98/cbus/scterm-sck.c ============================================================================== --- user/sam/wifi/sys/pc98/cbus/scterm-sck.c Fri Jan 2 13:56:45 2009 (r186702) +++ user/sam/wifi/sys/pc98/cbus/scterm-sck.c Fri Jan 2 19:55:17 2009 (r186703) @@ -37,9 +37,7 @@ #include #include -#include - -#ifndef SC_DUMB_TERMINAL +#include #define MAX_ESC_PAR 5 @@ -1212,5 +1210,3 @@ mask2attr(term_stat *tcp) return (attr << 8); } - -#endif /* SC_DUMB_TERMINAL */ Copied: user/sam/wifi/sys/pc98/cbus/sctermvar.h (from r186686, head/sys/pc98/cbus/sctermvar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sam/wifi/sys/pc98/cbus/sctermvar.h Fri Jan 2 19:55:17 2009 (r186703, copy of r186686, head/sys/pc98/cbus/sctermvar.h) @@ -0,0 +1,432 @@ +/*- + * Copyright (c) 1999 Kazutaka YOKOTA + * 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 as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_SYSCONS_SCTERMVAR_H_ +#define _DEV_SYSCONS_SCTERMVAR_H_ + +/* + * building blocks for terminal emulator modules. + */ + +static __inline void sc_term_ins_line(scr_stat *scp, int y, int n, int ch, + int attr, int tail); +static __inline void sc_term_del_line(scr_stat *scp, int y, int n, int ch, + int attr, int tail); +static __inline void sc_term_ins_char(scr_stat *scp, int n, int ch, + int attr); +static __inline void sc_term_del_char(scr_stat *scp, int n, int ch, + int attr); +static __inline void sc_term_col(scr_stat *scp, int n); +static __inline void sc_term_row(scr_stat *scp, int n); +static __inline void sc_term_up(scr_stat *scp, int n, int head); +static __inline void sc_term_down(scr_stat *scp, int n, int tail); +static __inline void sc_term_left(scr_stat *scp, int n); +static __inline void sc_term_right(scr_stat *scp, int n); +static __inline void sc_term_up_scroll(scr_stat *scp, int n, int ch, + int attr, int head, int tail); +static __inline void sc_term_down_scroll(scr_stat *scp, int n, int ch, + int attr, int head, int tail); +static __inline void sc_term_clr_eos(scr_stat *scp, int n, int ch, int attr); +static __inline void sc_term_clr_eol(scr_stat *scp, int n, int ch, int attr); +static __inline void sc_term_tab(scr_stat *scp, int n); +static __inline void sc_term_backtab(scr_stat *scp, int n); +static __inline void sc_term_respond(scr_stat *scp, u_char *s); +static __inline void sc_term_gen_print(scr_stat *scp, u_char **buf, int *len, + int attr); +static __inline void sc_term_gen_scroll(scr_stat *scp, int ch, int attr); + +static __inline void +sc_term_ins_line(scr_stat *scp, int y, int n, int ch, int attr, int tail) +{ + if (tail <= 0) + tail = scp->ysize; + if (n < 1) + n = 1; + if (n > tail - y) + n = tail - y; + sc_vtb_ins(&scp->vtb, y*scp->xsize, n*scp->xsize, ch, attr); + mark_for_update(scp, y*scp->xsize); + mark_for_update(scp, scp->xsize*tail - 1); +} + +static __inline void +sc_term_del_line(scr_stat *scp, int y, int n, int ch, int attr, int tail) +{ + if (tail <= 0) + tail = scp->ysize; + if (n < 1) + n = 1; + if (n > tail - y) + n = tail - y; + sc_vtb_delete(&scp->vtb, y*scp->xsize, n*scp->xsize, ch, attr); + mark_for_update(scp, y*scp->xsize); + mark_for_update(scp, scp->xsize*tail - 1); +} + +static __inline void +sc_term_ins_char(scr_stat *scp, int n, int ch, int attr) +{ + int count; + + if (n < 1) + n = 1; + if (n > scp->xsize - scp->xpos) + n = scp->xsize - scp->xpos; + count = scp->xsize - (scp->xpos + n); + sc_vtb_move(&scp->vtb, scp->cursor_pos, scp->cursor_pos + n, count); + sc_vtb_erase(&scp->vtb, scp->cursor_pos, n, ch, attr); + mark_for_update(scp, scp->cursor_pos); + mark_for_update(scp, scp->cursor_pos + n + count - 1); +} + +static __inline void +sc_term_del_char(scr_stat *scp, int n, int ch, int attr) +{ + int count; + + if (n < 1) + n = 1; + if (n > scp->xsize - scp->xpos) + n = scp->xsize - scp->xpos; + count = scp->xsize - (scp->xpos + n); + sc_vtb_move(&scp->vtb, scp->cursor_pos + n, scp->cursor_pos, count); + sc_vtb_erase(&scp->vtb, scp->cursor_pos + count, n, ch, attr); + mark_for_update(scp, scp->cursor_pos); + mark_for_update(scp, scp->cursor_pos + n + count - 1); +} + +static __inline void +sc_term_col(scr_stat *scp, int n) +{ + if (n < 1) + n = 1; + sc_move_cursor(scp, n - 1, scp->ypos); +} + +static __inline void +sc_term_row(scr_stat *scp, int n) +{ + if (n < 1) + n = 1; + sc_move_cursor(scp, scp->xpos, n - 1); +} + +static __inline void +sc_term_up(scr_stat *scp, int n, int head) +{ + if (n < 1) + n = 1; + n = imin(n, scp->ypos - head); + if (n <= 0) + return; + sc_move_cursor(scp, scp->xpos, scp->ypos - n); +} + +static __inline void +sc_term_down(scr_stat *scp, int n, int tail) +{ + if (tail <= 0) + tail = scp->ysize; + if (n < 1) + n = 1; + n = imin(n, tail - scp->ypos - 1); + if (n <= 0) + return; + sc_move_cursor(scp, scp->xpos, scp->ypos + n); +} + +static __inline void +sc_term_left(scr_stat *scp, int n) +{ + if (n < 1) + n = 1; + sc_move_cursor(scp, scp->xpos - n, scp->ypos); +} + +static __inline void +sc_term_right(scr_stat *scp, int n) +{ + if (n < 1) + n = 1; + sc_move_cursor(scp, scp->xpos + n, scp->ypos); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 01:11:26 2009 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 E3C0D1065672; Sat, 3 Jan 2009 01:11:26 +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 D61E28FC14; Sat, 3 Jan 2009 01:11:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n031BQej012360; Sat, 3 Jan 2009 01:11:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n031BQK6012359; Sat, 3 Jan 2009 01:11:26 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901030111.n031BQK6012359@svn.freebsd.org> From: Kip Macy Date: Sat, 3 Jan 2009 01:11:26 +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: r186709 - user/kmacy/HEAD_fast_net/sys/kern 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: Sat, 03 Jan 2009 01:11:27 -0000 Author: kmacy Date: Sat Jan 3 01:11:26 2009 New Revision: 186709 URL: http://svn.freebsd.org/changeset/base/186709 Log: sendfile doesn't modify the vnode - acquire vnode lock shared Modified: user/kmacy/HEAD_fast_net/sys/kern/uipc_syscalls.c Modified: user/kmacy/HEAD_fast_net/sys/kern/uipc_syscalls.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/kern/uipc_syscalls.c Sat Jan 3 00:27:28 2009 (r186708) +++ user/kmacy/HEAD_fast_net/sys/kern/uipc_syscalls.c Sat Jan 3 01:11:26 2009 (r186709) @@ -1811,7 +1811,7 @@ kern_sendfile(struct thread *td, struct if ((error = fgetvp_read(td, uap->fd, &vp)) != 0) goto out; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); if (vp->v_type == VREG) { obj = vp->v_object; if (obj != NULL) { From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 02:00:11 2009 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 A53FB106566B; Sat, 3 Jan 2009 02:00:11 +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 972898FC12; Sat, 3 Jan 2009 02:00:11 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0320Bc2013246; Sat, 3 Jan 2009 02:00:11 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0320Arr013245; Sat, 3 Jan 2009 02:00:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901030200.n0320Arr013245@svn.freebsd.org> From: Kip Macy Date: Sat, 3 Jan 2009 02:00:10 +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: r186710 - user/kmacy/HEAD_fast_net/sys/kern 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: Sat, 03 Jan 2009 02:00:12 -0000 Author: kmacy Date: Sat Jan 3 02:00:10 2009 New Revision: 186710 URL: http://svn.freebsd.org/changeset/base/186710 Log: convert name cache lock to rwlock for lookups Modified: user/kmacy/HEAD_fast_net/sys/kern/vfs_cache.c Modified: user/kmacy/HEAD_fast_net/sys/kern/vfs_cache.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/kern/vfs_cache.c Sat Jan 3 01:11:26 2009 (r186709) +++ user/kmacy/HEAD_fast_net/sys/kern/vfs_cache.c Sat Jan 3 02:00:10 2009 (r186710) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -109,11 +110,17 @@ SYSCTL_ULONG(_debug, OID_AUTO, numcachep #endif struct nchstats nchstats; /* cache effectiveness statistics */ -static struct mtx cache_lock; -MTX_SYSINIT(vfscache, &cache_lock, "Name Cache", MTX_DEF); +static struct rwlock cache_lock; +RW_SYSINIT(vfscache, &cache_lock, "Name Cache"); -#define CACHE_LOCK() mtx_lock(&cache_lock) -#define CACHE_UNLOCK() mtx_unlock(&cache_lock) +#define CACHE_RLOCK() rw_rlock(&cache_lock) +#define CACHE_RUNLOCK() rw_runlock(&cache_lock) +#define CACHE_WLOCK() rw_wlock(&cache_lock) +#define CACHE_WUNLOCK() rw_wunlock(&cache_lock) +#define CACHE_TRY_UPGRADE() rw_try_upgrade(&cache_lock) + +#define CACHE_LOCK() CACHE_WLOCK() +#define CACHE_UNLOCK() CACHE_WUNLOCK() /* * UMA zones for the VFS cache. @@ -275,7 +282,7 @@ cache_zap(ncp) { struct vnode *vp; - mtx_assert(&cache_lock, MA_OWNED); + rw_assert(&cache_lock, RA_LOCKED); CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); vp = NULL; LIST_REMOVE(ncp, nc_hash); @@ -329,7 +336,7 @@ cache_lookup(dvp, vpp, cnp) return (0); } retry: - CACHE_LOCK(); + CACHE_RLOCK(); numcalls++; if (cnp->cn_nameptr[0] == '.') { @@ -344,7 +351,7 @@ retry: dotdothits++; if (dvp->v_dd == NULL || (cnp->cn_flags & MAKEENTRY) == 0) { - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (0); } *vpp = dvp->v_dd; @@ -371,12 +378,16 @@ retry: nummiss++; } nchstats.ncs_miss++; - CACHE_UNLOCK(); + CACHE_RUNLOCK(); return (0); } /* We don't want to have an entry, so dump it */ if ((cnp->cn_flags & MAKEENTRY) == 0) { + if (CACHE_TRY_UPGRADE() == 0) { + CACHE_RUNLOCK(); + CACHE_WLOCK(); + } numposzaps++; nchstats.ncs_badhits++; cache_zap(ncp); @@ -394,6 +405,10 @@ retry: goto success; } + if (CACHE_TRY_UPGRADE() == 0) { + CACHE_RUNLOCK(); + CACHE_WLOCK(); + } /* We found a negative match, and want to create it, so purge */ if (cnp->cn_nameiop == CREATE) { numnegzaps++; @@ -425,7 +440,7 @@ success: */ if (dvp == *vpp) { /* lookup on "." */ VREF(*vpp); - CACHE_UNLOCK(); + CACHE_RUNLOCK(); /* * When we lookup "." we still can be asked to lock it * differently... @@ -451,7 +466,7 @@ success: VOP_UNLOCK(dvp, 0); } VI_LOCK(*vpp); - CACHE_UNLOCK(); + CACHE_RUNLOCK(); error = vget(*vpp, cnp->cn_lkflags | LK_INTERLOCK, cnp->cn_thread); if (cnp->cn_flags & ISDOTDOT) vn_lock(dvp, ltype | LK_RETRY); From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 02:31:57 2009 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 7D183106564A; Sat, 3 Jan 2009 02:31:57 +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 6D7B48FC12; Sat, 3 Jan 2009 02:31:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n032VvRk013882; Sat, 3 Jan 2009 02:31:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n032Vvfb013881; Sat, 3 Jan 2009 02:31:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901030231.n032Vvfb013881@svn.freebsd.org> From: Kip Macy Date: Sat, 3 Jan 2009 02:31:57 +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: r186711 - user/kmacy/HEAD_fast_net/sys/kern 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: Sat, 03 Jan 2009 02:31:57 -0000 Author: kmacy Date: Sat Jan 3 02:31:57 2009 New Revision: 186711 URL: http://svn.freebsd.org/changeset/base/186711 Log: convert vfs hash lock to an rwlock Modified: user/kmacy/HEAD_fast_net/sys/kern/vfs_hash.c Modified: user/kmacy/HEAD_fast_net/sys/kern/vfs_hash.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/kern/vfs_hash.c Sat Jan 3 02:00:10 2009 (r186710) +++ user/kmacy/HEAD_fast_net/sys/kern/vfs_hash.c Sat Jan 3 02:31:57 2009 (r186711) @@ -31,8 +31,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include static MALLOC_DEFINE(M_VFS_HASH, "vfs_hash", "VFS hash table"); @@ -40,14 +42,20 @@ static MALLOC_DEFINE(M_VFS_HASH, "vfs_ha static LIST_HEAD(vfs_hash_head, vnode) *vfs_hash_tbl; static LIST_HEAD(,vnode) vfs_hash_side; static u_long vfs_hash_mask; -static struct mtx vfs_hash_mtx; +static struct rwlock vfs_hash_lock; + +#define HASH_WLOCK() rw_wlock(&vfs_hash_lock) +#define HASH_WUNLOCK() rw_wunlock(&vfs_hash_lock) +#define HASH_RLOCK() rw_rlock(&vfs_hash_lock) +#define HASH_RUNLOCK() rw_runlock(&vfs_hash_lock) + static void vfs_hashinit(void *dummy __unused) { vfs_hash_tbl = hashinit(desiredvnodes, M_VFS_HASH, &vfs_hash_mask); - mtx_init(&vfs_hash_mtx, "vfs hash", NULL, MTX_DEF); + rw_init(&vfs_hash_lock, "vfs hash"); LIST_INIT(&vfs_hash_side); } @@ -68,7 +76,7 @@ vfs_hash_get(const struct mount *mp, u_i int error; while (1) { - mtx_lock(&vfs_hash_mtx); + HASH_RLOCK(); LIST_FOREACH(vp, vfs_hash_index(mp, hash), v_hashlist) { if (vp->v_hash != hash) continue; @@ -77,7 +85,7 @@ vfs_hash_get(const struct mount *mp, u_i if (fn != NULL && fn(vp, arg)) continue; VI_LOCK(vp); - mtx_unlock(&vfs_hash_mtx); + HASH_RUNLOCK(); error = vget(vp, flags | LK_INTERLOCK, td); if (error == ENOENT && (flags & LK_NOWAIT) == 0) break; @@ -87,7 +95,7 @@ vfs_hash_get(const struct mount *mp, u_i return (0); } if (vp == NULL) { - mtx_unlock(&vfs_hash_mtx); + HASH_RUNLOCK(); *vpp = NULL; return (0); } @@ -98,9 +106,9 @@ void vfs_hash_remove(struct vnode *vp) { - mtx_lock(&vfs_hash_mtx); + HASH_WLOCK(); LIST_REMOVE(vp, v_hashlist); - mtx_unlock(&vfs_hash_mtx); + HASH_WUNLOCK(); } int @@ -111,7 +119,7 @@ vfs_hash_insert(struct vnode *vp, u_int *vpp = NULL; while (1) { - mtx_lock(&vfs_hash_mtx); + HASH_WLOCK(); LIST_FOREACH(vp2, vfs_hash_index(vp->v_mount, hash), v_hashlist) { if (vp2->v_hash != hash) @@ -121,13 +129,13 @@ vfs_hash_insert(struct vnode *vp, u_int if (fn != NULL && fn(vp2, arg)) continue; VI_LOCK(vp2); - mtx_unlock(&vfs_hash_mtx); + HASH_WUNLOCK(); error = vget(vp2, flags | LK_INTERLOCK, td); if (error == ENOENT && (flags & LK_NOWAIT) == 0) break; - mtx_lock(&vfs_hash_mtx); + HASH_WLOCK(); LIST_INSERT_HEAD(&vfs_hash_side, vp, v_hashlist); - mtx_unlock(&vfs_hash_mtx); + HASH_WUNLOCK(); vput(vp); if (!error) *vpp = vp2; @@ -139,7 +147,7 @@ vfs_hash_insert(struct vnode *vp, u_int } vp->v_hash = hash; LIST_INSERT_HEAD(vfs_hash_index(vp->v_mount, hash), vp, v_hashlist); - mtx_unlock(&vfs_hash_mtx); + HASH_WUNLOCK(); return (0); } @@ -147,9 +155,9 @@ void vfs_hash_rehash(struct vnode *vp, u_int hash) { - mtx_lock(&vfs_hash_mtx); + HASH_WLOCK(); LIST_REMOVE(vp, v_hashlist); LIST_INSERT_HEAD(vfs_hash_index(vp->v_mount, hash), vp, v_hashlist); vp->v_hash = hash; - mtx_unlock(&vfs_hash_mtx); + HASH_WUNLOCK(); } From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 14:51:50 2009 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 256C51065673; Sat, 3 Jan 2009 14:51:50 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 145418FC19; Sat, 3 Jan 2009 14:51:50 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n03Epnae030647; Sat, 3 Jan 2009 14:51:49 GMT (envelope-from piso@svn.freebsd.org) Received: (from piso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n03EpnPp030645; Sat, 3 Jan 2009 14:51:49 GMT (envelope-from piso@svn.freebsd.org) Message-Id: <200901031451.n03EpnPp030645@svn.freebsd.org> From: Paolo Pisati Date: Sat, 3 Jan 2009 14:51:49 +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: r186723 - user/piso/sbin/ipfw 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: Sat, 03 Jan 2009 14:51:50 -0000 Author: piso Date: Sat Jan 3 14:51:49 2009 New Revision: 186723 URL: http://svn.freebsd.org/changeset/base/186723 Log: -get rid of #ifdef ALIAS_SCTP -style Modified: user/piso/sbin/ipfw/ipfw2.c Modified: user/piso/sbin/ipfw/ipfw2.c ============================================================================== --- user/piso/sbin/ipfw/ipfw2.c Sat Jan 3 14:33:48 2009 (r186722) +++ user/piso/sbin/ipfw/ipfw2.c Sat Jan 3 14:51:49 2009 (r186723) @@ -48,7 +48,6 @@ #include #define IPFW_INTERNAL /* Access to protected structures in ip_fw.h. */ -#define _ALIAS_SCTP /*Using alias_sctp*/ #include #include @@ -3505,13 +3504,9 @@ StrToProto (const char* str) if (!strcmp (str, "udp")) return IPPROTO_UDP; -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ if (!strcmp (str, "sctp")) return IPPROTO_SCTP; errx (EX_DATAERR, "unknown protocol %s. Expected sctp, tcp or udp", str); -#else - errx (EX_DATAERR, "unknown protocol %s. Expected tcp or udp", str); -#endif } static int @@ -3687,29 +3682,27 @@ setup_redir_port(char *spool_buf, int le strncpy(tmp_spool_buf, *av, strlen(*av)+1); lsnat = 1; } else { -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - /* - * The sctp nat does not allow the port numbers to be mapped to new port numbers - * Therefore, no ports are to be specified in the target port field - */ - if (r->proto == IPPROTO_SCTP) { - if (strchr (*av, ':')) - errx(EX_DATAERR, "redirect_port:" - "port numbers do not change in sctp, so do not specify them as part of the target"); - else - StrToAddr(*av, &r->laddr); - } else { -#endif /*Using alias_sctp*/ - if (StrToAddrAndPortRange (*av, &r->laddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); + /* + * The sctp nat does not allow the port numbers to be mapped to + * new port numbers. Therefore, no ports are to be specified + * in the target port field. + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (*av, ':')) + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in sctp, so do not " + "specify them as part of the target"); + else + StrToAddr(*av, &r->laddr); + } else { + if (StrToAddrAndPortRange (*av, &r->laddr, protoName, + &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); - r->lport = GETLOPORT(portRange); - numLocalPorts = GETNUMPORTS(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - } -#endif /*Using alias_sctp*/ + r->lport = GETLOPORT(portRange); + numLocalPorts = GETNUMPORTS(portRange); + } } INC_ARGCV(); @@ -3733,12 +3726,10 @@ setup_redir_port(char *spool_buf, int le } r->pport = GETLOPORT(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ if (r->proto == IPPROTO_SCTP) { /* so the logic below still works */ - numLocalPorts = GETNUMPORTS(portRange); - r->lport = r->pport; + numLocalPorts = GETNUMPORTS(portRange); + r->lport = r->pport; } -#endif /*Using alias_sctp*/ r->pport_cnt = GETNUMPORTS(portRange); INC_ARGCV(); @@ -3794,33 +3785,31 @@ setup_redir_port(char *spool_buf, int le goto nospace; len -= SOF_SPOOL; space += SOF_SPOOL; - -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - /* - * The sctp nat does not allow the port numbers to be mapped to new port numbers - * Therefore, no ports are to be specified in the target port field - */ - if (r->proto == IPPROTO_SCTP) { - if (strchr (sep, ':')) { - errx(EX_DATAERR, "redirect_port:" - "port numbers do not change in sctp, so do not specify them as part of the target"); - } else { - StrToAddr(sep, &tmp->addr); - tmp->port = r->pport; - } - } else { -#endif /*Using alias_sctp*/ - if (StrToAddrAndPortRange(sep, &tmp->addr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); - if (GETNUMPORTS(portRange) != 1) - errx(EX_DATAERR, "redirect_port: local port" - "must be single in this context"); - tmp->port = GETLOPORT(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - } -#endif /*Using alias_sctp*/ + /* + * The sctp nat does not allow the port numbers to be mapped to new port numbers + * Therefore, no ports are to be specified in the target port field + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (sep, ':')) { + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in " + "sctp, so do not specify them as " + "part of the target"); + } else { + StrToAddr(sep, &tmp->addr); + tmp->port = r->pport; + } + } else { + if (StrToAddrAndPortRange(sep, &tmp->addr, + protoName, &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); + if (GETNUMPORTS(portRange) != 1) + errx(EX_DATAERR, "redirect_port: " + "local port must be single in " + "this context"); + tmp->port = GETLOPORT(portRange); + } r->spool_cnt++; /* Point to the next possible cfg_spool. */ spool_buf = &spool_buf[SOF_SPOOL]; From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 17:13:38 2009 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 E40521065672; Sat, 3 Jan 2009 17:13:37 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1E928FC18; Sat, 3 Jan 2009 17:13:37 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n03HDbR9033334; Sat, 3 Jan 2009 17:13:37 GMT (envelope-from piso@svn.freebsd.org) Received: (from piso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n03HDb4B033332; Sat, 3 Jan 2009 17:13:37 GMT (envelope-from piso@svn.freebsd.org) Message-Id: <200901031713.n03HDb4B033332@svn.freebsd.org> From: Paolo Pisati Date: Sat, 3 Jan 2009 17:13:37 +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: r186725 - in user/piso: sbin/ipfw share/man/man8 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: Sat, 03 Jan 2009 17:13:38 -0000 Author: piso Date: Sat Jan 3 17:13:37 2009 New Revision: 186725 URL: http://svn.freebsd.org/changeset/base/186725 Log: -merge alias_sctp.8 with ipfw man page -mdoc style Deleted: user/piso/share/man/man8/alias_sctp.8 Modified: user/piso/sbin/ipfw/ipfw.8 user/piso/share/man/man8/Makefile Modified: user/piso/sbin/ipfw/ipfw.8 ============================================================================== --- user/piso/sbin/ipfw/ipfw.8 Sat Jan 3 15:17:20 2009 (r186724) +++ user/piso/sbin/ipfw/ipfw.8 Sat Jan 3 17:13:37 2009 (r186725) @@ -2183,17 +2183,173 @@ Redirect and LSNAT support follow closel See Section .Sx EXAMPLES for some examples on how to do redirect and lsnat. +.Sh SCTP NAT SUPPORT +Sctp nat can be configured in a simillar manner to TCP through the +ipfw command line tool +.Xr ipfw 8 +, the main difference is that +.Nm sctp nat +does not do port +translation. Since the local and global side ports will be the same, +there is no need to specify both. Ports are redirected as follows: +.Bd -ragged -offset indent +.Bk -words +.Cm nat +.Ar nat_number +.Cm config if +.Ar nic +.Cm redirect_port sctp +.Ar ip_address [,addr_list] {[port | port-port] [,ports]} +.Ek +.Ed +.Pp +. +Most +.B sctp nat +configuration can be done in real-time through the +.B sysctl(8) +interface. All may be changed dynamically, though the hash_table size will only +change for new +.Nm nat +instances. See +.Sx SYSCTL VARIABLES +for more info. .Sh SYSCTL VARIABLES A set of .Xr sysctl 8 variables controls the behaviour of the firewall and associated modules -.Pq Nm dummynet , bridge . +.Pq Nm dummynet , bridge , sctp nat . These are shown below together with their default value (but always check with the .Xr sysctl 8 command what value is actually in use) and meaning: .Bl -tag -width indent +.It Va net.inet.ip.alias.sctp.accept_global_ootb_addip: No 0 +Defines how the +.Nm nat +responds to receipt of global OOTB ASCONF-AddIP: +.Bl -tag -width indent +.It Cm 0 +No response (unless a partially matching association exists - +ports and vtags match but global address does not) +.It Cm 1 +.Nm nat +will accept and process all OOTB global AddIP messages. +.El +.Pp +Option 1 should never be selected as this forms a security risk. An attacker can +establish multiple fake associations by sending AddIP messages. +.It Va net.inet.ip.alias.sctp.chunk_proc_limit: No 5 +Defines the maximum number of chunks in an SCTP packet that will be parsed for a +packet that matches an existing association. This value is enforced to be greater or equal +than +.Cm net.inet.ip.alias.sctp.initialising_chunk_proc_limit . +A high value is +a DoS risk yet setting too low a value may result in important control chunks in +the packet not being located and parsed. +.It Va net.inet.ip.alias.sctp.error_on_ootb: No 1 +Defines when the +.Nm nat +responds to any Out-of-the-Blue (OOTB) packets with ErrorM +packets. An OOTB packet is a packet that arrives with no existing association +registered in the +.Nm nat +and is not an INIT or ASCONF-AddIP packet: +.Bl -tag -width indent +.It Cm 0 +ErrorM is never sent in response to OOTB packets. +.It Cm 1 +ErrorM is only sent to OOTB packets received on the local side. +.It Cm 2 +ErrorM is sent to the local side and on the global side ONLY if there is a +partial match (ports and vtags match but the source global IP does not). This +value is only useful if the +.Nm nat +is tracking global IP addresses. +.It Cm 3 +ErrorM is sent in response to all OOTB packets on both the local and global side +(DoS risk). +.El +.Pp +At the moment the default is 0, since the ErrorM packet is not yet +supported by most SCTP stacks. When it is supported, and if not tracking +global addresses, we recommend setting this value to 1 to allow +multi-homed local hosts to function with the +.Nm nat . +To track global addresses, we recommend setting this value to 2 to +allow global hosts to be informed when they need to (re)send an +ASCONF-AddIP. Value 3 should never be chosen (except for debugging) as +the +.Nm nat +will respond to all OOTB global packets (a DoS risk). +.It Va net.inet.ip.alias.sctp.hashtable_size: No 2003 +Size of hash tables used for +.Nm nat +lookups (100 < prime_number > 1000001) +This value sets the +.Nm hash table +size for any future created +.Nm nat +instance and therefore must be set prior to creating a +.Nm nat +instance. +The table sizes my be changed to suit specific needs. If there will be few +concurrent associations, and memory is scarce, you may make these smaller. If +there will be many thousands (or millions) of concurrent associations, you +should make these larger. A prime number is best for the table size. The sysctl +update function will adjust your input value to the next highest prime number. +.It Va net.inet.ip.alias.sctp.holddown_time: No 0 +Hold association in table for this many seconds after receiving a +SHUTDOWN-COMPLETE. This allows endpoints to correct shutdown gracefully if a +shutdown_complete is lost and retransmissions are required. +.It Va net.inet.ip.alias.sctp.init_timer: No 15 +Timeout value while waiting for (INIT-ACK|AddIP-ACK). +This value cannot be 0. +.It Va net.inet.ip.alias.sctp.initialising_chunk_proc_limit: No 2 +Defines the maximum number of chunks in an SCTP packet that will be parsed when +no existing association exists that matches that packet. Ideally this packet +will only be an INIT or ASCONF-AddIP packet. A higher value may become a DoS +risk as malformed packets can consume processing resources. +.It Va net.inet.ip.alias.sctp.param_proc_limit: No 25 +Defines the maximum number of parameters within a chunk that will be parsed in a +packet. As for other similar sysctl variables, larger values pose a DoS risk. +.It Va net.inet.ip.alias.sctp.log_level: No 0 +Level of detail in the system log messages (0 \- minimal, 1 \- event, +2 \- info, 3 \- detail, 4 \- debug, 5 \- max debug). May be a good +option in high loss environments. +.It Va net.inet.ip.alias.sctp.shutdown_time: No 15 +Timeout value while waiting for SHUTDOWN-COMPLETE. +This value cannot be 0. +.It Va net.inet.ip.alias.sctp.track_global_addresses: No 0 +Enables/disables global IP address tracking within the +.Nm nat +and places an +upper limit on the number of addresses tracked for each association: +.Bl -tag -width indent +.It Cm 0 +Global tracking is disabled +.It Cm >1 +Enables tracking, the maximum number of addresses tracked for each +association is limited to this value +.El +.Pp +This variable is fully dynamic, the new value will be adopted for all newly +arriving associations, existing association are treated as they were previously. +Global tracking will decrease the number of collisions within the +.Nm nat +at a cost +of increased processing load, memory usage, complexity, and possible +.Nm nat +state +problems in complex networks with multiple +.Nm nats . +We recommend not tracking +global IP addresses, this will still result in a fully functional +.Nm nat . +.It Va net.inet.ip.alias.sctp.up_timer: No 300 +Timeout value to keep an association up with no traffic. +This value cannot be 0. .It Va net.inet.ip.dummynet.expire : No 1 Lazily delete dynamic pipes/queue once they have no pending traffic. You can disable this by setting the variable to 0, in which case @@ -2718,6 +2874,15 @@ as part of a Summer of Code 2005 project Work on .Nm dummynet traffic shaper supported by Akamba Corp. +.Pp +Sctp +.Nm nat +support has been developed by +.An The Centre for Advanced Internet Architectures (CAIA) Aq http://www.caia.swin.edu.au . +The primary developers and maintainers are David Hayes and Jason But. +For further information visit: +.Aq http://www.caia.swin.edu.au/urp/SONATA +. .Sh BUGS The syntax has grown over the years and sometimes it might be confusing. Unfortunately, backward compatibility prevents cleaning up mistakes Modified: user/piso/share/man/man8/Makefile ============================================================================== --- user/piso/share/man/man8/Makefile Sat Jan 3 15:17:20 2009 (r186724) +++ user/piso/share/man/man8/Makefile Sat Jan 3 17:13:37 2009 (r186725) @@ -13,8 +13,7 @@ MAN= adding_user.8 \ rc.subr.8 \ rescue.8 \ sticky.8 \ - yp.8 \ - alias_sctp.8 + yp.8 MLINKS= rc.8 rc.atm.8 \ rc.8 rc.d.8 \ From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 17:22:06 2009 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 424A1106566B; Sat, 3 Jan 2009 17:22:06 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 319878FC13; Sat, 3 Jan 2009 17:22:06 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n03HM5eT033523; Sat, 3 Jan 2009 17:22:05 GMT (envelope-from piso@svn.freebsd.org) Received: (from piso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n03HM5Ff033522; Sat, 3 Jan 2009 17:22:05 GMT (envelope-from piso@svn.freebsd.org) Message-Id: <200901031722.n03HM5Ff033522@svn.freebsd.org> From: Paolo Pisati Date: Sat, 3 Jan 2009 17:22:05 +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: r186726 - user/piso/sys/netinet 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: Sat, 03 Jan 2009 17:22:06 -0000 Author: piso Date: Sat Jan 3 17:22:05 2009 New Revision: 186726 URL: http://svn.freebsd.org/changeset/base/186726 Log: -get rid of #ifdef _ALIAS_SCTP -white space Modified: user/piso/sys/netinet/ip_fw_nat.c Modified: user/piso/sys/netinet/ip_fw_nat.c ============================================================================== --- user/piso/sys/netinet/ip_fw_nat.c Sat Jan 3 17:13:37 2009 (r186725) +++ user/piso/sys/netinet/ip_fw_nat.c Sat Jan 3 17:22:05 2009 (r186726) @@ -326,12 +326,10 @@ ipfw_nat(struct ip_fw_args *args, struct else retval = LibAliasOut(t->lib, c, mcl->m_len + M_TRAILINGSPACE(mcl)); -#ifdef _ALIAS_SCTP if (retval == PKT_ALIAS_RESPOND) { m->m_flags |= M_SKIP_FIREWALL; retval = PKT_ALIAS_OK; } -#endif if (retval != PKT_ALIAS_OK && retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) { /* XXX - should i add some logging? */ @@ -407,7 +405,6 @@ ipfw_nat(struct ip_fw_args *args, struct } args->m = mcl; - return (IP_FW_NAT); }