CVS commit: src
Module Name:src Committed By: jruoho Date: Sun Apr 10 08:07:42 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/include: Makefile Added Files: src/tests/include: t_types.c Log Message: Add tests for PR standards/44847 and PR standards/18067. To generate a diff of this commit: cvs rdiff -u -r1.303 -r1.304 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.2 -r1.3 src/tests/include/Makefile cvs rdiff -u -r0 -r1.1 src/tests/include/t_types.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.303 src/distrib/sets/lists/tests/mi:1.304 --- src/distrib/sets/lists/tests/mi:1.303 Sun Apr 10 06:27:20 2011 +++ src/distrib/sets/lists/tests/mi Sun Apr 10 08:07:41 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.303 2011/04/10 06:27:20 jruoho Exp $ +# $NetBSD: mi,v 1.304 2011/04/10 08:07:41 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -288,6 +288,7 @@ ./usr/libdata/debug/usr/tests/include/t_limits.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_paths.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_stdint.debug tests-ipf-tests debug,atf +./usr/libdata/debug/usr/tests/include/t_types.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/ipf tests-ipf-tests ./usr/libdata/debug/usr/tests/kernel tests-kernel-tests ./usr/libdata/debug/usr/tests/kernel/h_ps_strings1.debug tests-kernel-tests debug,atf @@ -1371,6 +1372,7 @@ ./usr/tests/include/t_limits tests-include-tests atf ./usr/tests/include/t_paths tests-include-tests atf ./usr/tests/include/t_stdint tests-include-tests atf +./usr/tests/include/t_types tests-include-tests atf ./usr/tests/ipf tests-ipf-tests ./usr/tests/ipf/Atffiletests-ipf-tests ./usr/tests/ipf/expected tests-ipf-tests Index: src/tests/include/Makefile diff -u src/tests/include/Makefile:1.2 src/tests/include/Makefile:1.3 --- src/tests/include/Makefile:1.2 Wed Mar 30 09:43:22 2011 +++ src/tests/include/Makefile Sun Apr 10 08:07:41 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2011/03/30 09:43:22 jruoho Exp $ +# $NetBSD: Makefile,v 1.3 2011/04/10 08:07:41 jruoho Exp $ NOMAN= # defined @@ -12,6 +12,7 @@ TESTS_C+= t_limits TESTS_C+= t_paths TESTS_C+= t_stdint +TESTS_C+= t_types FILESDIR= ${TESTSDIR} FILES= d_bitstring_27.out Added files: Index: src/tests/include/t_types.c diff -u /dev/null src/tests/include/t_types.c:1.1 --- /dev/null Sun Apr 10 08:07:42 2011 +++ src/tests/include/t_types.c Sun Apr 10 08:07:41 2011 @@ -0,0 +1,149 @@ +/* $NetBSD: t_types.c,v 1.1 2011/04/10 08:07:41 jruoho Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_types.c,v 1.1 2011/04/10 08:07:41 jruoho Exp $"); + +#include + +#include +#include +#include + +#include + +ATF_TC(types_limits); +ATF_TC_HEAD(types_limits, tc) +{ + atf_tc_set_md_var(tc, "descr", "Known limits for types(3)"); +} + +ATF_TC_BODY(types_limits, tc) +{ + useconds_t usec; + ssize_t size; + + /* + * IEEE Std 1003.1-2008: + * + * "The type ssize_t shall be capable of storing + * values at least in the range [-1, {SSIZE_MAX}]." + * + */ + size = SSIZE_MAX; + ATF_REQUIRE(size > 0); + + size = size + 1; + ATF_REQUIRE(size < 0); + + /* + * IEEE Std 1003.1-2008: + * + * The type suseconds_t sha
CVS commit: src/tests/include
Module Name:src Committed By: jruoho Date: Sun Apr 10 08:11:34 UTC 2011 Modified Files: src/tests/include: t_types.c Log Message: Fix comments. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/include/t_types.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/include/t_types.c diff -u src/tests/include/t_types.c:1.1 src/tests/include/t_types.c:1.2 --- src/tests/include/t_types.c:1.1 Sun Apr 10 08:07:41 2011 +++ src/tests/include/t_types.c Sun Apr 10 08:11:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_types.c,v 1.1 2011/04/10 08:07:41 jruoho Exp $ */ +/* $NetBSD: t_types.c,v 1.2 2011/04/10 08:11:34 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_types.c,v 1.1 2011/04/10 08:07:41 jruoho Exp $"); +__RCSID("$NetBSD: t_types.c,v 1.2 2011/04/10 08:11:34 jruoho Exp $"); #include @@ -66,8 +66,8 @@ /* * IEEE Std 1003.1-2008: * - * The type suseconds_t shall be a signed integer type capable - * of storing values at least in the range [-1, 100]. + * "The type suseconds_t shall be a signed integer type capable + * of storing values at least in the range [-1, 100]." */ usec = 100; ATF_REQUIRE(usec > 0); @@ -131,7 +131,7 @@ ATF_REQUIRE((size - 1) > 0); /* - * Test also rlim_; PR standards/18067. + * Test also rlim_t; PR standards/18067. */ lim = 0;
CVS commit: src
Module Name:src Committed By: plunky Date: Sun Apr 10 08:29:32 UTC 2011 Modified Files: src: UPDATING Log Message: Building the Xorg binary was moved into a subdirectory to fix ordering issues with "make all". It may be necessary to remove the OBJDIR for external/mit/xorg/server/xorg-server/hw/xfree86 if your update build fails, as the "Xorg" entry there is now a directory. To generate a diff of this commit: cvs rdiff -u -r1.221 -r1.222 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/UPDATING diff -u src/UPDATING:1.221 src/UPDATING:1.222 --- src/UPDATING:1.221 Sun Jan 23 23:40:37 2011 +++ src/UPDATING Sun Apr 10 08:29:31 2011 @@ -1,4 +1,4 @@ -$NetBSD: UPDATING,v 1.221 2011/01/23 23:40:37 lukem Exp $ +$NetBSD: UPDATING,v 1.222 2011/04/10 08:29:31 plunky Exp $ This file (UPDATING) is intended to be a brief reference to recent changes that might cause problems in the build process, and a guide for @@ -15,6 +15,13 @@ Recent changes: ^^^ +20110328: + Building the Xorg binary was moved into a subdirectory to fix + ordering issues with "make all". It may be necessary to remove + the OBJDIR for external/mit/xorg/server/xorg-server/hw/xfree86 + if your update build fails, as the "Xorg" entry there is now a + directory. + 20110121: Assembler files no longer use -traditional-cpp. This can break the build of individual parts of the tree. This is handled
CVS commit: src
Module Name:src Committed By: jruoho Date: Sun Apr 10 08:35:48 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/include: Makefile Added Files: src/tests/include: t_glob.c Log Message: Verify that PR standards/21401 is no longer an issue. To generate a diff of this commit: cvs rdiff -u -r1.304 -r1.305 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.3 -r1.4 src/tests/include/Makefile cvs rdiff -u -r0 -r1.1 src/tests/include/t_glob.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.304 src/distrib/sets/lists/tests/mi:1.305 --- src/distrib/sets/lists/tests/mi:1.304 Sun Apr 10 08:07:41 2011 +++ src/distrib/sets/lists/tests/mi Sun Apr 10 08:35:47 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.304 2011/04/10 08:07:41 jruoho Exp $ +# $NetBSD: mi,v 1.305 2011/04/10 08:35:47 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -284,6 +284,7 @@ ./usr/libdata/debug/usr/tests/include/sys/t_bitops.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/sys/t_bootblock.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_bitstring.debug tests-ipf-tests debug,atf +./usr/libdata/debug/usr/tests/include/t_glob.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_inttypes.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_limits.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_paths.debug tests-ipf-tests debug,atf @@ -1368,6 +1369,7 @@ ./usr/tests/include/sys/t_bitops tests-include-tests atf ./usr/tests/include/sys/t_bootblock tests-include-tests atf ./usr/tests/include/t_bitstring tests-include-tests atf +./usr/tests/include/t_glob tests-include-tests atf ./usr/tests/include/t_inttypes tests-include-tests atf ./usr/tests/include/t_limits tests-include-tests atf ./usr/tests/include/t_paths tests-include-tests atf Index: src/tests/include/Makefile diff -u src/tests/include/Makefile:1.3 src/tests/include/Makefile:1.4 --- src/tests/include/Makefile:1.3 Sun Apr 10 08:07:41 2011 +++ src/tests/include/Makefile Sun Apr 10 08:35:48 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2011/04/10 08:07:41 jruoho Exp $ +# $NetBSD: Makefile,v 1.4 2011/04/10 08:35:48 jruoho Exp $ NOMAN= # defined @@ -8,6 +8,7 @@ TESTS_SUBDIRS= sys TESTS_C= t_bitstring +TESTS_C+= t_glob TESTS_C+= t_inttypes TESTS_C+= t_limits TESTS_C+= t_paths Added files: Index: src/tests/include/t_glob.c diff -u /dev/null src/tests/include/t_glob.c:1.1 --- /dev/null Sun Apr 10 08:35:48 2011 +++ src/tests/include/t_glob.c Sun Apr 10 08:35:48 2011 @@ -0,0 +1,75 @@ +/* $NetBSD: t_glob.c,v 1.1 2011/04/10 08:35:48 jruoho Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_glob.c,v 1.1 2011/04/10 08:35:48 jruoho Exp $"); + +#include +#include +#include + +ATF_TC(glob_types); +ATF_TC_HEAD(glob_types, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test glob(3) types"); +} + +ATF_TC_BODY(glob_types, tc) +{ + glob_t g; + + /* + * IEEE Std 1003.1-2008: + * + * "The header shall define the glob_t structure type, + * which shall include at least the following members: + * + *size_t gl_pathc Count of paths matched by pattern. + *char **gl_pathv Pointer to a list of matched pathname
CVS commit: src/etc/mtree
Module Name:src Committed By: blymn Date: Sun Apr 10 09:45:59 UTC 2011 Modified Files: src/etc/mtree: NetBSD.dist.tests Log Message: Add libcurses to tests. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/etc/mtree/NetBSD.dist.tests Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.36 src/etc/mtree/NetBSD.dist.tests:1.37 --- src/etc/mtree/NetBSD.dist.tests:1.36 Sat Apr 9 17:45:24 2011 +++ src/etc/mtree/NetBSD.dist.tests Sun Apr 10 09:45:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.36 2011/04/09 17:45:24 pgoyette Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.37 2011/04/10 09:45:59 blymn Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -184,6 +184,9 @@ ./usr/tests/lib/libc/tls ./usr/tests/lib/libc/ttyio ./usr/tests/lib/libc/time +./usr/tests/lib/libcurses +./usr/tests/lib/libcurses/check_files +./usr/tests/lib/libcurses/tests ./usr/tests/lib/libdes ./usr/tests/lib/semaphore ./usr/tests/lib/semaphore/pthread
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: blymn Date: Sun Apr 10 09:47:43 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi Log Message: Add libcurses tests To generate a diff of this commit: cvs rdiff -u -r1.305 -r1.306 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.305 src/distrib/sets/lists/tests/mi:1.306 --- src/distrib/sets/lists/tests/mi:1.305 Sun Apr 10 08:35:47 2011 +++ src/distrib/sets/lists/tests/mi Sun Apr 10 09:47:43 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.305 2011/04/10 08:35:47 jruoho Exp $ +# $NetBSD: mi,v 1.306 2011/04/10 09:47:43 blymn Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1944,6 +1944,105 @@ ./usr/tests/lib/libc/t_servent tests-obsolete obsolete ./usr/tests/lib/libc/t_strptime tests-obsolete obsolete ./usr/tests/lib/libc/time tests-lib-tests +./usr/tests/lib/libcurses tests-lib-tests +./usr/tests/lib/libcurses/.terminfo.db tests-lib-tests atf +./usr/tests/lib/libcurses/Atffile tests-lib-tests atf +./usr/tests/lib/libcurses/check_files tests-lib-tests +./usr/tests/lib/libcurses/check_files/addch.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/addchstr.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/addstr.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/attributes.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/background1.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/background2.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/background3.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/background4.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/background5.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/bell.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/box_standout.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/chgat1.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/chgat2.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/chgat3.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear1.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear10.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear2.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear3.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear4.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear5.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear6.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear7.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear8.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/clear9.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_blank_draw.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_blue_back.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_default.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_red_fore.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_set.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/color_start.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin1.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin10.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin11.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin12.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin13.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin14.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin2.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin3.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin4.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin5.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin6.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin7.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin8.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/copywin9.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/curs_set1.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/curs_set2.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/curs_set3.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/curses_start.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/fill.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/home.chk tests-lib-tests atf +./usr/tests/lib/libcurses/check_files/timeout.c
CVS commit: src/tests/lib
Module Name:src Committed By: blymn Date: Sun Apr 10 09:49:13 UTC 2011 Modified Files: src/tests/lib: Makefile Log Message: Add libcurses test To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/Makefile diff -u src/tests/lib/Makefile:1.13 src/tests/lib/Makefile:1.14 --- src/tests/lib/Makefile:1.13 Thu Apr 7 06:24:07 2011 +++ src/tests/lib/Makefile Sun Apr 10 09:49:13 2011 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.13 2011/04/07 06:24:07 plunky Exp $ +# $NetBSD: Makefile,v 1.14 2011/04/10 09:49:13 blymn Exp $ .include -TESTS_SUBDIRS= csu libbluetooth libc libevent libm \ +TESTS_SUBDIRS= csu libbluetooth libc libcurses libevent libm \ libobjc libposix libprop libpthread \ librt librumpclient librumphijack libutil semaphore
CVS commit: src
Module Name:src Committed By: jruoho Date: Sun Apr 10 09:58:01 UTC 2011 Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man3: Makefile Added Files: src/share/man/man3: unistd.3 Log Message: Add a small summary page for . To generate a diff of this commit: cvs rdiff -u -r1.1612 -r1.1613 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.73 -r1.74 src/share/man/man3/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man3/unistd.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1612 src/distrib/sets/lists/comp/mi:1.1613 --- src/distrib/sets/lists/comp/mi:1.1612 Fri Apr 8 08:36:33 2011 +++ src/distrib/sets/lists/comp/mi Sun Apr 10 09:58:00 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1612 2011/04/08 08:36:33 jruoho Exp $ +# $NetBSD: mi,v 1.1613 2011/04/10 09:58:00 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -8644,6 +8644,7 @@ ./usr/share/man/cat3/ungetc.0 comp-c-catman .cat ./usr/share/man/cat3/ungetch.0 comp-c-catman .cat ./usr/share/man/cat3/ungetwc.0 comp-c-catman .cat +./usr/share/man/cat3/unistd.0 comp-c-catman .cat ./usr/share/man/cat3/unlockpt.0 comp-c-catman .cat ./usr/share/man/cat3/unpost_form.0 comp-c-catman .cat ./usr/share/man/cat3/unsetenv.0 comp-c-catman .cat @@ -14650,6 +14651,7 @@ ./usr/share/man/html3/ungetc.html comp-c-htmlman html ./usr/share/man/html3/ungetch.html comp-c-htmlman html ./usr/share/man/html3/ungetwc.html comp-c-htmlman html +./usr/share/man/html3/unistd.html comp-c-htmlman html ./usr/share/man/html3/unlockpt.html comp-c-htmlman html ./usr/share/man/html3/unpost_form.html comp-c-htmlman html ./usr/share/man/html3/unsetenv.html comp-c-htmlman html @@ -20724,6 +20726,7 @@ ./usr/share/man/man3/ungetc.3 comp-c-man .man ./usr/share/man/man3/ungetch.3 comp-c-man .man ./usr/share/man/man3/ungetwc.3 comp-c-man .man +./usr/share/man/man3/unistd.3 comp-c-man .man ./usr/share/man/man3/unlockpt.3 comp-c-man .man ./usr/share/man/man3/unpost_form.3 comp-c-man .man ./usr/share/man/man3/unsetenv.3 comp-c-man .man Index: src/share/man/man3/Makefile diff -u src/share/man/man3/Makefile:1.73 src/share/man/man3/Makefile:1.74 --- src/share/man/man3/Makefile:1.73 Fri Apr 8 08:36:34 2011 +++ src/share/man/man3/Makefile Sun Apr 10 09:58:01 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.73 2011/04/08 08:36:34 jruoho Exp $ +# $NetBSD: Makefile,v 1.74 2011/04/10 09:58:01 jruoho Exp $ # @(#)Makefile 8.2 (Berkeley) 12/13/93 MAN= _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \ @@ -12,7 +12,8 @@ ilog2.3 intro.3 inttypes.3 iso646.3 \ makedev.3 offsetof.3 param.3 paths.3 queue.3 rbtree.3 sigevent.3 \ stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \ - tgmath.3 timeradd.3 timeval.3 tree.3 typeof.3 types.3 varargs.3 + tgmath.3 timeradd.3 timeval.3 tree.3 typeof.3 types.3 \ + unistd.3 varargs.3 USETBL= # used by queue.3 Added files: Index: src/share/man/man3/unistd.3 diff -u /dev/null src/share/man/man3/unistd.3:1.1 --- /dev/null Sun Apr 10 09:58:01 2011 +++ src/share/man/man3/unistd.3 Sun Apr 10 09:58:01 2011 @@ -0,0 +1,107 @@ +.\" $NetBSD: unistd.3,v 1.1 2011/04/10 09:58:01 jruoho Exp $ +.\" +.\" Copyright (c) 2011 Jukka Ruohonen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" +.Dd April 10, 2011 +.Dt UNISTD 3 +.Os +.Sh NAME +.Nm unistd +.Nd standard symbolic constants and types +.Sh SYNOPSIS +.In unistd.h +.Sh DESCRIPTION +The +.In unistd.h +heade
CVS commit: src/share/man/man3
Module Name:src Committed By: wiz Date: Sun Apr 10 10:01:07 UTC 2011 Modified Files: src/share/man/man3: unistd.3 Log Message: Fix some xrefs. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/share/man/man3/unistd.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man3/unistd.3 diff -u src/share/man/man3/unistd.3:1.1 src/share/man/man3/unistd.3:1.2 --- src/share/man/man3/unistd.3:1.1 Sun Apr 10 09:58:01 2011 +++ src/share/man/man3/unistd.3 Sun Apr 10 10:01:06 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: unistd.3,v 1.1 2011/04/10 09:58:01 jruoho Exp $ +.\" $NetBSD: unistd.3,v 1.2 2011/04/10 10:01:06 wiz Exp $ .\" .\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. @@ -56,11 +56,11 @@ Various limits and other symbolic constants described in .Xr pathconf 2 and -.Xr sysconf 2 . +.Xr sysconf 3 . .It Prototypes for several important system calls such as -.Xr alarm 2 , -.Xr execl 2 , +.Xr alarm 3 , +.Xr execl 3 , .Xr fork 2 , .Xr link 2 , .Xr pipe 2 ,
CVS commit: src/share/man/man3
Module Name:src Committed By: jruoho Date: Sun Apr 10 10:02:34 UTC 2011 Modified Files: src/share/man/man3: param.3 stddef.3 stdint.3 stdlib.3 types.3 Log Message: Xref unistd(3). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/share/man/man3/param.3 cvs rdiff -u -r1.7 -r1.8 src/share/man/man3/stddef.3 cvs rdiff -u -r1.4 -r1.5 src/share/man/man3/stdint.3 cvs rdiff -u -r1.2 -r1.3 src/share/man/man3/stdlib.3 cvs rdiff -u -r1.5 -r1.6 src/share/man/man3/types.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man3/param.3 diff -u src/share/man/man3/param.3:1.3 src/share/man/man3/param.3:1.4 --- src/share/man/man3/param.3:1.3 Fri Apr 8 08:40:05 2011 +++ src/share/man/man3/param.3 Sun Apr 10 10:02:34 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: param.3,v 1.3 2011/04/08 08:40:05 jruoho Exp $ +.\" $NetBSD: param.3,v 1.4 2011/04/10 10:02:34 jruoho Exp $ .\" .\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 8, 2011 +.Dd April 10, 2011 .Dt PARAM 3 .Os .Sh NAME @@ -92,7 +92,8 @@ .Sh SEE ALSO .Xr bitops 3 , .Xr cdefs 3 , -.Xr types 3 +.Xr types 3 , +.Xr unistd 3 .Sh HISTORY A .In param.h Index: src/share/man/man3/stddef.3 diff -u src/share/man/man3/stddef.3:1.7 src/share/man/man3/stddef.3:1.8 --- src/share/man/man3/stddef.3:1.7 Fri May 14 02:45:39 2010 +++ src/share/man/man3/stddef.3 Sun Apr 10 10:02:34 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: stddef.3,v 1.7 2010/05/14 02:45:39 joerg Exp $ +.\" $NetBSD: stddef.3,v 1.8 2011/04/10 10:02:34 jruoho Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 21, 2010 +.Dd April 10, 2011 .Dt STDDEF 3 .Os .Sh NAME @@ -67,7 +67,8 @@ Some of the described types and macros may appear also in other headers. .Sh SEE ALSO .Xr offsetof 3 , -.Xr stdlib 3 +.Xr stdlib 3 , +.Xr unistd 3 .Sh STANDARDS As described here, the .In stddef.h Index: src/share/man/man3/stdint.3 diff -u src/share/man/man3/stdint.3:1.4 src/share/man/man3/stdint.3:1.5 --- src/share/man/man3/stdint.3:1.4 Sun Mar 21 19:42:51 2010 +++ src/share/man/man3/stdint.3 Sun Apr 10 10:02:34 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: stdint.3,v 1.4 2010/03/21 19:42:51 jruoho Exp $ +.\" $NetBSD: stdint.3,v 1.5 2011/04/10 10:02:34 jruoho Exp $ .\" .\" Copyright (c) 2002 Mike Barcroft .\" All rights reserved. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/share/man/man7/stdint.7,v 1.5 2003/09/08 19:57:21 ru Exp $ .\" -.Dd March 20, 2010 +.Dd April 10, 2011 .Dt STDINT 3 .Os .Sh NAME @@ -122,7 +122,8 @@ .Vt void . .Sh SEE ALSO .Xr inttypes 3 , -.Xr stdbool 3 +.Xr stdbool 3 , +.Xr unistd 3 .Sh STANDARDS The .In stdint.h Index: src/share/man/man3/stdlib.3 diff -u src/share/man/man3/stdlib.3:1.2 src/share/man/man3/stdlib.3:1.3 --- src/share/man/man3/stdlib.3:1.2 Fri May 14 02:45:39 2010 +++ src/share/man/man3/stdlib.3 Sun Apr 10 10:02:34 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: stdlib.3,v 1.2 2010/05/14 02:45:39 joerg Exp $ +.\" $NetBSD: stdlib.3,v 1.3 2011/04/10 10:02:34 jruoho Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 25, 2010 +.Dd April 10, 2011 .Dt STDLIB 3 .Os .Sh NAME @@ -93,7 +93,9 @@ and .Xr strtol 3 . .Sh SEE ALSO -.Xr stddef 3 +.Xr stddef 3 , +.Xr types 3 , +.Xr unistd 3 .Sh STANDARDS As described here, the .In stdlib.h Index: src/share/man/man3/types.3 diff -u src/share/man/man3/types.3:1.5 src/share/man/man3/types.3:1.6 --- src/share/man/man3/types.3:1.5 Fri Apr 8 07:55:04 2011 +++ src/share/man/man3/types.3 Sun Apr 10 10:02:34 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: types.3,v 1.5 2011/04/08 07:55:04 jruoho Exp $ +.\" $NetBSD: types.3,v 1.6 2011/04/10 10:02:34 jruoho Exp $ .\" .\" Copyright (c) 2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -56,7 +56,7 @@ .\" .\" @(#)types.5 8.1 (Berkeley) 6/5/93 .\" -.Dd April 8, 2011 +.Dd April 10, 2011 .Dt TYPES 3 .Os .Sh NAME @@ -207,7 +207,8 @@ .Xr stdbool 3 , .Xr stddef 3 , .Xr stdint 3 , -.Xr stdlib 3 +.Xr stdlib 3 , +.Xr unistd 3 .Sh STANDARDS The .In sys/types.h
CVS commit: src/tests/lib/libc/stdlib
Module Name:src Committed By: jruoho Date: Sun Apr 10 10:23:45 UTC 2011 Modified Files: src/tests/lib/libc/stdlib: t_strtod.c Log Message: Currently known failures affect only amd64; adjust atf_tc_expect_fail(). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/stdlib/t_strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdlib/t_strtod.c diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.4 src/tests/lib/libc/stdlib/t_strtod.c:1.5 --- src/tests/lib/libc/stdlib/t_strtod.c:1.4 Fri Apr 8 06:37:51 2011 +++ src/tests/lib/libc/stdlib/t_strtod.c Sun Apr 10 10:23:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_strtod.c,v 1.4 2011/04/08 06:37:51 jruoho Exp $ */ +/* $NetBSD: t_strtod.c,v 1.5 2011/04/10 10:23:45 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -32,15 +32,17 @@ /* Public domain, Otto Moerbeek , 2006. */ #include -__RCSID("$NetBSD: t_strtod.c,v 1.4 2011/04/08 06:37:51 jruoho Exp $"); +__RCSID("$NetBSD: t_strtod.c,v 1.5 2011/04/10 10:23:45 jruoho Exp $"); -#include #include #include #include #include #include +#include +#include + ATF_TC(strtod_basic); ATF_TC_HEAD(strtod_basic, tc) { @@ -102,17 +104,20 @@ ATF_TC_BODY(strtod_inf, tc) { +#ifndef __vax__ + + const char *m_arch; long double ld; double d; float f; - d = 0.0; - f = 0.0; - ld = 0.0; + m_arch = atf_config_get("atf_arch"); -#ifndef __vax__ + if (strcmp(m_arch, "x86_64") == 0) + atf_tc_expect_fail("PR lib/33262"); - atf_tc_expect_fail("PR lib/33262"); + if (system("cpuctl identify 0 | grep -q QEMU") == 0) + atf_tc_expect_fail("PR lib/33262"); d = strtod("INF", NULL); ATF_REQUIRE(isinf(d) != 0);
CVS commit: src
Module Name:src Committed By: jruoho Date: Sun Apr 10 10:49:44 UTC 2011 Modified Files: src/distrib/sets/lists/tests: mi src/tests/include: Makefile Added Files: src/tests/include: t_netdb.c Log Message: Formally verify PR standards/44777. To generate a diff of this commit: cvs rdiff -u -r1.306 -r1.307 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.4 -r1.5 src/tests/include/Makefile cvs rdiff -u -r0 -r1.1 src/tests/include/t_netdb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.306 src/distrib/sets/lists/tests/mi:1.307 --- src/distrib/sets/lists/tests/mi:1.306 Sun Apr 10 09:47:43 2011 +++ src/distrib/sets/lists/tests/mi Sun Apr 10 10:49:43 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.306 2011/04/10 09:47:43 blymn Exp $ +# $NetBSD: mi,v 1.307 2011/04/10 10:49:43 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -287,6 +287,7 @@ ./usr/libdata/debug/usr/tests/include/t_glob.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_inttypes.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_limits.debug tests-ipf-tests debug,atf +./usr/libdata/debug/usr/tests/include/t_netdb.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_paths.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_stdint.debug tests-ipf-tests debug,atf ./usr/libdata/debug/usr/tests/include/t_types.debug tests-ipf-tests debug,atf @@ -1372,6 +1373,7 @@ ./usr/tests/include/t_glob tests-include-tests atf ./usr/tests/include/t_inttypes tests-include-tests atf ./usr/tests/include/t_limits tests-include-tests atf +./usr/tests/include/t_netdb tests-include-tests atf ./usr/tests/include/t_paths tests-include-tests atf ./usr/tests/include/t_stdint tests-include-tests atf ./usr/tests/include/t_types tests-include-tests atf Index: src/tests/include/Makefile diff -u src/tests/include/Makefile:1.4 src/tests/include/Makefile:1.5 --- src/tests/include/Makefile:1.4 Sun Apr 10 08:35:48 2011 +++ src/tests/include/Makefile Sun Apr 10 10:49:44 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2011/04/10 08:35:48 jruoho Exp $ +# $NetBSD: Makefile,v 1.5 2011/04/10 10:49:44 jruoho Exp $ NOMAN= # defined @@ -11,6 +11,7 @@ TESTS_C+= t_glob TESTS_C+= t_inttypes TESTS_C+= t_limits +TESTS_C+= t_netdb TESTS_C+= t_paths TESTS_C+= t_stdint TESTS_C+= t_types Added files: Index: src/tests/include/t_netdb.c diff -u /dev/null src/tests/include/t_netdb.c:1.1 --- /dev/null Sun Apr 10 10:49:44 2011 +++ src/tests/include/t_netdb.c Sun Apr 10 10:49:44 2011 @@ -0,0 +1,244 @@ +/* $NetBSD: t_netdb.c,v 1.1 2011/04/10 10:49:44 jruoho Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_netdb.c,v 1.1 2011/04/10 10:49:44 jruoho Exp $"); + +#include +#include + +ATF_TC(netdb_constants); +ATF_TC_HEAD(netdb_constants, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test constants in "); +} + +ATF_TC_BODY(netdb_constants, tc) +{ + bool fail; + + /* + * The following definitions should be available + * according to IEEE Std 1003.1-2008, issue 7. + */ + atf_tc_expect_fail("PR standards/44777"); + + fail = true; + +#ifdef AI_PASSIVE + fail = false; +#endif + if (fail != false) + atf_tc_fail("AI_PASSIVE not defined"); + + fail = true; + +
CVS commit: src/sys/dev/nand
Module Name:src Committed By: ahoka Date: Sun Apr 10 10:56:37 UTC 2011 Modified Files: src/sys/dev/nand: nandemulator.c Log Message: Add some KASSERTs and a few more debug printf To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nand/nandemulator.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/nand/nandemulator.c diff -u src/sys/dev/nand/nandemulator.c:1.2 src/sys/dev/nand/nandemulator.c:1.3 --- src/sys/dev/nand/nandemulator.c:1.2 Sun Mar 27 13:33:04 2011 +++ src/sys/dev/nand/nandemulator.c Sun Apr 10 10:56:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nandemulator.c,v 1.2 2011/03/27 13:33:04 ahoka Exp $ */ +/* $NetBSD: nandemulator.c,v 1.3 2011/04/10 10:56:37 ahoka Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nandemulator.c,v 1.2 2011/03/27 13:33:04 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nandemulator.c,v 1.3 2011/04/10 10:56:37 ahoka Exp $"); #include #include @@ -306,6 +306,8 @@ { struct nandemulator_softc *sc = device_private(self); + DPRINTF(("device reset\n")); + sc->sc_command = 0; sc->sc_register_writable = false; sc->sc_io_len = 0; @@ -321,6 +323,9 @@ { struct nandemulator_softc *sc = device_private(self); size_t page, offset; + + KASSERT(sc->sc_address_counter == + sc->sc_column_cycles + sc->sc_row_cycles); if (sc->sc_address_counter != sc->sc_column_cycles + sc->sc_row_cycles) { @@ -337,6 +342,8 @@ (uintmax_t )page, (uintmax_t )offset)); + KASSERT(offset < sc->sc_device_size); + if (offset >= sc->sc_device_size) { aprint_error_dev(self, "address > device size!\n"); sc->sc_io_len = 0; @@ -400,6 +407,8 @@ KASSERT(offset % (sc->sc_block_size * sc->sc_page_size) == 0); + KASSERT(offset < sc->sc_device_size); + if (offset >= sc->sc_device_size) { aprint_error_dev(self, "address > device size!\n"); } else { @@ -423,6 +432,7 @@ default: aprint_error_dev(self, "invalid nand command (0x%hhx)\n", command); + KASSERT(false); sc->sc_io_len = 0; } }; @@ -432,6 +442,8 @@ { struct nandemulator_softc *sc = device_private(self); + DPRINTF(("nandemulator_address: %hhx\n", address)); + /** * we have to handle read id/parameter page here, * as we can read right after giving the address. @@ -497,6 +509,8 @@ { struct nandemulator_softc *sc = device_private(self); + KASSERT(sc->sc_io_len > 0); + if (sc->sc_io_len > 0) { *data = *sc->sc_io_pointer; @@ -513,12 +527,16 @@ { struct nandemulator_softc *sc = device_private(self); + KASSERT(sc->sc_register_writable); + if (!sc->sc_register_writable) { aprint_error_dev(self, "trying to write read only location without effect\n"); return; } + KASSERT(sc->sc_io_len > 0); + if (sc->sc_io_len > 0) { *sc->sc_io_pointer = data; @@ -534,12 +552,16 @@ { struct nandemulator_softc *sc = device_private(self); + KASSERT(sc->sc_buswidth == NANDEMULATOR_16BIT); + if (sc->sc_buswidth != NANDEMULATOR_16BIT) { aprint_error_dev(self, "trying to read a word on an 8bit chip\n"); return; } + KASSERT(sc->sc_io_len > 1); + if (sc->sc_io_len > 1) { *data = *(uint16_t *)sc->sc_io_pointer; @@ -556,18 +578,24 @@ { struct nandemulator_softc *sc = device_private(self); + KASSERT(sc->sc_register_writable); + if (!sc->sc_register_writable) { aprint_error_dev(self, "trying to write read only location without effect\n"); return; } + KASSERT(sc->sc_buswidth == NANDEMULATOR_16BIT); + if (sc->sc_buswidth != NANDEMULATOR_16BIT) { aprint_error_dev(self, "trying to write a word to an 8bit chip"); return; } + KASSERT(sc->sc_io_len > 1); + if (sc->sc_io_len > 1) { *(uint16_t *)sc->sc_io_pointer = data;
CVS commit: src/tests/lib/libc/gen
Module Name:src Committed By: jruoho Date: Sun Apr 10 10:59:13 UTC 2011 Modified Files: src/tests/lib/libc/gen: t_nice.c Log Message: "wrong return value" -> "wrong errno". To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/t_nice.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/gen/t_nice.c diff -u src/tests/lib/libc/gen/t_nice.c:1.3 src/tests/lib/libc/gen/t_nice.c:1.4 --- src/tests/lib/libc/gen/t_nice.c:1.3 Wed Apr 6 08:47:55 2011 +++ src/tests/lib/libc/gen/t_nice.c Sun Apr 10 10:59:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_nice.c,v 1.3 2011/04/06 08:47:55 jruoho Exp $ */ +/* $NetBSD: t_nice.c,v 1.4 2011/04/10 10:59:13 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_nice.c,v 1.3 2011/04/06 08:47:55 jruoho Exp $"); +__RCSID("$NetBSD: t_nice.c,v 1.4 2011/04/10 10:59:13 jruoho Exp $"); #include #include @@ -66,7 +66,7 @@ ATF_REQUIRE(nice(i) == -1); if (errno != EPERM) - atf_tc_fail("wrong return value"); + atf_tc_fail("wrong errno"); } }
CVS commit: src/tests/net/if_loop
Module Name:src Committed By: martin Date: Sun Apr 10 11:31:48 UTC 2011 Modified Files: src/tests/net/if_loop: t_pr.c Log Message: Repeat the fragmentation on lo0 test, but with checksum on IFF_LOOPBACK interfaces enabled. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_loop/t_pr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_loop/t_pr.c diff -u src/tests/net/if_loop/t_pr.c:1.4 src/tests/net/if_loop/t_pr.c:1.5 --- src/tests/net/if_loop/t_pr.c:1.4 Sat Apr 9 20:42:12 2011 +++ src/tests/net/if_loop/t_pr.c Sun Apr 10 11:31:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.4 2011/04/09 20:42:12 martin Exp $ */ +/* $NetBSD: t_pr.c,v 1.5 2011/04/10 11:31:48 martin Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,11 +29,12 @@ #include #ifndef lint -__RCSID("$NetBSD: t_pr.c,v 1.4 2011/04/09 20:42:12 martin Exp $"); +__RCSID("$NetBSD: t_pr.c,v 1.5 2011/04/10 11:31:48 martin Exp $"); #endif /* not lint */ #include #include +#include #include #include @@ -51,15 +52,11 @@ #include "../config/netconfig.c" #include "../../h_macros.h" -ATF_TC(loopmtu); -ATF_TC_HEAD(loopmtu, tc) -{ - - atf_tc_set_md_var(tc, "descr", "test lo0 fragmentation"); - /* PR kern/43664 */ -} - -ATF_TC_BODY(loopmtu, tc) +/* + * Prepare rump server, configure interface and route to cause fragmentation + */ +static void +setup(void) { char ifname[IFNAMSIZ]; struct { @@ -68,11 +65,12 @@ } m_rtmsg; #define rtm m_rtmsg.m_rtm #define rsin m_rtmsg.m_sin - struct sockaddr_in sin; struct ifreq ifr; - char data[2000]; int s; + static bool init_done = false; + if (init_done) return; + strcpy(ifname, "lo0"); rump_init(); @@ -113,6 +111,106 @@ atf_tc_fail_errno("set route mtu"); rump_sys_close(s); + init_done = true; +} + +/* + * Turn on checksums on loopback interfaces + */ +static int +enable_locsums(void) +{ + struct sysctlnode q, ans[256]; + int mib[5], enable; + size_t alen; + unsigned i; + + mib[0] = CTL_NET; + mib[1] = PF_INET; + mib[2] = IPPROTO_IP; + mib[3] = CTL_QUERY; + alen = sizeof(ans); + + memset(&q, 0, sizeof(q)); + q.sysctl_flags = SYSCTL_VERSION; + + if (rump_sys___sysctl(mib, 4, ans, &alen, &q, sizeof(q)) == -1) + return -1; + + for (i = 0; i < __arraycount(ans); i++) + if (strcmp("do_loopback_cksum", ans[i].sysctl_name) == 0) + break; + if (i == __arraycount(ans)) { + errno = ENOENT; + return -1; + } + + mib[3] = ans[i].sysctl_num; + + enable = 1; + if (rump_sys___sysctl(mib, 4, NULL, NULL, &enable, + sizeof(enable)) == -1) + return errno; + + return 0; +} + +ATF_TC(loopmtu); +ATF_TC_HEAD(loopmtu, tc) +{ + + atf_tc_set_md_var(tc, "descr", "test lo0 fragmentation"); + /* PR kern/43664 */ +} + +ATF_TC_BODY(loopmtu, tc) +{ + struct sockaddr_in sin; + char data[2000]; + int s; + + setup(); + + /* open raw socket */ + s = rump_sys_socket(PF_INET, SOCK_RAW, 0); + if (s == -1) + atf_tc_fail_errno("raw socket"); + + /* then, send data */ + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_port = htons(12345); + sin.sin_addr.s_addr = inet_addr("127.0.0.1"); + + /* + * Should not fail anymore, PR has been fixed... + * + * atf_tc_expect_signal(SIGABRT, "PR kern/43664"); + */ + if (rump_sys_sendto(s, data, sizeof(data), 0, + (struct sockaddr *)&sin, sizeof(sin)) == -1) + atf_tc_fail_errno("sendto failed"); +} + +ATF_TC(loopmtu_csum); +ATF_TC_HEAD(loopmtu_csum, tc) +{ + + atf_tc_set_md_var(tc, "descr", "test lo0 fragmentation with checksums"); + /* PR kern/43664 */ +} + +ATF_TC_BODY(loopmtu_csum, tc) +{ + struct sockaddr_in sin; + char data[2000]; + int s; + + setup(); + + ATF_CHECK(enable_locsums() == 0); + /* open raw socket */ s = rump_sys_socket(PF_INET, SOCK_RAW, 0); if (s == -1) @@ -139,6 +237,8 @@ { ATF_TP_ADD_TC(tp, loopmtu); + ATF_TP_ADD_TC(tp, loopmtu_csum); return atf_no_error(); } +
CVS commit: src/sys/dev/nand
Module Name:src Committed By: ahoka Date: Sun Apr 10 12:48:10 UTC 2011 Modified Files: src/sys/dev/nand: nand.c nand.h Log Message: Fix locking and simplify some error path. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/nand/nand.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/nand/nand.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/nand/nand.c diff -u src/sys/dev/nand/nand.c:1.7 src/sys/dev/nand/nand.c:1.8 --- src/sys/dev/nand/nand.c:1.7 Mon Apr 4 14:25:10 2011 +++ src/sys/dev/nand/nand.c Sun Apr 10 12:48:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nand.c,v 1.7 2011/04/04 14:25:10 ahoka Exp $ */ +/* $NetBSD: nand.c,v 1.8 2011/04/10 12:48:09 ahoka Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -34,7 +34,7 @@ /* Common driver for NAND chips implementing the ONFI 2.2 specification */ #include -__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.7 2011/04/04 14:25:10 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.8 2011/04/10 12:48:09 ahoka Exp $"); #include "locators.h" @@ -1050,7 +1050,7 @@ const uint8_t *bufp; flash_off_t addr; size_t left, count; - int error, i; + int error = 0, i; first = offset & chip->nc_page_mask; firstoff = offset & ~chip->nc_page_mask; @@ -1061,26 +1061,30 @@ addr = first; *retlen = 0; + mutex_enter(&sc->sc_device_lock); if (count == 1) { if (nand_isbad(self, addr)) { aprint_error_dev(self, "nand_flash_write_unaligned: " "bad block encountered\n"); - return EIO; + error = EIO; + goto out; } error = nand_read_page(self, addr, chip->nc_page_cache); - if (error) - return error; + if (error) { + goto out; + } memcpy(chip->nc_page_cache + firstoff, buf, len); error = nand_program_page(self, addr, chip->nc_page_cache); - if (error) - return error; + if (error) { + goto out; + } *retlen = len; - return 0; + goto out; } bufp = buf; @@ -1091,14 +1095,16 @@ aprint_error_dev(self, "nand_flash_write_unaligned: " "bad block encountered\n"); - return EIO; + error = EIO; + goto out; } if (i == 0) { error = nand_read_page(self, addr, chip->nc_page_cache); - if (error) -return error; + if (error) { +goto out; + } memcpy(chip->nc_page_cache + firstoff, bufp, chip->nc_page_size - firstoff); @@ -1106,8 +1112,9 @@ printf("program page: %s: %d\n", __FILE__, __LINE__); error = nand_program_page(self, addr, chip->nc_page_cache); - if (error) -return error; + if (error) { +goto out; + } bufp += chip->nc_page_size - firstoff; left -= chip->nc_page_size - firstoff; @@ -1116,15 +1123,17 @@ } else if (i == count - 1) { error = nand_read_page(self, addr, chip->nc_page_cache); - if (error) -return error; + if (error) { +goto out; + } memcpy(chip->nc_page_cache, bufp, left); error = nand_program_page(self, addr, chip->nc_page_cache); - if (error) -return error; + if (error) { +goto out; + } *retlen += left; KASSERT(left < chip->nc_page_size); @@ -1138,8 +1147,9 @@ KASSERT(left > chip->nc_page_size); error = nand_program_page(self, addr, bufp); - if (error) -return error; + if (error) { +goto out; + } bufp += chip->nc_page_size; left -= chip->nc_page_size; @@ -1150,8 +1160,10 @@ } KASSERT(*retlen == len); +out: + mutex_exit(&sc->sc_device_lock); - return 0; + return error; } int @@ -1198,8 +1210,9 @@ } error = nand_program_page(self, addr, bufp); - if (error) + if (error) { goto out; + } addr += chip->nc_page_size; bufp += chip->nc_page_size; @@ -1240,8 +1253,9 @@ mutex_enter(&sc->sc_device_lock); if (count == 1) { error = nand_read_page(self, addr, chip->nc_page_cache); - if (error) + if (error) { goto out; + } memcpy(bufp, chip->nc_page_cache + firstoff, len); @@ -1251,8 +1265,9 @@ for (i = 0; i < count && left != 0; i++) { error = nand_read_page(self, addr, chip->nc_page_cache); - if (error) + if (error) { goto out; + } if (i == 0) { memcpy(bufp, chip->nc_page_cache + firstoff, @@ -1415,7 +1430,7 @@ struct nand_softc *sc = device_private(self); struct nand_chip *chip = &sc->sc_chip; flash_off_t addr; - int error; + int error = 0; if (ei->ei_addr < 0 || ei->ei_len < chip->nc_block_size) return EINVAL; @@ -1448,17 +1463,18 @@ addr = ei->ei_addr; while (addr < ei->ei_addr + ei->ei_len) { if (nand_isbad(self, addr)) { - mutex_exit(&sc->sc_device_lock); aprint_error_dev(self, "bad block encountered\n"); ei->ei_state = FLASH_ERASE_FAILED; - return EIO; + + error = EIO; + goto out; } error = nand_erase_block(self, addr); if (error) { - mutex_exit(&sc->sc_device_lock); ei->ei_state = FLASH_ERASE_FAILED;
CVS commit: src/lib/libc/arch/x86_64/gen
Module Name:src Committed By: christos Date: Sun Apr 10 13:51:18 UTC 2011 Modified Files: src/lib/libc/arch/x86_64/gen: infinityl.c Log Message: make infinityl match what gdtoa thinks. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/x86_64/gen/infinityl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/x86_64/gen/infinityl.c diff -u src/lib/libc/arch/x86_64/gen/infinityl.c:1.2 src/lib/libc/arch/x86_64/gen/infinityl.c:1.3 --- src/lib/libc/arch/x86_64/gen/infinityl.c:1.2 Sun Jun 12 01:21:27 2005 +++ src/lib/libc/arch/x86_64/gen/infinityl.c Sun Apr 10 09:51:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:27 lukem Exp $ */ +/* $NetBSD: infinityl.c,v 1.3 2011/04/10 13:51:18 christos Exp $ */ /* * IEEE-compatible infinityl.c for little-endian 80-bit format -- public domain. @@ -7,10 +7,10 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:27 lukem Exp $"); +__RCSID("$NetBSD: infinityl.c,v 1.3 2011/04/10 13:51:18 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include const union __long_double_u __infinityl = - { { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0, 0, 0, 0, 0 } }; + { { 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x7f, 0, 0, 0, 0, 0, 0 } };
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Sun Apr 10 14:37:20 UTC 2011 Modified Files: src/sys/sys: siginfo.h Log Message: revert previous. breaks things in subtle ways (ntpdate gets stuck on boot, shell processes get stuck on ^C) To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/siginfo.h diff -u src/sys/sys/siginfo.h:1.21 src/sys/sys/siginfo.h:1.22 --- src/sys/sys/siginfo.h:1.21 Sat Apr 9 20:04:37 2011 +++ src/sys/sys/siginfo.h Sun Apr 10 10:37:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.21 2011/04/10 00:04:37 christos Exp $ */ +/* $NetBSD: siginfo.h,v 1.22 2011/04/10 14:37:20 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -60,12 +60,6 @@ struct { pid_t _pid; uid_t _uid; - lwpid_t _lid; - } _lwp; - - struct { - pid_t _pid; - uid_t _uid; int _status; clock_t _utime; clock_t _stime; @@ -88,6 +82,7 @@ u_long ksi_flags; /* 4 or 8 bytes (LP64) */ CIRCLEQ_ENTRY(ksiginfo) ksi_list; struct _ksiginfo ksi_info; + lwpid_t ksi_lid; /* 0, or directed to LWP */ } ksiginfo_t; #define KSI_TRAP 0x01 /* signal caused by trap */ @@ -145,9 +140,6 @@ #define si_value _info._reason._rt._value #define si_pid _info._reason._child._pid #define si_uid _info._reason._child._uid -#if defined(_NETBSD_SOURCE) -#define si_lid _info._reason._lwp._lid -#endif #define si_status _info._reason._child._status #define si_utime _info._reason._child._utime #define si_stime _info._reason._child._stime @@ -165,15 +157,12 @@ #define ksi_errno ksi_info._errno #define ksi_value ksi_info._reason._rt._value - #define ksi_pid ksi_info._reason._child._pid #define ksi_uid ksi_info._reason._child._uid #define ksi_status ksi_info._reason._child._status #define ksi_utime ksi_info._reason._child._utime #define ksi_stime ksi_info._reason._child._stime -#define ksi_lid ksi_info._reason._lwp._lid /* 0, or directed to LWP */ - #define ksi_addr ksi_info._reason._fault._addr #define ksi_trap ksi_info._reason._fault._trap
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: christos Date: Sun Apr 10 14:38:19 UTC 2011 Modified Files: src/usr.bin/kdump: kdump.c Log Message: we don't have access to si_lid anymore. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/usr.bin/kdump/kdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/kdump.c diff -u src/usr.bin/kdump/kdump.c:1.107 src/usr.bin/kdump/kdump.c:1.108 --- src/usr.bin/kdump/kdump.c:1.107 Sat Apr 9 20:05:51 2011 +++ src/usr.bin/kdump/kdump.c Sun Apr 10 10:38:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $ */ +/* $NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $"); +__RCSID("$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $"); #endif #endif /* not lint */ @@ -950,9 +950,8 @@ si->si_value.sival_ptr); return; case SI_LWP: -printf(": code=SI_LWP sent by pid=%d, uid=%d " -"with target lid=%d)\n", si->si_pid, -si->si_uid, si->si_lid); +printf(": code=SI_LWP sent by pid=%d, " +"uid=%d")\n", si->si_pid, si->si_uid); return; default: code = NULL;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: jakllsch Date: Sun Apr 10 15:02:01 UTC 2011 Modified Files: src/sys/dev/pci: viaide.c Log Message: Fix regression introduced in 1.72. (Attach arguments need to be copied before using the copy.) To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/viaide.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/viaide.c diff -u src/sys/dev/pci/viaide.c:1.72 src/sys/dev/pci/viaide.c:1.73 --- src/sys/dev/pci/viaide.c:1.72 Mon Apr 4 20:37:56 2011 +++ src/sys/dev/pci/viaide.c Sun Apr 10 15:02:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: viaide.c,v 1.72 2011/04/04 20:37:56 dyoung Exp $ */ +/* $NetBSD: viaide.c,v 1.73 2011/04/10 15:02:01 jakllsch Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.72 2011/04/04 20:37:56 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.73 2011/04/10 15:02:01 jakllsch Exp $"); #include #include @@ -914,11 +914,14 @@ struct pciide_channel *cp; struct ata_channel *wdc_cp; struct wdc_regs *wdr; - struct pci_attach_args pacopy, *pa = &pacopy; - pcireg_t interface = PCI_INTERFACE(pa->pa_class); + struct pci_attach_args pacopy, *pa; + pcireg_t interface; int channel; pacopy = *pa0; + pa = &pacopy; + interface = PCI_INTERFACE(pa->pa_class); + if (via_sata_chip_map_common(sc, pa) == 0) return; @@ -986,14 +989,17 @@ struct pciide_channel *cp; struct ata_channel *wdc_cp; struct wdc_regs *wdr; - struct pci_attach_args pacopy, *pa = &pacopy; - pcireg_t interface = PCI_INTERFACE(pa->pa_class); + struct pci_attach_args pacopy, *pa; + pcireg_t interface; int channel; pci_intr_handle_t intrhandle; const char *intrstr; int i; pacopy = *pa0; + pa = &pacopy; + interface = PCI_INTERFACE(pa->pa_class); + if (via_sata_chip_map_common(sc, pa) == 0) return;
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Sun Apr 10 15:23:06 UTC 2011 Modified Files: src/sys/arch/x68k/dev: fd.c Log Message: Fix hangup on the first floppy access since 2008. Problem was reported by isaki@. On X680x0 (and most other machines other than ISA FDC), the ready line from FDD is connected to FDC and fdc driver can be notified of the ready state after fd_set_motor() by interrupts. In this case no need to use callout(9) to wait the FDD motor stabilized, and the callout(9) method used in ISA fdc(4) driver rather caused infinite unhandled interrupts since callout(9) was no longer invoked during interrupt storm after vmlocking2 merge, I guess. Should be pulled up to netbsd-5. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x68k/dev/fd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/dev/fd.c diff -u src/sys/arch/x68k/dev/fd.c:1.93 src/sys/arch/x68k/dev/fd.c:1.94 --- src/sys/arch/x68k/dev/fd.c:1.93 Sun Jun 6 04:52:01 2010 +++ src/sys/arch/x68k/dev/fd.c Sun Apr 10 15:23:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.93 2010/06/06 04:52:01 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.94 2011/04/10 15:23:06 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.93 2010/06/06 04:52:01 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.94 2011/04/10 15:23:06 tsutsui Exp $"); #include "rnd.h" #include "opt_ddb.h" @@ -212,7 +212,9 @@ struct fd_type *sc_deftype; /* default type descriptor */ struct fd_type *sc_type; /* current type descriptor */ +#if 0 /* see comments in fd_motor_on() */ struct callout sc_motoron_ch; +#endif struct callout sc_motoroff_ch; daddr_t sc_blkno; /* starting block number */ @@ -278,7 +280,9 @@ void fd_set_motor(struct fdc_softc *, int); void fd_motor_off(void *); +#if 0 void fd_motor_on(void *); +#endif int fdcresult(struct fdc_softc *); int out_fdc(bus_space_tag_t, bus_space_handle_t, u_char); void fdcstart(struct fdc_softc *); @@ -564,7 +568,9 @@ struct fd_type *type = &fd_types[0]; /* XXX 1.2MB */ int drive = fa->fa_drive; +#if 0 callout_init(&fd->sc_motoron_ch, 0); +#endif callout_init(&fd->sc_motoroff_ch, 0); fd->sc_dev = self; @@ -788,6 +794,7 @@ splx(s); } +#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */ void fd_motor_on(void *arg) { @@ -803,6 +810,7 @@ (void) fdcintr(fdc); splx(s); } +#endif int fdcresult(struct fdc_softc *fdc) @@ -1082,9 +1090,11 @@ fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT; fd_set_motor(fdc, 0); fdc->sc_state = MOTORWAIT; +#if 0 /* no need to callout on x68k; motor on will trigger interrupts */ /* allow .5s for motor to stabilize */ callout_reset(&fd->sc_motoron_ch, hz / 2, fd_motor_on, fd); +#endif return 1; } /* Make sure the right drive is selected. */ @@ -1437,8 +1447,22 @@ goto doseek; case MOTORWAIT: +#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */ if (fd->sc_flags & FD_MOTOR_WAIT) return 1; /* time's not up yet */ +#else + /* check drive ready by state change interrupt */ + KASSERT(fd->sc_flags & FD_MOTOR_WAIT); + out_fdc(iot, ioh, NE7CMD_SENSEI); + tmp = fdcresult(fdc); + if (tmp != 2 || (st0 & 0xc0) != 0xc0 /* ready changed */) { + printf("%s: unexpected interrupt during MOTORWAIT", + device_xname(fd->sc_dev)); + fdcpstatus(7, fdc); + return 1; + } + fd->sc_flags &= ~FD_MOTOR_WAIT; +#endif goto doseek; default:
CVS commit: src/doc
Module Name:src Committed By: jdc Date: Sun Apr 10 15:26:38 UTC 2011 Modified Files: src/doc: CHANGES Log Message: Mention ffb(4) EDID support. To generate a diff of this commit: cvs rdiff -u -r1.1537 -r1.1538 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1537 src/doc/CHANGES:1.1538 --- src/doc/CHANGES:1.1537 Wed Apr 6 09:11:08 2011 +++ src/doc/CHANGES Sun Apr 10 15:26:37 2011 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1537 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1538 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -987,3 +987,4 @@ [phx 20110404] sandpoint: QNAP support. [phx 20110405] dhcpcd(8): Import dhcpcd-5.2.12. [roy 20110406] + sparc64: Add EDID support to ffb(4). [jdc 20110408]
CVS commit: src/sys
Module Name:src Committed By: christos Date: Sun Apr 10 15:45:34 UTC 2011 Modified Files: src/sys/kern: kern_descrip.c sys_descrip.c sys_generic.c sys_pipe.c uipc_syscalls.c vfs_syscalls.c src/sys/sys: fcntl.h filedesc.h Log Message: - Add O_CLOEXEC to open(2) - Add fd_set_exclose() to encapsulate uses of FIO{,N}CLEX, O_CLOEXEC, F{G,S}ETFD - Add a pipe1() function to allow passing flags to the fd's that pipe(2) opens to ease implementation of linux pipe2(2) - Factor out fp handling code from open(2) and fhopen(2) To generate a diff of this commit: cvs rdiff -u -r1.211 -r1.212 src/sys/kern/kern_descrip.c cvs rdiff -u -r1.19 -r1.20 src/sys/kern/sys_descrip.c cvs rdiff -u -r1.125 -r1.126 src/sys/kern/sys_generic.c cvs rdiff -u -r1.129 -r1.130 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.141 -r1.142 src/sys/kern/uipc_syscalls.c cvs rdiff -u -r1.421 -r1.422 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.36 -r1.37 src/sys/sys/fcntl.h cvs rdiff -u -r1.58 -r1.59 src/sys/sys/filedesc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_descrip.c diff -u src/sys/kern/kern_descrip.c:1.211 src/sys/kern/kern_descrip.c:1.212 --- src/sys/kern/kern_descrip.c:1.211 Tue Feb 15 10:54:28 2011 +++ src/sys/kern/kern_descrip.c Sun Apr 10 11:45:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.211 2011/02/15 15:54:28 pooka Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.212 2011/04/10 15:45:33 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.211 2011/02/15 15:54:28 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.212 2011/04/10 15:45:33 christos Exp $"); #include #include @@ -1776,6 +1776,16 @@ return error; } +void +fd_set_exclose(struct lwp *l, int fd, bool exclose) +{ + filedesc_t *fdp = l->l_fd; + fdfile_t *ff = fdp->fd_dt->dt_ff[fd]; + ff->ff_exclose = exclose; + if (exclose) + fdp->fd_exclose = true; +} + /* * Return descriptor owner information. If the value is positive, * it's process ID. If it's negative, it's process group ID and Index: src/sys/kern/sys_descrip.c diff -u src/sys/kern/sys_descrip.c:1.19 src/sys/kern/sys_descrip.c:1.20 --- src/sys/kern/sys_descrip.c:1.19 Fri Dec 17 20:18:48 2010 +++ src/sys/kern/sys_descrip.c Sun Apr 10 11:45:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_descrip.c,v 1.19 2010/12/18 01:18:48 rmind Exp $ */ +/* $NetBSD: sys_descrip.c,v 1.20 2011/04/10 15:45:33 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.19 2010/12/18 01:18:48 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.20 2011/04/10 15:45:33 christos Exp $"); #include #include @@ -315,7 +315,6 @@ int fd, i, tmp, error, cmd, newmin; filedesc_t *fdp; file_t *fp; - fdfile_t *ff; struct flock fl; fd = SCARG(uap, fd); @@ -358,7 +357,6 @@ if ((fp = fd_getfile(fd)) == NULL) return (EBADF); - ff = fdp->fd_dt->dt_ff[fd]; if ((cmd & F_FSCTL)) { error = fcntl_forfs(fd, fp, cmd, SCARG(uap, arg)); @@ -380,16 +378,12 @@ break; case F_GETFD: - *retval = ff->ff_exclose; + *retval = fdp->fd_dt->dt_ff[fd]->ff_exclose; break; case F_SETFD: - if ((long)SCARG(uap, arg) & FD_CLOEXEC) { - ff->ff_exclose = true; - fdp->fd_exclose = true; - } else { - ff->ff_exclose = false; - } + fd_set_exclose(l, fd, + ((long)SCARG(uap, arg) & FD_CLOEXEC) != 0); break; case F_GETFL: Index: src/sys/kern/sys_generic.c diff -u src/sys/kern/sys_generic.c:1.125 src/sys/kern/sys_generic.c:1.126 --- src/sys/kern/sys_generic.c:1.125 Tue Jan 18 14:52:23 2011 +++ src/sys/kern/sys_generic.c Sun Apr 10 11:45:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_generic.c,v 1.125 2011/01/18 19:52:23 matt Exp $ */ +/* $NetBSD: sys_generic.c,v 1.126 2011/04/10 15:45:33 christos Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.125 2011/01/18 19:52:23 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.126 2011/04/10 15:45:33 christos Exp $"); #include #include @@ -522,20 +522,17 @@ } */ struct file *fp; proc_t *p; - struct filedesc *fdp; u_long com; int error; size_t size, alloc_size; void *data, *memp; #define STK_PARAMS 128 u_long stkbuf[STK_PARAMS/sizeof(u_long)]; - fdfile_t *ff; memp = NULL; alloc_size = 0; error = 0; p = l->l_proc; - fdp = p->p_fd; if ((fp = fd_getfile(SCARG(uap, fd))) == NULL) return (EBADF); @@ -546,15 +543,10 @@ goto out; } - ff = fdp->fd_dt->dt_ff[SCARG(uap, fd)]; switch (com = SCARG(uap, com)) { case FIONCLEX: - ff->ff_exclose = false; - goto out; - case FIOCLEX: - ff->ff_exclose = true; - fdp->fd_exclose = true;
CVS commit: src/lib/libc/sys
Module Name:src Committed By: christos Date: Sun Apr 10 15:46:15 UTC 2011 Modified Files: src/lib/libc/sys: open.2 Log Message: Document O_CLOEXEC. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/lib/libc/sys/open.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/open.2 diff -u src/lib/libc/sys/open.2:1.47 src/lib/libc/sys/open.2:1.48 --- src/lib/libc/sys/open.2:1.47 Wed Sep 22 13:58:09 2010 +++ src/lib/libc/sys/open.2 Sun Apr 10 11:46:15 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: open.2,v 1.47 2010/09/22 17:58:09 wiz Exp $ +.\" $NetBSD: open.2,v 1.48 2011/04/10 15:46:15 christos Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" -.Dd September 22, 2010 +.Dd April 10, 2011 .Dt OPEN 2 .Os .Sh NAME @@ -56,7 +56,7 @@ the values listed below. Applications must specify exactly one of the first three values (file access methods): -.Bl -tag -offset indent -width O_NONBLOCK +.Bl -tag -offset indent -width O_DIRECTORY .It Dv O_RDONLY Open for reading only. .It Dv O_WRONLY @@ -66,7 +66,7 @@ .El .Pp Any combination of the following may be used: -.Bl -tag -offset indent -width O_NONBLOCK +.Bl -tag -offset indent -width O_DIRECTORY .It Dv O_NONBLOCK Do not block on open or for data to become available. .It Dv O_APPEND @@ -93,6 +93,12 @@ If last path element is a symlink, don't follow it. This option is provided for compatibility with other operating systems, but its security value is questionable. +.It Dv O_CLOEXEC +Set the +.Xr close 2 +on +.Xr exec 2 +flag. .It Dv O_DSYNC If set, write operations will be performed according to synchronized I/O data integrity completion:
CVS commit: src/sys/compat/linux32/arch/amd64
Module Name:src Committed By: christos Date: Sun Apr 10 15:47:21 UTC 2011 Modified Files: src/sys/compat/linux32/arch/amd64: syscalls.master Log Message: add pipe2 and dup3 To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/compat/linux32/arch/amd64/syscalls.master Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux32/arch/amd64/syscalls.master diff -u src/sys/compat/linux32/arch/amd64/syscalls.master:1.57 src/sys/compat/linux32/arch/amd64/syscalls.master:1.58 --- src/sys/compat/linux32/arch/amd64/syscalls.master:1.57 Tue Nov 2 14:14:06 2010 +++ src/sys/compat/linux32/arch/amd64/syscalls.master Sun Apr 10 11:47:21 2011 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp $ + $NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp $ ; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file. ; (See syscalls.conf to see what it is processed into.) @@ -513,8 +513,8 @@ 327 UNIMPL signalfd4 328 UNIMPL eventfd2 329 UNIMPL epoll_create1 -330 UNIMPL dup3 -331 UNIMPL pipe2 +330 STD { int|linux32_sys||dup3(int from, int to, int flags); } +331 STD { int|linux32_sys||pipe2(netbsd32_intp fd, int flags); } 332 UNIMPL inotify_init1 333 UNIMPL preadv 334 UNIMPL pwritev
CVS commit: src/sys/compat/linux32/arch/amd64
Module Name:src Committed By: christos Date: Sun Apr 10 15:48:01 UTC 2011 Modified Files: src/sys/compat/linux32/arch/amd64: linux32_syscall.h linux32_syscallargs.h linux32_syscalls.c linux32_sysent.c Log Message: Regen: XXX: produces errors because of rump changes! To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 \ src/sys/compat/linux32/arch/amd64/linux32_syscall.h \ src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h \ src/sys/compat/linux32/arch/amd64/linux32_syscalls.c \ src/sys/compat/linux32/arch/amd64/linux32_sysent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux32/arch/amd64/linux32_syscall.h diff -u src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.61 --- src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.60 Tue Nov 2 14:15:39 2010 +++ src/sys/compat/linux32/arch/amd64/linux32_syscall.h Sun Apr 10 11:48:01 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: linux32_syscall.h,v 1.60 2010/11/02 18:15:39 chs Exp $ */ +/* $NetBSD: linux32_syscall.h,v 1.61 2011/04/10 15:48:01 christos Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp + * created from NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp */ #ifndef _LINUX32_SYS_SYSCALL_H_ @@ -612,6 +612,12 @@ /* syscall: "get_robust_list" ret: "int" args: "linux32_pid_t" "linux32_robust_list_headpp_t" "linux32_sizep_t" */ #define LINUX32_SYS_get_robust_list 312 +/* syscall: "dup3" ret: "int" args: "int" "int" "int" */ +#define LINUX32_SYS_dup3 330 + +/* syscall: "pipe2" ret: "int" args: "netbsd32_intp" "int" */ +#define LINUX32_SYS_pipe2 331 + #define LINUX32_SYS_MAXSYSCALL 338 #define LINUX32_SYS_NSYSENT 512 #endif /* _LINUX32_SYS_SYSCALL_H_ */ Index: src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h diff -u src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.61 --- src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.60 Tue Nov 2 14:15:39 2010 +++ src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h Sun Apr 10 11:48:01 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: linux32_syscallargs.h,v 1.60 2010/11/02 18:15:39 chs Exp $ */ +/* $NetBSD: linux32_syscallargs.h,v 1.61 2011/04/10 15:48:01 christos Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp + * created from NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp */ #ifndef _LINUX32_SYS_SYSCALLARGS_H_ @@ -27,7 +27,7 @@ } #undef check_syscall_args -#define check_syscall_args(call) \ +#define check_syscall_args(call) /*LINTED*/ \ typedef char call##_check_args[sizeof (struct call##_args) \ <= LINUX32_SYS_MAXSYSARGS * sizeof (register32_t) ? 1 : -1]; @@ -871,6 +871,19 @@ }; check_syscall_args(linux32_sys_get_robust_list) +struct linux32_sys_dup3_args { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; +}; +check_syscall_args(linux32_sys_dup3) + +struct linux32_sys_pipe2_args { + syscallarg(netbsd32_intp) fd; + syscallarg(int) flags; +}; +check_syscall_args(linux32_sys_pipe2) + /* * System call prototypes. */ @@ -1253,4 +1266,8 @@ int linux32_sys_get_robust_list(struct lwp *, const struct linux32_sys_get_robust_list_args *, register_t *); +int linux32_sys_dup3(struct lwp *, const struct linux32_sys_dup3_args *, register_t *); + +int linux32_sys_pipe2(struct lwp *, const struct linux32_sys_pipe2_args *, register_t *); + #endif /* _LINUX32_SYS_SYSCALLARGS_H_ */ Index: src/sys/compat/linux32/arch/amd64/linux32_syscalls.c diff -u src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.61 --- src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.60 Tue Nov 2 14:15:39 2010 +++ src/sys/compat/linux32/arch/amd64/linux32_syscalls.c Sun Apr 10 11:48:01 2011 @@ -1,14 +1,14 @@ -/* $NetBSD: linux32_syscalls.c,v 1.60 2010/11/02 18:15:39 chs Exp $ */ +/* $NetBSD: linux32_syscalls.c,v 1.61 2011/04/10 15:48:01 christos Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp + * created from NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: linux32_syscalls.c,v 1.60 2010/11/02 18:15:39 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_syscalls.c,v 1.61 2011/04/10 15:48:01 christos Exp $"); #if defined(_KERNEL_OPT) #include @@ -367,12 +367,186 @@ /* 327 */ "#327 (unimplemented signalfd4)", /* 328 */ "#328 (unimplemented eventfd2)", /* 329 */
CVS commit: src/sys/compat/linux32/common
Module Name:src Committed By: christos Date: Sun Apr 10 15:48:23 UTC 2011 Modified Files: src/sys/compat/linux32/common: linux32_unistd.c Log Message: implement pipe2 and dup3 To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/compat/linux32/common/linux32_unistd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux32/common/linux32_unistd.c diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.34 src/sys/compat/linux32/common/linux32_unistd.c:1.35 --- src/sys/compat/linux32/common/linux32_unistd.c:1.34 Wed Nov 11 04:48:51 2009 +++ src/sys/compat/linux32/common/linux32_unistd.c Sun Apr 10 11:48:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $ */ +/* $NetBSD: linux32_unistd.c,v 1.35 2011/04/10 15:48:23 christos Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.35 2011/04/10 15:48:23 christos Exp $"); #include #include @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -62,6 +63,7 @@ #include #include #include +#include #include #include @@ -221,8 +223,8 @@ return 0; } -int -linux32_sys_pipe(struct lwp *l, const struct linux32_sys_pipe_args *uap, register_t *retval) +static int +linux32_pipe(struct lwp *l, int *fd, register_t *retval, int flags) { /* { syscallarg(netbsd32_intp) fd; @@ -230,21 +232,79 @@ int error; int pfds[2]; - if ((error = sys_pipe(l, 0, retval))) - return error; - pfds[0] = (int)retval[0]; pfds[1] = (int)retval[1]; - if ((error = copyout(pfds, SCARG_P32(uap, fd), 2 * sizeof (int))) != 0) + if ((error = copyout(pfds, fd, 2 * sizeof(*fd))) != 0) return error; + if (flags & LINUX_O_CLOEXEC) { + fd_set_exclose(l, retval[0], true); + fd_set_exclose(l, retval[1], true); + } retval[0] = 0; retval[1] = 0; return 0; } +int +linux32_sys_pipe(struct lwp *l, const struct linux32_sys_pipe_args *uap, +register_t *retval) +{ + int error; + if ((error = pipe1(l, retval, 0))) + return error; + return linux32_pipe(l, SCARG_P32(uap, fd), retval, 0); +} + +int +linux32_sys_pipe2(struct lwp *l, const struct linux32_sys_pipe2_args *uap, +register_t *retval) +{ + int flag = 0; + int error; + + switch (SCARG(uap, flags)) { + case LINUX_O_CLOEXEC: + break; + case LINUX_O_NONBLOCK: + case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC: + flag = O_NONBLOCK; + break; + default: + return EINVAL; + } + + if ((error = pipe1(l, retval, flag))) + return error; + + return linux32_pipe(l, SCARG_P32(uap, fd), retval, SCARG(uap, flags)); +} + +int +linux32_sys_dup3(struct lwp *l, const struct linux32_sys_dup3_args *uap, +register_t *retval) +{ + /* { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; + } */ + struct sys_dup2_args ua; + int error; + + NETBSD32TO64_UAP(from); + NETBSD32TO64_UAP(to); + + if ((error = sys_dup2(l, &ua, retval))) + return error; + + if (SCARG(uap, flags) & LINUX_O_CLOEXEC) + fd_set_exclose(l, SCARG(uap, to), true); + + return 0; +} int linux32_sys_unlink(struct lwp *l, const struct linux32_sys_unlink_args *uap, register_t *retval)
CVS commit: src/sys/compat/linux/arch
Module Name:src Committed By: christos Date: Sun Apr 10 15:48:46 UTC 2011 Modified Files: src/sys/compat/linux/arch/amd64: syscalls.master src/sys/compat/linux/arch/i386: syscalls.master Log Message: add pipe2 and dup3 To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/arch/amd64/syscalls.master cvs rdiff -u -r1.103 -r1.104 src/sys/compat/linux/arch/i386/syscalls.master Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/arch/amd64/syscalls.master diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.35 src/sys/compat/linux/arch/amd64/syscalls.master:1.36 --- src/sys/compat/linux/arch/amd64/syscalls.master:1.35 Tue Jul 6 21:30:33 2010 +++ src/sys/compat/linux/arch/amd64/syscalls.master Sun Apr 10 11:48:46 2011 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp $ + $NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -496,8 +496,8 @@ 289 UNIMPL signalfd4 290 UNIMPL eventfd2 291 UNIMPL epoll_create1 -292 UNIMPL dup3 -293 UNIMPL pipe2 +292 STD { int|linux_sys||dup3(int from, int to, int flags); } +293 STD { int|linux_sys||pipe2(int *pfds, int flags); } 294 UNIMPL inotify_init1 295 UNIMPL preadv 296 UNIMPL pwritev Index: src/sys/compat/linux/arch/i386/syscalls.master diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.103 src/sys/compat/linux/arch/i386/syscalls.master:1.104 --- src/sys/compat/linux/arch/i386/syscalls.master:1.103 Tue Jul 6 21:30:34 2010 +++ src/sys/compat/linux/arch/i386/syscalls.master Sun Apr 10 11:48:46 2011 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.103 2010/07/07 01:30:34 chs Exp $ + $NetBSD: syscalls.master,v 1.104 2011/04/10 15:48:46 christos Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -509,8 +509,9 @@ 327 UNIMPL signalfd4 328 UNIMPL eventfd2 329 UNIMPL epoll_create1 -330 UNIMPL dup3 -331 UNIMPL pipe2 +330 STD { int|linux_sys||dup3(u_int from, u_int to, \ +int flags); } +331 STD { int|linux_sys||pipe2( int *pfds, int flags); } 332 UNIMPL inotify_init1 333 UNIMPL preadv 334 UNIMPL pwritev
CVS commit: src/sys/compat/linux/arch
Module Name:src Committed By: christos Date: Sun Apr 10 15:49:24 UTC 2011 Modified Files: src/sys/compat/linux/arch/amd64: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/i386: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c Log Message: Regen: Argh: cat: rumphdr.types: No such file or directory rm: rumphdr.types: No such file or directory *** Error code 1 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/compat/linux/arch/amd64/linux_syscall.h \ src/sys/compat/linux/arch/amd64/linux_syscallargs.h \ src/sys/compat/linux/arch/amd64/linux_syscalls.c \ src/sys/compat/linux/arch/amd64/linux_sysent.c cvs rdiff -u -r1.88 -r1.89 src/sys/compat/linux/arch/i386/linux_syscall.h \ src/sys/compat/linux/arch/i386/linux_syscallargs.h \ src/sys/compat/linux/arch/i386/linux_sysent.c cvs rdiff -u -r1.89 -r1.90 src/sys/compat/linux/arch/i386/linux_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/arch/amd64/linux_syscall.h diff -u src/sys/compat/linux/arch/amd64/linux_syscall.h:1.38 src/sys/compat/linux/arch/amd64/linux_syscall.h:1.39 --- src/sys/compat/linux/arch/amd64/linux_syscall.h:1.38 Tue Jul 6 21:31:51 2010 +++ src/sys/compat/linux/arch/amd64/linux_syscall.h Sun Apr 10 11:49:23 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: linux_syscall.h,v 1.38 2010/07/07 01:31:51 chs Exp $ */ +/* $NetBSD: linux_syscall.h,v 1.39 2011/04/10 15:49:23 christos Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp + * created from NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp */ #ifndef _LINUX_SYS_SYSCALL_H_ @@ -591,6 +591,12 @@ /* syscall: "get_robust_list" ret: "int" args: "int" "struct linux_robust_list_head **" "size_t *" */ #define LINUX_SYS_get_robust_list 274 +/* syscall: "dup3" ret: "int" args: "int" "int" "int" */ +#define LINUX_SYS_dup3 292 + +/* syscall: "pipe2" ret: "int" args: "int *" "int" */ +#define LINUX_SYS_pipe2 293 + /* syscall: "nosys" ret: "int" args: */ #define LINUX_SYS_nosys 300 Index: src/sys/compat/linux/arch/amd64/linux_syscallargs.h diff -u src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.38 src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.39 --- src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.38 Tue Jul 6 21:31:51 2010 +++ src/sys/compat/linux/arch/amd64/linux_syscallargs.h Sun Apr 10 11:49:23 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: linux_syscallargs.h,v 1.38 2010/07/07 01:31:51 chs Exp $ */ +/* $NetBSD: linux_syscallargs.h,v 1.39 2011/04/10 15:49:23 christos Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp + * created from NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp */ #ifndef _LINUX_SYS_SYSCALLARGS_H_ @@ -27,7 +27,7 @@ } #undef check_syscall_args -#define check_syscall_args(call) \ +#define check_syscall_args(call) /*LINTED*/ \ typedef char call##_check_args[sizeof (struct call##_args) \ <= LINUX_SYS_MAXSYSARGS * sizeof (register_t) ? 1 : -1]; @@ -890,6 +890,19 @@ }; check_syscall_args(linux_sys_get_robust_list) +struct linux_sys_dup3_args { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; +}; +check_syscall_args(linux_sys_dup3) + +struct linux_sys_pipe2_args { + syscallarg(int *) pfds; + syscallarg(int) flags; +}; +check_syscall_args(linux_sys_pipe2) + /* * System call prototypes. */ @@ -1285,6 +1298,10 @@ int linux_sys_get_robust_list(struct lwp *, const struct linux_sys_get_robust_list_args *, register_t *); +int linux_sys_dup3(struct lwp *, const struct linux_sys_dup3_args *, register_t *); + +int linux_sys_pipe2(struct lwp *, const struct linux_sys_pipe2_args *, register_t *); + int linux_sys_nosys(struct lwp *, const void *, register_t *); #endif /* _LINUX_SYS_SYSCALLARGS_H_ */ Index: src/sys/compat/linux/arch/amd64/linux_syscalls.c diff -u src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.38 src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.39 --- src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.38 Tue Jul 6 21:31:51 2010 +++ src/sys/compat/linux/arch/amd64/linux_syscalls.c Sun Apr 10 11:49:23 2011 @@ -1,14 +1,14 @@ -/* $NetBSD: linux_syscalls.c,v 1.38 2010/07/07 01:31:51 chs Exp $ */ +/* $NetBSD: linux_syscalls.c,v 1.39 2011/04/10 15:49:23 christos Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp + * created from NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_s
CVS commit: src/sys/compat/linux/common
Module Name:src Committed By: christos Date: Sun Apr 10 15:49:56 UTC 2011 Modified Files: src/sys/compat/linux/common: linux_file.c Log Message: We have O_CLOEXEC now To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/compat/linux/common/linux_file.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/common/linux_file.c diff -u src/sys/compat/linux/common/linux_file.c:1.101 src/sys/compat/linux/common/linux_file.c:1.102 --- src/sys/compat/linux/common/linux_file.c:1.101 Fri Nov 19 01:44:37 2010 +++ src/sys/compat/linux/common/linux_file.c Sun Apr 10 11:49:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file.c,v 1.101 2010/11/19 06:44:37 dholland Exp $ */ +/* $NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $ */ /*- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.101 2010/11/19 06:44:37 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $"); #include #include @@ -102,6 +102,7 @@ res |= cvtto_bsd_mask(lflags, LINUX_FASYNC, O_ASYNC); res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND); res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECTORY, O_DIRECTORY); + res |= cvtto_bsd_mask(lflags, LINUX_O_CLOEXEC, O_CLOEXEC); return res; } @@ -123,6 +124,7 @@ res |= cvtto_linux_mask(bflags, O_ASYNC, LINUX_FASYNC); res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND); res |= cvtto_linux_mask(bflags, O_DIRECTORY, LINUX_O_DIRECTORY); + res |= cvtto_linux_mask(bflags, O_CLOEXEC, LINUX_O_CLOEXEC); return res; }
CVS commit: src/sys/compat/linux/common
Module Name:src Committed By: christos Date: Sun Apr 10 15:50:34 UTC 2011 Modified Files: src/sys/compat/linux/common: linux_pipe.c Log Message: - implement dup3 and pipe2 - eliminate amd64 ifdef To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/compat/linux/common/linux_pipe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/common/linux_pipe.c diff -u src/sys/compat/linux/common/linux_pipe.c:1.63 src/sys/compat/linux/common/linux_pipe.c:1.64 --- src/sys/compat/linux/common/linux_pipe.c:1.63 Wed Jun 18 08:24:18 2008 +++ src/sys/compat/linux/common/linux_pipe.c Sun Apr 10 11:50:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_pipe.c,v 1.63 2008/06/18 12:24:18 tsutsui Exp $ */ +/* $NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.63 2008/06/18 12:24:18 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $"); #include #include @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include @@ -48,6 +50,7 @@ #include #include #include +#include #include @@ -59,33 +62,90 @@ * NetBSD passes fd[0] in retval[0], and fd[1] in retval[1]. * Linux directly passes the pointer. */ +static int +linux_pipe_return(struct lwp *l, int *pfds, register_t *retval, int flags) +{ + int error; + + if (sizeof(*retval) != sizeof(*pfds)) { + /* On amd64, sizeof(register_t) != sizeof(int) */ + int rpfds[2]; + rpfds[0] = (int)retval[0]; + rpfds[1] = (int)retval[1]; + + if ((error = copyout(rpfds, pfds, sizeof(rpfds + return error; + } else { + if ((error = copyout(retval, pfds, 2 * sizeof(*pfds + return error; + } + if (flags & LINUX_O_CLOEXEC) { + fd_set_exclose(l, retval[0], true); + fd_set_exclose(l, retval[1], true); + } + retval[0] = 0; + return 0; +} + int -linux_sys_pipe(struct lwp *l, const struct linux_sys_pipe_args *uap, register_t *retval) +linux_sys_pipe(struct lwp *l, const struct linux_sys_pipe_args *uap, +register_t *retval) { /* { syscallarg(int *) pfds; } */ int error; -#ifdef __amd64__ - int pfds[2]; -#endif - if ((error = sys_pipe(l, 0, retval))) + if ((error = pipe1(l, retval, 0))) return error; -#ifndef __amd64__ - /* Assumes register_t is an int */ - if ((error = copyout(retval, SCARG(uap, pfds), 2 * sizeof (int + return linux_pipe_return(l, SCARG(uap, pfds), retval, 0); +} + +int +linux_sys_pipe2(struct lwp *l, const struct linux_sys_pipe2_args *uap, +register_t *retval) +{ + /* { + syscallarg(int *) pfds; + syscallarg(int) flags; + } */ + int error; + int flag = 0; + + switch (SCARG(uap, flags)) { + case LINUX_O_CLOEXEC: + break; + case LINUX_O_NONBLOCK: + case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC: + flag = O_NONBLOCK; + break; + default: + return EINVAL; + } + + if ((error = pipe1(l, retval, flag))) return error; -#else - /* On amd64, sizeof(register_t) != sizeof(int) */ - pfds[0] = (int)retval[0]; - pfds[1] = (int)retval[1]; - if ((error = copyout(pfds, SCARG(uap, pfds), sizeof(pfds + return linux_pipe_return(l, SCARG(uap, pfds), retval, + SCARG(uap, flags)); +} + +int +linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap, +register_t *retval) +{ + /* { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; + } */ + int error; + if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval))) return error; -#endif - retval[0] = 0; + if (SCARG(uap, flags) & LINUX_O_CLOEXEC) + fd_set_exclose(l, SCARG(uap, to), true); + return 0; }
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: pgoyette Date: Sun Apr 10 16:06:59 UTC 2011 Modified Files: src/usr.bin/kdump: kdump.c Log Message: Fix string constant so it compiles again. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/usr.bin/kdump/kdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/kdump.c diff -u src/usr.bin/kdump/kdump.c:1.108 src/usr.bin/kdump/kdump.c:1.109 --- src/usr.bin/kdump/kdump.c:1.108 Sun Apr 10 14:38:19 2011 +++ src/usr.bin/kdump/kdump.c Sun Apr 10 16:06:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $ */ +/* $NetBSD: kdump.c,v 1.109 2011/04/10 16:06:59 pgoyette Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $"); +__RCSID("$NetBSD: kdump.c,v 1.109 2011/04/10 16:06:59 pgoyette Exp $"); #endif #endif /* not lint */ @@ -951,7 +951,7 @@ return; case SI_LWP: printf(": code=SI_LWP sent by pid=%d, " -"uid=%d")\n", si->si_pid, si->si_uid); +"uid=%d)\n", si->si_pid, si->si_uid); return; default: code = NULL;
CVS commit: src/sys/arch/sandpoint/sandpoint
Module Name:src Committed By: phx Date: Sun Apr 10 16:30:32 UTC 2011 Modified Files: src/sys/arch/sandpoint/sandpoint: satmgr.c Log Message: Missing comma. Make it compile again. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/sandpoint/satmgr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sandpoint/sandpoint/satmgr.c diff -u src/sys/arch/sandpoint/sandpoint/satmgr.c:1.8 src/sys/arch/sandpoint/sandpoint/satmgr.c:1.9 --- src/sys/arch/sandpoint/sandpoint/satmgr.c:1.8 Fri Apr 8 14:09:24 2011 +++ src/sys/arch/sandpoint/sandpoint/satmgr.c Sun Apr 10 16:30:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: satmgr.c,v 1.8 2011/04/08 14:09:24 nisimura Exp $ */ +/* $NetBSD: satmgr.c,v 1.9 2011/04/10 16:30:32 phx Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -136,10 +136,10 @@ }; static struct satops satmodel[] = { -{ "dlink",NULL, NULL, NULL, dbutton } +{ "dlink",NULL, NULL, NULL, dbutton }, { "kurobox", NULL, kreboot, kpwroff, kbutton }, { "qnap", qinit, qreboot, qpwroff, qbutton }, -{ "synology", sinit, sreboot, spwroff, sbutton }, +{ "synology", sinit, sreboot, spwroff, sbutton } }; /* single byte stride register layout */
CVS commit: src/distrib/i386/ramdisks/common
Module Name:src Committed By: joerg Date: Sun Apr 10 16:45:52 UTC 2011 Modified Files: src/distrib/i386/ramdisks/common: Makefile.ramdisk Log Message: Extend LDFLAGS, don't replace it. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/distrib/i386/ramdisks/common/Makefile.ramdisk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/i386/ramdisks/common/Makefile.ramdisk diff -u src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.9 src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.10 --- src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.9 Thu Feb 11 09:06:48 2010 +++ src/distrib/i386/ramdisks/common/Makefile.ramdisk Sun Apr 10 16:45:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.ramdisk,v 1.9 2010/02/11 09:06:48 roy Exp $ +# $NetBSD: Makefile.ramdisk,v 1.10 2011/04/10 16:45:52 joerg Exp $ .include .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" @@ -29,7 +29,8 @@ # This propogates through to the link of ramdiskbin # The map file is useful when trying to prune the image -CRUNCHENV += LDFLAGS='-Wl,-Map,${CRUNCHBIN}.map,--cref' +LDFLAGS+= -Wl,-Map,${CRUNCHBIN}.map,--cref +CRUNCHENV += LDFLAGS=${LDFLAGS:Q} .if defined(USE_SYSINST) .if ${USE_SYSINST} != yes
CVS commit: src
Module Name:src Committed By: joerg Date: Sun Apr 10 16:47:05 UTC 2011 Modified Files: src/gnu/usr.bin/gdb6/gdb: Makefile src/gnu/usr.bin/gdb6/gdbtui: Makefile src/gnu/usr.bin/gdb6/libgdb: Makefile src/sbin/mount_ffs: Makefile src/sbin/mount_hfs: Makefile src/sbin/mount_nfs: Makefile Log Message: Extend CPPFLAGS, don't replace it To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/gnu/usr.bin/gdb6/gdb/Makefile cvs rdiff -u -r1.5 -r1.6 src/gnu/usr.bin/gdb6/gdbtui/Makefile cvs rdiff -u -r1.10 -r1.11 src/gnu/usr.bin/gdb6/libgdb/Makefile cvs rdiff -u -r1.9 -r1.10 src/sbin/mount_ffs/Makefile cvs rdiff -u -r1.3 -r1.4 src/sbin/mount_hfs/Makefile cvs rdiff -u -r1.23 -r1.24 src/sbin/mount_nfs/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/gnu/usr.bin/gdb6/gdb/Makefile diff -u src/gnu/usr.bin/gdb6/gdb/Makefile:1.8 src/gnu/usr.bin/gdb6/gdb/Makefile:1.9 --- src/gnu/usr.bin/gdb6/gdb/Makefile:1.8 Wed Feb 3 15:34:39 2010 +++ src/gnu/usr.bin/gdb6/gdb/Makefile Sun Apr 10 16:47:04 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2010/02/03 15:34:39 roy Exp $ +# $NetBSD: Makefile,v 1.9 2011/04/10 16:47:04 joerg Exp $ .include "../Makefile.inc" @@ -10,7 +10,7 @@ PROG= gdb SRCS= gdb.c -CPPFLAGS= -I${.CURDIR} \ +CPPFLAGS+= -I${.CURDIR} \ -I${.CURDIR}/../arch/${MACHINE_ARCH} \ -I${DIST}/gdb \ -I${DIST}/gdb/config \ Index: src/gnu/usr.bin/gdb6/gdbtui/Makefile diff -u src/gnu/usr.bin/gdb6/gdbtui/Makefile:1.5 src/gnu/usr.bin/gdb6/gdbtui/Makefile:1.6 --- src/gnu/usr.bin/gdb6/gdbtui/Makefile:1.5 Sat Mar 27 19:46:57 2010 +++ src/gnu/usr.bin/gdb6/gdbtui/Makefile Sun Apr 10 16:47:04 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2010/03/27 19:46:57 mrg Exp $ +# $NetBSD: Makefile,v 1.6 2011/04/10 16:47:04 joerg Exp $ .include "../Makefile.inc" @@ -10,7 +10,7 @@ PROG= gdbtui SRCS= tui-main.c -CPPFLAGS= -I${.CURDIR} \ +CPPFLAGS+= -I${.CURDIR} \ -I${.CURDIR}/../arch/${MACHINE_ARCH} \ -I${DIST}/gdb \ -I${DIST}/gdb/config \ Index: src/gnu/usr.bin/gdb6/libgdb/Makefile diff -u src/gnu/usr.bin/gdb6/libgdb/Makefile:1.10 src/gnu/usr.bin/gdb6/libgdb/Makefile:1.11 --- src/gnu/usr.bin/gdb6/libgdb/Makefile:1.10 Fri Feb 18 22:27:51 2011 +++ src/gnu/usr.bin/gdb6/libgdb/Makefile Sun Apr 10 16:47:04 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2011/02/18 22:27:51 joerg Exp $ +# $NetBSD: Makefile,v 1.11 2011/04/10 16:47:04 joerg Exp $ .include @@ -14,7 +14,7 @@ SRCS= ${G_LIBGDB_OBS:.o=.c} GCPPFLAGS= ${G_INTERNAL_CFLAGS} CPPFLAGS.bsd-kvm.c= -D_KMEMUSER -CPPFLAGS= -I${.CURDIR} \ +CPPFLAGS+= -I${.CURDIR} \ -I${.CURDIR}/../arch/${MACHINE_ARCH} \ -I${DIST}/gdb \ -I${DIST}/gdb/config \ Index: src/sbin/mount_ffs/Makefile diff -u src/sbin/mount_ffs/Makefile:1.9 src/sbin/mount_ffs/Makefile:1.10 --- src/sbin/mount_ffs/Makefile:1.9 Tue Aug 5 20:57:45 2008 +++ src/sbin/mount_ffs/Makefile Sun Apr 10 16:47:05 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2008/08/05 20:57:45 pooka Exp $ +# $NetBSD: Makefile,v 1.10 2011/04/10 16:47:05 joerg Exp $ .include @@ -10,7 +10,7 @@ LINKS= ${BINDIR}/mount_ffs ${BINDIR}/mount_ufs MOUNT= ${NETBSDSRCDIR}/sbin/mount -CPPFLAGS=-I${MOUNT} +CPPFLAGS+=-I${MOUNT} .PATH: ${MOUNT} DPADD+=${LIBUTIL} Index: src/sbin/mount_hfs/Makefile diff -u src/sbin/mount_hfs/Makefile:1.3 src/sbin/mount_hfs/Makefile:1.4 --- src/sbin/mount_hfs/Makefile:1.3 Tue Aug 5 20:57:45 2008 +++ src/sbin/mount_hfs/Makefile Sun Apr 10 16:47:05 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2008/08/05 20:57:45 pooka Exp $ +# $NetBSD: Makefile,v 1.4 2011/04/10 16:47:05 joerg Exp $ .include @@ -7,7 +7,7 @@ MAN= mount_hfs.8 MOUNT= ${NETBSDSRCDIR}/sbin/mount -CPPFLAGS=-I${MOUNT} +CPPFLAGS+=-I${MOUNT} .PATH: ${MOUNT} DPADD+=${LIBUTIL} Index: src/sbin/mount_nfs/Makefile diff -u src/sbin/mount_nfs/Makefile:1.23 src/sbin/mount_nfs/Makefile:1.24 --- src/sbin/mount_nfs/Makefile:1.23 Fri Mar 5 19:53:37 2010 +++ src/sbin/mount_nfs/Makefile Sun Apr 10 16:47:05 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.23 2010/03/05 19:53:37 pooka Exp $ +# $NetBSD: Makefile,v 1.24 2011/04/10 16:47:05 joerg Exp $ # @(#)Makefile 8.2 (Berkeley) 3/27/94 .include @@ -9,7 +9,7 @@ MAN= mount_nfs.8 MOUNT= ${NETBSDSRCDIR}/sbin/mount -CPPFLAGS=-I${MOUNT} +CPPFLAGS+=-I${MOUNT} .PATH: ${MOUNT} .ifndef SMALLPROG
CVS commit: src/lib/libbsdmalloc
Module Name:src Committed By: joerg Date: Sun Apr 10 16:47:39 UTC 2011 Modified Files: src/lib/libbsdmalloc: Makefile Log Message: Define _REENT. Extend CPPFLAGS. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbsdmalloc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbsdmalloc/Makefile diff -u src/lib/libbsdmalloc/Makefile:1.2 src/lib/libbsdmalloc/Makefile:1.3 --- src/lib/libbsdmalloc/Makefile:1.2 Thu Jul 10 11:27:45 2003 +++ src/lib/libbsdmalloc/Makefile Sun Apr 10 16:47:39 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2003/07/10 11:27:45 lukem Exp $ +# $NetBSD: Makefile,v 1.3 2011/04/10 16:47:39 joerg Exp $ NOMAN=1 @@ -7,7 +7,6 @@ LIB= bsdmalloc SRCS= malloc.c -CPPFLAGS= -D_REENTRANT -CPPFLAGS= -I${.CURDIR}/../libc/include/ +CPPFLAGS+= -D_REENT -D_REENTRANT -I${.CURDIR}/../libc/include/ .include
CVS commit: src/gnu/dist/gcc4/gcc
Module Name:src Committed By: joerg Date: Sun Apr 10 16:48:52 UTC 2011 Modified Files: src/gnu/dist/gcc4/gcc: Makefile.in Log Message: Don't install limits.h. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/gnu/dist/gcc4/gcc/Makefile.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/gnu/dist/gcc4/gcc/Makefile.in diff -u src/gnu/dist/gcc4/gcc/Makefile.in:1.9 src/gnu/dist/gcc4/gcc/Makefile.in:1.10 --- src/gnu/dist/gcc4/gcc/Makefile.in:1.9 Thu Mar 24 13:31:30 2011 +++ src/gnu/dist/gcc4/gcc/Makefile.in Sun Apr 10 16:48:51 2011 @@ -3147,9 +3147,9 @@ chmod a+r include/$$realfile; \ fi; \ done; \ - rm -f include/limits.h; \ - chmod a+r include/limits.h; fi - cp xlimits.h include/limits.h + true || rm -f include/limits.h; \ + true || chmod a+r include/limits.h; fi + true || cp xlimits.h include/limits.h cp $(UNWIND_H) include/unwind.h # Install the README rm -f include/README
CVS commit: src/gnu/dist/gcc4/gcc
Module Name:src Committed By: joerg Date: Sun Apr 10 16:50:18 UTC 2011 Modified Files: src/gnu/dist/gcc4/gcc: gcc.c src/gnu/dist/gcc4/gcc/config: netbsd.h Log Message: Reduce difference between src/tools/gcc and src/gnu/usr.bin/gcc4 configuration. All but the target to helper programs should be the same. Mark include directories as sysroot-relative. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/gnu/dist/gcc4/gcc/gcc.c cvs rdiff -u -r1.6 -r1.7 src/gnu/dist/gcc4/gcc/config/netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/gnu/dist/gcc4/gcc/gcc.c diff -u src/gnu/dist/gcc4/gcc/gcc.c:1.4 src/gnu/dist/gcc4/gcc/gcc.c:1.5 --- src/gnu/dist/gcc4/gcc/gcc.c:1.4 Thu Jan 11 06:59:53 2007 +++ src/gnu/dist/gcc4/gcc/gcc.c Sun Apr 10 16:50:18 2011 @@ -6277,7 +6277,7 @@ PREFIX_PRIORITY_LAST, 0, 1); else if (*cross_compile == '0') { -#ifndef NETBSD_NATIVE +#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS) if (gcc_exec_prefix) add_prefix (&startfile_prefixes, concat (gcc_exec_prefix, machine_suffix, @@ -6295,7 +6295,7 @@ #endif /* NETBSD_NATIVE */ } -#ifndef NETBSD_NATIVE +#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS) if (*standard_startfile_prefix_1) add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1, "BINUTILS", Index: src/gnu/dist/gcc4/gcc/config/netbsd.h diff -u src/gnu/dist/gcc4/gcc/config/netbsd.h:1.6 src/gnu/dist/gcc4/gcc/config/netbsd.h:1.7 --- src/gnu/dist/gcc4/gcc/config/netbsd.h:1.6 Sun Apr 27 23:49:27 2008 +++ src/gnu/dist/gcc4/gcc/config/netbsd.h Sun Apr 10 16:50:18 2011 @@ -43,9 +43,13 @@ /* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD source tree so it can be configured appropriately without using - the GNU configure/build mechanism. */ + the GNU configure/build mechanism. -#ifdef NETBSD_NATIVE + NETBSD_TOOLS is defined when gcc is built as cross-compiler for + the in-tree toolchain. + */ + +#if defined(NETBSD_NATIVE) || defined(NETBSD_TOOLS) /* Look for the include files in the system-defined places. */ @@ -61,23 +65,28 @@ #undef INCLUDE_DEFAULTS #define INCLUDE_DEFAULTS\ { \ -{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ -{ GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \ -{ GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ +{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1 }, \ +{ GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 1 }, \ +{ GCC_INCLUDE_DIR, "GCC", 0, 0, 1 }, \ { 0, 0, 0, 0 } \ } -/* Under NetBSD, the normal location of the compiler back ends is the - /usr/libexec directory. */ - -#undef STANDARD_EXEC_PREFIX -#define STANDARD_EXEC_PREFIX "/usr/libexec/" - /* Under NetBSD, the normal location of the various *crt*.o files is the /usr/lib directory. */ #undef STANDARD_STARTFILE_PREFIX #define STANDARD_STARTFILE_PREFIX "/usr/lib/" +#undef STANDARD_STARTFILE_PREFIX_1 +#define STANDARD_STARTFILE_PREFIX_1 "/usr/lib/" + +#endif /* NETBSD_NATIVE || NETBSD_TOOLS */ + +#if defined(NETBSD_NATIVE) +/* Under NetBSD, the normal location of the compiler back ends is the + /usr/libexec directory. */ + +#undef STANDARD_EXEC_PREFIX +#define STANDARD_EXEC_PREFIX "/usr/libexec/" #undef TOOLDIR_BASE_PREFIX #define TOOLDIR_BASE_PREFIX "/usr/" @@ -87,7 +96,6 @@ #undef STANDARD_LIBEXEC_PREFIX #define STANDARD_LIBEXEC_PREFIX STANDARD_EXEC_PREFIX - #endif /* NETBSD_NATIVE */
CVS commit: src
Module Name:src Committed By: joerg Date: Sun Apr 10 16:52:36 UTC 2011 Modified Files: src/share/mk: bsd.dep.mk bsd.lib.mk bsd.own.mk bsd.prog.mk bsd.x11.mk src/tools: Makefile.host Log Message: For USETOOLS=yes, use the --sysroot support of the compiler to cut down the number of hard-coded pathes and magic invocations. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/share/mk/bsd.dep.mk cvs rdiff -u -r1.312 -r1.313 src/share/mk/bsd.lib.mk cvs rdiff -u -r1.653 -r1.654 src/share/mk/bsd.own.mk cvs rdiff -u -r1.262 -r1.263 src/share/mk/bsd.prog.mk cvs rdiff -u -r1.94 -r1.95 src/share/mk/bsd.x11.mk cvs rdiff -u -r1.27 -r1.28 src/tools/Makefile.host Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.dep.mk diff -u src/share/mk/bsd.dep.mk:1.71 src/share/mk/bsd.dep.mk:1.72 --- src/share/mk/bsd.dep.mk:1.71 Sun Feb 6 00:52:49 2011 +++ src/share/mk/bsd.dep.mk Sun Apr 10 16:52:36 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.dep.mk,v 1.71 2011/02/06 00:52:49 joerg Exp $ +# $NetBSD: bsd.dep.mk,v 1.72 2011/04/10 16:52:36 joerg Exp $ # Basic targets cleandir: cleandepend @@ -57,8 +57,6 @@ ${_MKTARGET_CREATE} ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ - ${HOSTLIB:U${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ - ${DESTDIR}/usr/include/g++}} \ ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} .endif # defined(SRCS) # } Index: src/share/mk/bsd.lib.mk diff -u src/share/mk/bsd.lib.mk:1.312 src/share/mk/bsd.lib.mk:1.313 --- src/share/mk/bsd.lib.mk:1.312 Thu Feb 10 21:55:33 2011 +++ src/share/mk/bsd.lib.mk Sun Apr 10 16:52:36 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.312 2011/02/10 21:55:33 matt Exp $ +# $NetBSD: bsd.lib.mk,v 1.313 2011/04/10 16:52:36 joerg Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include @@ -63,17 +63,6 @@ # Build and install rules MKDEP_SUFFIXES?= .o .po .pico .go .ln -# Use purely kernel private headers in rump builds -# Skip NetBSD headers for the toolchain builds -.if !defined(RUMPKERNEL) && !defined(HOSTLIB) -.if empty(CPPFLAGS:M-nostdinc) -CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include} -.endif -.if empty(CXXFLAGS:M-nostdinc++) -CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++} -.endif -.endif - .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor @@ -522,12 +511,12 @@ _LIBLDOPTS= .if ${SHLIBDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \ - -Wl,-rpath,${SHLIBDIR} \ - -L${DESTDIR}${SHLIBDIR} +_LIBLDOPTS+= -Wl,-rpath-link,=${SHLIBDIR} \ + -Wl,-rpath,=${SHLIBDIR} \ + -L=${SHLIBDIR} .elif ${SHLIBINSTALLDIR} != "/usr/lib" -_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \ - -L${DESTDIR}${SHLIBINSTALLDIR} +_LIBLDOPTS+= -Wl,-rpath-link,=${SHLIBINSTALLDIR} \ + -L=${SHLIBINSTALLDIR} .endif # gcc -shared now adds -lc automatically. For libraries other than libc and @@ -565,18 +554,9 @@ ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} ${_MKTARGET_BUILD} rm -f lib${LIB}.so.${SHLIB_FULLVERSION} -.if defined(DESTDIR) - ${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}${SHLIBDIR}/ \ - -Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ - -Wl,--whole-archive ${SOLIB} \ - -Wl,--no-whole-archive ${_LDADD.lib${LIB}} \ - ${_LIBLDOPTS} ${_LDFLAGS.lib${LIB}} \ - -L${_GCC_LIBGCCDIR} -.else ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \ -o ${.TARGET} ${_LIBLDOPTS} \ -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}} -.endif # We don't use INSTALL_SYMLINK here because this is just # happening inside the build directory/objdir. XXX Why does # this spend so much effort on libraries that aren't live??? XXX Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.653 src/share/mk/bsd.own.mk:1.654 --- src/share/mk/bsd.own.mk:1.653 Tue Mar 8 12:20:17 2011 +++ src/share/mk/bsd.own.mk Sun Apr 10 16:52:36 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.653 2011/03/08 12:20:17 njoly Exp $ +# $NetBSD: bsd.own.mk,v 1.654 2011/04/10 16:52:36 joerg Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -64,15 +64,6 @@ # default to binutils 2.19 HAVE_BINUTILS?= 219 -CPPFLAG_ISYSTEM= -isystem -.if defined(HAVE_GCC) -.if ${HAVE_GCC} == 3 -CPPFLAG_ISYSTEMXX= -isystem-cxx -.else # GCC 4 -CPPFLAG_ISYSTEMXX= -cxx-isystem -.endif -.endif - .if empty(.MAKEFLAGS:M-V*) .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) PRINTOBJDIR= ${MAKE} -r -V .OBJDIR -f /dev/null xxx @@ -216,6 +207,8 @@ OBJC= false .endif +CPPFLAGS+= ${HOSTPROG:U${HOSTLIB:U${DESTDIR:D--sysroot=${DESTDIR +LDFLAGS+= $
CVS commit: src
Module Name:src Committed By: joerg Date: Sun Apr 10 20:22:33 UTC 2011 Modified Files: src: UPDATING Log Message: Add a generic note about GCC's error on changed variables and a specific entry for the sysroot related changes breaking MKUPDATE. To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/UPDATING diff -u src/UPDATING:1.222 src/UPDATING:1.223 --- src/UPDATING:1.222 Sun Apr 10 08:29:31 2011 +++ src/UPDATING Sun Apr 10 20:22:32 2011 @@ -1,4 +1,4 @@ -$NetBSD: UPDATING,v 1.222 2011/04/10 08:29:31 plunky Exp $ +$NetBSD: UPDATING,v 1.223 2011/04/10 20:22:32 joerg Exp $ This file (UPDATING) is intended to be a brief reference to recent changes that might cause problems in the build process, and a guide for @@ -15,6 +15,11 @@ Recent changes: ^^^ +20110410: + The configuration of src/tools/gcc has changed. Update builds + have to remove the stale content explicitly. See the note toward + the end of the file for details. + 20110328: Building the Xorg binary was moved into a subdirectory to fix ordering issues with "make all". It may be necessary to remove @@ -540,3 +545,7 @@ Symptom:lint does not understand the '-X' option Fix:May need to build & install libs with NOLINT=1 before rebuilding lint + +Symptom:Update build fails in src/tools/gcc complaining that a variable + (e.g. CPPFLAGS) has changed since the previous run. +Fix:Run "nbmake-${ARCH} clean" in src/tools/gcc or do a clean build.
CVS commit: src/sys/arch
Module Name:src Committed By: christos Date: Sun Apr 10 20:36:49 UTC 2011 Modified Files: src/sys/arch/amd64/amd64: db_disasm.c src/sys/arch/amd64/conf: files.amd64 src/sys/arch/amd64/include: db_machdep.h src/sys/arch/i386/conf: files.i386 src/sys/arch/i386/include: db_machdep.h src/sys/arch/x86/conf: files.x86 Added Files: src/sys/arch/amd64/amd64: db_machdep.c src/sys/arch/i386/i386: db_machdep.c src/sys/arch/x86/include: db_machdep.h src/sys/arch/x86/x86: db_trace.c Removed Files: src/sys/arch/amd64/amd64: db_trace.c src/sys/arch/i386/i386: db_trace.c Log Message: Merge db_trace for x86. From: Vladimir Kirillov proger at wilab dot org dot ua To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/amd64/db_disasm.c cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/amd64/db_machdep.c cvs rdiff -u -r1.18 -r0 src/sys/arch/amd64/amd64/db_trace.c cvs rdiff -u -r1.71 -r1.72 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/include/db_machdep.h cvs rdiff -u -r1.356 -r1.357 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/i386/db_machdep.c cvs rdiff -u -r1.66 -r0 src/sys/arch/i386/i386/db_trace.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/db_machdep.h cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/include/db_machdep.h cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/db_trace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/db_disasm.c diff -u src/sys/arch/amd64/amd64/db_disasm.c:1.14 src/sys/arch/amd64/amd64/db_disasm.c:1.15 --- src/sys/arch/amd64/amd64/db_disasm.c:1.14 Fri Feb 18 13:00:52 2011 +++ src/sys/arch/amd64/amd64/db_disasm.c Sun Apr 10 16:36:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.14 2011/02/18 18:00:52 drochner Exp $ */ +/* $NetBSD: db_disasm.c,v 1.15 2011/04/10 20:36:49 christos Exp $ */ /* * Mach Operating System @@ -33,10 +33,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.14 2011/02/18 18:00:52 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.15 2011/04/10 20:36:49 christos Exp $"); #ifndef _KERNEL -#include "stubs.h" #include #include #include Index: src/sys/arch/amd64/conf/files.amd64 diff -u src/sys/arch/amd64/conf/files.amd64:1.71 src/sys/arch/amd64/conf/files.amd64:1.72 --- src/sys/arch/amd64/conf/files.amd64:1.71 Mon Apr 4 17:35:31 2011 +++ src/sys/arch/amd64/conf/files.amd64 Sun Apr 10 16:36:49 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.amd64,v 1.71 2011/04/04 21:35:31 dyoung Exp $ +# $NetBSD: files.amd64,v 1.72 2011/04/10 20:36:49 christos Exp $ # # new style config file for amd64 architecture # @@ -34,9 +34,9 @@ file arch/amd64/amd64/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum file arch/amd64/amd64/cpufunc.S file arch/amd64/amd64/db_disasm.c ddb -file arch/amd64/amd64/db_interface.c ddb +file arch/amd64/amd64/db_interface.c ddb +file arch/amd64/amd64/db_machdep.c ddb file arch/amd64/amd64/db_memrw.c ddb | kgdb -file arch/amd64/amd64/db_trace.c ddb file arch/amd64/amd64/kobj_machdep.c modular file arch/amd64/amd64/kgdb_machdep.c kgdb file kern/subr_disk_mbr.c disk Index: src/sys/arch/amd64/include/db_machdep.h diff -u src/sys/arch/amd64/include/db_machdep.h:1.9 src/sys/arch/amd64/include/db_machdep.h:1.10 --- src/sys/arch/amd64/include/db_machdep.h:1.9 Sat Mar 14 10:45:54 2009 +++ src/sys/arch/amd64/include/db_machdep.h Sun Apr 10 16:36:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.9 2009/03/14 14:45:54 dsl Exp $ */ +/* $NetBSD: db_machdep.h,v 1.10 2011/04/10 20:36:49 christos Exp $ */ /* * Mach Operating System @@ -44,6 +44,13 @@ typedef long db_expr_t; /* expression - signed */ typedef struct trapframe db_regs_t; + +struct x86_64_frame { + struct x86_64_frame *f_frame; + long f_retaddr; + long f_arg0; +}; + #ifndef MULTIPROCESSOR extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) @@ -125,10 +132,12 @@ int kdb_trap(int, int, db_regs_t *); +#ifdef _KERNEL /* * We define some of our own commands */ #define DB_MACHINE_COMMANDS +#endif #define DB_ELF_SYMBOLS #define DB_ELFSIZE 64 Index: src/sys/arch/i386/conf/files.i386 diff -u src/sys/arch/i386/conf/files.i386:1.356 src/sys/arch/i386/conf/files.i386:1.357 --- src/sys/arch/i386/conf/files.i386:1.356 Thu Feb 24 05:56:01 2011 +++ src/sys/arch/i386/conf/files.i386 Sun Apr 10 16:36:48 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.356 2011/02/24 10:56:01 jruoho Exp $ +# $NetBSD: files.i386,v 1.357 2011/04/10 20:36:48 christos Exp $ # # new style config file for i386 architecture # @@ -67,8 +67,8 @@ file arch/i386/i386/db_dbgreg.S ddb | kstack_check_dr0 file arch/i386/i386/db_disasm.c ddb file arch/i386/i386/db_interface.c ddb +file arch
CVS commit: src/sys/arch/x86/include
Module Name:src Committed By: christos Date: Sun Apr 10 20:38:37 UTC 2011 Modified Files: src/sys/arch/x86/include: db_machdep.h Log Message: something ate my / To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/db_machdep.h diff -u src/sys/arch/x86/include/db_machdep.h:1.1 src/sys/arch/x86/include/db_machdep.h:1.2 --- src/sys/arch/x86/include/db_machdep.h:1.1 Sun Apr 10 16:36:48 2011 +++ src/sys/arch/x86/include/db_machdep.h Sun Apr 10 16:38:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.1 2011/04/10 20:36:48 christos Exp $ * +/* $NetBSD: db_machdep.h,v 1.2 2011/04/10 20:38:37 christos Exp $ */ #ifndef _X86_DB_MACHDEP_H_ #define _X86_DB_MACHDEP_H_
CVS commit: src/usr.sbin/crash
Module Name:src Committed By: christos Date: Sun Apr 10 20:39:43 UTC 2011 Modified Files: src/usr.sbin/crash: Makefile crash.c Log Message: - amd64 support - fix end of file handling From: Vladimir Kirillov proger at wilab dot org dot ua To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/Makefile cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/crash/Makefile diff -u src/usr.sbin/crash/Makefile:1.6 src/usr.sbin/crash/Makefile:1.7 --- src/usr.sbin/crash/Makefile:1.6 Mon Mar 21 01:09:33 2011 +++ src/usr.sbin/crash/Makefile Sun Apr 10 16:39:42 2011 @@ -1,24 +1,23 @@ -# $NetBSD: Makefile,v 1.6 2011/03/21 05:09:33 joerg Exp $ +# $NetBSD: Makefile,v 1.7 2011/04/10 20:39:42 christos Exp $ -PROG= crash -MAN= crash.8 +PROG= crash +MAN= crash.8 RUMPKERNEL= yes # XXX: Avoid -mcmodel=kernel -LDADD+= -lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash -DPADD+= ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO} +LDADD+= -lutil -lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash +DPADD+= ${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO} # some ddb kernel components need limited modifications. for now, # punt if not noted as implemented here. -.if (${MACHINE} != "i386") - +.if !empty(${MACHINE:C/(amd64|i386)//}) SRCS+= unsupported.c - .else -S= ${.CURDIR}/../../sys +S= ${.CURDIR}/../../sys CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing CPPFLAGS+= -DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER +CPPFLAGS+= -DDB_AOUT_SYMBOLS -UDB_MACHINE_COMMANDS # ddb files from kernel .PATH: $S/ddb @@ -27,24 +26,24 @@ SRCS+= db_expr.c db_lex.c db_output.c db_print.c SRCS+= db_sym.c db_variables.c db_write_cmd.c -# db_trace.c, db_disasm.c -.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} -.for i in ${i} db_disasm db_trace -. if (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/${i}.c)) -SRCS+= ${i}.c +.PATH: ${S}/arch/${MACHINE}/${MACHINE} +SRCS+= db_machdep.c db_disasm.c + +. if empty(${MACHINE:C/(amd64|i386)//}) +.PATH: ${S}/arch/x86/x86 +SRCS+= db_trace.c . endif -.endfor # crash main source SRCS+= crash.c # arch.c .PATH: ${.CURDIR}/arch -.if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c)) +. if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c)) SRCS+= ${MACHINE_ARCH}.c -.else +. else SRCS+= generic.c -.endif +. endif # vers.c SRCS+= vers.c Index: src/usr.sbin/crash/crash.c diff -u src/usr.sbin/crash/crash.c:1.2 src/usr.sbin/crash/crash.c:1.3 --- src/usr.sbin/crash/crash.c:1.2 Thu Apr 16 02:52:08 2009 +++ src/usr.sbin/crash/crash.c Sun Apr 10 16:39:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $ */ +/* $NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $"); +__RCSID("$NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $"); #endif /* not lint */ #include @@ -52,18 +52,20 @@ #include #include #include +#include #include "extern.h" #define MAXSTAB (16 * 1024 * 1024) -static kvm_t *kd; db_regs_t ddb_regs; -History *hist; -HistEvent he; -EditLine *elptr; -char imgrelease[16]; -FILE *ofp; + +static kvm_t *kd; +static History *hist; +static HistEvent he; +static EditLine *elptr; +static char imgrelease[16]; +static FILE *ofp; static struct nlist nl[] = { #define X_OSRELEASE 0 @@ -73,6 +75,18 @@ { .n_name = NULL }, }; +static void +cleanup(void) +{ + if (ofp != stdout) { + (void)fflush(ofp); + (void)pclose(ofp); + ofp = stdout; + } + el_end(elptr); + history_end(hist); +} + void db_vprintf(const char *fmt, va_list ap) { @@ -121,14 +135,14 @@ db_alloc(size_t sz) { - return malloc(sz); + return emalloc(sz); } void * db_zalloc(size_t sz) { - return calloc(1, sz); + return ecalloc(1, sz); } void @@ -231,9 +245,8 @@ /* Read next command. */ el = el_gets(elptr, &cnt); - if (el == NULL) { - *lstart = '\0'; - return 0; + if (el == NULL) { /* EOF */ + exit(EXIT_SUCCESS); } /* Save to history, and copy to caller's buffer. */ @@ -255,7 +268,7 @@ /* Open a pipe to specified command, redirect output. */ assert(ofp == stdout); - for (*pcmd++ = '\0'; isspace((int)*pcmd); pcmd++) { + for (*pcmd++ = '\0'; isspace((unsigned char)*pcmd); pcmd++) { /* nothing */ } errno = 0; @@ -323,6 +336,8 @@ memf = _PATH_MEM; ofp = stdout; + setprogname(argv[0]); + /* * Parse options. */ @@ -354,31 +369,30 @@ return EXIT_FAILURE; } fd = open(nlistf, O_RDONLY); - if (fd < 0) { - err(EXIT_FAILURE, "open(%s)", nlistf); + if (fd == -1) { + err(EXIT_FAILURE, "open `%s'", nlistf); } - if (fstat(fd, &sb) < 0) { - err(EXIT_FAILURE, "stat(%s)", nlistf); + if (fstat(fd, &sb) == -1) { + err(EXIT_FAILURE, "stat `%s'", n
CVS commit: src/sys/ddb
Module Name:src Committed By: christos Date: Sun Apr 10 20:59:22 UTC 2011 Modified Files: src/sys/ddb: db_command.c db_interface.h db_proc.c Log Message: Add: usage: show proc [/a] [/p] address|pid /a == argument is an address of any lwp /p == argument is a pid [default] From: Vladimir Kirillov proger at wilab dot org dot ua To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/ddb/db_command.c cvs rdiff -u -r1.25 -r1.26 src/sys/ddb/db_interface.h cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/db_proc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ddb/db_command.c diff -u src/sys/ddb/db_command.c:1.134 src/sys/ddb/db_command.c:1.135 --- src/sys/ddb/db_command.c:1.134 Mon Sep 13 04:42:04 2010 +++ src/sys/ddb/db_command.c Sun Apr 10 16:59:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_command.c,v 1.134 2010/09/13 08:42:04 drochner Exp $ */ +/* $NetBSD: db_command.c,v 1.135 2011/04/10 20:59:22 christos Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.134 2010/09/13 08:42:04 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.135 2011/04/10 20:59:22 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_aio.h" @@ -219,10 +219,12 @@ #endif { DDB_ADD_CMD("pages", db_show_all_pages, 0 ,"List all used memory pages.",NULL,NULL) }, + { DDB_ADD_CMD("proc", db_show_proc, + 0 ,"Print process information.",NULL,NULL) }, { DDB_ADD_CMD("procs", db_show_all_procs, 0 ,"List all processes.",NULL,NULL) }, { DDB_ADD_CMD("pools", db_show_all_pools, - 0 ,"Show all poolS",NULL,NULL) }, + 0 ,"Show all pools",NULL,NULL) }, #ifdef AIO /*added from all sub cmds*/ { DDB_ADD_CMD("aio_jobs", db_show_aio_jobs, 0, Index: src/sys/ddb/db_interface.h diff -u src/sys/ddb/db_interface.h:1.25 src/sys/ddb/db_interface.h:1.26 --- src/sys/ddb/db_interface.h:1.25 Wed Feb 18 08:31:59 2009 +++ src/sys/ddb/db_interface.h Sun Apr 10 16:59:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.h,v 1.25 2009/02/18 13:31:59 yamt Exp $ */ +/* $NetBSD: db_interface.h,v 1.26 2011/04/10 20:59:22 christos Exp $ */ /*- * Copyright (c) 1995 The NetBSD Foundation, Inc. @@ -46,6 +46,7 @@ /* kern/kern_proc.c */ void db_kill_proc(db_expr_t, bool, db_expr_t, const char *); +void db_show_proc(db_expr_t, bool, db_expr_t, const char *); void db_show_all_procs(db_expr_t, bool, db_expr_t, const char *); void db_show_all_pools(db_expr_t, bool, db_expr_t, const char *); void db_show_sched_qs(db_expr_t, bool, db_expr_t, const char *); Index: src/sys/ddb/db_proc.c diff -u src/sys/ddb/db_proc.c:1.3 src/sys/ddb/db_proc.c:1.4 --- src/sys/ddb/db_proc.c:1.3 Mon Mar 9 02:07:05 2009 +++ src/sys/ddb/db_proc.c Sun Apr 10 16:59:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_proc.c,v 1.3 2009/03/09 06:07:05 mrg Exp $ */ +/* $NetBSD: db_proc.c,v 1.4 2011/04/10 20:59:22 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_proc.c,v 1.3 2009/03/09 06:07:05 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_proc.c,v 1.4 2011/04/10 20:59:22 christos Exp $"); #ifndef _KERNEL #include @@ -129,8 +129,8 @@ if (mode == NULL || *mode == 'm') { db_printf("usage: show all procs [/a] [/l] [/n] [/w]\n"); db_printf("\t/a == show process address info\n"); - db_printf("\t/l == show LWP info\n"); - db_printf("\t/n == show normal process info [default]\n"); + db_printf("\t/l == show LWP info [default]\n"); + db_printf("\t/n == show normal process info\n"); db_printf("\t/w == show process wait/emul info\n"); return; } @@ -257,3 +257,86 @@ } } +void +db_show_proc(db_expr_t addr, bool haddr, db_expr_t count, const char *modif) +{ + static proc_t p; + static lwp_t l; + const char *mode; + proc_t *pp; + lwp_t *lp; + char db_nbuf[MAXCOMLEN + 1], wbuf[MAXCOMLEN + 1]; + bool run; + int cpuno; + + if (modif[0] == 0) + mode = "p"; /* default == by pid */ + else + mode = strchr("ap", modif[0]); + + if (mode == NULL || !haddr) { + db_printf("usage: show proc [/a] [/p] address|pid\n"); + db_printf("\t/a == argument is an address of any lwp\n"); + db_printf("\t/p == argument is a pid [default]\n"); + return; + } + + switch (*mode) { + case 'a': + lp = (lwp_t *)addr; + db_printf("lwp_t %lx\n", (long)lp); + db_read_bytes((db_addr_t)lp, sizeof(l), (char *)&l); + pp = l.l_proc; + break; + default: + case 'p': + pp = db_proc_find((pid_t)addr); + lp = NULL; + break; + } + + if (pp == NULL) { + db_printf("bad address\n"); + return; + } + + db_read_bytes((db_addr_t)pp, sizeof(p), (char *)&p); + if (lp == NULL) + lp = p.p_lwps.lh_first; + + db_printf("%s: pid %d proc %lx vmspace/map %lx flags %x\n", + p.p_comm, p.p_pid, (long)pp, (long)p.p_vmspace, p.p_flag); + + while (
CVS commit: src/share/mk
Module Name:src Committed By: joerg Date: Sun Apr 10 21:03:17 UTC 2011 Modified Files: src/share/mk: bsd.own.mk Log Message: Use ?: operator to determine when to add --sysroot. Unbreaks clang bootstrap. To generate a diff of this commit: cvs rdiff -u -r1.654 -r1.655 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.654 src/share/mk/bsd.own.mk:1.655 --- src/share/mk/bsd.own.mk:1.654 Sun Apr 10 16:52:36 2011 +++ src/share/mk/bsd.own.mk Sun Apr 10 21:03:17 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.654 2011/04/10 16:52:36 joerg Exp $ +# $NetBSD: bsd.own.mk,v 1.655 2011/04/10 21:03:17 joerg Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -207,8 +207,8 @@ OBJC= false .endif -CPPFLAGS+= ${HOSTPROG:U${HOSTLIB:U${DESTDIR:D--sysroot=${DESTDIR -LDFLAGS+= ${HOSTPROG:U${HOSTLIB:U${DESTDIR:D--sysroot=${DESTDIR +CPPFLAGS+= ${!defined(HOSTPROG) && !defined(HOSTLIB) && defined(DESTDIR) :? --sysroot=${DESTDIR} :} +LDFLAGS+= ${!defined(HOSTPROG) && !defined(HOSTLIB) && defined(DESTDIR) :? --sysroot=${DESTDIR} :} .endif # EXTERNAL_TOOLCHAIN # } HOST_MKDEP= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
CVS commit: src/gnu/dist/gcc4/gcc/config
Module Name:src Committed By: joerg Date: Sun Apr 10 21:25:56 UTC 2011 Modified Files: src/gnu/dist/gcc4/gcc/config: netbsd.h Log Message: Add back a stylish new line. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/gnu/dist/gcc4/gcc/config/netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/gnu/dist/gcc4/gcc/config/netbsd.h diff -u src/gnu/dist/gcc4/gcc/config/netbsd.h:1.7 src/gnu/dist/gcc4/gcc/config/netbsd.h:1.8 --- src/gnu/dist/gcc4/gcc/config/netbsd.h:1.7 Sun Apr 10 16:50:18 2011 +++ src/gnu/dist/gcc4/gcc/config/netbsd.h Sun Apr 10 21:25:56 2011 @@ -96,6 +96,7 @@ #undef STANDARD_LIBEXEC_PREFIX #define STANDARD_LIBEXEC_PREFIX STANDARD_EXEC_PREFIX + #endif /* NETBSD_NATIVE */
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Apr 10 22:46:09 UTC 2011 Modified Files: src: UPDATING Log Message: Update this weekend's note on cleaning gcc: you need to clean binutils too. To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/UPDATING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/UPDATING diff -u src/UPDATING:1.223 src/UPDATING:1.224 --- src/UPDATING:1.223 Sun Apr 10 20:22:32 2011 +++ src/UPDATING Sun Apr 10 22:46:09 2011 @@ -1,4 +1,4 @@ -$NetBSD: UPDATING,v 1.223 2011/04/10 20:22:32 joerg Exp $ +$NetBSD: UPDATING,v 1.224 2011/04/10 22:46:09 dholland Exp $ This file (UPDATING) is intended to be a brief reference to recent changes that might cause problems in the build process, and a guide for @@ -16,9 +16,9 @@ Recent changes: ^^^ 20110410: - The configuration of src/tools/gcc has changed. Update builds - have to remove the stale content explicitly. See the note toward - the end of the file for details. + The configuration of src/tools/gcc has changed. To do an + update build you have to clean both tools/binutils and + tools/gcc by hand. 20110328: Building the Xorg binary was moved into a subdirectory to fix
CVS commit: src/usr.sbin/crash
Module Name:src Committed By: pgoyette Date: Sun Apr 10 22:49:52 UTC 2011 Modified Files: src/usr.sbin/crash: crash.8 Log Message: Synchronize -N option name in Synopsis with that in the Description To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/crash/crash.8 diff -u src/usr.sbin/crash/crash.8:1.2 src/usr.sbin/crash/crash.8:1.3 --- src/usr.sbin/crash/crash.8:1.2 Sun Mar 15 21:43:28 2009 +++ src/usr.sbin/crash/crash.8 Sun Apr 10 22:49:52 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: crash.8,v 1.2 2009/03/15 21:43:28 wiz Exp $ +.\" $NetBSD: crash.8,v 1.3 2011/04/10 22:49:52 pgoyette Exp $ .\" .\" Copyright (c) 2009 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm .Op Fl M Ar core -.Op Fl N Ar system +.Op Fl N Ar kernel .Sh DESCRIPTION The .Nm
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: dholland Date: Sun Apr 10 23:31:30 UTC 2011 Modified Files: src/tests/lib/libcurses/slave: curses_commands.c Log Message: Fix obvious bug. (note: this file still doesn't build on amd64) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/slave/curses_commands.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/curses_commands.c diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.1 src/tests/lib/libcurses/slave/curses_commands.c:1.2 --- src/tests/lib/libcurses/slave/curses_commands.c:1.1 Sun Apr 10 09:55:10 2011 +++ src/tests/lib/libcurses/slave/curses_commands.c Sun Apr 10 23:31:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.c,v 1.1 2011/04/10 09:55:10 blymn Exp $ */ +/* $NetBSD: curses_commands.c,v 1.2 2011/04/10 23:31:30 dholland Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -4442,7 +4442,7 @@ void cmd_vwprintw(int nargs, char **args) { - cmd_vwprintw(nargs, args); + cmd_vw_printw(nargs, args); }
CVS commit: src/lib/libc/sys
Module Name:src Committed By: wiz Date: Mon Apr 11 00:21:45 UTC 2011 Modified Files: src/lib/libc/sys: open.2 Log Message: exec is on a higher plane of existence. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/lib/libc/sys/open.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/open.2 diff -u src/lib/libc/sys/open.2:1.48 src/lib/libc/sys/open.2:1.49 --- src/lib/libc/sys/open.2:1.48 Sun Apr 10 15:46:15 2011 +++ src/lib/libc/sys/open.2 Mon Apr 11 00:21:45 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: open.2,v 1.48 2011/04/10 15:46:15 christos Exp $ +.\" $NetBSD: open.2,v 1.49 2011/04/11 00:21:45 wiz Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -97,7 +97,7 @@ Set the .Xr close 2 on -.Xr exec 2 +.Xr exec 3 flag. .It Dv O_DSYNC If set, write operations will be performed according to synchronized
CVS commit: src/sys
Module Name:src Committed By: dholland Date: Mon Apr 11 01:33:05 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c src/sys/nfs: nfs_serv.c nfs_srvsubs.c Log Message: kern/ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.157 -r1.158 src/sys/nfs/nfs_serv.c cvs rdiff -u -r1.9 -r1.10 src/sys/nfs/nfs_srvsubs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.132 src/sys/kern/vfs_lookup.c:1.133 --- src/sys/kern/vfs_lookup.c:1.132 Tue Mar 22 15:16:23 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:33:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.132 2011/03/22 15:16:23 pooka Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.133 2011/04/11 01:33:04 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.132 2011/03/22 15:16:23 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.133 2011/04/11 01:33:04 dholland Exp $"); #include "opt_magiclinks.h" @@ -415,9 +415,6 @@ int slashes; }; -/* XXX reorder things to make this decl unnecessary */ -static int do_lookup(struct namei_state *state, struct vnode *startdir); - /* * Initialize the namei working state. @@ -437,6 +434,21 @@ state->rdonly = 0; state->dp = NULL; state->slashes = 0; + +#ifdef DIAGNOSTIC + if (!state->cnp->cn_cred) + panic("namei: bad cred/proc"); + if (state->cnp->cn_nameiop & (~OPMASK)) + panic("namei: nameiop contaminated with flags"); + if (state->cnp->cn_flags & OPMASK) + panic("namei: flags contaminated with nameiops"); +#endif + + /* + * The buffer for name translation shall be the one inside the + * pathbuf. + */ + state->ndp->ni_pnbuf = state->ndp->ni_pathbuf->pb_path; } /* @@ -457,100 +469,101 @@ // /* - * Start up namei. Early portion. - * - * This is divided from namei_start2 by the emul_retry: point. - */ -static void -namei_start1(struct namei_state *state) -{ - -#ifdef DIAGNOSTIC - if (!state->cnp->cn_cred) - panic("namei: bad cred/proc"); - if (state->cnp->cn_nameiop & (~OPMASK)) - panic("namei: nameiop contaminated with flags"); - if (state->cnp->cn_flags & OPMASK) - panic("namei: flags contaminated with nameiops"); -#endif - - /* - * The buffer for name translation shall be the one inside the - * pathbuf. - */ - state->ndp->ni_pnbuf = state->ndp->ni_pathbuf->pb_path; -} - -/* - * Start up namei. Copy the path, find the root dir and cwd, establish - * the starting directory for lookup, and lock it. + * Get the directory context. + * Initializes the rootdir and erootdir state and returns a reference + * to the starting dir. */ -static int -namei_start2(struct namei_state *state) +static struct vnode * +namei_getstartdir(struct namei_state *state) { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; - struct cwdinfo *cwdi; /* pointer to cwd state */ struct lwp *self = curlwp; /* thread doing namei() */ + struct vnode *rootdir, *erootdir, *curdir, *startdir; - /* length includes null terminator (was originally from copyinstr) */ - ndp->ni_pathlen = strlen(ndp->ni_pnbuf) + 1; + cwdi = self->l_proc->p_cwdi; + rw_enter(&cwdi->cwdi_lock, RW_READER); - /* - * POSIX.1 requirement: "" is not a valid file name. - */ - if (ndp->ni_pathlen == 1) { - ndp->ni_vp = NULL; - return ENOENT; + /* root dir */ + if (cwdi->cwdi_rdir == NULL || (cnp->cn_flags & NOCHROOT)) { + rootdir = rootvnode; + } else { + rootdir = cwdi->cwdi_rdir; } - ndp->ni_loopcnt = 0; + /* emulation root dir, if any */ + if ((cnp->cn_flags & TRYEMULROOT) == 0) { + /* if we don't want it, don't fetch it */ + erootdir = NULL; + } else if (cnp->cn_flags & EMULROOTSET) { + /* explicitly set emulroot; "/../" doesn't override this */ + erootdir = ndp->ni_erootdir; + } else if (!strncmp(ndp->ni_pnbuf, "/../", 4)) { + /* explicit reference to real rootdir */ + erootdir = NULL; + } else { + /* may be null */ + erootdir = cwdi->cwdi_edir; + } - /* - * Get root directory for the translation. - */ - cwdi = self->l_proc->p_cwdi; - rw_enter(&cwdi->cwdi_lock, RW_READER); - state->namei_startdir = cwdi->cwdi_rdir; - if (state->namei_startdir == NULL) - state->namei_startdir = rootvnode; - ndp->ni_rootdir = state->namei_startdir; + /* current dir */ + curdir = cwdi->cwdi_cdir; - /* - * Check if starting from root directory or current directory. - */ - if (ndp->ni_pnbuf[0] == '/') { - if (cnp->cn_flags & TRYEMULROOT) { - if (cnp->cn_flags & EMULROOTSET) { -/* Called from (eg) emul_find_interp() */ -state->namei_startdir = ndp->ni_erootdir; - } else { -if (cwdi->cwdi_edir == NULL -|| (ndp->ni_pnbuf[1] == '.' - && ndp->ni_pnbuf[2] == '.' - && ndp->ni_pnbuf[3] == '/')) { - ndp->ni_er
CVS commit: src/sys/sys
Module Name:src Committed By: dholland Date: Mon Apr 11 01:33:46 UTC 2011 Modified Files: src/sys/sys: param.h Log Message: 5.99.49: you need a new nfsd module. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.385 src/sys/sys/param.h:1.386 --- src/sys/sys/param.h:1.385 Wed Mar 9 19:02:04 2011 +++ src/sys/sys/param.h Mon Apr 11 01:33:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.385 2011/03/09 19:02:04 pooka Exp $ */ +/* $NetBSD: param.h,v 1.386 2011/04/11 01:33:46 dholland Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -63,7 +63,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 599004800 /* NetBSD 5.99.48 */ +#define __NetBSD_Version__ 599004900 /* NetBSD 5.99.49 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:35:00 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.133 src/sys/kern/vfs_lookup.c:1.134 --- src/sys/kern/vfs_lookup.c:1.133 Mon Apr 11 01:33:04 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:35:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.133 2011/04/11 01:33:04 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.134 2011/04/11 01:35:00 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.133 2011/04/11 01:33:04 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.134 2011/04/11 01:35:00 dholland Exp $"); #include "opt_magiclinks.h" @@ -591,7 +591,7 @@ * appropriate. */ static int -namei_start(struct namei_state *state, int isnfsd, struct vnode *forcecwd) +namei_start(struct namei_state *state, struct vnode *forcecwd) { struct nameidata *ndp = state->ndp; @@ -609,7 +609,7 @@ ndp->ni_loopcnt = 0; /* Get starting directory, set up root, and ktrace. */ - if (isnfsd) { + if (forcecwd != NULL) { state->namei_startdir = namei_getstartdir_for_nfsd(state, forcecwd); /* no ktrace */ @@ -645,7 +645,7 @@ * Follow a symlink. */ static inline int -namei_follow(struct namei_state *state) +namei_follow(struct namei_state *state, int inhibitmagic) { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; @@ -690,8 +690,11 @@ /* * Do symlink substitution, if appropriate, and * check length for potential overflow. + * + * Inhibit symlink substitution for nfsd. + * XXX: This is how it was before; is that a bug or a feature? */ - if ((vfs_magiclinks && + if ((!inhibitmagic && vfs_magiclinks && symlink_magic(self->l_proc, cp, &linklen)) || (linklen + ndp->ni_pathlen >= MAXPATHLEN)) { PNBUF_PUT(cp); @@ -1230,7 +1233,8 @@ // static int -do_namei(struct namei_state *state) +do_namei(struct namei_state *state, struct vnode *forcecwd, + int neverfollow, int inhibitmagic) { int error; @@ -1253,7 +1257,7 @@ savepath = NULL; } - error = namei_start(state, 0/*not nfsd*/, NULL); + error = namei_start(state, forcecwd); if (error) { if (savepath != NULL) { pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); @@ -1302,7 +1306,11 @@ * aren't supposed to. */ if (namei_atsymlink(state)) { - error = namei_follow(state); + if (neverfollow) { +error = EINVAL; + } else { +error = namei_follow(state, inhibitmagic); + } if (error) { KASSERT(ndp->ni_dvp != ndp->ni_vp); vput(ndp->ni_dvp); @@ -1349,7 +1357,7 @@ int error; namei_init(&state, ndp); - error = do_namei(&state); + error = do_namei(&state, NULL, 0/*!neverfollow*/, 0/*!inhibitmagic*/); namei_cleanup(&state); return error; @@ -1366,122 +1374,70 @@ * affecting the other. */ -int -lookup_for_nfsd(struct nameidata *ndp, struct vnode *dp, int neverfollow) +static int +do_lookup_for_nfsd(struct namei_state *state, struct vnode *forcecwd, + int neverfollow, int inhibitmagic) { - struct namei_state state; int error; - struct iovec aiov; - struct uio auio; - int linklen; - char *cp; - - namei_init(&state, ndp); + struct nameidata *ndp = state->ndp; + //struct componentname *cnp = state->cnp; - namei_start(&state, 1/*nfsd*/, dp); + error = namei_start(state, forcecwd); + if (error) { + return error; + } for (;;) { - error = do_lookup(&state, dp); + error = do_lookup(state, state->namei_startdir); if (error) { - /* BEGIN from nfsd */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } - /* END from nfsd */ - namei_cleanup(&state); return error; } /* - * BEGIN wodge of code from nfsd - */ - - /* * Check for encountering a symbolic link */ - if ((state.cnp->cn_flags & ISSYMLINK) == 0) { - if ((state.cnp->cn_flags & LOCKPARENT) == 0 && state.ndp->ni_dvp) { - if (state.ndp->ni_dvp == state.ndp->ni_vp) { -vrele(state.ndp->ni_dvp); - } else { -vput(state.ndp->ni_dvp); - } - } - return (0); - } else { + if (namei_atsymlink(state)) { if (neverfollow) { error = EINVAL; - goto out; - } - if (state.ndp->ni_loopcnt++ >= MAXSYMLINKS) { - error = ELOOP; - goto out; - } - if (state.ndp->ni_vp->v_mount->mnt_flag & MNT_SYMPERM) { - error = VOP_ACCESS(ndp->ni_vp, VEXEC, state.cnp->cn_cred); - if (error != 0) -goto out; - } - cp = PNBUF_GET(); - aiov.iov_base = cp; - aiov.iov_len = MAXPATHLEN; - auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - auio.uio_offset = 0; - auio.uio_rw = UIO_READ; - auio.uio_resid = MAXPATHLEN; -
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:35:55 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.134 src/sys/kern/vfs_lookup.c:1.135 --- src/sys/kern/vfs_lookup.c:1.134 Mon Apr 11 01:35:00 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:35:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.134 2011/04/11 01:35:00 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.134 2011/04/11 01:35:00 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 dholland Exp $"); #include "opt_magiclinks.h" @@ -1372,72 +1372,21 @@ * called from a different place in a different context. For now I * want to be able to shuffle code in from one call site without * affecting the other. + * + * It turns out that the "main" version was a cut and pasted copy of + * namei with a few changes; the "index" version on the other hand + * always takes a single component and is an elaborate form of calling + * VOP_LOOKUP once. */ -static int -do_lookup_for_nfsd(struct namei_state *state, struct vnode *forcecwd, - int neverfollow, int inhibitmagic) -{ - int error; - - struct nameidata *ndp = state->ndp; - //struct componentname *cnp = state->cnp; - - error = namei_start(state, forcecwd); - if (error) { - return error; - } - -for (;;) { - - error = do_lookup(state, state->namei_startdir); - - if (error) { - if (ndp->ni_dvp) { - vput(ndp->ni_dvp); - } - return error; - } - - /* - * Check for encountering a symbolic link - */ - if (namei_atsymlink(state)) { - if (neverfollow) { - error = EINVAL; - } else { - error = namei_follow(state, inhibitmagic); - } - if (error) { - KASSERT(ndp->ni_dvp != ndp->ni_vp); - vput(state->ndp->ni_vp); - vput(state->ndp->ni_dvp); - state->ndp->ni_vp = NULL; - return error; - } - } else { - break; - } -} - -if ((state->cnp->cn_flags & LOCKPARENT) == 0 && state->ndp->ni_dvp) { - if (state->ndp->ni_dvp == state->ndp->ni_vp) { - vrele(state->ndp->ni_dvp); - } else { - vput(state->ndp->ni_dvp); - } -} -return (0); -} - int -lookup_for_nfsd(struct nameidata *ndp, struct vnode *dp, int neverfollow) +lookup_for_nfsd(struct nameidata *ndp, struct vnode *forcecwd, int neverfollow) { struct namei_state state; int error; namei_init(&state, ndp); - error = do_lookup_for_nfsd(&state, dp, neverfollow, 1/*inhibitmagic*/); + error = do_namei(&state, forcecwd, neverfollow, 1/*inhibitmagic*/); namei_cleanup(&state); return error; @@ -1450,8 +1399,8 @@ int error; /* - * Note: the name sent in here is not/should not be allowed to - * contain a slash. + * Note: the name sent in here (is not|should not be) allowed + * to contain a slash. */ ndp->ni_pathlen = strlen(ndp->ni_pathbuf->pb_path) + 1;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:36:28 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.135 src/sys/kern/vfs_lookup.c:1.136 --- src/sys/kern/vfs_lookup.c:1.135 Mon Apr 11 01:35:55 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:36:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.136 2011/04/11 01:36:28 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.135 2011/04/11 01:35:55 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.136 2011/04/11 01:36:28 dholland Exp $"); #include "opt_magiclinks.h" @@ -1392,6 +1392,62 @@ return error; } +static int +do_lookup_for_nfsd_index(struct namei_state *state, struct vnode *startdir) +{ + int error = 0; + + struct componentname *cnp = state->cnp; + struct nameidata *ndp = state->ndp; + const char *cp; /* pointer into pathname argument */ + + KASSERT(cnp == &ndp->ni_cnd); + + cnp->cn_nameptr = ndp->ni_pnbuf; + state->lookup_alldone = 0; + state->docache = 1; + state->rdonly = cnp->cn_flags & RDONLY; + ndp->ni_dvp = NULL; + cnp->cn_flags &= ~ISSYMLINK; + state->dp = startdir; + + cnp->cn_consume = 0; + cp = NULL; + cnp->cn_hash = namei_hash(cnp->cn_nameptr, &cp); + cnp->cn_namelen = cp - cnp->cn_nameptr; + KASSERT(cnp->cn_namelen <= NAME_MAX); + ndp->ni_pathlen -= cnp->cn_namelen; + ndp->ni_next = cp; + state->slashes = 0; + cnp->cn_flags &= ~REQUIREDIR; + cnp->cn_flags |= MAKEENTRY|ISLASTCN; + + if (cnp->cn_namelen == 2 && + cnp->cn_nameptr[1] == '.' && cnp->cn_nameptr[0] == '.') + cnp->cn_flags |= ISDOTDOT; + else + cnp->cn_flags &= ~ISDOTDOT; + + error = lookup_once(state); + if (error) { + goto bad; + } + // XXX ought to be able to avoid this case too + if (state->lookup_alldone) { + /* this should NOT be "goto terminal;" */ + return 0; + } + + if ((cnp->cn_flags & LOCKLEAF) == 0) { + VOP_UNLOCK(state->dp); + } + return (0); + +bad: + ndp->ni_vp = NULL; + return (error); +} + int lookup_for_nfsd_index(struct nameidata *ndp, struct vnode *startdir) { @@ -1402,6 +1458,12 @@ * Note: the name sent in here (is not|should not be) allowed * to contain a slash. */ + if (strlen(ndp->ni_pathbuf->pb_path) > NAME_MAX) { + return ENAMETOOLONG; + } + if (strchr(ndp->ni_pathbuf->pb_path, '/')) { + return EINVAL; + } ndp->ni_pathlen = strlen(ndp->ni_pathbuf->pb_path) + 1; ndp->ni_pnbuf = NULL; @@ -1410,7 +1472,7 @@ vref(startdir); namei_init(&state, ndp); - error = do_lookup(&state, startdir); + error = do_lookup_for_nfsd_index(&state, startdir); namei_cleanup(&state); return error;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:36:59 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.136 src/sys/kern/vfs_lookup.c:1.137 --- src/sys/kern/vfs_lookup.c:1.136 Mon Apr 11 01:36:28 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:36:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.136 2011/04/11 01:36:28 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.137 2011/04/11 01:36:59 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.136 2011/04/11 01:36:28 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.137 2011/04/11 01:36:59 dholland Exp $"); #include "opt_magiclinks.h" @@ -413,6 +413,8 @@ int rdonly; /* lookup read-only flag bit */ struct vnode *dp; /* the directory we are searching */ int slashes; + + unsigned attempt_retry:1; /* true if error allows emul retry */ }; @@ -1233,35 +1235,15 @@ // static int -do_namei(struct namei_state *state, struct vnode *forcecwd, +namei_oneroot(struct namei_state *state, struct vnode *forcecwd, int neverfollow, int inhibitmagic) { - int error; - struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; - const char *savepath = NULL; - - KASSERT(cnp == &ndp->ni_cnd); - - if (cnp->cn_flags & TRYEMULROOT) { - savepath = pathbuf_stringcopy_get(ndp->ni_pathbuf); - } - -emul_retry: - - if (savepath != NULL) { - /* kinda gross */ - strcpy(ndp->ni_pathbuf->pb_path, savepath); - pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); - savepath = NULL; - } + int error; error = namei_start(state, forcecwd); if (error) { - if (savepath != NULL) { - pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); - } return error; } @@ -1275,9 +1257,6 @@ * XXX: should this also check if it's unlinked? */ if (state->namei_startdir->v_mount == NULL) { - if (savepath != NULL) { -pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); - } namei_end(state); return (ENOENT); } @@ -1292,12 +1271,16 @@ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } - if (ndp->ni_erootdir != NULL) { -/* Retry the whole thing from the normal root */ -cnp->cn_flags &= ~TRYEMULROOT; -goto emul_retry; - } - KASSERT(savepath == NULL); + /* + * Note that if we're doing TRYEMULROOT we can + * retry with the normal root. Setting this + * here matches previous practice, but the + * previous practice didn't make much sense + * and somebody should sit down and figure out + * which cases should cause retry and which + * shouldn't. XXX. + */ + state->attempt_retry = 1; return (error); } @@ -1316,9 +1299,6 @@ vput(ndp->ni_dvp); vput(ndp->ni_vp); ndp->ni_vp = NULL; -if (savepath != NULL) { - pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); -} return error; } } @@ -1343,11 +1323,52 @@ ndp->ni_dvp = NULL; } + return 0; +} + +static int +namei_tryemulroot(struct namei_state *state, struct vnode *forcecwd, + int neverfollow, int inhibitmagic) +{ + int error; + + struct nameidata *ndp = state->ndp; + struct componentname *cnp = state->cnp; + const char *savepath = NULL; + + KASSERT(cnp == &ndp->ni_cnd); + + if (cnp->cn_flags & TRYEMULROOT) { + savepath = pathbuf_stringcopy_get(ndp->ni_pathbuf); + } + +emul_retry: + state->attempt_retry = 0; + + error = namei_oneroot(state, forcecwd, neverfollow, inhibitmagic); + if (error) { + /* + * Once namei has started up, the existence of ni_erootdir + * tells us whether we're working from an emulation root. + * The TRYEMULROOT flag isn't necessarily authoritative. + */ + if (ndp->ni_erootdir != NULL && state->attempt_retry) { + /* Retry the whole thing using the normal root */ + cnp->cn_flags &= ~TRYEMULROOT; + state->attempt_retry = 0; + + /* kinda gross */ + strcpy(ndp->ni_pathbuf->pb_path, savepath); + pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); + savepath = NULL; + + goto emul_retry; + } + } if (savepath != NULL) { pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath); } - - return 0; + return error; } int @@ -1357,7 +1378,8 @@ int error; namei_init(&state, ndp); - error = do_namei(&state, NULL, 0/*!neverfollow*/, 0/*!inhibitmagic*/); + error = namei_tryemulroot(&state, NULL, + 0/*!neverfollow*/, 0/*!inhibitmagic*/); namei_cleanup(&state); return error; @@ -1386,7 +1408,8 @@ int error; namei_init(&state, ndp); - error = do_namei(&state, forcecwd, neverfollow, 1/*inhibitmagic*/); + error = namei_tryemulroot(&state, forcecwd, + neve
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:37:14 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.137 src/sys/kern/vfs_lookup.c:1.138 --- src/sys/kern/vfs_lookup.c:1.137 Mon Apr 11 01:36:59 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:37:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.137 2011/04/11 01:36:59 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.138 2011/04/11 01:37:14 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.137 2011/04/11 01:36:59 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.138 2011/04/11 01:37:14 dholland Exp $"); #include "opt_magiclinks.h" @@ -415,6 +415,7 @@ int slashes; unsigned attempt_retry:1; /* true if error allows emul retry */ + unsigned lookup_terminal:1; /* flag returned from lookup */ }; @@ -1093,145 +1094,6 @@ return 0; } -static int -do_lookup(struct namei_state *state, struct vnode *startdir) -{ - int error = 0; - - struct componentname *cnp = state->cnp; - struct nameidata *ndp = state->ndp; - - KASSERT(cnp == &ndp->ni_cnd); - - cnp->cn_nameptr = ndp->ni_pnbuf; - - error = lookup_start(state, startdir); - if (error) { - goto bad; - } - // XXX: this case should not be necessary given proper handling - // of slashes elsewhere. - if (state->lookup_alldone) { - goto terminal; - } - -dirloop: - error = lookup_parsepath(state); - if (error) { - goto bad; - } - - error = lookup_once(state); - if (error) { - goto bad; - } - // XXX ought to be able to avoid this case too - if (state->lookup_alldone) { - /* this should NOT be "goto terminal;" */ - return 0; - } - - /* - * Check for symbolic link. Back up over any slashes that we skipped, - * as we will need them again. - */ - if ((state->dp->v_type == VLNK) && (cnp->cn_flags & (FOLLOW|REQUIREDIR))) { - ndp->ni_pathlen += state->slashes; - ndp->ni_next -= state->slashes; - cnp->cn_flags |= ISSYMLINK; - return (0); - } - - /* - * Check for directory, if the component was followed by a series of - * slashes. - */ - if ((state->dp->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { - error = ENOTDIR; - KASSERT(state->dp != ndp->ni_dvp); - vput(state->dp); - goto bad; - } - - /* - * Not a symbolic link. If this was not the last component, then - * continue at the next component, else return. - */ - if (!(cnp->cn_flags & ISLASTCN)) { - cnp->cn_nameptr = ndp->ni_next; - if (ndp->ni_dvp == state->dp) { - vrele(ndp->ni_dvp); - } else { - vput(ndp->ni_dvp); - } - goto dirloop; - } - -terminal: - if (state->dp == ndp->ni_erootdir) { - /* - * We are about to return the emulation root. - * This isn't a good idea because code might repeatedly - * lookup ".." until the file matches that returned - * for "/" and loop forever. - * So convert it to the real root. - */ - if (ndp->ni_dvp == state->dp) - vrele(state->dp); - else - if (ndp->ni_dvp != NULL) -vput(ndp->ni_dvp); - ndp->ni_dvp = NULL; - vput(state->dp); - state->dp = ndp->ni_rootdir; - vref(state->dp); - vn_lock(state->dp, LK_EXCLUSIVE | LK_RETRY); - ndp->ni_vp = state->dp; - } - - /* - * If the caller requested the parent node (i.e. - * it's a CREATE, DELETE, or RENAME), and we don't have one - * (because this is the root directory), then we must fail. - */ - if (ndp->ni_dvp == NULL && cnp->cn_nameiop != LOOKUP) { - switch (cnp->cn_nameiop) { - case CREATE: - error = EEXIST; - break; - case DELETE: - case RENAME: - error = EBUSY; - break; - default: - KASSERT(0); - } - vput(state->dp); - goto bad; - } - - /* - * Disallow directory write attempts on read-only lookups. - * Prefers EEXIST over EROFS for the CREATE case. - */ - if (state->rdonly && - (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { - error = EROFS; - if (state->dp != ndp->ni_dvp) { - vput(state->dp); - } - goto bad; - } - if ((cnp->cn_flags & LOCKLEAF) == 0) { - VOP_UNLOCK(state->dp); - } - return (0); - -bad: - ndp->ni_vp = NULL; - return (error); -} - // static int @@ -1265,7 +1127,91 @@ * Look up the next path component. * (currently, this may consume more than one) */ - error = do_lookup(state, state->namei_startdir); + cnp->cn_nameptr = ndp->ni_pnbuf; + + error = lookup_start(state, state->namei_startdir); + if (error) { + ndp->ni_vp = NULL; + return (error); + } + + // XXX: this case should not be necessary given proper handling + // of slashes elsewhere. + if (state->lookup_alldone) { + state->lookup_terminal = 1; + error = 0; + } else { + + dirloop:
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:37:43 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.138 src/sys/kern/vfs_lookup.c:1.139 --- src/sys/kern/vfs_lookup.c:1.138 Mon Apr 11 01:37:14 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:37:43 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.138 2011/04/11 01:37:14 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.138 2011/04/11 01:37:14 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $"); #include "opt_magiclinks.h" @@ -415,7 +415,6 @@ int slashes; unsigned attempt_retry:1; /* true if error allows emul retry */ - unsigned lookup_terminal:1; /* flag returned from lookup */ }; @@ -641,7 +640,8 @@ static inline int namei_atsymlink(struct namei_state *state) { - return (state->cnp->cn_flags & ISSYMLINK) != 0; + return (state->dp->v_type == VLNK) && + (state->cnp->cn_flags & (FOLLOW|REQUIREDIR)); } /* @@ -775,67 +775,6 @@ * if LOCKPARENT set, return locked parent in ni_dvp */ -/* - * Begin lookup(). - */ -static int -lookup_start(struct namei_state *state, struct vnode *startdir) -{ - const char *cp; /* pointer into pathname argument */ - - struct componentname *cnp = state->cnp; - struct nameidata *ndp = state->ndp; - - KASSERT(cnp == &ndp->ni_cnd); - - state->lookup_alldone = 0; - state->dp = NULL; - - /* - * Setup: break out flag bits into variables. - */ - state->docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; - if (cnp->cn_nameiop == DELETE) - state->docache = 0; - state->rdonly = cnp->cn_flags & RDONLY; - ndp->ni_dvp = NULL; - cnp->cn_flags &= ~ISSYMLINK; - state->dp = startdir; - - /* - * If we have a leading string of slashes, remove them, and just make - * sure the current node is a directory. - */ - cp = cnp->cn_nameptr; - if (*cp == '/') { - do { - cp++; - } while (*cp == '/'); - ndp->ni_pathlen -= cp - cnp->cn_nameptr; - cnp->cn_nameptr = cp; - - if (state->dp->v_type != VDIR) { - vput(state->dp); - return ENOTDIR; - } - - /* - * If we've exhausted the path name, then just return the - * current node. - */ - if (cnp->cn_nameptr[0] == '\0') { - ndp->ni_vp = state->dp; - cnp->cn_flags |= ISLASTCN; - - /* bleh */ - state->lookup_alldone = 1; - return 0; - } - } - - return 0; -} - static int lookup_parsepath(struct namei_state *state) { @@ -1102,6 +1041,7 @@ { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; + const char *cp; int error; error = namei_start(state, forcecwd); @@ -1110,8 +1050,17 @@ } /* + * Setup: break out flag bits into variables. + */ + state->docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; + if (cnp->cn_nameiop == DELETE) + state->docache = 0; + state->rdonly = cnp->cn_flags & RDONLY; + + /* * Keep going until we run out of path components. */ + cnp->cn_nameptr = ndp->ni_pnbuf; for (;;) { /* @@ -1127,190 +1076,98 @@ * Look up the next path component. * (currently, this may consume more than one) */ - cnp->cn_nameptr = ndp->ni_pnbuf; - - error = lookup_start(state, state->namei_startdir); - if (error) { - ndp->ni_vp = NULL; - return (error); - } - // XXX: this case should not be necessary given proper handling - // of slashes elsewhere. - if (state->lookup_alldone) { - state->lookup_terminal = 1; - error = 0; - } else { - - dirloop: - error = lookup_parsepath(state); - if (error) { -state->lookup_terminal = 0; -ndp->ni_vp = NULL; -goto lookup_out; - } + state->lookup_alldone = 0; - error = lookup_once(state); - if (error) { -state->lookup_terminal = 0; -ndp->ni_vp = NULL; -goto lookup_out; - } - // XXX ought to be able to avoid this case too - if (state->lookup_alldone) { -/* this should NOT set lookup_terminal */ -state->lookup_terminal = 0; -error = 0; -goto lookup_out; - } + ndp->ni_dvp = NULL; + cnp->cn_flags &= ~ISSYMLINK; + state->dp = state->namei_startdir; - /* - * Check for symbolic link. Back up over any - * slashes that we skipped, as we will need - * them again. - */ - if ((state->dp->v_type == VLNK) && (cnp->cn_flags & (FOLLOW|REQUIREDIR))) { -ndp->ni_pathlen += state->slashes; -ndp->ni_next -= state->slashes; -cnp->cn_flags |= ISSYMLINK; -state->lookup_terminal = 0; -error = 0; -goto lookup_out; - } +dirloop: + /* + * If we have a leading string of slashes, remove + * the
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:38:10 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.139 src/sys/kern/vfs_lookup.c:1.140 --- src/sys/kern/vfs_lookup.c:1.139 Mon Apr 11 01:37:43 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:38:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $"); #include "opt_magiclinks.h" @@ -593,9 +593,11 @@ * appropriate. */ static int -namei_start(struct namei_state *state, struct vnode *forcecwd) +namei_start(struct namei_state *state, struct vnode *forcecwd, + struct vnode **startdir_ret) { struct nameidata *ndp = state->ndp; + struct vnode *startdir; /* length includes null terminator (was originally from copyinstr) */ ndp->ni_pathlen = strlen(ndp->ni_pnbuf) + 1; @@ -612,16 +614,16 @@ /* Get starting directory, set up root, and ktrace. */ if (forcecwd != NULL) { - state->namei_startdir = namei_getstartdir_for_nfsd(state, - forcecwd); + startdir = namei_getstartdir_for_nfsd(state, forcecwd); /* no ktrace */ } else { - state->namei_startdir = namei_getstartdir(state); + startdir = namei_getstartdir(state); namei_ktrace(state); } - vn_lock(state->namei_startdir, LK_EXCLUSIVE | LK_RETRY); + vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY); + *startdir_ret = startdir; return 0; } @@ -1044,7 +1046,7 @@ const char *cp; int error; - error = namei_start(state, forcecwd); + error = namei_start(state, forcecwd, &state->namei_startdir); if (error) { return error; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:38:24 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.140 src/sys/kern/vfs_lookup.c:1.141 --- src/sys/kern/vfs_lookup.c:1.140 Mon Apr 11 01:38:10 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:38:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.141 2011/04/11 01:38:24 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.141 2011/04/11 01:38:24 dholland Exp $"); #include "opt_magiclinks.h" @@ -650,7 +650,9 @@ * Follow a symlink. */ static inline int -namei_follow(struct namei_state *state, int inhibitmagic) +namei_follow(struct namei_state *state, int inhibitmagic, + struct vnode *searchdir, + struct vnode **newsearchdir_ret) { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; @@ -715,26 +717,27 @@ memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen); PNBUF_PUT(cp); vput(ndp->ni_vp); - state->namei_startdir = ndp->ni_dvp; + searchdir = ndp->ni_dvp; /* * Check if root directory should replace current directory. */ if (ndp->ni_pnbuf[0] == '/') { - vput(state->namei_startdir); + vput(searchdir); /* Keep absolute symbolic links inside emulation root */ - state->namei_startdir = ndp->ni_erootdir; - if (state->namei_startdir == NULL || + searchdir = ndp->ni_erootdir; + if (searchdir == NULL || (ndp->ni_pnbuf[1] == '.' && ndp->ni_pnbuf[2] == '.' && ndp->ni_pnbuf[3] == '/')) { ndp->ni_erootdir = NULL; - state->namei_startdir = ndp->ni_rootdir; + searchdir = ndp->ni_rootdir; } - vref(state->namei_startdir); - vn_lock(state->namei_startdir, LK_EXCLUSIVE | LK_RETRY); + vref(searchdir); + vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); } + *newsearchdir_ret = searchdir; return 0; } @@ -1173,7 +1176,9 @@ if (neverfollow) { error = EINVAL; } else { -error = namei_follow(state, inhibitmagic); +error = namei_follow(state, inhibitmagic, + state->namei_startdir, + &state->namei_startdir); } if (error) { KASSERT(ndp->ni_dvp != ndp->ni_vp);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:38:47 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.141 src/sys/kern/vfs_lookup.c:1.142 --- src/sys/kern/vfs_lookup.c:1.141 Mon Apr 11 01:38:24 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:38:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.141 2011/04/11 01:38:24 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.142 2011/04/11 01:38:47 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.141 2011/04/11 01:38:24 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.142 2011/04/11 01:38:47 dholland Exp $"); #include "opt_magiclinks.h" @@ -717,7 +717,6 @@ memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen); PNBUF_PUT(cp); vput(ndp->ni_vp); - searchdir = ndp->ni_dvp; /* * Check if root directory should replace current directory. @@ -1176,6 +1175,7 @@ if (neverfollow) { error = EINVAL; } else { +state->namei_startdir = ndp->ni_dvp; error = namei_follow(state, inhibitmagic, state->namei_startdir, &state->namei_startdir);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:39:13 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.142 src/sys/kern/vfs_lookup.c:1.143 --- src/sys/kern/vfs_lookup.c:1.142 Mon Apr 11 01:38:47 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:39:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.142 2011/04/11 01:38:47 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.143 2011/04/11 01:39:13 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.142 2011/04/11 01:38:47 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.143 2011/04/11 01:39:13 dholland Exp $"); #include "opt_magiclinks.h" @@ -805,8 +805,6 @@ cnp->cn_hash = namei_hash(cnp->cn_nameptr, &cp); cnp->cn_namelen = cp - cnp->cn_nameptr; if (cnp->cn_namelen > NAME_MAX) { - vput(state->dp); - ndp->ni_dvp = NULL; return ENAMETOOLONG; } #ifdef NAMEI_DIAGNOSTIC @@ -1127,6 +1125,8 @@ error = lookup_parsepath(state); if (error) { + vput(state->dp); + ndp->ni_dvp = NULL; ndp->ni_vp = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) {
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:39:29 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.143 src/sys/kern/vfs_lookup.c:1.144 --- src/sys/kern/vfs_lookup.c:1.143 Mon Apr 11 01:39:13 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:39:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.143 2011/04/11 01:39:13 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.144 2011/04/11 01:39:28 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.143 2011/04/11 01:39:13 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.144 2011/04/11 01:39:28 dholland Exp $"); #include "opt_magiclinks.h" @@ -640,9 +640,9 @@ * Check for being at a symlink. */ static inline int -namei_atsymlink(struct namei_state *state) +namei_atsymlink(struct namei_state *state, struct vnode *foundobj) { - return (state->dp->v_type == VLNK) && + return (foundobj->v_type == VLNK) && (state->cnp->cn_flags & (FOLLOW|REQUIREDIR)); } @@ -1168,7 +1168,7 @@ * over any slashes that we skipped, as we will need * them again. */ - if (namei_atsymlink(state)) { + if (namei_atsymlink(state, state->dp)) { ndp->ni_pathlen += state->slashes; ndp->ni_next -= state->slashes; cnp->cn_flags |= ISSYMLINK;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:39:46 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.144 src/sys/kern/vfs_lookup.c:1.145 --- src/sys/kern/vfs_lookup.c:1.144 Mon Apr 11 01:39:28 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:39:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.144 2011/04/11 01:39:28 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.145 2011/04/11 01:39:46 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.144 2011/04/11 01:39:28 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.145 2011/04/11 01:39:46 dholland Exp $"); #include "opt_magiclinks.h" @@ -1043,6 +1043,7 @@ { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; + struct vnode *searchdir; const char *cp; int error; @@ -1083,7 +1084,7 @@ ndp->ni_dvp = NULL; cnp->cn_flags &= ~ISSYMLINK; - state->dp = state->namei_startdir; + searchdir = state->namei_startdir; dirloop: /* @@ -1099,8 +1100,8 @@ ndp->ni_pathlen -= cp - cnp->cn_nameptr; cnp->cn_nameptr = cp; - if (state->dp->v_type != VDIR) { -vput(state->dp); + if (searchdir->v_type != VDIR) { +vput(searchdir); ndp->ni_vp = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) { @@ -1116,16 +1117,18 @@ * current node. */ if (cnp->cn_nameptr[0] == '\0') { - ndp->ni_vp = state->dp; + ndp->ni_vp = searchdir; cnp->cn_flags |= ISLASTCN; + /* XXX this conflates searchdir/foundobj wrongly */ + /* bleh */ goto terminal; } error = lookup_parsepath(state); if (error) { - vput(state->dp); + vput(searchdir); ndp->ni_dvp = NULL; ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1136,7 +1139,10 @@ return (error); } + state->dp = searchdir; error = lookup_once(state); + /* XXX here and below searchdir is really "foundobj" */ + searchdir = state->dp; if (error) { ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1168,7 +1174,7 @@ * over any slashes that we skipped, as we will need * them again. */ - if (namei_atsymlink(state, state->dp)) { + if (namei_atsymlink(state, searchdir)) { ndp->ni_pathlen += state->slashes; ndp->ni_next -= state->slashes; cnp->cn_flags |= ISSYMLINK; @@ -1195,9 +1201,9 @@ * Check for directory, if the component was * followed by a series of slashes. */ - if ((state->dp->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { - KASSERT(state->dp != ndp->ni_dvp); - vput(state->dp); + if ((searchdir->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { + KASSERT(searchdir != ndp->ni_dvp); + vput(searchdir); ndp->ni_vp = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) { @@ -1214,18 +1220,20 @@ */ if (!(cnp->cn_flags & ISLASTCN)) { cnp->cn_nameptr = ndp->ni_next; - if (ndp->ni_dvp == state->dp) { + if (ndp->ni_dvp == searchdir) { vrele(ndp->ni_dvp); } else { vput(ndp->ni_dvp); } ndp->ni_dvp = NULL; + /* XXX notyet */ + //searchdir = foundobj; goto dirloop; } terminal: error = 0; - if (state->dp == ndp->ni_erootdir) { + if (searchdir == ndp->ni_erootdir) { /* * We are about to return the emulation root. * This isn't a good idea because code might @@ -1233,17 +1241,17 @@ * matches that returned for "/" and loop * forever. So convert it to the real root. */ - if (ndp->ni_dvp == state->dp) -vrele(state->dp); + if (ndp->ni_dvp == searchdir) +vrele(searchdir); else if (ndp->ni_dvp != NULL) vput(ndp->ni_dvp); ndp->ni_dvp = NULL; - vput(state->dp); - state->dp = ndp->ni_rootdir; - vref(state->dp); - vn_lock(state->dp, LK_EXCLUSIVE | LK_RETRY); - ndp->ni_vp = state->dp; + vput(searchdir); + searchdir = ndp->ni_rootdir; + vref(searchdir); + vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); + ndp->ni_vp = searchdir; } /* @@ -1264,8 +1272,8 @@ default: KASSERT(0); } - vput(state->dp); - ndp->ni_vp = NULL; + vput(searchdir); + searchdir = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); @@ -1281,8 +1289,8 @@ if (state->rdonly && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { error = EROFS; - if (state->dp != ndp->ni_dvp) { -vput(state->dp); + if (searchdir != ndp->ni_dvp) { +vput(searchdir); } ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1293,7 +1301,7 @@ return (error);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:40:01 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.145 -r1.146 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.145 src/sys/kern/vfs_lookup.c:1.146 --- src/sys/kern/vfs_lookup.c:1.145 Mon Apr 11 01:39:46 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:40:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.145 2011/04/11 01:39:46 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.146 2011/04/11 01:40:01 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.145 2011/04/11 01:39:46 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.146 2011/04/11 01:40:01 dholland Exp $"); #include "opt_magiclinks.h" @@ -1043,7 +1043,7 @@ { struct nameidata *ndp = state->ndp; struct componentname *cnp = state->cnp; - struct vnode *searchdir; + struct vnode *searchdir, *foundobj; const char *cp; int error; @@ -1117,11 +1117,10 @@ * current node. */ if (cnp->cn_nameptr[0] == '\0') { - ndp->ni_vp = searchdir; + foundobj = searchdir; + ndp->ni_vp = foundobj; cnp->cn_flags |= ISLASTCN; - /* XXX this conflates searchdir/foundobj wrongly */ - /* bleh */ goto terminal; } @@ -1141,8 +1140,7 @@ state->dp = searchdir; error = lookup_once(state); - /* XXX here and below searchdir is really "foundobj" */ - searchdir = state->dp; + foundobj = state->dp; if (error) { ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1174,7 +1172,7 @@ * over any slashes that we skipped, as we will need * them again. */ - if (namei_atsymlink(state, searchdir)) { + if (namei_atsymlink(state, foundobj)) { ndp->ni_pathlen += state->slashes; ndp->ni_next -= state->slashes; cnp->cn_flags |= ISSYMLINK; @@ -1201,9 +1199,9 @@ * Check for directory, if the component was * followed by a series of slashes. */ - if ((searchdir->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { - KASSERT(searchdir != ndp->ni_dvp); - vput(searchdir); + if ((foundobj->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { + KASSERT(foundobj != ndp->ni_dvp); + vput(foundobj); ndp->ni_vp = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) { @@ -1220,20 +1218,19 @@ */ if (!(cnp->cn_flags & ISLASTCN)) { cnp->cn_nameptr = ndp->ni_next; - if (ndp->ni_dvp == searchdir) { + if (ndp->ni_dvp == foundobj) { vrele(ndp->ni_dvp); } else { vput(ndp->ni_dvp); } ndp->ni_dvp = NULL; - /* XXX notyet */ - //searchdir = foundobj; + searchdir = foundobj; goto dirloop; } terminal: error = 0; - if (searchdir == ndp->ni_erootdir) { + if (foundobj == ndp->ni_erootdir) { /* * We are about to return the emulation root. * This isn't a good idea because code might @@ -1241,17 +1238,17 @@ * matches that returned for "/" and loop * forever. So convert it to the real root. */ - if (ndp->ni_dvp == searchdir) -vrele(searchdir); + if (ndp->ni_dvp == foundobj) +vrele(foundobj); else if (ndp->ni_dvp != NULL) vput(ndp->ni_dvp); ndp->ni_dvp = NULL; - vput(searchdir); - searchdir = ndp->ni_rootdir; - vref(searchdir); - vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); - ndp->ni_vp = searchdir; + vput(foundobj); + foundobj = ndp->ni_rootdir; + vref(foundobj); + vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); + ndp->ni_vp = foundobj; } /* @@ -1272,8 +1269,8 @@ default: KASSERT(0); } - vput(searchdir); - searchdir = NULL; + vput(foundobj); + foundobj = NULL; /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); @@ -1289,8 +1286,8 @@ if (state->rdonly && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { error = EROFS; - if (searchdir != ndp->ni_dvp) { -vput(searchdir); + if (foundobj != ndp->ni_dvp) { +vput(foundobj); } ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1301,7 +1298,7 @@ return (error); } if ((cnp->cn_flags & LOCKLEAF) == 0) { - VOP_UNLOCK(searchdir); + VOP_UNLOCK(foundobj); } break;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 01:40:14 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: ZZmsg To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.146 src/sys/kern/vfs_lookup.c:1.147 --- src/sys/kern/vfs_lookup.c:1.146 Mon Apr 11 01:40:01 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 01:40:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.146 2011/04/11 01:40:01 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.147 2011/04/11 01:40:13 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.146 2011/04/11 01:40:01 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.147 2011/04/11 01:40:13 dholland Exp $"); #include "opt_magiclinks.h" @@ -411,7 +411,6 @@ int docache; /* == 0 do not cache last component */ int rdonly; /* lookup read-only flag bit */ - struct vnode *dp; /* the directory we are searching */ int slashes; unsigned attempt_retry:1; /* true if error allows emul retry */ @@ -434,7 +433,6 @@ state->docache = 0; state->rdonly = 0; - state->dp = NULL; state->slashes = 0; #ifdef DIAGNOSTIC @@ -798,7 +796,8 @@ * the name set the SAVENAME flag. When done, they assume * responsibility for freeing the pathname buffer. * - * At this point, our only vnode state is that "dp" is held and locked. + * At this point, our only vnode state is that the search dir + * is held and locked. */ cnp->cn_consume = 0; cp = NULL; @@ -856,8 +855,11 @@ } static int -lookup_once(struct namei_state *state) +lookup_once(struct namei_state *state, + struct vnode *searchdir, + struct vnode **foundobj_ret) { + struct vnode *foundobj; struct vnode *tdp; /* saved dp */ struct mount *mp; /* mount table entry */ struct lwp *l = curlwp; @@ -886,18 +888,20 @@ struct proc *p = l->l_proc; for (;;) { - if (state->dp == ndp->ni_rootdir || state->dp == rootvnode) { -ndp->ni_dvp = state->dp; -ndp->ni_vp = state->dp; -vref(state->dp); + if (searchdir == ndp->ni_rootdir || searchdir == rootvnode) { +foundobj = searchdir; +vref(foundobj); +ndp->ni_dvp = searchdir; +ndp->ni_vp = foundobj; +*foundobj_ret = foundobj; return 0; } if (ndp->ni_rootdir != rootvnode) { int retval; -VOP_UNLOCK(state->dp); -retval = vn_isunder(state->dp, ndp->ni_rootdir, l); -vn_lock(state->dp, LK_EXCLUSIVE | LK_RETRY); +VOP_UNLOCK(searchdir); +retval = vn_isunder(searchdir, ndp->ni_rootdir, l); +vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); if (!retval) { /* Oops! We got out of jail! */ log(LOG_WARNING, @@ -906,35 +910,37 @@ p->p_pid, kauth_cred_geteuid(l->l_cred), p->p_comm); /* Put us at the jail root. */ -vput(state->dp); -state->dp = ndp->ni_rootdir; -ndp->ni_dvp = state->dp; -ndp->ni_vp = state->dp; -vref(state->dp); -vref(state->dp); -vn_lock(state->dp, LK_EXCLUSIVE | LK_RETRY); +vput(searchdir); +searchdir = NULL; +foundobj = ndp->ni_rootdir; +vref(foundobj); +vref(foundobj); +ndp->ni_dvp = foundobj; +ndp->ni_vp = foundobj; +vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); +*foundobj_ret = foundobj; return 0; } } - if ((state->dp->v_vflag & VV_ROOT) == 0 || + if ((searchdir->v_vflag & VV_ROOT) == 0 || (cnp->cn_flags & NOCROSSMOUNT)) break; - tdp = state->dp; - state->dp = state->dp->v_mount->mnt_vnodecovered; + tdp = searchdir; + searchdir = searchdir->v_mount->mnt_vnodecovered; vput(tdp); - vref(state->dp); - vn_lock(state->dp, LK_EXCLUSIVE | LK_RETRY); + vref(searchdir); + vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); } } /* * We now have a segment name to search for, and a directory to search. - * Again, our only vnode state is that "dp" is held and locked. + * Our vnode state here is that "searchdir" is held and locked. */ unionlookup: - ndp->ni_dvp = state->dp; + ndp->ni_dvp = searchdir; ndp->ni_vp = NULL; - error = VOP_LOOKUP(state->dp, &ndp->ni_vp, cnp); + error = VOP_LOOKUP(searchdir, &ndp->ni_vp, cnp); if (error != 0) { #ifdef DIAGNOSTIC if (ndp->ni_vp != NULL) @@ -944,13 +950,13 @@ printf("not found\n"); #endif /* NAMEI_DIAGNOSTIC */ if ((error == ENOENT) && - (state->dp->v_vflag & VV_ROOT) && - (state->dp->v_mount->mnt_flag & MNT_UNION)) { - tdp = state->dp; - state->dp = state->dp->v_mount->mnt_vnodecovered; + (searchdir->v_vflag & VV_ROOT) && + (searchdir->v_mount->mnt_flag & MNT_UNION)) { + tdp = searchdir; + searchd
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon Apr 11 01:44:15 UTC 2011 Modified Files: src/usr.bin/make: make.1 var.c Log Message: Add :localtime and :gmtime which use value as format string for strftime. To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/make.1 cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.186 src/usr.bin/make/make.1:1.187 --- src/usr.bin/make/make.1:1.186 Thu Apr 7 01:40:01 2011 +++ src/usr.bin/make/make.1 Mon Apr 11 01:44:15 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.186 2011/04/07 01:40:01 joerg Exp $ +.\" $NetBSD: make.1,v 1.187 2011/04/11 01:44:15 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 2, 2011 +.Dd April 10, 2011 .Dt MAKE 1 .Os .Sh NAME @@ -1042,8 +1042,18 @@ .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. +.It Cm \&:gmtime +The value is a format string for +.Xr strftime 3 , +using the current +.Xr gmtime 3 . .It Cm \&:hash Compute a 32bit hash of the value and encode it as hex digits. +.It Cm \&:localtime +The value is a format string for +.Xr strftime 3 , +using the current +.Xr localtime 3 . .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.163 src/usr.bin/make/var.c:1.164 --- src/usr.bin/make/var.c:1.163 Thu Apr 7 01:40:01 2011 +++ src/usr.bin/make/var.c Mon Apr 11 01:44:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.163 2011/04/07 01:40:01 joerg Exp $ */ +/* $NetBSD: var.c,v 1.164 2011/04/11 01:44:15 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.163 2011/04/07 01:40:01 joerg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.164 2011/04/11 01:44:15 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.163 2011/04/07 01:40:01 joerg Exp $"); +__RCSID("$NetBSD: var.c,v 1.164 2011/04/11 01:44:15 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -2366,6 +2366,21 @@ return Buf_Destroy(&buf, FALSE); } +static char * +VarStrftime(const char *fmt, int zulu) +{ +char buf[BUFSIZ]; +time_t utc; + +time(&utc); +if (!*fmt) + fmt = "%c"; +strftime(buf, sizeof(buf), fmt, zulu ? gmtime(&utc) : localtime(&utc)); + +buf[sizeof(buf) - 1] = '\0'; +return bmake_strdup(buf); +} + /* * Now we need to apply any modifiers the user wants applied. * These are: @@ -2451,6 +2466,10 @@ * variable. */ +/* we now have some modifiers with long names */ +#define STRMOD_MATCH(s, want, n) \ +(strncmp(s, want, n) == 0 && (s[n] == endc || s[n] == ':')) + static char * ApplyModifiers(char *nstr, const char *tstr, int startc, int endc, @@ -2896,10 +2915,19 @@ } } + case 'g': + cp = tstr + 1; /* make sure it is set */ + if (STRMOD_MATCH(tstr, "gmtime", 6)) { + newStr = VarStrftime(nstr, 1); + cp = tstr + 6; + termc = *cp; + } else { + goto bad_modifier; + } + break; case 'h': cp = tstr + 1; /* make sure it is set */ - if (strncmp(tstr, "hash", 4) == 0 && - (tstr[4] == endc || tstr[4] == ':')) { + if (STRMOD_MATCH(tstr, "hash", 4)) { newStr = VarHash(nstr); cp = tstr + 4; termc = *cp; @@ -2907,6 +2935,16 @@ goto bad_modifier; } break; + case 'l': + cp = tstr + 1; /* make sure it is set */ + if (STRMOD_MATCH(tstr, "localtime", 9)) { + newStr = VarStrftime(nstr, 0); + cp = tstr + 9; + termc = *cp; + } else { + goto bad_modifier; + } + break; case 't': { cp = tstr + 1; /* make sure it is set */
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:11:32 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: In lookup_once(), move the assignments to ni_dvp and ni_vp to just before function return. To generate a diff of this commit: cvs rdiff -u -r1.147 -r1.148 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.147 src/sys/kern/vfs_lookup.c:1.148 --- src/sys/kern/vfs_lookup.c:1.147 Mon Apr 11 01:40:13 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:11:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.147 2011/04/11 01:40:13 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.148 2011/04/11 02:11:32 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.147 2011/04/11 01:40:13 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.148 2011/04/11 02:11:32 dholland Exp $"); #include "opt_magiclinks.h" @@ -938,12 +938,11 @@ * Our vnode state here is that "searchdir" is held and locked. */ unionlookup: - ndp->ni_dvp = searchdir; - ndp->ni_vp = NULL; - error = VOP_LOOKUP(searchdir, &ndp->ni_vp, cnp); + foundobj = NULL; + error = VOP_LOOKUP(searchdir, &foundobj, cnp); if (error != 0) { #ifdef DIAGNOSTIC - if (ndp->ni_vp != NULL) + if (foundobj != NULL) panic("leaf `%s' should be empty", cnp->cn_nameptr); #endif /* DIAGNOSTIC */ #ifdef NAMEI_DIAGNOSTIC @@ -981,11 +980,13 @@ } /* - * We return with ni_vp NULL to indicate that the entry + * We return with foundobj NULL to indicate that the entry * doesn't currently exist, leaving a pointer to the * (possibly locked) directory vnode in ndp->ni_dvp. */ state->lookup_alldone = 1; + ndp->ni_dvp = searchdir; + ndp->ni_vp = NULL; *foundobj_ret = NULL; return (0); } @@ -1006,10 +1007,8 @@ cnp->cn_flags |= ISLASTCN; } - foundobj = ndp->ni_vp; - /* - * "foundobj" and "ndp->ni_dvp" are both locked and held, + * "foundobj" and "searchdir" are both locked and held, * and may be the same vnode. */ @@ -1024,21 +1023,23 @@ vput(foundobj); return error; } - KASSERT(ndp->ni_dvp != foundobj); - VOP_UNLOCK(ndp->ni_dvp); + KASSERT(searchdir != foundobj); + VOP_UNLOCK(searchdir); vput(foundobj); error = VFS_ROOT(mp, &tdp); vfs_unbusy(mp, false, NULL); if (error) { - vn_lock(ndp->ni_dvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); return error; } VOP_UNLOCK(tdp); - ndp->ni_vp = foundobj = tdp; - vn_lock(ndp->ni_dvp, LK_EXCLUSIVE | LK_RETRY); - vn_lock(ndp->ni_vp, LK_EXCLUSIVE | LK_RETRY); + foundobj = tdp; + vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); + vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); } + ndp->ni_dvp = searchdir; + ndp->ni_vp = foundobj; *foundobj_ret = foundobj; return 0; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:12:42 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: lookup_once() on success always sets ni_vp to the same thing as the returned foundobj, so do that in the caller instead. To generate a diff of this commit: cvs rdiff -u -r1.148 -r1.149 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.148 src/sys/kern/vfs_lookup.c:1.149 --- src/sys/kern/vfs_lookup.c:1.148 Mon Apr 11 02:11:32 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:12:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.148 2011/04/11 02:11:32 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.149 2011/04/11 02:12:42 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.148 2011/04/11 02:11:32 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.149 2011/04/11 02:12:42 dholland Exp $"); #include "opt_magiclinks.h" @@ -892,7 +892,6 @@ foundobj = searchdir; vref(foundobj); ndp->ni_dvp = searchdir; -ndp->ni_vp = foundobj; *foundobj_ret = foundobj; return 0; } @@ -916,7 +915,6 @@ vref(foundobj); vref(foundobj); ndp->ni_dvp = foundobj; -ndp->ni_vp = foundobj; vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); *foundobj_ret = foundobj; return 0; @@ -986,7 +984,6 @@ */ state->lookup_alldone = 1; ndp->ni_dvp = searchdir; - ndp->ni_vp = NULL; *foundobj_ret = NULL; return (0); } @@ -1039,7 +1036,6 @@ } ndp->ni_dvp = searchdir; - ndp->ni_vp = foundobj; *foundobj_ret = foundobj; return 0; } @@ -1166,6 +1162,7 @@ state->attempt_retry = 1; return (error); } + ndp->ni_vp = foundobj; // XXX ought to be able to avoid this case too if (state->lookup_alldone) { error = 0; @@ -1459,6 +1456,7 @@ if (error) { goto bad; } + ndp->ni_vp = foundobj; // XXX ought to be able to avoid this case too if (state->lookup_alldone) { /* this should NOT be "goto terminal;" */
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:12:58 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: As ndp->ni_dvp is also assigned to the updated search dir on every return from lookup_once(), pass it back instead and update ni_dvp in the caller. To generate a diff of this commit: cvs rdiff -u -r1.149 -r1.150 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.149 src/sys/kern/vfs_lookup.c:1.150 --- src/sys/kern/vfs_lookup.c:1.149 Mon Apr 11 02:12:42 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:12:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.149 2011/04/11 02:12:42 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.149 2011/04/11 02:12:42 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 dholland Exp $"); #include "opt_magiclinks.h" @@ -857,6 +857,7 @@ static int lookup_once(struct namei_state *state, struct vnode *searchdir, + struct vnode **newsearchdir_ret, struct vnode **foundobj_ret) { struct vnode *foundobj; @@ -891,7 +892,7 @@ if (searchdir == ndp->ni_rootdir || searchdir == rootvnode) { foundobj = searchdir; vref(foundobj); -ndp->ni_dvp = searchdir; +*newsearchdir_ret = searchdir; *foundobj_ret = foundobj; return 0; } @@ -914,8 +915,8 @@ foundobj = ndp->ni_rootdir; vref(foundobj); vref(foundobj); -ndp->ni_dvp = foundobj; vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); +*newsearchdir_ret = foundobj; *foundobj_ret = foundobj; return 0; } @@ -980,10 +981,10 @@ /* * We return with foundobj NULL to indicate that the entry * doesn't currently exist, leaving a pointer to the - * (possibly locked) directory vnode in ndp->ni_dvp. + * (possibly locked) directory vnode as searchdir. */ state->lookup_alldone = 1; - ndp->ni_dvp = searchdir; + *newsearchdir_ret = searchdir; *foundobj_ret = NULL; return (0); } @@ -1035,7 +1036,7 @@ vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); } - ndp->ni_dvp = searchdir; + *newsearchdir_ret = searchdir; *foundobj_ret = foundobj; return 0; } @@ -1143,7 +1144,8 @@ return (error); } - error = lookup_once(state, searchdir, &foundobj); + error = lookup_once(state, searchdir, &searchdir, &foundobj); + ndp->ni_dvp = searchdir; if (error) { ndp->ni_vp = NULL; /* XXX this should use namei_end() */ @@ -1452,7 +1454,7 @@ else cnp->cn_flags &= ~ISDOTDOT; - error = lookup_once(state, startdir, &foundobj); + error = lookup_once(state, startdir, &ndp->ni_dvp, &foundobj); if (error) { goto bad; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:13:10 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: namei_end() doesn't really do anything useful at this point, so get rid of it. To generate a diff of this commit: cvs rdiff -u -r1.150 -r1.151 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.150 src/sys/kern/vfs_lookup.c:1.151 --- src/sys/kern/vfs_lookup.c:1.150 Mon Apr 11 02:12:58 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:13:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.151 2011/04/11 02:13:10 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.151 2011/04/11 02:13:10 dholland Exp $"); #include "opt_magiclinks.h" @@ -626,15 +626,6 @@ } /* - * Undo namei_start: unlock and release the current lookup directory. - */ -static void -namei_end(struct namei_state *state) -{ - vput(state->namei_startdir); -} - -/* * Check for being at a symlink. */ static inline int @@ -1077,7 +1068,7 @@ * XXX: should this also check if it's unlinked? */ if (state->namei_startdir->v_mount == NULL) { - namei_end(state); + vput(state->namei_startdir); return (ENOENT); } @@ -1109,7 +1100,6 @@ if (searchdir->v_type != VDIR) { vput(searchdir); ndp->ni_vp = NULL; -/* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } @@ -1136,7 +1126,6 @@ vput(searchdir); ndp->ni_dvp = NULL; ndp->ni_vp = NULL; - /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } @@ -1148,7 +1137,6 @@ ndp->ni_dvp = searchdir; if (error) { ndp->ni_vp = NULL; - /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } @@ -1209,7 +1197,6 @@ KASSERT(foundobj != ndp->ni_dvp); vput(foundobj); ndp->ni_vp = NULL; - /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } @@ -1277,7 +1264,6 @@ } vput(foundobj); foundobj = NULL; - /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); } @@ -1296,7 +1282,6 @@ vput(foundobj); } ndp->ni_vp = NULL; - /* XXX this should use namei_end() */ if (ndp->ni_dvp) { vput(ndp->ni_dvp); }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:13:22 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: state->namei_startdir has no further reason to exist. To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.151 src/sys/kern/vfs_lookup.c:1.152 --- src/sys/kern/vfs_lookup.c:1.151 Mon Apr 11 02:13:10 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:13:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.151 2011/04/11 02:13:10 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.151 2011/04/11 02:13:10 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 dholland Exp $"); #include "opt_magiclinks.h" @@ -403,9 +403,6 @@ struct nameidata *ndp; struct componentname *cnp; - /* used by the pieces of namei */ - struct vnode *namei_startdir; /* The directory namei() starts from. */ - /* used by the pieces of lookup */ int lookup_alldone; @@ -427,8 +424,6 @@ state->cnp = &ndp->ni_cnd; KASSERT((state->cnp->cn_flags & INRELOOKUP) == 0); - state->namei_startdir = NULL; - state->lookup_alldone = 0; state->docache = 0; @@ -460,8 +455,6 @@ { KASSERT(state->cnp == &state->ndp->ni_cnd); - //KASSERT(state->namei_startdir == NULL); // not yet - /* nothing for now */ (void)state; } @@ -1044,7 +1037,7 @@ const char *cp; int error; - error = namei_start(state, forcecwd, &state->namei_startdir); + error = namei_start(state, forcecwd, &searchdir); if (error) { return error; } @@ -1067,8 +1060,8 @@ * If the directory we're on is unmounted, bail out. * XXX: should this also check if it's unlinked? */ - if (state->namei_startdir->v_mount == NULL) { - vput(state->namei_startdir); + if (searchdir->v_mount == NULL) { + vput(searchdir); return (ENOENT); } @@ -1081,7 +1074,6 @@ ndp->ni_dvp = NULL; cnp->cn_flags &= ~ISSYMLINK; - searchdir = state->namei_startdir; dirloop: /* @@ -1173,10 +1165,16 @@ if (neverfollow) { error = EINVAL; } else { -state->namei_startdir = ndp->ni_dvp; +/* + * dholland 20110410: if we're at a + * union mount it might make sense to + * use the top of the union stack here + * rather than the layer we found the + * symlink in. (FUTURE) + */ error = namei_follow(state, inhibitmagic, - state->namei_startdir, - &state->namei_startdir); + searchdir, + &searchdir); } if (error) { KASSERT(ndp->ni_dvp != ndp->ni_vp);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:14:57 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: vref new vnodes before vrele'ing old vnodes, just in case. To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.152 src/sys/kern/vfs_lookup.c:1.153 --- src/sys/kern/vfs_lookup.c:1.152 Mon Apr 11 02:13:22 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:14:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.153 2011/04/11 02:14:57 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.152 2011/04/11 02:13:22 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.153 2011/04/11 02:14:57 dholland Exp $"); #include "opt_magiclinks.h" @@ -910,8 +910,8 @@ break; tdp = searchdir; searchdir = searchdir->v_mount->mnt_vnodecovered; - vput(tdp); vref(searchdir); + vput(tdp); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); } } @@ -936,8 +936,8 @@ (searchdir->v_mount->mnt_flag & MNT_UNION)) { tdp = searchdir; searchdir = searchdir->v_mount->mnt_vnodecovered; - vput(tdp); vref(searchdir); + vput(tdp); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); goto unionlookup; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:15:09 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: In lookup_once(), assign newsearchdir_ret when searchdir is updated, instead of upon return. To generate a diff of this commit: cvs rdiff -u -r1.153 -r1.154 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.153 src/sys/kern/vfs_lookup.c:1.154 --- src/sys/kern/vfs_lookup.c:1.153 Mon Apr 11 02:14:57 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:15:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.153 2011/04/11 02:14:57 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.154 2011/04/11 02:15:09 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.153 2011/04/11 02:14:57 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.154 2011/04/11 02:15:09 dholland Exp $"); #include "opt_magiclinks.h" @@ -854,6 +854,7 @@ struct nameidata *ndp = state->ndp; KASSERT(cnp == &ndp->ni_cnd); + *newsearchdir_ret = searchdir; /* * Handle "..": two special cases. @@ -873,10 +874,10 @@ struct proc *p = l->l_proc; for (;;) { - if (searchdir == ndp->ni_rootdir || searchdir == rootvnode) { + if (searchdir == ndp->ni_rootdir || + searchdir == rootvnode) { foundobj = searchdir; vref(foundobj); -*newsearchdir_ret = searchdir; *foundobj_ret = foundobj; return 0; } @@ -913,6 +914,7 @@ vref(searchdir); vput(tdp); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); + *newsearchdir_ret = searchdir; } } @@ -923,6 +925,7 @@ unionlookup: foundobj = NULL; error = VOP_LOOKUP(searchdir, &foundobj, cnp); + if (error != 0) { #ifdef DIAGNOSTIC if (foundobj != NULL) @@ -939,6 +942,7 @@ vref(searchdir); vput(tdp); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); + *newsearchdir_ret = searchdir; goto unionlookup; } @@ -968,7 +972,6 @@ * (possibly locked) directory vnode as searchdir. */ state->lookup_alldone = 1; - *newsearchdir_ret = searchdir; *foundobj_ret = NULL; return (0); } @@ -1020,7 +1023,6 @@ vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); } - *newsearchdir_ret = searchdir; *foundobj_ret = foundobj; return 0; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:15:22 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Don't bother conditionally doing vput(ndp->ni_dvp) where it's always null. (and don't bother testing for null where it never is) To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.155 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.154 src/sys/kern/vfs_lookup.c:1.155 --- src/sys/kern/vfs_lookup.c:1.154 Mon Apr 11 02:15:09 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:15:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.154 2011/04/11 02:15:09 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.155 2011/04/11 02:15:21 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.154 2011/04/11 02:15:09 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.155 2011/04/11 02:15:21 dholland Exp $"); #include "opt_magiclinks.h" @@ -1094,9 +1094,7 @@ if (searchdir->v_type != VDIR) { vput(searchdir); ndp->ni_vp = NULL; -if (ndp->ni_dvp) { - vput(ndp->ni_dvp); -} +KASSERT(ndp->ni_dvp == NULL); state->attempt_retry = 1; return ENOTDIR; } @@ -1120,9 +1118,6 @@ vput(searchdir); ndp->ni_dvp = NULL; ndp->ni_vp = NULL; - if (ndp->ni_dvp) { -vput(ndp->ni_dvp); - } state->attempt_retry = 1; return (error); } @@ -1131,9 +1126,7 @@ ndp->ni_dvp = searchdir; if (error) { ndp->ni_vp = NULL; - if (ndp->ni_dvp) { -vput(ndp->ni_dvp); - } + vput(ndp->ni_dvp); /* * Note that if we're doing TRYEMULROOT we can * retry with the normal root. Where this is
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:15:38 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Improve previous by manipulating ni_dvp more intelligently. To generate a diff of this commit: cvs rdiff -u -r1.155 -r1.156 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.155 src/sys/kern/vfs_lookup.c:1.156 --- src/sys/kern/vfs_lookup.c:1.155 Mon Apr 11 02:15:21 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:15:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.155 2011/04/11 02:15:21 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.155 2011/04/11 02:15:21 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 dholland Exp $"); #include "opt_magiclinks.h" @@ -1078,6 +1078,8 @@ cnp->cn_flags &= ~ISSYMLINK; dirloop: + KASSERT(ndp->ni_dvp == NULL); + /* * If we have a leading string of slashes, remove * them, and just make sure the current node is a @@ -1093,8 +1095,8 @@ if (searchdir->v_type != VDIR) { vput(searchdir); -ndp->ni_vp = NULL; KASSERT(ndp->ni_dvp == NULL); +ndp->ni_vp = NULL; state->attempt_retry = 1; return ENOTDIR; } @@ -1116,17 +1118,17 @@ error = lookup_parsepath(state); if (error) { vput(searchdir); - ndp->ni_dvp = NULL; + KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = NULL; state->attempt_retry = 1; return (error); } error = lookup_once(state, searchdir, &searchdir, &foundobj); - ndp->ni_dvp = searchdir; if (error) { + vput(searchdir); + KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = NULL; - vput(ndp->ni_dvp); /* * Note that if we're doing TRYEMULROOT we can * retry with the normal root. Where this is @@ -1139,6 +1141,7 @@ state->attempt_retry = 1; return (error); } + ndp->ni_dvp = searchdir; ndp->ni_vp = foundobj; // XXX ought to be able to avoid this case too if (state->lookup_alldone) {
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:15:55 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Don't assign ni_dvp until the end of namei_oneroot(). To generate a diff of this commit: cvs rdiff -u -r1.156 -r1.157 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.156 src/sys/kern/vfs_lookup.c:1.157 --- src/sys/kern/vfs_lookup.c:1.156 Mon Apr 11 02:15:38 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:15:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.157 2011/04/11 02:15:54 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.157 2011/04/11 02:15:54 dholland Exp $"); #include "opt_magiclinks.h" @@ -1107,6 +1107,7 @@ * current node. */ if (cnp->cn_nameptr[0] == '\0') { + vref(searchdir); foundobj = searchdir; ndp->ni_vp = foundobj; cnp->cn_flags |= ISLASTCN; @@ -1141,8 +1142,9 @@ state->attempt_retry = 1; return (error); } - ndp->ni_dvp = searchdir; + KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = foundobj; + // XXX ought to be able to avoid this case too if (state->lookup_alldone) { error = 0; @@ -1175,9 +1177,10 @@ &searchdir); } if (error) { -KASSERT(ndp->ni_dvp != ndp->ni_vp); -vput(ndp->ni_dvp); +KASSERT(searchdir != ndp->ni_vp); +vput(searchdir); vput(ndp->ni_vp); +KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = NULL; return error; } @@ -1190,11 +1193,11 @@ * followed by a series of slashes. */ if ((foundobj->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { - KASSERT(foundobj != ndp->ni_dvp); + KASSERT(foundobj != searchdir); vput(foundobj); ndp->ni_vp = NULL; - if (ndp->ni_dvp) { -vput(ndp->ni_dvp); + if (searchdir) { +vput(searchdir); } state->attempt_retry = 1; return ENOTDIR; @@ -1207,13 +1210,14 @@ */ if (!(cnp->cn_flags & ISLASTCN)) { cnp->cn_nameptr = ndp->ni_next; - if (ndp->ni_dvp == foundobj) { -vrele(ndp->ni_dvp); + if (searchdir == foundobj) { +vrele(searchdir); } else { -vput(ndp->ni_dvp); +vput(searchdir); } - ndp->ni_dvp = NULL; + KASSERT(ndp->ni_dvp == NULL); searchdir = foundobj; + foundobj = NULL; goto dirloop; } @@ -1227,12 +1231,13 @@ * matches that returned for "/" and loop * forever. So convert it to the real root. */ - if (ndp->ni_dvp == foundobj) + if (searchdir == foundobj) vrele(foundobj); else -if (ndp->ni_dvp != NULL) - vput(ndp->ni_dvp); - ndp->ni_dvp = NULL; +if (searchdir != NULL) + vput(searchdir); + searchdir = NULL; + KASSERT(ndp->ni_dvp == NULL); vput(foundobj); foundobj = ndp->ni_rootdir; vref(foundobj); @@ -1246,7 +1251,7 @@ * and we don't have one (because this is the * root directory), then we must fail. */ - if (ndp->ni_dvp == NULL && cnp->cn_nameiop != LOOKUP) { + if (searchdir == NULL && cnp->cn_nameiop != LOOKUP) { switch (cnp->cn_nameiop) { case CREATE: error = EEXIST; @@ -1260,9 +1265,8 @@ } vput(foundobj); foundobj = NULL; - if (ndp->ni_dvp) { -vput(ndp->ni_dvp); - } + KASSERT(ndp->ni_dvp == NULL); + ndp->ni_vp = NULL; state->attempt_retry = 1; return (error); } @@ -1274,13 +1278,14 @@ if (state->rdonly && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { error = EROFS; - if (foundobj != ndp->ni_dvp) { + if (foundobj != searchdir) { vput(foundobj); } - ndp->ni_vp = NULL; - if (ndp->ni_dvp) { -vput(ndp->ni_dvp); + if (searchdir) { +vput(searchdir); } + KASSERT(ndp->ni_dvp == NULL); + ndp->ni_vp = NULL; state->attempt_retry = 1; return (error); } @@ -1298,15 +1303,16 @@ /* * If LOCKPARENT is not set, the parent directory isn't returned. */ - if ((cnp->cn_flags & LOCKPARENT) == 0 && ndp->ni_dvp != NULL) { - if (ndp->ni_dvp == ndp->ni_vp) { - vrele(ndp->ni_dvp); + if ((cnp->cn_flags & LOCKPARENT) == 0 && searchdir != NULL) { + if (searchdir == ndp->ni_vp) { + vrele(searchdir); } else { - vput(ndp->ni_dvp); + vput(searchdir); } - ndp->ni_dvp = NULL; + searchdir = NULL; } + ndp->ni_dvp = searchdir; return 0; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:16:07 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: In the test where we check if searchdir is NULL and fail if we needed to return ni_dvp, also check if searchdir is on a different volume from foundobj. I believe the NULL test was meant to encompass this situation, but it definitely doesn't in some cases related to emulroots. This appears to be a bug, and I'm pretty sure it's not one I introduced. (The search directory and result are on different volumes if we crossed a mount point.) To generate a diff of this commit: cvs rdiff -u -r1.157 -r1.158 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.157 src/sys/kern/vfs_lookup.c:1.158 --- src/sys/kern/vfs_lookup.c:1.157 Mon Apr 11 02:15:54 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:16:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.157 2011/04/11 02:15:54 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.157 2011/04/11 02:15:54 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $"); #include "opt_magiclinks.h" @@ -1246,12 +1246,14 @@ } /* - * If the caller requested the parent node - * (i.e. it's a CREATE, DELETE, or RENAME), - * and we don't have one (because this is the - * root directory), then we must fail. + * If the caller requested the parent node (i.e. it's + * a CREATE, DELETE, or RENAME), and we don't have one + * (because this is the root directory, or we crossed + * a mount point), then we must fail. */ - if (searchdir == NULL && cnp->cn_nameiop != LOOKUP) { + if (cnp->cn_nameiop != LOOKUP && + (searchdir == NULL || + searchdir->v_mount != foundobj->v_mount)) { switch (cnp->cn_nameiop) { case CREATE: error = EEXIST; @@ -1263,6 +1265,9 @@ default: KASSERT(0); } + if (searchdir) { +vput(searchdir); + } vput(foundobj); foundobj = NULL; KASSERT(ndp->ni_dvp == NULL);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:16:27 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Ensure we don't leak stale pointers out in ni_dvp or ni_vp on error return. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.158 src/sys/kern/vfs_lookup.c:1.159 --- src/sys/kern/vfs_lookup.c:1.158 Mon Apr 11 02:16:07 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:16:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $"); #include "opt_magiclinks.h" @@ -1377,6 +1377,12 @@ 0/*!neverfollow*/, 0/*!inhibitmagic*/); namei_cleanup(&state); + if (error) { + /* make sure no stray refs leak out */ + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; + } + return error; } @@ -1407,6 +1413,12 @@ neverfollow, 1/*inhibitmagic*/); namei_cleanup(&state); + if (error) { + /* make sure no stray refs leak out */ + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; + } + return error; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:17:01 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Fix lookup_for_nfsd_index() -- it wasn't locking the directory it was searching. I'm not sure if this is something I introduced or if it's just been wrong for ages; the code path is used only for serving index.html in WebNFS and probably just ought to be removed. To generate a diff of this commit: cvs rdiff -u -r1.159 -r1.160 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.159 src/sys/kern/vfs_lookup.c:1.160 --- src/sys/kern/vfs_lookup.c:1.159 Mon Apr 11 02:16:27 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:17:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $"); #include "opt_magiclinks.h" @@ -1458,7 +1458,14 @@ else cnp->cn_flags &= ~ISDOTDOT; - error = lookup_once(state, startdir, &ndp->ni_dvp, &foundobj); + /* + * Because lookup_once can change the startdir, we need our + * own reference to it to avoid consuming the caller's. + */ + vref(startdir); + vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY); + error = lookup_once(state, startdir, &startdir, &foundobj); + vput(startdir); if (error) { goto bad; } @@ -1469,6 +1476,7 @@ return 0; } + KASSERT((cnp->cn_flags & LOCKPARENT) == 0); if ((cnp->cn_flags & LOCKLEAF) == 0) { VOP_UNLOCK(foundobj); } @@ -1500,8 +1508,6 @@ ndp->ni_pnbuf = NULL; ndp->ni_cnd.cn_nameptr = NULL; - vref(startdir); - namei_init(&state, ndp); error = do_lookup_for_nfsd_index(&state, startdir); namei_cleanup(&state);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:17:14 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Pass foundobj to namei_follow() instead of fishing in the global state. To generate a diff of this commit: cvs rdiff -u -r1.160 -r1.161 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.160 src/sys/kern/vfs_lookup.c:1.161 --- src/sys/kern/vfs_lookup.c:1.160 Mon Apr 11 02:17:01 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:17:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $"); #include "opt_magiclinks.h" @@ -633,7 +633,7 @@ */ static inline int namei_follow(struct namei_state *state, int inhibitmagic, - struct vnode *searchdir, + struct vnode *searchdir, struct vnode *foundobj, struct vnode **newsearchdir_ret) { struct nameidata *ndp = state->ndp; @@ -649,8 +649,8 @@ if (ndp->ni_loopcnt++ >= MAXSYMLINKS) { return ELOOP; } - if (ndp->ni_vp->v_mount->mnt_flag & MNT_SYMPERM) { - error = VOP_ACCESS(ndp->ni_vp, VEXEC, cnp->cn_cred); + if (foundobj->v_mount->mnt_flag & MNT_SYMPERM) { + error = VOP_ACCESS(foundobj, VEXEC, cnp->cn_cred); if (error != 0) return error; } @@ -665,7 +665,7 @@ auio.uio_rw = UIO_READ; auio.uio_resid = MAXPATHLEN; UIO_SETUP_SYSSPACE(&auio); - error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred); + error = VOP_READLINK(foundobj, &auio, cnp->cn_cred); if (error) { PNBUF_PUT(cp); return error; @@ -698,7 +698,7 @@ ndp->ni_pathlen += linklen; memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen); PNBUF_PUT(cp); - vput(ndp->ni_vp); + vput(foundobj); /* * Check if root directory should replace current directory. @@ -1173,7 +1173,7 @@ * symlink in. (FUTURE) */ error = namei_follow(state, inhibitmagic, - searchdir, + searchdir, ndp->ni_vp, &searchdir); } if (error) {
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:17:28 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Remove state->lookup_alldone. Don't need it any more; it's set precisely when succeeding with a null result vnode and it now works to just check for that case. (also, when "error" is already 0 we don't need to assign another 0 to it, even as a precaution.) To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.161 src/sys/kern/vfs_lookup.c:1.162 --- src/sys/kern/vfs_lookup.c:1.161 Mon Apr 11 02:17:14 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:17:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 dholland Exp $"); #include "opt_magiclinks.h" @@ -403,9 +403,6 @@ struct nameidata *ndp; struct componentname *cnp; - /* used by the pieces of lookup */ - int lookup_alldone; - int docache; /* == 0 do not cache last component */ int rdonly; /* lookup read-only flag bit */ int slashes; @@ -424,8 +421,6 @@ state->cnp = &ndp->ni_cnd; KASSERT((state->cnp->cn_flags & INRELOOKUP) == 0); - state->lookup_alldone = 0; - state->docache = 0; state->rdonly = 0; state->slashes = 0; @@ -971,7 +966,6 @@ * doesn't currently exist, leaving a pointer to the * (possibly locked) directory vnode as searchdir. */ - state->lookup_alldone = 1; *foundobj_ret = NULL; return (0); } @@ -1072,8 +1066,6 @@ * (currently, this may consume more than one) */ - state->lookup_alldone = 0; - ndp->ni_dvp = NULL; cnp->cn_flags &= ~ISSYMLINK; @@ -1145,10 +1137,14 @@ KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = foundobj; - // XXX ought to be able to avoid this case too - if (state->lookup_alldone) { - error = 0; - /* break out of main loop */ + if (foundobj == NULL) { + /* + * Success with no object returned means we're + * creating something and it isn't already + * there. Break out of the main loop now so + * the code below doesn't have to test for + * foundobj == NULL. + */ break; } @@ -1435,7 +1431,6 @@ KASSERT(cnp == &ndp->ni_cnd); cnp->cn_nameptr = ndp->ni_pnbuf; - state->lookup_alldone = 0; state->docache = 1; state->rdonly = cnp->cn_flags & RDONLY; ndp->ni_dvp = NULL; @@ -1470,9 +1465,8 @@ goto bad; } ndp->ni_vp = foundobj; - // XXX ought to be able to avoid this case too - if (state->lookup_alldone) { - /* this should NOT be "goto terminal;" */ + + if (foundobj == NULL) { return 0; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:17:42 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Cosmetic: names of scratch vnodes. To generate a diff of this commit: cvs rdiff -u -r1.162 -r1.163 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.162 src/sys/kern/vfs_lookup.c:1.163 --- src/sys/kern/vfs_lookup.c:1.162 Mon Apr 11 02:17:28 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:17:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.163 2011/04/11 02:17:41 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.162 2011/04/11 02:17:28 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.163 2011/04/11 02:17:41 dholland Exp $"); #include "opt_magiclinks.h" @@ -839,8 +839,8 @@ struct vnode **newsearchdir_ret, struct vnode **foundobj_ret) { - struct vnode *foundobj; - struct vnode *tdp; /* saved dp */ + struct vnode *tmpvn; /* scratch vnode */ + struct vnode *foundobj; /* result */ struct mount *mp; /* mount table entry */ struct lwp *l = curlwp; int error; @@ -904,10 +904,10 @@ if ((searchdir->v_vflag & VV_ROOT) == 0 || (cnp->cn_flags & NOCROSSMOUNT)) break; - tdp = searchdir; + tmpvn = searchdir; searchdir = searchdir->v_mount->mnt_vnodecovered; vref(searchdir); - vput(tdp); + vput(tmpvn); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); *newsearchdir_ret = searchdir; } @@ -932,10 +932,10 @@ if ((error == ENOENT) && (searchdir->v_vflag & VV_ROOT) && (searchdir->v_mount->mnt_flag & MNT_UNION)) { - tdp = searchdir; + tmpvn = searchdir; searchdir = searchdir->v_mount->mnt_vnodecovered; vref(searchdir); - vput(tdp); + vput(tmpvn); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); *newsearchdir_ret = searchdir; goto unionlookup; @@ -1005,14 +1005,13 @@ KASSERT(searchdir != foundobj); VOP_UNLOCK(searchdir); vput(foundobj); - error = VFS_ROOT(mp, &tdp); + error = VFS_ROOT(mp, &foundobj); vfs_unbusy(mp, false, NULL); if (error) { vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); return error; } - VOP_UNLOCK(tdp); - foundobj = tdp; + VOP_UNLOCK(foundobj); vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY); vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:17:54 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Make sure namei_oneroot leaves ni_dvp and ni_vp NULL on error. To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.163 src/sys/kern/vfs_lookup.c:1.164 --- src/sys/kern/vfs_lookup.c:1.163 Mon Apr 11 02:17:41 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:17:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.163 2011/04/11 02:17:41 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.163 2011/04/11 02:17:41 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $"); #include "opt_magiclinks.h" @@ -592,7 +592,6 @@ * POSIX.1 requirement: "" is not a valid file name. */ if (ndp->ni_pathlen == 1) { - ndp->ni_vp = NULL; return ENOENT; } @@ -1034,6 +1033,8 @@ error = namei_start(state, forcecwd, &searchdir); if (error) { + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; return error; } @@ -1057,6 +1058,8 @@ */ if (searchdir->v_mount == NULL) { vput(searchdir); + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; return (ENOENT); } @@ -1374,8 +1377,8 @@ if (error) { /* make sure no stray refs leak out */ - ndp->ni_dvp = NULL; - ndp->ni_vp = NULL; + KASSERT(ndp->ni_dvp == NULL); + KASSERT(ndp->ni_vp == NULL); } return error; @@ -1410,8 +1413,8 @@ if (error) { /* make sure no stray refs leak out */ - ndp->ni_dvp = NULL; - ndp->ni_vp = NULL; + KASSERT(ndp->ni_dvp == NULL); + KASSERT(ndp->ni_vp == NULL); } return error;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:18:07 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Don't assign ni_vp until namei_oneroot() returns. To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.164 src/sys/kern/vfs_lookup.c:1.165 --- src/sys/kern/vfs_lookup.c:1.164 Mon Apr 11 02:17:54 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:18:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $"); #include "opt_magiclinks.h" @@ -1103,7 +1103,6 @@ if (cnp->cn_nameptr[0] == '\0') { vref(searchdir); foundobj = searchdir; - ndp->ni_vp = foundobj; cnp->cn_flags |= ISLASTCN; /* bleh */ @@ -1137,7 +1136,6 @@ return (error); } KASSERT(ndp->ni_dvp == NULL); - ndp->ni_vp = foundobj; if (foundobj == NULL) { /* @@ -1171,13 +1169,13 @@ * symlink in. (FUTURE) */ error = namei_follow(state, inhibitmagic, - searchdir, ndp->ni_vp, + searchdir, foundobj, &searchdir); } if (error) { -KASSERT(searchdir != ndp->ni_vp); +KASSERT(searchdir != foundobj); vput(searchdir); -vput(ndp->ni_vp); +vput(foundobj); KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = NULL; return error; @@ -1240,7 +1238,6 @@ foundobj = ndp->ni_rootdir; vref(foundobj); vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); - ndp->ni_vp = foundobj; } /* @@ -1307,7 +1304,7 @@ * If LOCKPARENT is not set, the parent directory isn't returned. */ if ((cnp->cn_flags & LOCKPARENT) == 0 && searchdir != NULL) { - if (searchdir == ndp->ni_vp) { + if (searchdir == foundobj) { vrele(searchdir); } else { vput(searchdir); @@ -1316,6 +1313,7 @@ } ndp->ni_dvp = searchdir; + ndp->ni_vp = foundobj; return 0; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:18:20 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Update some comments. To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.165 src/sys/kern/vfs_lookup.c:1.166 --- src/sys/kern/vfs_lookup.c:1.165 Mon Apr 11 02:18:07 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:18:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $"); #include "opt_magiclinks.h" @@ -574,8 +574,8 @@ } /* - * Start up namei. Copy the path, find the root dir and cwd, establish - * the starting directory for lookup, and lock it. Also calls ktrace when + * Start up namei. Find the root dir and cwd, establish the starting + * directory for lookup, and lock it. Also calls ktrace when * appropriate. */ static int @@ -961,9 +961,10 @@ } /* - * We return with foundobj NULL to indicate that the entry - * doesn't currently exist, leaving a pointer to the - * (possibly locked) directory vnode as searchdir. + * We return success and a NULL foundobj to indicate + * that the entry doesn't currently exist, leaving a + * pointer to the (possibly locked) directory vnode as + * searchdir. */ *foundobj_ret = NULL; return (0);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:19:12 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: namei_follow() randomly drops foundobj on success. Do that in the caller instead. On the other hand, the caller was updating cn_nameptr, and since that's closely related to the buffer manipulation in namei_follow, do that there. To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.166 src/sys/kern/vfs_lookup.c:1.167 --- src/sys/kern/vfs_lookup.c:1.166 Mon Apr 11 02:18:20 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:19:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $"); #include "opt_magiclinks.h" @@ -692,7 +692,9 @@ ndp->ni_pathlen += linklen; memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen); PNBUF_PUT(cp); - vput(foundobj); + + /* we're now starting from the beginning of the buffer again */ + cnp->cn_nameptr = ndp->ni_pnbuf; /* * Check if root directory should replace current directory. @@ -1181,7 +1183,8 @@ ndp->ni_vp = NULL; return error; } - cnp->cn_nameptr = ndp->ni_pnbuf; + vput(foundobj); + foundobj = NULL; continue; }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:19:27 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Assign NULL to ni_dvp immediately before error return, rather than halfway through the logic. To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.167 src/sys/kern/vfs_lookup.c:1.168 --- src/sys/kern/vfs_lookup.c:1.167 Mon Apr 11 02:19:11 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:19:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.168 2011/04/11 02:19:27 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.168 2011/04/11 02:19:27 dholland Exp $"); #include "opt_magiclinks.h" @@ -1071,12 +1071,9 @@ * (currently, this may consume more than one) */ - ndp->ni_dvp = NULL; cnp->cn_flags &= ~ISSYMLINK; dirloop: - KASSERT(ndp->ni_dvp == NULL); - /* * If we have a leading string of slashes, remove * them, and just make sure the current node is a @@ -1092,7 +1089,7 @@ if (searchdir->v_type != VDIR) { vput(searchdir); -KASSERT(ndp->ni_dvp == NULL); +ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1; return ENOTDIR; @@ -1115,7 +1112,7 @@ error = lookup_parsepath(state); if (error) { vput(searchdir); - KASSERT(ndp->ni_dvp == NULL); + ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1; return (error); @@ -1124,7 +1121,7 @@ error = lookup_once(state, searchdir, &searchdir, &foundobj); if (error) { vput(searchdir); - KASSERT(ndp->ni_dvp == NULL); + ndp->ni_dvp = NULL; ndp->ni_vp = NULL; /* * Note that if we're doing TRYEMULROOT we can @@ -1138,7 +1135,6 @@ state->attempt_retry = 1; return (error); } - KASSERT(ndp->ni_dvp == NULL); if (foundobj == NULL) { /* @@ -1179,7 +1175,7 @@ KASSERT(searchdir != foundobj); vput(searchdir); vput(foundobj); -KASSERT(ndp->ni_dvp == NULL); +ndp->ni_dvp = NULL; ndp->ni_vp = NULL; return error; } @@ -1194,11 +1190,12 @@ */ if ((foundobj->v_type != VDIR) && (cnp->cn_flags & REQUIREDIR)) { KASSERT(foundobj != searchdir); - vput(foundobj); - ndp->ni_vp = NULL; if (searchdir) { vput(searchdir); } + vput(foundobj); + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; state->attempt_retry = 1; return ENOTDIR; } @@ -1215,7 +1212,6 @@ } else { vput(searchdir); } - KASSERT(ndp->ni_dvp == NULL); searchdir = foundobj; foundobj = NULL; goto dirloop; @@ -1237,7 +1233,6 @@ if (searchdir != NULL) vput(searchdir); searchdir = NULL; - KASSERT(ndp->ni_dvp == NULL); vput(foundobj); foundobj = ndp->ni_rootdir; vref(foundobj); @@ -1269,7 +1264,7 @@ } vput(foundobj); foundobj = NULL; - KASSERT(ndp->ni_dvp == NULL); + ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1; return (error); @@ -1288,7 +1283,7 @@ if (searchdir) { vput(searchdir); } - KASSERT(ndp->ni_dvp == NULL); + ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1; return (error);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:19:43 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Don't assign inside an if-expression without an explicit comparison. To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.168 src/sys/kern/vfs_lookup.c:1.169 --- src/sys/kern/vfs_lookup.c:1.168 Mon Apr 11 02:19:27 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:19:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.168 2011/04/11 02:19:27 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.169 2011/04/11 02:19:42 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.168 2011/04/11 02:19:27 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.169 2011/04/11 02:19:42 dholland Exp $"); #include "opt_magiclinks.h" @@ -997,7 +997,8 @@ * Check to see if the vnode has been mounted on; * if so find the root of the mounted file system. */ - while (foundobj->v_type == VDIR && (mp = foundobj->v_mountedhere) && + while (foundobj->v_type == VDIR && + (mp = foundobj->v_mountedhere) != NULL && (cnp->cn_flags & NOCROSSMOUNT) == 0) { error = vfs_busy(mp, NULL); if (error != 0) {
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:20:00 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Simplify refcount handling/cleanup in three places. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.169 src/sys/kern/vfs_lookup.c:1.170 --- src/sys/kern/vfs_lookup.c:1.169 Mon Apr 11 02:19:42 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:20:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.169 2011/04/11 02:19:42 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.170 2011/04/11 02:20:00 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.169 2011/04/11 02:19:42 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.170 2011/04/11 02:20:00 dholland Exp $"); #include "opt_magiclinks.h" @@ -1228,12 +1228,13 @@ * matches that returned for "/" and loop * forever. So convert it to the real root. */ - if (searchdir == foundobj) -vrele(foundobj); - else -if (searchdir != NULL) + if (searchdir != NULL) { +if (searchdir == foundobj) + vrele(searchdir); +else vput(searchdir); - searchdir = NULL; +searchdir = NULL; + } vput(foundobj); foundobj = ndp->ni_rootdir; vref(foundobj); @@ -1249,6 +1250,15 @@ if (cnp->cn_nameiop != LOOKUP && (searchdir == NULL || searchdir->v_mount != foundobj->v_mount)) { + if (searchdir) { +vput(searchdir); + } + vput(foundobj); + foundobj = NULL; + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; + state->attempt_retry = 1; + switch (cnp->cn_nameiop) { case CREATE: error = EEXIST; @@ -1260,14 +1270,6 @@ default: KASSERT(0); } - if (searchdir) { -vput(searchdir); - } - vput(foundobj); - foundobj = NULL; - ndp->ni_dvp = NULL; - ndp->ni_vp = NULL; - state->attempt_retry = 1; return (error); } @@ -1278,12 +1280,16 @@ if (state->rdonly && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { error = EROFS; - if (foundobj != searchdir) { -vput(foundobj); - } if (searchdir) { -vput(searchdir); +if (foundobj != searchdir) { + vput(searchdir); +} else { + vrele(searchdir); +} +searchdir = NULL; } + vput(foundobj); + foundobj = NULL; ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1;
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:20:15 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Remove dead assignment of "error" and simplify some uses of it. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.170 src/sys/kern/vfs_lookup.c:1.171 --- src/sys/kern/vfs_lookup.c:1.170 Mon Apr 11 02:20:00 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:20:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.170 2011/04/11 02:20:00 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.170 2011/04/11 02:20:00 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $"); #include "opt_magiclinks.h" @@ -1219,7 +1219,6 @@ } terminal: - error = 0; if (foundobj == ndp->ni_erootdir) { /* * We are about to return the emulation root. @@ -1261,16 +1260,14 @@ switch (cnp->cn_nameiop) { case CREATE: -error = EEXIST; -break; +return EEXIST; case DELETE: case RENAME: -error = EBUSY; -break; +return EBUSY; default: -KASSERT(0); +break; } - return (error); + panic("Invalid nameiop\n"); } /* @@ -1279,7 +1276,6 @@ */ if (state->rdonly && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { - error = EROFS; if (searchdir) { if (foundobj != searchdir) { vput(searchdir); @@ -1293,7 +1289,7 @@ ndp->ni_dvp = NULL; ndp->ni_vp = NULL; state->attempt_retry = 1; - return (error); + return EROFS; } if ((cnp->cn_flags & LOCKLEAF) == 0) { VOP_UNLOCK(foundobj);
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:21:02 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: Add comment warning about case with LOCKPARENT but not LOCKLEAF. bleh. To generate a diff of this commit: cvs rdiff -u -r1.171 -r1.172 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.171 src/sys/kern/vfs_lookup.c:1.172 --- src/sys/kern/vfs_lookup.c:1.171 Mon Apr 11 02:20:15 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:21:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $"); #include "opt_magiclinks.h" @@ -1292,6 +1292,17 @@ return EROFS; } if ((cnp->cn_flags & LOCKLEAF) == 0) { + /* + * Note: if LOCKPARENT but not LOCKLEAF is + * set, and searchdir == foundobj, this code + * necessarily unlocks the parent as well as + * the leaf. That is, just because you specify + * LOCKPARENT doesn't mean you necessarily get + * a locked parent vnode. The code in + * vfs_syscalls.c, and possibly elsewhere, + * that uses this combination "knows" this, so + * it can't be safely changed. Feh. XXX + */ VOP_UNLOCK(foundobj); }
CVS commit: src/sys/kern
Module Name:src Committed By: dholland Date: Mon Apr 11 02:21:17 UTC 2011 Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Update comments. To generate a diff of this commit: cvs rdiff -u -r1.172 -r1.173 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.172 src/sys/kern/vfs_lookup.c:1.173 --- src/sys/kern/vfs_lookup.c:1.172 Mon Apr 11 02:21:01 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:21:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.173 2011/04/11 02:21:17 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.173 2011/04/11 02:21:17 dholland Exp $"); #include "opt_magiclinks.h" @@ -317,7 +317,10 @@ } /* - * XXX should not exist + * XXX should not exist: + * 1. whether a pointer is kernel or user should be statically checkable + * 2. copyin should be handled by the upper part of the syscall layer, + * not in here. */ int pathbuf_maybe_copyin(const char *path, enum uio_seg seg, struct pathbuf **ret) @@ -376,7 +379,10 @@ /* - * Convert a pathname into a pointer to a locked vnode. + * namei: convert a pathname into a pointer to a (maybe-locked) vnode, + * and maybe also its parent directory vnode, and assorted other guff. + * See namei(9) for the interface documentation. + * * * The FOLLOW flag is set when symbolic links are to be followed * when they occur at the end of the name translation process. @@ -397,7 +403,47 @@ */ /* + * Search a pathname. + * This is a very central and rather complicated routine. + * + * The pathname is pointed to by ni_ptr and is of length ni_pathlen. + * The starting directory is passed in. The pathname is descended + * until done, or a symbolic link is encountered. The variable ni_more + * is clear if the path is completed; it is set to one if a symbolic + * link needing interpretation is encountered. + * + * The flag argument is LOOKUP, CREATE, RENAME, or DELETE depending on + * whether the name is to be looked up, created, renamed, or deleted. + * When CREATE, RENAME, or DELETE is specified, information usable in + * creating, renaming, or deleting a directory entry may be calculated. + * If flag has LOCKPARENT or'ed into it, the parent directory is returned + * locked. Otherwise the parent directory is not returned. If the target + * of the pathname exists and LOCKLEAF is or'ed into the flag the target + * is returned locked, otherwise it is returned unlocked. When creating + * or renaming and LOCKPARENT is specified, the target may not be ".". + * When deleting and LOCKPARENT is specified, the target may be ".". + * + * Overall outline of lookup: + * + * dirloop: + * identify next component of name at ndp->ni_ptr + * handle degenerate case where name is null string + * if .. and crossing mount points and on mounted filesys, find parent + * call VOP_LOOKUP routine for next component name + * directory vnode returned in ni_dvp, locked. + * component vnode returned in ni_vp (if it exists), locked. + * if result vnode is mounted on and crossing mount points, + * find mounted on vnode + * if more components of name, do next level at dirloop + * return the answer in ni_vp, locked if LOCKLEAF set + * if LOCKPARENT set, return locked parent in ni_dvp + */ + + +/* * Internal state for a namei operation. + * + * cnp is always equal to &ndp->ni_cnp. */ struct namei_state { struct nameidata *ndp; @@ -527,7 +573,7 @@ /* * Get the directory context for the nfsd case, in parallel to * getstartdir. Initializes the rootdir and erootdir state and - * returns a reference to the passed-instarting dir. + * returns a reference to the passed-in starting dir. */ static struct vnode * namei_getstartdir_for_nfsd(struct namei_state *state, struct vnode *startdir) @@ -613,7 +659,7 @@ } /* - * Check for being at a symlink. + * Check for being at a symlink that we're going to follow. */ static inline int namei_atsymlink(struct namei_state *state, struct vnode *foundobj) @@ -624,6 +670,9 @@ /* * Follow a symlink. + * + * Updates searchdir. inhibitmagic causes magic symlinks to not be + * interpreted; this is used by nfsd. */ static inline int namei_follow(struct namei_state *state, int inhibitmagic, @@ -721,42 +770,8 @@ // /* - * Search a pathname. - * This is a very central and rather complicated routine. - * - * The pathname is pointed to by ni_ptr and is of length ni_pathlen. - * The starting directory is passed in. The pathname is descended -
CVS commit: src
Module Name:src Committed By: mrg Date: Mon Apr 11 04:22:32 UTC 2011 Modified Files: src/sys/arch/acorn26/include: db_machdep.h src/sys/arch/hp300/include: db_machdep.h src/sys/arch/i386/i386: db_machdep.c src/sys/arch/i386/include: db_machdep.h src/sys/arch/luna68k/include: db_machdep.h src/sys/arch/m68k/include: db_machdep.h src/sys/arch/mvme68k/include: db_machdep.h src/sys/arch/pmax/include: db_machdep.h src/sys/arch/sparc/include: db_machdep.h src/sys/arch/x86/x86: db_trace.c src/sys/ddb: db_sym.c db_sym.h files.ddb src/usr.sbin/crash: Makefile Removed Files: src/sys/ddb: db_aout.c db_aout.h Log Message: obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code in db_sym.[ch] as it is used by the elf version of crash(8). i will be cleaning up the db_sym.c code in a follow up commit to avoid having dead code compiled. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/acorn26/include/db_machdep.h cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/include/db_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/db_machdep.c cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/include/db_machdep.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/include/db_machdep.h cvs rdiff -u -r1.28 -r1.29 src/sys/arch/m68k/include/db_machdep.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mvme68k/include/db_machdep.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/pmax/include/db_machdep.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/include/db_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/db_trace.c cvs rdiff -u -r1.41 -r0 src/sys/ddb/db_aout.c cvs rdiff -u -r1.3 -r0 src/sys/ddb/db_aout.h cvs rdiff -u -r1.59 -r1.60 src/sys/ddb/db_sym.c cvs rdiff -u -r1.23 -r1.24 src/sys/ddb/db_sym.h cvs rdiff -u -r1.5 -r1.6 src/sys/ddb/files.ddb cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/acorn26/include/db_machdep.h diff -u src/sys/arch/acorn26/include/db_machdep.h:1.7 src/sys/arch/acorn26/include/db_machdep.h:1.8 --- src/sys/arch/acorn26/include/db_machdep.h:1.7 Wed Jan 14 23:14:48 2009 +++ src/sys/arch/acorn26/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,9 +1,8 @@ -/* $NetBSD: db_machdep.h,v 1.7 2009/01/14 23:14:48 bjh21 Exp $ */ +/* $NetBSD: db_machdep.h,v 1.8 2011/04/11 04:22:30 mrg Exp $ */ #include /* acorn26 uses ELF */ -#undef DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/hp300/include/db_machdep.h diff -u src/sys/arch/hp300/include/db_machdep.h:1.4 src/sys/arch/hp300/include/db_machdep.h:1.5 --- src/sys/arch/hp300/include/db_machdep.h:1.4 Tue Dec 6 17:05:02 2005 +++ src/sys/arch/hp300/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,6 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.4 2005/12/06 17:05:02 tsutsui Exp $ */ +/* $NetBSD: db_machdep.h,v 1.5 2011/04/11 04:22:30 mrg Exp $ */ /* Just use the common m68k definition */ #include - -#undef DB_AOUT_SYMBOLS Index: src/sys/arch/i386/i386/db_machdep.c diff -u src/sys/arch/i386/i386/db_machdep.c:1.1 src/sys/arch/i386/i386/db_machdep.c:1.2 --- src/sys/arch/i386/i386/db_machdep.c:1.1 Sun Apr 10 20:36:48 2011 +++ src/sys/arch/i386/i386/db_machdep.c Mon Apr 11 04:22:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:48 christos Exp $ */ +/* $NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $ */ /* * Mach Operating System @@ -27,15 +27,25 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $"); #include #include #include +#ifndef _KERNEL +#include +#endif + #include #include #include +#include + +#include +/* We need to include both for ddb and crash(8). */ +#include +#include #include #include Index: src/sys/arch/i386/include/db_machdep.h diff -u src/sys/arch/i386/include/db_machdep.h:1.28 src/sys/arch/i386/include/db_machdep.h:1.29 --- src/sys/arch/i386/include/db_machdep.h:1.28 Sun Apr 10 20:36:48 2011 +++ src/sys/arch/i386/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.28 2011/04/10 20:36:48 christos Exp $ */ +/* $NetBSD: db_machdep.h,v 1.29 2011/04/11 04:22:30 mrg Exp $ */ /* * Mach Operating System @@ -139,9 +139,8 @@ #endif /* - * We use either a.out or Elf32 symbols in DDB. + * We use Elf32 symbols in DDB. */ -#define DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/luna68k/include/db_machdep.h diff -u src/sys/arch/luna68k/include/db_machdep.h:1.2 src/sys/arch/luna68k/include/db_machdep.h:1.3 --- src/sys/arch/luna68k/include/db_machdep.h:1.2 Mon Dec 24 17:57:19 2001 +++ src/sys/arch/luna68k/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,8
CVS commit: src/sys/ddb
Module Name:src Committed By: mrg Date: Mon Apr 11 04:26:18 UTC 2011 Modified Files: src/sys/ddb: db_sym.c Log Message: avoid compiling dead code into crash. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/ddb/db_sym.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ddb/db_sym.c diff -u src/sys/ddb/db_sym.c:1.60 src/sys/ddb/db_sym.c:1.61 --- src/sys/ddb/db_sym.c:1.60 Mon Apr 11 04:22:32 2011 +++ src/sys/ddb/db_sym.c Mon Apr 11 04:26:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.60 2011/04/11 04:22:32 mrg Exp $ */ +/* $NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.60 2011/04/11 04:22:32 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_ddbparam.h" @@ -46,7 +46,8 @@ #ifndef _KERNEL #define TBLNAME "netbsd" -static int use_ksyms = true; +#define use_ksyms 0 + const db_symformat_t *db_symformat; static db_forall_func_t db_sift; extern db_symformat_t db_symformat_aout; @@ -66,10 +67,8 @@ ksyms_addsyms_elf(symsize, vss, vse); /* Will complain if necessary */ #else /* _KERNEL */ db_symformat = &db_symformat_elf; - if ((*db_symformat->sym_init)(symsize, vss, vse, TBLNAME) == true) { - use_ksyms = false; - return; - } + if ((*db_symformat->sym_init)(symsize, vss, vse, TBLNAME) != true) + printf("sym_init failed"); #endif /* _KERNEL */ }
CVS commit: [rmind-uvmplock] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: mrg Date: Mon Apr 11 04:35:28 UTC 2011 Modified Files: src/sys/arch/sparc64/sparc64 [rmind-uvmplock]: pmap.c Log Message: don't take pmap_lock in a few places. there's a bunch more work we can do in here, but i've run with this change for ages. To generate a diff of this commit: cvs rdiff -u -r1.259.2.3 -r1.259.2.4 src/sys/arch/sparc64/sparc64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/sparc64/pmap.c diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.259.2.3 src/sys/arch/sparc64/sparc64/pmap.c:1.259.2.4 --- src/sys/arch/sparc64/sparc64/pmap.c:1.259.2.3 Sat Mar 5 20:52:08 2011 +++ src/sys/arch/sparc64/sparc64/pmap.c Mon Apr 11 04:35:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.259.2.3 2011/03/05 20:52:08 rmind Exp $ */ +/* $NetBSD: pmap.c,v 1.259.2.4 2011/04/11 04:35:27 mrg Exp $ */ /* * * Copyright (C) 1996-1999 Eduardo Horvath. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.259.2.3 2011/03/05 20:52:08 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.259.2.4 2011/04/11 04:35:27 mrg Exp $"); #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ #define HWREF @@ -1335,16 +1335,12 @@ { struct pmap *pm = pmap_kernel(); paddr_t pa; - bool took_lock; if (maxkvaddr >= KERNEND) { printf("WARNING: cannot extend kernel pmap beyond %p to %p\n", (void *)KERNEND, (void *)maxkvaddr); return (kbreak); } - took_lock = lock_available; - if (__predict_true(took_lock)) - mutex_enter(&pmap_lock); DPRINTF(PDB_GROW, ("pmap_growkernel(%lx...%lx)\n", kbreak, maxkvaddr)); /* Align with the start of a page table */ for (kbreak &= (-1 << PDSHIFT); kbreak < maxkvaddr; @@ -1362,8 +1358,6 @@ ENTER_STAT(ptpneeded); } } - if (__predict_true(took_lock)) - mutex_exit(&pmap_lock); return (kbreak); } @@ -2103,7 +2097,6 @@ return; } - mutex_enter(&pmap_lock); sva = trunc_page(sva); for (; sva < eva; sva += PAGE_SIZE) { #ifdef DEBUG @@ -2163,7 +2156,6 @@ tlb_flush_pte(sva, pm); } pv_check(); - mutex_exit(&pmap_lock); } /* @@ -2250,7 +2242,6 @@ int64_t data; int rv; - mutex_enter(&pmap_lock); data = pseg_get(pm, va); KASSERT(data & TLB_V); if (prot & VM_PROT_WRITE) { @@ -2264,7 +2255,6 @@ KASSERT(pmap_ctx(pm)>=0); tsb_invalidate(va, pm); tlb_flush_pte(va, pm); - mutex_exit(&pmap_lock); } /* @@ -2811,7 +2801,6 @@ return; } #endif - mutex_enter(&pmap_lock); data = pseg_get(pmap, va & PV_VAMASK); KASSERT(data & TLB_V); data &= ~TLB_TSB_LOCK; @@ -2819,7 +2808,6 @@ if (rv & 1) panic("pmap_unwire: pseg_set needs spare! rv=%d\n", rv); pv_check(); - mutex_exit(&pmap_lock); } /* @@ -3057,7 +3045,7 @@ int i, j, k, n; /* Don't want one of these pages reused while we're reading it. */ - mutex_enter(&pmap_lock); + mutex_enter(&pmap_lock); /* XXX uvmplock */ n = 0; for (i = 0; i < STSZ; i++) { pdir = (paddr_t *)(u_long)ldxa((vaddr_t)&pm->pm_segs[i], @@ -3079,13 +3067,12 @@ } } } - mutex_exit(&pmap_lock); + mutex_exit(&pmap_lock); /* XXX uvmplock */ if (pm->pm_stats.wired_count != n) printf("pmap_count_wired: pm_stats = %ld, counted: %d\n", pm->pm_stats.wired_count, n); - return n; } #endif /* PMAP_COUNT_DEBUG */
CVS commit: src/lib/libc/gen
Module Name:src Committed By: jruoho Date: Mon Apr 11 05:59:11 UTC 2011 Modified Files: src/lib/libc/gen: fmtmsg.3 Log Message: Markup improvements. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gen/fmtmsg.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/fmtmsg.3 diff -u src/lib/libc/gen/fmtmsg.3:1.6 src/lib/libc/gen/fmtmsg.3:1.7 --- src/lib/libc/gen/fmtmsg.3:1.6 Wed Apr 30 13:10:50 2008 +++ src/lib/libc/gen/fmtmsg.3 Mon Apr 11 05:59:11 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: fmtmsg.3,v 1.6 2008/04/30 13:10:50 martin Exp $ +.\" $NetBSD: fmtmsg.3,v 1.7 2011/04/11 05:59:11 jruoho Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 10, 1999 +.Dd April 11, 2011 .Dt FMTMSG 3 .Os .Sh NAME @@ -56,7 +56,7 @@ from the condition causing the message and where to display the message is specified in .Fa classification . -.Ss classification +.Ss Classification The .Fa classification argument consists of a major classification and several sub-classifications. @@ -65,8 +65,8 @@ may be specified for each (sub-)classification. The following classifications are available: -.Bl -tag -width MessageXSourceXSub-classificationsXX -.It Major Classifications +.Bl -tag -width "XXX" +.It Em Major classifications The source of the condition. Available identifiers are: .Dv MM_HARD @@ -75,7 +75,7 @@ (software), and .Dv MM_FIRM (firmware). -.It Message Source Sub-classifications +.It Em Message source sub-classifications The type of software detecting the condition. Available identifiers are: .Dv MM_APPL @@ -84,14 +84,14 @@ (utility), and .Dv MM_OPSYS (operating system). -.It Display Sub-classifications +.It Em Display sub-classifications The displays the formatted messages is to be written to. Available identifiers are: .Dv MM_PRINT (standard error stream) and .Dv MM_CONSOLE (system console). -.It Status Sub-classifications +.It Em Status sub-classifications The capability of the calling software to recover from the condition. Available identifiers are: .Dv MM_RECOVER @@ -105,7 +105,7 @@ is to be supplied, .Dv MM_NULLMC must be specified. -.Ss label +.Ss Label The .Fa label argument identifies the source of the message. @@ -117,12 +117,12 @@ is to be supplied, .Dv MM_NULLLBL must be specified. -.Ss severity +.Ss Severity The seriousness of the condition causing the message. The following .Fa severity levels are available: -.Bl -tag -width MM_WARNINGXX +.Bl -tag -width MM_WARNING -offset indent .It Dv MM_HALT The software has encountered a severe fault and is halting. .It Dv MM_ERROR @@ -138,7 +138,7 @@ level is to be supplied, .Dv MM_NOSEV must be specified. -.Ss text +.Ss Text The description of the condition the software encountered. The character string is not limited to a specific size. @@ -148,7 +148,7 @@ is to be supplied, .Dv MM_NOTXT must be specified. -.Ss action +.Ss Action The first step to be taken to recover from the condition the software encountered; it will be preceded by the prefix .Dq TO FIX: . @@ -159,7 +159,7 @@ is to be supplied, .Dv MM_NOACT must be specified. -.Ss tag +.Ss Tag The on-line documentation which provides further information about the condition and the message, such as .Dq Xr fmtmsg 3 .
CVS commit: src/usr.bin/make
Module Name:src Committed By: wiz Date: Mon Apr 11 06:56:51 UTC 2011 Modified Files: src/usr.bin/make: make.1 Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.187 src/usr.bin/make/make.1:1.188 --- src/usr.bin/make/make.1:1.187 Mon Apr 11 01:44:15 2011 +++ src/usr.bin/make/make.1 Mon Apr 11 06:56:50 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.187 2011/04/11 01:44:15 sjg Exp $ +.\" $NetBSD: make.1,v 1.188 2011/04/11 06:56:50 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -786,7 +786,7 @@ will not create .meta files in .Ql Va .CURDIR . This can be overridden by setting -.Va bf +.Va bf to a value which represents True. .It Pa verbose If in "meta" mode, print a clue about the target being built. @@ -1043,16 +1043,16 @@ .It Cm \&:R Replaces each word in the variable with everything but its suffix. .It Cm \&:gmtime -The value is a format string for +The value is a format string for .Xr strftime 3 , -using the current +using the current .Xr gmtime 3 . .It Cm \&:hash Compute a 32bit hash of the value and encode it as hex digits. .It Cm \&:localtime -The value is a format string for +The value is a format string for .Xr strftime 3 , -using the current +using the current .Xr localtime 3 . .It Cm \&:tA Attempt to convert variable to an absolute path using