CVS commit: src/tests/net/arp
Module Name:src Committed By: ozaki-r Date: Fri Mar 4 04:18:44 UTC 2016 Modified Files: src/tests/net/arp: t_arp.sh Log Message: Improve tests of proxy arp The tests make it clear how it behaves though, I don't know if the current behavior is what it should be. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/net/arp/t_arp.sh 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/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.12 src/tests/net/arp/t_arp.sh:1.13 --- src/tests/net/arp/t_arp.sh:1.12 Mon Feb 29 09:35:16 2016 +++ src/tests/net/arp/t_arp.sh Fri Mar 4 04:18:44 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.12 2016/02/29 09:35:16 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.13 2016/03/04 04:18:44 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,16 +26,15 @@ # inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" +inetserver="$inetserver -lrumpdev -lrumpnet_tap" HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP4SRC=10.0.1.1 IP4DST=10.0.1.2 -IP4DST_PUB=10.0.1.3 -MACDST_PUB=b2:a1:00:00:00:01 -IP4DST_PUBPROXY=10.0.1.4 -MACDST_PUBPROXY=b2:a1:00:00:00:02 +IP4DST_PROXYARP1=10.0.1.3 +IP4DST_PROXYARP2=10.0.1.4 DEBUG=false TIMEOUT=1 @@ -45,7 +44,8 @@ atf_test_case cache_expiration_10s clean atf_test_case command cleanup atf_test_case garp cleanup atf_test_case cache_overwriting cleanup -atf_test_case pubproxy_arp cleanup +atf_test_case proxy_arp_pub cleanup +atf_test_case proxy_arp_pubproxy cleanup atf_test_case link_activation cleanup cache_expiration_5s_head() @@ -78,9 +78,15 @@ cache_overwriting_head() atf_set "require.progs" "rump_server" } -pubproxy_arp_head() +proxy_arp_pub_head() { - atf_set "descr" "Tests for Proxy ARP" + atf_set "descr" "Tests for Proxy ARP (pub)" + atf_set "require.progs" "rump_server" +} + +proxy_arp_pubproxy_head() +{ + atf_set "descr" "Tests for Proxy ARP (pub proxy)" atf_set "require.progs" "rump_server" } @@ -360,9 +366,12 @@ check_entry_flags() "rump.netstat -rn -f inet | grep ^'$ip'" } -pubproxy_arp_body() + +test_proxy_arp() { local arp_keep=5 + local opts= title= flags= + local type=$1 atf_check -s exit:0 ${inetserver} $SOCKSRC atf_check -s exit:0 ${inetserver} $SOCKDST @@ -371,48 +380,116 @@ pubproxy_arp_body() setup_src_server $arp_keep export RUMP_SERVER=$SOCKDST + atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1 + macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') - atf_check -s exit:0 -o ignore rump.arp -s $IP4DST_PUB \ - $MACDST_PUB pub - atf_check -s exit:0 -o match:'permanent published' \ - rump.arp -n $IP4DST_PUB - check_entry_flags $IP4DST_PUB ULSp + if [ "$type" = "pub" ]; then + opts="pub" + title="permanent published" + flags="ULSp" + else + opts="pub proxy" + title='permanent published \(proxy only\)' + flags="UHLSp" + fi - $DEBUG && rump.arp -n -a - $DEBUG && rump.netstat -nr -f inet + # + # Test#1: First setup an endpoint then create proxy arp entry + # + export RUMP_SERVER=$SOCKDST + atf_check -s exit:0 rump.ifconfig tap1 create + atf_check -s exit:0 rump.ifconfig tap1 $IP4DST_PROXYARP1/24 up + atf_check -s exit:0 rump.ifconfig -w 10 - atf_check -s exit:0 -o ignore rump.arp -s $IP4DST_PUBPROXY \ - $MACDST_PUBPROXY pub proxy - atf_check -s exit:0 -o match:'permanent published \(proxy only\)' \ - rump.arp -n $IP4DST_PUBPROXY - check_entry_flags $IP4DST_PUBPROXY UHLSp + # Try to ping (should fail w/o proxy arp) + export RUMP_SERVER=$SOCKSRC + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 - $DEBUG && rump.arp -n -a - $DEBUG && rump.netstat -nr -f inet + # Flushing + extract_new_packets > ./out - export RUMP_SERVER=$SOCKSRC + # Set up proxy ARP entry + export RUMP_SERVER=$SOCKDST + atf_check -s exit:0 -o ignore \ + rump.arp -s $IP4DST_PROXYARP1 $macaddr_dst $opts + atf_check -s exit:0 -o match:"$title" rump.arp -n $IP4DST_PROXYARP1 + if [ "$type" = "pub" ]; then + # XXX local? Is it correct? + check_entry_flags $IP4DST_PROXYARP1 ${flags}l + else + check_entry_flags $IP4DST_PROXYARP1 $flags + fi - atf_check -s not-exit:0 -o ignore -e ignore \ - rump.ping -n -w 1 -c 1 $IP4DST_PUB + # Try to ping + export RUMP_SERVER=$SOCKSRC + if [ "$type" = "pub" ]; then + # XXX fails + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 + else + atf_check -s exit:0 -o ignore \ + rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 + fi - atf_check -s exit:0 sleep 1 extract_new_packets > ./out $DEBUG && cat ./out - pkt=$(make_pkt_str_arprep $IP4DST_PUB $MACDST_PUB) - atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" + pkt=$(make_pkt_str_arprep
CVS commit: src/usr.bin/hexdump
Module Name:src Committed By: dholland Date: Fri Mar 4 03:02:52 UTC 2016 Modified Files: src/usr.bin/hexdump: display.c Log Message: Don't try to use stdin after clobbering it with a failed freopen(). Prevents an extra "Bad file descriptor" message when trying to hexdump a single nonexistent file. The intended behavior seems to have been to read from stdin if there was one filename given and it wasn't valid. But this seems like a bad idea, so prevent that case instead of hacking it up so it works. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/hexdump/display.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/hexdump/display.c diff -u src/usr.bin/hexdump/display.c:1.24 src/usr.bin/hexdump/display.c:1.25 --- src/usr.bin/hexdump/display.c:1.24 Fri Mar 4 02:54:38 2016 +++ src/usr.bin/hexdump/display.c Fri Mar 4 03:02:52 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland Exp $ */ +/* $NetBSD: display.c,v 1.25 2016/03/04 03:02:52 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland Exp $"); +__RCSID("$NetBSD: display.c,v 1.25 2016/03/04 03:02:52 dholland Exp $"); #endif #endif /* not lint */ @@ -297,12 +297,32 @@ get(void) } } +/* + * Save argv for later retrieval. + */ void stashargv(char **argv) { _argv = argv; } +/* + * Get the next file. The idea with the twisty logic seems to be to + * either read N filenames from argv and then exit, or if there aren't + * any, to use stdin and then exit. It should probably be simplified. + * The "done" flag doesn't mean "we are done", it means "we are done + * once we run out of filenames". + * + * XXX: is there any reason not to remove the logic that inhibits + * calling fstat if using stdin and not a filename? It should be safe + * to call fstat on any fd. + * + * Note: I have ruled that if there is one file on the command line + * and it doesn't open, we should exit after complaining about it and + * not then proceed to read stdin; the latter seems like unexpected + * and undesirable behavior. Also, it didn't work anyway, because the + * freopen call clobbers stdin while failing. -- dholland 20160303 + */ int next(void) { @@ -311,13 +331,14 @@ next(void) for (;;) { if (*_argv) { + done = 1; if (!(freopen(*_argv, "r", stdin))) { warn("%s", *_argv); exitval = 1; ++_argv; continue; } - statok = done = 1; + statok = 1; } else { if (done++) return(0);
CVS commit: src/usr.bin/hexdump
Module Name:src Committed By: dholland Date: Fri Mar 4 02:54:38 UTC 2016 Modified Files: src/usr.bin/hexdump: display.c hexdump.c hexdump.h Log Message: Don't use one function for two different things. Two functions is the ticket. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/hexdump/display.c cvs rdiff -u -r1.18 -r1.19 src/usr.bin/hexdump/hexdump.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/hexdump/hexdump.h 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/hexdump/display.c diff -u src/usr.bin/hexdump/display.c:1.23 src/usr.bin/hexdump/display.c:1.24 --- src/usr.bin/hexdump/display.c:1.23 Fri Mar 4 02:46:19 2016 +++ src/usr.bin/hexdump/display.c Fri Mar 4 02:54:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $ */ +/* $NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $"); +__RCSID("$NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland Exp $"); #endif #endif /* not lint */ @@ -254,7 +254,7 @@ get(void) * and no other files are available, zero-pad the rest of the * block and set the end flag. */ - if (!length || (ateof && !next(NULL))) { + if (!length || (ateof && !next())) { if (need == blocksize) return(NULL); if (!need && vflag != ALL && @@ -297,16 +297,18 @@ get(void) } } +void +stashargv(char **argv) +{ + _argv = argv; +} + int -next(char **argv) +next(void) { static int done; int statok; - if (argv) { - _argv = argv; - return(1); - } for (;;) { if (*_argv) { if (!(freopen(*_argv, "r", stdin))) { Index: src/usr.bin/hexdump/hexdump.c diff -u src/usr.bin/hexdump/hexdump.c:1.18 src/usr.bin/hexdump/hexdump.c:1.19 --- src/usr.bin/hexdump/hexdump.c:1.18 Fri Jul 6 09:06:43 2012 +++ src/usr.bin/hexdump/hexdump.c Fri Mar 4 02:54:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hexdump.c,v 1.18 2012/07/06 09:06:43 wiz Exp $ */ +/* $NetBSD: hexdump.c,v 1.19 2016/03/04 02:54:38 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)hexdump.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: hexdump.c,v 1.18 2012/07/06 09:06:43 wiz Exp $"); +__RCSID("$NetBSD: hexdump.c,v 1.19 2016/03/04 02:54:38 dholland Exp $"); #endif #endif /* not lint */ @@ -88,7 +88,7 @@ main(int argc, char *argv[]) for (tfs = fshead; tfs; tfs = tfs->nextfs) rewrite(tfs); - (void)next(argv); + stashargv(argv); display(); exit(exitval); } Index: src/usr.bin/hexdump/hexdump.h diff -u src/usr.bin/hexdump/hexdump.h:1.14 src/usr.bin/hexdump/hexdump.h:1.15 --- src/usr.bin/hexdump/hexdump.h:1.14 Fri Mar 4 02:46:19 2016 +++ src/usr.bin/hexdump/hexdump.h Fri Mar 4 02:54:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hexdump.h,v 1.14 2016/03/04 02:46:19 dholland Exp $ */ +/* $NetBSD: hexdump.h,v 1.15 2016/03/04 02:54:38 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -88,7 +88,8 @@ void display(void); void doskip(const char *, int); void escape(char *); void hexsyntax(int, char ***); -int next(char **); +void stashargv(char **); +int next(void); void odsyntax(int, char ***); void rewrite(FS *); int size(FS *);
CVS commit: src/usr.bin/hexdump
Module Name:src Committed By: dholland Date: Fri Mar 4 02:46:19 UTC 2016 Modified Files: src/usr.bin/hexdump: display.c hexdump.h Log Message: use "static" To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/hexdump/display.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/hexdump/hexdump.h 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/hexdump/display.c diff -u src/usr.bin/hexdump/display.c:1.22 src/usr.bin/hexdump/display.c:1.23 --- src/usr.bin/hexdump/display.c:1.22 Fri Oct 18 20:19:03 2013 +++ src/usr.bin/hexdump/display.c Fri Mar 4 02:46:19 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $ */ +/* $NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $"); +__RCSID("$NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $"); #endif #endif /* not lint */ @@ -62,6 +62,7 @@ enum _vflag vflag = FIRST; static off_t address; /* address/offset in stream */ static off_t eaddress; /* end address */ +static u_char *get(void); static inline void print(PR *, u_char *); void @@ -229,7 +230,7 @@ bpad(PR *pr) static char **_argv; -u_char * +static u_char * get(void) { static int ateof = 1; Index: src/usr.bin/hexdump/hexdump.h diff -u src/usr.bin/hexdump/hexdump.h:1.13 src/usr.bin/hexdump/hexdump.h:1.14 --- src/usr.bin/hexdump/hexdump.h:1.13 Sun Sep 4 20:27:27 2011 +++ src/usr.bin/hexdump/hexdump.h Fri Mar 4 02:46:19 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hexdump.h,v 1.13 2011/09/04 20:27:27 joerg Exp $ */ +/* $NetBSD: hexdump.h,v 1.14 2016/03/04 02:46:19 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -87,7 +87,6 @@ void conv_u(PR *, u_char *); void display(void); void doskip(const char *, int); void escape(char *); -u_char *get(void); void hexsyntax(int, char ***); int next(char **); void odsyntax(int, char ***);
CVS commit: src
Module Name:src Committed By: ozaki-r Date: Fri Mar 4 02:44:45 UTC 2016 Modified Files: src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/net: Makefile Added Files: src/tests/net/if_tap: Makefile t_tap.sh Log Message: Add tests for tap(4) To generate a diff of this commit: cvs rdiff -u -r1.663 -r1.664 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.124 -r1.125 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.26 -r1.27 src/tests/net/Makefile cvs rdiff -u -r0 -r1.1 src/tests/net/if_tap/Makefile \ src/tests/net/if_tap/t_tap.sh 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.663 src/distrib/sets/lists/tests/mi:1.664 --- src/distrib/sets/lists/tests/mi:1.663 Tue Feb 23 16:21:55 2016 +++ src/distrib/sets/lists/tests/mi Fri Mar 4 02:44:45 2016 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.663 2016/02/23 16:21:55 christos Exp $ +# $NetBSD: mi,v 1.664 2016/03/04 02:44:45 ozaki-r Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -3176,6 +3176,10 @@ ./usr/tests/net/if_loop/Atffile tests-net-tests atf,rump ./usr/tests/net/if_loop/Kyuafile tests-net-tests atf,rump,kyua ./usr/tests/net/if_loop/t_pr tests-net-tests atf,rump +./usr/tests/net/if_taptests-net-tests compattestfile,atf +./usr/tests/net/if_tap/Atffile tests-net-tests atf,rump +./usr/tests/net/if_tap/Kyuafile tests-net-tests atf,rump,kyua +./usr/tests/net/if_tap/t_tap tests-net-tests atf,rump ./usr/tests/net/in_cksum tests-net-tests compattestfile,atf ./usr/tests/net/in_cksum/Atffile tests-net-tests compattestfile,atf ./usr/tests/net/in_cksum/Kyuafile tests-net-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.124 src/etc/mtree/NetBSD.dist.tests:1.125 --- src/etc/mtree/NetBSD.dist.tests:1.124 Tue Jan 5 17:22:38 2016 +++ src/etc/mtree/NetBSD.dist.tests Fri Mar 4 02:44:45 2016 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.124 2016/01/05 17:22:38 jakllsch Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.125 2016/03/04 02:44:45 ozaki-r Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -324,6 +324,7 @@ ./usr/tests/net/if_bridge ./usr/tests/net/if_gif ./usr/tests/net/if_loop +./usr/tests/net/if_tap ./usr/tests/net/in_cksum ./usr/tests/net/mcast ./usr/tests/net/mpls Index: src/tests/net/Makefile diff -u src/tests/net/Makefile:1.26 src/tests/net/Makefile:1.27 --- src/tests/net/Makefile:1.26 Thu Nov 5 00:02:59 2015 +++ src/tests/net/Makefile Fri Mar 4 02:44:45 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.26 2015/11/05 00:02:59 knakahara Exp $ +# $NetBSD: Makefile,v 1.27 2016/03/04 02:44:45 ozaki-r Exp $ .include @@ -7,7 +7,7 @@ TESTSDIR= ${TESTSBASE}/net TESTS_SUBDIRS= fdpass in_cksum net sys .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_SUBDIRS+= arp bpf bpfilter carp icmp if if_bridge if_gif if_loop -TESTS_SUBDIRS+= mcast mpls ndp npf route +TESTS_SUBDIRS+= if_tap mcast mpls ndp npf route .if (${MKSLJIT} != "no") TESTS_SUBDIRS+= bpfjit .endif Added files: Index: src/tests/net/if_tap/Makefile diff -u /dev/null src/tests/net/if_tap/Makefile:1.1 --- /dev/null Fri Mar 4 02:44:45 2016 +++ src/tests/net/if_tap/Makefile Fri Mar 4 02:44:45 2016 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2016/03/04 02:44:45 ozaki-r Exp $ +# + +.include + +TESTSDIR= ${TESTSBASE}/net/if_tap + +TESTS_SH= t_tap + +.include Index: src/tests/net/if_tap/t_tap.sh diff -u /dev/null src/tests/net/if_tap/t_tap.sh:1.1 --- /dev/null Fri Mar 4 02:44:45 2016 +++ src/tests/net/if_tap/t_tap.sh Fri Mar 4 02:44:45 2016 @@ -0,0 +1,198 @@ +# $NetBSD: t_tap.sh,v 1.1 2016/03/04 02:44:45 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan Inc. +# 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
CVS commit: src/games/tetris
Module Name:src Committed By: nat Date: Thu Mar 3 21:38:55 UTC 2016 Modified Files: src/games/tetris: screen.c tetris.c tetris.h Log Message: Center game board on screen. OK from christos@. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/games/tetris/screen.c \ src/games/tetris/tetris.c cvs rdiff -u -r1.14 -r1.15 src/games/tetris/tetris.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/tetris/screen.c diff -u src/games/tetris/screen.c:1.31 src/games/tetris/screen.c:1.32 --- src/games/tetris/screen.c:1.31 Fri Nov 6 19:53:37 2015 +++ src/games/tetris/screen.c Thu Mar 3 21:38:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.31 2015/11/06 19:53:37 christos Exp $ */ +/* $NetBSD: screen.c,v 1.32 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -197,6 +197,7 @@ scr_set(void) MINCOLS, MINROWS); stop(""); /* stop() supplies \n */ } + Offset = (Rows - D_LAST + D_FIRST - 2) / 2; if (tcgetattr(0, ) < 0) stop("tcgetattr() fails"); newtt = oldtt; @@ -360,7 +361,7 @@ scr_update(void) putpad(exit_standout_mode); cur_so = 0; } -moveto(RTOD(j), CTOD(i)); +moveto(RTOD(j + Offset), CTOD(i)); } if (enter_standout_mode) { if (so != cur_so) { Index: src/games/tetris/tetris.c diff -u src/games/tetris/tetris.c:1.31 src/games/tetris/tetris.c:1.32 --- src/games/tetris/tetris.c:1.31 Fri Nov 6 19:53:37 2015 +++ src/games/tetris/tetris.c Thu Mar 3 21:38:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.31 2015/11/06 19:53:37 christos Exp $ */ +/* $NetBSD: tetris.c,v 1.32 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -62,6 +62,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19 cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ int Rows, Cols; /* current screen size */ +int Offset; /* used to center board & shapes */ static const struct shape *curshape; const struct shape *nextshape; Index: src/games/tetris/tetris.h diff -u src/games/tetris/tetris.h:1.14 src/games/tetris/tetris.h:1.15 --- src/games/tetris/tetris.h:1.14 Sun Jul 13 16:23:55 2014 +++ src/games/tetris/tetris.h Thu Mar 3 21:38:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.14 2014/07/13 16:23:55 pgoyette Exp $ */ +/* $NetBSD: tetris.h,v 1.15 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -73,6 +73,7 @@ extern cell board[B_SIZE]; /* 1 => occup #define MINCOLS 40 extern int Rows, Cols; /* current screen size */ +extern int Offset; /* vert. offset to center board */ /* * Translations from board coordinates to display coordinates.
CVS commit: src/sys/arch/sparc64/sparc64
Module Name:src Committed By: palle Date: Thu Mar 3 20:45:45 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64: locore.s Log Message: sun4v: rft_kernel should pay attention to the number of register windows that can be restored. We cannot rely on fill traps to occur, since sun4v only has two trap levels available in privileged mode. Based on code from OpenBSD. ok martin@ To generate a diff of this commit: cvs rdiff -u -r1.388 -r1.389 src/sys/arch/sparc64/sparc64/locore.s 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/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.388 src/sys/arch/sparc64/sparc64/locore.s:1.389 --- src/sys/arch/sparc64/sparc64/locore.s:1.388 Sun Feb 14 21:13:33 2016 +++ src/sys/arch/sparc64/sparc64/locore.s Thu Mar 3 20:45:45 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.388 2016/02/14 21:13:33 palle Exp $ */ +/* $NetBSD: locore.s,v 1.389 2016/03/03 20:45:45 palle Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -355,6 +355,35 @@ cputyp: .word CPU_SUN4U ! Default to sun #define CLRTT #endif + +/* + * Some macros to load and store a register window + */ + + .macro SPILL storer,base,size,asi + + .irpc n,01234567 + \storer %l\n, [\base + (\n * \size)] \asi + .endr + .irpc n,01234567 + \storer %i\n, [\base + ((8+\n) * \size)] \asi + .endr + + .endm + + + .macro FILL loader, base, size, asi + + .irpc n,01234567 + \loader [\base + (\n * \size)] \asi, %l\n + .endr + + .irpc n,01234567 + \loader [\base + ((8+\n) * \size)] \asi, %i\n + .endr + + .endm + /* * Here are some oft repeated traps as macros. */ @@ -4079,12 +4108,26 @@ return_from_trap: * */ rft_kernel: - rdpr %tl, %g4! Grab a set of trap registers + rdpr %tl, %g4 ! Grab a set of trap registers inc %g4 wrpr %g4, %g0, %tl wrpr %g3, 0, %tnpc wrpr %g2, 0, %tpc wrpr %g1, 0, %tstate + + rdpr %canrestore, %g2 + brnz %g2, 1f + nop + + wr %g0, ASI_NUCLEUS, %asi + rdpr %cwp, %g1 + dec %g1 + wrpr %g1, %cwp + FILL ldxa, %sp+BIAS, 8, %asi + restored + inc %g1 + wrpr %g1, %cwp +1: restore rdpr %tstate, %g1 ! Since we may have trapped our regs may be toast rdpr %cwp, %g2
CVS commit: src/sys/arch/arm
Module Name:src Committed By: skrll Date: Thu Mar 3 17:01:31 UTC 2016 Modified Files: src/sys/arch/arm/arm32: cpu.c src/sys/arch/arm/include: armreg.h vfpreg.h src/sys/arch/arm/vfp: vfp_init.c Log Message: Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs. While I'm here add some A57/A72 info as well. My RPI3 works with FB console - the uart needs some help with its clocks. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/arch/arm/arm32/cpu.c cvs rdiff -u -r1.109 -r1.110 src/sys/arch/arm/include/armreg.h cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/include/vfpreg.h cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/vfp/vfp_init.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/arm/arm32/cpu.c diff -u src/sys/arch/arm/arm32/cpu.c:1.112 src/sys/arch/arm/arm32/cpu.c:1.113 --- src/sys/arch/arm/arm32/cpu.c:1.112 Sat Jan 23 21:39:17 2016 +++ src/sys/arch/arm/arm32/cpu.c Thu Mar 3 17:01:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.112 2016/01/23 21:39:17 christos Exp $ */ +/* $NetBSD: cpu.c,v 1.113 2016/03/03 17:01:31 skrll Exp $ */ /* * Copyright (c) 1995 Mark Brinicombe. @@ -46,7 +46,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.112 2016/01/23 21:39:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.113 2016/03/03 17:01:31 skrll Exp $"); #include #include @@ -513,6 +513,14 @@ const struct cpuidtab cpuids[] = { pN_steppings, "7A" }, { CPU_ID_CORTEXA17R1, CPU_CLASS_CORTEX, "Cortex-A17 r1", pN_steppings, "7A" }, + { CPU_ID_CORTEXA53R0, CPU_CLASS_CORTEX, "Cortex-A53 r0", + pN_steppings, "8A" }, + { CPU_ID_CORTEXA57R0, CPU_CLASS_CORTEX, "Cortex-A57 r0", + pN_steppings, "8A" }, + { CPU_ID_CORTEXA57R1, CPU_CLASS_CORTEX, "Cortex-A57 r1", + pN_steppings, "8A" }, + { CPU_ID_CORTEXA72R0, CPU_CLASS_CORTEX, "Cortex-A72 r0", + pN_steppings, "8A" }, { CPU_ID_MV88SV581X_V6, CPU_CLASS_PJ4B, "Sheeva 88SV581x", generic_steppings }, Index: src/sys/arch/arm/include/armreg.h diff -u src/sys/arch/arm/include/armreg.h:1.109 src/sys/arch/arm/include/armreg.h:1.110 --- src/sys/arch/arm/include/armreg.h:1.109 Thu Oct 15 07:14:56 2015 +++ src/sys/arch/arm/include/armreg.h Thu Mar 3 17:01:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.109 2015/10/15 07:14:56 skrll Exp $ */ +/* $NetBSD: armreg.h,v 1.110 2016/03/03 17:01:31 skrll Exp $ */ /* * Copyright (c) 1998, 2001 Ben Harris @@ -226,12 +226,20 @@ #define CPU_ID_CORTEXA15R2 0x412fc0f0 #define CPU_ID_CORTEXA15R3 0x413fc0f0 #define CPU_ID_CORTEXA17R1 0x411fc0e0 -#define CPU_ID_CORTEX_P(n) ((n & 0xff0ff000) == 0x410fc000) +#define CPU_ID_CORTEXA53R0 0x410fd030 +#define CPU_ID_CORTEXA57R0 0x410fd070 +#define CPU_ID_CORTEXA57R1 0x411fd070 +#define CPU_ID_CORTEXA72R0 0x410fd080 + +#define CPU_ID_CORTEX_P(n) ((n & 0xff0fe000) == 0x410fc000) #define CPU_ID_CORTEX_A5_P(n) ((n & 0xff0ff0f0) == 0x410fc050) #define CPU_ID_CORTEX_A7_P(n) ((n & 0xff0ff0f0) == 0x410fc070) #define CPU_ID_CORTEX_A8_P(n) ((n & 0xff0ff0f0) == 0x410fc080) #define CPU_ID_CORTEX_A9_P(n) ((n & 0xff0ff0f0) == 0x410fc090) #define CPU_ID_CORTEX_A15_P(n) ((n & 0xff0ff0f0) == 0x410fc0f0) +#define CPU_ID_CORTEX_A53_P(n) ((n & 0xff0ff0f0) == 0x410fd030) +#define CPU_ID_CORTEX_A57_P(n) ((n & 0xff0ff0f0) == 0x410fd070) +#define CPU_ID_CORTEX_A72_P(n) ((n & 0xff0ff0f0) == 0x410fd080) #define CPU_ID_SA110 0x4401a100 #define CPU_ID_SA1100 0x4401a110 #define CPU_ID_TI925T 0x54029250 Index: src/sys/arch/arm/include/vfpreg.h diff -u src/sys/arch/arm/include/vfpreg.h:1.14 src/sys/arch/arm/include/vfpreg.h:1.15 --- src/sys/arch/arm/include/vfpreg.h:1.14 Mon Feb 9 07:55:52 2015 +++ src/sys/arch/arm/include/vfpreg.h Thu Mar 3 17:01:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfpreg.h,v 1.14 2015/02/09 07:55:52 slp Exp $ */ +/* $NetBSD: vfpreg.h,v 1.15 2016/03/03 17:01:31 skrll Exp $ */ /* * Copyright (c) 2008 ARM Ltd @@ -65,6 +65,7 @@ #define FPU_VFP_CORTEXA9 0x41033090 #define FPU_VFP_CORTEXA15 0x410330f0 #define FPU_VFP_CORTEXA15_QEMU 0x410430f0 +#define FPU_VFP_CORTEXA53 0x41034030 #define FPU_VFP_MV88SV58XX 0x56022090 #define VFP_FPEXC_EX 0x8000 /* EXception status bit */ Index: src/sys/arch/arm/vfp/vfp_init.c diff -u src/sys/arch/arm/vfp/vfp_init.c:1.49 src/sys/arch/arm/vfp/vfp_init.c:1.50 --- src/sys/arch/arm/vfp/vfp_init.c:1.49 Thu Nov 12 10:49:35 2015 +++ src/sys/arch/arm/vfp/vfp_init.c Thu Mar 3 17:01:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfp_init.c,v 1.49 2015/11/12 10:49:35 jmcneill Exp $ */ +/* $NetBSD: vfp_init.c,v 1.50 2016/03/03 17:01:31 skrll Exp $ */ /* * Copyright (c) 2008 ARM Ltd @@ -95,6 +95,7 @@ load_vfpregs(const struct vfpreg *fregs) case FPU_VFP_CORTEXA9: case FPU_VFP_CORTEXA15: case FPU_VFP_CORTEXA15_QEMU: + case FPU_VFP_CORTEXA53: #endif load_vfpregs_hi(fregs->vfp_regs); #ifdef CPU_ARM11 @@ -117,6
CVS commit: [netbsd-7-0] src/doc
Module Name:src Committed By: martin Date: Thu Mar 3 15:44:19 UTC 2016 Modified Files: src/doc [netbsd-7-0]: CHANGES-7.0.1 Log Message: Note Tickets 1096, 1108 and 1128 To generate a diff of this commit: cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/doc/CHANGES-7.0.1 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-7.0.1 diff -u src/doc/CHANGES-7.0.1:1.1.2.37 src/doc/CHANGES-7.0.1:1.1.2.38 --- src/doc/CHANGES-7.0.1:1.1.2.37 Sat Feb 27 21:38:59 2016 +++ src/doc/CHANGES-7.0.1 Thu Mar 3 15:44:19 2016 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.0.1,v 1.1.2.37 2016/02/27 21:38:59 martin Exp $ +# $NetBSD: CHANGES-7.0.1,v 1.1.2.38 2016/03/03 15:44:19 martin Exp $ A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.0.1 release: @@ -991,4 +991,39 @@ distrib/sets/lists/xdebug/md.newsmips 1 distrib/sets/lists/xdebug/md.prep 1.4 Fix debug set lists. +bin/cp/utils.c 1.43-1.44 +bin/mv/mv.c 1.44 +lib/librumphijack/hijack.c 1.112-1.115 +sbin/restore/dirs.c1.51 +sbin/restore/tape.c1.68 +usr.bin/touch/touch.c1.33 + + Don't truncate at sub-microsecond while preserving timestamps. + Fix the name of failed function in warning message. + + Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are + changed to use the system call. + + Also hijack futimens(2) so that t_sh test passes. + + Define a generic ATCALL() and use it to implement utimensat() + + Make ATCALL() behave for absolute paths too. + [nakayama, ticket #1096] + +sys/kern/kern_ksyms.c1.82 +sys/kern/kern_module.c1.107-1.110 + + Add some additional status messages for kern.module.verbose=TRUE + + In module_do_load(), consolidate checking for a pre-existing module, + and return a single error value EEXIST. When making a recursive + call (to load required modules), treat a pre-existing module as + success. + [pgoyette, ticket #1108] + +sys/kern/kern_time.c1.184 + + Don't leak garabage from the kernel stack on sleep(0) and equivalents. + [uwe, ticket #1128]
CVS commit: [netbsd-7] src/sys/kern
Module Name:src Committed By: martin Date: Thu Mar 3 15:42:26 UTC 2016 Modified Files: src/sys/kern [netbsd-7]: kern_time.c Log Message: Pull up following revision(s) (requested by uwe in ticket #1128): sys/kern/kern_time.c: revision 1.184 Don't leak garabage from the kernel stack on sleep(0) and equivalents. Hat tip to perl's ext/POSIX/t/wrappers.t To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.179.8.1 src/sys/kern/kern_time.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/kern_time.c diff -u src/sys/kern/kern_time.c:1.179 src/sys/kern/kern_time.c:1.179.8.1 --- src/sys/kern/kern_time.c:1.179 Wed May 22 16:00:52 2013 +++ src/sys/kern/kern_time.c Thu Mar 3 15:42:26 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $ */ +/* $NetBSD: kern_time.c,v 1.179.8.1 2016/03/03 15:42:26 martin Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.1 2016/03/03 15:42:26 martin Exp $"); #include #include @@ -328,8 +328,14 @@ nanosleep1(struct lwp *l, clockid_t cloc struct timespec rmtstart; int error, timo; - if ((error = ts2timo(clock_id, flags, rqt, , )) != 0) - return error == ETIMEDOUT ? 0 : error; + if ((error = ts2timo(clock_id, flags, rqt, , )) != 0) { + if (error == ETIMEDOUT) { + error = 0; + if (rmt != NULL) +rmt->tv_sec = rmt->tv_nsec = 0; + } + return error; + } /* * Avoid inadvertently sleeping forever
CVS commit: [netbsd-7-0] src/sys/kern
Module Name:src Committed By: martin Date: Thu Mar 3 15:41:35 UTC 2016 Modified Files: src/sys/kern [netbsd-7-0]: kern_time.c Log Message: Pull up following revision(s) (requested by uwe in ticket #1128): sys/kern/kern_time.c: revision 1.184 Don't leak garabage from the kernel stack on sleep(0) and equivalents. Hat tip to perl's ext/POSIX/t/wrappers.t To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.179.12.1 src/sys/kern/kern_time.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/kern_time.c diff -u src/sys/kern/kern_time.c:1.179 src/sys/kern/kern_time.c:1.179.12.1 --- src/sys/kern/kern_time.c:1.179 Wed May 22 16:00:52 2013 +++ src/sys/kern/kern_time.c Thu Mar 3 15:41:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $ */ +/* $NetBSD: kern_time.c,v 1.179.12.1 2016/03/03 15:41:35 martin Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.1 2016/03/03 15:41:35 martin Exp $"); #include #include @@ -328,8 +328,14 @@ nanosleep1(struct lwp *l, clockid_t cloc struct timespec rmtstart; int error, timo; - if ((error = ts2timo(clock_id, flags, rqt, , )) != 0) - return error == ETIMEDOUT ? 0 : error; + if ((error = ts2timo(clock_id, flags, rqt, , )) != 0) { + if (error == ETIMEDOUT) { + error = 0; + if (rmt != NULL) +rmt->tv_sec = rmt->tv_nsec = 0; + } + return error; + } /* * Avoid inadvertently sleeping forever
CVS commit: [netbsd-7] src/sys/kern
Module Name:src Committed By: martin Date: Thu Mar 3 14:47:08 UTC 2016 Modified Files: src/sys/kern [netbsd-7]: kern_ksyms.c kern_module.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #1108): sys/kern/kern_module.c: revision 1.107-1.110 sys/kern/kern_ksyms.c: revision 1.82 Add some additional status messages for kern.module.verbose=TRUE Remove extraneous ')' from previous. KNF In module_do_load(), consolidate checking for a pre-existing module, and return a single error value EEXIST. When making a recursive call (to load required modules), treat a pre-existing module as success. Without this change, when a module was loaded by specific request (as opposed to being loaded as a requirement of some other module), we would always load the module from the file-system, and then after making various sanity/compatability checks we would destroy the new copy if there was a pre-existing copy. Fixes PR kern/40764 XXX Note that if the module exists, we bypass all of the various XXX "compatability" checks, including whether or not the existing XXX module is of any particular class! (In the previous code, we XXX checked to see if the newly-loaded copy had the correct class, XXX but not the pre-existing copy, which could have been loaded XXX from a different path/filename.) To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.72.2.1 src/sys/kern/kern_ksyms.c cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/kern/kern_module.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/kern_ksyms.c diff -u src/sys/kern/kern_ksyms.c:1.72 src/sys/kern/kern_ksyms.c:1.72.2.1 --- src/sys/kern/kern_ksyms.c:1.72 Fri Jul 25 08:10:40 2014 +++ src/sys/kern/kern_ksyms.c Thu Mar 3 14:47:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ksyms.c,v 1.72 2014/07/25 08:10:40 dholland Exp $ */ +/* $NetBSD: kern_ksyms.c,v 1.72.2.1 2016/03/03 14:47:08 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.72 2014/07/25 08:10:40 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.72.2.1 2016/03/03 14:47:08 martin Exp $"); #if defined(_KERNEL) && defined(_KERNEL_OPT) #include "opt_ddb.h" @@ -324,7 +324,7 @@ addsymtab(const char *name, void *symsta nglob = 0; for (i = n = 0; i < nsyms; i++) { - /* This breaks CTF mapping, so don't do it when + /* This breaks CTF mapping, so don't do it when * DTrace is enabled */ #ifndef KDTRACE_HOOKS @@ -389,7 +389,7 @@ addsymtab(const char *name, void *symsta panic("addsymtab"); #ifdef KDTRACE_HOOKS - /* + /* * Build the mapping from original symbol id to new symbol table. * Deleted symbols will have a zero map, indices will be one based * instead of zero based. @@ -481,7 +481,7 @@ ksyms_addsyms_elf(int symsize, void *sta shdr[ehdr->e_shstrndx].sh_offset; for (i = 1; i < ehdr->e_shnum; i++) { #ifdef DEBUG - printf("ksyms: checking %s\n", [shdr[i].sh_name]); + printf("ksyms: checking %s\n", [shdr[i].sh_name]); #endif if (shdr[i].sh_type != SHT_PROGBITS) continue; @@ -499,7 +499,7 @@ ksyms_addsyms_elf(int symsize, void *sta } #ifdef DEBUG } else { - printf("ksyms: e_shstrndx == 0\n"); + printf("ksyms: e_shstrndx == 0\n"); #endif } #endif @@ -527,9 +527,8 @@ ksyms_addsyms_elf(int symsize, void *sta */ void ksyms_addsyms_explicit(void *ehdr, void *symstart, size_t symsize, - void *strstart, size_t strsize) +void *strstart, size_t strsize) { - if (!ksyms_verify(symstart, strstart)) return; @@ -549,7 +548,7 @@ ksyms_addsyms_explicit(void *ehdr, void */ int ksyms_getval_unlocked(const char *mod, const char *sym, unsigned long *val, - int type) +int type) { struct ksyms_symtab *st; Elf_Sym *es; @@ -717,7 +716,7 @@ ksyms_getname(const char **mod, const ch */ void ksyms_modload(const char *name, void *symstart, vsize_t symsize, - char *strstart, vsize_t strsize) +char *strstart, vsize_t strsize) { struct ksyms_symtab *st; @@ -827,20 +826,20 @@ ksyms_sift(char *mod, char *sym, int mod static void ksyms_sizes_calc(void) { -struct ksyms_symtab *st; + struct ksyms_symtab *st; int i, delta; -ksyms_symsz = ksyms_strsz = 0; -TAILQ_FOREACH(st, _symtabs, sd_queue) { + ksyms_symsz = ksyms_strsz = 0; + TAILQ_FOREACH(st, _symtabs, sd_queue) { delta = ksyms_strsz - st->sd_usroffset; if (delta != 0) { for (i = 0; i < st->sd_symsize/sizeof(Elf_Sym); i++) st->sd_symstart[i].st_name += delta; st->sd_usroffset = ksyms_strsz; } -ksyms_symsz += st->sd_symsize; -ksyms_strsz += st->sd_strsize; -} + ksyms_symsz += st->sd_symsize; + ksyms_strsz += st->sd_strsize; + } } static void @@ -922,7 +921,6 @@ ksyms_hdr_init(void
CVS commit: [netbsd-7-0] src/sys/kern
Module Name:src Committed By: martin Date: Thu Mar 3 14:46:07 UTC 2016 Modified Files: src/sys/kern [netbsd-7-0]: kern_ksyms.c kern_module.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #1108): sys/kern/kern_module.c: revision 1.107-1.110 sys/kern/kern_ksyms.c: revision 1.82 Add some additional status messages for kern.module.verbose=TRUE Remove extraneous ')' from previous. KNF In module_do_load(), consolidate checking for a pre-existing module, and return a single error value EEXIST. When making a recursive call (to load required modules), treat a pre-existing module as success. Without this change, when a module was loaded by specific request (as opposed to being loaded as a requirement of some other module), we would always load the module from the file-system, and then after making various sanity/compatability checks we would destroy the new copy if there was a pre-existing copy. Fixes PR kern/40764 XXX Note that if the module exists, we bypass all of the various XXX "compatability" checks, including whether or not the existing XXX module is of any particular class! (In the previous code, we XXX checked to see if the newly-loaded copy had the correct class, XXX but not the pre-existing copy, which could have been loaded XXX from a different path/filename.) To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.72.4.1 src/sys/kern/kern_ksyms.c cvs rdiff -u -r1.97.2.1 -r1.97.2.1.2.1 src/sys/kern/kern_module.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/kern_ksyms.c diff -u src/sys/kern/kern_ksyms.c:1.72 src/sys/kern/kern_ksyms.c:1.72.4.1 --- src/sys/kern/kern_ksyms.c:1.72 Fri Jul 25 08:10:40 2014 +++ src/sys/kern/kern_ksyms.c Thu Mar 3 14:46:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ksyms.c,v 1.72 2014/07/25 08:10:40 dholland Exp $ */ +/* $NetBSD: kern_ksyms.c,v 1.72.4.1 2016/03/03 14:46:07 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.72 2014/07/25 08:10:40 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.72.4.1 2016/03/03 14:46:07 martin Exp $"); #if defined(_KERNEL) && defined(_KERNEL_OPT) #include "opt_ddb.h" @@ -324,7 +324,7 @@ addsymtab(const char *name, void *symsta nglob = 0; for (i = n = 0; i < nsyms; i++) { - /* This breaks CTF mapping, so don't do it when + /* This breaks CTF mapping, so don't do it when * DTrace is enabled */ #ifndef KDTRACE_HOOKS @@ -389,7 +389,7 @@ addsymtab(const char *name, void *symsta panic("addsymtab"); #ifdef KDTRACE_HOOKS - /* + /* * Build the mapping from original symbol id to new symbol table. * Deleted symbols will have a zero map, indices will be one based * instead of zero based. @@ -481,7 +481,7 @@ ksyms_addsyms_elf(int symsize, void *sta shdr[ehdr->e_shstrndx].sh_offset; for (i = 1; i < ehdr->e_shnum; i++) { #ifdef DEBUG - printf("ksyms: checking %s\n", [shdr[i].sh_name]); + printf("ksyms: checking %s\n", [shdr[i].sh_name]); #endif if (shdr[i].sh_type != SHT_PROGBITS) continue; @@ -499,7 +499,7 @@ ksyms_addsyms_elf(int symsize, void *sta } #ifdef DEBUG } else { - printf("ksyms: e_shstrndx == 0\n"); + printf("ksyms: e_shstrndx == 0\n"); #endif } #endif @@ -527,9 +527,8 @@ ksyms_addsyms_elf(int symsize, void *sta */ void ksyms_addsyms_explicit(void *ehdr, void *symstart, size_t symsize, - void *strstart, size_t strsize) +void *strstart, size_t strsize) { - if (!ksyms_verify(symstart, strstart)) return; @@ -549,7 +548,7 @@ ksyms_addsyms_explicit(void *ehdr, void */ int ksyms_getval_unlocked(const char *mod, const char *sym, unsigned long *val, - int type) +int type) { struct ksyms_symtab *st; Elf_Sym *es; @@ -717,7 +716,7 @@ ksyms_getname(const char **mod, const ch */ void ksyms_modload(const char *name, void *symstart, vsize_t symsize, - char *strstart, vsize_t strsize) +char *strstart, vsize_t strsize) { struct ksyms_symtab *st; @@ -827,20 +826,20 @@ ksyms_sift(char *mod, char *sym, int mod static void ksyms_sizes_calc(void) { -struct ksyms_symtab *st; + struct ksyms_symtab *st; int i, delta; -ksyms_symsz = ksyms_strsz = 0; -TAILQ_FOREACH(st, _symtabs, sd_queue) { + ksyms_symsz = ksyms_strsz = 0; + TAILQ_FOREACH(st, _symtabs, sd_queue) { delta = ksyms_strsz - st->sd_usroffset; if (delta != 0) { for (i = 0; i < st->sd_symsize/sizeof(Elf_Sym); i++) st->sd_symstart[i].st_name += delta; st->sd_usroffset = ksyms_strsz; } -ksyms_symsz += st->sd_symsize; -ksyms_strsz += st->sd_strsize; -} + ksyms_symsz += st->sd_symsize; + ksyms_strsz += st->sd_strsize; + } } static void @@ -922,7 +921,6 @@ ksyms_hdr_init(void
CVS commit: [netbsd-7] src
Module Name:src Committed By: martin Date: Thu Mar 3 14:30:52 UTC 2016 Modified Files: src/bin/cp [netbsd-7]: utils.c src/lib/librumphijack [netbsd-7]: hijack.c src/sbin/restore [netbsd-7]: dirs.c tape.c src/usr.bin/touch [netbsd-7]: touch.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1096): bin/mv/mv.c: revision 1.44 bin/cp/utils.c: revision 1.43-1.44 lib/librumphijack/hijack.c: revision 1.112-1.115 usr.bin/touch/touch.c: revision 1.33 sbin/restore/tape.c: revision 1.68 sbin/restore/dirs.c: revision 1.51 Don't truncate at sub-microsecond while preserving timestamps. One of motivation of this change is to make the behavior of test(1) -nt/ot with preserved copy (like cp -p) closer to the NetBSD 6. Of course whether full timestamps are kept or not depends also on underlying file system. The ifdef added in mv(1) since existing ifdefs was our local change to compile it on solaris (though I couldn't test it): http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html Fix the name of failed function in warning message. Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are changed to use the system call. Linux also has this system call, but not tested this on linux. Also hijack futimens(2) so that t_sh test passes. Define a generic ATCALL() and use it to implement utimensat() Make ATCALL() behave for absolute paths too. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.42.4.1 src/bin/cp/utils.c cvs rdiff -u -r1.109.2.1 -r1.109.2.2 src/lib/librumphijack/hijack.c cvs rdiff -u -r1.50 -r1.50.6.1 src/sbin/restore/dirs.c cvs rdiff -u -r1.67 -r1.67.8.1 src/sbin/restore/tape.c cvs rdiff -u -r1.32 -r1.32.8.1 src/usr.bin/touch/touch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/cp/utils.c diff -u src/bin/cp/utils.c:1.42 src/bin/cp/utils.c:1.42.4.1 --- src/bin/cp/utils.c:1.42 Wed Dec 11 06:00:11 2013 +++ src/bin/cp/utils.c Thu Mar 3 14:30:52 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: utils.c,v 1.42 2013/12/11 06:00:11 dholland Exp $ */ +/* $NetBSD: utils.c,v 1.42.4.1 2016/03/03 14:30:52 martin Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #else -__RCSID("$NetBSD: utils.c,v 1.42 2013/12/11 06:00:11 dholland Exp $"); +__RCSID("$NetBSD: utils.c,v 1.42.4.1 2016/03/03 14:30:52 martin Exp $"); #endif #endif /* not lint */ @@ -62,13 +62,13 @@ __RCSID("$NetBSD: utils.c,v 1.42 2013/12 int set_utimes(const char *file, struct stat *fs) { -static struct timeval tv[2]; +struct timespec ts[2]; -TIMESPEC_TO_TIMEVAL([0], >st_atimespec); -TIMESPEC_TO_TIMEVAL([1], >st_mtimespec); +ts[0] = fs->st_atimespec; +ts[1] = fs->st_mtimespec; -if (lutimes(file, tv)) { - warn("lutimes: %s", file); +if (lutimens(file, ts)) { + warn("lutimens: %s", file); return (1); } return (0); Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.109.2.1 src/lib/librumphijack/hijack.c:1.109.2.2 --- src/lib/librumphijack/hijack.c:1.109.2.1 Tue Dec 9 20:13:38 2014 +++ src/lib/librumphijack/hijack.c Thu Mar 3 14:30:52 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.109.2.1 2014/12/09 20:13:38 martin Exp $ */ +/* $NetBSD: hijack.c,v 1.109.2.2 2016/03/03 14:30:52 martin Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: hijack.c,v 1.109.2.1 2014/12/09 20:13:38 martin Exp $"); +__RCSID("$NetBSD: hijack.c,v 1.109.2.2 2016/03/03 14:30:52 martin Exp $"); #endif #include @@ -107,6 +107,7 @@ enum dualcall { DUALCALL_LINK, DUALCALL_RENAME, DUALCALL_MKDIR, DUALCALL_RMDIR, DUALCALL_UTIMES, DUALCALL_LUTIMES, DUALCALL_FUTIMES, + DUALCALL_UTIMENSAT, DUALCALL_FUTIMENS, DUALCALL_TRUNCATE, DUALCALL_FTRUNCATE, DUALCALL_FSYNC, DUALCALL_ACCESS, @@ -304,6 +305,8 @@ struct sysnames { { DUALCALL_UTIMES, S(REALUTIMES), RSYS_NAME(UTIMES) }, { DUALCALL_LUTIMES, S(REALLUTIMES), RSYS_NAME(LUTIMES) }, { DUALCALL_FUTIMES, S(REALFUTIMES), RSYS_NAME(FUTIMES) }, + { DUALCALL_UTIMENSAT, "utimensat", RSYS_NAME(UTIMENSAT) }, + { DUALCALL_FUTIMENS, "futimens", RSYS_NAME(FUTIMENS) }, { DUALCALL_OPEN, "open", RSYS_NAME(OPEN) }, { DUALCALL_CHDIR, "chdir", RSYS_NAME(CHDIR) }, { DUALCALL_FCHDIR, "fchdir", RSYS_NAME(FCHDIR) }, @@ -525,6 +528,33 @@ whichpath(const char *path) #define DPRINTF(x) #endif +#define ATCALL(type, name, rcname, args, proto, vars) \ +type name args\ +{ \ + type (*fun) proto; \ + int isrump = -1; \ + \ + if (fd == AT_FDCWD || *path == '/') {\ + isrump = path_isrump(path);\ + } else { \ + isrump = fd_isrump(fd); \ + }\ + \ + DPRINTF(("%s -> %d:%s
CVS commit: [netbsd-7-0] src
Module Name:src Committed By: martin Date: Thu Mar 3 14:27:54 UTC 2016 Modified Files: src/bin/cp [netbsd-7-0]: utils.c src/lib/librumphijack [netbsd-7-0]: hijack.c src/sbin/restore [netbsd-7-0]: dirs.c tape.c src/usr.bin/touch [netbsd-7-0]: touch.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1096): bin/mv/mv.c: revision 1.44 bin/cp/utils.c: revision 1.43-1.44 lib/librumphijack/hijack.c: revision 1.112-1.115 usr.bin/touch/touch.c: revision 1.33 sbin/restore/tape.c: revision 1.68 sbin/restore/dirs.c: revision 1.51 Don't truncate at sub-microsecond while preserving timestamps. One of motivation of this change is to make the behavior of test(1) -nt/ot with preserved copy (like cp -p) closer to the NetBSD 6. Of course whether full timestamps are kept or not depends also on underlying file system. The ifdef added in mv(1) since existing ifdefs was our local change to compile it on solaris (though I couldn't test it): http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html Fix the name of failed function in warning message. Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are changed to use the system call. Linux also has this system call, but not tested this on linux. Also hijack futimens(2) so that t_sh test passes. Define a generic ATCALL() and use it to implement utimensat() Make ATCALL() behave for absolute paths too. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.42.6.1 src/bin/cp/utils.c cvs rdiff -u -r1.109.2.1 -r1.109.2.1.2.1 src/lib/librumphijack/hijack.c cvs rdiff -u -r1.50 -r1.50.8.1 src/sbin/restore/dirs.c cvs rdiff -u -r1.67 -r1.67.10.1 src/sbin/restore/tape.c cvs rdiff -u -r1.32 -r1.32.10.1 src/usr.bin/touch/touch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/cp/utils.c diff -u src/bin/cp/utils.c:1.42 src/bin/cp/utils.c:1.42.6.1 --- src/bin/cp/utils.c:1.42 Wed Dec 11 06:00:11 2013 +++ src/bin/cp/utils.c Thu Mar 3 14:27:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: utils.c,v 1.42 2013/12/11 06:00:11 dholland Exp $ */ +/* $NetBSD: utils.c,v 1.42.6.1 2016/03/03 14:27:54 martin Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #else -__RCSID("$NetBSD: utils.c,v 1.42 2013/12/11 06:00:11 dholland Exp $"); +__RCSID("$NetBSD: utils.c,v 1.42.6.1 2016/03/03 14:27:54 martin Exp $"); #endif #endif /* not lint */ @@ -62,13 +62,13 @@ __RCSID("$NetBSD: utils.c,v 1.42 2013/12 int set_utimes(const char *file, struct stat *fs) { -static struct timeval tv[2]; +struct timespec ts[2]; -TIMESPEC_TO_TIMEVAL([0], >st_atimespec); -TIMESPEC_TO_TIMEVAL([1], >st_mtimespec); +ts[0] = fs->st_atimespec; +ts[1] = fs->st_mtimespec; -if (lutimes(file, tv)) { - warn("lutimes: %s", file); +if (lutimens(file, ts)) { + warn("lutimens: %s", file); return (1); } return (0); Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.109.2.1 src/lib/librumphijack/hijack.c:1.109.2.1.2.1 --- src/lib/librumphijack/hijack.c:1.109.2.1 Tue Dec 9 20:13:38 2014 +++ src/lib/librumphijack/hijack.c Thu Mar 3 14:27:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.109.2.1 2014/12/09 20:13:38 martin Exp $ */ +/* $NetBSD: hijack.c,v 1.109.2.1.2.1 2016/03/03 14:27:54 martin Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: hijack.c,v 1.109.2.1 2014/12/09 20:13:38 martin Exp $"); +__RCSID("$NetBSD: hijack.c,v 1.109.2.1.2.1 2016/03/03 14:27:54 martin Exp $"); #endif #include @@ -107,6 +107,7 @@ enum dualcall { DUALCALL_LINK, DUALCALL_RENAME, DUALCALL_MKDIR, DUALCALL_RMDIR, DUALCALL_UTIMES, DUALCALL_LUTIMES, DUALCALL_FUTIMES, + DUALCALL_UTIMENSAT, DUALCALL_FUTIMENS, DUALCALL_TRUNCATE, DUALCALL_FTRUNCATE, DUALCALL_FSYNC, DUALCALL_ACCESS, @@ -304,6 +305,8 @@ struct sysnames { { DUALCALL_UTIMES, S(REALUTIMES), RSYS_NAME(UTIMES) }, { DUALCALL_LUTIMES, S(REALLUTIMES), RSYS_NAME(LUTIMES) }, { DUALCALL_FUTIMES, S(REALFUTIMES), RSYS_NAME(FUTIMES) }, + { DUALCALL_UTIMENSAT, "utimensat", RSYS_NAME(UTIMENSAT) }, + { DUALCALL_FUTIMENS, "futimens", RSYS_NAME(FUTIMENS) }, { DUALCALL_OPEN, "open", RSYS_NAME(OPEN) }, { DUALCALL_CHDIR, "chdir", RSYS_NAME(CHDIR) }, { DUALCALL_FCHDIR, "fchdir", RSYS_NAME(FCHDIR) }, @@ -525,6 +528,33 @@ whichpath(const char *path) #define DPRINTF(x) #endif +#define ATCALL(type, name, rcname, args, proto, vars) \ +type name args\ +{ \ + type (*fun) proto; \ + int isrump = -1; \ + \ + if (fd == AT_FDCWD || *path == '/') {\ + isrump = path_isrump(path);\ + } else { \ + isrump = fd_isrump(fd); \ + }\ + \