CVS commit: src/sbin/gpt

2013-12-08 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Dec  9 01:35:02 UTC 2013

Modified Files:
src/sbin/gpt: gpt.8 show.c

Log Message:
For the "show -i " subcommand, print Start and Size both in
terms of number of sectors and bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.13 -r1.14 src/sbin/gpt/show.c

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

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.23 src/sbin/gpt/gpt.8:1.24
--- src/sbin/gpt/gpt.8:1.23	Sun Dec  8 09:32:51 2013
+++ src/sbin/gpt/gpt.8	Mon Dec  9 01:35:02 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.23 2013/12/08 09:32:51 jnemeth Exp $
+.\" $NetBSD: gpt.8,v 1.24 2013/12/09 01:35:02 jnemeth Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -365,6 +365,7 @@ user friendly form.
 With the
 .Fl i
 option, all the details of a particular GPT partition will be displayed.
+The format of this display is subject to change.
 None of the options have any effect on non-GPT partitions.
 The order of precedence for the options are:
 .Fl i ,

Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.13 src/sbin/gpt/show.c:1.14
--- src/sbin/gpt/show.c:1.13	Sun Dec  8 08:30:01 2013
+++ src/sbin/gpt/show.c	Mon Dec  9 01:35:02 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.13 2013/12/08 08:30:01 jnemeth Exp $");
+__RCSID("$NetBSD: show.c,v 1.14 2013/12/09 01:35:02 jnemeth Exp $");
 #endif
 
 #include 
@@ -223,7 +223,7 @@ show_one(void)
 	map_t *m;
 	struct gpt_ent *ent;
 	const char *s1;
-	char *s2;
+	char *s2, human_num[5];
 
 	for (m = map_first(); m != NULL; m = m->map_next)
 		if (entry == m->map_index)
@@ -236,8 +236,21 @@ show_one(void)
 	ent = m->map_data;
 
 	printf("Details for index %d:\n", entry);
-	printf("Start: %llu\n", (long long)m->map_start);
-	printf("Size: %llu\n", (long long)m->map_size);
+	if (humanize_number(human_num, 5, (int64_t)(m->map_start * secsz),
+	"", HN_AUTOSCALE, HN_NOSPACE|HN_B) < 0)
+		human_num[0] = '\0';
+	if (human_num[0] != '\0')
+		printf("Start: %llu (%s)\n", (long long)m->map_start,
+		human_num);
+	else
+		printf("Start: %llu\n", (long long)m->map_start);
+	if (humanize_number(human_num, 5, (int64_t)(m->map_size * secsz),
+	"", HN_AUTOSCALE, HN_NOSPACE|HN_B) < 0)
+		human_num[0] = '\0';
+	if (human_num[0] != '\0')
+		printf("Size: %llu (%s)\n", (long long)m->map_size, human_num);
+	else
+		printf("Size: %llu\n", (long long)m->map_size);
 
 	le_uuid_dec(ent->ent_type, &type);
 	s1 = friendly(&type);



CVS commit: src/lib/libc

2013-12-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Dec  8 21:29:15 UTC 2013

Modified Files:
src/lib/libc: shlib_version

Log Message:
add note about gets()


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/lib/libc/shlib_version

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/shlib_version
diff -u src/lib/libc/shlib_version:1.244 src/lib/libc/shlib_version:1.245
--- src/lib/libc/shlib_version:1.244	Sun Nov 10 20:59:27 2013
+++ src/lib/libc/shlib_version	Sun Dec  8 21:29:15 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.244 2013/11/10 20:59:27 joerg Exp $
+#	$NetBSD: shlib_version,v 1.245 2013/12/08 21:29:15 dholland Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -32,6 +32,7 @@
 # - kill sigcontext: never request version 0 or 1 signal trampoline.
 #   always request version 2 trampoline. (on vax, 3).
 # - remove gets(); it is finally dead in c11.
+#   (note: maybe it still needs to be kept in a compat lib; but not in libc)
 # - make __cerror (spelled CERROR) hidden again
 # - remove ruserok() and friends to libcompat (or entirely)
 # - remove alloca fallback and expect compiler to provide a builtin version.



CVS commit: src/sys/arch/i386

2013-12-08 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec  8 20:45:30 UTC 2013

Modified Files:
src/sys/arch/i386/i386: freebsd_machdep.c ibcs2_machdep.c machdep.c
process_machdep.c svr4_machdep.c trap.c
src/sys/arch/i386/include: freebsd_machdep.h npx.h
src/sys/arch/i386/isa: npx.c

Log Message:
Rename the fields of 'struct envxmm' (itself badly named) so that they
  are different from those used for the x87 fpu.
Use a union to describe the 64bit 'address' field so that it correctly
  spilt for 32bit binaries.
The freebsd emulation defined its own 'struct freebsd_env87' that the
  code just assumed matched the netbsd one.
  Since this is a hardware structure, just use the netbsd one.
This shouldn't change the binaries except that 'en_fos' used to be
  incorrectly a 32bit field.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/i386/freebsd_machdep.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/i386/ibcs2_machdep.c
cvs rdiff -u -r1.739 -r1.740 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/i386/i386/svr4_machdep.c
cvs rdiff -u -r1.266 -r1.267 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/include/freebsd_machdep.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/include/npx.h
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/i386/isa/npx.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/i386/i386/freebsd_machdep.c
diff -u src/sys/arch/i386/i386/freebsd_machdep.c:1.55 src/sys/arch/i386/i386/freebsd_machdep.c:1.56
--- src/sys/arch/i386/i386/freebsd_machdep.c:1.55	Thu Dec 10 14:13:50 2009
+++ src/sys/arch/i386/i386/freebsd_machdep.c	Sun Dec  8 20:45:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_machdep.c,v 1.55 2009/12/10 14:13:50 matt Exp $	*/
+/*	$NetBSD: freebsd_machdep.c,v 1.56 2013/12/08 20:45:30 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.55 2009/12/10 14:13:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.56 2013/12/08 20:45:30 dsl Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -65,7 +65,7 @@ freebsd_setregs(struct lwp *l, struct ex
 
 	setregs(l, epp, stack);
 	if (i386_use_fxsave)
-		pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __FreeBSD_NPXCW__;
+		pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __FreeBSD_NPXCW__;
 	else
 		pcb->pcb_savefpu.sv_87.sv_env.en_cw = __FreeBSD_NPXCW__;
 }
@@ -285,8 +285,7 @@ netbsd_to_freebsd_ptrace_regs(struct reg
 	fregs->freebsd_ptrace_regs.tf_esp = nregs->r_esp;
 	fregs->freebsd_ptrace_regs.tf_ss = nregs->r_ss;
 
-	fregs->freebsd_ptrace_fpregs.sv_env =
-		*(struct freebsd_env87 *)&nframe->sv_env;
+	fregs->freebsd_ptrace_fpregs.sv_env = nframe->sv_env;
 	memcpy(fregs->freebsd_ptrace_fpregs.sv_ac, nframe->sv_ac,
 	  sizeof(fregs->freebsd_ptrace_fpregs.sv_ac));
 	fregs->freebsd_ptrace_fpregs.sv_ex_sw = 
@@ -336,8 +335,7 @@ freebsd_to_netbsd_ptrace_regs(struct fre
 	nregs->r_esp = fregs->freebsd_ptrace_regs.tf_esp;
 	nregs->r_ss = fregs->freebsd_ptrace_regs.tf_ss;
 
-	nframe->sv_env =
-		*(struct env87 *)&fregs->freebsd_ptrace_fpregs.sv_env;
+	nframe->sv_env = fregs->freebsd_ptrace_fpregs.sv_env;
 	memcpy(nframe->sv_ac, fregs->freebsd_ptrace_fpregs.sv_ac,
 	  sizeof(nframe->sv_ac));
 	nframe->sv_ex_sw =

Index: src/sys/arch/i386/i386/ibcs2_machdep.c
diff -u src/sys/arch/i386/i386/ibcs2_machdep.c:1.40 src/sys/arch/i386/i386/ibcs2_machdep.c:1.41
--- src/sys/arch/i386/i386/ibcs2_machdep.c:1.40	Sun Feb 14 11:09:54 2010
+++ src/sys/arch/i386/i386/ibcs2_machdep.c	Sun Dec  8 20:45:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $	*/
+/*	$NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.41 2013/12/08 20:45:30 dsl Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -69,7 +69,7 @@ ibcs2_setregs(struct lwp *l, struct exec
 
 	setregs(l, epp, stack);
 	if (i386_use_fxsave)
-		pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __iBCS2_NPXCW__;
+		pcb->pcb_savefpu.sv_xmm.sv_env.fx_cw = __iBCS2_NPXCW__;
 	else
 		pcb->pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
 	tf = l->l_md.md_regs;

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.739 src/sys/arch/i386/i386/machdep.c:1.740
--- src/sys/arch/i386/i386/machdep.c:1.739	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/i386/i386/machdep.c	Sun Dec  8 20:45:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.739 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.740 2013/12/08 20:

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

2013-12-08 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec  8 18:08:34 UTC 2013

Modified Files:
src/sys/arch/x86/include: cputypes.h

Log Message:
Remove the now-unused CPU_MAXMODEL and CPU_DEFMODEL


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/cputypes.h

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

Modified files:

Index: src/sys/arch/x86/include/cputypes.h
diff -u src/sys/arch/x86/include/cputypes.h:1.3 src/sys/arch/x86/include/cputypes.h:1.4
--- src/sys/arch/x86/include/cputypes.h:1.3	Thu Jan 27 18:44:40 2011
+++ src/sys/arch/x86/include/cputypes.h	Sun Dec  8 18:08:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cputypes.h,v 1.3 2011/01/27 18:44:40 bouyer Exp $	*/
+/*	$NetBSD: cputypes.h,v 1.4 2013/12/08 18:08:34 dsl Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -74,8 +74,6 @@
  * Some other defines, dealing with values returned by cpuid.
  */
 
-#define CPU_MAXMODEL	15	/* Models within family range 0-15 */
-#define CPU_DEFMODEL	16	/* Value for unknown model -> default  */
 #define CPU_MINFAMILY	 4	/* Lowest that cpuid can return (486) */
 #define CPU_MAXFAMILY	 7	/* Highest consecutive # we know (fake P4) */
 #define CPU_FAMILY_P4	15	/* Family number for Pentium 4 */



CVS commit: src/sys/arch

2013-12-08 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec  8 18:00:51 UTC 2013

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/x86/include: cpufunc.h specialreg.h

Log Message:
Add some definitions for cpu 'extended state'.
These are needed for support of the AVX SIMD instructions.
Nothing yet uses them.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.21 src/sys/arch/amd64/amd64/cpufunc.S:1.22
--- src/sys/arch/amd64/amd64/cpufunc.S:1.21	Sat Sep 24 21:24:52 2011
+++ src/sys/arch/amd64/amd64/cpufunc.S	Sun Dec  8 18:00:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.21 2011/09/24 21:24:52 jym Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.22 2013/12/08 18:00:51 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -244,6 +244,21 @@ ENTRY(rdmsr_safe)
 	movq	%rax, PCB_ONFAULT(%r8)
 	ret
 
+ENTRY(rdxcr)
+	movq	%rdi, %rcx
+	xgetbv
+	shlq	$32, %rdx
+	orq	%rdx, %rax
+	ret
+
+ENTRY(wrxcr)
+	movq	%rdi, %rcx
+	movq	%rsi, %rax
+	movq	%rsi, %rdx
+	shrq	$32, %rdx
+	xsetbv
+	ret
+
 /*
  * MSR operations fault handler
  */
@@ -468,6 +483,27 @@ ENTRY(fldummy)
 	flds	(%rdi)
 	ret
 
+ENTRY(xsave)
+	movq	%rsi, %rax
+	movq	%rsi, %rdx
+	shrq	$32, %rdx
+	xsave	(%rdi)
+	ret
+
+ENTRY(xsaveopt)
+	movq	%rsi, %rax
+	movq	%rsi, %rdx
+	shrq	$32, %rdx
+	xsaveopt	(%rdi)
+	ret
+
+ENTRY(xrstor)
+	movq	%rsi, %rax
+	movq	%rsi, %rdx
+	shrq	$32, %rdx
+	xrstor	(%rdi)
+	ret
+
 ENTRY(x86_ldmxcsr)
 	ldmxcsr	(%rdi)
 	ret

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.13 src/sys/arch/x86/include/cpufunc.h:1.14
--- src/sys/arch/x86/include/cpufunc.h:1.13	Sat Sep 24 10:32:52 2011
+++ src/sys/arch/x86/include/cpufunc.h	Sun Dec  8 18:00:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.13 2011/09/24 10:32:52 jym Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.14 2013/12/08 18:00:51 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -93,8 +93,9 @@ void	fxrstor(void *);
 void	x86_monitor(const void *, uint32_t, uint32_t);
 void	x86_mwait(uint32_t, uint32_t);
 void	x86_ldmxcsr(void *);
+/* x86_cpuid2() writes four 32bit values, %eax, %ebx, %ecx and %edx */
 #define	x86_cpuid(a,b)	x86_cpuid2((a),0,(b))
-void	x86_cpuid2(unsigned, unsigned, unsigned *);
+void	x86_cpuid2(uint32_t, uint32_t, uint32_t *);
 
 /* Use read_psl, write_psl when saving and restoring interrupt state. */
 void	x86_disable_intr(void);
@@ -126,6 +127,14 @@ void		wrmsr_locked(u_int, u_int, uint64_
 void		setfs(int);
 void		setusergs(int);
 
+/* Extended processor state functions (for AVX registers etc) */
+
+uint64_t	rdxcr(uint32_t);		/* xgetbv */
+void		wrxcr(uint32_t, uint64_t);	/* xsetgv */
+void		xrstor(const void *, uint64_t);
+void		xsave(void *, uint64_t);
+void		xsaveopt(const void *, uint64_t);
+
 #endif /* _KERNEL */
 
 #endif /* !_X86_CPUFUNC_H_ */

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.73 src/sys/arch/x86/include/specialreg.h:1.74
--- src/sys/arch/x86/include/specialreg.h:1.73	Wed Nov 20 17:50:39 2013
+++ src/sys/arch/x86/include/specialreg.h	Sun Dec  8 18:00:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.73 2013/11/20 17:50:39 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.74 2013/12/08 18:00:51 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -218,6 +218,39 @@
 		? 0 : (CPUID_TO_EXTMODEL(cpuid) << 4)))
 
 /*
+ * Extended Control Register XCR0
+ */
+#define	XCR0_X87	0x0001	/* x87 FPU/MMX state */
+#define	XCR0_SSE	0x0002	/* SSE state */
+#define	XCR0_AVX	0x0004	/* AVX state (ymmn registers) */
+
+#define XCR0_FLAGS1	"\20" \
+	"\1" "x87"	"\2" "SSE"	"\3" "AVX"	"\4" "B03"
+
+/*
+ * CPUID Processor extended state Enumeration Fn000d
+ *
+ * %ecx == 0: supported features info:
+ *	%edx:%eax bits valid for XCR0
+ *	%ebx Save area size for features enabled in XCR0
+ *	%ecx Maximim save area size for all cpu features
+ *
+ * %ecx == 1:
+ *	%eax: Bit 0 => xsaveopt instruction avalaible (sandy bridge onwards)
+ *
+ * %ecx >= 2: Save area details for XCR0 bit n
+ *	%eax: size of save area for this feature
+ *	%ebx: offset of save area for this feature
+ *	%ecx, %edx: reserved
+ *	All of %eax, %ebx, %ecx and %edx are zero for unsupported features.
+ */
+
+#define	CPUID_PES1_XSAVEOPT	0x0001	/* xsaveopt instruction */
+
+#define CPUID_PES1_FLAGS	"\20" \
+	"\1" "XSAVEOPT"
+
+/*
  * Intel Deterministic Cache Parameter Leaf
  * Fn_0004
  */



CVS commit: src/sys/compat/linux/arch

2013-12-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec  8 15:56:13 UTC 2013

Modified Files:
src/sys/compat/linux/arch/alpha: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/amd64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/arm: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/m68k: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/mips: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/powerpc: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/linux/arch/alpha/linux_syscall.h \
src/sys/compat/linux/arch/alpha/linux_sysent.c
cvs rdiff -u -r1.85 -r1.86 \
src/sys/compat/linux/arch/alpha/linux_syscallargs.h
cvs rdiff -u -r1.87 -r1.88 src/sys/compat/linux/arch/alpha/linux_syscalls.c
cvs rdiff -u -r1.47 -r1.48 src/sys/compat/linux/arch/amd64/linux_syscall.h \
src/sys/compat/linux/arch/amd64/linux_syscallargs.h \
src/sys/compat/linux/arch/amd64/linux_syscalls.c \
src/sys/compat/linux/arch/amd64/linux_sysent.c
cvs rdiff -u -r1.56 -r1.57 src/sys/compat/linux/arch/arm/linux_syscall.h \
src/sys/compat/linux/arch/arm/linux_syscallargs.h \
src/sys/compat/linux/arch/arm/linux_syscalls.c \
src/sys/compat/linux/arch/arm/linux_sysent.c
cvs rdiff -u -r1.84 -r1.85 src/sys/compat/linux/arch/m68k/linux_syscall.h \
src/sys/compat/linux/arch/m68k/linux_syscalls.c \
src/sys/compat/linux/arch/m68k/linux_sysent.c
cvs rdiff -u -r1.83 -r1.84 src/sys/compat/linux/arch/m68k/linux_syscallargs.h
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/linux/arch/mips/linux_syscall.h
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/linux/arch/mips/linux_syscallargs.h \
src/sys/compat/linux/arch/mips/linux_syscalls.c \
src/sys/compat/linux/arch/mips/linux_sysent.c
cvs rdiff -u -r1.62 -r1.63 src/sys/compat/linux/arch/powerpc/linux_syscall.h \
src/sys/compat/linux/arch/powerpc/linux_sysent.c
cvs rdiff -u -r1.61 -r1.62 \
src/sys/compat/linux/arch/powerpc/linux_syscallargs.h \
src/sys/compat/linux/arch/powerpc/linux_syscalls.c

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

Modified files:

Index: src/sys/compat/linux/arch/alpha/linux_syscall.h
diff -u src/sys/compat/linux/arch/alpha/linux_syscall.h:1.86 src/sys/compat/linux/arch/alpha/linux_syscall.h:1.87
--- src/sys/compat/linux/arch/alpha/linux_syscall.h:1.86	Tue Nov 19 03:53:09 2013
+++ src/sys/compat/linux/arch/alpha/linux_syscall.h	Sun Dec  8 15:56:12 2013
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscall.h,v 1.86 2013/11/19 03:53:09 chs Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.87 2013/12/08 15:56:12 njoly Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.80 2013/11/19 03:52:07 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.81 2013/12/08 15:55:10 njoly Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALL_H_
@@ -30,7 +30,7 @@
 /* syscall: "close" ret: "int" args: "int" */
 #define	LINUX_SYS_close	6
 
-/* syscall: "creat" ret: "int" args: "const char *" "mode_t" */
+/* syscall: "creat" ret: "int" args: "const char *" "linux_umode_t" */
 #define	LINUX_SYS_creat	8
 
 /* syscall: "link" ret: "int" args: "const char *" "const char *" */
@@ -45,7 +45,7 @@
 /* syscall: "fchdir" ret: "int" args: "int" */
 #define	LINUX_SYS_fchdir	13
 
-/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */
+/* syscall: "mknod" ret: "int" args: "const char *" "linux_umode_t" "int" */
 #define	LINUX_SYS_mknod	14
 
 /* syscall: "chmod" ret: "int" args: "const char *" "int" */
@@ -90,7 +90,7 @@
 /* syscall: "pipe" ret: "int" args: */
 #define	LINUX_SYS_pipe	42
 
-/* syscall: "open" ret: "int" args: "const char *" "int" "int" */
+/* syscall: "open" ret: "int" args: "const char *" "int" "linux_umode_t" */
 #define	LINUX_SYS_open	45
 
 /* syscall: "getgid_with_egid" ret: "gid_t" args: */
@@ -234,7 +234,7 @@
 /* syscall: "__posix_fchown" ret: "int" args: "int" "int" "int" */
 #define	LINUX_SYS___posix_fchown	123
 
-/* syscall: "fchmod" ret: "int" args: "int" "mode_t" */
+/* syscall: "fchmod" ret: "int" args: "int" "linux_umode_t" */
 #define	LINUX_SYS_fchmod	124
 
 /* syscall: "recvfrom" ret: "int" args: "int" "void *" "int" "int" "struct osockaddr *" "int *" */
@@ -270,7 +270,7 @@
 /* syscall: "socketpair" ret: "int" args: "int" "int" "int" "int *" */
 #define	LINUX_SYS_socketpair	135
 
-/* syscall: "mkdir" ret: "int" args: "const char *" "int" */
+/* syscall: "mkdir" ret: "int" args: "const char *" "linux_umode_t" */
 #define	LINUX_SYS_mkdir	136
 
 /* sy

CVS commit: src/sys/compat/linux

2013-12-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec  8 15:55:11 UTC 2013

Modified Files:
src/sys/compat/linux/arch/alpha: syscalls.master
src/sys/compat/linux/arch/amd64: syscalls.master
src/sys/compat/linux/arch/arm: syscalls.master
src/sys/compat/linux/arch/m68k: syscalls.master
src/sys/compat/linux/arch/mips: syscalls.master
src/sys/compat/linux/arch/powerpc: syscalls.master
src/sys/compat/linux/common: linux_file.c

Log Message:
Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/compat/linux/arch/alpha/syscalls.master
cvs rdiff -u -r1.45 -r1.46 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.78 -r1.79 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.48 -r1.49 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.56 -r1.57 src/sys/compat/linux/arch/powerpc/syscalls.master
cvs rdiff -u -r1.107 -r1.108 src/sys/compat/linux/common/linux_file.c

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

Modified files:

Index: src/sys/compat/linux/arch/alpha/syscalls.master
diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.80 src/sys/compat/linux/arch/alpha/syscalls.master:1.81
--- src/sys/compat/linux/arch/alpha/syscalls.master:1.80	Tue Nov 19 03:52:07 2013
+++ src/sys/compat/linux/arch/alpha/syscalls.master	Sun Dec  8 15:55:10 2013
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.80 2013/11/19 03:52:07 chs Exp $
+	$NetBSD: syscalls.master,v 1.81 2013/12/08 15:55:10 njoly Exp $
 ;
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -91,13 +91,14 @@
 7	NODEF		{ int|osf1_sys||wait4(int pid, int *status, \
 			int options, struct osf1_rusage *rusage); }
 ;8	ALIAS		osf1_sys_old_creat, NOT USED
-8	STD		{ int|linux_sys||creat(const char *path, mode_t mode); }
+8	STD		{ int|linux_sys||creat(const char *path, linux_umode_t mode); }
 9	NOARGS		{ int|sys||link(const char *path, const char *link); }
 10	STD		{ int|linux_sys||unlink(const char *path); }
 11	UNIMPL
 12	NOARGS		{ int|sys||chdir(const char *path); }
 13	NOARGS		{ int|sys||fchdir(int fd); }
-14	STD		{ int|linux_sys||mknod(const char *path, int mode, int dev); }
+14	STD		{ int|linux_sys||mknod(const char *path, linux_umode_t mode, \
+			int dev); }
 15	NOARGS		{ int|sys||chmod(const char *path, int mode); }
 16	NOARGS		{ int|sys||__posix_chown(const char *path, int uid, int gid); }
 ;17	ALIAS		osf1_sys_brk
@@ -134,7 +135,8 @@
 			void *taddr, unsigned long tsize, \
 			void *daddr, unsigned long dsize); }
 44	UNIMPL
-45	STD		{ int|linux_sys||open(const char *path, int flags, int mode); }
+45	STD		{ int|linux_sys||open(const char *path, int flags, \
+			linux_umode_t mode); }
 46	UNIMPL
 47	NOARGS		{ gid_t|sys||getgid_with_egid(void); }
 ; ALIAS osf1_sys_sigprocmask(int how, unsigned long mask);
@@ -252,7 +254,7 @@
 122	NODEF		{ int|osf1_sys||settimeofday(struct osf1_timeval *tv, \
 			struct osf1_timezone *tzp); }
 123	NOARGS		{ int|sys||__posix_fchown(int fd, int uid, int gid); }
-124	NOARGS		{ int|sys||fchmod(int fd, mode_t mode); }
+124	NOARGS		{ int|sys||fchmod(int fd, linux_umode_t mode); }
 125	STD		{ int|linux_sys||recvfrom(int s, void *buf, int len, \
 int flags, struct osockaddr *from, \
 int *fromlenaddr); }
@@ -269,7 +271,7 @@
 134	NOARGS		{ int|sys||shutdown(int s, int how); }
 135	STD		{ int|linux_sys||socketpair(int domain, int type, \
 int protocol, int *rsv); }
-136	NOARGS		{ int|sys||mkdir(const char *path, int mode); }
+136	NOARGS		{ int|sys||mkdir(const char *path, linux_umode_t mode); }
 137	NOARGS		{ int|sys||rmdir(const char *path); }
 138	NODEF		{ int|osf1_sys||utimes(const char *path, \
 			const struct osf1_timeval *tptr); }

Index: src/sys/compat/linux/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.45 src/sys/compat/linux/arch/amd64/syscalls.master:1.46
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.45	Mon Nov 18 01:32:52 2013
+++ src/sys/compat/linux/arch/amd64/syscalls.master	Sun Dec  8 15:55:10 2013
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.45 2013/11/18 01:32:52 chs Exp $
+	$NetBSD: syscalls.master,v 1.46 2013/12/08 15:55:10 njoly Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -230,7 +230,7 @@
 			const char *to); }
 83	NOARGS		{ int|sys||mkdir(const char *path, linux_umode_t mode); }
 84	NOARGS		{ int|sys||rmdir(const char *path); }
-85	STD		{ int|linux_sys||creat(const char *path, int mode); }
+85	STD		{ int|linux_sys||creat(const char *path, linux_umode_t mode); }
 86	NOARGS		{ int|sys||link(const char *path, const char *link); }
 87	STD		{ int|linux_sys||unlink(const char *path); }
 88	NOARGS		{ int|sys||symlink(const char *path, const char *to); }

Index: src/sys/compat/linux/ar

CVS commit: src/sys/compat/linux/common

2013-12-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec  8 14:59:43 UTC 2013

Modified Files:
src/sys/compat/linux/common: linux_file.c

Log Message:
Add missing syscall argument fd in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/compat/linux/common/linux_file.c

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

Modified files:

Index: src/sys/compat/linux/common/linux_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.106 src/sys/compat/linux/common/linux_file.c:1.107
--- src/sys/compat/linux/common/linux_file.c:1.106	Mon Nov 18 01:32:52 2013
+++ src/sys/compat/linux/common/linux_file.c	Sun Dec  8 14:59:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.106 2013/11/18 01:32:52 chs Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.107 2013/12/08 14:59:43 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.106 2013/11/18 01:32:52 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.107 2013/12/08 14:59:43 njoly Exp $");
 
 #include 
 #include 
@@ -215,6 +215,7 @@ int
 linux_sys_openat(struct lwp *l, const struct linux_sys_openat_args *uap, register_t *retval)
 {
 	/* {
+		syscallarg(int) fd;
 		syscallarg(const char *) path;
 		syscallarg(int) flags;
 		syscallarg(int) mode;



CVS commit: src/sys/arch

2013-12-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Dec  8 14:41:28 UTC 2013

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile loadfile_machdep.c version
src/sys/arch/sparc64/include: pte.h
src/sys/arch/sparc64/sparc64: hvcall.S

Log Message:
Add support for running ofwboot on sun4v. Please note that the kernel on sun4v 
will be loaded properly but when the kernel takes over it will crash 
immediately since the kernel is not sun4v ready yet


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc/stand/ofwboot/Makefile
cvs rdiff -u -r1.10 -r1.11 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/stand/ofwboot/version
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc64/include/pte.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/sparc64/hvcall.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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.30 src/sys/arch/sparc/stand/ofwboot/Makefile:1.31
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.30	Wed Aug 21 06:41:52 2013
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Sun Dec  8 14:41:28 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2013/08/21 06:41:52 matt Exp $
+#	$NetBSD: Makefile,v 1.31 2013/12/08 14:41:28 palle Exp $
 
 CURDIR=	${.CURDIR}
 S=	${CURDIR}/../../../..
@@ -13,6 +13,9 @@ KLINK_MACHINE=	sparc64
 PROG?=		ofwboot
 SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c
 SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
+.if ${MACHINE_ARCH} == "sparc64"
+SRCS+=		hvcall.S
+.endif
 .PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
 
 # XXX SHOULD NOT NEED TO DEFINE THESE!
@@ -25,6 +28,9 @@ COPTS+=		-ffreestanding
 CWARNFLAGS+=	-Wno-main
 CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
 CPPFLAGS+=	-D_STANDALONE -DSUN4U
+.if ${MACHINE_ARCH} == "sparc64"
+CPPFLAGS+=	-DSUN4V
+.endif
 CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
 CPPFLAGS+=	-DNETBOOT
 CPPFLAGS+=	-DSUPPORT_DHCP
@@ -120,5 +126,9 @@ NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c
 srt0.o: srt0.s
 	${NORMAL_S}
 
+hvcall.o: hvcall.S
+	${NORMAL_S}
+
+
 # Explicit dependency for this.
 boot.o: boot.c

Index: src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.10 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.11
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.10	Sat May 21 16:32:00 2011
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Sun Dec  8 14:41:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.10 2011/05/21 16:32:00 nakayama Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.11 2013/12/08 14:41:28 palle Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "boot.h"
 #include "openfirm.h"
@@ -58,8 +59,19 @@ extern vaddr_t	itlb_va_to_pa(vaddr_t);
 extern vaddr_t	dtlb_va_to_pa(vaddr_t);
 
 static void	tlb_init(void);
-
+static void	tlb_init_sun4u(void);
+#ifdef SUN4V
+static void	tlb_init_sun4v(void);
+#endif
+void	sparc64_finalize_tlb_sun4u(u_long);
+#ifdef SUN4V
+void	sparc64_finalize_tlb_sun4v(u_long);
+#endif
 static int	mmu_mapin(vaddr_t, vsize_t);
+static int	mmu_mapin_sun4u(vaddr_t, vsize_t);
+#ifdef SUN4V
+static int	mmu_mapin_sun4v(vaddr_t, vsize_t);
+#endif
 static ssize_t	mmu_read(int, void *, size_t);
 static void*	mmu_memcpy(void *, const void *, size_t);
 static void*	mmu_memset(void *, int, size_t);
@@ -106,6 +118,9 @@ static struct memsw {
 
 static struct memsw *memsw = &memswa[0];
 
+#ifdef SUN4V
+static int sun4v = 0;
+#endif
 
 /*
  * Check if a memory region is already mapped. Return length and virtual
@@ -158,16 +173,52 @@ kvamap_enter(uint64_t va, uint64_t len)
 static void
 tlb_init(void)
 {
-	phandle_t child;
 	phandle_t root;
+#ifdef SUN4V	
 	char buf[128];
-	u_int bootcpu;
-	u_int cpu;
+#endif	
 
 	if (dtlb_store != NULL) {
 		return;
 	}
 
+	if ( (root = prom_findroot()) == -1) {
+		panic("tlb_init: prom_findroot()");
+	}
+#ifdef SUN4V		
+	if (_prom_getprop(root, "compatible", buf, sizeof(buf)) > 0 &&
+		strcmp(buf, "sun4v") == 0) {
+		tlb_init_sun4v();
+		sun4v = 1;
+	}
+	else {
+#endif
+		tlb_init_sun4u();
+#ifdef SUN4V		
+	}
+#endif
+
+	dtlb_store = alloc(dtlb_slot_max * sizeof(*dtlb_store));
+	itlb_store = alloc(itlb_slot_max * sizeof(*itlb_store));
+	if (dtlb_store == NULL || itlb_store == NULL) {
+		panic("tlb_init: malloc");
+	}
+
+	dtlb_slot = itlb_slot = 0;
+}
+
+/*
+ * Initialize TLB as required by MMU mapping functions - sun4u.
+ */
+static void
+tlb_init_sun4u(void)
+{
+	phandle_t child;
+	phandle_t root;
+	char buf[128];
+	u_int bootcpu;
+	u_int cpu;
+
 	bootcpu = get_cpuid();
 
 	if ( (root = prom_findroot()) == -1) {
@@ -196,14 +247,35 @@ tlb_init(void)
 	_prom_getprop(child, "#itlb-entries", &itlb_sl

CVS commit: src/sys/arch/arm/pic

2013-12-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  8 14:37:01 UTC 2013

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Mark rv as unused (for now)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/pic/pic.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/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.17 src/sys/arch/arm/pic/pic.c:1.18
--- src/sys/arch/arm/pic/pic.c:1.17	Sat Sep  7 00:32:02 2013
+++ src/sys/arch/arm/pic/pic.c	Sun Dec  8 14:37:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.17 2013/09/07 00:32:02 matt Exp $	*/
+/*	$NetBSD: pic.c,v 1.18 2013/12/08 14:37:01 skrll Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.17 2013/09/07 00:32:02 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.18 2013/12/08 14:37:01 skrll Exp $");
 
 #define _INTR_PRIVATE
 #include 
@@ -255,7 +255,7 @@ pic_find_pending_irqs_by_ipl(struct pic_
 void
 pic_dispatch(struct intrsource *is, void *frame)
 {
-	int rv;
+	int rv __unused;
 
 	if (__predict_false(is->is_arg == NULL)
 	&& __predict_true(frame != NULL)) {



CVS commit: src/sys/dev/pci

2013-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 11:32:51 UTC 2013

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

Log Message:
Cosmectic: use the same define in all places when referencing the BAR.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_athn_pci.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_athn_pci.c
diff -u src/sys/dev/pci/if_athn_pci.c:1.8 src/sys/dev/pci/if_athn_pci.c:1.9
--- src/sys/dev/pci/if_athn_pci.c:1.8	Sun Apr 21 19:59:40 2013
+++ src/sys/dev/pci/if_athn_pci.c	Sun Dec  8 11:32:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_pci.c,v 1.8 2013/04/21 19:59:40 msaitoh Exp $	*/
+/*	$NetBSD: if_athn_pci.c,v 1.9 2013/12/08 11:32:51 martin Exp $	*/
 /*	$OpenBSD: if_athn_pci.c,v 1.11 2011/01/08 10:02:32 damien Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_pci.c,v 1.8 2013/04/21 19:59:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_pci.c,v 1.9 2013/12/08 11:32:51 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -189,7 +189,7 @@ athn_pci_attach(device_t parent, device_
 		(int)memtype);
 		goto fail;
 	}
-	error = pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &psc->psc_iot,
+	error = pci_mapreg_map(pa, ATHN_PCI_MMBA, memtype, 0, &psc->psc_iot,
 	&psc->psc_ioh, NULL, &psc->psc_mapsz);
 	if (error != 0) {
 		aprint_error_dev(self, "cannot map register space\n");



CVS commit: src/sys/arch/sparc/sparc

2013-12-08 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Dec  8 10:12:39 UTC 2013

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

Log Message:
Use a double linked list with a static head to track MMU entries.
Code from martin@.
Tested on SUN4 (4/330), SUN4C (SS2), and SUN4M (Krups, 4/630).


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.353 src/sys/arch/sparc/sparc/pmap.c:1.354
--- src/sys/arch/sparc/sparc/pmap.c:1.353	Mon Nov 25 02:59:14 2013
+++ src/sys/arch/sparc/sparc/pmap.c	Sun Dec  8 10:12:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.353 2013/11/25 02:59:14 christos Exp $ */
+/*	$NetBSD: pmap.c,v 1.354 2013/12/08 10:12:39 jdc Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.353 2013/11/25 02:59:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.354 2013/12/08 10:12:39 jdc Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -279,12 +279,12 @@ pvhead4m(u_int pte)
  * by flushing (and invalidating) a TLB entry when appropriate before
  * altering an in-memory page table entry.
  */
-struct mmuq;
 struct mmuentry {
-	TAILQ_ENTRY(mmuentry)	me_list;	/* usage list link */
+	struct {
+	struct mmuentry *prev, *next;
+	}			me_list;	/* usage list link */
 	TAILQ_ENTRY(mmuentry)	me_pmchain;	/* pmap owner link */
 	struct	pmap *me_pmap;		/* pmap, if in use */
-	struct	mmuq *me_queue;		/* where do we live */
 	u_short	me_vreg;		/* associated virtual region/segment */
 	u_short	me_vseg;		/* associated virtual region/segment */
 	u_short	me_cookie;		/* hardware SMEG/PMEG number */
@@ -295,24 +295,54 @@ struct mmuentry {
 struct mmuentry *mmusegments;	/* allocated in pmap_bootstrap */
 struct mmuentry *mmuregions;	/* allocated in pmap_bootstrap */
 
-TAILQ_HEAD(mmuq, mmuentry);
-struct mmuq segm_freelist, segm_lru, segm_locked;
-struct mmuq region_freelist, region_lru, region_locked;
-
-#define MMUQ_INIT(head)			TAILQ_INIT(head)
-
-#define MMUQ_REMOVE(elm, field)		do { 	\
-	TAILQ_REMOVE(elm->me_queue, elm,field); \
-	elm->me_queue = NULL;			\
-} while (/*CONSTCOND*/0)
-
-#define MMUQ_INSERT_TAIL(head, elm, field) do {	\
-	TAILQ_INSERT_TAIL(head, elm, field);	\
-	elm->me_queue = head;			\
-} while (/*CONSTCOND*/0)
+#if defined(SUN4) || defined(SUN4C)
+struct mmuentry segm_freelist, segm_lru, segm_locked;
+#if defined(SUN4_MMU3L)
+struct mmuentry region_freelist, region_lru, region_locked;
+#endif
+/*
+ * We use a double linked list looping through its static head (which
+ * alway remains on the list), so we can remove any other member from
+ * a list without knowing which list it is on.
+ */
+static void inline
+mmuq_remove(struct mmuentry *e)
+{
+	e->me_list.next->me_list.prev = e->me_list.prev;
+	e->me_list.prev->me_list.next = e->me_list.next;
+}
+
+static void inline
+mmuq_init(struct mmuentry *e)
+{
+	memset(e, 0, sizeof(*e));
+	e->me_list.next = e;
+	e->me_list.prev = e;
+}
+
+static inline struct mmuentry *
+mmuq_first(struct mmuentry *head)
+{
+	KASSERT(head->me_list.next != head);
+	return head->me_list.next;
+}
+
+static inline bool
+mmuq_empty(struct mmuentry *head)
+{
+	return head->me_list.next == head;
+}
+
+static inline void
+mmuq_insert_tail(struct mmuentry *head, struct mmuentry *e)
+{
+	e->me_list.prev = head->me_list.prev;
+	e->me_list.next = head;
+	head->me_list.prev->me_list.next = e;
+	head->me_list.prev = e;
+}
+#endif
 
-#define MMUQ_EMPTY(head)		TAILQ_EMPTY(head)
-#define MMUQ_FIRST(head)		TAILQ_FIRST(head)
 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
@@ -912,7 +942,7 @@ pgt_page_free(struct pool *pp, void *v)
 {
 	vaddr_t va;
 	paddr_t pa;
-	bool rv __diagused;
+	bool rv;
 
 	va = (vaddr_t)v;
 	rv = pmap_extract(pmap_kernel(), va, &pa);
@@ -1545,10 +1575,10 @@ mmu_setup4m_L3(int pagtblptd, struct seg
 /*
  * MMU management.
  */
-static int	me_alloc(struct mmuq *, struct pmap *, int, int);
+static int	me_alloc(struct mmuentry *, struct pmap *, int, int);
 static void	me_free(struct pmap *, u_int);
 #if defined(SUN4_MMU3L)
-static int	region_alloc(struct mmuq *, struct pmap *, int);
+static int	region_alloc(struct mmuentry *, struct pmap *, int);
 static void	region_free(struct pmap *, u_int);
 #endif
 
@@ -1568,7 +1598,7 @@ static void	region_free(struct pmap *, u
  */
 
 static inline int
-me_alloc(struct mmuq *mh, struct pmap *newpm, int newvreg, int newvseg)
+me_alloc(struct mmuentry *mh, struct pmap *newpm, int newvreg, int newvseg)
 {
 	struct mmuentry *me;
 	struct pmap *pm;
@@ -1578,16 +1608,16 @@ me_alloc(struct mmuq *mh, struct pmap *n
 	struct segmap *sp;
 
 	/* try free list first */
-	if (!MMUQ_EMPTY(&segm_freelist)) {
-		me = MMUQ_FIRST(&segm_freelist)

CVS commit: src/sbin/gpt

2013-12-08 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Dec  8 09:32:51 UTC 2013

Modified Files:
src/sbin/gpt: add.c gpt.8 resize.c

Log Message:
For the add and resize subcommands, change the -s option.  If there is
no suffix, or the suffix is 's' or 'S', size is in sectors (as before)
otherwise size is in bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/add.c src/sbin/gpt/gpt.8
cvs rdiff -u -r1.6 -r1.7 src/sbin/gpt/resize.c

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

Modified files:

Index: src/sbin/gpt/add.c
diff -u src/sbin/gpt/add.c:1.22 src/sbin/gpt/add.c:1.23
--- src/sbin/gpt/add.c:1.22	Fri Dec  6 02:31:31 2013
+++ src/sbin/gpt/add.c	Sun Dec  8 09:32:51 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.22 2013/12/06 02:31:31 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.23 2013/12/08 09:32:51 jnemeth Exp $");
 #endif
 
 #include 
@@ -46,12 +46,12 @@ __RCSID("$NetBSD: add.c,v 1.22 2013/12/0
 #include "gpt.h"
 
 static uuid_t type;
-static off_t alignment, block, size;
+static off_t alignment, block, sectors, size;
 static unsigned int entry;
 static uint8_t *name;
 
 const char addmsg1[] = "add [-a alignment] [-b blocknr] [-i index] [-l label]";
-const char addmsg2[] = "[-s sectors] [-t type] device ...";
+const char addmsg2[] = "[-s size] [-t type] device ...";
 
 __dead static void
 usage_add(void)
@@ -134,14 +134,14 @@ add(int fd)
 
 	if (alignment > 0) {
 		alignsecs = alignment / secsz;
-		map = map_alloc(block, size, alignsecs);
+		map = map_alloc(block, sectors, alignsecs);
 		if (map == NULL) {
 			warnx("%s: error: not enough space available on "
 			  "device for an aligned partition", device_name);
 			return;
 		}
 	} else {
-		map = map_alloc(block, size, 0);
+		map = map_alloc(block, sectors, 0);
 		if (map == NULL) {
 			warnx("%s: error: not enough space available on "
 			  "device", device_name);
@@ -226,11 +226,31 @@ cmd_add(int argc, char *argv[])
 			name = (uint8_t *)strdup(optarg);
 			break;
 		case 's':
-			if (size > 0)
+			if (sectors > 0 || size > 0)
 usage_add();
-			size = strtoll(optarg, &p, 10);
-			if (*p != 0 || size < 1)
+			sectors = strtoll(optarg, &p, 10);
+			if (sectors < 1)
 usage_add();
+			if (*p == '\0')
+break;
+			if (*p == 's' || *p == 'S') {
+if (*(p + 1) == '\0')
+	break;
+else
+	usage_add();
+			}
+			if (*p == 'b' || *p == 'B') {
+if (*(p + 1) == '\0') {
+	size = sectors;
+	sectors = 0;
+	break;
+} else
+	usage_add();
+			}
+			if (dehumanize_number(optarg, &human_num) < 0)
+usage_add();
+			size = human_num;
+			sectors = 0;
 			break;
 		case 't':
 			if (!uuid_is_nil(&type, NULL))
@@ -260,11 +280,21 @@ cmd_add(int argc, char *argv[])
 		}
 
 		if (alignment % secsz != 0) {
-			warnx("Alignment must be a multiple of sector size; ");
+			warnx("Alignment must be a multiple of sector size;");
+			warnx("the sector size for %s is %d bytes.",
+			device_name, secsz);
+			continue;
+		}
+
+		if (size % secsz != 0) {
+			warnx("Size in bytes must be a multiple of sector "
+			  "size;");
 			warnx("the sector size for %s is %d bytes.",
 			device_name, secsz);
 			continue;
 		}
+		if (size > 0)
+			sectors = size / secsz;
 
 		add(fd);
 
Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.22 src/sbin/gpt/gpt.8:1.23
--- src/sbin/gpt/gpt.8:1.22	Fri Dec  6 02:31:31 2013
+++ src/sbin/gpt/gpt.8	Sun Dec  8 09:32:51 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.22 2013/12/06 02:31:31 jnemeth Exp $
+.\" $NetBSD: gpt.8,v 1.23 2013/12/08 09:32:51 jnemeth Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd December 5, 2013
+.Dd December 8, 2013
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -95,7 +95,7 @@ There is no formalized definition of the
 .Bl -tag -width indent
 .\"  add 
 .It Nm Ic add Oo Fl a Ar alignment Oc Oo Fl b Ar blocknr Oc \
-Oo Fl i Ar index Oc Oo Fl l Ar label Oc Oo Fl s Ar sectors Oc \
+Oo Fl i Ar index Oc Oo Fl l Ar label Oc Oo Fl s Ar size Oc \
 Oo Fl t Ar type Oc Ar device ...
 The
 .Ic add
@@ -129,9 +129,15 @@ The
 option allows the user to specify a label for the partition.
 .Pp
 The
-.Fl s Ar sectors
-option allows the user to specify the size of the partition in sectors.
-The minimum size is 1.
+.Fl s Ar size
+option allows the user to specify the size of the partition.
+If there is no suffix, or the suffix is
+.Sq s
+or
+.Sq S
+then size is in sectors, otherwise size is in bytes which must be
+a multiple of the device's sector size.
+The minimum size is 1 sector.
 .Pp
 The
 .Fl t Ar type
@@ -317,7 +323,7 @@ Partitions are removed by clearing the p
 No other information is changed.
 .\"  resize 
 .I

CVS commit: src/sys/rump/kern/lib/libsys_linux

2013-12-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec  8 08:55:27 UTC 2013

Modified Files:
src/sys/rump/kern/lib/libsys_linux: rump_linux_syscall.h
rump_linux_syscallargs.h rump_linux_syscalls.c rump_linux_sysent.c

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h
cvs rdiff -u -r1.8 -r1.9 \
src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h \
src/sys/rump/kern/lib/libsys_linux/rump_linux_syscalls.c \
src/sys/rump/kern/lib/libsys_linux/rump_linux_sysent.c

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

Modified files:

Index: src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h
diff -u src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h:1.5 src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h:1.6
--- src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h:1.5	Sat Dec  7 11:49:56 2013
+++ src/sys/rump/kern/lib/libsys_linux/rump_linux_syscall.h	Sun Dec  8 08:55:27 2013
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_linux_syscall.h,v 1.5 2013/12/07 11:49:56 njoly Exp $ */
+/* $NetBSD: rump_linux_syscall.h,v 1.6 2013/12/08 08:55:27 njoly Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.7 2013/12/07 11:49:27 njoly Exp
+ * created from	NetBSD: syscalls.master,v 1.8 2013/12/08 08:54:48 njoly Exp
  */
 
 #ifndef _RUMP_LINUX_SYS_SYSCALL_H_
@@ -168,6 +168,18 @@
 /* syscall: "fchroot" ret: "int" args: "int" */
 #define	RUMP_LINUX_SYS_fchroot	297
 
+/* syscall: "renameat" ret: "int" args: "int" "const char *" "int" "const char *" */
+#define	RUMP_LINUX_SYS_renameat	458
+
+/* syscall: "mkdirat" ret: "int" args: "int" "const char *" "mode_t" */
+#define	RUMP_LINUX_SYS_mkdirat	461
+
+/* syscall: "readlinkat" ret: "int" args: "int" "const char *" "char *" "size_t" */
+#define	RUMP_LINUX_SYS_readlinkat	469
+
+/* syscall: "symlinkat" ret: "int" args: "const char *" "int" "const char *" */
+#define	RUMP_LINUX_SYS_symlinkat	470
+
 #define	RUMP_LINUX_SYS_MAXSYSCALL	477
 #define	RUMP_LINUX_SYS_NSYSENT	512
 #endif /* _RUMP_LINUX_SYS_SYSCALL_H_ */

Index: src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h
diff -u src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h:1.8 src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h:1.9
--- src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h:1.8	Sat Dec  7 11:49:56 2013
+++ src/sys/rump/kern/lib/libsys_linux/rump_linux_syscallargs.h	Sun Dec  8 08:55:27 2013
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_linux_syscallargs.h,v 1.8 2013/12/07 11:49:56 njoly Exp $ */
+/* $NetBSD: rump_linux_syscallargs.h,v 1.9 2013/12/08 08:55:27 njoly Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.7 2013/12/07 11:49:27 njoly Exp
+ * created from	NetBSD: syscalls.master,v 1.8 2013/12/08 08:54:48 njoly Exp
  */
 
 #ifndef _RUMP_LINUX_SYS_SYSCALLARGS_H_
@@ -342,6 +342,58 @@ struct linux_sys_dup3_args {
 };
 check_syscall_args(linux_sys_dup3)
 
+struct linux_sys_linkat_args {
+	syscallarg(int) fd1;
+	syscallarg(const char *) name1;
+	syscallarg(int) fd2;
+	syscallarg(const char *) name2;
+	syscallarg(int) flags;
+};
+check_syscall_args(linux_sys_linkat)
+
+struct sys_renameat_args;
+
+struct linux_sys_mknodat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+	syscallarg(unsigned) dev;
+};
+check_syscall_args(linux_sys_mknodat)
+
+struct sys_mkdirat_args;
+
+struct linux_sys_faccessat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) amode;
+};
+check_syscall_args(linux_sys_faccessat)
+
+struct linux_sys_fchmodat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(linux_sys_fchmodat)
+
+struct linux_sys_fchownat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(uid_t) owner;
+	syscallarg(gid_t) group;
+	syscallarg(int) flag;
+};
+check_syscall_args(linux_sys_fchownat)
+
+struct linux_sys_fstatat64_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(struct linux_stat *) sp;
+	syscallarg(int) flag;
+};
+check_syscall_args(linux_sys_fstatat64)
+
 struct linux_sys_utimensat_args {
 	syscallarg(int) fd;
 	syscallarg(const char *) path;
@@ -350,6 +402,25 @@ struct linux_sys_utimensat_args {
 };
 check_syscall_args(linux_sys_utimensat)
 
+struct linux_sys_openat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) flags;
+	syscallarg(mode_t) mode;
+};
+check_syscall_args(linux_sys_openat)
+
+struct sys_readlinkat_args;
+
+struct sys_symlinkat_args;
+
+struct linux_sys_unlinkat_args {
+	syscallarg(int) fd;
+	syscallarg(const char *) path;
+	syscallarg(int) flag;
+};
+check_syscall_args(linux_sys_u

CVS commit: src/sys/rump/kern/lib/libsys_linux

2013-12-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec  8 08:54:48 UTC 2013

Modified Files:
src/sys/rump/kern/lib/libsys_linux: syscalls.master

Log Message:
Add support for *at syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/kern/lib/libsys_linux/syscalls.master

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

Modified files:

Index: src/sys/rump/kern/lib/libsys_linux/syscalls.master
diff -u src/sys/rump/kern/lib/libsys_linux/syscalls.master:1.7 src/sys/rump/kern/lib/libsys_linux/syscalls.master:1.8
--- src/sys/rump/kern/lib/libsys_linux/syscalls.master:1.7	Sat Dec  7 11:49:27 2013
+++ src/sys/rump/kern/lib/libsys_linux/syscalls.master	Sun Dec  8 08:54:48 2013
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.7 2013/12/07 11:49:27 njoly Exp $
+	$NetBSD: syscalls.master,v 1.8 2013/12/08 08:54:48 njoly Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -584,22 +584,34 @@
 454	NODEF		{ int|linux_sys||dup3(int from, int to, int flags); }
 455	UNIMPL		kqueue1
 456	UNIMPL		paccept
-457	UNIMPL		linkat
-458	UNIMPL		renameat
+457	NODEF		{ int|linux_sys||linkat(int fd1, const char *name1, \
+			int fd2, const char *name2, int flags); }
+458	NOARGS		{ int|sys||renameat(int fromfd, const char *from, \
+			int tofd, const char *to); }
 459	UNIMPL		mkfifoat
-460	UNIMPL		mknodat
-461	UNIMPL		mkdirat
-462	UNIMPL		faccessat
-463	UNIMPL		fchmodat
-464	UNIMPL		fchownat
+460	NODEF		{ int|linux_sys||mknodat(int fd, const char *path, \
+			mode_t mode, unsigned dev); }
+461	NOARGS		{ int|sys||mkdirat(int fd, const char *path, \
+			mode_t mode); }
+462	NODEF		{ int|linux_sys||faccessat(int fd, const char *path, \
+			int amode); }
+463	NODEF		{ int|linux_sys||fchmodat(int fd, const char *path, \
+			mode_t mode); }
+464	NODEF		{ int|linux_sys||fchownat(int fd, const char *path, \
+			uid_t owner, gid_t group, int flag); }
 465	UNIMPL		fexecve
-466	UNIMPL		fstatat
+466	NODEF		{ int|linux_sys||fstatat64(int fd, const char *path, \
+			   struct linux_stat *sp, int flag); }
 467	NODEF		{ int|linux_sys||utimensat(int fd, const char *path, \
 			struct linux_timespec *times, int flag); }
-468	UNIMPL		openat
-469	UNIMPL		readlinkat
-470	UNIMPL		symlinkat
-471	UNIMPL		unlinkat
+468	NODEF		{ int|linux_sys||openat(int fd, const char *path, \
+			int flags, ... mode_t mode); }
+469	NOARGS		{ int|sys||readlinkat(int fd, const char *path, \
+			char *buf, size_t bufsize); }
+470	NOARGS		{ int|sys||symlinkat(const char *path1, int fd, \
+			const char *path2); }
+471	NODEF		{ int|linux_sys||unlinkat(int fd, const char *path, \
+			int flag); }
 472	UNIMPL		futimens
 473	UNIMPL		__quotactl
 474	UNIMPL		posix_spawn



CVS commit: src/bin/cat

2013-12-08 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Dec  8 08:32:13 UTC 2013

Modified Files:
src/bin/cat: cat.c

Log Message:
more complete fix for Coverity issue 976653


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/bin/cat/cat.c

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

Modified files:

Index: src/bin/cat/cat.c
diff -u src/bin/cat/cat.c:1.53 src/bin/cat/cat.c:1.54
--- src/bin/cat/cat.c:1.53	Tue Dec  3 17:06:51 2013
+++ src/bin/cat/cat.c	Sun Dec  8 08:32:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.53 2013/12/03 17:06:51 spz Exp $	*/
+/* $NetBSD: cat.c,v 1.54 2013/12/08 08:32:13 spz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)cat.c	8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: cat.c,v 1.53 2013/12/03 17:06:51 spz Exp $");
+__RCSID("$NetBSD: cat.c,v 1.54 2013/12/08 08:32:13 spz Exp $");
 #endif
 #endif /* not lint */
 
@@ -279,10 +279,11 @@ skipnomsg:
 continue;
 			}
 			filename = *argv++;
+		} else if (fd < 0) {
+			err(EXIT_FAILURE, "stdin");
 		}
 		raw_cat(fd);
-		/* fd > 0 would be cuter but let's priorize human-readability */
-		if (fd >= 0 && fd != fileno(stdin))
+		if (fd != fileno(stdin))
 			(void)close(fd);
 	} while (*argv);
 }



CVS commit: src/sbin/gpt

2013-12-08 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Dec  8 08:30:01 UTC 2013

Modified Files:
src/sbin/gpt: show.c

Log Message:
fix off-by-one error


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/gpt/show.c

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

Modified files:

Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.12 src/sbin/gpt/show.c:1.13
--- src/sbin/gpt/show.c:1.12	Sat Nov 30 19:43:53 2013
+++ src/sbin/gpt/show.c	Sun Dec  8 08:30:01 2013
@@ -29,7 +29,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.12 2013/11/30 19:43:53 jnemeth Exp $");
+__RCSID("$NetBSD: show.c,v 1.13 2013/12/08 08:30:01 jnemeth Exp $");
 #endif
 
 #include 
@@ -311,7 +311,7 @@ cmd_show(int argc, char *argv[])
 			continue;
 		}
 
-		if (entry > 1)
+		if (entry > 0)
 			show_one();
 		else
 			show();