From owner-svn-src-stable@FreeBSD.ORG Sun May 29 02:09:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B012C106566B; Sun, 29 May 2011 02:09:09 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A03E18FC0A; Sun, 29 May 2011 02:09:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T299Z9009968; Sun, 29 May 2011 02:09:09 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T299nS009966; Sun, 29 May 2011 02:09:09 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105290209.p4T299nS009966@svn.freebsd.org> From: Attilio Rao Date: Sun, 29 May 2011 02:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222436 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:09:09 -0000 Author: attilio Date: Sun May 29 02:09:09 2011 New Revision: 222436 URL: http://svn.freebsd.org/changeset/base/222436 Log: MFC r222002: Do not use memory barrier when is not necessary. Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_mod.c Sun May 29 00:59:38 2011 (r222435) +++ stable/8/sys/dev/hwpmc/hwpmc_mod.c Sun May 29 02:09:09 2011 (r222436) @@ -4083,7 +4083,7 @@ pmc_process_interrupt(int cpu, struct pm done: /* mark CPU as needing processing */ - atomic_set_rel_int(&pmc_cpumask, (1 << cpu)); + atomic_set_int(&pmc_cpumask, (1 << cpu)); return (error); } @@ -4193,7 +4193,7 @@ pmc_process_samples(int cpu) break; if (ps->ps_nsamples == PMC_SAMPLE_INUSE) { /* Need a rescan at a later time. */ - atomic_set_rel_int(&pmc_cpumask, (1 << cpu)); + atomic_set_int(&pmc_cpumask, (1 << cpu)); break; } @@ -4782,7 +4782,7 @@ pmc_cleanup(void) PMCDBG(MOD,INI,0, "%s", "cleanup"); /* switch off sampling */ - atomic_store_rel_int(&pmc_cpumask, 0); + pmc_cpumask = 0; pmc_intr = NULL; sx_xlock(&pmc_sx); From owner-svn-src-stable@FreeBSD.ORG Sun May 29 02:10:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3F47106566B; Sun, 29 May 2011 02:10:57 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C46408FC0A; Sun, 29 May 2011 02:10:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T2Avoo010081; Sun, 29 May 2011 02:10:57 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T2AvFN010079; Sun, 29 May 2011 02:10:57 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105290210.p4T2AvFN010079@svn.freebsd.org> From: Attilio Rao Date: Sun, 29 May 2011 02:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222437 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:10:57 -0000 Author: attilio Date: Sun May 29 02:10:57 2011 New Revision: 222437 URL: http://svn.freebsd.org/changeset/base/222437 Log: MFC r222201: Fill the whole cpuset_t, not only the first object. Modified: stable/8/sys/kern/kern_cpuset.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_cpuset.c ============================================================================== --- stable/8/sys/kern/kern_cpuset.c Sun May 29 02:09:09 2011 (r222436) +++ stable/8/sys/kern/kern_cpuset.c Sun May 29 02:10:57 2011 (r222437) @@ -681,7 +681,7 @@ cpuset_thread0(void) * cpuset_create() due to NULL parent. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - set->cs_mask.__bits[0] = -1; + CPU_FILL(&set->cs_mask); LIST_INIT(&set->cs_children); LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); set->cs_ref = 1; From owner-svn-src-stable@FreeBSD.ORG Sun May 29 15:07:53 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDE6E1065672; Sun, 29 May 2011 15:07:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDC538FC0A; Sun, 29 May 2011 15:07:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TF7rjs035262; Sun, 29 May 2011 15:07:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TF7rC7035260; Sun, 29 May 2011 15:07:53 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291507.p4TF7rC7035260@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222452 - stable/8/bin/sh X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:07:53 -0000 Author: jilles Date: Sun May 29 15:07:53 2011 New Revision: 222452 URL: http://svn.freebsd.org/changeset/base/222452 Log: MFC r222173: sh: Fix bss-based buffer overflow in . builtin. If the length of a directory in PATH together with the given filename exceeded FILENAME_MAX (which may happen even for pathnames that work), a static buffer was overflown. The static buffer is unnecessary, we can use the stalloc() stack. Obtained from: NetBSD Modified: stable/8/bin/sh/main.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/main.c ============================================================================== --- stable/8/bin/sh/main.c Sun May 29 15:02:10 2011 (r222451) +++ stable/8/bin/sh/main.c Sun May 29 15:07:53 2011 (r222452) @@ -296,7 +296,6 @@ readcmdfile(const char *name) static char * find_dot_file(char *basename) { - static char localname[FILENAME_MAX+1]; char *fullname; const char *path = pathval(); struct stat statb; @@ -306,10 +305,14 @@ find_dot_file(char *basename) return basename; while ((fullname = padvance(&path, basename)) != NULL) { - strcpy(localname, fullname); + if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) { + /* + * Don't bother freeing here, since it will + * be freed by the caller. + */ + return fullname; + } stunalloc(fullname); - if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) - return localname; } return basename; } From owner-svn-src-stable@FreeBSD.ORG Sun May 29 15:10:13 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC2C106566C; Sun, 29 May 2011 15:10:13 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AB448FC13; Sun, 29 May 2011 15:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TFADt9035368; Sun, 29 May 2011 15:10:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TFADQ7035367; Sun, 29 May 2011 15:10:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291510.p4TFADQ7035367@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222453 - stable/8/tools/regression/bin/sh/builtins X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:10:13 -0000 Author: jilles Date: Sun May 29 15:10:12 2011 New Revision: 222453 URL: http://svn.freebsd.org/changeset/base/222453 Log: MFC r222174: sh: Add test for r222173 (MFCed as r222452). Added: stable/8/tools/regression/bin/sh/builtins/dot4.0 - copied unchanged from r222174, head/tools/regression/bin/sh/builtins/dot4.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/dot4.0 (from r222174, head/tools/regression/bin/sh/builtins/dot4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot4.0 Sun May 29 15:10:12 2011 (r222453, copy of r222174, head/tools/regression/bin/sh/builtins/dot4.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +v=abcd +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +r=$( ( + trap 'exit 0' 0 + . "$v" +) 2>&1 >/dev/null) && [ -n "$r" ] From owner-svn-src-stable@FreeBSD.ORG Sun May 29 18:09:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 058B6106564A; Sun, 29 May 2011 18:09:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9ABD8FC18; Sun, 29 May 2011 18:09:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TI9ED9040719; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TI9ESQ040717; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201105291809.p4TI9ESQ040717@svn.freebsd.org> From: Kirk McKusick Date: Sun, 29 May 2011 18:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222455 - stable/8/sys/ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:09:15 -0000 Author: mckusick Date: Sun May 29 18:09:14 2011 New Revision: 222455 URL: http://svn.freebsd.org/changeset/base/222455 Log: MFC r222334: The check for whether a block is going to be claimed by a snapshot needs to happen before we notify the underlying layer that it is being freed. Modified: stable/8/sys/ufs/ffs/ffs_alloc.c Modified: stable/8/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:00:50 2011 (r222454) +++ stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:09:14 2011 (r222455) @@ -1874,10 +1874,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size /* devvp is a normal disk device */ dev = devvp->v_rdev; cgblkno = fsbtodb(fs, cgtod(fs, cg)); - ASSERT_VOP_LOCKED(devvp, "ffs_blkfree"); - if ((devvp->v_vflag & VV_COPYONWRITE) && - ffs_snapblkfree(fs, devvp, bno, size, inum)) - return; + ASSERT_VOP_LOCKED(devvp, "ffs_blkfree_cg"); } #ifdef INVARIANTS if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || @@ -2024,6 +2021,17 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct bio *bip; struct ffs_blkfree_trim_params *tp; + /* + * Check to see if a snapshot wants to claim the block. + * Check that devvp is a normal disk device, not a snapshot, + * it has a snapshot(s) associated with it, and one of the + * snapshots wants to claim the block. + */ + if (devvp->v_type != VREG && + (devvp->v_vflag & VV_COPYONWRITE) && + ffs_snapblkfree(fs, devvp, bno, size, inum)) { + return; + } if (!ump->um_candelete) { ffs_blkfree_cg(ump, fs, devvp, bno, size, inum); return; From owner-svn-src-stable@FreeBSD.ORG Mon May 30 07:58:49 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A4911065670; Mon, 30 May 2011 07:58:49 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0D68FC18; Mon, 30 May 2011 07:58:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U7wnW3066494; Mon, 30 May 2011 07:58:49 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U7wnoV066492; Mon, 30 May 2011 07:58:49 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300758.p4U7wnoV066492@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 07:58:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222478 - stable/8/share/man/man7 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:58:49 -0000 Author: bcr (doc committer) Date: Mon May 30 07:58:49 2011 New Revision: 222478 URL: http://svn.freebsd.org/changeset/base/222478 Log: MFC r218699: Document TRYBROKEN in ports(7). PR: docs/153542 Submitted by: Eitan Adler Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Mon May 30 07:15:33 2011 (r222477) +++ stable/8/share/man/man7/ports.7 Mon May 30 07:58:49 2011 (r222478) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2009 +.Dd February 14, 2009 .Dt PORTS 7 .Os .Sh NAME @@ -477,6 +477,9 @@ Of course, these ports may not work as e what you are doing and are sure about installing a forbidden port, then .Va NO_IGNORE lets you do it. +.It Va TRYBROKEN +If defined, attempt to build a port even if it is marked as +.Aq Va BROKEN . .It Va PORT_DBDIR Directory where the results of configuring .Va OPTIONS From owner-svn-src-stable@FreeBSD.ORG Mon May 30 08:00:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D35921065675; Mon, 30 May 2011 08:00:28 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C345F8FC18; Mon, 30 May 2011 08:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U80S8a066610; Mon, 30 May 2011 08:00:28 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U80Si7066608; Mon, 30 May 2011 08:00:28 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300800.p4U80Si7066608@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222479 - stable/7/share/man/man7 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:00:28 -0000 Author: bcr (doc committer) Date: Mon May 30 08:00:28 2011 New Revision: 222479 URL: http://svn.freebsd.org/changeset/base/222479 Log: MFC r218699: Document TRYBROKEN in ports(7). PR: docs/153542 Submitted by: Eitan Adler Modified: stable/7/share/man/man7/ports.7 Directory Properties: stable/7/share/man/man7/ (props changed) Modified: stable/7/share/man/man7/ports.7 ============================================================================== --- stable/7/share/man/man7/ports.7 Mon May 30 07:58:49 2011 (r222478) +++ stable/7/share/man/man7/ports.7 Mon May 30 08:00:28 2011 (r222479) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2009 +.Dd February 14, 2009 .Dt PORTS 7 .Os .Sh NAME @@ -477,6 +477,9 @@ Of course, these ports may not work as e what you are doing and are sure about installing a forbidden port, then .Va NO_IGNORE lets you do it. +.It Va TRYBROKEN +If defined, attempt to build a port even if it is marked as +.Aq Va BROKEN . .It Va PORT_DBDIR Directory where the results of configuring .Va OPTIONS From owner-svn-src-stable@FreeBSD.ORG Mon May 30 08:04:47 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D15D9106566B; Mon, 30 May 2011 08:04:47 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C16578FC08; Mon, 30 May 2011 08:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U84lgv066791; Mon, 30 May 2011 08:04:47 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U84lJY066789; Mon, 30 May 2011 08:04:47 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300804.p4U84lJY066789@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222480 - stable/8/share/man/man7 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:04:47 -0000 Author: bcr (doc committer) Date: Mon May 30 08:04:47 2011 New Revision: 222480 URL: http://svn.freebsd.org/changeset/base/222480 Log: MFC r222278: Add a description to the checksum target about not only being able to verify, but also having the ability to fetch distfiles that are missing or failed the checksum calculation PR: docs/138887 Submitted by: Radim Kolar (hsn at sendmail dot cz) Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Mon May 30 08:00:28 2011 (r222479) +++ stable/8/share/man/man7/ports.7 Mon May 30 08:04:47 2011 (r222480) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2009 +.Dd May 25, 2011 .Dt PORTS 7 .Os .Sh NAME @@ -124,6 +124,8 @@ and .It Cm checksum Verify that the fetched distfile's checksum matches the one the port was tested against. +If the distfile's checksum does not match, it also fetches the distfiles +which are missing or failed the checksum calculation. Defining .Va NO_CHECKSUM will skip this step. From owner-svn-src-stable@FreeBSD.ORG Mon May 30 08:05:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55268106567A; Mon, 30 May 2011 08:05:28 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44FC98FC08; Mon, 30 May 2011 08:05:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U85SHv066851; Mon, 30 May 2011 08:05:28 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U85SSg066849; Mon, 30 May 2011 08:05:28 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105300805.p4U85SSg066849@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 08:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222481 - stable/7/share/man/man7 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:05:28 -0000 Author: bcr (doc committer) Date: Mon May 30 08:05:27 2011 New Revision: 222481 URL: http://svn.freebsd.org/changeset/base/222481 Log: MFC r222278: Add a description to the checksum target about not only being able to verify, but also having the ability to fetch distfiles that are missing or failed the checksum calculation PR: docs/138887 Submitted by: Radim Kolar (hsn at sendmail dot cz) Modified: stable/7/share/man/man7/ports.7 Directory Properties: stable/7/share/man/man7/ (props changed) Modified: stable/7/share/man/man7/ports.7 ============================================================================== --- stable/7/share/man/man7/ports.7 Mon May 30 08:04:47 2011 (r222480) +++ stable/7/share/man/man7/ports.7 Mon May 30 08:05:27 2011 (r222481) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2009 +.Dd May 25, 2011 .Dt PORTS 7 .Os .Sh NAME @@ -124,6 +124,8 @@ and .It Cm checksum Verify that the fetched distfile's checksum matches the one the port was tested against. +If the distfile's checksum does not match, it also fetches the distfiles +which are missing or failed the checksum calculation. Defining .Va NO_CHECKSUM will skip this step. From owner-svn-src-stable@FreeBSD.ORG Mon May 30 11:24:03 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F5541065672; Mon, 30 May 2011 11:24:03 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E7C58FC1C; Mon, 30 May 2011 11:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UBO3TC074903; Mon, 30 May 2011 11:24:03 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UBO3tg074896; Mon, 30 May 2011 11:24:03 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201105301124.p4UBO3tg074896@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 30 May 2011 11:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222496 - in stable/8/sys: kern netinet netinet/cc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 11:24:03 -0000 Author: pluknet Date: Mon May 30 11:24:03 2011 New Revision: 222496 URL: http://svn.freebsd.org/changeset/base/222496 Log: MFC r220592: Staticize malloc types. Approved by: lstewart Modified: stable/8/sys/kern/kern_hhook.c stable/8/sys/netinet/cc/cc_chd.c stable/8/sys/netinet/cc/cc_cubic.c stable/8/sys/netinet/cc/cc_htcp.c stable/8/sys/netinet/cc/cc_vegas.c stable/8/sys/netinet/siftr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/kern/kern_hhook.c Mon May 30 11:24:03 2011 (r222496) @@ -58,8 +58,7 @@ struct hhook { STAILQ_ENTRY(hhook) hhk_next; }; -MALLOC_DECLARE(M_HHOOK); -MALLOC_DEFINE(M_HHOOK, "hhook", "Helper hooks are linked off hhook_head lists"); +static MALLOC_DEFINE(M_HHOOK, "hhook", "Helper hooks are linked off hhook_head lists"); LIST_HEAD(hhookheadhead, hhook_head); VNET_DEFINE(struct hhookheadhead, hhook_head_list); Modified: stable/8/sys/netinet/cc/cc_chd.c ============================================================================== --- stable/8/sys/netinet/cc/cc_chd.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/netinet/cc/cc_chd.c Mon May 30 11:24:03 2011 (r222496) @@ -127,8 +127,7 @@ static VNET_DEFINE(uint32_t, chd_qthresh #define V_chd_loss_fair VNET(chd_loss_fair) #define V_chd_use_max VNET(chd_use_max) -MALLOC_DECLARE(M_CHD); -MALLOC_DEFINE(M_CHD, "chd data", +static MALLOC_DEFINE(M_CHD, "chd data", "Per connection data required for the CHD congestion control algorithm"); struct cc_algo chd_cc_algo = { Modified: stable/8/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/8/sys/netinet/cc/cc_cubic.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/netinet/cc/cc_cubic.c Mon May 30 11:24:03 2011 (r222496) @@ -98,8 +98,7 @@ struct cubic { int t_last_cong; }; -MALLOC_DECLARE(M_CUBIC); -MALLOC_DEFINE(M_CUBIC, "cubic data", +static MALLOC_DEFINE(M_CUBIC, "cubic data", "Per connection data required for the CUBIC congestion control algorithm"); struct cc_algo cubic_cc_algo = { Modified: stable/8/sys/netinet/cc/cc_htcp.c ============================================================================== --- stable/8/sys/netinet/cc/cc_htcp.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/netinet/cc/cc_htcp.c Mon May 30 11:24:03 2011 (r222496) @@ -173,8 +173,7 @@ static VNET_DEFINE(uint8_t, htcp_rtt_sca #define V_htcp_adaptive_backoff VNET(htcp_adaptive_backoff) #define V_htcp_rtt_scaling VNET(htcp_rtt_scaling) -MALLOC_DECLARE(M_HTCP); -MALLOC_DEFINE(M_HTCP, "htcp data", +static MALLOC_DEFINE(M_HTCP, "htcp data", "Per connection data required for the HTCP congestion control algorithm"); struct cc_algo htcp_cc_algo = { Modified: stable/8/sys/netinet/cc/cc_vegas.c ============================================================================== --- stable/8/sys/netinet/cc/cc_vegas.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/netinet/cc/cc_vegas.c Mon May 30 11:24:03 2011 (r222496) @@ -105,8 +105,7 @@ static VNET_DEFINE(uint32_t, vegas_beta) #define V_vegas_alpha VNET(vegas_alpha) #define V_vegas_beta VNET(vegas_beta) -MALLOC_DECLARE(M_VEGAS); -MALLOC_DEFINE(M_VEGAS, "vegas data", +static MALLOC_DEFINE(M_VEGAS, "vegas data", "Per connection data required for the Vegas congestion control algorithm"); struct cc_algo vegas_cc_algo = { Modified: stable/8/sys/netinet/siftr.c ============================================================================== --- stable/8/sys/netinet/siftr.c Mon May 30 11:17:42 2011 (r222495) +++ stable/8/sys/netinet/siftr.c Mon May 30 11:24:03 2011 (r222496) @@ -156,14 +156,11 @@ __FBSDID("$FreeBSD$"); #define THIRD_OCTET(X) (((X) & 0x0000FF00) >> 8) #define FOURTH_OCTET(X) ((X) & 0x000000FF) -MALLOC_DECLARE(M_SIFTR); -MALLOC_DEFINE(M_SIFTR, "siftr", "dynamic memory used by SIFTR"); - -MALLOC_DECLARE(M_SIFTR_PKTNODE); -MALLOC_DEFINE(M_SIFTR_PKTNODE, "siftr_pktnode", "SIFTR pkt_node struct"); - -MALLOC_DECLARE(M_SIFTR_HASHNODE); -MALLOC_DEFINE(M_SIFTR_HASHNODE, "siftr_hashnode", "SIFTR flow_hash_node struct"); +static MALLOC_DEFINE(M_SIFTR, "siftr", "dynamic memory used by SIFTR"); +static MALLOC_DEFINE(M_SIFTR_PKTNODE, "siftr_pktnode", + "SIFTR pkt_node struct"); +static MALLOC_DEFINE(M_SIFTR_HASHNODE, "siftr_hashnode", + "SIFTR flow_hash_node struct"); /* Used as links in the pkt manager queue. */ struct pkt_node { From owner-svn-src-stable@FreeBSD.ORG Mon May 30 16:10:16 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46F981065676; Mon, 30 May 2011 16:10:16 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 361A78FC1C; Mon, 30 May 2011 16:10:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UGAGvK084216; Mon, 30 May 2011 16:10:16 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UGAGmm084214; Mon, 30 May 2011 16:10:16 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105301610.p4UGAGmm084214@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 30 May 2011 16:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222501 - stable/8/sys/dev/uart X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 16:10:16 -0000 Author: marcel Date: Mon May 30 16:10:15 2011 New Revision: 222501 URL: http://svn.freebsd.org/changeset/base/222501 Log: MFC r222317: Ignore MCR[6] during the probe to fix a false negative. PR: kern/129663 Modified: stable/8/sys/dev/uart/uart_dev_ns8250.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- stable/8/sys/dev/uart/uart_dev_ns8250.c Mon May 30 15:48:28 2011 (r222500) +++ stable/8/sys/dev/uart/uart_dev_ns8250.c Mon May 30 16:10:15 2011 (r222501) @@ -242,8 +242,14 @@ ns8250_probe(struct uart_bas *bas) val = uart_getreg(bas, REG_IIR); if (val & 0x30) return (ENXIO); + /* + * Bit 6 of the MCR (= 0x40) appears to be 1 for the Sun1699 + * chip, but otherwise doesn't seem to have a function. In + * other words, uart(4) works regardless. Ignore that bit so + * the probe succeeds. + */ val = uart_getreg(bas, REG_MCR); - if (val & 0xe0) + if (val & 0xa0) return (ENXIO); return (0); From owner-svn-src-stable@FreeBSD.ORG Mon May 30 23:27:43 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 260781065672; Mon, 30 May 2011 23:27:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14D9F8FC15; Mon, 30 May 2011 23:27:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UNRgt6097629; Mon, 30 May 2011 23:27:42 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UNRgBf097626; Mon, 30 May 2011 23:27:42 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105302327.p4UNRgBf097626@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 30 May 2011 23:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222514 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 23:27:43 -0000 Author: np Date: Mon May 30 23:27:42 2011 New Revision: 222514 URL: http://svn.freebsd.org/changeset/base/222514 Log: MFC r222003, r222085, r222102 r222003: Add missing header. The test for VLAN_CAPABILITIES later in the file doesn't make sense without it. r222085: - Enable per-channel congestion notification. - Enable PCIe relaxed ordering for all egress queues and rx data buffers. r222102: Simplify t4_os_find_pci_capability. Modified: stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon May 30 21:56:37 2011 (r222513) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon May 30 23:27:42 2011 (r222514) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "common/t4_hw.h" #include "common/common.h" @@ -365,7 +366,13 @@ t4_attach(device_t dev) sc->mbox = sc->pf; pci_enable_busmaster(dev); - pci_set_max_read_req(dev, 4096); + if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) { + pci_set_max_read_req(dev, 4096); + v = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2); + v |= PCIM_EXP_CTL_RELAXED_ORD_ENABLE; + pci_write_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, v, 2); + } + snprintf(sc->lockname, sizeof(sc->lockname), "%s", device_get_nameunit(dev)); mtx_init(&sc->sc_lock, sc->lockname, 0, MTX_DEF); @@ -3208,41 +3215,9 @@ filter_rpl(struct adapter *sc, const str int t4_os_find_pci_capability(struct adapter *sc, int cap) { - device_t dev; - struct pci_devinfo *dinfo; - pcicfgregs *cfg; - uint32_t status; - uint8_t ptr; - - dev = sc->dev; - dinfo = device_get_ivars(dev); - cfg = &dinfo->cfg; - - status = pci_read_config(dev, PCIR_STATUS, 2); - if (!(status & PCIM_STATUS_CAPPRESENT)) - return (0); - - switch (cfg->hdrtype & PCIM_HDRTYPE) { - case 0: - case 1: - ptr = PCIR_CAP_PTR; - break; - case 2: - ptr = PCIR_CAP_PTR_2; - break; - default: - return (0); - break; - } - ptr = pci_read_config(dev, ptr, 1); - - while (ptr != 0) { - if (pci_read_config(dev, ptr + PCICAP_ID, 1) == cap) - return (ptr); - ptr = pci_read_config(dev, ptr + PCICAP_NEXTPTR, 1); - } + int i; - return (0); + return (pci_find_cap(sc->dev, cap, &i) == 0 ? i : 0); } int Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Mon May 30 21:56:37 2011 (r222513) +++ stable/8/sys/dev/cxgbe/t4_sge.c Mon May 30 23:27:42 2011 (r222514) @@ -100,7 +100,7 @@ static int alloc_ring(struct adapter *, static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, void *); static int alloc_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *, - int); + int, int); static int free_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *); static int alloc_iq(struct sge_iq *, int); static int free_iq(struct sge_iq *); @@ -1103,7 +1103,7 @@ free_ring(struct adapter *sc, bus_dma_ta */ static int alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl, - int intr_idx) + int intr_idx, int cong) { int rc, i, cntxt_id; size_t len; @@ -1154,6 +1154,8 @@ alloc_iq_fl(struct port_info *pi, struct V_FW_IQ_CMD_IQESIZE(ilog2(iq->esize) - 4)); c.iqsize = htobe16(iq->qsize); c.iqaddr = htobe64(iq->ba); + if (cong >= 0) + c.iqns_to_fl0congen = htobe32(F_FW_IQ_CMD_IQFLINTCONGEN); if (fl) { mtx_init(&fl->fl_lock, fl->lockname, NULL, MTX_DEF); @@ -1197,7 +1199,15 @@ alloc_iq_fl(struct port_info *pi, struct fl->needed = fl->cap; c.iqns_to_fl0congen = - htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE)); + htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) | + F_FW_IQ_CMD_FL0FETCHRO | F_FW_IQ_CMD_FL0DATARO | + F_FW_IQ_CMD_FL0PADEN); + if (cong >= 0) { + c.iqns_to_fl0congen |= + htobe32(V_FW_IQ_CMD_FL0CNGCHMAP(cong) | + F_FW_IQ_CMD_FL0CONGCIF | + F_FW_IQ_CMD_FL0CONGEN); + } c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) | V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B)); @@ -1324,7 +1334,7 @@ free_iq_fl(struct port_info *pi, struct static int alloc_iq(struct sge_iq *iq, int intr_idx) { - return alloc_iq_fl(NULL, iq, NULL, intr_idx); + return alloc_iq_fl(NULL, iq, NULL, intr_idx, -1); } static int @@ -1341,7 +1351,7 @@ alloc_rxq(struct port_info *pi, struct s struct sysctl_oid_list *children; char name[16]; - rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx); + rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, 1 << pi->tx_chan); if (rc != 0) return (rc); @@ -1432,7 +1442,7 @@ alloc_ctrlq(struct adapter *sc, struct s c.physeqid_pkd = htobe32(0); c.fetchszm_to_iqid = htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | - V_FW_EQ_CTRL_CMD_PCIECHN(idx) | + V_FW_EQ_CTRL_CMD_PCIECHN(idx) | F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | @@ -1557,7 +1567,7 @@ alloc_txq(struct port_info *pi, struct s c.viid_pkd = htobe32(V_FW_EQ_ETH_CMD_VIID(pi->viid)); c.fetchszm_to_iqid = htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | - V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | + V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | From owner-svn-src-stable@FreeBSD.ORG Tue May 31 05:00:46 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 270C5106564A; Tue, 31 May 2011 05:00:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163128FC17; Tue, 31 May 2011 05:00:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4V50js1008232; Tue, 31 May 2011 05:00:45 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V50jcH008229; Tue, 31 May 2011 05:00:45 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105310500.p4V50jcH008229@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 31 May 2011 05:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222517 - stable/8/sys/geom/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 05:00:46 -0000 Author: ae Date: Tue May 31 05:00:45 2011 New Revision: 222517 URL: http://svn.freebsd.org/changeset/base/222517 Log: MFC r222243,222244: Remove unused variable. Modified: stable/8/sys/geom/part/g_part_mbr.c stable/8/sys/geom/part/g_part_pc98.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/8/sys/geom/part/g_part_mbr.c Tue May 31 01:30:58 2011 (r222516) +++ stable/8/sys/geom/part/g_part_mbr.c Tue May 31 05:00:45 2011 (r222517) @@ -248,14 +248,11 @@ g_part_mbr_bootcode(struct g_part_table static int g_part_mbr_create(struct g_part_table *basetable, struct g_part_parms *gpp) { - struct g_consumer *cp; struct g_provider *pp; struct g_part_mbr_table *table; uint32_t msize; pp = gpp->gpp_provider; - cp = LIST_FIRST(&pp->consumers); - if (pp->sectorsize < MBRSIZE) return (ENOSPC); Modified: stable/8/sys/geom/part/g_part_pc98.c ============================================================================== --- stable/8/sys/geom/part/g_part_pc98.c Tue May 31 01:30:58 2011 (r222516) +++ stable/8/sys/geom/part/g_part_pc98.c Tue May 31 05:00:45 2011 (r222517) @@ -218,14 +218,11 @@ g_part_pc98_bootcode(struct g_part_table static int g_part_pc98_create(struct g_part_table *basetable, struct g_part_parms *gpp) { - struct g_consumer *cp; struct g_provider *pp; struct g_part_pc98_table *table; uint32_t cyl, msize; pp = gpp->gpp_provider; - cp = LIST_FIRST(&pp->consumers); - if (pp->sectorsize < SECSIZE || pp->mediasize < 2 * SECSIZE) return (ENOSPC); if (pp->sectorsize > SECSIZE) From owner-svn-src-stable@FreeBSD.ORG Tue May 31 17:24:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 988511065676; Tue, 31 May 2011 17:24:18 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87F7E8FC17; Tue, 31 May 2011 17:24:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VHOIki033080; Tue, 31 May 2011 17:24:18 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VHOIFT033078; Tue, 31 May 2011 17:24:18 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201105311724.p4VHOIFT033078@svn.freebsd.org> From: Will Andrews Date: Tue, 31 May 2011 17:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222536 - stable/8/cddl/compat/opensolaris/misc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 17:24:18 -0000 Author: will Date: Tue May 31 17:24:18 2011 New Revision: 222536 URL: http://svn.freebsd.org/changeset/base/222536 Log: MFC r222313: Close a race between libzfs and mountd when updating NFS exports. Reviewed by: pjd Approved by: ken Modified: stable/8/cddl/compat/opensolaris/misc/fsshare.c Directory Properties: stable/8/cddl/compat/opensolaris/ (props changed) Modified: stable/8/cddl/compat/opensolaris/misc/fsshare.c ============================================================================== --- stable/8/cddl/compat/opensolaris/misc/fsshare.c Tue May 31 17:14:06 2011 (r222535) +++ stable/8/cddl/compat/opensolaris/misc/fsshare.c Tue May 31 17:24:18 2011 (r222536) @@ -221,6 +221,7 @@ out: error = errno; unlink(tmpfile); } else { + fflush(newfd); /* * Send SIGHUP to mountd, but unlock exports file later. */ From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 05:03:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 409031066462; Wed, 1 Jun 2011 05:03:18 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30AF68FC17; Wed, 1 Jun 2011 05:03:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5153IVL054690; Wed, 1 Jun 2011 05:03:18 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5153IZ3054687; Wed, 1 Jun 2011 05:03:18 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106010503.p5153IZ3054687@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 1 Jun 2011 05:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222554 - stable/8/sys/geom/vinum X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 05:03:18 -0000 Author: ae Date: Wed Jun 1 05:03:17 2011 New Revision: 222554 URL: http://svn.freebsd.org/changeset/base/222554 Log: MFC r222283: Prevent non-aligned reading from provider while tasting. Reject providers with unsupported sectorsize. Modified: stable/8/sys/geom/vinum/geom_vinum_drive.c stable/8/sys/geom/vinum/geom_vinum_events.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/geom/vinum/geom_vinum_drive.c ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum_drive.c Wed Jun 1 01:35:09 2011 (r222553) +++ stable/8/sys/geom/vinum/geom_vinum_drive.c Wed Jun 1 05:03:17 2011 (r222554) @@ -126,6 +126,10 @@ gv_read_header(struct g_consumer *cp, st pp = cp->provider; KASSERT(pp != NULL, ("gv_read_header: null pp")); + if ((GV_HDR_OFFSET % pp->sectorsize) != 0 || + (GV_HDR_LEN % pp->sectorsize) != 0) + return (ENODEV); + d_hdr = g_read_data(cp, GV_HDR_OFFSET, pp->sectorsize, NULL); if (d_hdr == NULL) return (-1); Modified: stable/8/sys/geom/vinum/geom_vinum_events.c ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum_events.c Wed Jun 1 01:35:09 2011 (r222553) +++ stable/8/sys/geom/vinum/geom_vinum_events.c Wed Jun 1 05:03:17 2011 (r222554) @@ -109,6 +109,12 @@ gv_drive_tasted(struct gv_softc *sc, str buf = NULL; G_VINUM_DEBUG(2, "tasted drive on '%s'", pp->name); + if ((GV_CFG_OFFSET % pp->sectorsize) != 0 || + (GV_CFG_LEN % pp->sectorsize) != 0) { + G_VINUM_DEBUG(0, "provider %s has unsupported sectorsize.", + pp->name); + return; + } gp = sc->geom; g_topology_lock(); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 05:50:25 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B79F106564A; Wed, 1 Jun 2011 05:50:25 +0000 (UTC) (envelope-from art@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A82D8FC22; Wed, 1 Jun 2011 05:50:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p515oOcO056305; Wed, 1 Jun 2011 05:50:24 GMT (envelope-from art@svn.freebsd.org) Received: (from art@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p515oOjk056295; Wed, 1 Jun 2011 05:50:24 GMT (envelope-from art@svn.freebsd.org) Message-Id: <201106010550.p515oOjk056295@svn.freebsd.org> From: Artem Belevich Date: Wed, 1 Jun 2011 05:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222555 - in stable/8/sys: amd64/linux32 compat/freebsd32 i386/linux kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 05:50:25 -0000 Author: art Date: Wed Jun 1 05:50:24 2011 New Revision: 222555 URL: http://svn.freebsd.org/changeset/base/222555 Log: MFC r219559: add DTrace systrace support for linux32 and freebsd32 on amd64 syscalls This commits makes necessary changes in syscall/sysent generation infrastructure. PR: kern/152822 Reviewed by: jhb (ealier version) Approved by: avg (mentor) Modified: stable/8/sys/amd64/linux32/Makefile stable/8/sys/amd64/linux32/syscalls.conf stable/8/sys/amd64/linux32/syscalls.master stable/8/sys/compat/freebsd32/Makefile stable/8/sys/compat/freebsd32/syscalls.conf stable/8/sys/i386/linux/Makefile stable/8/sys/i386/linux/syscalls.conf stable/8/sys/i386/linux/syscalls.master stable/8/sys/kern/makesyscalls.sh Modified: stable/8/sys/amd64/linux32/Makefile ============================================================================== --- stable/8/sys/amd64/linux32/Makefile Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/amd64/linux32/Makefile Wed Jun 1 05:50:24 2011 (r222555) @@ -5,11 +5,13 @@ all: @echo "make sysent only" -sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h +sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c -linux32_sysent.c linux32_syscall.h linux32_proto.h: ../../kern/makesyscalls.sh \ +linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../kern/makesyscalls.sh \ syscalls.master syscalls.conf -mv -f linux32_sysent.c linux32_sysent.c.bak -mv -f linux32_syscall.h linux32_syscall.h.bak -mv -f linux32_proto.h linux32_proto.h.bak + -mv -f linux32_syscalls.c linux32_syscalls.c.bak + -mv -f linux32_systrace_args.c linux32_systrace_args.c.bak sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf Modified: stable/8/sys/amd64/linux32/syscalls.conf ============================================================================== --- stable/8/sys/amd64/linux32/syscalls.conf Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/amd64/linux32/syscalls.conf Wed Jun 1 05:50:24 2011 (r222555) @@ -1,5 +1,5 @@ # $FreeBSD$ -sysnames="/dev/null" +sysnames="linux32_syscalls.c" sysproto="linux32_proto.h" sysproto_h=_LINUX_SYSPROTO_H_ syshdr="linux32_syscall.h" @@ -8,4 +8,4 @@ sysmk="/dev/null" syscallprefix="LINUX_SYS_" switchname="linux_sysent" namesname="linux_syscallnames" -systrace="/dev/null" +systrace="linux32_systrace_args.c" Modified: stable/8/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/8/sys/amd64/linux32/syscalls.master Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/amd64/linux32/syscalls.master Wed Jun 1 05:50:24 2011 (r222555) @@ -291,7 +291,7 @@ l_uid16_t *euid, l_uid16_t *suid); } 166 AUE_NULL UNIMPL vm86 167 AUE_NULL STD { int linux_query_module(void); } -168 AUE_POLL NOPROTO { int poll(struct pollfd*, \ +168 AUE_POLL NOPROTO { int poll(struct pollfd *fds, \ unsigned int nfds, int timeout); } 169 AUE_NULL STD { int linux_nfsservctl(void); } 170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \ Modified: stable/8/sys/compat/freebsd32/Makefile ============================================================================== --- stable/8/sys/compat/freebsd32/Makefile Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/compat/freebsd32/Makefile Wed Jun 1 05:50:24 2011 (r222555) @@ -5,15 +5,17 @@ all: @echo "make sysent only" -sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h +sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c -freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h: \ +freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \ ../../kern/makesyscalls.sh syscalls.master syscalls.conf -mv -f freebsd32_sysent.c freebsd32_sysent.c.bak -mv -f freebsd32_syscalls.c freebsd32_syscalls.c.bak -mv -f freebsd32_syscall.h freebsd32_syscall.h.bak -mv -f freebsd32_proto.h freebsd32_proto.h.bak + -mv -f freebsd32_systrace_args.c freebsd32_systrace_args.c.bak sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf clean: rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h + rm -f freebsd32_systrace_args.c Modified: stable/8/sys/compat/freebsd32/syscalls.conf ============================================================================== --- stable/8/sys/compat/freebsd32/syscalls.conf Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/compat/freebsd32/syscalls.conf Wed Jun 1 05:50:24 2011 (r222555) @@ -8,4 +8,4 @@ sysmk="/dev/null" syscallprefix="FREEBSD32_SYS_" switchname="freebsd32_sysent" namesname="freebsd32_syscallnames" -systrace="/dev/null" +systrace="freebsd32_systrace_args.c" Modified: stable/8/sys/i386/linux/Makefile ============================================================================== --- stable/8/sys/i386/linux/Makefile Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/i386/linux/Makefile Wed Jun 1 05:50:24 2011 (r222555) @@ -5,11 +5,13 @@ all: @echo "make sysent only" -sysent: linux_sysent.c linux_syscall.h linux_proto.h +sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c -linux_sysent.c linux_syscall.h linux_proto.h: ../../kern/makesyscalls.sh \ - syscalls.master syscalls.conf +linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ + ../../kern/makesyscalls.sh syscalls.master syscalls.conf -mv -f linux_sysent.c linux_sysent.c.bak -mv -f linux_syscall.h linux_syscall.h.bak -mv -f linux_proto.h linux_proto.h.bak + -mv -f linux_syscalls.c linux_syscalls.c.bak + -mv -f linux_systrace_args.c linux_systrace_args.c.bak sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf Modified: stable/8/sys/i386/linux/syscalls.conf ============================================================================== --- stable/8/sys/i386/linux/syscalls.conf Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/i386/linux/syscalls.conf Wed Jun 1 05:50:24 2011 (r222555) @@ -1,5 +1,5 @@ # $FreeBSD$ -sysnames="/dev/null" +sysnames="linux_syscalls.c" sysproto="linux_proto.h" sysproto_h=_LINUX_SYSPROTO_H_ syshdr="linux_syscall.h" @@ -8,4 +8,4 @@ sysmk="/dev/null" syscallprefix="LINUX_SYS_" switchname="linux_sysent" namesname="linux_syscallnames" -systrace="/dev/null" +systrace="linux_systrace_args.c" Modified: stable/8/sys/i386/linux/syscalls.master ============================================================================== --- stable/8/sys/i386/linux/syscalls.master Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/i386/linux/syscalls.master Wed Jun 1 05:50:24 2011 (r222555) @@ -102,7 +102,7 @@ 46 AUE_SETGID STD { int linux_setgid16(l_gid16_t gid); } 47 AUE_GETGID STD { int linux_getgid16(void); } 48 AUE_NULL STD { int linux_signal(l_int sig, \ - l_handler_t handler); } + void *handler); } 49 AUE_GETEUID STD { int linux_geteuid16(void); } 50 AUE_GETEGID STD { int linux_getegid16(void); } 51 AUE_ACCT NOPROTO { int acct(char *path); } @@ -148,7 +148,7 @@ struct timeval *tp, \ struct timezone *tzp); } 79 AUE_SETTIMEOFDAY NOPROTO { int settimeofday( \ - struct timeval *tp, \ + struct timeval *tv, \ struct timezone *tzp); } 80 AUE_GETGROUPS STD { int linux_getgroups16(l_uint gidsetsize, \ l_gid16_t *gidset); } @@ -293,7 +293,7 @@ l_uid16_t *euid, l_uid16_t *suid); } 166 AUE_NULL STD { int linux_vm86(void); } 167 AUE_NULL STD { int linux_query_module(void); } -168 AUE_POLL NOPROTO { int poll(struct pollfd*, \ +168 AUE_POLL NOPROTO { int poll(struct pollfd* fds, \ unsigned int nfds, long timeout); } 169 AUE_NULL STD { int linux_nfsservctl(void); } 170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \ Modified: stable/8/sys/kern/makesyscalls.sh ============================================================================== --- stable/8/sys/kern/makesyscalls.sh Wed Jun 1 05:03:17 2011 (r222554) +++ stable/8/sys/kern/makesyscalls.sh Wed Jun 1 05:50:24 2011 (r222555) @@ -190,6 +190,8 @@ s/\$//g print > syscompat6 print > syscompat7 print > sysnames + print > systrace + print > systracetmp savesyscall = syscall next } @@ -202,6 +204,8 @@ s/\$//g print > syscompat6 print > syscompat7 print > sysnames + print > systrace + print > systracetmp syscall = savesyscall next } @@ -214,6 +218,8 @@ s/\$//g print > syscompat6 print > syscompat7 print > sysnames + print > systrace + print > systracetmp next } syscall != $1 { From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 06:01:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02B5E106566B; Wed, 1 Jun 2011 06:01:18 +0000 (UTC) (envelope-from art@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5DF88FC23; Wed, 1 Jun 2011 06:01:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5161HmD056709; Wed, 1 Jun 2011 06:01:17 GMT (envelope-from art@svn.freebsd.org) Received: (from art@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5161HgT056702; Wed, 1 Jun 2011 06:01:17 GMT (envelope-from art@svn.freebsd.org) Message-Id: <201106010601.p5161HgT056702@svn.freebsd.org> From: Artem Belevich Date: Wed, 1 Jun 2011 06:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222556 - in stable/8/sys: amd64/linux32 compat/freebsd32 i386/linux X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 06:01:18 -0000 Author: art Date: Wed Jun 1 06:01:17 2011 New Revision: 222556 URL: http://svn.freebsd.org/changeset/base/222556 Log: Added DTrace systrace support for linux32 and freebsd32 on amd64 syscalls Regenerates system call and systrace support files. PR: kern/152822 Reviewed by: jhb (earlier version) Approved by: avg (mentor) Added: stable/8/sys/amd64/linux32/linux32_syscalls.c (contents, props changed) stable/8/sys/amd64/linux32/linux32_systrace_args.c (contents, props changed) stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c (contents, props changed) stable/8/sys/i386/linux/linux_syscalls.c (contents, props changed) stable/8/sys/i386/linux/linux_systrace_args.c (contents, props changed) Modified: stable/8/sys/amd64/linux32/linux32_proto.h stable/8/sys/amd64/linux32/linux32_syscall.h stable/8/sys/amd64/linux32/linux32_sysent.c stable/8/sys/i386/linux/linux_proto.h stable/8/sys/i386/linux/linux_syscall.h stable/8/sys/i386/linux/linux_sysent.c Modified: stable/8/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/8/sys/amd64/linux32/linux32_proto.h Wed Jun 1 05:50:24 2011 (r222555) +++ stable/8/sys/amd64/linux32/linux32_proto.h Wed Jun 1 06:01:17 2011 (r222556) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 220466 2011-04-09 08:29:07Z avg + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 222555 2011-06-01 05:50:24Z art */ #ifndef _LINUX_SYSPROTO_H_ Modified: stable/8/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- stable/8/sys/amd64/linux32/linux32_syscall.h Wed Jun 1 05:50:24 2011 (r222555) +++ stable/8/sys/amd64/linux32/linux32_syscall.h Wed Jun 1 06:01:17 2011 (r222556) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 220466 2011-04-09 08:29:07Z avg + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 222555 2011-06-01 05:50:24Z art */ #define LINUX_SYS_exit 1 Added: stable/8/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/amd64/linux32/linux32_syscalls.c Wed Jun 1 06:01:17 2011 (r222556) @@ -0,0 +1,328 @@ +/* + * System call names. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 222555 2011-06-01 05:50:24Z art + */ + +const char *linux_syscallnames[] = { +#define nosys linux_nosys + "#0", /* 0 = setup */ + "exit", /* 1 = exit */ + "linux_fork", /* 2 = linux_fork */ + "read", /* 3 = read */ + "write", /* 4 = write */ + "linux_open", /* 5 = linux_open */ + "close", /* 6 = close */ + "linux_waitpid", /* 7 = linux_waitpid */ + "linux_creat", /* 8 = linux_creat */ + "linux_link", /* 9 = linux_link */ + "linux_unlink", /* 10 = linux_unlink */ + "linux_execve", /* 11 = linux_execve */ + "linux_chdir", /* 12 = linux_chdir */ + "linux_time", /* 13 = linux_time */ + "linux_mknod", /* 14 = linux_mknod */ + "linux_chmod", /* 15 = linux_chmod */ + "linux_lchown16", /* 16 = linux_lchown16 */ + "#17", /* 17 = break */ + "linux_stat", /* 18 = linux_stat */ + "linux_lseek", /* 19 = linux_lseek */ + "linux_getpid", /* 20 = linux_getpid */ + "linux_mount", /* 21 = linux_mount */ + "linux_oldumount", /* 22 = linux_oldumount */ + "linux_setuid16", /* 23 = linux_setuid16 */ + "linux_getuid16", /* 24 = linux_getuid16 */ + "linux_stime", /* 25 = linux_stime */ + "linux_ptrace", /* 26 = linux_ptrace */ + "linux_alarm", /* 27 = linux_alarm */ + "#28", /* 28 = fstat */ + "linux_pause", /* 29 = linux_pause */ + "linux_utime", /* 30 = linux_utime */ + "#31", /* 31 = stty */ + "#32", /* 32 = gtty */ + "linux_access", /* 33 = linux_access */ + "linux_nice", /* 34 = linux_nice */ + "#35", /* 35 = ftime */ + "sync", /* 36 = sync */ + "linux_kill", /* 37 = linux_kill */ + "linux_rename", /* 38 = linux_rename */ + "linux_mkdir", /* 39 = linux_mkdir */ + "linux_rmdir", /* 40 = linux_rmdir */ + "dup", /* 41 = dup */ + "linux_pipe", /* 42 = linux_pipe */ + "linux_times", /* 43 = linux_times */ + "#44", /* 44 = prof */ + "linux_brk", /* 45 = linux_brk */ + "linux_setgid16", /* 46 = linux_setgid16 */ + "linux_getgid16", /* 47 = linux_getgid16 */ + "linux_signal", /* 48 = linux_signal */ + "linux_geteuid16", /* 49 = linux_geteuid16 */ + "linux_getegid16", /* 50 = linux_getegid16 */ + "acct", /* 51 = acct */ + "linux_umount", /* 52 = linux_umount */ + "#53", /* 53 = lock */ + "linux_ioctl", /* 54 = linux_ioctl */ + "linux_fcntl", /* 55 = linux_fcntl */ + "#56", /* 56 = mpx */ + "setpgid", /* 57 = setpgid */ + "#58", /* 58 = ulimit */ + "linux_olduname", /* 59 = linux_olduname */ + "umask", /* 60 = umask */ + "chroot", /* 61 = chroot */ + "linux_ustat", /* 62 = linux_ustat */ + "dup2", /* 63 = dup2 */ + "linux_getppid", /* 64 = linux_getppid */ + "getpgrp", /* 65 = getpgrp */ + "setsid", /* 66 = setsid */ + "linux_sigaction", /* 67 = linux_sigaction */ + "linux_sgetmask", /* 68 = linux_sgetmask */ + "linux_ssetmask", /* 69 = linux_ssetmask */ + "linux_setreuid16", /* 70 = linux_setreuid16 */ + "linux_setregid16", /* 71 = linux_setregid16 */ + "linux_sigsuspend", /* 72 = linux_sigsuspend */ + "linux_sigpending", /* 73 = linux_sigpending */ + "linux_sethostname", /* 74 = linux_sethostname */ + "linux_setrlimit", /* 75 = linux_setrlimit */ + "linux_old_getrlimit", /* 76 = linux_old_getrlimit */ + "linux_getrusage", /* 77 = linux_getrusage */ + "linux_gettimeofday", /* 78 = linux_gettimeofday */ + "linux_settimeofday", /* 79 = linux_settimeofday */ + "linux_getgroups16", /* 80 = linux_getgroups16 */ + "linux_setgroups16", /* 81 = linux_setgroups16 */ + "linux_old_select", /* 82 = linux_old_select */ + "linux_symlink", /* 83 = linux_symlink */ + "linux_lstat", /* 84 = linux_lstat */ + "linux_readlink", /* 85 = linux_readlink */ + "#86", /* 86 = linux_uselib */ + "swapon", /* 87 = swapon */ + "linux_reboot", /* 88 = linux_reboot */ + "linux_readdir", /* 89 = linux_readdir */ + "linux_mmap", /* 90 = linux_mmap */ + "munmap", /* 91 = munmap */ + "linux_truncate", /* 92 = linux_truncate */ + "linux_ftruncate", /* 93 = linux_ftruncate */ + "fchmod", /* 94 = fchmod */ + "fchown", /* 95 = fchown */ + "linux_getpriority", /* 96 = linux_getpriority */ + "setpriority", /* 97 = setpriority */ + "#98", /* 98 = profil */ + "linux_statfs", /* 99 = linux_statfs */ + "linux_fstatfs", /* 100 = linux_fstatfs */ + "#101", /* 101 = ioperm */ + "linux_socketcall", /* 102 = linux_socketcall */ + "linux_syslog", /* 103 = linux_syslog */ + "linux_setitimer", /* 104 = linux_setitimer */ + "linux_getitimer", /* 105 = linux_getitimer */ + "linux_newstat", /* 106 = linux_newstat */ + "linux_newlstat", /* 107 = linux_newlstat */ + "linux_newfstat", /* 108 = linux_newfstat */ + "linux_uname", /* 109 = linux_uname */ + "linux_iopl", /* 110 = linux_iopl */ + "linux_vhangup", /* 111 = linux_vhangup */ + "#112", /* 112 = idle */ + "#113", /* 113 = vm86old */ + "linux_wait4", /* 114 = linux_wait4 */ + "linux_swapoff", /* 115 = linux_swapoff */ + "linux_sysinfo", /* 116 = linux_sysinfo */ + "linux_ipc", /* 117 = linux_ipc */ + "fsync", /* 118 = fsync */ + "linux_sigreturn", /* 119 = linux_sigreturn */ + "linux_clone", /* 120 = linux_clone */ + "linux_setdomainname", /* 121 = linux_setdomainname */ + "linux_newuname", /* 122 = linux_newuname */ + "#123", /* 123 = modify_ldt */ + "linux_adjtimex", /* 124 = linux_adjtimex */ + "linux_mprotect", /* 125 = linux_mprotect */ + "linux_sigprocmask", /* 126 = linux_sigprocmask */ + "linux_create_module", /* 127 = linux_create_module */ + "linux_init_module", /* 128 = linux_init_module */ + "linux_delete_module", /* 129 = linux_delete_module */ + "linux_get_kernel_syms", /* 130 = linux_get_kernel_syms */ + "linux_quotactl", /* 131 = linux_quotactl */ + "getpgid", /* 132 = getpgid */ + "fchdir", /* 133 = fchdir */ + "linux_bdflush", /* 134 = linux_bdflush */ + "linux_sysfs", /* 135 = linux_sysfs */ + "linux_personality", /* 136 = linux_personality */ + "#137", /* 137 = afs_syscall */ + "linux_setfsuid16", /* 138 = linux_setfsuid16 */ + "linux_setfsgid16", /* 139 = linux_setfsgid16 */ + "linux_llseek", /* 140 = linux_llseek */ + "linux_getdents", /* 141 = linux_getdents */ + "linux_select", /* 142 = linux_select */ + "flock", /* 143 = flock */ + "linux_msync", /* 144 = linux_msync */ + "linux_readv", /* 145 = linux_readv */ + "linux_writev", /* 146 = linux_writev */ + "linux_getsid", /* 147 = linux_getsid */ + "linux_fdatasync", /* 148 = linux_fdatasync */ + "linux_sysctl", /* 149 = linux_sysctl */ + "mlock", /* 150 = mlock */ + "munlock", /* 151 = munlock */ + "mlockall", /* 152 = mlockall */ + "munlockall", /* 153 = munlockall */ + "sched_setparam", /* 154 = sched_setparam */ + "sched_getparam", /* 155 = sched_getparam */ + "linux_sched_setscheduler", /* 156 = linux_sched_setscheduler */ + "linux_sched_getscheduler", /* 157 = linux_sched_getscheduler */ + "sched_yield", /* 158 = sched_yield */ + "linux_sched_get_priority_max", /* 159 = linux_sched_get_priority_max */ + "linux_sched_get_priority_min", /* 160 = linux_sched_get_priority_min */ + "linux_sched_rr_get_interval", /* 161 = linux_sched_rr_get_interval */ + "linux_nanosleep", /* 162 = linux_nanosleep */ + "linux_mremap", /* 163 = linux_mremap */ + "linux_setresuid16", /* 164 = linux_setresuid16 */ + "linux_getresuid16", /* 165 = linux_getresuid16 */ + "#166", /* 166 = vm86 */ + "linux_query_module", /* 167 = linux_query_module */ + "poll", /* 168 = poll */ + "linux_nfsservctl", /* 169 = linux_nfsservctl */ + "linux_setresgid16", /* 170 = linux_setresgid16 */ + "linux_getresgid16", /* 171 = linux_getresgid16 */ + "linux_prctl", /* 172 = linux_prctl */ + "linux_rt_sigreturn", /* 173 = linux_rt_sigreturn */ + "linux_rt_sigaction", /* 174 = linux_rt_sigaction */ + "linux_rt_sigprocmask", /* 175 = linux_rt_sigprocmask */ + "linux_rt_sigpending", /* 176 = linux_rt_sigpending */ + "linux_rt_sigtimedwait", /* 177 = linux_rt_sigtimedwait */ + "linux_rt_sigqueueinfo", /* 178 = linux_rt_sigqueueinfo */ + "linux_rt_sigsuspend", /* 179 = linux_rt_sigsuspend */ + "linux_pread", /* 180 = linux_pread */ + "linux_pwrite", /* 181 = linux_pwrite */ + "linux_chown16", /* 182 = linux_chown16 */ + "linux_getcwd", /* 183 = linux_getcwd */ + "linux_capget", /* 184 = linux_capget */ + "linux_capset", /* 185 = linux_capset */ + "linux_sigaltstack", /* 186 = linux_sigaltstack */ + "linux_sendfile", /* 187 = linux_sendfile */ + "#188", /* 188 = getpmsg */ + "#189", /* 189 = putpmsg */ + "linux_vfork", /* 190 = linux_vfork */ + "linux_getrlimit", /* 191 = linux_getrlimit */ + "linux_mmap2", /* 192 = linux_mmap2 */ + "linux_truncate64", /* 193 = linux_truncate64 */ + "linux_ftruncate64", /* 194 = linux_ftruncate64 */ + "linux_stat64", /* 195 = linux_stat64 */ + "linux_lstat64", /* 196 = linux_lstat64 */ + "linux_fstat64", /* 197 = linux_fstat64 */ + "linux_lchown", /* 198 = linux_lchown */ + "linux_getuid", /* 199 = linux_getuid */ + "linux_getgid", /* 200 = linux_getgid */ + "geteuid", /* 201 = geteuid */ + "getegid", /* 202 = getegid */ + "setreuid", /* 203 = setreuid */ + "setregid", /* 204 = setregid */ + "linux_getgroups", /* 205 = linux_getgroups */ + "linux_setgroups", /* 206 = linux_setgroups */ + "fchown", /* 207 = fchown */ + "setresuid", /* 208 = setresuid */ + "getresuid", /* 209 = getresuid */ + "setresgid", /* 210 = setresgid */ + "getresgid", /* 211 = getresgid */ + "linux_chown", /* 212 = linux_chown */ + "setuid", /* 213 = setuid */ + "setgid", /* 214 = setgid */ + "linux_setfsuid", /* 215 = linux_setfsuid */ + "linux_setfsgid", /* 216 = linux_setfsgid */ + "linux_pivot_root", /* 217 = linux_pivot_root */ + "linux_mincore", /* 218 = linux_mincore */ + "madvise", /* 219 = madvise */ + "linux_getdents64", /* 220 = linux_getdents64 */ + "linux_fcntl64", /* 221 = linux_fcntl64 */ + "#222", /* 222 = */ + "#223", /* 223 = */ + "linux_gettid", /* 224 = linux_gettid */ + "#225", /* 225 = linux_readahead */ + "linux_setxattr", /* 226 = linux_setxattr */ + "linux_lsetxattr", /* 227 = linux_lsetxattr */ + "linux_fsetxattr", /* 228 = linux_fsetxattr */ + "linux_getxattr", /* 229 = linux_getxattr */ + "linux_lgetxattr", /* 230 = linux_lgetxattr */ + "linux_fgetxattr", /* 231 = linux_fgetxattr */ + "linux_listxattr", /* 232 = linux_listxattr */ + "linux_llistxattr", /* 233 = linux_llistxattr */ + "linux_flistxattr", /* 234 = linux_flistxattr */ + "linux_removexattr", /* 235 = linux_removexattr */ + "linux_lremovexattr", /* 236 = linux_lremovexattr */ + "linux_fremovexattr", /* 237 = linux_fremovexattr */ + "linux_tkill", /* 238 = linux_tkill */ + "#239", /* 239 = linux_sendfile64 */ + "linux_sys_futex", /* 240 = linux_sys_futex */ + "linux_sched_setaffinity", /* 241 = linux_sched_setaffinity */ + "linux_sched_getaffinity", /* 242 = linux_sched_getaffinity */ + "linux_set_thread_area", /* 243 = linux_set_thread_area */ + "#244", /* 244 = linux_get_thread_area */ + "#245", /* 245 = linux_io_setup */ + "#246", /* 246 = linux_io_destroy */ + "#247", /* 247 = linux_io_getevents */ + "#248", /* 248 = linux_io_submit */ + "#249", /* 249 = linux_io_cancel */ + "linux_fadvise64", /* 250 = linux_fadvise64 */ + "#251", /* 251 = */ + "linux_exit_group", /* 252 = linux_exit_group */ + "linux_lookup_dcookie", /* 253 = linux_lookup_dcookie */ + "linux_epoll_create", /* 254 = linux_epoll_create */ + "linux_epoll_ctl", /* 255 = linux_epoll_ctl */ + "linux_epoll_wait", /* 256 = linux_epoll_wait */ + "linux_remap_file_pages", /* 257 = linux_remap_file_pages */ + "linux_set_tid_address", /* 258 = linux_set_tid_address */ + "linux_timer_create", /* 259 = linux_timer_create */ + "linux_timer_settime", /* 260 = linux_timer_settime */ + "linux_timer_gettime", /* 261 = linux_timer_gettime */ + "linux_timer_getoverrun", /* 262 = linux_timer_getoverrun */ + "linux_timer_delete", /* 263 = linux_timer_delete */ + "linux_clock_settime", /* 264 = linux_clock_settime */ + "linux_clock_gettime", /* 265 = linux_clock_gettime */ + "linux_clock_getres", /* 266 = linux_clock_getres */ + "linux_clock_nanosleep", /* 267 = linux_clock_nanosleep */ + "linux_statfs64", /* 268 = linux_statfs64 */ + "linux_fstatfs64", /* 269 = linux_fstatfs64 */ + "linux_tgkill", /* 270 = linux_tgkill */ + "linux_utimes", /* 271 = linux_utimes */ + "linux_fadvise64_64", /* 272 = linux_fadvise64_64 */ + "#273", /* 273 = */ + "linux_mbind", /* 274 = linux_mbind */ + "linux_get_mempolicy", /* 275 = linux_get_mempolicy */ + "linux_set_mempolicy", /* 276 = linux_set_mempolicy */ + "linux_mq_open", /* 277 = linux_mq_open */ + "linux_mq_unlink", /* 278 = linux_mq_unlink */ + "linux_mq_timedsend", /* 279 = linux_mq_timedsend */ + "linux_mq_timedreceive", /* 280 = linux_mq_timedreceive */ + "linux_mq_notify", /* 281 = linux_mq_notify */ + "linux_mq_getsetattr", /* 282 = linux_mq_getsetattr */ + "linux_kexec_load", /* 283 = linux_kexec_load */ + "linux_waitid", /* 284 = linux_waitid */ + "#285", /* 285 = */ + "linux_add_key", /* 286 = linux_add_key */ + "linux_request_key", /* 287 = linux_request_key */ + "linux_keyctl", /* 288 = linux_keyctl */ + "linux_ioprio_set", /* 289 = linux_ioprio_set */ + "linux_ioprio_get", /* 290 = linux_ioprio_get */ + "linux_inotify_init", /* 291 = linux_inotify_init */ + "linux_inotify_add_watch", /* 292 = linux_inotify_add_watch */ + "linux_inotify_rm_watch", /* 293 = linux_inotify_rm_watch */ + "linux_migrate_pages", /* 294 = linux_migrate_pages */ + "linux_openat", /* 295 = linux_openat */ + "linux_mkdirat", /* 296 = linux_mkdirat */ + "linux_mknodat", /* 297 = linux_mknodat */ + "linux_fchownat", /* 298 = linux_fchownat */ + "linux_futimesat", /* 299 = linux_futimesat */ + "linux_fstatat64", /* 300 = linux_fstatat64 */ + "linux_unlinkat", /* 301 = linux_unlinkat */ + "linux_renameat", /* 302 = linux_renameat */ + "linux_linkat", /* 303 = linux_linkat */ + "linux_symlinkat", /* 304 = linux_symlinkat */ + "linux_readlinkat", /* 305 = linux_readlinkat */ + "linux_fchmodat", /* 306 = linux_fchmodat */ + "linux_faccessat", /* 307 = linux_faccessat */ + "linux_pselect6", /* 308 = linux_pselect6 */ + "linux_ppoll", /* 309 = linux_ppoll */ + "linux_unshare", /* 310 = linux_unshare */ + "linux_set_robust_list", /* 311 = linux_set_robust_list */ + "linux_get_robust_list", /* 312 = linux_get_robust_list */ + "linux_splice", /* 313 = linux_splice */ + "linux_sync_file_range", /* 314 = linux_sync_file_range */ + "linux_tee", /* 315 = linux_tee */ + "linux_vmsplice", /* 316 = linux_vmsplice */ +}; Modified: stable/8/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- stable/8/sys/amd64/linux32/linux32_sysent.c Wed Jun 1 05:50:24 2011 (r222555) +++ stable/8/sys/amd64/linux32/linux32_sysent.c Wed Jun 1 06:01:17 2011 (r222556) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 220466 2011-04-09 08:29:07Z avg + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 222555 2011-06-01 05:50:24Z art */ #include "opt_compat.h" Added: stable/8/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/amd64/linux32/linux32_systrace_args.c Wed Jun 1 06:01:17 2011 (r222556) @@ -0,0 +1,5126 @@ +/* + * System call argument to DTrace register array converstion. + * + * DO NOT EDIT-- this file is automatically generated. + * $FreeBSD$ + * This file is part of the DTrace syscall provider. + */ + +static void +systrace_args(int sysnum, void *params, u_int64_t *uarg, int *n_args) +{ + int64_t *iarg = (int64_t *) uarg; + switch (sysnum) { +#define nosys linux_nosys + /* sys_exit */ + case 1: { + struct sys_exit_args *p = params; + iarg[0] = p->rval; /* int */ + *n_args = 1; + break; + } + /* linux_fork */ + case 2: { + *n_args = 0; + break; + } + /* read */ + case 3: { + struct read_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[2] = p->nbyte; /* u_int */ + *n_args = 3; + break; + } + /* write */ + case 4: { + struct write_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[2] = p->nbyte; /* u_int */ + *n_args = 3; + break; + } + /* linux_open */ + case 5: { + struct linux_open_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->flags; /* l_int */ + iarg[2] = p->mode; /* l_int */ + *n_args = 3; + break; + } + /* close */ + case 6: { + struct close_args *p = params; + iarg[0] = p->fd; /* int */ + *n_args = 1; + break; + } + /* linux_waitpid */ + case 7: { + struct linux_waitpid_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + uarg[1] = (intptr_t) p->status; /* l_int * */ + iarg[2] = p->options; /* l_int */ + *n_args = 3; + break; + } + /* linux_creat */ + case 8: { + struct linux_creat_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->mode; /* l_int */ + *n_args = 2; + break; + } + /* linux_link */ + case 9: { + struct linux_link_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + uarg[1] = (intptr_t) p->to; /* char * */ + *n_args = 2; + break; + } + /* linux_unlink */ + case 10: { + struct linux_unlink_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* linux_execve */ + case 11: { + struct linux_execve_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + uarg[1] = (intptr_t) p->argp; /* u_int32_t * */ + uarg[2] = (intptr_t) p->envp; /* u_int32_t * */ + *n_args = 3; + break; + } + /* linux_chdir */ + case 12: { + struct linux_chdir_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* linux_time */ + case 13: { + struct linux_time_args *p = params; + uarg[0] = (intptr_t) p->tm; /* l_time_t * */ + *n_args = 1; + break; + } + /* linux_mknod */ + case 14: { + struct linux_mknod_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->mode; /* l_int */ + iarg[2] = p->dev; /* l_dev_t */ + *n_args = 3; + break; + } + /* linux_chmod */ + case 15: { + struct linux_chmod_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->mode; /* l_mode_t */ + *n_args = 2; + break; + } + /* linux_lchown16 */ + case 16: { + struct linux_lchown16_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->uid; /* l_uid16_t */ + iarg[2] = p->gid; /* l_gid16_t */ + *n_args = 3; + break; + } + /* linux_stat */ + case 18: { + struct linux_stat_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + uarg[1] = (intptr_t) p->up; /* struct linux_stat * */ + *n_args = 2; + break; + } + /* linux_lseek */ + case 19: { + struct linux_lseek_args *p = params; + iarg[0] = p->fdes; /* l_uint */ + iarg[1] = p->off; /* l_off_t */ + iarg[2] = p->whence; /* l_int */ + *n_args = 3; + break; + } + /* linux_getpid */ + case 20: { + *n_args = 0; + break; + } + /* linux_mount */ + case 21: { + struct linux_mount_args *p = params; + uarg[0] = (intptr_t) p->specialfile; /* char * */ + uarg[1] = (intptr_t) p->dir; /* char * */ + uarg[2] = (intptr_t) p->filesystemtype; /* char * */ + iarg[3] = p->rwflag; /* l_ulong */ + uarg[4] = (intptr_t) p->data; /* void * */ + *n_args = 5; + break; + } + /* linux_oldumount */ + case 22: { + struct linux_oldumount_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* linux_setuid16 */ + case 23: { + struct linux_setuid16_args *p = params; + iarg[0] = p->uid; /* l_uid16_t */ + *n_args = 1; + break; + } + /* linux_getuid16 */ + case 24: { + *n_args = 0; + break; + } + /* linux_stime */ + case 25: { + *n_args = 0; + break; + } + /* linux_ptrace */ + case 26: { + struct linux_ptrace_args *p = params; + iarg[0] = p->req; /* l_long */ + iarg[1] = p->pid; /* l_long */ + iarg[2] = p->addr; /* l_long */ + iarg[3] = p->data; /* l_long */ + *n_args = 4; + break; + } + /* linux_alarm */ + case 27: { + struct linux_alarm_args *p = params; + iarg[0] = p->secs; /* l_uint */ + *n_args = 1; + break; + } + /* linux_pause */ + case 29: { + *n_args = 0; + break; + } + /* linux_utime */ + case 30: { + struct linux_utime_args *p = params; + uarg[0] = (intptr_t) p->fname; /* char * */ + uarg[1] = (intptr_t) p->times; /* struct l_utimbuf * */ + *n_args = 2; + break; + } + /* linux_access */ + case 33: { + struct linux_access_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->flags; /* l_int */ + *n_args = 2; + break; + } + /* linux_nice */ + case 34: { + struct linux_nice_args *p = params; + iarg[0] = p->inc; /* l_int */ + *n_args = 1; + break; + } + /* sync */ + case 36: { + *n_args = 0; + break; + } + /* linux_kill */ + case 37: { + struct linux_kill_args *p = params; + iarg[0] = p->pid; /* l_int */ + iarg[1] = p->signum; /* l_int */ + *n_args = 2; + break; + } + /* linux_rename */ + case 38: { + struct linux_rename_args *p = params; + uarg[0] = (intptr_t) p->from; /* char * */ + uarg[1] = (intptr_t) p->to; /* char * */ + *n_args = 2; + break; + } + /* linux_mkdir */ + case 39: { + struct linux_mkdir_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->mode; /* l_int */ + *n_args = 2; + break; + } + /* linux_rmdir */ + case 40: { + struct linux_rmdir_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* dup */ + case 41: { + struct dup_args *p = params; + uarg[0] = p->fd; /* u_int */ + *n_args = 1; + break; + } + /* linux_pipe */ + case 42: { + struct linux_pipe_args *p = params; + uarg[0] = (intptr_t) p->pipefds; /* l_ulong * */ + *n_args = 1; + break; + } + /* linux_times */ + case 43: { + struct linux_times_args *p = params; + uarg[0] = (intptr_t) p->buf; /* struct l_times_argv * */ + *n_args = 1; + break; + } + /* linux_brk */ + case 45: { + struct linux_brk_args *p = params; + iarg[0] = p->dsend; /* l_ulong */ + *n_args = 1; + break; + } + /* linux_setgid16 */ + case 46: { + struct linux_setgid16_args *p = params; + iarg[0] = p->gid; /* l_gid16_t */ + *n_args = 1; + break; + } + /* linux_getgid16 */ + case 47: { + *n_args = 0; + break; + } + /* linux_signal */ + case 48: { + struct linux_signal_args *p = params; + iarg[0] = p->sig; /* l_int */ + iarg[1] = p->handler; /* l_handler_t */ + *n_args = 2; + break; + } + /* linux_geteuid16 */ + case 49: { + *n_args = 0; + break; + } + /* linux_getegid16 */ + case 50: { + *n_args = 0; + break; + } + /* acct */ + case 51: { + struct acct_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* linux_umount */ + case 52: { + struct linux_umount_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->flags; /* l_int */ + *n_args = 2; + break; + } + /* linux_ioctl */ + case 54: { + struct linux_ioctl_args *p = params; + iarg[0] = p->fd; /* l_uint */ + iarg[1] = p->cmd; /* l_uint */ + uarg[2] = p->arg; /* uintptr_t */ + *n_args = 3; + break; + } + /* linux_fcntl */ + case 55: { + struct linux_fcntl_args *p = params; + iarg[0] = p->fd; /* l_uint */ + iarg[1] = p->cmd; /* l_uint */ + uarg[2] = p->arg; /* uintptr_t */ + *n_args = 3; + break; + } + /* setpgid */ + case 57: { + struct setpgid_args *p = params; + iarg[0] = p->pid; /* int */ + iarg[1] = p->pgid; /* int */ + *n_args = 2; + break; + } + /* linux_olduname */ + case 59: { + *n_args = 0; + break; + } + /* umask */ + case 60: { + struct umask_args *p = params; + iarg[0] = p->newmask; /* int */ + *n_args = 1; + break; + } + /* chroot */ + case 61: { + struct chroot_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + *n_args = 1; + break; + } + /* linux_ustat */ + case 62: { + struct linux_ustat_args *p = params; + iarg[0] = p->dev; /* l_dev_t */ + uarg[1] = (intptr_t) p->ubuf; /* struct l_ustat * */ + *n_args = 2; + break; + } + /* dup2 */ + case 63: { + struct dup2_args *p = params; + uarg[0] = p->from; /* u_int */ + uarg[1] = p->to; /* u_int */ + *n_args = 2; + break; + } + /* linux_getppid */ + case 64: { + *n_args = 0; + break; + } + /* getpgrp */ + case 65: { + *n_args = 0; + break; + } + /* setsid */ + case 66: { + *n_args = 0; + break; + } + /* linux_sigaction */ + case 67: { + struct linux_sigaction_args *p = params; + iarg[0] = p->sig; /* l_int */ + uarg[1] = (intptr_t) p->nsa; /* l_osigaction_t * */ + uarg[2] = (intptr_t) p->osa; /* l_osigaction_t * */ + *n_args = 3; + break; + } + /* linux_sgetmask */ + case 68: { + *n_args = 0; + break; + } + /* linux_ssetmask */ + case 69: { + struct linux_ssetmask_args *p = params; + iarg[0] = p->mask; /* l_osigset_t */ + *n_args = 1; + break; + } + /* linux_setreuid16 */ + case 70: { + struct linux_setreuid16_args *p = params; + iarg[0] = p->ruid; /* l_uid16_t */ + iarg[1] = p->euid; /* l_uid16_t */ + *n_args = 2; + break; + } + /* linux_setregid16 */ + case 71: { + struct linux_setregid16_args *p = params; + iarg[0] = p->rgid; /* l_gid16_t */ + iarg[1] = p->egid; /* l_gid16_t */ + *n_args = 2; + break; + } + /* linux_sigsuspend */ + case 72: { + struct linux_sigsuspend_args *p = params; + iarg[0] = p->hist0; /* l_int */ + iarg[1] = p->hist1; /* l_int */ + iarg[2] = p->mask; /* l_osigset_t */ + *n_args = 3; + break; + } + /* linux_sigpending */ + case 73: { + struct linux_sigpending_args *p = params; + uarg[0] = (intptr_t) p->mask; /* l_osigset_t * */ + *n_args = 1; + break; + } + /* linux_sethostname */ + case 74: { + struct linux_sethostname_args *p = params; + uarg[0] = (intptr_t) p->hostname; /* char * */ + uarg[1] = p->len; /* u_int */ + *n_args = 2; + break; + } + /* linux_setrlimit */ + case 75: { + struct linux_setrlimit_args *p = params; + iarg[0] = p->resource; /* l_uint */ + uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + *n_args = 2; + break; + } + /* linux_old_getrlimit */ + case 76: { + struct linux_old_getrlimit_args *p = params; + iarg[0] = p->resource; /* l_uint */ + uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + *n_args = 2; + break; + } + /* linux_getrusage */ + case 77: { + struct linux_getrusage_args *p = params; + iarg[0] = p->who; /* int */ + uarg[1] = (intptr_t) p->rusage; /* struct l_rusage * */ + *n_args = 2; + break; + } + /* linux_gettimeofday */ + case 78: { + struct linux_gettimeofday_args *p = params; + uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */ + uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + *n_args = 2; + break; + } + /* linux_settimeofday */ + case 79: { + struct linux_settimeofday_args *p = params; + uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */ + uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + *n_args = 2; + break; + } + /* linux_getgroups16 */ + case 80: { + struct linux_getgroups16_args *p = params; + iarg[0] = p->gidsetsize; /* l_uint */ + uarg[1] = (intptr_t) p->gidset; /* l_gid16_t * */ + *n_args = 2; + break; + } + /* linux_setgroups16 */ + case 81: { + struct linux_setgroups16_args *p = params; + iarg[0] = p->gidsetsize; /* l_uint */ + uarg[1] = (intptr_t) p->gidset; /* l_gid16_t * */ + *n_args = 2; + break; + } + /* linux_old_select */ + case 82: { + struct linux_old_select_args *p = params; + uarg[0] = (intptr_t) p->ptr; /* struct l_old_select_argv * */ + *n_args = 1; + break; + } + /* linux_symlink */ + case 83: { + struct linux_symlink_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + uarg[1] = (intptr_t) p->to; /* char * */ + *n_args = 2; + break; + } + /* linux_lstat */ + case 84: { + struct linux_lstat_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + uarg[1] = (intptr_t) p->up; /* struct linux_lstat * */ + *n_args = 2; + break; + } + /* linux_readlink */ + case 85: { + struct linux_readlink_args *p = params; + uarg[0] = (intptr_t) p->name; /* char * */ + uarg[1] = (intptr_t) p->buf; /* char * */ + iarg[2] = p->count; /* l_int */ + *n_args = 3; + break; + } + /* swapon */ + case 87: { + struct swapon_args *p = params; + uarg[0] = (intptr_t) p->name; /* char * */ + *n_args = 1; + break; + } + /* linux_reboot */ + case 88: { + struct linux_reboot_args *p = params; + iarg[0] = p->magic1; /* l_int */ + iarg[1] = p->magic2; /* l_int */ + iarg[2] = p->cmd; /* l_uint */ + uarg[3] = (intptr_t) p->arg; /* void * */ + *n_args = 4; + break; + } + /* linux_readdir */ + case 89: { + struct linux_readdir_args *p = params; + iarg[0] = p->fd; /* l_uint */ + uarg[1] = (intptr_t) p->dent; /* struct l_dirent * */ + iarg[2] = p->count; /* l_uint */ + *n_args = 3; + break; + } + /* linux_mmap */ + case 90: { + struct linux_mmap_args *p = params; + uarg[0] = (intptr_t) p->ptr; /* struct l_mmap_argv * */ + *n_args = 1; + break; + } + /* munmap */ + case 91: { + struct munmap_args *p = params; + uarg[0] = (intptr_t) p->addr; /* caddr_t */ + iarg[1] = p->len; /* int */ + *n_args = 2; + break; + } + /* linux_truncate */ + case 92: { + struct linux_truncate_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->length; /* l_ulong */ + *n_args = 2; + break; + } + /* linux_ftruncate */ + case 93: { + struct linux_ftruncate_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->length; /* long */ + *n_args = 2; + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 06:07:58 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13A3B1065687; Wed, 1 Jun 2011 06:07:58 +0000 (UTC) (envelope-from art@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0153A8FC12; Wed, 1 Jun 2011 06:07:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5167vJu056941; Wed, 1 Jun 2011 06:07:57 GMT (envelope-from art@svn.freebsd.org) Received: (from art@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5167vLi056935; Wed, 1 Jun 2011 06:07:57 GMT (envelope-from art@svn.freebsd.org) Message-Id: <201106010607.p5167vLi056935@svn.freebsd.org> From: Artem Belevich Date: Wed, 1 Jun 2011 06:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222557 - in stable/8/sys: cddl/dev/systrace modules/dtrace modules/dtrace/dtraceall modules/dtrace/systrace_freebsd32 modules/dtrace/systrace_linux32 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 06:07:58 -0000 Author: art Date: Wed Jun 1 06:07:57 2011 New Revision: 222557 URL: http://svn.freebsd.org/changeset/base/222557 Log: MFC r219561, r220437: add DTrace systrace support for linux32 and freebsd32 on amd64 syscalls Add systrace_linux32 and systrace_freebsd32 modules which provide support for tracing compat system calls in addition to native system call tracing provided by systrace module. Provided that all the systrace modules are loaded now you can select what syscalls to trace in the following manner: syscall::xxx:yyy - work on all system calls that match the specification syscall:freebsd:xxx:yyy - only native system calls syscall:linux:xxx:yyy - linux compat system calls (linux32 on amd64) syscall:freebsd32:xxx:yyy - freebsd32 compat system calls on amd64 PR: kern/152822 Reviewed by: jhb (earlier version) Approved by: avg (mentor) Added: stable/8/sys/modules/dtrace/systrace_freebsd32/ - copied from r219561, head/sys/modules/dtrace/systrace_freebsd32/ stable/8/sys/modules/dtrace/systrace_linux32/ - copied from r219561, head/sys/modules/dtrace/systrace_linux32/ Modified: stable/8/sys/cddl/dev/systrace/systrace.c stable/8/sys/modules/dtrace/Makefile stable/8/sys/modules/dtrace/dtraceall/Makefile stable/8/sys/modules/dtrace/dtraceall/dtraceall.c stable/8/sys/modules/dtrace/systrace_linux32/Makefile Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cddl/dev/systrace/systrace.c ============================================================================== --- stable/8/sys/cddl/dev/systrace/systrace.c Wed Jun 1 06:01:17 2011 (r222556) +++ stable/8/sys/cddl/dev/systrace/systrace.c Wed Jun 1 06:07:57 2011 (r222557) @@ -59,17 +59,39 @@ #include #ifdef LINUX_SYSTRACE -#include -#include -#include -#include -#include +#if defined(__amd64__) +#include +#include +#include +#include +#define MODNAME "linux32" +#elif defined(__i386__) +#include +#include +#include +#include +#define MODNAME "linux" +#else +#error Only i386 and amd64 are supported. +#endif extern struct sysent linux_sysent[]; -#define DEVNAME "dtrace/linsystrace" -#define PROVNAME "linsyscall" #define MAXSYSCALL LINUX_SYS_MAXSYSCALL #define SYSCALLNAMES linux_syscallnames #define SYSENT linux_sysent +#elif defined(FREEBSD32_SYSTRACE) +/* + * The syscall arguments are processed into a DTrace argument array + * using a generated function. See sys/kern/makesyscalls.sh. + */ +#include +#include +#include +#include +extern const char *freebsd32_syscallnames[]; +#define MODNAME "freebsd32" +#define MAXSYSCALL FREEBSD32_SYS_MAXSYSCALL +#define SYSCALLNAMES freebsd32_syscallnames +#define SYSENT freebsd32_sysent #else /* * The syscall arguments are processed into a DTrace argument array @@ -77,13 +99,15 @@ extern struct sysent linux_sysent[]; */ #include #include -#define DEVNAME "dtrace/systrace" -#define PROVNAME "syscall" +#define MODNAME "freebsd" #define MAXSYSCALL SYS_MAXSYSCALL #define SYSCALLNAMES syscallnames #define SYSENT sysent #endif +#define PROVNAME "syscall" +#define DEVNAME "dtrace/systrace/" MODNAME + #define SYSTRACE_ARTIFICIAL_FRAMES 1 #define SYSTRACE_SHIFT 16 @@ -109,7 +133,7 @@ static struct cdevsw systrace_cdevsw = { .d_version = D_VERSION, .d_open = systrace_open, #ifdef LINUX_SYSTRACE - .d_name = "linsystrace", + .d_name = "systrace_" MODNAME, #else .d_name = "systrace", #endif @@ -214,14 +238,14 @@ systrace_provide(void *arg, dtrace_probe return; for (i = 0; i < MAXSYSCALL; i++) { - if (dtrace_probe_lookup(systrace_id, NULL, + if (dtrace_probe_lookup(systrace_id, MODNAME, uglyhack.pp_syscallnames[i], "entry") != 0) continue; - (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], + (void) dtrace_probe_create(systrace_id, MODNAME, uglyhack.pp_syscallnames[i], "entry", SYSTRACE_ARTIFICIAL_FRAMES, (void *)((uintptr_t)SYSTRACE_ENTRY(i))); - (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], + (void) dtrace_probe_create(systrace_id, MODNAME, uglyhack.pp_syscallnames[i], "return", SYSTRACE_ARTIFICIAL_FRAMES, (void *)((uintptr_t)SYSTRACE_RETURN(i))); } @@ -335,12 +359,16 @@ SYSINIT(systrace_load, SI_SUB_DTRACE_PRO SYSUNINIT(systrace_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_unload, NULL); #ifdef LINUX_SYSTRACE -DEV_MODULE(linsystrace, systrace_modevent, NULL); -MODULE_VERSION(linsystrace, 1); -MODULE_DEPEND(linsystrace, linux, 1, 1, 1); -MODULE_DEPEND(linsystrace, systrace, 1, 1, 1); -MODULE_DEPEND(linsystrace, dtrace, 1, 1, 1); -MODULE_DEPEND(linsystrace, opensolaris, 1, 1, 1); +DEV_MODULE(systrace_linux32, systrace_modevent, NULL); +MODULE_VERSION(systrace_linux32, 1); +MODULE_DEPEND(systrace_linux32, linux, 1, 1, 1); +MODULE_DEPEND(systrace_linux32, dtrace, 1, 1, 1); +MODULE_DEPEND(systrace_linux32, opensolaris, 1, 1, 1); +#elif defined(FREEBSD32_SYSTRACE) +DEV_MODULE(systrace_freebsd32, systrace_modevent, NULL); +MODULE_VERSION(systrace_freebsd32, 1); +MODULE_DEPEND(systrace_freebsd32, dtrace, 1, 1, 1); +MODULE_DEPEND(systrace_freebsd32, opensolaris, 1, 1, 1); #else DEV_MODULE(systrace, systrace_modevent, NULL); MODULE_VERSION(systrace, 1); Modified: stable/8/sys/modules/dtrace/Makefile ============================================================================== --- stable/8/sys/modules/dtrace/Makefile Wed Jun 1 06:01:17 2011 (r222556) +++ stable/8/sys/modules/dtrace/Makefile Wed Jun 1 06:07:57 2011 (r222557) @@ -15,7 +15,10 @@ SUBDIR= dtmalloc \ systrace .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" -SUBDIR+= fasttrap fbt +SUBDIR+= fasttrap fbt systrace_linux32 +.endif +.if ${MACHINE_ARCH} == "amd64" +SUBDIR+= systrace_freebsd32 .endif .include Modified: stable/8/sys/modules/dtrace/dtraceall/Makefile ============================================================================== --- stable/8/sys/modules/dtrace/dtraceall/Makefile Wed Jun 1 06:01:17 2011 (r222556) +++ stable/8/sys/modules/dtrace/dtraceall/Makefile Wed Jun 1 06:07:57 2011 (r222557) @@ -1,8 +1,15 @@ # $FreeBSD$ KMOD= dtraceall -SRCS= dtraceall.c +SRCS= dtraceall.c opt_compat.h CFLAGS+= -I${.CURDIR}/../../.. +.if !defined(KERNBUILDDIR) +opt_compat.h: +.if ${MACHINE_ARCH} == "amd64" + echo "#define COMPAT_FREEBSD32 1" >> ${.TARGET} +.endif +.endif + .include Modified: stable/8/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- stable/8/sys/modules/dtrace/dtraceall/dtraceall.c Wed Jun 1 06:01:17 2011 (r222556) +++ stable/8/sys/modules/dtrace/dtraceall/dtraceall.c Wed Jun 1 06:07:57 2011 (r222557) @@ -32,6 +32,7 @@ #include #include #include +#include "opt_compat.h" static int dtraceall_modevent(module_t mod __unused, int type, void *data __unused) @@ -73,4 +74,7 @@ MODULE_DEPEND(dtraceall, fasttrap, 1, 1, MODULE_DEPEND(dtraceall, lockstat, 1, 1, 1); MODULE_DEPEND(dtraceall, sdt, 1, 1, 1); MODULE_DEPEND(dtraceall, systrace, 1, 1, 1); +#if defined(COMPAT_FREEBSD32) +MODULE_DEPEND(dtraceall, systrace_freebsd32, 1, 1, 1); +#endif MODULE_DEPEND(dtraceall, profile, 1, 1, 1); Modified: stable/8/sys/modules/dtrace/systrace_linux32/Makefile ============================================================================== --- head/sys/modules/dtrace/systrace_linux32/Makefile Sat Mar 12 09:09:25 2011 (r219561) +++ stable/8/sys/modules/dtrace/systrace_linux32/Makefile Wed Jun 1 06:07:57 2011 (r222557) @@ -2,7 +2,12 @@ .PATH: ${.CURDIR}/../../../cddl/dev/systrace +.if ${MACHINE} == "amd64" KMOD= systrace_linux32 +.else +KMOD= systrace_linux +.endif + SRCS= systrace.c SRCS+= vnode_if.h From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 14:41:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE48106564A; Wed, 1 Jun 2011 14:41:09 +0000 (UTC) (envelope-from art@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13DBB8FC17; Wed, 1 Jun 2011 14:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51Ef8oR074137; Wed, 1 Jun 2011 14:41:08 GMT (envelope-from art@svn.freebsd.org) Received: (from art@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51Ef82m074136; Wed, 1 Jun 2011 14:41:08 GMT (envelope-from art@svn.freebsd.org) Message-Id: <201106011441.p51Ef82m074136@svn.freebsd.org> From: Artem Belevich Date: Wed, 1 Jun 2011 14:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222565 - in stable/8/sys: amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 14:41:09 -0000 Author: art Date: Wed Jun 1 14:41:08 2011 New Revision: 222565 URL: http://svn.freebsd.org/changeset/base/222565 Log: Fixed lost svn:mergeinfo on some directories in sys/ Approved by: avg (mentor) Modified: Directory Properties: stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 15:46:12 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C855F106564A; Wed, 1 Jun 2011 15:46:12 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6B3F8FC0A; Wed, 1 Jun 2011 15:46:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51FkCwR076100; Wed, 1 Jun 2011 15:46:12 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51FkCd6076098; Wed, 1 Jun 2011 15:46:12 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011546.p51FkCd6076098@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 15:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222566 - stable/8/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 15:46:12 -0000 Author: mdf Date: Wed Jun 1 15:46:12 2011 New Revision: 222566 URL: http://svn.freebsd.org/changeset/base/222566 Log: MFC r212364: Fix small errors in the sbuf(9) man page. Modified: stable/8/share/man/man9/sbuf.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/sbuf.9 ============================================================================== --- stable/8/share/man/man9/sbuf.9 Wed Jun 1 14:41:08 2011 (r222565) +++ stable/8/share/man/man9/sbuf.9 Wed Jun 1 15:46:12 2011 (r222566) @@ -98,7 +98,7 @@ The .Nm family of functions allows one to safely allocate, construct and -release bounded null-terminated strings in kernel space. +release bounded NUL-terminated strings in kernel space. Instead of arrays of characters, these functions operate on structures called .Fa sbufs , @@ -289,7 +289,7 @@ overflowed. .Pp The .Fn sbuf_finish -function null-terminates the +function NUL-terminates the .Fa sbuf and marks it as finished, which means that it may no longer be modified using @@ -298,7 +298,10 @@ modified using .Fn sbuf_cpy , .Fn sbuf_printf or -.Fn sbuf_putc . +.Fn sbuf_putc , +until +.Fn sbuf_clear +is used to reset the sbuf. .Pp The .Fn sbuf_data @@ -309,7 +312,9 @@ functions return the actual string and i only works on a finished .Fa sbuf . .Fn sbuf_done -returns non-zero if the sbuf is finished. +returns non-zero if the +.Fa sbuf +is finished. .Sh NOTES If an operation caused an .Fa sbuf From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 15:46:26 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A79321065747; Wed, 1 Jun 2011 15:46:26 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97C6A8FC16; Wed, 1 Jun 2011 15:46:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51FkQIb076141; Wed, 1 Jun 2011 15:46:26 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51FkQ1S076139; Wed, 1 Jun 2011 15:46:26 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011546.p51FkQ1S076139@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 15:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222567 - stable/7/share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 15:46:26 -0000 Author: mdf Date: Wed Jun 1 15:46:26 2011 New Revision: 222567 URL: http://svn.freebsd.org/changeset/base/222567 Log: MFC r212364: Fix small errors in the sbuf(9) man page. Modified: stable/7/share/man/man9/sbuf.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/sbuf.9 ============================================================================== --- stable/7/share/man/man9/sbuf.9 Wed Jun 1 15:46:12 2011 (r222566) +++ stable/7/share/man/man9/sbuf.9 Wed Jun 1 15:46:26 2011 (r222567) @@ -98,7 +98,7 @@ The .Nm family of functions allows one to safely allocate, construct and -release bounded null-terminated strings in kernel space. +release bounded NUL-terminated strings in kernel space. Instead of arrays of characters, these functions operate on structures called .Fa sbufs , @@ -289,7 +289,7 @@ overflowed. .Pp The .Fn sbuf_finish -function null-terminates the +function NUL-terminates the .Fa sbuf and marks it as finished, which means that it may no longer be modified using @@ -298,7 +298,10 @@ modified using .Fn sbuf_cpy , .Fn sbuf_printf or -.Fn sbuf_putc . +.Fn sbuf_putc , +until +.Fn sbuf_clear +is used to reset the sbuf. .Pp The .Fn sbuf_data @@ -309,7 +312,9 @@ functions return the actual string and i only works on a finished .Fa sbuf . .Fn sbuf_done -returns non-zero if the sbuf is finished. +returns non-zero if the +.Fa sbuf +is finished. .Sh NOTES If an operation caused an .Fa sbuf From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 16:07:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFACF1065670; Wed, 1 Jun 2011 16:07:14 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE9128FC18; Wed, 1 Jun 2011 16:07:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51G7EoA076996; Wed, 1 Jun 2011 16:07:14 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51G7EkO076993; Wed, 1 Jun 2011 16:07:14 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011607.p51G7EkO076993@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 16:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222569 - in stable/7/sys: kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 16:07:14 -0000 Author: mdf Date: Wed Jun 1 16:07:14 2011 New Revision: 222569 URL: http://svn.freebsd.org/changeset/base/222569 Log: MFC r181462: Switch to simplified BSD license (with phk's approval), plus whitespace and style(9) cleanup. Modified: stable/7/sys/kern/subr_sbuf.c stable/7/sys/sys/sbuf.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_sbuf.c ============================================================================== --- stable/7/sys/kern/subr_sbuf.c Wed Jun 1 15:48:43 2011 (r222568) +++ stable/7/sys/kern/subr_sbuf.c Wed Jun 1 16:07:14 2011 (r222569) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2008 Poul-Henning Kamp + * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,19 +12,18 @@ * 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 - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include @@ -84,9 +84,11 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "st * Debugging support */ #if defined(_KERNEL) && defined(INVARIANTS) + static void _assert_sbuf_integrity(const char *fun, struct sbuf *s) { + KASSERT(s != NULL, ("%s called with a NULL sbuf pointer", fun)); KASSERT(s->s_buf != NULL, @@ -98,15 +100,20 @@ _assert_sbuf_integrity(const char *fun, static void _assert_sbuf_state(const char *fun, struct sbuf *s, int state) { + KASSERT((s->s_flags & SBUF_FINISHED) == state, ("%s called with %sfinished or corrupt sbuf", fun, (state ? "un" : ""))); } + #define assert_sbuf_integrity(s) _assert_sbuf_integrity(__func__, (s)) #define assert_sbuf_state(s, i) _assert_sbuf_state(__func__, (s), (i)) + #else /* _KERNEL && INVARIANTS */ + #define assert_sbuf_integrity(s) do { } while (0) #define assert_sbuf_state(s, i) do { } while (0) + #endif /* _KERNEL && INVARIANTS */ static int @@ -121,7 +128,6 @@ sbuf_extendsize(int size) else newsize += SBUF_MAXEXTENDINCR; } - return (newsize); } @@ -137,9 +143,8 @@ sbuf_extend(struct sbuf *s, int addlen) if (!SBUF_CANEXTEND(s)) return (-1); - newsize = sbuf_extendsize(s->s_size + addlen); - newbuf = (char *)SBMALLOC(newsize); + newbuf = SBMALLOC(newsize); if (newbuf == NULL) return (-1); bcopy(s->s_buf, newbuf, s->s_size); @@ -160,6 +165,7 @@ sbuf_extend(struct sbuf *s, int addlen) struct sbuf * sbuf_new(struct sbuf *s, char *buf, int length, int flags) { + KASSERT(length >= 0, ("attempt to create an sbuf of negative length (%d)", length)); KASSERT((flags & ~SBUF_USRFLAGMSK) == 0, @@ -167,14 +173,14 @@ sbuf_new(struct sbuf *s, char *buf, int flags &= SBUF_USRFLAGMSK; if (s == NULL) { - s = (struct sbuf *)SBMALLOC(sizeof *s); + s = SBMALLOC(sizeof(*s)); if (s == NULL) return (NULL); - bzero(s, sizeof *s); + bzero(s, sizeof(*s)); s->s_flags = flags; SBUF_SETFLAG(s, SBUF_DYNSTRUCT); } else { - bzero(s, sizeof *s); + bzero(s, sizeof(*s)); s->s_flags = flags; } s->s_size = length; @@ -184,7 +190,7 @@ sbuf_new(struct sbuf *s, char *buf, int } if (flags & SBUF_AUTOEXTEND) s->s_size = sbuf_extendsize(s->s_size); - s->s_buf = (char *)SBMALLOC(s->s_size); + s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) { if (SBUF_ISDYNSTRUCT(s)) SBFREE(s); @@ -201,6 +207,7 @@ sbuf_new(struct sbuf *s, char *buf, int struct sbuf * sbuf_uionew(struct sbuf *s, struct uio *uio, int *error) { + KASSERT(uio != NULL, ("%s called with NULL uio pointer", __func__)); KASSERT(error != NULL, @@ -228,6 +235,7 @@ sbuf_uionew(struct sbuf *s, struct uio * void sbuf_clear(struct sbuf *s) { + assert_sbuf_integrity(s); /* don't care if it's finished or not */ @@ -243,6 +251,7 @@ sbuf_clear(struct sbuf *s) int sbuf_setpos(struct sbuf *s, int pos) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -270,7 +279,6 @@ sbuf_bcat(struct sbuf *s, const void *bu if (SBUF_HASOVERFLOWED(s)) return (-1); - for (; len; len--) { if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0) break; @@ -290,12 +298,12 @@ sbuf_bcat(struct sbuf *s, const void *bu int sbuf_bcopyin(struct sbuf *s, const void *uaddr, size_t len) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); if (SBUF_HASOVERFLOWED(s)) return (-1); - if (len == 0) return (0); if (len > SBUF_FREESPACE(s)) { @@ -316,6 +324,7 @@ sbuf_bcopyin(struct sbuf *s, const void int sbuf_bcpy(struct sbuf *s, const void *buf, size_t len) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -329,6 +338,7 @@ sbuf_bcpy(struct sbuf *s, const void *bu int sbuf_cat(struct sbuf *s, const char *str) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -389,6 +399,7 @@ sbuf_copyin(struct sbuf *s, const void * int sbuf_cpy(struct sbuf *s, const char *str) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -455,7 +466,7 @@ sbuf_printf(struct sbuf *s, const char * va_start(ap, fmt); result = sbuf_vprintf(s, fmt, ap); va_end(ap); - return(result); + return (result); } /* @@ -464,12 +475,12 @@ sbuf_printf(struct sbuf *s, const char * int sbuf_putc(struct sbuf *s, int c) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); if (SBUF_HASOVERFLOWED(s)) return (-1); - if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); @@ -485,6 +496,7 @@ sbuf_putc(struct sbuf *s, int c) int sbuf_trim(struct sbuf *s) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -503,7 +515,8 @@ sbuf_trim(struct sbuf *s) int sbuf_overflowed(struct sbuf *s) { - return SBUF_HASOVERFLOWED(s); + + return (SBUF_HASOVERFLOWED(s)); } /* @@ -512,6 +525,7 @@ sbuf_overflowed(struct sbuf *s) void sbuf_finish(struct sbuf *s) { + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -526,10 +540,11 @@ sbuf_finish(struct sbuf *s) char * sbuf_data(struct sbuf *s) { + assert_sbuf_integrity(s); assert_sbuf_state(s, SBUF_FINISHED); - return s->s_buf; + return (s->s_buf); } /* @@ -538,12 +553,13 @@ sbuf_data(struct sbuf *s) int sbuf_len(struct sbuf *s) { + assert_sbuf_integrity(s); /* don't care if it's finished or not */ if (SBUF_HASOVERFLOWED(s)) return (-1); - return s->s_len; + return (s->s_len); } /* @@ -560,7 +576,7 @@ sbuf_delete(struct sbuf *s) if (SBUF_ISDYNAMIC(s)) SBFREE(s->s_buf); isdyn = SBUF_ISDYNSTRUCT(s); - bzero(s, sizeof *s); + bzero(s, sizeof(*s)); if (isdyn) SBFREE(s); } @@ -572,5 +588,5 @@ int sbuf_done(struct sbuf *s) { - return(SBUF_ISFINISHED(s)); + return (SBUF_ISFINISHED(s)); } Modified: stable/7/sys/sys/sbuf.h ============================================================================== --- stable/7/sys/sys/sbuf.h Wed Jun 1 15:48:43 2011 (r222568) +++ stable/7/sys/sys/sbuf.h Wed Jun 1 16:07:14 2011 (r222569) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2008 Poul-Henning Kamp + * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,19 +12,18 @@ * 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 - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ @@ -43,7 +43,7 @@ struct sbuf { int s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ -#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ +#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ #define SBUF_OVERFLOWED 0x00040000 /* sbuf overflowed */ @@ -64,8 +64,10 @@ int sbuf_bcat(struct sbuf *, const voi int sbuf_bcpy(struct sbuf *, const void *, size_t); int sbuf_cat(struct sbuf *, const char *); int sbuf_cpy(struct sbuf *, const char *); -int sbuf_printf(struct sbuf *, const char *, ...) __printflike(2, 3); -int sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0); +int sbuf_printf(struct sbuf *, const char *, ...) + __printflike(2, 3); +int sbuf_vprintf(struct sbuf *, const char *, __va_list) + __printflike(2, 0); int sbuf_putc(struct sbuf *, int); int sbuf_trim(struct sbuf *); int sbuf_overflowed(struct sbuf *); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 16:34:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93206106566B; Wed, 1 Jun 2011 16:34:18 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77C088FC0A; Wed, 1 Jun 2011 16:34:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51GYIhu077888; Wed, 1 Jun 2011 16:34:18 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51GYI8D077886; Wed, 1 Jun 2011 16:34:18 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011634.p51GYI8D077886@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 16:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222570 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 16:34:18 -0000 Author: mdf Date: Wed Jun 1 16:34:18 2011 New Revision: 222570 URL: http://svn.freebsd.org/changeset/base/222570 Log: MFC r212180-r212184: Use math rather than iteration when the desired sbuf size is larger than SBUF_MAXEXTENDSIZE. Fix brain fart when converting an if statement into a KASSERT. Fix user-space libsbuf build. Why isn't CTASSERT available to user-space? Style(9) fixes and eliminate the use of min(). Use a better #if guard. Modified: stable/8/sys/kern/subr_sbuf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_sbuf.c ============================================================================== --- stable/8/sys/kern/subr_sbuf.c Wed Jun 1 16:07:14 2011 (r222569) +++ stable/8/sys/kern/subr_sbuf.c Wed Jun 1 16:34:18 2011 (r222570) @@ -56,7 +56,6 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "st #define KASSERT(e, m) #define SBMALLOC(size) malloc(size) #define SBFREE(buf) free(buf) -#define min(x,y) MIN(x,y) #endif /* _KERNEL */ /* @@ -116,18 +115,24 @@ _assert_sbuf_state(const char *fun, stru #endif /* _KERNEL && INVARIANTS */ +#ifdef CTASSERT +CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); +CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); +#endif + static int sbuf_extendsize(int size) { int newsize; - newsize = SBUF_MINEXTENDSIZE; - while (newsize < size) { - if (newsize < (int)SBUF_MAXEXTENDSIZE) + if (size < (int)SBUF_MAXEXTENDSIZE) { + newsize = SBUF_MINEXTENDSIZE; + while (newsize < size) newsize *= 2; - else - newsize += SBUF_MAXEXTENDINCR; + } else { + newsize = roundup2(size, SBUF_MAXEXTENDINCR); } + KASSERT(newsize >= size, ("%s: %d < %d\n", __func__, newsize, size)); return (newsize); } @@ -184,11 +189,11 @@ sbuf_new(struct sbuf *s, char *buf, int s->s_flags = flags; } s->s_size = length; - if (buf) { + if (buf != NULL) { s->s_buf = buf; return (s); } - if (flags & SBUF_AUTOEXTEND) + if ((flags & SBUF_AUTOEXTEND) != 0) s->s_size = sbuf_extendsize(s->s_size); s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) { @@ -284,7 +289,7 @@ sbuf_bcat(struct sbuf *s, const void *bu break; s->s_buf[s->s_len++] = *str++; } - if (len) { + if (len > 0) { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -308,7 +313,8 @@ sbuf_bcopyin(struct sbuf *s, const void return (0); if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len - SBUF_FREESPACE(s)); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } if (copyin(uaddr, s->s_buf + s->s_len, len) != 0) return (-1); @@ -345,12 +351,12 @@ sbuf_cat(struct sbuf *s, const char *str if (SBUF_HASOVERFLOWED(s)) return (-1); - while (*str) { + while (*str != '\0') { if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) break; s->s_buf[s->s_len++] = *str++; } - if (*str) { + if (*str != '\0') { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -376,7 +382,8 @@ sbuf_copyin(struct sbuf *s, const void * len = SBUF_FREESPACE(s); /* XXX return 0? */ if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } switch (copyinstr(uaddr, s->s_buf + s->s_len, len + 1, &done)) { case ENAMETOOLONG: @@ -440,9 +447,11 @@ sbuf_vprintf(struct sbuf *s, const char * terminating nul. * * vsnprintf() returns the amount that would have been copied, - * given sufficient space, hence the min() calculation below. + * given sufficient space, so don't over-increment s_len. */ - s->s_len += min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); + s->s_len += len; if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s)) SBUF_SETFLAG(s, SBUF_OVERFLOWED); @@ -486,7 +495,7 @@ sbuf_putc(struct sbuf *s, int c) return (-1); } if (c != '\0') - s->s_buf[s->s_len++] = c; + s->s_buf[s->s_len++] = c; return (0); } @@ -503,7 +512,7 @@ sbuf_trim(struct sbuf *s) if (SBUF_HASOVERFLOWED(s)) return (-1); - while (s->s_len && isspace(s->s_buf[s->s_len-1])) + while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) --s->s_len; return (0); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 16:34:26 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 845FC106564A; Wed, 1 Jun 2011 16:34:26 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 740168FC14; Wed, 1 Jun 2011 16:34:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51GYQp5077929; Wed, 1 Jun 2011 16:34:26 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51GYQUn077927; Wed, 1 Jun 2011 16:34:26 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011634.p51GYQUn077927@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 16:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222571 - stable/7/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 16:34:26 -0000 Author: mdf Date: Wed Jun 1 16:34:26 2011 New Revision: 222571 URL: http://svn.freebsd.org/changeset/base/222571 Log: MFC r212180-r212184: Use math rather than iteration when the desired sbuf size is larger than SBUF_MAXEXTENDSIZE. Fix brain fart when converting an if statement into a KASSERT. Fix user-space libsbuf build. Why isn't CTASSERT available to user-space? Style(9) fixes and eliminate the use of min(). Use a better #if guard. Modified: stable/7/sys/kern/subr_sbuf.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_sbuf.c ============================================================================== --- stable/7/sys/kern/subr_sbuf.c Wed Jun 1 16:34:18 2011 (r222570) +++ stable/7/sys/kern/subr_sbuf.c Wed Jun 1 16:34:26 2011 (r222571) @@ -56,7 +56,6 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "st #define KASSERT(e, m) #define SBMALLOC(size) malloc(size) #define SBFREE(buf) free(buf) -#define min(x,y) MIN(x,y) #endif /* _KERNEL */ /* @@ -116,18 +115,24 @@ _assert_sbuf_state(const char *fun, stru #endif /* _KERNEL && INVARIANTS */ +#ifdef CTASSERT +CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); +CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); +#endif + static int sbuf_extendsize(int size) { int newsize; - newsize = SBUF_MINEXTENDSIZE; - while (newsize < size) { - if (newsize < (int)SBUF_MAXEXTENDSIZE) + if (size < (int)SBUF_MAXEXTENDSIZE) { + newsize = SBUF_MINEXTENDSIZE; + while (newsize < size) newsize *= 2; - else - newsize += SBUF_MAXEXTENDINCR; + } else { + newsize = roundup2(size, SBUF_MAXEXTENDINCR); } + KASSERT(newsize >= size, ("%s: %d < %d\n", __func__, newsize, size)); return (newsize); } @@ -184,11 +189,11 @@ sbuf_new(struct sbuf *s, char *buf, int s->s_flags = flags; } s->s_size = length; - if (buf) { + if (buf != NULL) { s->s_buf = buf; return (s); } - if (flags & SBUF_AUTOEXTEND) + if ((flags & SBUF_AUTOEXTEND) != 0) s->s_size = sbuf_extendsize(s->s_size); s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) { @@ -284,7 +289,7 @@ sbuf_bcat(struct sbuf *s, const void *bu break; s->s_buf[s->s_len++] = *str++; } - if (len) { + if (len > 0) { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -308,7 +313,8 @@ sbuf_bcopyin(struct sbuf *s, const void return (0); if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len - SBUF_FREESPACE(s)); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } if (copyin(uaddr, s->s_buf + s->s_len, len) != 0) return (-1); @@ -345,12 +351,12 @@ sbuf_cat(struct sbuf *s, const char *str if (SBUF_HASOVERFLOWED(s)) return (-1); - while (*str) { + while (*str != '\0') { if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) break; s->s_buf[s->s_len++] = *str++; } - if (*str) { + if (*str != '\0') { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -376,7 +382,8 @@ sbuf_copyin(struct sbuf *s, const void * len = SBUF_FREESPACE(s); /* XXX return 0? */ if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } switch (copyinstr(uaddr, s->s_buf + s->s_len, len + 1, &done)) { case ENAMETOOLONG: @@ -440,9 +447,11 @@ sbuf_vprintf(struct sbuf *s, const char * terminating nul. * * vsnprintf() returns the amount that would have been copied, - * given sufficient space, hence the min() calculation below. + * given sufficient space, so don't over-increment s_len. */ - s->s_len += min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); + s->s_len += len; if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s)) SBUF_SETFLAG(s, SBUF_OVERFLOWED); @@ -486,7 +495,7 @@ sbuf_putc(struct sbuf *s, int c) return (-1); } if (c != '\0') - s->s_buf[s->s_len++] = c; + s->s_buf[s->s_len++] = c; return (0); } @@ -503,7 +512,7 @@ sbuf_trim(struct sbuf *s) if (SBUF_HASOVERFLOWED(s)) return (-1); - while (s->s_len && isspace(s->s_buf[s->s_len-1])) + while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) --s->s_len; return (0); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 17:36:52 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 898B81065672; Wed, 1 Jun 2011 17:36:52 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7674A8FC08; Wed, 1 Jun 2011 17:36:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51Haq7a079960; Wed, 1 Jun 2011 17:36:52 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HaqTu079955; Wed, 1 Jun 2011 17:36:52 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011736.p51HaqTu079955@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 17:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222574 - in stable/8: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 17:36:52 -0000 Author: mdf Date: Wed Jun 1 17:36:52 2011 New Revision: 222574 URL: http://svn.freebsd.org/changeset/base/222574 Log: MFC r212365, r212367: r212365: Refactor sbuf code so that most uses of sbuf_extend() are in a new sbuf_put_byte(). This makes it easier to add drain functionality when a buffer would overflow as there are fewer code points. r212367: Add drain functionality to sbufs. The drain is a function that is called when the sbuf internal buffer is filled. For kernel sbufs with a drain, the internal buffer will never be expanded. For userland sbufs with a drain, the internal buffer may still be expanded by sbuf_[v]printf(3). Sbufs now have three basic uses: 1) static string manipulation. Overflow is marked. 2) dynamic string manipulation. Overflow triggers string growth. 3) drained string manipulation. Overflow triggers draining. In all cases the manipulation is 'safe' in that overflow is detected and managed. Note that r212367 had to be minorly re-implemented to dynamically allocate space for a function pointer, a void * argument, and an int error, to not break the ABI/KBI. Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/sbuf.9 stable/8/sys/kern/subr_sbuf.c stable/8/sys/sys/sbuf.h Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Wed Jun 1 17:17:02 2011 (r222573) +++ stable/8/share/man/man9/Makefile Wed Jun 1 17:36:52 2011 (r222574) @@ -1028,6 +1028,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ + sbuf.9 sbuf_set_drain.9 \ sbuf.9 sbuf_setpos.9 \ sbuf.9 sbuf_trim.9 \ sbuf.9 sbuf_vprintf.9 Modified: stable/8/share/man/man9/sbuf.9 ============================================================================== --- stable/8/share/man/man9/sbuf.9 Wed Jun 1 17:17:02 2011 (r222573) +++ stable/8/share/man/man9/sbuf.9 Wed Jun 1 17:36:52 2011 (r222574) @@ -43,6 +43,7 @@ .Nm sbuf_printf , .Nm sbuf_vprintf , .Nm sbuf_putc , +.Nm sbuf_set_drain , .Nm sbuf_trim , .Nm sbuf_overflowed , .Nm sbuf_finish , @@ -54,6 +55,8 @@ .Sh SYNOPSIS .In sys/types.h .In sys/sbuf.h +.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ len ) ; +.Pp .Ft struct sbuf * .Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags" .Ft struct sbuf * @@ -80,11 +83,13 @@ .Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap" .Ft int .Fn sbuf_putc "struct sbuf *s" "int c" +.Ft void +.Fn sbuf_set_drain "struct sbuf *s" "sbuf_drain_func *func" "void *arg" .Ft int .Fn sbuf_trim "struct sbuf *s" .Ft int .Fn sbuf_overflowed "struct sbuf *s" -.Ft void +.Ft int .Fn sbuf_finish "struct sbuf *s" .Ft char * .Fn sbuf_data "struct sbuf *s" @@ -224,6 +229,51 @@ to the at the current position. .Pp The +.Fn sbuf_set_drain +function sets a drain function +.Fa func +for the +.Fa sbuf , +and records a pointer +.Fa arg +to be passed to the drain on callback. +The drain function cannot be changed while +.Fa sbuf_len +is non-zero. +.Pp +The registered drain function +.Vt sbuf_drain_func +will be called with the argument +.Fa arg +provided to +.Fn sbuf_set_drain , +a pointer +.Fa data +to a byte string that is the contents of the sbuf, and the length +.Fa len +of the data. +If the drain function exists, it will be called when the sbuf internal +buffer is full, or on behalf of +.Fn sbuf_finish . +The drain function may drain some or all of the data, but must drain +at least 1 byte. +The return value from the drain function, if positive, indicates how +many bytes were drained. +If negative, the return value indicates the negative error code which +will be returned from this or a later call to +.Fn sbuf_finish . +The returned drained length cannot be zero. +To do unbuffered draining, initialize the sbuf with a two-byte buffer. +The drain will be called for every byte added to the sbuf. +The +.Fn sbuf_bcopyin , +.Fn sbuf_copyin , +.Fn sbuf_trim , +and +.Fn sbuf_data +functions cannot be used on an sbuf with a drain. +.Pp +The .Fn sbuf_copyin function copies a NUL-terminated string from the specified userland address into the @@ -289,10 +339,17 @@ overflowed. .Pp The .Fn sbuf_finish -function NUL-terminates the +function will call the attached drain function if one exists until all +the data in the .Fa sbuf -and marks it as finished, which means that it may no longer be -modified using +is flushed. +If there is no attached drain, +.Fn sbuf_finish +NUL-terminates the +.Fa sbuf . +In either case it marks the +.Fa sbuf +as finished, which means that it may no longer be modified using .Fn sbuf_setpos , .Fn sbuf_cat , .Fn sbuf_cpy , @@ -305,12 +362,21 @@ is used to reset the sbuf. .Pp The .Fn sbuf_data -and -.Fn sbuf_len -functions return the actual string and its length, respectively; +function returns the actual string; .Fn sbuf_data only works on a finished .Fa sbuf . +The +.Fn sbuf_len function returns the length of the string. +For an +.Fa sbuf +with an attached drain, +.Fn sbuf_len +returns the length of the un-drained data. +.Fn sbuf_done +returns non-zero if the +.Fa sbuf +is finished. .Fn sbuf_done returns non-zero if the .Fa sbuf @@ -329,6 +395,22 @@ size of its storage buffer using .Fn sbuf_setpos , or it is reinitialized to a sufficiently short string using .Fn sbuf_cpy . +.Pp +Drains in user-space will not always function as indicated. +While the drain function will be called immediately on overflow from +the +.Fa sbuf_putc , +.Fa sbuf_bcat , +.Fa sbuf_cat +functions, +.Fa sbuf_printf +and +.Fa sbuf_vprintf +currently have no way to determine whether there will be an overflow +until after it occurs, and cannot do a partial expansion of the format +string. +Thus when using libsbuf the buffer may be extended to allow completion +of a single printf call, even though a drain is attached. .Sh RETURN VALUES The .Fn sbuf_new @@ -372,6 +454,14 @@ The function returns \-1 if copying string from userland failed, and number of bytes copied otherwise. +The +.Fn sbuf_finish +function returns ENOMEM if the sbuf overflowed before being finished, +or returns the error code from the drain if one is attached. +When used as +.Xr sbuf_finish 3 , +.Fn sbuf_finish +will return \-1 and set errno on error instead. .Sh SEE ALSO .Xr printf 3 , .Xr strcat 3 , @@ -396,6 +486,8 @@ Additional improvements were suggested b .An Justin T. Gibbs Aq gibbs@FreeBSD.org . Auto-extend support added by .An Kelly Yancey Aq kbyanc@FreeBSD.org . +Drain functionality added by +.An Matthew Fleming Aq mdf@FreeBSD.org . .Pp This manual page was written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . Modified: stable/8/sys/kern/subr_sbuf.c ============================================================================== --- stable/8/sys/kern/subr_sbuf.c Wed Jun 1 17:17:02 2011 (r222573) +++ stable/8/sys/kern/subr_sbuf.c Wed Jun 1 17:36:52 2011 (r222574) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #else /* _KERNEL */ #include +#include #include #include #include @@ -48,6 +50,12 @@ __FBSDID("$FreeBSD$"); #include +struct sbuf_drain { + sbuf_drain_func *s_func; /* drain function */ + void *s_arg; /* user-supplied drain argument */ + int s_error; /* current error code */ +}; + #ifdef _KERNEL static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); #define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK) @@ -246,6 +254,8 @@ sbuf_clear(struct sbuf *s) SBUF_CLEARFLAG(s, SBUF_FINISHED); SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); + if (s->s_drain != NULL) + s->s_drain->s_error = 0; s->s_len = 0; } @@ -272,27 +282,125 @@ sbuf_setpos(struct sbuf *s, int pos) } /* + * Set up a drain function and argument on an sbuf to flush data to + * when the sbuf buffer overflows. + */ +void +sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx) +{ + + assert_sbuf_state(s, 0); + assert_sbuf_integrity(s); + KASSERT((s->s_drain != NULL && func == s->s_drain->s_func) || + s->s_len == 0, + ("Cannot change drain to %p on non-empty sbuf %p", func, s)); + if (func == NULL) { + SBFREE(s->s_drain); + s->s_drain = NULL; + return; + } + if (s->s_drain == NULL) { + s->s_drain = SBMALLOC(sizeof(*s->s_drain)); + if (s->s_drain == NULL) + return; + } + s->s_drain->s_func = func; + s->s_drain->s_arg = ctx; + s->s_drain->s_error = 0; +} + +/* + * Call the drain and process the return. + */ +static int +sbuf_drain(struct sbuf *s) +{ + int len; + + KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); + len = s->s_drain->s_func(s->s_drain->s_arg, s->s_buf, s->s_len); + if (len < 0) { + s->s_drain->s_error = -len; + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + return (s->s_drain->s_error); + } + + KASSERT(len > 0, ("Drain must either error or work!")); + s->s_len -= len; + /* + * Fast path for the expected case where all the data was + * drained. + */ + if (s->s_len == 0) + return (0); + /* + * Move the remaining characters to the beginning of the + * string. + */ + memmove(s->s_buf, s->s_buf + len, s->s_len); + return (0); +} + +/* + * Append a byte to an sbuf. This is the core function for appending + * to an sbuf and is the main place that deals with extending the + * buffer and marking overflow. + */ +static void +sbuf_put_byte(int c, struct sbuf *s) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + if (SBUF_HASOVERFLOWED(s)) + return; + if (SBUF_FREESPACE(s) <= 0) { + /* + * If there is a drain, use it, otherwise extend the + * buffer. + */ + if (s->s_drain != NULL) + (void)sbuf_drain(s); + else if (sbuf_extend(s, 1) < 0) + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + if (SBUF_HASOVERFLOWED(s)) + return; + } + s->s_buf[s->s_len++] = c; +} + +/* + * Append a non-NUL character to an sbuf. This prototype signature is + * suitable for use with kvprintf(9). + */ +static void +sbuf_putc_func(int c, void *arg) +{ + + if (c != '\0') + sbuf_put_byte(c, arg); +} + +/* * Append a byte string to an sbuf. */ int sbuf_bcat(struct sbuf *s, const void *buf, size_t len) { const char *str = buf; + const char *end = str + len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); if (SBUF_HASOVERFLOWED(s)) return (-1); - for (; len; len--) { - if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (len > 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } + for (; str < end; str++) { + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + } return (0); } @@ -306,6 +414,8 @@ sbuf_bcopyin(struct sbuf *s, const void assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -352,13 +462,9 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (*str != '\0') { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); } return (0); } @@ -374,6 +480,8 @@ sbuf_copyin(struct sbuf *s, const void * assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -417,11 +525,28 @@ sbuf_cpy(struct sbuf *s, const char *str /* * Format the given argument list and append the resulting string to an sbuf. */ +#ifdef _KERNEL +int +sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + KASSERT(fmt != NULL, + ("%s called with a NULL format string", __func__)); + + (void)kvprintf(fmt, sbuf_putc_func, s, 10, ap); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + return (0); +} +#else /* !_KERNEL */ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { va_list ap_copy; - int len; + int error, len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -432,13 +557,32 @@ sbuf_vprintf(struct sbuf *s, const char if (SBUF_HASOVERFLOWED(s)) return (-1); + /* + * For the moment, there is no way to get vsnprintf(3) to hand + * back a character at a time, to push everything into + * sbuf_putc_func() as was done for the kernel. + * + * In userspace, while drains are useful, there's generally + * not a problem attempting to malloc(3) on out of space. So + * expand a userland sbuf if there is not enough room for the + * data produced by sbuf_[v]printf(3). + */ + + error = 0; do { va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, fmt, ap_copy); va_end(ap_copy); - } while (len > SBUF_FREESPACE(s) && - sbuf_extend(s, len - SBUF_FREESPACE(s)) == 0); + + if (SBUF_FREESPACE(s) >= len) + break; + /* Cannot print with the current available space. */ + if (s->s_drain != NULL && s->s_len > 0) + error = sbuf_drain(s); + else + error = sbuf_extend(s, len - SBUF_FREESPACE(s)); + } while (error == 0); /* * s->s_len is the length of the string, without the terminating nul. @@ -462,6 +606,7 @@ sbuf_vprintf(struct sbuf *s, const char return (-1); return (0); } +#endif /* _KERNEL */ /* * Format the given arguments and append the resulting string to an sbuf. @@ -485,17 +630,9 @@ int sbuf_putc(struct sbuf *s, int c) { - assert_sbuf_integrity(s); - assert_sbuf_state(s, 0); - + sbuf_putc_func(c, s); if (SBUF_HASOVERFLOWED(s)) return (-1); - if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } - if (c != '\0') - s->s_buf[s->s_len++] = c; return (0); } @@ -508,6 +645,8 @@ sbuf_trim(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -531,16 +670,32 @@ sbuf_overflowed(struct sbuf *s) /* * Finish off an sbuf. */ -void +int sbuf_finish(struct sbuf *s) { + int error = 0; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + if (s->s_drain != NULL) { + error = s->s_drain->s_error; + while (s->s_len > 0 && error == 0) + error = sbuf_drain(s); + } else if (SBUF_HASOVERFLOWED(s)) + error = ENOMEM; s->s_buf[s->s_len] = '\0'; SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); SBUF_SETFLAG(s, SBUF_FINISHED); +#ifdef _KERNEL + return (error); +#else + /*XXX*/if (error) { + errno = error; + return (-1); + } else + return (0); +#endif } /* @@ -552,6 +707,8 @@ sbuf_data(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, SBUF_FINISHED); + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); return (s->s_buf); } @@ -565,6 +722,8 @@ sbuf_len(struct sbuf *s) assert_sbuf_integrity(s); /* don't care if it's finished or not */ + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -584,6 +743,8 @@ sbuf_delete(struct sbuf *s) if (SBUF_ISDYNAMIC(s)) SBFREE(s->s_buf); + if (s->s_drain != NULL) + SBFREE(s->s_drain); isdyn = SBUF_ISDYNSTRUCT(s); bzero(s, sizeof(*s)); if (isdyn) Modified: stable/8/sys/sys/sbuf.h ============================================================================== --- stable/8/sys/sys/sbuf.h Wed Jun 1 17:17:02 2011 (r222573) +++ stable/8/sys/sys/sbuf.h Wed Jun 1 17:36:52 2011 (r222574) @@ -33,12 +33,16 @@ #include +struct sbuf; +struct sbuf_drain_data; +typedef int (sbuf_drain_func)(void *, const char *, int); + /* * Structure definition */ struct sbuf { char *s_buf; /* storage buffer */ - void *s_unused; /* binary compatibility. */ + struct sbuf_drain *s_drain; /* drain function and data */ int s_size; /* size of storage buffer */ int s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ @@ -69,9 +73,10 @@ int sbuf_printf(struct sbuf *, const c int sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0); int sbuf_putc(struct sbuf *, int); +void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); int sbuf_trim(struct sbuf *); int sbuf_overflowed(struct sbuf *); -void sbuf_finish(struct sbuf *); +int sbuf_finish(struct sbuf *); char *sbuf_data(struct sbuf *); int sbuf_len(struct sbuf *); int sbuf_done(struct sbuf *); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 17:40:59 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5038106566B; Wed, 1 Jun 2011 17:40:59 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A20158FC12; Wed, 1 Jun 2011 17:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51HexNC080120; Wed, 1 Jun 2011 17:40:59 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HexUB080115; Wed, 1 Jun 2011 17:40:59 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011740.p51HexUB080115@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 17:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222575 - in stable/7: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 17:40:59 -0000 Author: mdf Date: Wed Jun 1 17:40:59 2011 New Revision: 222575 URL: http://svn.freebsd.org/changeset/base/222575 Log: MFC r212365, r212367: r212365: Refactor sbuf code so that most uses of sbuf_extend() are in a new sbuf_put_byte(). This makes it easier to add drain functionality when a buffer would overflow as there are fewer code points. r212367: Add drain functionality to sbufs. The drain is a function that is called when the sbuf internal buffer is filled. For kernel sbufs with a drain, the internal buffer will never be expanded. For userland sbufs with a drain, the internal buffer may still be expanded by sbuf_[v]printf(3). Sbufs now have three basic uses: 1) static string manipulation. Overflow is marked. 2) dynamic string manipulation. Overflow triggers string growth. 3) drained string manipulation. Overflow triggers draining. In all cases the manipulation is 'safe' in that overflow is detected and managed. Note that r212367 had to be minorly re-implemented to dynamically allocate space for a function pointer, a void * argument, and an int error, to not break the ABI/KBI. Modified: stable/7/share/man/man9/Makefile stable/7/share/man/man9/sbuf.9 stable/7/sys/kern/subr_sbuf.c stable/7/sys/sys/sbuf.h Directory Properties: stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/Makefile ============================================================================== --- stable/7/share/man/man9/Makefile Wed Jun 1 17:36:52 2011 (r222574) +++ stable/7/share/man/man9/Makefile Wed Jun 1 17:40:59 2011 (r222575) @@ -965,6 +965,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ + sbuf.9 sbuf_set_drain.9 \ sbuf.9 sbuf_setpos.9 \ sbuf.9 sbuf_trim.9 \ sbuf.9 sbuf_vprintf.9 Modified: stable/7/share/man/man9/sbuf.9 ============================================================================== --- stable/7/share/man/man9/sbuf.9 Wed Jun 1 17:36:52 2011 (r222574) +++ stable/7/share/man/man9/sbuf.9 Wed Jun 1 17:40:59 2011 (r222575) @@ -43,6 +43,7 @@ .Nm sbuf_printf , .Nm sbuf_vprintf , .Nm sbuf_putc , +.Nm sbuf_set_drain , .Nm sbuf_trim , .Nm sbuf_overflowed , .Nm sbuf_finish , @@ -54,6 +55,8 @@ .Sh SYNOPSIS .In sys/types.h .In sys/sbuf.h +.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ len ) ; +.Pp .Ft struct sbuf * .Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags" .Ft struct sbuf * @@ -80,11 +83,13 @@ .Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap" .Ft int .Fn sbuf_putc "struct sbuf *s" "int c" +.Ft void +.Fn sbuf_set_drain "struct sbuf *s" "sbuf_drain_func *func" "void *arg" .Ft int .Fn sbuf_trim "struct sbuf *s" .Ft int .Fn sbuf_overflowed "struct sbuf *s" -.Ft void +.Ft int .Fn sbuf_finish "struct sbuf *s" .Ft char * .Fn sbuf_data "struct sbuf *s" @@ -224,6 +229,51 @@ to the at the current position. .Pp The +.Fn sbuf_set_drain +function sets a drain function +.Fa func +for the +.Fa sbuf , +and records a pointer +.Fa arg +to be passed to the drain on callback. +The drain function cannot be changed while +.Fa sbuf_len +is non-zero. +.Pp +The registered drain function +.Vt sbuf_drain_func +will be called with the argument +.Fa arg +provided to +.Fn sbuf_set_drain , +a pointer +.Fa data +to a byte string that is the contents of the sbuf, and the length +.Fa len +of the data. +If the drain function exists, it will be called when the sbuf internal +buffer is full, or on behalf of +.Fn sbuf_finish . +The drain function may drain some or all of the data, but must drain +at least 1 byte. +The return value from the drain function, if positive, indicates how +many bytes were drained. +If negative, the return value indicates the negative error code which +will be returned from this or a later call to +.Fn sbuf_finish . +The returned drained length cannot be zero. +To do unbuffered draining, initialize the sbuf with a two-byte buffer. +The drain will be called for every byte added to the sbuf. +The +.Fn sbuf_bcopyin , +.Fn sbuf_copyin , +.Fn sbuf_trim , +and +.Fn sbuf_data +functions cannot be used on an sbuf with a drain. +.Pp +The .Fn sbuf_copyin function copies a NUL-terminated string from the specified userland address into the @@ -289,10 +339,17 @@ overflowed. .Pp The .Fn sbuf_finish -function NUL-terminates the +function will call the attached drain function if one exists until all +the data in the .Fa sbuf -and marks it as finished, which means that it may no longer be -modified using +is flushed. +If there is no attached drain, +.Fn sbuf_finish +NUL-terminates the +.Fa sbuf . +In either case it marks the +.Fa sbuf +as finished, which means that it may no longer be modified using .Fn sbuf_setpos , .Fn sbuf_cat , .Fn sbuf_cpy , @@ -305,12 +362,21 @@ is used to reset the sbuf. .Pp The .Fn sbuf_data -and -.Fn sbuf_len -functions return the actual string and its length, respectively; +function returns the actual string; .Fn sbuf_data only works on a finished .Fa sbuf . +The +.Fn sbuf_len function returns the length of the string. +For an +.Fa sbuf +with an attached drain, +.Fn sbuf_len +returns the length of the un-drained data. +.Fn sbuf_done +returns non-zero if the +.Fa sbuf +is finished. .Fn sbuf_done returns non-zero if the .Fa sbuf @@ -329,6 +395,22 @@ size of its storage buffer using .Fn sbuf_setpos , or it is reinitialized to a sufficiently short string using .Fn sbuf_cpy . +.Pp +Drains in user-space will not always function as indicated. +While the drain function will be called immediately on overflow from +the +.Fa sbuf_putc , +.Fa sbuf_bcat , +.Fa sbuf_cat +functions, +.Fa sbuf_printf +and +.Fa sbuf_vprintf +currently have no way to determine whether there will be an overflow +until after it occurs, and cannot do a partial expansion of the format +string. +Thus when using libsbuf the buffer may be extended to allow completion +of a single printf call, even though a drain is attached. .Sh RETURN VALUES The .Fn sbuf_new @@ -372,6 +454,14 @@ The function returns \-1 if copying string from userland failed, and number of bytes copied otherwise. +The +.Fn sbuf_finish +function returns ENOMEM if the sbuf overflowed before being finished, +or returns the error code from the drain if one is attached. +When used as +.Xr sbuf_finish 3 , +.Fn sbuf_finish +will return \-1 and set errno on error instead. .Sh SEE ALSO .Xr printf 3 , .Xr strcat 3 , @@ -396,6 +486,8 @@ Additional improvements were suggested b .An Justin T. Gibbs Aq gibbs@FreeBSD.org . Auto-extend support added by .An Kelly Yancey Aq kbyanc@FreeBSD.org . +Drain functionality added by +.An Matthew Fleming Aq mdf@FreeBSD.org . .Pp This manual page was written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . Modified: stable/7/sys/kern/subr_sbuf.c ============================================================================== --- stable/7/sys/kern/subr_sbuf.c Wed Jun 1 17:36:52 2011 (r222574) +++ stable/7/sys/kern/subr_sbuf.c Wed Jun 1 17:40:59 2011 (r222575) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #else /* _KERNEL */ #include +#include #include #include #include @@ -48,6 +50,12 @@ __FBSDID("$FreeBSD$"); #include +struct sbuf_drain { + sbuf_drain_func *s_func; /* drain function */ + void *s_arg; /* user-supplied drain argument */ + int s_error; /* current error code */ +}; + #ifdef _KERNEL static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); #define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK) @@ -246,6 +254,8 @@ sbuf_clear(struct sbuf *s) SBUF_CLEARFLAG(s, SBUF_FINISHED); SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); + if (s->s_drain != NULL) + s->s_drain->s_error = 0; s->s_len = 0; } @@ -272,27 +282,125 @@ sbuf_setpos(struct sbuf *s, int pos) } /* + * Set up a drain function and argument on an sbuf to flush data to + * when the sbuf buffer overflows. + */ +void +sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx) +{ + + assert_sbuf_state(s, 0); + assert_sbuf_integrity(s); + KASSERT((s->s_drain != NULL && func == s->s_drain->s_func) || + s->s_len == 0, + ("Cannot change drain to %p on non-empty sbuf %p", func, s)); + if (func == NULL) { + SBFREE(s->s_drain); + s->s_drain = NULL; + return; + } + if (s->s_drain == NULL) { + s->s_drain = SBMALLOC(sizeof(*s->s_drain)); + if (s->s_drain == NULL) + return; + } + s->s_drain->s_func = func; + s->s_drain->s_arg = ctx; + s->s_drain->s_error = 0; +} + +/* + * Call the drain and process the return. + */ +static int +sbuf_drain(struct sbuf *s) +{ + int len; + + KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); + len = s->s_drain->s_func(s->s_drain->s_arg, s->s_buf, s->s_len); + if (len < 0) { + s->s_drain->s_error = -len; + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + return (s->s_drain->s_error); + } + + KASSERT(len > 0, ("Drain must either error or work!")); + s->s_len -= len; + /* + * Fast path for the expected case where all the data was + * drained. + */ + if (s->s_len == 0) + return (0); + /* + * Move the remaining characters to the beginning of the + * string. + */ + memmove(s->s_buf, s->s_buf + len, s->s_len); + return (0); +} + +/* + * Append a byte to an sbuf. This is the core function for appending + * to an sbuf and is the main place that deals with extending the + * buffer and marking overflow. + */ +static void +sbuf_put_byte(int c, struct sbuf *s) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + if (SBUF_HASOVERFLOWED(s)) + return; + if (SBUF_FREESPACE(s) <= 0) { + /* + * If there is a drain, use it, otherwise extend the + * buffer. + */ + if (s->s_drain != NULL) + (void)sbuf_drain(s); + else if (sbuf_extend(s, 1) < 0) + SBUF_SETFLAG(s, SBUF_OVERFLOWED); + if (SBUF_HASOVERFLOWED(s)) + return; + } + s->s_buf[s->s_len++] = c; +} + +/* + * Append a non-NUL character to an sbuf. This prototype signature is + * suitable for use with kvprintf(9). + */ +static void +sbuf_putc_func(int c, void *arg) +{ + + if (c != '\0') + sbuf_put_byte(c, arg); +} + +/* * Append a byte string to an sbuf. */ int sbuf_bcat(struct sbuf *s, const void *buf, size_t len) { const char *str = buf; + const char *end = str + len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); if (SBUF_HASOVERFLOWED(s)) return (-1); - for (; len; len--) { - if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (len > 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } + for (; str < end; str++) { + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + } return (0); } @@ -306,6 +414,8 @@ sbuf_bcopyin(struct sbuf *s, const void assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -352,13 +462,9 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) - break; - s->s_buf[s->s_len++] = *str++; - } - if (*str != '\0') { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); + sbuf_put_byte(*str, s); + if (SBUF_HASOVERFLOWED(s)) + return (-1); } return (0); } @@ -374,6 +480,8 @@ sbuf_copyin(struct sbuf *s, const void * assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("Nonsensical copyin to sbuf %p with a drain", s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -417,11 +525,28 @@ sbuf_cpy(struct sbuf *s, const char *str /* * Format the given argument list and append the resulting string to an sbuf. */ +#ifdef _KERNEL +int +sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) +{ + + assert_sbuf_integrity(s); + assert_sbuf_state(s, 0); + + KASSERT(fmt != NULL, + ("%s called with a NULL format string", __func__)); + + (void)kvprintf(fmt, sbuf_putc_func, s, 10, ap); + if (SBUF_HASOVERFLOWED(s)) + return (-1); + return (0); +} +#else /* !_KERNEL */ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { va_list ap_copy; - int len; + int error, len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -432,13 +557,32 @@ sbuf_vprintf(struct sbuf *s, const char if (SBUF_HASOVERFLOWED(s)) return (-1); + /* + * For the moment, there is no way to get vsnprintf(3) to hand + * back a character at a time, to push everything into + * sbuf_putc_func() as was done for the kernel. + * + * In userspace, while drains are useful, there's generally + * not a problem attempting to malloc(3) on out of space. So + * expand a userland sbuf if there is not enough room for the + * data produced by sbuf_[v]printf(3). + */ + + error = 0; do { va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, fmt, ap_copy); va_end(ap_copy); - } while (len > SBUF_FREESPACE(s) && - sbuf_extend(s, len - SBUF_FREESPACE(s)) == 0); + + if (SBUF_FREESPACE(s) >= len) + break; + /* Cannot print with the current available space. */ + if (s->s_drain != NULL && s->s_len > 0) + error = sbuf_drain(s); + else + error = sbuf_extend(s, len - SBUF_FREESPACE(s)); + } while (error == 0); /* * s->s_len is the length of the string, without the terminating nul. @@ -462,6 +606,7 @@ sbuf_vprintf(struct sbuf *s, const char return (-1); return (0); } +#endif /* _KERNEL */ /* * Format the given arguments and append the resulting string to an sbuf. @@ -485,17 +630,9 @@ int sbuf_putc(struct sbuf *s, int c) { - assert_sbuf_integrity(s); - assert_sbuf_state(s, 0); - + sbuf_putc_func(c, s); if (SBUF_HASOVERFLOWED(s)) return (-1); - if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) { - SBUF_SETFLAG(s, SBUF_OVERFLOWED); - return (-1); - } - if (c != '\0') - s->s_buf[s->s_len++] = c; return (0); } @@ -508,6 +645,8 @@ sbuf_trim(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -531,16 +670,32 @@ sbuf_overflowed(struct sbuf *s) /* * Finish off an sbuf. */ -void +int sbuf_finish(struct sbuf *s) { + int error = 0; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + if (s->s_drain != NULL) { + error = s->s_drain->s_error; + while (s->s_len > 0 && error == 0) + error = sbuf_drain(s); + } else if (SBUF_HASOVERFLOWED(s)) + error = ENOMEM; s->s_buf[s->s_len] = '\0'; SBUF_CLEARFLAG(s, SBUF_OVERFLOWED); SBUF_SETFLAG(s, SBUF_FINISHED); +#ifdef _KERNEL + return (error); +#else + /*XXX*/if (error) { + errno = error; + return (-1); + } else + return (0); +#endif } /* @@ -552,6 +707,8 @@ sbuf_data(struct sbuf *s) assert_sbuf_integrity(s); assert_sbuf_state(s, SBUF_FINISHED); + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); return (s->s_buf); } @@ -565,6 +722,8 @@ sbuf_len(struct sbuf *s) assert_sbuf_integrity(s); /* don't care if it's finished or not */ + KASSERT(s->s_drain == NULL, + ("%s makes no sense on sbuf %p with drain", __func__, s)); if (SBUF_HASOVERFLOWED(s)) return (-1); @@ -584,6 +743,8 @@ sbuf_delete(struct sbuf *s) if (SBUF_ISDYNAMIC(s)) SBFREE(s->s_buf); + if (s->s_drain != NULL) + SBFREE(s->s_drain); isdyn = SBUF_ISDYNSTRUCT(s); bzero(s, sizeof(*s)); if (isdyn) Modified: stable/7/sys/sys/sbuf.h ============================================================================== --- stable/7/sys/sys/sbuf.h Wed Jun 1 17:36:52 2011 (r222574) +++ stable/7/sys/sys/sbuf.h Wed Jun 1 17:40:59 2011 (r222575) @@ -33,12 +33,16 @@ #include +struct sbuf; +struct sbuf_drain_data; +typedef int (sbuf_drain_func)(void *, const char *, int); + /* * Structure definition */ struct sbuf { char *s_buf; /* storage buffer */ - void *s_unused; /* binary compatibility. */ + struct sbuf_drain *s_drain; /* drain function and data */ int s_size; /* size of storage buffer */ int s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ @@ -69,9 +73,10 @@ int sbuf_printf(struct sbuf *, const c int sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0); int sbuf_putc(struct sbuf *, int); +void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); int sbuf_trim(struct sbuf *); int sbuf_overflowed(struct sbuf *); -void sbuf_finish(struct sbuf *); +int sbuf_finish(struct sbuf *); char *sbuf_data(struct sbuf *); int sbuf_len(struct sbuf *); int sbuf_done(struct sbuf *); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 17:51:18 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D85CD106564A; Wed, 1 Jun 2011 17:51:18 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F27A8FC12; Wed, 1 Jun 2011 17:51:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51HpIGg080531; Wed, 1 Jun 2011 17:51:18 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HpIJ2080529; Wed, 1 Jun 2011 17:51:18 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011751.p51HpIJ2080529@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 17:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222576 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 17:51:19 -0000 Author: mdf Date: Wed Jun 1 17:51:18 2011 New Revision: 222576 URL: http://svn.freebsd.org/changeset/base/222576 Log: MFC r212478: (originally by kan@) Add missing pointer increment to sbuf_cat. Modified: stable/8/sys/kern/subr_sbuf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_sbuf.c ============================================================================== --- stable/8/sys/kern/subr_sbuf.c Wed Jun 1 17:40:59 2011 (r222575) +++ stable/8/sys/kern/subr_sbuf.c Wed Jun 1 17:51:18 2011 (r222576) @@ -462,7 +462,7 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - sbuf_put_byte(*str, s); + sbuf_put_byte(*str++, s); if (SBUF_HASOVERFLOWED(s)) return (-1); } From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 17:51:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22ACD1065797; Wed, 1 Jun 2011 17:51:28 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11CBE8FC0C; Wed, 1 Jun 2011 17:51:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51HpR1G080571; Wed, 1 Jun 2011 17:51:27 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HpROC080569; Wed, 1 Jun 2011 17:51:27 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011751.p51HpROC080569@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 17:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222577 - stable/7/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 17:51:28 -0000 Author: mdf Date: Wed Jun 1 17:51:27 2011 New Revision: 222577 URL: http://svn.freebsd.org/changeset/base/222577 Log: MFC r212478: (originally by kan@) Add missing pointer increment to sbuf_cat. Modified: stable/7/sys/kern/subr_sbuf.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_sbuf.c ============================================================================== --- stable/7/sys/kern/subr_sbuf.c Wed Jun 1 17:51:18 2011 (r222576) +++ stable/7/sys/kern/subr_sbuf.c Wed Jun 1 17:51:27 2011 (r222577) @@ -462,7 +462,7 @@ sbuf_cat(struct sbuf *s, const char *str return (-1); while (*str != '\0') { - sbuf_put_byte(*str, s); + sbuf_put_byte(*str++, s); if (SBUF_HASOVERFLOWED(s)) return (-1); } From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 18:26:59 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9114106566C; Wed, 1 Jun 2011 18:26:59 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A657E8FC14; Wed, 1 Jun 2011 18:26:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51IQxOb081800; Wed, 1 Jun 2011 18:26:59 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51IQxP2081793; Wed, 1 Jun 2011 18:26:59 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011826.p51IQxP2081793@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 18:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222579 - in stable/8: share/man/man9 sys/dev/cxgb sys/kern sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 18:26:59 -0000 Author: mdf Date: Wed Jun 1 18:26:59 2011 New Revision: 222579 URL: http://svn.freebsd.org/changeset/base/222579 Log: Partial MFC of r212370. np@ requested this functionality so I kept in the cxgb change, but otherwise MFC'd only the new function sbuf_new_for_sysctl(9) and none of the changed code. MFC r217830: Document sbuf_new_for_sysctl(9). Partial MFC of r217916: Explicitly wire the user buffer rather than doing it implicitly in sbuf_new_for_sysctl(9). This allows using an sbuf with a SYSCTL_OUT drain for extremely large amounts of data where the caller knows that appropriate references are held, and sleeping is not an issue. Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/sbuf.9 stable/8/sys/dev/cxgb/cxgb_sge.c stable/8/sys/kern/kern_sysctl.c stable/8/sys/kern/subr_sbuf.c stable/8/sys/sys/sysctl.h Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/share/man/man9/Makefile Wed Jun 1 18:26:59 2011 (r222579) @@ -1025,6 +1025,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_finish.9 \ sbuf.9 sbuf_len.9 \ sbuf.9 sbuf_new.9 \ + sbuf.9 sbuf_new_for_sysctl.9 \ sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ Modified: stable/8/share/man/man9/sbuf.9 ============================================================================== --- stable/8/share/man/man9/sbuf.9 Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/share/man/man9/sbuf.9 Wed Jun 1 18:26:59 2011 (r222579) @@ -25,13 +25,14 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2009 +.Dd January 25, 2011 .Dt SBUF 9 .Os .Sh NAME .Nm sbuf , .Nm sbuf_new , .Nm sbuf_new_auto , +.Nm sbuf_new_for_sysctl , .Nm sbuf_clear , .Nm sbuf_setpos , .Nm sbuf_bcat , @@ -99,6 +100,9 @@ .Fn sbuf_done "struct sbuf *s" .Ft void .Fn sbuf_delete "struct sbuf *s" +.In sys/sysctl.h +.Ft struct sbuf * +.Fn sbuf_new_for_sysctl "struct sbuf *s" "char *buf" "int length" "struct sysctl_req *req" .Sh DESCRIPTION The .Nm @@ -169,6 +173,15 @@ and .Dv SBUF_AUTOEXTEND . .Pp The +.Fn sbuf_new_for_sysctl +function will set up an sbuf with a drain function to use +.Fn SYSCTL_OUT +when the internal buffer fills. +Note that if the various functions which append to an sbuf are used while +a non-sleepable lock is held, the user buffer should be wired using +.Fn sysctl_wire_old_buffer . +.Pp +The .Fn sbuf_delete function clears the .Fa sbuf Modified: stable/8/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_sge.c Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/sys/dev/cxgb/cxgb_sge.c Wed Jun 1 18:26:59 2011 (r222579) @@ -3223,7 +3223,6 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) struct sge_rspq *rspq; struct sge_qset *qs; int i, err, dump_end, idx; - static int multiplier = 1; struct sbuf *sb; struct rsp_desc *rspd; uint32_t data[4]; @@ -3248,8 +3247,10 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) err = t3_sge_read_rspq(qs->port->adapter, rspq->cntxt_id, data); if (err) return (err); -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n index=%u size=%u MSI-X/RspQ=%u intr enable=%u intr armed=%u\n", (data[0] & 0xffff), data[0] >> 16, ((data[2] >> 20) & 0x3f), @@ -3272,13 +3273,11 @@ retry_sbufops: rspd->rss_hdr.rss_hash_val, be32toh(rspd->flags), be32toh(rspd->len_cq), rspd->intr_gen); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3289,7 +3288,6 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3316,10 +3314,10 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) err = t3_sge_read_ecntxt(qs->port->adapter, qs->rspq.cntxt_id, data); if (err) return (err); - - -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n credits=%u GTS=%u index=%u size=%u rspq#=%u cmdq#=%u\n", (data[0] & 0x7fff), ((data[0] >> 15) & 1), (data[0] >> 16), @@ -3346,13 +3344,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3363,7 +3358,6 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3387,8 +3381,10 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err != 0) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " qid=%d start=%d -> end=%d\n", qs->idx, txq->txq_dump_start, (txq->txq_dump_start + txq->txq_dump_count) & 255); @@ -3408,13 +3404,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } Modified: stable/8/sys/kern/kern_sysctl.c ============================================================================== --- stable/8/sys/kern/kern_sysctl.c Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/sys/kern/kern_sysctl.c Wed Jun 1 18:26:59 2011 (r222579) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1586,3 +1587,28 @@ userland_sysctl(struct thread *td, int * } return (error); } + +/* + * Drain into a sysctl struct. The user buffer should be wired if a page + * fault would cause issue. + */ +static int +sbuf_sysctl_drain(void *arg, const char *data, int len) +{ + struct sysctl_req *req = arg; + int error; + + error = SYSCTL_OUT(req, data, len); + KASSERT(error >= 0, ("Got unexpected negative value %d", error)); + return (error == 0 ? len : -error); +} + +struct sbuf * +sbuf_new_for_sysctl(struct sbuf *s, char *buf, int length, + struct sysctl_req *req) +{ + + s = sbuf_new(s, buf, length, SBUF_FIXEDLEN); + sbuf_set_drain(s, sbuf_sysctl_drain, req); + return (s); +} Modified: stable/8/sys/kern/subr_sbuf.c ============================================================================== --- stable/8/sys/kern/subr_sbuf.c Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/sys/kern/subr_sbuf.c Wed Jun 1 18:26:59 2011 (r222579) @@ -324,8 +324,8 @@ sbuf_drain(struct sbuf *s) SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (s->s_drain->s_error); } - - KASSERT(len > 0, ("Drain must either error or work!")); + KASSERT(len > 0 && len <= s->s_len, + ("Bad drain amount %d for sbuf %p", len, s)); s->s_len -= len; /* * Fast path for the expected case where all the data was Modified: stable/8/sys/sys/sysctl.h ============================================================================== --- stable/8/sys/sys/sysctl.h Wed Jun 1 17:58:27 2011 (r222578) +++ stable/8/sys/sys/sysctl.h Wed Jun 1 18:26:59 2011 (r222579) @@ -715,6 +715,9 @@ void sysctl_lock(void); void sysctl_unlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); +struct sbuf; +struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, + struct sysctl_req *); #else /* !_KERNEL */ #include From owner-svn-src-stable@FreeBSD.ORG Wed Jun 1 18:27:13 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 943CC1065676; Wed, 1 Jun 2011 18:27:13 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81AE58FC12; Wed, 1 Jun 2011 18:27:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51IRDsM081856; Wed, 1 Jun 2011 18:27:13 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51IRDbG081849; Wed, 1 Jun 2011 18:27:13 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201106011827.p51IRDbG081849@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Jun 2011 18:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222580 - in stable/7: share/man/man9 sys/dev/cxgb sys/kern sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 18:27:13 -0000 Author: mdf Date: Wed Jun 1 18:27:13 2011 New Revision: 222580 URL: http://svn.freebsd.org/changeset/base/222580 Log: Partial MFC of r212370. np@ requested this functionality so I kept in the cxgb change, but otherwise MFC'd only the new function sbuf_new_for_sysctl(9) and none of the changed code. MFC r217830: Document sbuf_new_for_sysctl(9). Partial MFC of r217916: Explicitly wire the user buffer rather than doing it implicitly in sbuf_new_for_sysctl(9). This allows using an sbuf with a SYSCTL_OUT drain for extremely large amounts of data where the caller knows that appropriate references are held, and sleeping is not an issue. Modified: stable/7/share/man/man9/Makefile stable/7/share/man/man9/sbuf.9 stable/7/sys/dev/cxgb/cxgb_sge.c stable/7/sys/kern/kern_sysctl.c stable/7/sys/kern/subr_sbuf.c stable/7/sys/sys/sysctl.h Directory Properties: stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man9/Makefile ============================================================================== --- stable/7/share/man/man9/Makefile Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/share/man/man9/Makefile Wed Jun 1 18:27:13 2011 (r222580) @@ -962,6 +962,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \ sbuf.9 sbuf_finish.9 \ sbuf.9 sbuf_len.9 \ sbuf.9 sbuf_new.9 \ + sbuf.9 sbuf_new_for_sysctl.9 \ sbuf.9 sbuf_overflowed.9 \ sbuf.9 sbuf_printf.9 \ sbuf.9 sbuf_putc.9 \ Modified: stable/7/share/man/man9/sbuf.9 ============================================================================== --- stable/7/share/man/man9/sbuf.9 Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/share/man/man9/sbuf.9 Wed Jun 1 18:27:13 2011 (r222580) @@ -25,13 +25,14 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2009 +.Dd January 25, 2011 .Dt SBUF 9 .Os .Sh NAME .Nm sbuf , .Nm sbuf_new , .Nm sbuf_new_auto , +.Nm sbuf_new_for_sysctl , .Nm sbuf_clear , .Nm sbuf_setpos , .Nm sbuf_bcat , @@ -99,6 +100,9 @@ .Fn sbuf_done "struct sbuf *s" .Ft void .Fn sbuf_delete "struct sbuf *s" +.In sys/sysctl.h +.Ft struct sbuf * +.Fn sbuf_new_for_sysctl "struct sbuf *s" "char *buf" "int length" "struct sysctl_req *req" .Sh DESCRIPTION The .Nm @@ -169,6 +173,15 @@ and .Dv SBUF_AUTOEXTEND . .Pp The +.Fn sbuf_new_for_sysctl +function will set up an sbuf with a drain function to use +.Fn SYSCTL_OUT +when the internal buffer fills. +Note that if the various functions which append to an sbuf are used while +a non-sleepable lock is held, the user buffer should be wired using +.Fn sysctl_wire_old_buffer . +.Pp +The .Fn sbuf_delete function clears the .Fa sbuf Modified: stable/7/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_sge.c Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/sys/dev/cxgb/cxgb_sge.c Wed Jun 1 18:27:13 2011 (r222580) @@ -3070,7 +3070,6 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) struct sge_rspq *rspq; struct sge_qset *qs; int i, err, dump_end, idx; - static int multiplier = 1; struct sbuf *sb; struct rsp_desc *rspd; uint32_t data[4]; @@ -3095,8 +3094,10 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS) err = t3_sge_read_rspq(qs->port->adapter, rspq->cntxt_id, data); if (err) return (err); -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n index=%u size=%u MSI-X/RspQ=%u intr enable=%u intr armed=%u\n", (data[0] & 0xffff), data[0] >> 16, ((data[2] >> 20) & 0x3f), @@ -3119,13 +3120,11 @@ retry_sbufops: rspd->rss_hdr.rss_hash_val, be32toh(rspd->flags), be32toh(rspd->len_cq), rspd->intr_gen); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3136,7 +3135,6 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3163,10 +3161,10 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS) err = t3_sge_read_ecntxt(qs->port->adapter, qs->rspq.cntxt_id, data); if (err) return (err); - - -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " \n credits=%u GTS=%u index=%u size=%u rspq#=%u cmdq#=%u\n", (data[0] & 0x7fff), ((data[0] >> 15) & 1), (data[0] >> 16), @@ -3193,13 +3191,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } @@ -3210,7 +3205,6 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) struct sge_txq *txq; struct sge_qset *qs; int i, j, err, dump_end; - static int multiplier = 1; struct sbuf *sb; struct tx_desc *txd; uint32_t *WR, wr_hi, wr_lo, gen; @@ -3234,8 +3228,10 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS) return (EINVAL); } -retry_sbufops: - sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN); + err = sysctl_wire_old_buffer(req, 0); + if (err != 0) + return (err); + sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req); sbuf_printf(sb, " qid=%d start=%d -> end=%d\n", qs->idx, txq->txq_dump_start, (txq->txq_dump_start + txq->txq_dump_count) & 255); @@ -3255,13 +3251,10 @@ retry_sbufops: WR[j], WR[j + 1], WR[j + 2], WR[j + 3]); } - if (sbuf_overflowed(sb)) { - sbuf_delete(sb); - multiplier++; - goto retry_sbufops; - } - sbuf_finish(sb); - err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + err = sbuf_finish(sb); + /* Output a trailing NUL. */ + if (err == 0) + err = SYSCTL_OUT(req, "", 1); sbuf_delete(sb); return (err); } Modified: stable/7/sys/kern/kern_sysctl.c ============================================================================== --- stable/7/sys/kern/kern_sysctl.c Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/sys/kern/kern_sysctl.c Wed Jun 1 18:27:13 2011 (r222580) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1585,3 +1586,28 @@ userland_sysctl(struct thread *td, int * } return (error); } + +/* + * Drain into a sysctl struct. The user buffer should be wired if a page + * fault would cause issue. + */ +static int +sbuf_sysctl_drain(void *arg, const char *data, int len) +{ + struct sysctl_req *req = arg; + int error; + + error = SYSCTL_OUT(req, data, len); + KASSERT(error >= 0, ("Got unexpected negative value %d", error)); + return (error == 0 ? len : -error); +} + +struct sbuf * +sbuf_new_for_sysctl(struct sbuf *s, char *buf, int length, + struct sysctl_req *req) +{ + + s = sbuf_new(s, buf, length, SBUF_FIXEDLEN); + sbuf_set_drain(s, sbuf_sysctl_drain, req); + return (s); +} Modified: stable/7/sys/kern/subr_sbuf.c ============================================================================== --- stable/7/sys/kern/subr_sbuf.c Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/sys/kern/subr_sbuf.c Wed Jun 1 18:27:13 2011 (r222580) @@ -324,8 +324,8 @@ sbuf_drain(struct sbuf *s) SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (s->s_drain->s_error); } - - KASSERT(len > 0, ("Drain must either error or work!")); + KASSERT(len > 0 && len <= s->s_len, + ("Bad drain amount %d for sbuf %p", len, s)); s->s_len -= len; /* * Fast path for the expected case where all the data was Modified: stable/7/sys/sys/sysctl.h ============================================================================== --- stable/7/sys/sys/sysctl.h Wed Jun 1 18:26:59 2011 (r222579) +++ stable/7/sys/sys/sysctl.h Wed Jun 1 18:27:13 2011 (r222580) @@ -703,6 +703,9 @@ void sysctl_lock(void); void sysctl_unlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); +struct sbuf; +struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, + struct sysctl_req *); #else /* !_KERNEL */ #include From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 07:19:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AB6F10657A5; Thu, 2 Jun 2011 07:19:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47D058FC08; Thu, 2 Jun 2011 07:19:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p527JKAL005772; Thu, 2 Jun 2011 07:19:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p527JKva005770; Thu, 2 Jun 2011 07:19:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020719.p527JKva005770@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 07:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222593 - stable/8/sys/x86/cpufreq X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 07:19:20 -0000 Author: mav Date: Thu Jun 2 07:19:19 2011 New Revision: 222593 URL: http://svn.freebsd.org/changeset/base/222593 Log: MFC r209339: Core i5, same as previously Core2Duo, found to not set P-state for single core lower then set on other cores. Do not try to test P-states on attach on SMP systems. It is hopeless now and will just pollute verbose logs. If needed, check still can be forced via loader tunable. Modified: stable/8/sys/x86/cpufreq/est.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/x86/cpufreq/est.c ============================================================================== --- stable/8/sys/x86/cpufreq/est.c Thu Jun 2 05:31:54 2011 (r222592) +++ stable/8/sys/x86/cpufreq/est.c Thu Jun 2 07:19:19 2011 (r222593) @@ -1126,16 +1126,12 @@ est_acpi_info(device_t dev, freq_info ** * Confirm id16 value is correct. */ if (sets[i].freq > 0) { - error = est_set_id16(dev, sets[i].spec[0], 1); - if (error != 0 && strict) { + error = est_set_id16(dev, sets[i].spec[0], strict); + if (error != 0) { if (bootverbose) device_printf(dev, "Invalid freq %u, " "ignored.\n", sets[i].freq); continue; - } else if (error != 0 && bootverbose) { - device_printf(dev, "Can't check freq %u, " - "it may be invalid\n", - sets[i].freq); } table[j].freq = sets[i].freq; table[j].volts = sets[i].volts; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 07:21:28 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9833106566B; Thu, 2 Jun 2011 07:21:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCA608FC08; Thu, 2 Jun 2011 07:21:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p527LR0k005884; Thu, 2 Jun 2011 07:21:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p527LRi5005882; Thu, 2 Jun 2011 07:21:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020721.p527LRi5005882@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 07:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222594 - stable/8/sys/x86/cpufreq X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 07:21:28 -0000 Author: mav Date: Thu Jun 2 07:21:27 2011 New Revision: 222594 URL: http://svn.freebsd.org/changeset/base/222594 Log: MRC r212721: Few whitespace cleanups and comments tunings. Modified: stable/8/sys/x86/cpufreq/est.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/x86/cpufreq/est.c ============================================================================== --- stable/8/sys/x86/cpufreq/est.c Thu Jun 2 07:19:19 2011 (r222593) +++ stable/8/sys/x86/cpufreq/est.c Thu Jun 2 07:21:27 2011 (r222594) @@ -110,14 +110,16 @@ CTASSERT(EST_MAX_SETTINGS <= MAX_SETTING #define EST_TRANS_LAT 1000 /* - * Frequency (MHz) and voltage (mV) settings. Data from the - * Intel Pentium M Processor Datasheet (Order Number 252612), Table 5. + * Frequency (MHz) and voltage (mV) settings. * * Dothan processors have multiple VID#s with different settings for * each VID#. Since we can't uniquely identify this info * without undisclosed methods from Intel, we can't support newer * processors with this table method. If ACPI Px states are supported, * we get info from them. + * + * Data from the "Intel Pentium M Processor Datasheet", + * Order Number 252612-003, Table 5. */ static freq_info PM17_130[] = { /* 130nm 1.70GHz Pentium M */ @@ -217,7 +219,7 @@ static freq_info PM10_ULV_130[] = { /* * Data from "Intel Pentium M Processor on 90nm Process with - * 2-MB L2 Cache Datasheet", Order Number 302189, Table 5. + * 2-MB L2 Cache Datasheet", Order Number 302189-008, Table 5. */ static freq_info PM_765A_90[] = { /* 90 nm 2.10GHz Pentium M, VID #A */ @@ -988,7 +990,7 @@ est_probe(device_t dev) device_t perf_dev; uint64_t msr; int error, type; - + if (resource_disabled("est", 0)) return (ENXIO); @@ -1128,7 +1130,7 @@ est_acpi_info(device_t dev, freq_info ** if (sets[i].freq > 0) { error = est_set_id16(dev, sets[i].spec[0], strict); if (error != 0) { - if (bootverbose) + if (bootverbose) device_printf(dev, "Invalid freq %u, " "ignored.\n", sets[i].freq); continue; @@ -1224,7 +1226,7 @@ est_msr_info(device_t dev, uint64_t msr, device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus); if (!bus_speed_ok(bus)) return (EOPNOTSUPP); - + /* Calculate high frequency. */ id = msr >> 32; freq = ((id >> 8) & 0xff) * bus; @@ -1285,14 +1287,14 @@ est_set_id16(device_t dev, uint16_t id16 msr = rdmsr(MSR_PERF_CTL); msr = (msr & ~0xffff) | id16; wrmsr(MSR_PERF_CTL, msr); - + /* Wait a short while for the new setting. XXX Is this necessary? */ DELAY(EST_TRANS_LAT); - + if (need_check) { - est_get_id16(&new_id16); + est_get_id16(&new_id16); if (new_id16 != id16) { - if (bootverbose) + if (bootverbose) device_printf(dev, "Invalid id16 (set, cur) " "= (%u, %u)\n", id16, new_id16); ret = ENXIO; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 07:39:06 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27DBD1065670; Thu, 2 Jun 2011 07:39:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A9568FC15; Thu, 2 Jun 2011 07:39:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p527d5KN006512; Thu, 2 Jun 2011 07:39:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p527d5UH006504; Thu, 2 Jun 2011 07:39:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020739.p527d5UH006504@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 07:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222595 - in stable/8/sys/dev: ahci ata ata/chipsets ichsmb ichwd sound/pci/hda X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 07:39:06 -0000 Author: mav Date: Thu Jun 2 07:39:05 2011 New Revision: 222595 URL: http://svn.freebsd.org/changeset/base/222595 Log: MFC r221789, r221794 (by jfv): Chipset support for the new Intel Panther Point PCH, thanks to Seth Heasley for preparing the changes. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c stable/8/sys/dev/ichsmb/ichsmb_pci.c stable/8/sys/dev/ichwd/ichwd.c stable/8/sys/dev/ichwd/ichwd.h stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ahci/ahci.c Thu Jun 2 07:39:05 2011 (r222595) @@ -164,10 +164,18 @@ static struct { {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point", 0}, {0x1c058086, 0x00, "Intel Cougar Point", 0}, - {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, + {0x1e028086, 0x00, "Intel Panther Point", 0}, + {0x1e038086, 0x00, "Intel Panther Point", 0}, + {0x1e048086, 0x00, "Intel Panther Point", 0}, + {0x1e058086, 0x00, "Intel Panther Point", 0}, + {0x1e068086, 0x00, "Intel Panther Point", 0}, + {0x1e078086, 0x00, "Intel Panther Point", 0}, + {0x1e0e8086, 0x00, "Intel Panther Point", 0}, + {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ata/ata-pci.h Thu Jun 2 07:39:05 2011 (r222595) @@ -233,6 +233,19 @@ struct ata_pci_controller { #define ATA_PBG_R2 0x1d068086 #define ATA_PBG_S2 0x1d088086 +#define ATA_PPT_S1 0x1e008086 +#define ATA_PPT_S2 0x1e018086 +#define ATA_PPT_AH1 0x1e028086 +#define ATA_PPT_AH2 0x1e038086 +#define ATA_PPT_R1 0x1e048086 +#define ATA_PPT_R2 0x1e058086 +#define ATA_PPT_R3 0x1e068086 +#define ATA_PPT_R4 0x1e078086 +#define ATA_PPT_S3 0x1e088086 +#define ATA_PPT_S4 0x1e098086 +#define ATA_PPT_R5 0x1e0e8086 +#define ATA_PPT_R6 0x1e0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Thu Jun 2 07:39:05 2011 (r222595) @@ -181,6 +181,18 @@ ata_intel_probe(device_t dev) { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, + { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, Modified: stable/8/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/8/sys/dev/ichsmb/ichsmb_pci.c Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ichsmb/ichsmb_pci.c Thu Jun 2 07:39:05 2011 (r222595) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #define ID_DH89XXCC 0x23308086 #define ID_PATSBURG 0x1d228086 #define ID_CPT 0x1c228086 +#define ID_PPT 0x1e228086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -186,6 +187,9 @@ ichsmb_pci_probe(device_t dev) case ID_CPT: device_set_desc(dev, "Intel Cougar Point SMBus controller"); break; + case ID_PPT: + device_set_desc(dev, "Intel Panther Point SMBus controller"); + break; default: return (ENXIO); } Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ichwd/ichwd.c Thu Jun 2 07:39:05 2011 (r222595) @@ -111,9 +111,41 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, - { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10 }, + { DEVICEID_PPT0, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT1, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT2, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT3, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT4, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT5, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT6, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT7, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT8, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT9, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT10, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT11, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT12, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT13, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT14, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT15, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT16, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT17, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT18, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT19, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT20, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT21, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT22, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT23, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT24, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT25, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT26, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT27, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT28, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT29, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT30, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_PPT31, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, { 0, NULL, 0 }, }; Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/ichwd/ichwd.h Thu Jun 2 07:39:05 2011 (r222595) @@ -67,6 +67,38 @@ struct ichwd_softc { #define VENDORID_INTEL 0x8086 #define DEVICEID_PATSBURG_LPC1 0x1d40 #define DEVICEID_PATSBURG_LPC2 0x1d41 +#define DEVICEID_PPT0 0x1e40 +#define DEVICEID_PPT1 0x1e41 +#define DEVICEID_PPT2 0x1e42 +#define DEVICEID_PPT3 0x1e43 +#define DEVICEID_PPT4 0x1e44 +#define DEVICEID_PPT5 0x1e45 +#define DEVICEID_PPT6 0x1e46 +#define DEVICEID_PPT7 0x1e47 +#define DEVICEID_PPT8 0x1e48 +#define DEVICEID_PPT9 0x1e49 +#define DEVICEID_PPT10 0x1e4a +#define DEVICEID_PPT11 0x1e4b +#define DEVICEID_PPT12 0x1e4c +#define DEVICEID_PPT13 0x1e4d +#define DEVICEID_PPT14 0x1e4e +#define DEVICEID_PPT15 0x1e4f +#define DEVICEID_PPT16 0x1e50 +#define DEVICEID_PPT17 0x1e51 +#define DEVICEID_PPT18 0x1e52 +#define DEVICEID_PPT19 0x1e53 +#define DEVICEID_PPT20 0x1e54 +#define DEVICEID_PPT21 0x1e55 +#define DEVICEID_PPT22 0x1e56 +#define DEVICEID_PPT23 0x1e57 +#define DEVICEID_PPT24 0x1e58 +#define DEVICEID_PPT25 0x1e59 +#define DEVICEID_PPT26 0x1e5a +#define DEVICEID_PPT27 0x1e5b +#define DEVICEID_PPT28 0x1e5c +#define DEVICEID_PPT29 0x1e5d +#define DEVICEID_PPT30 0x1e5e +#define DEVICEID_PPT31 0x1e5f #define DEVICEID_DH89XXCC_LPC 0x2310 #define DEVICEID_82801AA 0x2410 #define DEVICEID_82801AB 0x2420 Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:21:27 2011 (r222594) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:39:05 2011 (r222595) @@ -141,6 +141,7 @@ SND_DECLARE_FILE("$FreeBSD$"); /* Intel */ #define INTEL_VENDORID 0x8086 #define HDA_INTEL_PATSBURG HDA_MODEL_CONSTRUCT(INTEL, 0x1d20) +#define HDA_INTEL_PPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x1e20) #define HDA_INTEL_82801F HDA_MODEL_CONSTRUCT(INTEL, 0x2668) #define HDA_INTEL_63XXESB HDA_MODEL_CONSTRUCT(INTEL, 0x269a) #define HDA_INTEL_82801G HDA_MODEL_CONSTRUCT(INTEL, 0x27d8) @@ -493,6 +494,7 @@ static const struct { char flags; } hdac_devices[] = { { HDA_INTEL_PATSBURG,"Intel Patsburg", 0 }, + { HDA_INTEL_PPT1, "Intel Panther Point", 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0 }, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 07:45:46 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A7EC1065670; Thu, 2 Jun 2011 07:45:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D28768FC12; Thu, 2 Jun 2011 07:45:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p527jjSw006814; Thu, 2 Jun 2011 07:45:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p527jjD0006812; Thu, 2 Jun 2011 07:45:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020745.p527jjD0006812@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 07:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222596 - stable/8/sys/dev/sound/pci/hda X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 07:45:46 -0000 Author: mav Date: Thu Jun 2 07:45:45 2011 New Revision: 222596 URL: http://svn.freebsd.org/changeset/base/222596 Log: MFC r208934: Add set of codec IDs. PR: kern/147466 Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:39:05 2011 (r222595) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:45:45 2011 (r222596) @@ -752,6 +752,7 @@ static const struct { #define HDA_CODEC_CX20561 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051) #define HDA_CODEC_CX20582 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5066) #define HDA_CODEC_CX20583 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5067) +#define HDA_CODEC_CX20585 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5069) #define HDA_CODEC_CXXXXX HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff) /* VIA */ @@ -814,6 +815,10 @@ static const struct { #define HDA_CODEC_NVIDIAMCP78 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0002) #define HDA_CODEC_NVIDIAMCP78_2 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0006) #define HDA_CODEC_NVIDIAMCP7A HDA_CODEC_CONSTRUCT(NVIDIA, 0x0007) +#define HDA_CODEC_NVIDIAGT220 HDA_CODEC_CONSTRUCT(NVIDIA, 0x000a) +#define HDA_CODEC_NVIDIAGT21X HDA_CODEC_CONSTRUCT(NVIDIA, 0x000b) +#define HDA_CODEC_NVIDIAMCP89 HDA_CODEC_CONSTRUCT(NVIDIA, 0x000c) +#define HDA_CODEC_NVIDIAGT240 HDA_CODEC_CONSTRUCT(NVIDIA, 0x000d) #define HDA_CODEC_NVIDIAMCP67 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0067) #define HDA_CODEC_NVIDIAMCP73 HDA_CODEC_CONSTRUCT(NVIDIA, 0x8001) #define HDA_CODEC_NVIDIAXXXX HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff) @@ -931,6 +936,7 @@ static const struct { { HDA_CODEC_CX20561, "Conexant CX20561 (Hermosa)" }, { HDA_CODEC_CX20582, "Conexant CX20582 (Pebble)" }, { HDA_CODEC_CX20583, "Conexant CX20583 (Pebble HSF)" }, + { HDA_CODEC_CX20585, "Conexant CX20585" }, { HDA_CODEC_VT1708_8, "VIA VT1708_8" }, { HDA_CODEC_VT1708_9, "VIA VT1708_9" }, { HDA_CODEC_VT1708_A, "VIA VT1708_A" }, @@ -986,6 +992,10 @@ static const struct { { HDA_CODEC_NVIDIAMCP78, "NVidia MCP78 HDMI" }, { HDA_CODEC_NVIDIAMCP78_2, "NVidia MCP78 HDMI" }, { HDA_CODEC_NVIDIAMCP7A, "NVidia MCP7A HDMI" }, + { HDA_CODEC_NVIDIAGT220, "NVidia GT220 HDMI" }, + { HDA_CODEC_NVIDIAGT21X, "NVidia GT21x HDMI" }, + { HDA_CODEC_NVIDIAMCP89, "NVidia MCP89 HDMI" }, + { HDA_CODEC_NVIDIAGT240, "NVidia GT240 HDMI" }, { HDA_CODEC_INTELG45_1, "Intel G45 HDMI" }, { HDA_CODEC_INTELG45_2, "Intel G45 HDMI" }, { HDA_CODEC_INTELG45_3, "Intel G45 HDMI" }, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 07:51:34 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C23E1065670; Thu, 2 Jun 2011 07:51:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 296EB8FC1C; Thu, 2 Jun 2011 07:51:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p527pY16007048; Thu, 2 Jun 2011 07:51:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p527pY4r007046; Thu, 2 Jun 2011 07:51:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020751.p527pY4r007046@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 07:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222597 - stable/8/sys/dev/sound/pci/hda X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 07:51:34 -0000 Author: mav Date: Thu Jun 2 07:51:33 2011 New Revision: 222597 URL: http://svn.freebsd.org/changeset/base/222597 Log: MFC r211910 (by jfv): Add Intel Cougar Point PCH HD Audio Controller ID Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:45:45 2011 (r222596) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:51:33 2011 (r222597) @@ -140,6 +140,7 @@ SND_DECLARE_FILE("$FreeBSD$"); /* Intel */ #define INTEL_VENDORID 0x8086 +#define HDA_INTEL_CPT HDA_MODEL_CONSTRUCT(INTEL, 0x1c20) #define HDA_INTEL_PATSBURG HDA_MODEL_CONSTRUCT(INTEL, 0x1d20) #define HDA_INTEL_PPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x1e20) #define HDA_INTEL_82801F HDA_MODEL_CONSTRUCT(INTEL, 0x2668) @@ -493,6 +494,7 @@ static const struct { char *desc; char flags; } hdac_devices[] = { + { HDA_INTEL_CPT, "Intel Cougar Point", 0 }, { HDA_INTEL_PATSBURG,"Intel Patsburg", 0 }, { HDA_INTEL_PPT1, "Intel Panther Point", 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0 }, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 08:39:11 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA99E1065675; Thu, 2 Jun 2011 08:39:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E38B8FC1F; Thu, 2 Jun 2011 08:39:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p528dBuP008512; Thu, 2 Jun 2011 08:39:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p528dBa9008510; Thu, 2 Jun 2011 08:39:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106020839.p528dBa9008510@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 08:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222598 - stable/8/sys/dev/sound/pci/hda X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 08:39:11 -0000 Author: mav Date: Thu Jun 2 08:39:10 2011 New Revision: 222598 URL: http://svn.freebsd.org/changeset/base/222598 Log: MFC r222298: Add better names for the Intel HDMI audio codecs. Modified: stable/8/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 07:51:33 2011 (r222597) +++ stable/8/sys/dev/sound/pci/hda/hdac.c Thu Jun 2 08:39:10 2011 (r222598) @@ -826,12 +826,13 @@ static const struct { #define HDA_CODEC_NVIDIAXXXX HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff) /* INTEL */ -#define HDA_CODEC_INTELG45_1 HDA_CODEC_CONSTRUCT(INTEL, 0x2801) -#define HDA_CODEC_INTELG45_2 HDA_CODEC_CONSTRUCT(INTEL, 0x2802) -#define HDA_CODEC_INTELG45_3 HDA_CODEC_CONSTRUCT(INTEL, 0x2803) -#define HDA_CODEC_INTELG45_4 HDA_CODEC_CONSTRUCT(INTEL, 0x2804) -#define HDA_CODEC_INTELG45_5 HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) -#define HDA_CODEC_INTELQ57 HDA_CODEC_CONSTRUCT(INTEL, 0x0054) +#define HDA_CODEC_INTELIP HDA_CODEC_CONSTRUCT(INTEL, 0x0054) +#define HDA_CODEC_INTELBL HDA_CODEC_CONSTRUCT(INTEL, 0x2801) +#define HDA_CODEC_INTELCA HDA_CODEC_CONSTRUCT(INTEL, 0x2802) +#define HDA_CODEC_INTELEL HDA_CODEC_CONSTRUCT(INTEL, 0x2803) +#define HDA_CODEC_INTELIP2 HDA_CODEC_CONSTRUCT(INTEL, 0x2804) +#define HDA_CODEC_INTELCPT HDA_CODEC_CONSTRUCT(INTEL, 0x2805) +#define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) /* Codecs */ @@ -998,12 +999,13 @@ static const struct { { HDA_CODEC_NVIDIAGT21X, "NVidia GT21x HDMI" }, { HDA_CODEC_NVIDIAMCP89, "NVidia MCP89 HDMI" }, { HDA_CODEC_NVIDIAGT240, "NVidia GT240 HDMI" }, - { HDA_CODEC_INTELG45_1, "Intel G45 HDMI" }, - { HDA_CODEC_INTELG45_2, "Intel G45 HDMI" }, - { HDA_CODEC_INTELG45_3, "Intel G45 HDMI" }, - { HDA_CODEC_INTELG45_4, "Intel G45 HDMI" }, - { HDA_CODEC_INTELG45_5, "Intel G45 HDMI" }, - { HDA_CODEC_INTELQ57, "Intel Q57 HDMI" }, + { HDA_CODEC_INTELIP, "Intel Ibex Peak HDMI" }, + { HDA_CODEC_INTELBL, "Intel Bearlake HDMI" }, + { HDA_CODEC_INTELCA, "Intel Cantiga HDMI" }, + { HDA_CODEC_INTELEL, "Intel Eaglelake HDMI" }, + { HDA_CODEC_INTELIP2, "Intel Ibex Peak HDMI" }, + { HDA_CODEC_INTELCPT, "Intel Cougar Point HDMI" }, + { HDA_CODEC_INTELCL, "Intel Crestline HDMI" }, { HDA_CODEC_SII1390, "Silicon Image SiI1390 HDMI" }, { HDA_CODEC_SII1392, "Silicon Image SiI1392 HDMI" }, /* Unknown codec */ From owner-svn-src-stable@FreeBSD.ORG Thu Jun 2 20:57:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2593A106566C; Thu, 2 Jun 2011 20:57:37 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE62F8FC20; Thu, 2 Jun 2011 20:57:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52KvabA033712; Thu, 2 Jun 2011 20:57:36 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52KvakG033709; Thu, 2 Jun 2011 20:57:36 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106022057.p52KvakG033709@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Jun 2011 20:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222629 - in stable/8/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 20:57:37 -0000 Author: rmacklem Date: Thu Jun 2 20:57:36 2011 New Revision: 222629 URL: http://svn.freebsd.org/changeset/base/222629 Log: MFC: r222075 Add a sanity check for the existence of an "addr" option to both NFS clients. This avoids the crash reported by Sergey Kandaurov (pluknet@gmail.com) to the freebsd-fs@ list with subject "[old nfsclient] different nmount() args passed from mount vs mount_nfs" dated May 17, 2011. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 2 20:56:42 2011 (r222628) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 2 20:57:36 2011 (r222629) @@ -1075,15 +1075,21 @@ nfs_mount(struct mount *mp) dirpath[0] = '\0'; dirlen = strlen(dirpath); - if (has_nfs_args_opt == 0 && vfs_getopt(mp->mnt_optnew, "addr", - (void **)&args.addr, &args.addrlen) == 0) { - if (args.addrlen > SOCK_MAXADDRLEN) { - error = ENAMETOOLONG; + if (has_nfs_args_opt == 0) { + if (vfs_getopt(mp->mnt_optnew, "addr", + (void **)&args.addr, &args.addrlen) == 0) { + if (args.addrlen > SOCK_MAXADDRLEN) { + error = ENAMETOOLONG; + goto out; + } + nam = malloc(args.addrlen, M_SONAME, M_WAITOK); + bcopy(args.addr, nam, args.addrlen); + nam->sa_len = args.addrlen; + } else { + vfs_mount_error(mp, "No server address"); + error = EINVAL; goto out; } - nam = malloc(args.addrlen, M_SONAME, M_WAITOK); - bcopy(args.addr, nam, args.addrlen); - nam->sa_len = args.addrlen; } args.fh = nfh; Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Thu Jun 2 20:56:42 2011 (r222628) +++ stable/8/sys/nfsclient/nfs_vfsops.c Thu Jun 2 20:57:36 2011 (r222629) @@ -1147,6 +1147,10 @@ nfs_mount(struct mount *mp) goto out; } } + } else if (has_addr_opt == 0) { + vfs_mount_error(mp, "No server address"); + error = EINVAL; + goto out; } error = mountnfs(&args, mp, nam, args.hostname, &vp, curthread->td_ucred, negnametimeo); From owner-svn-src-stable@FreeBSD.ORG Fri Jun 3 18:18:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06D8B106564A; Fri, 3 Jun 2011 18:18:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9FA48FC0A; Fri, 3 Jun 2011 18:18:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53IIsZh074933; Fri, 3 Jun 2011 18:18:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53IIseF074931; Fri, 3 Jun 2011 18:18:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106031818.p53IIseF074931@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Jun 2011 18:18:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222657 - stable/8/usr.bin/find X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 18:18:55 -0000 Author: jilles Date: Fri Jun 3 18:18:54 2011 New Revision: 222657 URL: http://svn.freebsd.org/changeset/base/222657 Log: MFC r222390: find: If a part of an expression is unknown, do not call it an option. Although most of the primaries and operators start with "-", they are not options. Examples: find . -xyz find . -name xyz -or bad Modified: stable/8/usr.bin/find/option.c Directory Properties: stable/8/usr.bin/find/ (props changed) Modified: stable/8/usr.bin/find/option.c ============================================================================== --- stable/8/usr.bin/find/option.c Fri Jun 3 17:49:16 2011 (r222656) +++ stable/8/usr.bin/find/option.c Fri Jun 3 18:18:54 2011 (r222657) @@ -176,7 +176,7 @@ find_create(char ***argvp) argv = *argvp; if ((p = lookup_option(*argv)) == NULL) - errx(1, "%s: unknown option", *argv); + errx(1, "%s: unknown primary or operator", *argv); ++argv; new = (p->create)(p, &argv); From owner-svn-src-stable@FreeBSD.ORG Sat Jun 4 11:28:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 050BF1065677; Sat, 4 Jun 2011 11:28:45 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF8228FC17; Sat, 4 Jun 2011 11:28:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54BSiIh008155; Sat, 4 Jun 2011 11:28:44 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54BSilk008153; Sat, 4 Jun 2011 11:28:44 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201106041128.p54BSilk008153@svn.freebsd.org> From: Benedict Reuschling Date: Sat, 4 Jun 2011 11:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222677 - stable/8/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 11:28:45 -0000 Author: bcr (doc committer) Date: Sat Jun 4 11:28:44 2011 New Revision: 222677 URL: http://svn.freebsd.org/changeset/base/222677 Log: MFC r222447: Mention that jumbo frame support is disabled on PCIe VT6130/VT6132 controllers because of TX MAC hangs when trying to send a frame that is larger than 4K (see r200759). PR: docs/156742 Submitted by: Michael Moll (kvedulv at kvedulv dot de) Reviewed by: yongari@ Modified: stable/8/share/man/man4/vge.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/vge.4 ============================================================================== --- stable/8/share/man/man4/vge.4 Sat Jun 4 11:28:42 2011 (r222676) +++ stable/8/share/man/man4/vge.4 Sat Jun 4 11:28:44 2011 (r222677) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd May 29, 2011 .Dt VGE 4 .Os .Sh NAME @@ -66,13 +66,14 @@ The MAC supports TCP/IP hardware checksums (IPv4 only), TCP large send, VLAN tag insertion and stripping, as well as VLAN filtering, a 64-entry CAM filter and a 64-entry VLAN filter, 64-bit multicast hash filter, 4 separate transmit DMA queues, flow control -and jumbo frames up to 16K in size. +and jumbo frames (not on VT6130/VT6132) up to 16K in size. The Velocity family controllers have a 16K receive FIFO and 48K transmit FIFO. .Pp The .Nm driver takes advantage of the controller's checksum offload and VLAN -tagging features, as well as the jumbo frame and CAM filter support. +tagging features, as well as the jumbo frame (except VT6130/VT6132) and CAM +filter support. The CAM filter is used for multicast address filtering to provide 64 perfect multicast address filter support. If it is necessary for the interface to join more than 64 multicast @@ -81,6 +82,8 @@ groups, the driver will switch over to u The jumbo frame support can be enabled by setting the interface MTU to any value larger than the default of 1500 bytes, up to a maximum of 9000 bytes. +Jumbo frames are disabled on the VT6130/VT6132 controllers because the TX +MAC will hang when trying to send a frame that is larger than 4K. The receive and transmit checksum offload support can be toggled on and off using the .Xr ifconfig 8 From owner-svn-src-stable@FreeBSD.ORG Sat Jun 4 11:30:13 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A15A106564A; Sat, 4 Jun 2011 11:30:13 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 201DF8FC13; Sat, 4 Jun 2011 11:30:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54BUDK2008251; Sat, 4 Jun 2011 11:30:13 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54BUDFv008249; Sat, 4 Jun 2011 11:30:13 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201106041130.p54BUDFv008249@svn.freebsd.org> From: Benedict Reuschling Date: Sat, 4 Jun 2011 11:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222678 - stable/7/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 11:30:13 -0000 Author: bcr (doc committer) Date: Sat Jun 4 11:30:12 2011 New Revision: 222678 URL: http://svn.freebsd.org/changeset/base/222678 Log: MFC r222447: Mention that jumbo frame support is disabled on PCIe VT6130/VT6132 controllers because of TX MAC hangs when trying to send a frame that is larger than 4K (see r200759). PR: docs/156742 Submitted by: Michael Moll (kvedulv at kvedulv dot de) Reviewed by: yongari@ Modified: stable/7/share/man/man4/vge.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/vge.4 ============================================================================== --- stable/7/share/man/man4/vge.4 Sat Jun 4 11:28:44 2011 (r222677) +++ stable/7/share/man/man4/vge.4 Sat Jun 4 11:30:12 2011 (r222678) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd May 29, 2011 .Dt VGE 4 .Os .Sh NAME @@ -66,13 +66,14 @@ The MAC supports TCP/IP hardware checksums (IPv4 only), TCP large send, VLAN tag insertion and stripping, as well as VLAN filtering, a 64-entry CAM filter and a 64-entry VLAN filter, 64-bit multicast hash filter, 4 separate transmit DMA queues, flow control -and jumbo frames up to 16K in size. +and jumbo frames (not on VT6130/VT6132) up to 16K in size. The Velocity family controllers have a 16K receive FIFO and 48K transmit FIFO. .Pp The .Nm driver takes advantage of the controller's checksum offload and VLAN -tagging features, as well as the jumbo frame and CAM filter support. +tagging features, as well as the jumbo frame (except VT6130/VT6132) and CAM +filter support. The CAM filter is used for multicast address filtering to provide 64 perfect multicast address filter support. If it is necessary for the interface to join more than 64 multicast @@ -81,6 +82,8 @@ groups, the driver will switch over to u The jumbo frame support can be enabled by setting the interface MTU to any value larger than the default of 1500 bytes, up to a maximum of 9000 bytes. +Jumbo frames are disabled on the VT6130/VT6132 controllers because the TX +MAC will hang when trying to send a frame that is larger than 4K. The receive and transmit checksum offload support can be toggled on and off using the .Xr ifconfig 8 From owner-svn-src-stable@FreeBSD.ORG Sat Jun 4 22:51:06 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C2A1106566C; Sat, 4 Jun 2011 22:51:06 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8878FC18; Sat, 4 Jun 2011 22:51:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54Mp6u2029511; Sat, 4 Jun 2011 22:51:06 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54Mp64Y029509; Sat, 4 Jun 2011 22:51:06 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201106042251.p54Mp64Y029509@svn.freebsd.org> From: Attilio Rao Date: Sat, 4 Jun 2011 22:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222700 - stable/8/sys/i386/xen X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 22:51:06 -0000 Author: attilio Date: Sat Jun 4 22:51:06 2011 New Revision: 222700 URL: http://svn.freebsd.org/changeset/base/222700 Log: MFC r222065: Sync XEN support with i386 about the usage of ipi_send_cpu() Modified: stable/8/sys/i386/xen/mp_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/i386/xen/mp_machdep.c ============================================================================== --- stable/8/sys/i386/xen/mp_machdep.c Sat Jun 4 22:19:00 2011 (r222699) +++ stable/8/sys/i386/xen/mp_machdep.c Sat Jun 4 22:51:06 2011 (r222700) @@ -961,6 +961,30 @@ start_ap(int apic_id) } /* + * send an IPI to a specific CPU. + */ +static void +ipi_send_cpu(int cpu, u_int ipi) +{ + u_int bitmap, old_pending, new_pending; + + if (IPI_IS_BITMAPED(ipi)) { + bitmap = 1 << ipi; + ipi = IPI_BITMAP_VECTOR; + do { + old_pending = cpu_ipi_pending[cpu]; + new_pending = old_pending | bitmap; + } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], + old_pending, new_pending)); + if (!old_pending) + ipi_pcpu(cpu, RESCHEDULE_VECTOR); + } else { + KASSERT(call_data != NULL, ("call_data not set")); + ipi_pcpu(cpu, CALL_FUNCTION_VECTOR); + } +} + +/* * Flush the TLB on all other CPU's */ static void @@ -1102,14 +1126,6 @@ void ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1119,23 +1135,11 @@ ipi_selected(cpumask_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) atomic_set_int(&ipi_nmi_pending, cpus); - CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); while ((cpu = ffs(cpus)) != 0) { cpu--; cpus &= ~(1 << cpu); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (!old_pending) - ipi_pcpu(cpu, RESCHEDULE_VECTOR); - } else { - KASSERT(call_data != NULL, ("call_data not set")); - ipi_pcpu(cpu, CALL_FUNCTION_VECTOR); - } + CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); + ipi_send_cpu(cpu, ipi); } } @@ -1145,14 +1149,6 @@ ipi_selected(cpumask_t cpus, u_int ipi) void ipi_cpu(int cpu, u_int ipi) { - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1163,19 +1159,7 @@ ipi_cpu(int cpu, u_int ipi) atomic_set_int(&ipi_nmi_pending, 1 << cpu); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (!old_pending) - ipi_pcpu(cpu, RESCHEDULE_VECTOR); - } else { - KASSERT(call_data != NULL, ("call_data not set")); - ipi_pcpu(cpu, CALL_FUNCTION_VECTOR); - } + ipi_send_cpu(cpu, ipi); } /*