Re: CVS commit: src/external/bsd/flex/dist/src

2017-01-06 Thread Takahiro Kambe
Hi,

I've seen strange warnings:

nbmake[7]: /data/amd64/obj/tools/lex/.depend, 959: ignoring stale .depend for 
/p/netbsd/cvsroot/src/external/bsd/flex/dist/src/scan.l

>From commit log of /usr/src/external/bsd/flex/dist/src/initparse.c,
revision 1.2 says:

Regen without #line directives.
- nbyacc -l -d -o initparse.c parse.y
- nblex -L -t -p scan.l > initscan.c

And using the same step to generate initparse.c and initscan.c, above
warning has gone.

Is there any reason not to use the same way of files generation?

Best regards.

-- 
Takahiro Kambe 


CVS commit: src/share/man/man2

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 06:01:20 UTC 2017

Modified Files:
src/share/man/man2: siginfo.2

Log Message:
Document that TRAP_EXEC is .Nx extension and update .Sh HISTORY for it

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man2/siginfo.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man2

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 06:01:20 UTC 2017

Modified Files:
src/share/man/man2: siginfo.2

Log Message:
Document that TRAP_EXEC is .Nx extension and update .Sh HISTORY for it

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man2/siginfo.2

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/man2/siginfo.2
diff -u src/share/man/man2/siginfo.2:1.17 src/share/man/man2/siginfo.2:1.18
--- src/share/man/man2/siginfo.2:1.17	Sat Jan  7 01:22:12 2017
+++ src/share/man/man2/siginfo.2	Sat Jan  7 06:01:20 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: siginfo.2,v 1.17 2017/01/07 01:22:12 kamil Exp $
+.\"	$NetBSD: siginfo.2,v 1.18 2017/01/07 06:01:20 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -364,8 +364,21 @@ or
 are
 .Nx
 extensions.
+.Pp
+The
+.Dv TRAP_EXEC
+signal specific reason of
+.Dv SIGTRAP
+is
+.Nx
+extension.
 .Sh HISTORY
 The
 .Nm
 functionality first appeared in
 .At V.4 .
+.Pp
+.Dv TRAP_EXEC
+first appeared
+in
+.Nx 8 .



CVS commit: src/doc

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 05:57:27 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Document new additions to ptrace(2) in doc/CHANGES

Added:
  ptrace(2): Add new si_code value of SIGTRAP: TRAP_EXEC [kamil 20170107]
  ptrace(2): Add signal information accessors API:
 PT_GET_SIGINFO and PT_SET_SIGINFO [kamil 20170107]

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2231 -r1.2232 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 05:57:27 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Document new additions to ptrace(2) in doc/CHANGES

Added:
  ptrace(2): Add new si_code value of SIGTRAP: TRAP_EXEC [kamil 20170107]
  ptrace(2): Add signal information accessors API:
 PT_GET_SIGINFO and PT_SET_SIGINFO [kamil 20170107]

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2231 -r1.2232 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.2231 src/doc/CHANGES:1.2232
--- src/doc/CHANGES:1.2231	Mon Jan  2 17:46:39 2017
+++ src/doc/CHANGES	Sat Jan  7 05:57:27 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2231 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2232 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -441,3 +441,6 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	dreamcast: Add preliminary "G1-ATA" IDE HDD support. [tsutsui 20161229]
 	resolvconf(8): Import openresolv-3.9.0 [roy 20161230]
 	flex(1): Import flex-2.6.3 [christos 20170102]
+	ptrace(2): Add new si_code value of SIGTRAP: TRAP_EXEC [kamil 20170107]
+	ptrace(2): Add signal information accessors API:
+		PT_GET_SIGINFO and PT_SET_SIGINFO [kamil 20170107]



CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 05:51:14 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Add more notes explaining how debuggers work on NetBSD

Explain:
 - execve(2) handling and behavior, SIGTRAP & TRAP_EXEC
 - reference PaX MPROTECT restrictions for debuggers
 - software breakpoints handling and behavior, SIGTRAP & TRAP_BKPT
 - single step behavior, SIGTRAP & TRAP_TRACE
 - list predefined MI symbols for help debuggers in port specific headers
 - explain that PT_TRACE_ME does not send a SIGSTOP signal

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/ptrace.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/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.49 src/lib/libc/sys/ptrace.2:1.50
--- src/lib/libc/sys/ptrace.2:1.49	Sat Jan  7 03:41:25 2017
+++ src/lib/libc/sys/ptrace.2	Sat Jan  7 05:51:14 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.49 2017/01/07 03:41:25 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.50 2017/01/07 05:51:14 kamil Exp $
 .\"
 .\" This file is in the public domain.
 .Dd January 7, 2016
@@ -43,12 +43,86 @@ terminate or continue as appropriate.
 .Fn ptrace
 is the mechanism by which all this happens.
 .Pp
+When a process that is traced by a debugger request and calls
+.Xr execve 2
+or any of the routines built on it
+.Po
+such as
+.Xr execv 3
+.Pc ,
+it will stop before executing the first instruction of the new image and emit
+.Dv SIGRAP
+with
+.Dv si_code
+set to
+.Dv TRAP_EXEC .
+If a program is traced with the
+.Dv PT_SYSCALL
+option enabled,
+this event notifier is disabled.
+If a traced program calls
+.Xr execve 2
+any setuid or setgid bits on the executable being executed will be ignored.
+.Pp
+Program (software) breakpoints are reported with
+.Dv SIGTRAP
+and the
+.Dv si_code
+value set to
+.Dv TRAP_BKPT .
+These breakpoints are machine specific instructions that interrput the process.
+In order to put a trap by a tracer into the tracee's program,
+debugger must violate the
+.Dv PaX MPROTECT
+restrictions.
+For details check the
+.Dv security.pax.mprotect.ptrace
+option described in
+.Xr sysctl 7 .
+When a tracee is interrputed by a trap,
+the trap is not removed by the kernel and it must be handled by a debugger.
+.Pp
+If a program is traced with single steps
+.Dv ( PT_STEP )
+it reports each step with
+.Dv SIGTRAP
+with
+.Dv si_code
+set to
+.Dv TRAP_TRACE .
+.Pp
+A debugger might reuse a port specific symbols,
+to help writing portable code as described in the port specific part of the
+.In sys/ptrace.h
+header.
+Among these symbols,
+there are:
+.Bl -dash -tag
+.It
+.Dv PTRACE_REG_PC
+.It
+.Dv PTRACE_REG_SET_PC
+.It
+.Dv PTRACE_REG_SP
+.It
+.Dv PTRACE_REG_INTRV
+.It
+.Dv PTRACE_BREAKPOINT
+.It
+.Dv PTRACE_BREAKPOINT_SIZE
+.It
+.Dv PTRACE_BREAKPOINT_ADJ
+.El
+.Pp
 The
 .Fa request
-argument specifies what operation is being performed; the meaning of
+argument
+of
+.Nm
+specifies what operation is being performed; the meaning of
 the rest of the arguments depends on the operation, but except for one
 special case noted below, all
-.Fn ptrace
+.Nm
 calls are made by the tracing process, and the
 .Fa pid
 argument specifies the process ID of the traced process.
@@ -59,20 +133,14 @@ can be:
 This request is the only one used by the traced process; it declares
 that the process expects to be traced by its parent.
 All the other arguments are ignored.
-(If the parent process does not expect to trace
+If the parent process does not expect to trace
 the child, it will probably be rather confused by the results; once the
 traced process stops, it cannot be made to continue except via
-.Fn ptrace . )
-When a process has used this request and calls
-.Xr execve 2
-or any of the routines built on it
-.Po
-such as
-.Xr execv 3
-.Pc ,
-it will stop before executing the first instruction of the new image.
-Also, any setuid or setgid bits on the executable being executed will
-be ignored.
+.Fn ptrace .
+.Pp
+This call does not stop the process neither emit
+.Dv SIGSTOP
+to parent.
 .It Dv PT_READ_I , Dv PT_READ_D
 These requests read a single
 .Li int
@@ -138,8 +206,14 @@ must have the same real UID as the traci
 not be executing a setuid or setgid executable.
 (If the tracing process is running as root,
 these restrictions do not apply.)
+.Pp
 The tracing process will see the newly-traced process stop and may then
 control it as if it had been traced all along.
+It means that the
+.Dv SIGSTOP
+signal is emitted to tracer.
+It is different behavior to the one from
+.Dv PT_TRACE_ME .
 .Pp
 Three other restrictions apply to all tracing processes, even those
 running as root.
@@ -360,7 +434,7 @@ argument should be set to
 .Li sizeof(struct ptrace_siginfo) .
 .Pp
 In order to pass faked signal to the tracee,
-the siginal type must match the signal passed to process with
+the signal type 

CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 05:51:14 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Add more notes explaining how debuggers work on NetBSD

Explain:
 - execve(2) handling and behavior, SIGTRAP & TRAP_EXEC
 - reference PaX MPROTECT restrictions for debuggers
 - software breakpoints handling and behavior, SIGTRAP & TRAP_BKPT
 - single step behavior, SIGTRAP & TRAP_TRACE
 - list predefined MI symbols for help debuggers in port specific headers
 - explain that PT_TRACE_ME does not send a SIGSTOP signal

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/ptrace.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2017-01-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Sat Jan  7 04:44:13 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile

Log Message:
Add entries of pmap(9) functions


To generate a diff of this commit:
cvs rdiff -u -r1.2099 -r1.2100 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.400 -r1.401 src/share/man/man9/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2017-01-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Sat Jan  7 04:44:13 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile

Log Message:
Add entries of pmap(9) functions


To generate a diff of this commit:
cvs rdiff -u -r1.2099 -r1.2100 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.400 -r1.401 src/share/man/man9/Makefile

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.2099 src/distrib/sets/lists/comp/mi:1.2100
--- src/distrib/sets/lists/comp/mi:1.2099	Sat Jan  7 00:47:18 2017
+++ src/distrib/sets/lists/comp/mi	Sat Jan  7 04:44:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2099 2017/01/07 00:47:18 kamil Exp $
+#	$NetBSD: mi,v 1.2100 2017/01/07 04:44:12 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -9818,6 +9818,9 @@
 ./usr/share/man/cat9/PCI_PRODUCT.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/PCI_REVISION.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/PCI_VENDOR.0		comp-sys-catman		.cat
+./usr/share/man/cat9/PMAP_MAP_POOLPAGE.0	comp-sys-catman		.cat
+./usr/share/man/cat9/PMAP_PREFER.0		comp-sys-catman		.cat
+./usr/share/man/cat9/PMAP_UNMAP_POOLPAGE.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/PMC_ENABLED.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/PSLIST_DESTROY.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/PSLIST_ENTRY_DESTROY.0	comp-sys-catman		.cat
@@ -10788,6 +10791,37 @@
 ./usr/share/man/cat9/pgsignal.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/physio.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pmap.0			comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_activate.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_clear_modify.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_clear_reference.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_copy.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_copy_page.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_create.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_deactivate.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_destroy.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_enter.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_extract.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_fork.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_growkernel.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_init.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_is_modified.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_is_referenced.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_kenter_pa.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_kernel.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_kremove.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_page_protect.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_phys_address.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_protect.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_reference.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_remove.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_remove_all.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_resident_count.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_steal_memory.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_unwire.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_update.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_virtual_space.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_wired_count.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pmap_zero_page.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pmatch.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pmc.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pmc_accumulate.0		comp-sys-catman		.cat
@@ -17088,6 +17122,9 @@
 ./usr/share/man/html9/PCI_PRODUCT.html		comp-sys-htmlman	html
 ./usr/share/man/html9/PCI_REVISION.html		comp-sys-htmlman	html
 ./usr/share/man/html9/PCI_VENDOR.html		comp-sys-htmlman	html
+./usr/share/man/html9/PMAP_MAP_POOLPAGE.html	comp-sys-htmlman	html
+./usr/share/man/html9/PMAP_PREFER.html		comp-sys-htmlman	html
+./usr/share/man/html9/PMAP_UNMAP_POOLPAGE.html	comp-sys-htmlman	html
 ./usr/share/man/html9/PMC_ENABLED.html		comp-sys-htmlman	html
 ./usr/share/man/html9/PSLIST_DESTROY.html	comp-sys-htmlman	html
 ./usr/share/man/html9/PSLIST_ENTRY_DESTROY.html	comp-sys-htmlman	html
@@ -18018,6 +18055,37 @@
 ./usr/share/man/html9/pgsignal.html		comp-sys-htmlman	html
 ./usr/share/man/html9/physio.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pmap.html			comp-sys-htmlman	html
+./usr/share/man/html9/pmap_activate.html	comp-sys-htmlman	html
+./usr/share/man/html9/pmap_clear_modify.html	comp-sys-htmlman	html
+./usr/share/man/html9/pmap_clear_reference.html	comp-sys-htmlman	html
+./usr/share/man/html9/pmap_copy.html		comp-sys-htmlman	html
+./usr/share/man/html9/pmap_copy_page.html	comp-sys-htmlman	html

CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 03:41:25 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Document PT_SET_SIGINFO and PT_GET_SIGINFO in ptrace(2)

PT_SET_SIGINFO - fake signal information emitted to tracee
PT_GET_SIGINFO - read signal information routed to tracee

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/sys/ptrace.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/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.48 src/lib/libc/sys/ptrace.2:1.49
--- src/lib/libc/sys/ptrace.2:1.48	Sat Jan  7 01:32:35 2017
+++ src/lib/libc/sys/ptrace.2	Sat Jan  7 03:41:25 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.48 2017/01/07 01:32:35 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.49 2017/01/07 03:41:25 kamil Exp $
 .\"
 .\" This file is in the public domain.
 .Dd January 7, 2016
@@ -329,6 +329,57 @@ The
 .Fa data
 argument should be set to
 .Li sizeof(struct ptrace_state) .
+.It Dv PT_SET_SIGINFO
+This request can be used to specify signal information emitted to tracee.
+This signal information is specified in
+.Dq Li "struct ptrace_siginfo"
+defined as:
+.Bd -literal -offset indentq
+typedef struct ptrace_siginfo {
+	siginfo_t	psi_siginfo;
+	lwpid_t		psi_lwpid;
+} ptrace_siginfo_t;
+.Ed
+.Pp
+Where
+.Fa psi_siginfo
+is the set to signal information structure.
+The
+.Fa psi_lwpid
+field describes LWP address of the signal.
+Value
+.Dv 0
+means the whole process
+(route signal to all LWPs).
+.Pp
+A pointer to this structure is passed in
+.Fa addr .
+The
+.Fa data
+argument should be set to
+.Li sizeof(struct ptrace_siginfo) .
+.Pp
+In order to pass faked signal to the tracee,
+the siginal type must match the signal passed to process with
+.Dv PT_CONTINUE ,
+.Dv PT_DETACH
+or
+.Dv PT_STEP .
+.It Dv PT_GET_SIGINFO
+This request can be used to determine signal information that was received by
+a debugger
+.Po
+see
+.Xr siginfo 2
+.Pc .
+The information is read into the
+.Dq Li struct ptrace_siginfo
+pointed to by
+.Fa addr .
+The
+.Fa data
+argument should be set to
+.Li sizeof(struct ptrace_siginfo) .
 .El
 .Pp
 Additionally, the following requests exist but are



CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 03:41:25 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Document PT_SET_SIGINFO and PT_GET_SIGINFO in ptrace(2)

PT_SET_SIGINFO - fake signal information emitted to tracee
PT_GET_SIGINFO - read signal information routed to tracee

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/sys/ptrace.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools/compat

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  7 02:55:19 UTC 2017

Modified Files:
src/tools/compat: compat_defs.h

Log Message:
need ctype.h


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/tools/compat/compat_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools/compat

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  7 02:55:19 UTC 2017

Modified Files:
src/tools/compat: compat_defs.h

Log Message:
need ctype.h


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/tools/compat/compat_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.105 src/tools/compat/compat_defs.h:1.106
--- src/tools/compat/compat_defs.h:1.105	Fri Jan  6 21:52:04 2017
+++ src/tools/compat/compat_defs.h	Fri Jan  6 21:55:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.105 2017/01/07 02:52:04 christos Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.106 2017/01/07 02:55:19 christos Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/tools/compat

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  7 02:52:04 UTC 2017

Modified Files:
src/tools/compat: compat_defs.h configure.ac

Log Message:
Check for declarations, not the existance of functions since some are
visible only when _NETBSD_SOURCE is defined. This avoids || defined(__NetBSD__)
hacks.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.85 -r1.86 src/tools/compat/configure.ac

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools/compat

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  7 02:52:04 UTC 2017

Modified Files:
src/tools/compat: compat_defs.h configure.ac

Log Message:
Check for declarations, not the existance of functions since some are
visible only when _NETBSD_SOURCE is defined. This avoids || defined(__NetBSD__)
hacks.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.85 -r1.86 src/tools/compat/configure.ac

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.104 src/tools/compat/compat_defs.h:1.105
--- src/tools/compat/compat_defs.h:1.104	Wed Oct 19 17:54:20 2016
+++ src/tools/compat/compat_defs.h	Fri Jan  6 21:52:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.104 2016/10/19 21:54:20 christos Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.105 2017/01/07 02:52:04 christos Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -46,6 +46,9 @@
 #include 
 #include 
 #include 
+#if HAVE_ERR_H
+#include 
+#endif
 
 #if HAVE_SYS_CDEFS_H
 #include 
@@ -63,6 +66,9 @@
 #if HAVE_STDDEF_H
 #include 
 #endif
+#if HAVE_LIBGEN_H
+#include 
+#endif
 
 #if HAVE_RPC_TYPES_H
 #include 
@@ -219,19 +225,19 @@ typedef unsigned short u_short;
 
 /* Prototypes for replacement functions. */
 
-#if !HAVE_ATOLL
+#if !HAVE_DECL_ATOLL
 long long int atoll(const char *);
 #endif
 
-#if !HAVE_ASPRINTF
+#if !HAVE_DECL_ASPRINTF
 int asprintf(char **, const char *, ...);
 #endif
 
-#if !HAVE_ASNPRINTF
+#if !HAVE_DECL_ASNPRINTF
 int asnprintf(char **, size_t, const char *, ...);
 #endif
 
-#if !HAVE_BASENAME
+#if !HAVE_DECL_BASENAME
 char *basename(char *);
 #endif
 
@@ -241,7 +247,7 @@ extern char *optarg;
 extern int optind, opterr, optopt;
 #endif
 
-#if !HAVE_DIRNAME
+#if !HAVE_DECL_DIRNAME
 char *dirname(char *);
 #endif
 
@@ -323,10 +329,10 @@ int easprintf(char **, const char *, ...
 int evasprintf(char **, const char *, va_list);
 #endif
 
-#if !HAVE_FGETLN || defined(__NetBSD__)
+#if !HAVE_DECL_FGETLN
 char *fgetln(FILE *, size_t *);
 #endif
-#if !HAVE_DPRINTF
+#if !HAVE_DECL_DPRINTF
 int dprintf(int, const char *, ...);
 #endif
 
@@ -338,7 +344,7 @@ int dprintf(int, const char *, ...);
 int flock(int, int);
 #endif
 
-#if !HAVE_FPARSELN || BROKEN_FPARSELN || defined(__NetBSD__)
+#if !HAVE_DECL_FPARSELN || BROKEN_FPARSELN
 # define FPARSELN_UNESCESC	0x01
 # define FPARSELN_UNESCCONT	0x02
 # define FPARSELN_UNESCCOMM	0x04
@@ -347,16 +353,18 @@ int flock(int, int);
 char *fparseln(FILE *, size_t *, size_t *, const char [3], int);
 #endif
 
-#if !HAVE_GETLINE
+#if !HAVE_DECL_GETDELIM
 ssize_t getdelim(char **, size_t *, int, FILE *);
+#endif
+#if !HAVE_DECL_GETLINE
 ssize_t getline(char **, size_t *, FILE *);
 #endif
 
-#if !HAVE_ISSETUGID
+#if !HAVE_DECL_ISSETUGID
 int issetugid(void);
 #endif
 
-#if !HAVE_ISBLANK && !defined(isblank)
+#if !HAVE_DECL_ISBLANK && !defined(isblank)
 #define isblank(x) ((x) == ' ' || (x) == '\t')
 #endif
 
@@ -389,11 +397,11 @@ int issetugid(void);
 #define bswap64(x)	__nbcompat_bswap64(x)
 #endif
 
-#if !HAVE_MKSTEMP
+#if !HAVE_DECL_MKSTEMP
 int mkstemp(char *);
 #endif
 
-#if !HAVE_MKDTEMP
+#if !HAVE_DECL_MKDTEMP
 char *mkdtemp(char *);
 #endif
 
@@ -403,11 +411,11 @@ char *mkdtemp(char *);
 int __nbcompat_gettemp(char *, int *, int);
 #endif
 
-#if !HAVE_PREAD
+#if !HAVE_DECL_PREAD
 ssize_t pread(int, void *, size_t, off_t);
 #endif
 
-#if !HAVE_HEAPSORT
+#if !HAVE_DECL_HEAPSORT
 int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
 #endif
 /* Make them use our version */
@@ -484,7 +492,7 @@ int		lchmod(const char *, mode_t);
 int		lchown(const char *, uid_t, gid_t);
 #endif
 
-#if !HAVE_PWRITE
+#if !HAVE_DECL_PWRITE
 ssize_t pwrite(int, const void *, size_t, off_t);
 #endif
 
@@ -492,11 +500,11 @@ ssize_t pwrite(int, const void *, size_t
 int raise_default_signal(int);
 #endif
 
-#if !HAVE_REALLOCARR
+#if !HAVE_DECL_REALLOCARR
 int reallocarr(void *, size_t, size_t);
 #endif
 
-#if !HAVE_SETENV
+#if !HAVE_DECL_SETENV
 int setenv(const char *, const char *, int);
 #endif
 
@@ -508,8 +516,10 @@ int setgroupent(int);
 int setpassent(int);
 #endif
 
-#if !HAVE_SETPROGNAME || defined(__NetBSD__)
+#if !HAVE_DECL_GETPROGNAME
 const char *getprogname(void);
+#endif
+#if !HAVE_DECL_SETPROGNAME
 void setprogname(const char *);
 #endif
 
@@ -518,27 +528,19 @@ int snprintb(char *, size_t, const char 
 int snprintb_m(char *, size_t, const char *, uint64_t, size_t);
 #endif
 
-#if !HAVE_SNPRINTF
+#if !HAVE_DECL_SNPRINTF
 int snprintf(char *, size_t, const char *, ...);
 #endif
 
-#if !HAVE_STRLCAT
-size_t strlcat(char *, const char *, size_t);
-#endif
-
-#if !HAVE_STRLCPY
-size_t strlcpy(char *, const char *, size_t);
-#endif
-
-#if !HAVE_STRMODE
+#if !HAVE_DECL_STRMODE
 void strmode(mode_t, char *);
 #endif
 
-#if !HAVE_STRNDUP
+#if 

CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:32:35 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Fix swapped text between PT_GET_PROCESS_STATE and PT_GET_EVENT_MASK

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/sys/ptrace.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/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.47 src/lib/libc/sys/ptrace.2:1.48
--- src/lib/libc/sys/ptrace.2:1.47	Sat Jan  7 01:29:18 2017
+++ src/lib/libc/sys/ptrace.2	Sat Jan  7 01:32:35 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.47 2017/01/07 01:29:18 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.48 2017/01/07 01:32:35 kamil Exp $
 .\"
 .\" This file is in the public domain.
 .Dd January 7, 2016
@@ -309,7 +309,7 @@ pointed to by
 The
 .Fa data
 argument should be set to
-.Li sizeof(struct ptrace_state) .
+.Li sizeof(struct ptrace_event) .
 .It Dv PT_GET_PROCESS_STATE
 This request reads the state information associated with the event
 that stopped the traced process.
@@ -328,7 +328,7 @@ A pointer to this structure is passed in
 The
 .Fa data
 argument should be set to
-.Li sizeof(struct ptrace_event) .
+.Li sizeof(struct ptrace_state) .
 .El
 .Pp
 Additionally, the following requests exist but are



CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:32:35 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Fix swapped text between PT_GET_PROCESS_STATE and PT_GET_EVENT_MASK

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/sys/ptrace.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:29:18 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
ptrace(2): Document addr and data argument usage for PT_GET_PROCESS_STATE

The PT_GET_PROCESS_STATE call in ptrace(2) has the following usage of addr
and data:

A pointer to this structure is passed in addr.  The data
argument should be set to sizeof(struct ptrace_event).

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/sys/ptrace.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/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.46 src/lib/libc/sys/ptrace.2:1.47
--- src/lib/libc/sys/ptrace.2:1.46	Thu Dec 29 22:17:51 2016
+++ src/lib/libc/sys/ptrace.2	Sat Jan  7 01:29:18 2017
@@ -1,7 +1,7 @@
-.\"	$NetBSD: ptrace.2,v 1.46 2016/12/29 22:17:51 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.47 2017/01/07 01:29:18 kamil Exp $
 .\"
 .\" This file is in the public domain.
-.Dd November 1, 2016
+.Dd January 7, 2016
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -309,7 +309,7 @@ pointed to by
 The
 .Fa data
 argument should be set to
-.Li sizeof(struct ptrace_event) .
+.Li sizeof(struct ptrace_state) .
 .It Dv PT_GET_PROCESS_STATE
 This request reads the state information associated with the event
 that stopped the traced process.
@@ -322,6 +322,13 @@ typedef struct ptrace_state {
 	pid_t	pe_other_pid;
 } ptrace_state_t;
 .Ed
+.Pp
+A pointer to this structure is passed in
+.Fa addr .
+The
+.Fa data
+argument should be set to
+.Li sizeof(struct ptrace_event) .
 .El
 .Pp
 Additionally, the following requests exist but are



CVS commit: src/lib/libc/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:29:18 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
ptrace(2): Document addr and data argument usage for PT_GET_PROCESS_STATE

The PT_GET_PROCESS_STATE call in ptrace(2) has the following usage of addr
and data:

A pointer to this structure is passed in addr.  The data
argument should be set to sizeof(struct ptrace_event).

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/sys/ptrace.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man2

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:22:12 UTC 2017

Modified Files:
src/share/man/man2: siginfo.2

Log Message:
Document TRAP_EXEC in SIGRAP in siginfo(2)

TRAP_EXEC - Process exec trap

This signal is emitted on exec() when a process is controlled by a
debugger.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man2/siginfo.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man2

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 01:22:12 UTC 2017

Modified Files:
src/share/man/man2: siginfo.2

Log Message:
Document TRAP_EXEC in SIGRAP in siginfo(2)

TRAP_EXEC - Process exec trap

This signal is emitted on exec() when a process is controlled by a
debugger.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man2/siginfo.2

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/man2/siginfo.2
diff -u src/share/man/man2/siginfo.2:1.16 src/share/man/man2/siginfo.2:1.17
--- src/share/man/man2/siginfo.2:1.16	Thu Dec 29 11:50:44 2016
+++ src/share/man/man2/siginfo.2	Sat Jan  7 01:22:12 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: siginfo.2,v 1.16 2016/12/29 11:50:44 wiz Exp $
+.\"	$NetBSD: siginfo.2,v 1.17 2017/01/07 01:22:12 kamil Exp $
 .\"
 .\" Copyright (c) 2003 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 December 28, 2016
+.Dd January 7, 2017
 .Dt SIGINFO 2
 .Os
 .Sh NAME
@@ -231,6 +231,8 @@ Object-specific hardware error
 Process breakpoint
 .It TRAP_TRACE
 Process trace trap
+.It TRAP_EXEC
+Process exec trap
 .El
 .It SIGCHLD
 .Bl -tag -width CLD_CONTINUED



CVS commit: src/distrib/sets/lists/comp

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 00:47:19 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Fix MKCATPAGES=yes build - fix typo in cat3/krb5_checksum_is_keyed.0


To generate a diff of this commit:
cvs rdiff -u -r1.2098 -r1.2099 src/distrib/sets/lists/comp/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2098 src/distrib/sets/lists/comp/mi:1.2099
--- src/distrib/sets/lists/comp/mi:1.2098	Thu Jan  5 23:15:43 2017
+++ src/distrib/sets/lists/comp/mi	Sat Jan  7 00:47:18 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2098 2017/01/05 23:15:43 roy Exp $
+#	$NetBSD: mi,v 1.2099 2017/01/07 00:47:18 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7072,7 +7072,7 @@
 ./usr/share/man/cat3/krb5_checksum.0		comp-krb5-catman	kerberos,.cat
 ./usr/share/man/cat3/krb5_checksum_disable.0	comp-krb5-catman	kerberos,.cat
 ./usr/share/man/cat3/krb5_checksum_is_collision_proof.0 comp-krb5-catman	kerberos,.cat
-./usr/share/man/cat3/krb5_checksum_	is_keyed.0	comp-krb5-catman	kerberos,.cat
+./usr/share/man/cat3/krb5_checksum_is_keyed.0	comp-krb5-catman	kerberos,.cat
 ./usr/share/man/cat3/krb5_checksumsize.0	comp-krb5-catman	kerberos,.cat
 ./usr/share/man/cat3/krb5_cksumtype_valid.0	comp-krb5-catman	kerberos,.cat
 ./usr/share/man/cat3/krb5_clear_error_string.0	comp-obsolete		obsolete



CVS commit: src/distrib/sets/lists/comp

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jan  7 00:47:19 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Fix MKCATPAGES=yes build - fix typo in cat3/krb5_checksum_is_keyed.0


To generate a diff of this commit:
cvs rdiff -u -r1.2098 -r1.2099 src/distrib/sets/lists/comp/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:58:00 UTC 2017

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 7.99.56 for new ptrace(2) interfaces and SIGTRAP type TRAP_EXEC

Kernel bump for PT_GET_SIGINFO and PT_SET_SIGINFO in ptrace(2) and new
si_code value TRAP_EXEC in  for the SIGTRAP signal.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.522 -r1.523 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.522 src/sys/sys/param.h:1.523
--- src/sys/sys/param.h:1.522	Thu Jan  5 03:40:33 2017
+++ src/sys/sys/param.h	Fri Jan  6 22:58:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.522 2017/01/05 03:40:33 pgoyette Exp $	*/
+/*	$NetBSD: param.h,v 1.523 2017/01/06 22:58:00 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799005500	/* NetBSD 7.99.55 */
+#define	__NetBSD_Version__	799005600	/* NetBSD 7.99.56 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:58:00 UTC 2017

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 7.99.56 for new ptrace(2) interfaces and SIGTRAP type TRAP_EXEC

Kernel bump for PT_GET_SIGINFO and PT_SET_SIGINFO in ptrace(2) and new
si_code value TRAP_EXEC in  for the SIGTRAP signal.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.522 -r1.523 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:53:17 UTC 2017

Modified Files:
src/sys/kern: core_elf32.c core_netbsd.c kern_sig.c sys_ptrace_common.c
src/sys/sys: ptrace.h signalvar.h

Log Message:
Introduce new ptrace(2) interface: PT_SET_SIGINFO and PT_GET_SIGINFO

This interface is designed to read signal information emited to tracee and
fake this signal with new value.

This functionality is required to distinguish types of events that occured
in the tracee and intercepted by a debugger.

These accessors introduce a new structure type ptrace_siginfo:
/*
 * Signal Information structure
 */
typedef struct ptrace_siginfo {
   siginfo_t   psi_siginfo;/* signal information structure */
   lwpid_t psi_lwpid;  /* destination LWP of the signal
* value 0 means the whole process
* (route signal to all LWPs) */
} ptrace_siginfo_t;

Include  in  in order to not break existing
software due to unknown symbol siginfo_t.

This interface has been proposed to the tech-kern@ mailing list.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/core_elf32.c
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/core_netbsd.c
cvs rdiff -u -r1.331 -r1.332 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/sys_ptrace_common.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/ptrace.h
cvs rdiff -u -r1.87 -r1.88 src/sys/sys/signalvar.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/core_elf32.c
diff -u src/sys/kern/core_elf32.c:1.49 src/sys/kern/core_elf32.c:1.50
--- src/sys/kern/core_elf32.c:1.49	Thu Sep 29 20:40:53 2016
+++ src/sys/kern/core_elf32.c	Fri Jan  6 22:53:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: core_elf32.c,v 1.49 2016/09/29 20:40:53 christos Exp $	*/
+/*	$NetBSD: core_elf32.c,v 1.50 2017/01/06 22:53:17 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.49 2016/09/29 20:40:53 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.50 2017/01/06 22:53:17 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_coredump.h"
@@ -357,8 +357,8 @@ coredump_note_procinfo(struct lwp *l, st
 	/* First, write an elfcore_procinfo. */
 	cpi.cpi_version = NETBSD_ELFCORE_PROCINFO_VERSION;
 	cpi.cpi_cpisize = sizeof(cpi);
-	cpi.cpi_signo = p->p_sigctx.ps_signo;
-	cpi.cpi_sigcode = p->p_sigctx.ps_code;
+	cpi.cpi_signo = p->p_sigctx.ps_info._signo;
+	cpi.cpi_sigcode = p->p_sigctx.ps_info._code;
 	cpi.cpi_siglwp = p->p_sigctx.ps_lwp;
 
 	/*

Index: src/sys/kern/core_netbsd.c
diff -u src/sys/kern/core_netbsd.c:1.22 src/sys/kern/core_netbsd.c:1.23
--- src/sys/kern/core_netbsd.c:1.22	Tue Jan  7 07:59:03 2014
+++ src/sys/kern/core_netbsd.c	Fri Jan  6 22:53:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: core_netbsd.c,v 1.22 2014/01/07 07:59:03 dsl Exp $	*/
+/*	$NetBSD: core_netbsd.c,v 1.23 2017/01/06 22:53:17 kamil Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: core_netbsd.c,v 1.22 2014/01/07 07:59:03 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_netbsd.c,v 1.23 2017/01/06 22:53:17 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_coredump.h"
@@ -88,8 +88,8 @@ CORENAME(coredump_netbsd)(struct lwp *l,
 	cs.core.c_midmag = 0;
 	strncpy(cs.core.c_name, p->p_comm, MAXCOMLEN);
 	cs.core.c_nseg = 0;
-	cs.core.c_signo = p->p_sigctx.ps_signo;
-	cs.core.c_ucode = p->p_sigctx.ps_code;
+	cs.core.c_signo = p->p_sigctx.ps_info._signo;
+	cs.core.c_ucode = p->p_sigctx.ps_info._code;
 	cs.core.c_cpusize = 0;
 	cs.core.c_tsize = (u_long)ctob(vm->vm_tsize);
 	cs.core.c_dsize = (u_long)ctob(vm->vm_dsize);

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.331 src/sys/kern/kern_sig.c:1.332
--- src/sys/kern/kern_sig.c:1.331	Sun Dec  4 16:40:43 2016
+++ src/sys/kern/kern_sig.c	Fri Jan  6 22:53:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.331 2016/12/04 16:40:43 christos Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.332 2017/01/06 22:53:17 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.331 2016/12/04 16:40:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.332 2017/01/06 22:53:17 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1240,8 +1240,7 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
 
 	/* XXX for core dump/debugger */
 	p->p_sigctx.ps_lwp = ksi->ksi_lid;
-	p->p_sigctx.ps_signo = ksi->ksi_signo;
-	p->p_sigctx.ps_code = ksi->ksi_trap;
+	p->p_sigctx.ps_info = ksi->ksi_info;
 
 	/*
 	 * Notify any interested parties of the signal.
@@ -1860,8 +1859,16 @@ postsig(int signo)
 	l->l_ru.ru_nsignals++;
 	if (l->l_sigpendset == NULL) {
 		/* From 

CVS commit: src/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:53:17 UTC 2017

Modified Files:
src/sys/kern: core_elf32.c core_netbsd.c kern_sig.c sys_ptrace_common.c
src/sys/sys: ptrace.h signalvar.h

Log Message:
Introduce new ptrace(2) interface: PT_SET_SIGINFO and PT_GET_SIGINFO

This interface is designed to read signal information emited to tracee and
fake this signal with new value.

This functionality is required to distinguish types of events that occured
in the tracee and intercepted by a debugger.

These accessors introduce a new structure type ptrace_siginfo:
/*
 * Signal Information structure
 */
typedef struct ptrace_siginfo {
   siginfo_t   psi_siginfo;/* signal information structure */
   lwpid_t psi_lwpid;  /* destination LWP of the signal
* value 0 means the whole process
* (route signal to all LWPs) */
} ptrace_siginfo_t;

Include  in  in order to not break existing
software due to unknown symbol siginfo_t.

This interface has been proposed to the tech-kern@ mailing list.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/core_elf32.c
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/core_netbsd.c
cvs rdiff -u -r1.331 -r1.332 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/sys_ptrace_common.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/ptrace.h
cvs rdiff -u -r1.87 -r1.88 src/sys/sys/signalvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:42:58 UTC 2017

Modified Files:
src/sys/kern: kern_exec.c
src/sys/sys: siginfo.h

Log Message:
Introduce new SIGTRAP code: TRAP_EXEC

On exec() events under a debugger generate the SIGTRAP signal with
TRAP_EXEC property. This allows tracer to distinguish exec() events easily.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.438 -r1.439 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.26 -r1.27 src/sys/sys/siginfo.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:42:58 UTC 2017

Modified Files:
src/sys/kern: kern_exec.c
src/sys/sys: siginfo.h

Log Message:
Introduce new SIGTRAP code: TRAP_EXEC

On exec() events under a debugger generate the SIGTRAP signal with
TRAP_EXEC property. This allows tracer to distinguish exec() events easily.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.438 -r1.439 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.26 -r1.27 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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.438 src/sys/kern/kern_exec.c:1.439
--- src/sys/kern/kern_exec.c:1.438	Thu Nov  3 22:08:30 2016
+++ src/sys/kern/kern_exec.c	Fri Jan  6 22:42:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.438 2016/11/03 22:08:30 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.438 2016/11/03 22:08:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1318,6 +1318,7 @@ execve_runproc(struct lwp *l, struct exe
 
 		KSI_INIT_EMPTY();
 		ksi.ksi_signo = SIGTRAP;
+		ksi.ksi_code = TRAP_EXEC;
 		ksi.ksi_lid = l->l_lid;
 		kpsignal(p, , NULL);
 	}

Index: src/sys/sys/siginfo.h
diff -u src/sys/sys/siginfo.h:1.26 src/sys/sys/siginfo.h:1.27
--- src/sys/sys/siginfo.h:1.26	Tue Dec 27 02:20:46 2016
+++ src/sys/sys/siginfo.h	Fri Jan  6 22:42:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.26 2016/12/27 02:20:46 kamil Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.27 2017/01/06 22:42:58 kamil Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -210,6 +210,7 @@ typedef union siginfo {
 /* SIGTRAP */
 #define	TRAP_BRKPT	1	/* Process breakpoint			*/
 #define	TRAP_TRACE	2	/* Process trace trap			*/
+#define	TRAP_EXEC	3	/* Process exec trap			*/
 
 /* SIGCHLD */
 #define	CLD_EXITED	1	/* Child has exited			*/



CVS commit: src/tests/kernel

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:40:06 UTC 2017

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Add new test siginfo4 in t_ptrace_wait{,3,4,6,id,pid}

siginfo4:
Detect SIGTRAP TRAP_EXEC from tracee

This test is currently disabled and it will be enabled once
PT_[SG]ET_SIGINFO will land the sources.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/kernel/t_ptrace_wait.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/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.49 src/tests/kernel/t_ptrace_wait.c:1.50
--- src/tests/kernel/t_ptrace_wait.c:1.49	Wed Jan  4 22:27:20 2017
+++ src/tests/kernel/t_ptrace_wait.c	Fri Jan  6 22:40:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.49 2017/01/04 22:27:20 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.50 2017/01/06 22:40:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.49 2017/01/04 22:27:20 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.50 2017/01/06 22:40:06 kamil Exp $");
 
 #include 
 #include 
@@ -4701,6 +4701,66 @@ ATF_TC_BODY(siginfo3, tc)
 }
 #endif
 
+#if defined(HAVE_SIGINFO)
+ATF_TC(siginfo4);
+ATF_TC_HEAD(siginfo4, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Detect SIGTRAP TRAP_EXEC from tracee");
+}
+
+ATF_TC_BODY(siginfo4, tc)
+{
+	const int sigval = SIGTRAP;
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	struct ptrace_siginfo info;
+	memset(, 0, sizeof(info));
+
+	printf("Before forking process PID=%d\n", getpid());
+	ATF_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		printf("Before calling execve(2) from child\n");
+		execlp("/bin/echo", "/bin/echo", NULL);
+
+		FORKEE_ASSERT(0 && "Not reached");
+	}
+	printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_EXEC);
+
+	printf("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 	setvbuf(stdout, NULL, _IONBF, 0);
@@ -4786,6 +4846,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC_HAVE_SIGINFO(tp, siginfo1);
 	ATF_TP_ADD_TC_HAVE_SIGINFO(tp, siginfo2);
 	ATF_TP_ADD_TC_HAVE_SIGINFO(tp, siginfo3);
+	ATF_TP_ADD_TC_HAVE_SIGINFO(tp, siginfo4);
 
 	return atf_no_error();
 }



CVS commit: src/tests/kernel

2017-01-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  6 22:40:06 UTC 2017

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Add new test siginfo4 in t_ptrace_wait{,3,4,6,id,pid}

siginfo4:
Detect SIGTRAP TRAP_EXEC from tracee

This test is currently disabled and it will be enabled once
PT_[SG]ET_SIGINFO will land the sources.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/kernel/t_ptrace_wait.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 20:27:19 UTC 2017

Modified Files:
src/tools/dbsym: Makefile
src/tools/mdsetimage: Makefile

Log Message:
handle the case where we don't have the files built yet


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tools/dbsym/Makefile
cvs rdiff -u -r1.12 -r1.13 src/tools/mdsetimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 20:27:19 UTC 2017

Modified Files:
src/tools/dbsym: Makefile
src/tools/mdsetimage: Makefile

Log Message:
handle the case where we don't have the files built yet


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tools/dbsym/Makefile
cvs rdiff -u -r1.12 -r1.13 src/tools/mdsetimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/dbsym/Makefile
diff -u src/tools/dbsym/Makefile:1.10 src/tools/dbsym/Makefile:1.11
--- src/tools/dbsym/Makefile:1.10	Fri Jan  6 12:22:51 2017
+++ src/tools/dbsym/Makefile	Fri Jan  6 15:27:19 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2017/01/06 17:22:51 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2017/01/06 20:27:19 christos Exp $
 
 NOMAN=	# defined
 
@@ -16,7 +16,9 @@ IBERTYDIR=	${TOOLCHAINOBJ}/build/libiber
 
 LDMAKEFILE=${TOOLCHAINOBJ}/build/ld/Makefile
 .if exists(${LDMAKEFILE})
-HAVE_LIBDL!=		grep -- -ldl ${LDMAKEFILE} || echo no
+HAVE_LIBDL!=	grep -- -ldl ${LDMAKEFILE} || echo no
+.else
+HAVE_LIBDL=	no
 .endif
 
 .if ${HAVE_LIBDL} != "no"

Index: src/tools/mdsetimage/Makefile
diff -u src/tools/mdsetimage/Makefile:1.12 src/tools/mdsetimage/Makefile:1.13
--- src/tools/mdsetimage/Makefile:1.12	Fri Jan  6 12:22:51 2017
+++ src/tools/mdsetimage/Makefile	Fri Jan  6 15:27:19 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2017/01/06 17:22:51 christos Exp $
+#	$NetBSD: Makefile,v 1.13 2017/01/06 20:27:19 christos Exp $
 
 NOMAN=	# defined
 
@@ -17,7 +17,9 @@ IBERTYDIR=	${TOOLCHAINOBJ}/build/libiber
 
 LDMAKEFILE=${TOOLCHAINOBJ}/build/ld/Makefile
 .if exists(${LDMAKEFILE})
-HAVE_LIBDL!=		grep -- -ldl ${LDMAKEFILE} || echo no
+HAVE_LIBDL!=	grep -- -ldl ${LDMAKEFILE} || echo no
+.else
+HAVE_LIBDL=	no
 .endif
 
 .if ${HAVE_LIBDL} != "no"



CVS commit: src/usr.sbin/npf/npfd

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 19:20:24 UTC 2017

Modified Files:
src/usr.sbin/npf/npfd: Makefile npfd.c npfd.h npfd_log.c

Log Message:
Add log validation


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npfd/Makefile \
src/usr.sbin/npf/npfd/npfd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfd/npfd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npfd/npfd_log.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/npf/npfd/Makefile
diff -u src/usr.sbin/npf/npfd/Makefile:1.3 src/usr.sbin/npf/npfd/Makefile:1.4
--- src/usr.sbin/npf/npfd/Makefile:1.3	Fri Dec 30 14:55:46 2016
+++ src/usr.sbin/npf/npfd/Makefile	Fri Jan  6 14:20:24 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2016/12/30 19:55:46 christos Exp $
+# $NetBSD: Makefile,v 1.4 2017/01/06 19:20:24 christos Exp $
 #
 # Public Domain
 #
@@ -6,7 +6,7 @@
 NOMAN=
 PROG=		npfd
 
-#DBG=-g
+DBG=-g
 SRCS=		npfd.c npfd_log.c
 CPPFLAGS+=	-I${.CURDIR}
 
Index: src/usr.sbin/npf/npfd/npfd.h
diff -u src/usr.sbin/npf/npfd/npfd.h:1.3 src/usr.sbin/npf/npfd/npfd.h:1.4
--- src/usr.sbin/npf/npfd/npfd.h:1.3	Fri Dec 30 14:55:46 2016
+++ src/usr.sbin/npf/npfd/npfd.h	Fri Jan  6 14:20:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npfd.h,v 1.3 2016/12/30 19:55:46 christos Exp $	*/
+/*	$NetBSD: npfd.h,v 1.4 2017/01/06 19:20:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
 struct npf_log;
 typedef struct npfd_log npfd_log_t;
 
-npfd_log_t *	npfd_log_create(const char *, const char *, int);
+npfd_log_t *	npfd_log_create(const char *, const char *, const char *, int);
 void		npfd_log_destroy(npfd_log_t *);
 int		npfd_log_getsock(npfd_log_t *);
 bool		npfd_log_reopen(npfd_log_t *, bool);

Index: src/usr.sbin/npf/npfd/npfd.c
diff -u src/usr.sbin/npf/npfd/npfd.c:1.4 src/usr.sbin/npf/npfd/npfd.c:1.5
--- src/usr.sbin/npf/npfd/npfd.c:1.4	Fri Dec 30 14:55:46 2016
+++ src/usr.sbin/npf/npfd/npfd.c	Fri Jan  6 14:20:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npfd.c,v 1.4 2016/12/30 19:55:46 christos Exp $	*/
+/*	$NetBSD: npfd.c,v 1.5 2017/01/06 19:20:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npfd.c,v 1.4 2016/12/30 19:55:46 christos Exp $");
+__RCSID("$NetBSD: npfd.c,v 1.5 2017/01/06 19:20:24 christos Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: npfd.c,v 1.4 2016/12/3
 
 #include "npfd.h"
 
-static volatile sig_atomic_t hup, stats, done;
+static volatile sig_atomic_t hup, stats, done, flush;
 
 static int
 npfd_getctl(void)
@@ -87,6 +87,9 @@ npfd_event_loop(npfd_log_t *log, int del
 		if (stats) {
 			stats = false;
 			npfd_log_stats(log);
+		}
+		if (flush) {
+			flush = false;
 			npfd_log_flush(log);
 		}
 		switch (poll(, 1, delay)) {
@@ -118,9 +121,11 @@ sighandler(int sig)
 		done = true;
 		break;
 	case SIGINFO:
-	case SIGQUIT:
 		stats = true;
 		break;
+	case SIGALRM:
+		flush = true;
+		break;
 	default:
 		syslog(LOG_ERR, "Unhandled signal %d", sig);
 		break;
@@ -131,7 +136,8 @@ static __dead void
 usage(void)
 {
 	fprintf(stderr, "Usage: %s [-D] [-d ] [-i ]"
-	" [-p ] [-s ] expression\n", getprogname());
+	" [-f ] [-p ] [-s ] expression\n",
+	getprogname());
 	exit(EXIT_FAILURE);
 }
 
@@ -165,11 +171,12 @@ main(int argc, char **argv)
 	const char *iface = "npflog0";
 	int snaplen = 116;
 	char *pidname = NULL;
+	char *filename = NULL;
 
 	int fd = npfd_getctl();
 	(void)close(fd);
 
-	while ((ch = getopt(argc, argv, "Dd:i:p:s:")) != -1) {
+	while ((ch = getopt(argc, argv, "Dd:f:i:p:s:")) != -1) {
 		switch (ch) {
 		case 'D':
 			daemon_off = true;
@@ -177,6 +184,9 @@ main(int argc, char **argv)
 		case 'd':
 			delay = atoi(optarg) * 1000;
 			break;
+		case 'f':
+			filename = optarg;
+			break;
 		case 'i':
 			iface = optarg;
 			break;
@@ -196,7 +206,7 @@ main(int argc, char **argv)
 
 	char *filter = copyargs(argc, argv);
 
-	npfd_log_t *log = npfd_log_create(iface, filter, snaplen);
+	npfd_log_t *log = npfd_log_create(filename, iface, filter, snaplen);
 
 	if (!daemon_off) {
 		if (daemon(0, 0) == -1)

Index: src/usr.sbin/npf/npfd/npfd_log.c
diff -u src/usr.sbin/npf/npfd/npfd_log.c:1.5 src/usr.sbin/npf/npfd/npfd_log.c:1.6
--- src/usr.sbin/npf/npfd/npfd_log.c:1.5	Thu Jan  5 11:23:31 2017
+++ src/usr.sbin/npf/npfd/npfd_log.c	Fri Jan  6 14:20:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npfd_log.c,v 1.5 2017/01/05 16:23:31 christos Exp $	*/
+/*	$NetBSD: npfd_log.c,v 1.6 2017/01/06 19:20:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,10 +30,12 @@
  */
 
 #include 
-__RCSID("$NetBSD: npfd_log.c,v 1.5 2017/01/05 16:23:31 christos Exp $");
+__RCSID("$NetBSD: npfd_log.c,v 1.6 2017/01/06 19:20:24 christos Exp $");
 
 #include 
 #include 
+#include 
+
 #include 
 
 #include 
@@ -69,8 +71,138 @@ 

CVS commit: src/usr.sbin/npf/npfd

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 19:20:24 UTC 2017

Modified Files:
src/usr.sbin/npf/npfd: Makefile npfd.c npfd.h npfd_log.c

Log Message:
Add log validation


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npfd/Makefile \
src/usr.sbin/npf/npfd/npfd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfd/npfd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npfd/npfd_log.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/flex

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:26:41 UTC 2017

Modified Files:
src/external/bsd/flex: Makefile.inc

Log Message:
get the right version even for the tools build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/flex

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:26:41 UTC 2017

Modified Files:
src/external/bsd/flex: Makefile.inc

Log Message:
get the right version even for the tools build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/flex/Makefile.inc
diff -u src/external/bsd/flex/Makefile.inc:1.5 src/external/bsd/flex/Makefile.inc:1.6
--- src/external/bsd/flex/Makefile.inc:1.5	Fri Jan  6 12:13:22 2017
+++ src/external/bsd/flex/Makefile.inc	Fri Jan  6 12:26:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.5 2017/01/06 17:13:22 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.6 2017/01/06 17:26:41 christos Exp $
 
 WARNS?=	1
 
@@ -7,7 +7,7 @@ WARNS?=	1
 BINDIR?= /usr/bin
 
 IDIST=	${NETBSDSRCDIR}/external/bsd/flex/dist/src
-.if defined(HOSTPROGNAME)
+.if !empty(TOOL_SED:M*/*) && !exists(${TOOL_SED})
 VERSION = 3.x
 .else
 VERSION != ${TOOL_SED} -ne "s/PACKAGE_VERSION='\(.*\)'/\1/p" \



CVS commit: src/usr.sbin/zic

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:25:32 UTC 2017

Modified Files:
src/usr.sbin/zic: Makefile

Log Message:
don't try to run a non-existing nbcat


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/zic/Makefile

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/zic/Makefile
diff -u src/usr.sbin/zic/Makefile:1.19 src/usr.sbin/zic/Makefile:1.20
--- src/usr.sbin/zic/Makefile:1.19	Thu Oct 20 13:38:28 2016
+++ src/usr.sbin/zic/Makefile	Fri Jan  6 12:25:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.19 2016/10/20 17:38:28 christos Exp $
+#	$NetBSD: Makefile,v 1.20 2017/01/06 17:25:32 christos Exp $
 
 .include "Makefile.inc"
 .include 
@@ -8,7 +8,11 @@ COPTS.zic.c	+= -Wno-format-nonliteral
 PROG=	zic
 SRCS=	zic.c
 MAN=	zic.8
+.if !empty(TOOL_CAT:M*/*) && !exists(${TOOL_CAT})
+TZVERSION=0
+.else
 TZVERSION!= ${TOOL_CAT} ${NETBSDSRCDIR}/lib/libc/time/version
+.endif
 CPPFLAGS+=-DPKGVERSION='"(tzcode) "' -DTZVERSION='"${TZVERSION}"'
 
 .PATH: ${NETBSDSRCDIR}/lib/libc/time
@@ -18,4 +22,7 @@ LDADD+=-lutil
 DPADD+=${LIBUTIL}
 .endif
 
+foo:
+	echo ${TZVERSION}
+
 .include 



CVS commit: src/usr.sbin/zic

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:25:32 UTC 2017

Modified Files:
src/usr.sbin/zic: Makefile

Log Message:
don't try to run a non-existing nbcat


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/zic/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:22:51 UTC 2017

Modified Files:
src/tools/dbsym: Makefile
src/tools/mdsetimage: Makefile

Log Message:
don't run grep if we don't have the Makefile, like when we are building
objdirs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tools/dbsym/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/mdsetimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tools

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:22:51 UTC 2017

Modified Files:
src/tools/dbsym: Makefile
src/tools/mdsetimage: Makefile

Log Message:
don't run grep if we don't have the Makefile, like when we are building
objdirs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tools/dbsym/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/mdsetimage/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/dbsym/Makefile
diff -u src/tools/dbsym/Makefile:1.9 src/tools/dbsym/Makefile:1.10
--- src/tools/dbsym/Makefile:1.9	Mon Feb  1 09:18:16 2016
+++ src/tools/dbsym/Makefile	Fri Jan  6 12:22:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2016/02/01 14:18:16 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2017/01/06 17:22:51 christos Exp $
 
 NOMAN=	# defined
 
@@ -14,8 +14,11 @@ IBERTYDIR=	${TOOLCHAINOBJ}/build/libiber
 
 .include "${.CURDIR}/../Makefile.host"
 
-LIBDL!=		grep -- -ldl ${TOOLCHAINOBJ}/build/ld/Makefile || echo no
+LDMAKEFILE=${TOOLCHAINOBJ}/build/ld/Makefile
+.if exists(${LDMAKEFILE})
+HAVE_LIBDL!=		grep -- -ldl ${LDMAKEFILE} || echo no
+.endif
 
-.if ${LIBDL} != "no"
-LDADD+= -ldl
+.if ${HAVE_LIBDL} != "no"
+LDADD+=	-ldl
 .endif

Index: src/tools/mdsetimage/Makefile
diff -u src/tools/mdsetimage/Makefile:1.11 src/tools/mdsetimage/Makefile:1.12
--- src/tools/mdsetimage/Makefile:1.11	Mon Feb  1 09:17:21 2016
+++ src/tools/mdsetimage/Makefile	Fri Jan  6 12:22:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2016/02/01 14:17:21 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2017/01/06 17:22:51 christos Exp $
 
 NOMAN=	# defined
 
@@ -14,8 +14,12 @@ IBERTYDIR=	${TOOLCHAINOBJ}/build/libiber
 
 .include "${.CURDIR}/../Makefile.host"
 
-LIBDL!=		grep -- -ldl ${TOOLCHAINOBJ}/build/ld/Makefile || echo no
 
-.if ${LIBDL} != "no"
+LDMAKEFILE=${TOOLCHAINOBJ}/build/ld/Makefile
+.if exists(${LDMAKEFILE})
+HAVE_LIBDL!=		grep -- -ldl ${LDMAKEFILE} || echo no
+.endif
+
+.if ${HAVE_LIBDL} != "no"
 LDADD+=	-ldl
 .endif



CVS commit: src/external/bsd/flex

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:13:22 UTC 2017

Modified Files:
src/external/bsd/flex: Makefile.inc

Log Message:
don't use sed for the tools version because during objdir etc runs we don't
have ${TOOL_SED} yet available.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/flex/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/flex/Makefile.inc
diff -u src/external/bsd/flex/Makefile.inc:1.4 src/external/bsd/flex/Makefile.inc:1.5
--- src/external/bsd/flex/Makefile.inc:1.4	Mon Jan  2 12:45:26 2017
+++ src/external/bsd/flex/Makefile.inc	Fri Jan  6 12:13:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.4 2017/01/02 17:45:26 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.5 2017/01/06 17:13:22 christos Exp $
 
 WARNS?=	1
 
@@ -7,8 +7,12 @@ WARNS?=	1
 BINDIR?= /usr/bin
 
 IDIST=	${NETBSDSRCDIR}/external/bsd/flex/dist/src
+.if defined(HOSTPROGNAME)
+VERSION = 3.x
+.else
 VERSION != ${TOOL_SED} -ne "s/PACKAGE_VERSION='\(.*\)'/\1/p" \
 	${IDIST}/../configure
+.endif
 
 CPPFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/../include -I${IDIST} \
 	-DLOCALEDIR=\"/usr/share/locale\"



CVS commit: src/external/bsd/flex

2017-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  6 17:13:22 UTC 2017

Modified Files:
src/external/bsd/flex: Makefile.inc

Log Message:
don't use sed for the tools version because during objdir etc runs we don't
have ${TOOL_SED} yet available.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/flex/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch

2017-01-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  6 14:55:37 UTC 2017

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_plcom.c
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
Use the VC property mailbox to request the UART clock rate and use it
appropriately

Newer firmwares use 48MHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_plcom.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/evbarm/rpi/rpi_machdep.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/broadcom/bcm2835_plcom.c
diff -u src/sys/arch/arm/broadcom/bcm2835_plcom.c:1.3 src/sys/arch/arm/broadcom/bcm2835_plcom.c:1.4
--- src/sys/arch/arm/broadcom/bcm2835_plcom.c:1.3	Wed Jul 29 14:22:49 2015
+++ src/sys/arch/arm/broadcom/bcm2835_plcom.c	Fri Jan  6 14:55:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_plcom.c,v 1.3 2015/07/29 14:22:49 skrll Exp $	*/
+/*	$NetBSD: bcm2835_plcom.c,v 1.4 2017/01/06 14:55:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Interface to plcom (PL011) serial driver. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_plcom.c,v 1.3 2015/07/29 14:22:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_plcom.c,v 1.4 2017/01/06 14:55:37 skrll Exp $");
 
 #include 
 #include 
@@ -69,11 +69,19 @@ static void
 bcm2835_plcom_attach(device_t parent, device_t self, void *aux)
 {
 	struct plcom_softc *sc = device_private(self);
+	prop_dictionary_t dict = device_properties(self);
 	struct amba_attach_args *aaa = aux;
 	void *ih;
 
 	sc->sc_dev = self;
 	sc->sc_frequency = BCM2835_UART0_CLK;
+
+/* Fetch the UART clock frequency from property if set. */
+	prop_number_t frequency = prop_dictionary_get(dict, "frequency");
+if (frequency != NULL) {
+		sc->sc_frequency = prop_number_integer_value(frequency);
+}
+
 	sc->sc_hwflags = PLCOM_HW_TXFIFO_DISABLE;
 	sc->sc_swflags = 0;
 	sc->sc_set_mcr = NULL;

Index: src/sys/arch/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.69 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.70
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.69	Fri Jan  6 14:53:32 2017
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Fri Jan  6 14:55:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.70 2017/01/06 14:55:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.70 2017/01/06 14:55:37 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -131,6 +131,8 @@ static void rpi_device_register(device_t
 #define RPI_FB_HEIGHT	720
 #endif
 
+int uart_clk = BCM2835_UART0_CLK;
+
 #define	PLCONADDR BCM2835_UART0_BASE
 
 #ifndef CONSDEVNAME
@@ -177,6 +179,28 @@ static struct plcom_instance rpi_pi = {
 
 static struct __aligned(16) {
 	struct vcprop_buffer_hdr	vb_hdr;
+	struct vcprop_tag_clockrate	vbt_uartclockrate;
+	struct vcprop_tag end;
+} vb_uart = {
+	.vb_hdr = {
+		.vpb_len = sizeof(vb_uart),
+		.vpb_rcode = VCPROP_PROCESS_REQUEST,
+	},
+	.vbt_uartclockrate = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_CLOCKRATE,
+			.vpt_len = VCPROPTAG_LEN(vb_uart.vbt_uartclockrate),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+		.id = VCPROP_CLK_UART
+	},
+	.end = {
+		.vpt_tag = VCPROPTAG_NULL
+	}
+};
+
+static struct __aligned(16) {
+	struct vcprop_buffer_hdr	vb_hdr;
 	struct vcprop_tag_fwrev		vbt_fwrev;
 	struct vcprop_tag_boardmodel	vbt_boardmodel;
 	struct vcprop_tag_boardrev	vbt_boardrev;
@@ -391,6 +415,26 @@ static uint8_t cursor_mask[8 * 64], curs
 
 
 static void
+rpi_uartinit(void)
+{
+	const paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
+	const bus_space_tag_t iot = _bs_tag;
+	const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(pa);
+	uint32_t res;
+
+	bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC, KERN_VTOPHYS(_uart));
+
+	bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, );
+
+	cpu_dcache_inv_range((vaddr_t), sizeof(vb));
+
+	if (vcprop_tag_success_p(_uart.vbt_uartclockrate.tag))
+		uart_clk = vb_uart.vbt_uartclockrate.rate;
+}
+
+
+
+static void
 rpi_bootparams(void)
 {
 	const paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
@@ -596,6 +640,8 @@ initarm(void *arg)
 
 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
 
+	rpi_uartinit();
+
 	consinit();
 
 	/* Talk to the user */
@@ -704,7 +750,7 @@ consinit(void)
 	 */
 	rpi_pi.pi_iobase = consaddr;
 
-	plcomcnattach(_pi, plcomcnspeed, BCM2835_UART0_CLK,
+	plcomcnattach(_pi, plcomcnspeed, uart_clk,
 	plcomcnmode, PLCOMCNUNIT);
 
 #endif
@@ -728,7 +774,7 @@ static kgdb_port_init(void)
 
 	rpi_pi.pi_iobase = consaddr;
 
-	res = plcom_kgdb_attach(_pi, KGDB_DEVRATE, 

CVS commit: src/sys/arch

2017-01-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  6 14:55:37 UTC 2017

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_plcom.c
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
Use the VC property mailbox to request the UART clock rate and use it
appropriately

Newer firmwares use 48MHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_plcom.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/evbarm/rpi/rpi_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm/rpi

2017-01-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  6 14:53:32 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/rpi/rpi_machdep.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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.68 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.69
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.68	Tue Feb  2 13:55:51 2016
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Fri Jan  6 14:53:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.68 2016/02/02 13:55:51 skrll Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.68 2016/02/02 13:55:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -188,8 +188,7 @@ static struct __aligned(16) {
 	struct vcprop_tag_clockrate	vbt_emmcclockrate;
 	struct vcprop_tag_clockrate	vbt_armclockrate;
 	struct vcprop_tag end;
-} vb =
-{
+} vb = {
 	.vb_hdr = {
 		.vpb_len = sizeof(vb),
 		.vpb_rcode = VCPROP_PROCESS_REQUEST,
@@ -276,8 +275,7 @@ static struct __aligned(16) {
 	struct vcprop_buffer_hdr	vb_hdr;
 	struct vcprop_tag_edidblock	vbt_edid;
 	struct vcprop_tag end;
-} vb_edid =
-{
+} vb_edid = {
 	.vb_hdr = {
 		.vpb_len = sizeof(vb_edid),
 		.vpb_rcode = VCPROP_PROCESS_REQUEST,
@@ -305,8 +303,7 @@ static struct __aligned(16) {
 	struct vcprop_tag_blankscreen	vbt_blank;
 	struct vcprop_tag_fbpitch	vbt_pitch;
 	struct vcprop_tag end;
-} vb_setfb =
-{
+} vb_setfb = {
 	.vb_hdr = {
 		.vpb_len = sizeof(vb_setfb),
 		.vpb_rcode = VCPROP_PROCESS_REQUEST,



CVS commit: src/sys/arch/evbarm/rpi

2017-01-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  6 14:53:32 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/rpi/rpi_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:25:41 UTC 2017

Modified Files:
src/lib/libcurses: addbytes.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libcurses/addbytes.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/libcurses/addbytes.c
diff -u src/lib/libcurses/addbytes.c:1.46 src/lib/libcurses/addbytes.c:1.47
--- src/lib/libcurses/addbytes.c:1.46	Fri Jan  6 14:06:45 2017
+++ src/lib/libcurses/addbytes.c	Fri Jan  6 14:25:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: addbytes.c,v 1.46 2017/01/06 14:06:45 roy Exp $	*/
+/*	$NetBSD: addbytes.c,v 1.47 2017/01/06 14:25:41 roy Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c	8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.46 2017/01/06 14:06:45 roy Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.47 2017/01/06 14:25:41 roy Exp $");
 #endif
 #endif/* not lint */
 
@@ -179,7 +179,7 @@ _cursesi_waddbytes(WINDOW *win, const ch
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT,
 		 "ADDBYTES WIDE(0x%x [%s], %x) at (%d, %d), ate %d bytes\n",
-		 (unsigned) wc, unctrl((unsigned) wc), attr, y, x, n);
+		 (unsigned)wc, unctrl((unsigned)wc), attr, y, x, n);
 #endif
 		cc.vals[0] = wc;
 		cc.elements = 1;
@@ -225,11 +225,11 @@ _cursesi_addbyte(WINDOW *win, __LINE **l
 			newx = tabsize - (*x % tabsize);
 			for (i = 0; i < newx; i++) {
 if (waddbytes(win, blank, 1) == ERR)
-	return (ERR);
+	return ERR;
 (*x)++;
 			}
 			PSYNCH_IN;
-			return (OK);
+			return OK;
 
 		case '\n':
 			PSYNCH_OUT;
@@ -241,13 +241,13 @@ _cursesi_addbyte(WINDOW *win, __LINE **l
 		case '\r':
 			*x = 0;
 			win->curx = *x;
-			return (OK);
+			return OK;
 
 		case '\b':
 			if (--(*x) < 0)
 *x = 0;
 			win->curx = *x;
-			return (OK);
+			return OK;
 		}
 	}
 
@@ -274,7 +274,7 @@ _cursesi_addbyte(WINDOW *win, __LINE **l
 		}
 		*lp = win->alines[*y];
 		if (c == '\n')
-			return (OK);
+			return OK;
 	}
 
 #ifdef DEBUG
@@ -334,7 +334,7 @@ _cursesi_addbyte(WINDOW *win, __LINE **l
 		 *win->alines[*y]->lastchp);
 #endif
 	__sync(win);
-	return (OK);
+	return OK;
 }
 
 /*
@@ -347,7 +347,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **
 		  const cchar_t *wch, int char_interp)
 {
 #ifndef HAVE_WCHAR
-	return (ERR);
+	return ERR;
 #else
 	int sx = 0, ex = 0, cw = 0, i = 0, newx = 0, tabsize;
 	__LDATA *lp = >alines[*y]->line[*x], *tp = NULL;
@@ -593,9 +593,9 @@ _cursesi_addwchar(WINDOW *win, __LINE **
 			while (ex < win->maxx && WCOL(*tp) < 0) {
 #ifdef DEBUG
 __CTRACE(__CTRACE_INPUT,
- 	"_cursesi_addwchar: clear "
- 	"remaining of current char (%d,%d)nn",
- 	*y, ex);
+"_cursesi_addwchar: clear "
+"remaining of current char (%d,%d)nn",
+*y, ex);
 #endif /* DEBUG */
 tp->ch = (wchar_t) btowc((int) win->bch);
 if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:25:41 UTC 2017

Modified Files:
src/lib/libcurses: addbytes.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libcurses/addbytes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:06:45 UTC 2017

Modified Files:
src/lib/libcurses: addbytes.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libcurses/addbytes.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/libcurses/addbytes.c
diff -u src/lib/libcurses/addbytes.c:1.45 src/lib/libcurses/addbytes.c:1.46
--- src/lib/libcurses/addbytes.c:1.45	Mon Jan  2 10:28:34 2017
+++ src/lib/libcurses/addbytes.c	Fri Jan  6 14:06:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $	*/
+/*	$NetBSD: addbytes.c,v 1.46 2017/01/06 14:06:45 roy Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c	8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.46 2017/01/06 14:06:45 roy Exp $");
 #endif
 #endif/* not lint */
 
@@ -60,6 +60,7 @@ __RCSID("$NetBSD: addbytes.c,v 1.45 2017
 int
 addbytes(const char *bytes, int count)
 {
+
 	return _cursesi_waddbytes(stdscr, bytes, count, 0, 1);
 }
 
@@ -70,6 +71,7 @@ addbytes(const char *bytes, int count)
 int
 waddbytes(WINDOW *win, const char *bytes, int count)
 {
+
 	return _cursesi_waddbytes(win, bytes, count, 0, 1);
 }
 
@@ -80,6 +82,7 @@ waddbytes(WINDOW *win, const char *bytes
 int
 mvaddbytes(int y, int x, const char *bytes, int count)
 {
+
 	return mvwaddbytes(stdscr, y, x, bytes, count);
 }
 
@@ -90,6 +93,7 @@ mvaddbytes(int y, int x, const char *byt
 int
 mvwaddbytes(WINDOW *win, int y, int x, const char *bytes, int count)
 {
+
 	if (wmove(win, y, x) == ERR)
 		return ERR;
 
@@ -101,6 +105,7 @@ mvwaddbytes(WINDOW *win, int y, int x, c
 int
 __waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
 {
+
 	return _cursesi_waddbytes(win, bytes, count, attr, 1);
 }
 



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:06:45 UTC 2017

Modified Files:
src/lib/libcurses: addbytes.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libcurses/addbytes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:06:00 UTC 2017

Modified Files:
src/lib/libcurses: addch.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libcurses/addch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 14:06:00 UTC 2017

Modified Files:
src/lib/libcurses: addch.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libcurses/addch.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/libcurses/addch.c
diff -u src/lib/libcurses/addch.c:1.17 src/lib/libcurses/addch.c:1.18
--- src/lib/libcurses/addch.c:1.17	Sat Nov  9 11:16:59 2013
+++ src/lib/libcurses/addch.c	Fri Jan  6 14:06:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: addch.c,v 1.17 2013/11/09 11:16:59 blymn Exp $	*/
+/*	$NetBSD: addch.c,v 1.18 2017/01/06 14:06:00 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addch.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addch.c,v 1.17 2013/11/09 11:16:59 blymn Exp $");
+__RCSID("$NetBSD: addch.c,v 1.18 2017/01/06 14:06:00 roy Exp $");
 #endif
 #endif/* not lint */
 
@@ -51,6 +51,7 @@ __RCSID("$NetBSD: addch.c,v 1.17 2013/11
 int
 addch(chtype ch)
 {
+
 	return waddch(stdscr, ch);
 }
 
@@ -61,6 +62,7 @@ addch(chtype ch)
 int
 mvaddch(int y, int x, chtype ch)
 {
+
 	return mvwaddch(stdscr, y, x, ch);
 }
 
@@ -71,6 +73,7 @@ mvaddch(int y, int x, chtype ch)
 int
 mvwaddch(WINDOW *win, int y, int x, chtype ch)
 {
+
 	if (wmove(win, y, x) == ERR)
 		return ERR;
 
@@ -96,8 +99,8 @@ waddch(WINDOW *win, chtype ch)
 #ifdef HAVE_WCHAR
 	__cursesi_chtype_to_cchar(ch, );
 #else
-	buf.ch = (wchar_t) ch & __CHARTEXT;
-	buf.attr = (attr_t) ch & __ATTRIBUTES;
+	buf.ch = (wchar_t)ch & __CHARTEXT;
+	buf.attr = (attr_t)ch & __ATTRIBUTES;
 #endif
 
 #ifdef DEBUG
@@ -111,9 +114,9 @@ waddch(WINDOW *win, chtype ch)
 #endif
 
 #ifdef HAVE_WCHAR
-	return (wadd_wch(win, ));
+	return wadd_wch(win, );
 #else
-	return (__waddch(win, ));
+	return __waddch(win, );
 #endif
 }
 
@@ -124,5 +127,5 @@ __waddch(WINDOW *win, __LDATA *dp)
 
 	buf[0] = dp->ch;
 	buf[1] = '\0';
-	return (_cursesi_waddbytes(win, buf, 1, dp->attr, 1));
+	return _cursesi_waddbytes(win, buf, 1, dp->attr, 1);
 }



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 13:53:18 UTC 2017

Modified Files:
src/lib/libcurses: acs.c addnstr.c addwstr.c attributes.c background.c
bell.c border.c box.c cchar.c clrtobot.c clrtoeol.c color.c
copywin.c cr_put.c ctrace.c delch.c deleteln.c delwin.c erase.c
flushok.c fullname.c get_wch.c get_wstr.c getch.c getstr.c getyx.c
idcok.c idlok.c immedok.c in_wch.c in_wchstr.c inch.c inchstr.c
initscr.c ins_wch.c insch.c insdelln.c insertln.c insstr.c inwstr.c
keyname.c keypad.c leaveok.c line.c meta.c move.c mvwin.c newwin.c
nodelay.c notimeout.c pause.c printw.c putchar.c refresh.c resize.c
scanw.c screen.c scroll.c scrollok.c setterm.c standout.c syncok.c
timeout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c
underscore.c

Log Message:
KNF.
Normalise coding style.
White space police.
Sprinkle some extra braces to make the flow more clear.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libcurses/acs.c src/lib/libcurses/ctrace.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libcurses/addnstr.c \
src/lib/libcurses/box.c src/lib/libcurses/deleteln.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libcurses/addwstr.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libcurses/attributes.c \
src/lib/libcurses/putchar.c src/lib/libcurses/resize.c \
src/lib/libcurses/scanw.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libcurses/background.c \
src/lib/libcurses/border.c src/lib/libcurses/copywin.c \
src/lib/libcurses/toucholap.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libcurses/bell.c src/lib/libcurses/ins_wch.c \
src/lib/libcurses/line.c src/lib/libcurses/meta.c \
src/lib/libcurses/timeout.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libcurses/cchar.c \
src/lib/libcurses/flushok.c src/lib/libcurses/getyx.c \
src/lib/libcurses/scrollok.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/clrtobot.c \
src/lib/libcurses/delch.c src/lib/libcurses/getstr.c \
src/lib/libcurses/printw.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/clrtoeol.c
cvs rdiff -u -r1.40 -r1.41 src/lib/libcurses/color.c
cvs rdiff -u -r1.31 -r1.32 src/lib/libcurses/cr_put.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libcurses/delwin.c \
src/lib/libcurses/mvwin.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/erase.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libcurses/fullname.c \
src/lib/libcurses/get_wch.c src/lib/libcurses/idlok.c \
src/lib/libcurses/underscore.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libcurses/get_wstr.c \
src/lib/libcurses/in_wch.c src/lib/libcurses/in_wchstr.c \
src/lib/libcurses/inwstr.c
cvs rdiff -u -r1.61 -r1.62 src/lib/libcurses/getch.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libcurses/idcok.c \
src/lib/libcurses/immedok.c src/lib/libcurses/syncok.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libcurses/inch.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libcurses/inchstr.c \
src/lib/libcurses/keyname.c src/lib/libcurses/leaveok.c \
src/lib/libcurses/nodelay.c src/lib/libcurses/notimeout.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libcurses/initscr.c \
src/lib/libcurses/touchwin.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libcurses/insch.c \
src/lib/libcurses/scroll.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libcurses/insdelln.c \
src/lib/libcurses/move.c src/lib/libcurses/standout.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libcurses/insertln.c \
src/lib/libcurses/keypad.c src/lib/libcurses/tscroll.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/insstr.c
cvs rdiff -u -r1.49 -r1.50 src/lib/libcurses/newwin.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libcurses/pause.c
cvs rdiff -u -r1.82 -r1.83 src/lib/libcurses/refresh.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/screen.c
cvs rdiff -u -r1.58 -r1.59 src/lib/libcurses/setterm.c
cvs rdiff -u -r1.41 -r1.42 src/lib/libcurses/tstp.c
cvs rdiff -u -r1.45 -r1.46 src/lib/libcurses/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev

2017-01-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jan  6 09:32:08 UTC 2017

Modified Files:
src/sys/dev: spkr.c spkr_audio.c spkrvar.h
src/sys/dev/isa: spkr_pcppi.c

Log Message:
Implement a common spkr_detach() function and call it from the
attachment-specific detach functions.  Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated.  The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().

Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.

Addresses my PR kern/51785


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spkr.c src/sys/dev/spkrvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/spkr_audio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/spkr_pcppi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev

2017-01-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jan  6 09:32:08 UTC 2017

Modified Files:
src/sys/dev: spkr.c spkr_audio.c spkrvar.h
src/sys/dev/isa: spkr_pcppi.c

Log Message:
Implement a common spkr_detach() function and call it from the
attachment-specific detach functions.  Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated.  The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().

Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.

Addresses my PR kern/51785


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spkr.c src/sys/dev/spkrvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/spkr_audio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/spkr_pcppi.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/spkr.c
diff -u src/sys/dev/spkr.c:1.5 src/sys/dev/spkr.c:1.6
--- src/sys/dev/spkr.c:1.5	Thu Dec 15 06:55:55 2016
+++ src/sys/dev/spkr.c	Fri Jan  6 09:32:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.5 2016/12/15 06:55:55 pgoyette Exp $	*/
+/*	$NetBSD: spkr.c,v 1.6 2017/01/06 09:32:08 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.5 2016/12/15 06:55:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.6 2017/01/06 09:32:08 pgoyette Exp $");
 
 #include 
 #include 
@@ -358,6 +358,9 @@ spkr_attach(device_t self, void (*tone)(
 {
 	struct spkr_softc *sc = device_private(self);
 
+#ifdef SPKRDEBUG
+	aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit);
+#endif /* SPKRDEBUG */
 	sc->sc_dev = self;
 	sc->sc_tone = tone;
 	sc->sc_rest = rest;
@@ -365,6 +368,22 @@ spkr_attach(device_t self, void (*tone)(
 }
 
 int
+spkr_detach(device_t self, int flags)
+{
+	struct spkr_softc *sc = device_private(self);
+
+#ifdef SPKRDEBUG
+	aprint_debug("%s: entering for unit %d\n", __func__, self->dv_unit);
+#endif /* SPKRDEBUG */
+	if (sc == NULL)
+		return ENXIO;
+	if (sc->sc_inbuf != NULL)
+		return EBUSY;
+
+	return 0;
+}
+
+int
 spkropen(dev_t dev, int	flags, int mode, struct lwp *l)
 {
 #ifdef SPKRDEBUG
@@ -374,7 +393,7 @@ spkropen(dev_t dev, int	flags, int mode,
 
 	if (sc == NULL)
 		return ENXIO;
-	if (sc->sc_inbuf)
+	if (sc->sc_inbuf != NULL)
 		return EBUSY;
 
 	sc->sc_inbuf = malloc(DEV_BSIZE, M_DEVBUF, M_WAITOK);
@@ -393,7 +412,7 @@ spkrwrite(dev_t dev, struct uio *uio, in
 
 	if (sc == NULL)
 		return ENXIO;
-	if (!sc->sc_inbuf)
+	if (sc->sc_inbuf == NULL)
 		return EINVAL;
 
 	size_t n = min(DEV_BSIZE, uio->uio_resid);
@@ -414,7 +433,7 @@ spkrclose(dev_t dev, int flags, int mode
 
 	if (sc == NULL)
 		return ENXIO;
-	if (!sc->sc_inbuf)
+	if (sc->sc_inbuf == NULL)
 		return EINVAL;
 
 	sc->sc_tone(sc->sc_dev, 0, 0);
@@ -448,7 +467,7 @@ spkrioctl(dev_t dev, u_long cmd, void *d
 
 	if (sc == NULL)
 		return ENXIO;
-	if (!sc->sc_inbuf)
+	if (sc->sc_inbuf == NULL)
 		return EINVAL;
 
 	switch (cmd) {
@@ -493,20 +512,21 @@ spkr_modcmd(modcmd_t cmd, void *arg)
 			break;
 
 		error = config_init_component(cfdriver_ioconf_spkr,
-			cfattach_ioconf_spkr, cfdata_ioconf_spkr);
+		cfattach_ioconf_spkr, cfdata_ioconf_spkr);
 		if (error) {
 			devsw_detach(NULL, _cdevsw);
 		}
 		break;
 
 	case MODULE_CMD_FINI:
-		return EBUSY;
-#ifdef notyet
-		error = config_fini_component(cfdriver_ioconf_spkr,
-			cfattach_ioconf_spkr, cfdata_ioconf_spkr);
 		devsw_detach(NULL, _cdevsw);
+		error = config_fini_component(cfdriver_ioconf_spkr,
+		cfattach_ioconf_spkr, cfdata_ioconf_spkr);
+		if (error)
+			devsw_attach(spkr_cd.cd_name, NULL, ,
+			_cdevsw, );
 		break;
-#endif
+
 	default:
 		error = ENOTTY;
 		break;
Index: src/sys/dev/spkrvar.h
diff -u src/sys/dev/spkrvar.h:1.5 src/sys/dev/spkrvar.h:1.6
--- src/sys/dev/spkrvar.h:1.5	Thu Dec 15 06:48:14 2016
+++ src/sys/dev/spkrvar.h	Fri Jan  6 09:32:08 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: spkrvar.h,v 1.5 2016/12/15 06:48:14 pgoyette Exp $ */
+/* $NetBSD: spkrvar.h,v 1.6 2017/01/06 09:32:08 pgoyette Exp $ */
 
 #ifndef _SYS_DEV_SPKRVAR_H
 #define _SYS_DEV_SPKRVAR_H
@@ -23,4 +23,6 @@ struct spkr_softc {
 void spkr_attach(device_t,
 void (*)(device_t, u_int, u_int), void (*)(device_t, int));
 
+int spkr_detach(device_t, int);
+
 #endif /* _SYS_DEV_SPKRVAR_H */

Index: src/sys/dev/spkr_audio.c
diff -u src/sys/dev/spkr_audio.c:1.2 src/sys/dev/spkr_audio.c:1.3
--- src/sys/dev/spkr_audio.c:1.2	Thu Dec 15 06:48:14 2016
+++ src/sys/dev/spkr_audio.c	Fri Jan  6 09:32:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr_audio.c,v 1.2 2016/12/15 06:48:14 pgoyette Exp $	*/
+/*	$NetBSD: spkr_audio.c,v 1.3 2017/01/06 09:32:08 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr_audio.c,v 1.2 2016/12/15 06:48:14 

CVS commit: src/sys/lib/libsa

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 09:14:36 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
Explain how all that mess works, without actually fixing it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libsa/loadfile_elf32.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/lib/libsa

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 09:14:36 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
Explain how all that mess works, without actually fixing it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.33 src/sys/lib/libsa/loadfile_elf32.c:1.34
--- src/sys/lib/libsa/loadfile_elf32.c:1.33	Sat Dec  3 09:20:55 2016
+++ src/sys/lib/libsa/loadfile_elf32.c	Fri Jan  6 09:14:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.33 2016/12/03 09:20:55 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.34 2017/01/06 09:14:36 maxv Exp $ */
 
 /*
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -259,6 +259,21 @@ externalize_shdr(Elf_Byte bo, Elf_Shdr *
 #define IS_DATA(p)	(p.p_flags & PF_W)
 #define IS_BSS(p)	(p.p_filesz < p.p_memsz)
 
+/*
+ * Load the ELF binary into memory. Layout of the memory:
+ * +-++-+-+
+ * | KERNEL SEGMENTS | ELF HEADER | SECTION HEADERS | SYMBOL SECTIONS |
+ * +-++-+-+
+ * The KERNEL SEGMENTS start address is fixed by the segments themselves. We
+ * then map the rest by increasing maxp.
+ *
+ * The offsets of the SYMBOL SECTIONS are relative to the start address of the
+ * ELF HEADER. The shdr offset of ELF HEADER points to SECTION HEADERS.
+ *
+ * We just give the kernel a pointer to the ELF HEADER, which is enough for it
+ * to find the location and number of symbols by itself later.
+ */
+
 int
 ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
 {



CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 09:14:07 UTC 2017

Modified Files:
src/lib/libcurses: color.c cur_hash.c curses.h curses_private.h
refresh.c

Log Message:
u_int -> unsigned int, u_int32_t -> uint32_t.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libcurses/color.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libcurses/cur_hash.c
cvs rdiff -u -r1.118 -r1.119 src/lib/libcurses/curses.h
cvs rdiff -u -r1.56 -r1.57 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.81 -r1.82 src/lib/libcurses/refresh.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/libcurses/color.c
diff -u src/lib/libcurses/color.c:1.39 src/lib/libcurses/color.c:1.40
--- src/lib/libcurses/color.c:1.39	Tue Jan  3 12:39:44 2017
+++ src/lib/libcurses/color.c	Fri Jan  6 09:14:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: color.c,v 1.39 2017/01/03 12:39:44 roy Exp $	*/
+/*	$NetBSD: color.c,v 1.40 2017/01/06 09:14:07 roy Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: color.c,v 1.39 2017/01/03 12:39:44 roy Exp $");
+__RCSID("$NetBSD: color.c,v 1.40 2017/01/06 09:14:07 roy Exp $");
 #endif/* not lint */
 
 #include "curses.h"
@@ -542,7 +542,7 @@ __set_color( /*ARGSUSED*/ WINDOW *win, a
 	if ((curscr->wattr & __COLOR) == (attr & __COLOR))
 		return;
 
-	pair = PAIR_NUMBER((u_int32_t)attr);
+	pair = PAIR_NUMBER((uint32_t)attr);
 #ifdef DEBUG
 	__CTRACE(__CTRACE_COLOR, "__set_color: %d, %d, %d\n", pair,
 		 _cursesi_screen->colour_pairs[pair].fore,

Index: src/lib/libcurses/cur_hash.c
diff -u src/lib/libcurses/cur_hash.c:1.12 src/lib/libcurses/cur_hash.c:1.13
--- src/lib/libcurses/cur_hash.c:1.12	Fri Feb 18 22:16:27 2005
+++ src/lib/libcurses/cur_hash.c	Fri Jan  6 09:14:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cur_hash.c,v 1.12 2005/02/18 22:16:27 dsl Exp $	*/
+/*	$NetBSD: cur_hash.c,v 1.13 2017/01/06 09:14:07 roy Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cur_hash.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: cur_hash.c,v 1.12 2005/02/18 22:16:27 dsl Exp $");
+__RCSID("$NetBSD: cur_hash.c,v 1.13 2017/01/06 09:14:07 roy Exp $");
 #endif
 #endif/* not lint */
 
@@ -46,10 +46,10 @@ __RCSID("$NetBSD: cur_hash.c,v 1.12 2005
 /*
  * __hash_more() is "hashpjw" from the Dragon Book, Aho, Sethi & Ullman, p.436.
  */
-u_int
-__hash_more(const void  *v_s, size_t len, u_int h)
+unsigned int
+__hash_more(const void  *v_s, size_t len, unsigned int h)
 {
-	u_int g;
+	unsigned int g;
 	size_t i = 0;
 	const char *s = v_s;
 

Index: src/lib/libcurses/curses.h
diff -u src/lib/libcurses/curses.h:1.118 src/lib/libcurses/curses.h:1.119
--- src/lib/libcurses/curses.h:1.118	Thu Jan  5 23:15:43 2017
+++ src/lib/libcurses/curses.h	Fri Jan  6 09:14:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses.h,v 1.118 2017/01/05 23:15:43 roy Exp $	*/
+/*	$NetBSD: curses.h,v 1.119 2017/01/06 09:14:07 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -395,9 +395,9 @@ __END_DECLS
 #define	COLOR_WHITE	0x07
 
 #ifdef __cplusplus
-#define __UINT32_CAST(a)	static_cast(a)
+#define __UINT32_CAST(a)	static_cast(a)
 #else
-#define __UINT32_CAST(a)	(u_int32_t)(a)
+#define __UINT32_CAST(a)	(uint32_t)(a)
 #endif
 #define	COLOR_PAIR(n)	(((__UINT32_CAST(n)) << 17) & A_COLOR)
 #define	PAIR_NUMBER(n)	(((__UINT32_CAST(n)) & A_COLOR) >> 17)

Index: src/lib/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.56 src/lib/libcurses/curses_private.h:1.57
--- src/lib/libcurses/curses_private.h:1.56	Thu Jan  5 20:31:37 2017
+++ src/lib/libcurses/curses_private.h	Fri Jan  6 09:14:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_private.h,v 1.56 2017/01/05 20:31:37 roy Exp $	*/
+/*	$NetBSD: curses_private.h,v 1.57 2017/01/06 09:14:07 roy Exp $	*/
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -313,7 +313,7 @@ void _cursesi_reset_wacs(SCREEN *);
 void _cursesi_resetterm(SCREEN *);
 int  _cursesi_setterm(char *, SCREEN *);
 int	 __delay(void);
-u_int	 __hash_more(const void *, size_t, u_int);
+unsigned int	 __hash_more(const void *, size_t, unsigned int);
 #define	__hash(s, len)	__hash_more((s), (len), 0u)
 void	 __id_subwins(WINDOW *);
 void	 __init_getch(SCREEN *);

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.81 src/lib/libcurses/refresh.c:1.82
--- src/lib/libcurses/refresh.c:1.81	Sat Dec 31 22:47:01 2016
+++ src/lib/libcurses/refresh.c	Fri Jan  6 09:14:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.81 2016/12/31 22:47:01 roy Exp $	*/
+/*	$NetBSD: refresh.c,v 1.82 2017/01/06 09:14:07 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.81 2016/12/31 22:47:01 roy Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.82 2017/01/06 

CVS commit: src/lib/libcurses

2017-01-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jan  6 09:14:07 UTC 2017

Modified Files:
src/lib/libcurses: color.c cur_hash.c curses.h curses_private.h
refresh.c

Log Message:
u_int -> unsigned int, u_int32_t -> uint32_t.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libcurses/color.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libcurses/cur_hash.c
cvs rdiff -u -r1.118 -r1.119 src/lib/libcurses/curses.h
cvs rdiff -u -r1.56 -r1.57 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.81 -r1.82 src/lib/libcurses/refresh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86/x86

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 09:04:06 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Rename a few things


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/arch/x86/x86/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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.235 src/sys/arch/x86/x86/pmap.c:1.236
--- src/sys/arch/x86/x86/pmap.c:1.235	Thu Dec 22 16:29:05 2016
+++ src/sys/arch/x86/x86/pmap.c	Fri Jan  6 09:04:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.236 2017/01/06 09:04:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236 2017/01/06 09:04:06 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1481,12 +1481,12 @@ pmap_init_directmap(struct pmap *kpm)
 	extern phys_ram_seg_t mem_clusters[];
 	extern int mem_cluster_cnt;
 
-	paddr_t lastpa, dm_pd, dm_pdp, pdp;
+	paddr_t lastpa, L2page_pa, L3page_pa, pdp;
 	vaddr_t tmpva;
 	pt_entry_t *pte;
 	pd_entry_t *pde;
 	phys_ram_seg_t *mc;
-	long n_dm_pdp;
+	size_t nL3e;
 	int i;
 
 	const pd_entry_t pteflags = PG_V | PG_KW | pmap_pg_nx;
@@ -1506,27 +1506,27 @@ pmap_init_directmap(struct pmap *kpm)
 		panic("RAM limit reached: > 512GB not supported");
 	}
 
-	/* Allocate L3. */
-	dm_pdp = pmap_bootstrap_palloc(1);
-
-	/* Number of L3 entries. */
-	n_dm_pdp = (lastpa + NBPD_L3 - 1) >> L3_SHIFT;
-
-	/* In locore.S, we allocated a tmp va. Use it now. */
+	/* In locore.S, we allocated a tmp va. We will use it now. */
 	tmpva = (KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2);
 	pte = PTE_BASE + pl1_i(tmpva);
-	*pte = dm_pdp | pteflags;
+
+	/* Allocate L3, and zero it out. */
+	L3page_pa = pmap_bootstrap_palloc(1);
+	*pte = L3page_pa | pteflags;
 	pmap_update_pg(tmpva);
 	memset((void *)tmpva, 0, PAGE_SIZE);
 
+	/* Number of L3 entries. */
+	nL3e = (lastpa + NBPD_L3 - 1) >> L3_SHIFT;
+
 	/*
 	 * Map the direct map RW. Use super pages (1GB) or large pages (2MB) if
 	 * they are supported. Note: PG_G is not allowed on non-leaf PTPs.
 	 */
 	if (cpu_feature[2] & CPUID_P1GB) {
 		/* Super pages are supported. Just create L3. */
-		for (i = 0; i < n_dm_pdp; i++) {
-			pdp = (paddr_t)&(((pd_entry_t *)dm_pdp)[i]);
+		for (i = 0; i < nL3e; i++) {
+			pdp = (paddr_t)&(((pd_entry_t *)L3page_pa)[i]);
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
@@ -1536,11 +1536,11 @@ pmap_init_directmap(struct pmap *kpm)
 		}
 	} else {
 		/* Allocate L2. */
-		dm_pd = pmap_bootstrap_palloc(n_dm_pdp);
+		L2page_pa = pmap_bootstrap_palloc(nL3e);
 
 		/* Zero out the L2 pages. */
-		for (i = 0; i < n_dm_pdp; i++) {
-			pdp = dm_pd + i * PAGE_SIZE;
+		for (i = 0; i < nL3e; i++) {
+			pdp = L2page_pa + i * PAGE_SIZE;
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
@@ -1550,8 +1550,8 @@ pmap_init_directmap(struct pmap *kpm)
 		KASSERT(pmap_largepages != 0);
 
 		/* Large pages are supported. Just create L2. */
-		for (i = 0; i < NPDPG * n_dm_pdp; i++) {
-			pdp = (paddr_t)&(((pd_entry_t *)dm_pd)[i]);
+		for (i = 0; i < NPDPG * nL3e; i++) {
+			pdp = (paddr_t)&(((pd_entry_t *)L2page_pa)[i]);
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
@@ -1561,17 +1561,17 @@ pmap_init_directmap(struct pmap *kpm)
 		}
 
 		/* Fill in the L3 entries, linked to L2. */
-		for (i = 0; i < n_dm_pdp; i++) {
-			pdp = (paddr_t)&(((pd_entry_t *)dm_pdp)[i]);
+		for (i = 0; i < nL3e; i++) {
+			pdp = (paddr_t)&(((pd_entry_t *)L3page_pa)[i]);
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
 			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = (dm_pd + (i << PAGE_SHIFT)) | pteflags | PG_U;
+			*pde = (L2page_pa + (i << PAGE_SHIFT)) | pteflags | PG_U;
 		}
 	}
 
-	kpm->pm_pdir[PDIR_SLOT_DIRECT] = dm_pdp | pteflags | PG_U;
+	kpm->pm_pdir[PDIR_SLOT_DIRECT] = L3page_pa | pteflags | PG_U;
 
 	*pte = 0;
 	pmap_update_pg(tmpva);
@@ -2011,9 +2011,9 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t 
 		pmap->pm_ptphint[i - 2] = ptp;
 		pa = VM_PAGE_TO_PHYS(ptp);
 		pmap_pte_set([index], (pd_entry_t)
-		(pmap_pa2pte(pa) | PG_u | PG_RW | PG_V));
+		(pmap_pa2pte(pa) | PG_u | PG_RW | PG_V));
 #if defined(XEN) && defined(__x86_64__)
-		if(i == PTP_LEVELS) {
+		if (i == PTP_LEVELS) {
 			/*
 			 * Update the per-cpu PD on all cpus the current
 			 * pmap is active on



CVS commit: src/sys/arch/x86/x86

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 09:04:06 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Rename a few things


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/sys/sys

2017-01-06 Thread Paul Goyette

On Fri, 6 Jan 2017, matthew green wrote:


Paul Goyette writes:

Yeah, I managed to type -m instead of -f

Should already be fixed (via cvs admin) in the repo.


can you update the mailing list with the fixed text please?
that's the normal method as well.


Sorry, here's the revised commit message:

   The inline functions {ms,us,ns}2bintime() are currently defined
   incorrectly, and always result in the bt.frac being set to zero.
   Even correcting for left- vs right shifts, the results are low
   precision with at most 32 significant bits.

   Rewrite using 64-bit multiply rather than division to get proper
   results.  Also the multiply is less costly than a divide on most
   platforms.

Unfortunately, the line breaks didn't survive my 'cvs admin' command
(I tried to put them in the message using \n but that didn't work.)



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++


re: CVS commit: src/sys/sys

2017-01-06 Thread matthew green
Paul Goyette writes:
> Yeah, I managed to type -m instead of -f
> 
> Should already be fixed (via cvs admin) in the repo.

can you update the mailing list with the fixed text please?
that's the normal method as well.

thanks.


.mrg.

> On Fri, 6 Jan 2017, matthew green wrote:
> 
> > "Paul Goyette" writes:
> >> Module Name:   src
> >> Committed By:  pgoyette
> >> Date:  Thu Jan  5 22:51:15 UTC 2017
> >>
> >> Modified Files:
> >>src/sys/sys: time.h
> >>
> >> Log Message:
> >> /home/paul/time.msg
> >
> > interesting!
> >
> > !DSPAM:586f0b9f152991262213216!
> >
> >
> 
> +--+--++
> | Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
> | (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
> | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
> +--+--++
> 


CVS commit: src/sys/arch/i386/i386

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 08:36:56 UTC 2017

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Explain the computation


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/i386/i386/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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.143 src/sys/arch/i386/i386/locore.S:1.144
--- src/sys/arch/i386/i386/locore.S:1.143	Fri Dec 16 19:52:22 2016
+++ src/sys/arch/i386/i386/locore.S	Fri Jan  6 08:36:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.143 2016/12/16 19:52:22 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.144 2017/01/06 08:36:56 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.143 2016/12/16 19:52:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.144 2017/01/06 08:36:56 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -633,7 +633,7 @@ no_NOX:
 	incl	%eax		/* one more PTP for VAs stolen by bootstrap */
 1:	movl	%eax,RELOC(nkptp)+1*4
 
-	/* tablesize = (PDP_SIZE + UPAGES + nkptp) << PGSHIFT; */
+	/* tablesize = (PDP_SIZE + UPAGES + nkptp[1]) << PGSHIFT; */
 	addl	$(PDP_SIZE+UPAGES),%eax
 #ifdef PAE
 	incl	%eax 		/* one more page for L3 */
@@ -643,7 +643,8 @@ no_NOX:
 #endif
 	movl	%eax,RELOC(tablesize)
 
-	/* Ensure that nkptp covers BOOTSTRAP TABLES. */
+	/* Ensure that nkptp[1] covers BOOTSTRAP TABLES, ie:
+	 * (esi + tablesize) >> L2_SHIFT + 1 < nkptp[1] */
 	addl	%esi,%eax
 	addl	$~L2_FRAME,%eax
 	shrl	$L2_SHIFT,%eax



CVS commit: src/sys/arch/i386/i386

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 08:36:56 UTC 2017

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Explain the computation


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/x86

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 08:32:26 UTC 2017

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Remove a few #if 0s, and explain what we are doing on PAE: the last two PAs
are entered in reversed order.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/xen/x86/x86_xpmap.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/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.68 src/sys/arch/xen/x86/x86_xpmap.c:1.69
--- src/sys/arch/xen/x86/x86_xpmap.c:1.68	Fri Dec 16 19:52:22 2016
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri Jan  6 08:32:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.68 2016/12/16 19:52:22 maxv Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.69 2017/01/06 08:32:26 maxv Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert 
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.68 2016/12/16 19:52:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.69 2017/01/06 08:32:26 maxv Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -664,7 +664,7 @@ xen_locore(void)
 		count++;
 	}
 
-#ifndef __x86_64__
+#ifdef i386
 	/*
 	 * One more L2 page: we'll allocate several pages after kva_start
 	 * in pmap_bootstrap() before pmap_growkernel(), which have not been
@@ -832,21 +832,24 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 	pdtpe[pl3_pi(KERNTEXTOFF)] =
 	xpmap_ptom_masked(addr) | PG_k | PG_V | PG_RW;
 #elif defined(PAE)
-	/* Our PAE-style level 2: 5 contigous pages (4 L2 + 1 shadow) */
+	/*
+	 * Our PAE-style level 2, 5 contiguous pages (4 L2 + 1 shadow).
+	 *  +-++-+
+	 * Physical layout: | 3 * USERLAND L2 | L2 KERN SHADOW | L2 KERN |
+	 *  +-++-+
+	 * However, we enter pdtpte[3] into L2 KERN, and not L2 KERN SHADOW.
+	 * This way, pde[L2_SLOT_KERN] always points to the shadow.
+	 */
 	pde = (pd_entry_t *)avail;
 	memset(pde, 0, PAGE_SIZE * 5);
 	avail += PAGE_SIZE * 5;
-	addr = ((u_long)pde) - KERNBASE;
 
 	/*
-	 * Enter L2 pages in L3. The real L2 kernel PD will be the last one
-	 * (so that pde[L2_SLOT_KERN] always points to the shadow).
+	 * Link L2 pages in L3, with a special case for L2 KERN. Xen doesn't
+	 * want RW permissions in L3 entries, it'll add them itself.
 	 */
+	addr = ((u_long)pde) - KERNBASE;
 	for (i = 0; i < 3; i++, addr += PAGE_SIZE) {
-		/*
-		 * Xen doesn't want RW mappings in L3 entries, it'll add it
-		 * itself.
-		 */
 		pdtpe[i] = xpmap_ptom_masked(addr) | PG_k | PG_V;
 	}
 	addr += PAGE_SIZE;
@@ -944,15 +947,11 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 
 	/* Install recursive page tables mapping */
 #ifdef PAE
-	/*
-	 * We need a shadow page for the kernel's L2 page.
-	 * The real L2 kernel PD will be the last one (so that
-	 * pde[L2_SLOT_KERN] always points to the shadow).
-	 */
+	/* Copy L2 KERN into L2 KERN SHADOW, and reference the latter in cpu0. */
 	memcpy([L2_SLOT_KERN + NPDPG], [L2_SLOT_KERN], PAGE_SIZE);
 	cpu_info_primary.ci_kpm_pdir = [L2_SLOT_KERN + NPDPG];
 	cpu_info_primary.ci_kpm_pdirpa =
-	(vaddr_t) cpu_info_primary.ci_kpm_pdir - KERNBASE;
+	(vaddr_t)cpu_info_primary.ci_kpm_pdir - KERNBASE;
 
 	/*
 	 * We don't enter a recursive entry from the L3 PD. Instead, we enter
@@ -965,28 +964,16 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 		pde[PDIR_SLOT_PTE + i] = xpmap_ptom_masked(addr) | PG_k | PG_V |
 		pg_nx;
 	}
-#if 0
-	addr += PAGE_SIZE; /* point to shadow L2 */
-	pde[PDIR_SLOT_PTE + 3] = xpmap_ptom_masked(addr) | PG_k | PG_V;
-#endif
-	/* Mark tables RO, and pin the kernel's shadow as L2 */
+
+	/* Mark tables RO, and pin L2 KERN SHADOW. */
 	addr = (u_long)pde - KERNBASE;
 	for (i = 0; i < 5; i++, addr += PAGE_SIZE) {
 		xen_bt_set_readonly(((vaddr_t)pde) + PAGE_SIZE * i);
-#if 0
-		if (i == 2 || i == 3)
-			continue;
-		xpq_queue_pin_l2_table(xpmap_ptom_masked(addr));
-#endif
 	}
 	if (final) {
 		addr = (u_long)pde - KERNBASE + 3 * PAGE_SIZE;
 		xpq_queue_pin_l2_table(xpmap_ptom_masked(addr));
 	}
-#if 0
-	addr = (u_long)pde - KERNBASE + 2 * PAGE_SIZE;
-	xpq_queue_pin_l2_table(xpmap_ptom_masked(addr));
-#endif
 #else /* PAE */
 
 	/* Recursive entry in pmap_kernel(). */
@@ -1000,7 +987,8 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 
 	/* Mark tables RO */
 	xen_bt_set_readonly((vaddr_t)pde);
-#endif
+#endif /* PAE */
+
 #if PTP_LEVELS > 2 || defined(PAE)
 	xen_bt_set_readonly((vaddr_t)pdtpe);
 #endif



CVS commit: src/sys/arch/xen/x86

2017-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  6 08:32:26 UTC 2017

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Remove a few #if 0s, and explain what we are doing on PAE: the last two PAs
are entered in reversed order.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/xen/x86/x86_xpmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2017-01-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan  6 08:05:26 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and newer
  devices.
- Update comment in wm_init_rss().


To generate a diff of this commit:
cvs rdiff -u -r1.461 -r1.462 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.461 src/sys/dev/pci/if_wm.c:1.462
--- src/sys/dev/pci/if_wm.c:1.461	Wed Jan  4 04:43:08 2017
+++ src/sys/dev/pci/if_wm.c	Fri Jan  6 08:05:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.461 2017/01/04 04:43:08 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.462 2017/01/06 08:05:26 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.461 2017/01/04 04:43:08 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.462 2017/01/06 08:05:26 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3709,11 +3709,11 @@ wm_initialize_hardware_bits(struct wm_so
 		}
 		CSR_WRITE(sc, WMREG_TARC0, tarc0);
 
+		switch (sc->sc_type) {
 		/*
-		 * 8257[12] Errata No.52 and some others.
+		 * 8257[12] Errata No.52, 82573 Errata No.43 and some others.
 		 * Avoid RSS Hash Value bug.
 		 */
-		switch (sc->sc_type) {
 		case WM_T_82571:
 		case WM_T_82572:
 		case WM_T_82573:
@@ -3723,6 +3723,27 @@ wm_initialize_hardware_bits(struct wm_so
 			reg |= WMREG_RFCTL_NEWIPV6EXDIS |WMREG_RFCTL_IPV6EXDIS;
 			CSR_WRITE(sc, WMREG_RFCTL, reg);
 			break;
+		/*
+		 * 82575 Errata XXX, 82576 Errata 46, 82580 Errata 24,
+		 * I350 Errata 37, I210 Errata No. 31 and I211 Errata No. 11:
+		 * "Certain Malformed IPv6 Extension Headers are Not Processed
+		 * Correctly by the Device"
+		 *
+		 * I354(C2000) Errata AVR53:
+		 * "Malformed IPv6 Extension Headers May Result in LAN Device
+		 * Hang"
+		 */
+		case WM_T_82575:
+		case WM_T_82576:
+		case WM_T_82580:
+		case WM_T_I350:
+		case WM_T_I210:
+		case WM_T_I211:
+		case WM_T_I354:
+			reg = CSR_READ(sc, WMREG_RFCTL);
+			reg |= WMREG_RFCTL_IPV6EXDIS;
+			CSR_WRITE(sc, WMREG_RFCTL, reg);
+			break;
 		default:
 			break;
 		}
@@ -4411,9 +4432,9 @@ wm_init_rss(struct wm_softc *sc)
 	else
 		mrqc = MRQC_ENABLE_RSS_MQ;
 
-	/* 
-	 * The same as FreeBSD igb.
-	 * Why doesn't use MRQC_RSS_FIELD_IPV6_EX?
+	/*
+	 * MRQC_RSS_FIELD_IPV6_EX is not set because of an errata.
+	 * See IPV6EXDIS bit in wm_initialize_hardware_bits().
 	 */
 	mrqc |= (MRQC_RSS_FIELD_IPV4 | MRQC_RSS_FIELD_IPV4_TCP);
 	mrqc |= (MRQC_RSS_FIELD_IPV6 | MRQC_RSS_FIELD_IPV6_TCP);



CVS commit: src/sys/dev/pci

2017-01-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan  6 08:05:26 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and newer
  devices.
- Update comment in wm_init_rss().


To generate a diff of this commit:
cvs rdiff -u -r1.461 -r1.462 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.