CVS commit: src/lib/libnpf

2014-01-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Jan  8 10:14:21 UTC 2014

Modified Files:
src/lib/libnpf: npf.3

Log Message:
Kill extra space in function argument.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libnpf/npf.3

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

Modified files:

Index: src/lib/libnpf/npf.3
diff -u src/lib/libnpf/npf.3:1.13 src/lib/libnpf/npf.3:1.14
--- src/lib/libnpf/npf.3:1.13	Tue Nov 12 06:06:21 2013
+++ src/lib/libnpf/npf.3	Wed Jan  8 10:14:21 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: npf.3,v 1.13 2013/11/12 06:06:21 wiz Exp $
+.\	$NetBSD: npf.3,v 1.14 2014/01/08 10:14:21 njoly Exp $
 .\
 .\ Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -56,7 +56,7 @@
 .Ft bool
 .Fn npf_rule_exists_p nl_config_t *ncf const char *name
 .Ft int
-.Fn npf_rule_insert nl_config_t *ncf  nl_rule_t *parent nl_rule_t *rl
+.Fn npf_rule_insert nl_config_t *ncf nl_rule_t *parent nl_rule_t *rl
 .Ft int
 .Fn npf_rule_setprio nl_rule_t *rl pri_t pri
 .Ft int



CVS commit: src/lib/librumpuser

2014-01-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan  8 11:04:47 UTC 2014

Modified Files:
src/lib/librumpuser: rumpuser_port.h

Log Message:
remove obsolete definitions


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/librumpuser/rumpuser_port.h

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

Modified files:

Index: src/lib/librumpuser/rumpuser_port.h
diff -u src/lib/librumpuser/rumpuser_port.h:1.25 src/lib/librumpuser/rumpuser_port.h:1.26
--- src/lib/librumpuser/rumpuser_port.h:1.25	Wed Jan  8 01:47:31 2014
+++ src/lib/librumpuser/rumpuser_port.h	Wed Jan  8 11:04:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_port.h,v 1.25 2014/01/08 01:47:31 pooka Exp $	*/
+/*	$NetBSD: rumpuser_port.h,v 1.26 2014/01/08 11:04:47 pooka Exp $	*/
 
 /*
  * Portability header for non-NetBSD platforms.
@@ -21,8 +21,6 @@
 #define PLATFORM_HAS_NBSYSCTL
 #define PLATFORM_HAS_NBFILEHANDLE
 
-#define PLATFORM_HAS_DISKLABEL
-#define PLATFORM_HAS_NBMODULES
 #define PLATFORM_HAS_STRSUFTOLL
 #define PLATFORM_HAS_SETGETPROGNAME
 



CVS commit: src/sys/rump/net/lib/libshmif

2014-01-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan  8 11:06:33 UTC 2014

Modified Files:
src/sys/rump/net/lib/libshmif: rumpcomp_user.c

Log Message:
OpenBSD has kqueue


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/net/lib/libshmif/rumpcomp_user.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/net/lib/libshmif/rumpcomp_user.c
diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.13 src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.14
--- src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.13	Thu Jul  4 17:46:14 2013
+++ src/sys/rump/net/lib/libshmif/rumpcomp_user.c	Wed Jan  8 11:06:33 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpcomp_user.c,v 1.13 2013/07/04 17:46:14 pooka Exp $	*/
+/*  $NetBSD: rumpcomp_user.c,v 1.14 2014/01/08 11:06:33 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -42,7 +42,8 @@
  * good chance of doing the fd-path mapping on Linux thanks to dcache,
  * so just keep the existing interfaces for now.
  */
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \
+|| defined(__OpenBSD__)
 #include sys/event.h
 
 #include stdlib.h



CVS commit: src/distrib/sets/lists

2014-01-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  8 12:30:27 UTC 2014

Modified Files:
src/distrib/sets/lists/base: ad.arm ad.mips md.amd64 md.sparc64 shl.mi
src/distrib/sets/lists/debug: ad.arm ad.mips md.amd64 md.sparc64 shl.mi

Log Message:
bump libc for ptsname_r


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/distrib/sets/lists/base/ad.arm
cvs rdiff -u -r1.25 -r1.26 src/distrib/sets/lists/base/ad.mips
cvs rdiff -u -r1.219 -r1.220 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.206 -r1.207 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.683 -r1.684 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.20 -r1.21 src/distrib/sets/lists/debug/ad.arm
cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/debug/ad.mips
cvs rdiff -u -r1.37 -r1.38 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.38 -r1.39 src/distrib/sets/lists/debug/md.sparc64
cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/lists/debug/shl.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/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.29 src/distrib/sets/lists/base/ad.arm:1.30
--- src/distrib/sets/lists/base/ad.arm:1.29	Tue Dec 31 15:26:17 2013
+++ src/distrib/sets/lists/base/ad.arm	Wed Jan  8 07:30:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.29 2013/12/31 20:26:17 christos Exp $
+# $NetBSD: ad.arm,v 1.30 2014/01/08 12:30:27 christos Exp $
 ./lib/oabi	base-compat-shlib	compat
 ./lib/oabi/npf	base-npf-shlib		compat
 ./lib/oabi/npf/ext_log.so			base-npf-shlib		compat,pic
@@ -92,7 +92,7 @@
 ./usr/lib/oabi/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/oabi/libc.so.12.187			base-compat-shlib	compat,pic
+./usr/lib/oabi/libc.so.12.188			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libc_vfp.so.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libc_vfp.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos

Index: src/distrib/sets/lists/base/ad.mips
diff -u src/distrib/sets/lists/base/ad.mips:1.25 src/distrib/sets/lists/base/ad.mips:1.26
--- src/distrib/sets/lists/base/ad.mips:1.25	Tue Dec 31 15:26:17 2013
+++ src/distrib/sets/lists/base/ad.mips	Wed Jan  8 07:30:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.25 2013/12/31 20:26:17 christos Exp $
+# $NetBSD: ad.mips,v 1.26 2014/01/08 12:30:27 christos Exp $
 ./lib/64	base-compat-shlib	compat,arch64
 ./lib/64/npf	base-npf-shlib		compat,arch64
 ./lib/64/npf/ext_log.sobase-npf-shlib		compat,pic,arch64
@@ -94,7 +94,7 @@
 ./usr/lib/64/libc++.so.1			base-compat-shlib	compat,pic,libcxx,arch64
 ./usr/lib/64/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx,arch64
 ./usr/lib/64/libc.so.12base-compat-shlib	compat,pic,arch64
-./usr/lib/64/libc.so.12.187			base-compat-shlib	compat,pic,arch64
+./usr/lib/64/libc.so.12.188			base-compat-shlib	compat,pic,arch64
 ./usr/lib/64/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos,arch64
 ./usr/lib/64/libcom_err.so.7.0			base-compat-shlib	compat,pic,kerberos,arch64
 ./usr/lib/64/libcrypt.so.1			base-compat-shlib	compat,pic,arch64
@@ -434,7 +434,7 @@
 ./usr/lib/o32/libc++.so.1			base-compat-shlib	compat,pic,libcxx,arch64
 ./usr/lib/o32/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx,arch64
 ./usr/lib/o32/libc.so.12			base-compat-shlib	compat,pic,arch64
-./usr/lib/o32/libc.so.12.187			base-compat-shlib	compat,pic,arch64
+./usr/lib/o32/libc.so.12.188			base-compat-shlib	compat,pic,arch64
 ./usr/lib/o32/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos,arch64
 ./usr/lib/o32/libcom_err.so.7.0			base-compat-shlib	compat,pic,kerberos,arch64
 ./usr/lib/o32/libcrypt.so.1			base-compat-shlib	compat,pic,arch64

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.219 src/distrib/sets/lists/base/md.amd64:1.220
--- src/distrib/sets/lists/base/md.amd64:1.219	Tue Dec 31 15:26:17 2013
+++ src/distrib/sets/lists/base/md.amd64	Wed Jan  8 07:30:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.219 2013/12/31 20:26:17 christos Exp $
+# $NetBSD: md.amd64,v 1.220 2014/01/08 12:30:27 christos Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./lib/i386	base-compat-shlib		compat
@@ -86,7 +86,7 @@
 ./usr/lib/i386/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/i386/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/i386/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/i386/libc.so.12.187			base-compat-shlib	compat,pic
+./usr/lib/i386/libc.so.12.188			base-compat-shlib	compat,pic
 ./usr/lib/i386/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/i386/libcom_err.so.7.0		base-compat-shlib	compat,pic,kerberos
 ./usr/lib/i386/libcrypt.so.1			base-compat-shlib	

CVS commit: src/lib/libc

2014-01-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  8 12:29:49 UTC 2014

Modified Files:
src/lib/libc: shlib_version

Log Message:
bump for ptsname_r


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 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.245 src/lib/libc/shlib_version:1.246
--- src/lib/libc/shlib_version:1.245	Sun Dec  8 16:29:15 2013
+++ src/lib/libc/shlib_version	Wed Jan  8 07:29:49 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.245 2013/12/08 21:29:15 dholland Exp $
+#	$NetBSD: shlib_version,v 1.246 2014/01/08 12:29:49 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -39,4 +39,4 @@
 # - switch to DT_INIT_ARRAY on all platforms
 # - consolidate ownership with crt0.o and avoid common symbols
 major=12
-minor=187
+minor=188



CVS commit: xsrc/external/mit/xf86-input-elographics/dist/src

2014-01-08 Thread Marc Balmer
Module Name:xsrc
Committed By:   mbalmer
Date:   Wed Jan  8 12:46:48 UTC 2014

Modified Files:
xsrc/external/mit/xf86-input-elographics/dist/src: xf86Elo.c

Log Message:
Add support for inverted axis, from upstream repository.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c

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

Modified files:

Index: xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c
diff -u xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.4 xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.5
--- xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.4	Fri Jul 26 13:37:37 2013
+++ xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c	Wed Jan  8 12:46:48 2014
@@ -360,6 +360,22 @@ xf86EloReadInput(InputInfoPtr	pInfo)
   cur_y = WORD_ASSEMBLY(priv-packet_buf[5], priv-packet_buf[6]);
   state = priv-packet_buf[2]  0x07;
 
+  DBG(5, ErrorF(ELO got: x(%d), y(%d), %s\n,
+  cur_x, cur_y,
+  (state == ELO_PRESS) ? Press :
+			((state == ELO_RELEASE) ? Release : Stream)));
+
+  if (priv-min_y  priv-max_y) {
+/* inverted y axis */
+cur_y = priv-max_y - cur_y + priv-min_y;
+  }
+
+  if (priv-min_x  priv-max_x) {
+/* inverted x axis */
+cur_x = priv-max_x - cur_x + priv-min_x;
+  }
+
+
   /*
* Send events.
*
@@ -676,6 +692,7 @@ xf86EloControl(DeviceIntPtr	dev,
   unsigned char		reply[ELO_PACKET_SIZE];
   Atom btn_label;
   Atom axis_labels[2] = { 0, 0 };
+  int x0, x1, y0, y1;
 
   switch(mode) {
 
@@ -719,17 +736,27 @@ xf86EloControl(DeviceIntPtr	dev,
 	return !Success;
   }
   else {
+
+	/* Correct the coordinates for possibly inverted axis.
+	   Leave priv-variables untouched so we can check for
+	   inversion on incoming events.
+	 */
+	y0 = min(priv-min_y, priv-max_y);
+	y1 = max(priv-min_y, priv-max_y);
+	x0 = min(priv-min_x, priv-max_x);
+	x1 = max(priv-min_x, priv-max_x);
+
 	/* I will map coordinates myself */
 	InitValuatorAxisStruct(dev, 0,
 			   axis_labels[0],
-			   priv-min_x, priv-max_x,
+			   x0, x1,
 			   9500,
 			   0 /* min_res */,
 			   9500  /* max_res */,
 			   Absolute);
 	InitValuatorAxisStruct(dev, 1,
 			   axis_labels[1],
-			   priv-min_y, priv-max_y,
+			   y0, y1,
 			   10500,
 			   0 /* min_res */,
 			   10500 /* max_res */,
@@ -848,6 +875,11 @@ xf86EloControl(DeviceIntPtr	dev,
 DBG(2, ErrorF(Done\n));
 return Success;
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) * 100 + GET_ABI_MINOR(ABI_XINPUT_VERSION) = 1901
+  case DEVICE_ABORT:
+return Success;
+#endif
+
   default:
   ErrorF(unsupported mode=%d\n, mode);
   return BadValue;



CVS commit: xsrc/external/mit/xf86-input-elographics/dist/src

2014-01-08 Thread Marc Balmer
Module Name:xsrc
Committed By:   mbalmer
Date:   Wed Jan  8 12:48:41 UTC 2014

Modified Files:
xsrc/external/mit/xf86-input-elographics/dist/src: xf86Elo.c

Log Message:
Add support for touchscreens that don't frame the packets (usually USB devices
like e.g. the IBM SurePos touchscreens).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c

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

Modified files:

Index: xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c
diff -u xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.5 xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.6
--- xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.5	Wed Jan  8 12:46:48 2014
+++ xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c	Wed Jan  8 12:48:41 2014
@@ -103,6 +103,7 @@ static Model SupportedModels[] =
  ***
  */
 #define ELO_PACKET_SIZE		10
+#define ELO_UNFRAMED_SIZE	8
 
 #define ELO_SYNC_BYTE		'U'	/* Sync byte. First of a packet.	*/
 #define ELO_TOUCH		'T'	/* Report of touchs and motions. Not	*
@@ -196,6 +197,8 @@ typedef struct _EloPrivateRec {
   int		swap_axes;		/* Swap X an Y axes if != 0 */
   unsigned char	packet_buf[ELO_PACKET_SIZE]; /* Assembly buffer*/
   int		model;			/* one of MODEL_...*/
+  Bool		no_framing;		/* Whether packets are framed */
+
 } EloPrivateRec, *EloPrivatePtr;
 
 /*
@@ -303,6 +306,45 @@ xf86EloGetPacket(unsigned char	*buffer,
   }
 }
 
+/*
+ ***
+ *
+ * xf86EloGetUnframedPacket --
+ *	Read an unframed packet from the port
+ *  The packet structure read by this function is as follow:
+ *		Byte 0 : ELO_TOUCH
+ *		Byte 1
+ *		...
+ *		Byte 8 : packet data
+ *
+ *	This function returns if a valid packet has been assembled in
+ *	buffer or if no more data is available.
+ *
+ *
+ ***
+ */
+static Bool
+xf86EloGetUnframedPacket(unsigned char	*buffer,
+		 int		fd)
+{
+  int	num_bytes;
+  Bool	ok;
+
+  SYSCALL(num_bytes = read(fd,
+			   (char *) (buffer),
+			   ELO_UNFRAMED_SIZE));
+
+  /*
+   * Okay, give up.
+   */
+  if (num_bytes != ELO_UNFRAMED_SIZE) {
+Error(System error while reading from Elographics touchscreen.);
+return !Success;
+  }
+  DBG(4, ErrorF(Read %d bytes\n, num_bytes));
+
+  return Success;
+}
 
 /*
  ***
@@ -343,12 +385,17 @@ xf86EloReadInput(InputInfoPtr	pInfo)
* one packet worth of data in the OS buffer.
*/
   do {
-  if(xf86EloGetPacket(priv-packet_buf,
+  if (priv-no_framing) {
+if(xf86EloGetUnframedPacket(priv-packet_buf[1],
+   pInfo-fd) != Success)
+continue;
+  } else {
+if(xf86EloGetPacket(priv-packet_buf,
 		   priv-packet_buf_p,
 		   priv-checksum,
 		   pInfo-fd) != Success)
   continue;
-
+  }
   /*
* Process only ELO_TOUCHs here.
*/
@@ -917,7 +964,7 @@ xf86EloAllocate(InputDriverPtr drv, Inpu
   priv-checksum = ELO_INIT_CHECKSUM;
   priv-packet_buf_p = 0;
   priv-swap_axes = 0;
-
+  priv-no_framing = 0;
   pInfo-device_control = xf86EloControl;
   pInfo-read_input   = xf86EloReadInput;
   pInfo-control_proc = NULL;
@@ -1023,6 +1070,8 @@ xf86EloInit(InputDriverPtr	drv,
   if (priv-swap_axes) {
 xf86Msg(X_CONFIG, Elographics device will work with X and Y axes swapped\n);
   }
+  priv-no_framing = xf86SetIntOption(pInfo-options, NoFraming, 0);
+  xf86Msg(X_CONFIG, Elographics no framing: %d\n, priv-no_framing);
   debug_level = xf86SetIntOption(pInfo-options, DebugLevel, 0);
   if (debug_level) {
 #if DEBUG



CVS commit: src/sys/fs/tmpfs

2014-01-08 Thread pedro martelletto
Module Name:src
Committed By:   pedro
Date:   Wed Jan  8 16:11:04 UTC 2014

Modified Files:
src/sys/fs/tmpfs: tmpfs_subr.c

Log Message:
Allocate direntp on the stack in tmpfs_dir_getdents(), thus saving
calls to kmem_zalloc() and kmem_free(); OK rmind@. From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/fs/tmpfs/tmpfs_subr.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/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.93 src/sys/fs/tmpfs/tmpfs_subr.c:1.94
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.93	Fri Jan  3 09:53:12 2014
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Wed Jan  8 16:11:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.93 2014/01/03 09:53:12 hannken Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.94 2014/01/08 16:11:04 pedro Exp $	*/
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tmpfs_subr.c,v 1.93 2014/01/03 09:53:12 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: tmpfs_subr.c,v 1.94 2014/01/08 16:11:04 pedro Exp $);
 
 #include sys/param.h
 #include sys/cprng.h
@@ -797,26 +797,26 @@ int
 tmpfs_dir_getdents(tmpfs_node_t *node, struct uio *uio, off_t *cntp)
 {
 	tmpfs_dirent_t *de;
-	struct dirent *dentp;
+	struct dirent dent;
 	int error = 0;
 
 	KASSERT(VOP_ISLOCKED(node-tn_vnode));
 	TMPFS_VALIDATE_DIR(node);
 
 	/*
-	 * Allocate struct dirent and first check for the . and ...
+	 * First check for the . and .. cases.
 	 * Note: tmpfs_dir_getdotents() will seek for us.
 	 */
-	dentp = kmem_zalloc(sizeof(struct dirent), KM_SLEEP);
+	memset(dent, 0, sizeof(dent));
 
 	if (uio-uio_offset == TMPFS_DIRSEQ_DOT) {
-		if ((error = tmpfs_dir_getdotents(node, dentp, uio)) != 0) {
+		if ((error = tmpfs_dir_getdotents(node, dent, uio)) != 0) {
 			goto done;
 		}
 		(*cntp)++;
 	}
 	if (uio-uio_offset == TMPFS_DIRSEQ_DOTDOT) {
-		if ((error = tmpfs_dir_getdotents(node, dentp, uio)) != 0) {
+		if ((error = tmpfs_dir_getdotents(node, dent, uio)) != 0) {
 			goto done;
 		}
 		(*cntp)++;
@@ -840,26 +840,26 @@ tmpfs_dir_getdents(tmpfs_node_t *node, s
 	 */
 	do {
 		if (de-td_node == TMPFS_NODE_WHITEOUT) {
-			dentp-d_fileno = 1;
-			dentp-d_type = DT_WHT;
+			dent.d_fileno = 1;
+			dent.d_type = DT_WHT;
 		} else {
-			dentp-d_fileno = de-td_node-tn_id;
-			dentp-d_type = vtype2dt(de-td_node-tn_type);
+			dent.d_fileno = de-td_node-tn_id;
+			dent.d_type = vtype2dt(de-td_node-tn_type);
 		}
-		dentp-d_namlen = de-td_namelen;
-		KASSERT(de-td_namelen  sizeof(dentp-d_name));
-		memcpy(dentp-d_name, de-td_name, de-td_namelen);
-		dentp-d_name[de-td_namelen] = '\0';
-		dentp-d_reclen = _DIRENT_SIZE(dentp);
+		dent.d_namlen = de-td_namelen;
+		KASSERT(de-td_namelen  sizeof(dent.d_name));
+		memcpy(dent.d_name, de-td_name, de-td_namelen);
+		dent.d_name[de-td_namelen] = '\0';
+		dent.d_reclen = _DIRENT_SIZE(dent);
 
-		if (dentp-d_reclen  uio-uio_resid) {
+		if (dent.d_reclen  uio-uio_resid) {
 			/* Exhausted UIO space. */
 			error = EJUSTRETURN;
 			break;
 		}
 
 		/* Copy out the directory entry and continue. */
-		error = uiomove(dentp, dentp-d_reclen, uio);
+		error = uiomove(dent, dent.d_reclen, uio);
 		if (error) {
 			break;
 		}
@@ -873,7 +873,6 @@ tmpfs_dir_getdents(tmpfs_node_t *node, s
 	node-tn_spec.tn_dir.tn_readdir_lastp = de;
 done:
 	tmpfs_update(node-tn_vnode, TMPFS_UPDATE_ATIME);
-	kmem_free(dentp, sizeof(struct dirent));
 
 	if (error == EJUSTRETURN) {
 		/* Exhausted UIO space - just return. */



CVS commit: src/sys/dev/i2c

2014-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan  8 16:45:14 UTC 2014

Modified Files:
src/sys/dev/i2c: tps65217pmic.c

Log Message:
Add unused tps65217pmic_reg_write() function.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/tps65217pmic.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/i2c/tps65217pmic.c
diff -u src/sys/dev/i2c/tps65217pmic.c:1.7 src/sys/dev/i2c/tps65217pmic.c:1.8
--- src/sys/dev/i2c/tps65217pmic.c:1.7	Tue Dec 31 14:51:46 2013
+++ src/sys/dev/i2c/tps65217pmic.c	Wed Jan  8 16:45:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tps65217pmic.c,v 1.7 2013/12/31 14:51:46 skrll Exp $ */
+/*	$NetBSD: tps65217pmic.c,v 1.8 2014/01/08 16:45:14 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tps65217pmic.c,v 1.7 2013/12/31 14:51:46 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: tps65217pmic.c,v 1.8 2014/01/08 16:45:14 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -131,6 +131,8 @@ static int tps65217pmic_match(device_t, 
 static void tps65217pmic_attach(device_t, device_t, void *);
 
 static uint8_t tps65217pmic_reg_read(struct tps65217pmic_softc *, uint8_t);
+static void tps65217pmic_reg_write(struct tps65217pmic_softc *, uint8_t,
+uint8_t);
 
 static void tps65217pmic_reg_refresh(struct tps65217pmic_softc *);
 
@@ -606,6 +608,29 @@ tps65217pmic_reg_read(struct tps65217pmi
 	return rv;
 }
 
+static void __unused
+tps65217pmic_reg_write(struct tps65217pmic_softc *sc, uint8_t reg, uint8_t data)
+{
+	uint8_t wbuf[2];
+
+	if (iic_acquire_bus(sc-sc_tag, I2C_F_POLL) != 0) {
+		aprint_error_dev(sc-sc_dev, cannot acquire bus for write\n);
+		return;
+	}
+
+	wbuf[0] = reg;
+	wbuf[1] = data;
+
+	if (iic_exec(sc-sc_tag, I2C_OP_WRITE_WITH_STOP, sc-sc_addr, wbuf,
+	2, NULL, 0, I2C_F_POLL)) {
+		aprint_error_dev(sc-sc_dev, cannot execute I2C write\n);
+		iic_release_bus(sc-sc_tag, I2C_F_POLL);
+		return;
+	}
+
+	iic_release_bus(sc-sc_tag, I2C_F_POLL);
+}
+
 static void
 tps65217pmic_envsys_register(struct tps65217pmic_softc *sc)
 {



CVS commit: src/sys/dev/i2c

2014-01-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan  8 16:49:48 UTC 2014

Modified Files:
src/sys/dev/i2c: tps65217pmic.c

Log Message:
Fix whitespace issues.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/tps65217pmic.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/i2c/tps65217pmic.c
diff -u src/sys/dev/i2c/tps65217pmic.c:1.8 src/sys/dev/i2c/tps65217pmic.c:1.9
--- src/sys/dev/i2c/tps65217pmic.c:1.8	Wed Jan  8 16:45:14 2014
+++ src/sys/dev/i2c/tps65217pmic.c	Wed Jan  8 16:49:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tps65217pmic.c,v 1.8 2014/01/08 16:45:14 jakllsch Exp $ */
+/*	$NetBSD: tps65217pmic.c,v 1.9 2014/01/08 16:49:48 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tps65217pmic.c,v 1.8 2014/01/08 16:45:14 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: tps65217pmic.c,v 1.9 2014/01/08 16:49:48 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, $NetBSD: tps65217pmic
 #include dev/i2c/tps65217pmicreg.h
 
 #define NTPS_REG	7
-#define SNUM_REGS	NTPS_REG-1	
+#define SNUM_REGS	NTPS_REG-1
 #define SNUM_USBSTATUS	NTPS_REG
 #define SNUM_ACSTATUS	NTPS_REG+1
 
@@ -340,7 +340,7 @@ tps65217pmic_power_monitor_init(struct t
 {
 	uint8_t intr, intrmask, status, ppath;
 
-	intrmask = TPS65217PMIC_INT_USBM | TPS65217PMIC_INT_ACM | 
+	intrmask = TPS65217PMIC_INT_USBM | TPS65217PMIC_INT_ACM |
 	TPS65217PMIC_INT_PBM;
 
 	status = tps65217pmic_reg_read(sc, TPS65217PMIC_STATUS);
@@ -354,7 +354,7 @@ tps65217pmic_power_monitor_init(struct t
 	sc-sc_acenabled = ppath  TPS65217PMIC_PPATH_AC_EN;
 
 	if (intr  intrmask)
-		aprint_normal_dev(sc-sc_dev, 
+		aprint_normal_dev(sc-sc_dev,
 		WARNING: hardware interrupt enabled but not supported);
 
 	/* set up callout to poll for power source changes */
@@ -383,10 +383,10 @@ tps65217pmic_power_monitor(void *aux)
 		sc-sc_usbstatus = usbstatus;
 		pmf_event_inject(NULL, PMFE_POWER_CHANGED);
 		if (usbstatus)
-			aprint_normal_dev(sc-sc_dev, 
+			aprint_normal_dev(sc-sc_dev,
 			USB power source connected\n);
 		else
-			aprint_normal_dev(sc-sc_dev, 
+			aprint_normal_dev(sc-sc_dev,
 			USB power source disconnected\n);
 	}
 
@@ -394,10 +394,10 @@ tps65217pmic_power_monitor(void *aux)
 		sc-sc_acstatus = acstatus;
 		pmf_event_inject(NULL, PMFE_POWER_CHANGED);
 		if (acstatus) {
-			sysmon_pswitch_event(sc-sc_smpsw, 
+			sysmon_pswitch_event(sc-sc_smpsw,
 			PSWITCH_EVENT_PRESSED);
 		} else {
-			sysmon_pswitch_event(sc-sc_smpsw, 
+			sysmon_pswitch_event(sc-sc_smpsw,
 			PSWITCH_EVENT_RELEASED);
 		}
 	}
@@ -655,16 +655,16 @@ tps65217pmic_envsys_register(struct tps6
 	/* attach power source indicators */
 	strcpy(sc-sc_usbsensor.desc, USB power source); /* SNUM_USBSTATUS */
 	sc-sc_usbsensor.units = ENVSYS_INDICATOR;
-	sc-sc_usbsensor.state = ENVSYS_SINVALID; 
+	sc-sc_usbsensor.state = ENVSYS_SINVALID;
 	if (sysmon_envsys_sensor_attach(sc-sc_sme, sc-sc_usbsensor))
-		aprint_error_dev(sc-sc_dev, 
+		aprint_error_dev(sc-sc_dev,
 		error attaching USB power source sensor\n);
 	strcpy(sc-sc_acsensor.desc, AC power source); /* SNUM_ACSTATUS */
 	sc-sc_acsensor.units = ENVSYS_INDICATOR;
-	sc-sc_acsensor.state = ENVSYS_SINVALID; 
+	sc-sc_acsensor.state = ENVSYS_SINVALID;
 	if (sysmon_envsys_sensor_attach(sc-sc_sme, sc-sc_acsensor))
-		aprint_error_dev(sc-sc_dev, 
-	 	error attaching AC power source sensor\n);
+		aprint_error_dev(sc-sc_dev,
+		error attaching AC power source sensor\n);
 
 	/* register everything in sysmon */
 	sc-sc_sme-sme_name = device_xname(sc-sc_dev);



CVS commit: src/doc

2014-01-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan  8 20:34:45 UTC 2014

Modified Files:
src/doc: TODO.clang

Log Message:
CMSG_SPACE is no longer an issue.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/doc/TODO.clang

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

Modified files:

Index: src/doc/TODO.clang
diff -u src/doc/TODO.clang:1.4 src/doc/TODO.clang:1.5
--- src/doc/TODO.clang:1.4	Tue Jan 17 15:38:44 2012
+++ src/doc/TODO.clang	Wed Jan  8 20:34:45 2014
@@ -1,4 +1,4 @@
-$NetBSD: TODO.clang,v 1.4 2012/01/17 15:38:44 joerg Exp $
+$NetBSD: TODO.clang,v 1.5 2014/01/08 20:34:45 joerg Exp $
 
 Hacks for the clang integration
 ---
@@ -9,9 +9,3 @@ and slightly different encoding of the l
 
 Various places use NOCLANGERROR or CWARNFLAGS.clang to disable errors or
 warnings.
-
-Issues with CMSG_SPACE() used inside a union:
-src/external/tmux/dist/compat/imsg-buffer.c
-src/external/tmux/dist/compat/imsg.c
-src/external/ibm-public/postfix/dist/src/util/unix_recv_fd.c
-src/external/ibm-public/postfix/dist/src/util/unix_send_fd.c



CVS commit: src/lib/libc/resolv

2014-01-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  8 22:58:50 UTC 2014

Modified Files:
src/lib/libc/resolv: res_init.c

Log Message:
provide a patchable __res_conf_name for testing purposes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/resolv/res_init.c

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

Modified files:

Index: src/lib/libc/resolv/res_init.c
diff -u src/lib/libc/resolv/res_init.c:1.27 src/lib/libc/resolv/res_init.c:1.28
--- src/lib/libc/resolv/res_init.c:1.27	Mon Dec  9 04:35:16 2013
+++ src/lib/libc/resolv/res_init.c	Wed Jan  8 17:58:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: res_init.c,v 1.27 2013/12/09 09:35:16 wiz Exp $	*/
+/*	$NetBSD: res_init.c,v 1.28 2014/01/08 22:58:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1993
@@ -76,7 +76,7 @@
 static const char sccsid[] = @(#)res_init.c	8.1 (Berkeley) 6/7/93;
 static const char rcsid[] = Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp;
 #else
-__RCSID($NetBSD: res_init.c,v 1.27 2013/12/09 09:35:16 wiz Exp $);
+__RCSID($NetBSD: res_init.c,v 1.28 2014/01/08 22:58:50 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -162,6 +162,8 @@ static uint32_t net_mask(struct in_addr)
 static struct timespec __res_conf_time;
 static const struct timespec ts = { 0, 0 };
 
+const char *__res_conf_name = _PATH_RESCONF;
+
 /*
  * Resolver state default settings.
  */
@@ -346,7 +348,7 @@ __res_vinit(res_state statp, int preinit
 	 line[sizeof(name) - 1] == '\t'))
 
 	nserv = 0;
-	if ((fp = fopen(_PATH_RESCONF, re)) != NULL) {
+	if ((fp = fopen(__res_conf_name, re)) != NULL) {
 	struct stat st;
 	struct kevent kc;
 



CVS commit: src/sys/arch

2014-01-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jan  9 00:57:25 UTC 2014

Modified Files:
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/i386/i386: machdep.c

Log Message:
Make the amd64 post-halt-press-a-key code match i386, and introduce
into both a message for the case where cngetc() doesn't work. If
there's no console attached, this won't accomplish anything; but if
there's a screen but no keyboard, or the keyboard's wedged, or
whatever, it might provide useful information.

Suggested back in 2009 by some stuff in PR 37924 and has been hanging
about in one of my trees ever since.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.740 -r1.741 src/sys/arch/i386/i386/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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.200 src/sys/arch/amd64/amd64/machdep.c:1.201
--- src/sys/arch/amd64/amd64/machdep.c:1.200	Sun Dec  1 01:05:16 2013
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Jan  9 00:57:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.200 2013/12/01 01:05:16 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.201 2014/01/09 00:57:25 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.200 2013/12/01 01:05:16 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.201 2014/01/09 00:57:25 dholland Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -728,7 +728,13 @@ haltsys:
 		printf(The operating system has halted.\n);
 		printf(Please press any key to reboot.\n\n);
 		cnpollc(1);	/* for proper keyboard command handling */
-		cngetc();
+		if (cngetc() == 0) {
+			/* no console attached, so just hlt */
+			printf(No keyboard - cannot reboot after all.\n);
+			for(;;) {
+x86_hlt();
+			}
+		}
 		cnpollc(0);
 	}
 

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.740 src/sys/arch/i386/i386/machdep.c:1.741
--- src/sys/arch/i386/i386/machdep.c:1.740	Sun Dec  8 20:45:30 2013
+++ src/sys/arch/i386/i386/machdep.c	Thu Jan  9 00:57:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 dsl Exp $	*/
+/*	$NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.740 2013/12/08 20:45:30 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.741 2014/01/09 00:57:25 dholland Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -842,6 +842,7 @@ haltsys:
 		cnpollc(1);	/* for proper keyboard command handling */
 		if (cngetc() == 0) {
 			/* no console attached, so just hlt */
+			printf(No keyboard - cannot reboot after all.\n);
 			for(;;) {
 x86_hlt();
 			}



CVS commit: src/tests/lib/libc/net

2014-01-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan  9 02:18:10 UTC 2014

Modified Files:
src/tests/lib/libc/net: Makefile h_dns_server.c h_hostent.c
t_hostent.sh
Added Files:
src/tests/lib/libc/net: resolv.conf

Log Message:
Use our own resolv.conf file simplifying the test to not need rump_vfs.
Add debugging on the dns server
One test fails (gethostbyaddr6) why? It runs without rump


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/net/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/h_dns_server.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/h_hostent.c
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/net/resolv.conf
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/net/t_hostent.sh

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

Modified files:

Index: src/tests/lib/libc/net/Makefile
diff -u src/tests/lib/libc/net/Makefile:1.9 src/tests/lib/libc/net/Makefile:1.10
--- src/tests/lib/libc/net/Makefile:1.9	Mon Jan  6 09:50:32 2014
+++ src/tests/lib/libc/net/Makefile	Wed Jan  8 21:18:10 2014
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.9 2014/01/06 14:50:32 gson Exp $
+# $NetBSD: Makefile,v 1.10 2014/01/09 02:18:10 christos Exp $
 
 .include bsd.own.mk
 
 MKMAN=	no
 
 TESTS_SUBDIRS+=	getaddrinfo
-FILES+=hosts
+FILES+=hosts resolv.conf
 
 TESTSDIR=	${TESTSBASE}/lib/libc/net
 

Index: src/tests/lib/libc/net/h_dns_server.c
diff -u src/tests/lib/libc/net/h_dns_server.c:1.2 src/tests/lib/libc/net/h_dns_server.c:1.3
--- src/tests/lib/libc/net/h_dns_server.c:1.2	Mon Jan  6 11:42:57 2014
+++ src/tests/lib/libc/net/h_dns_server.c	Wed Jan  8 21:18:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $	*/
+/*	$NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $);
+__RCSID($NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $);
 
 #include ctype.h
 #include err.h
@@ -58,6 +58,12 @@ union sockaddr_either {
 	struct sockaddr_in6 sin6;
 };
 
+#ifdef DEBUG
+#define DPRINTF(...)	fprintf(stderr, __VA_ARGS__)
+#else
+#define DPRINTF(...)	
+#endif
+
 /* A DNS question and its corresponding answer */
 
 struct dns_data {
@@ -131,6 +137,34 @@ name_eq(const unsigned char *a, const un
 	}
 }
 
+#ifdef DEBUG
+static char *
+name2str(const void *v, char *buf, size_t buflen) {
+	const unsigned char *a = v;
+	char *b = buf;
+	char *eb = buf + buflen;
+
+#define ADDC(c) do { \
+		if (b  eb) \
+			*b++ = c; \
+		else \
+			return NULL; \
+	} while (/*CONSTCOND*/0)
+	for (int did = 0;; did++) {
+		int lena = *a++;
+		if (lena == 0) {
+			ADDC('\0');
+			return buf;
+		}
+		if (did)
+			ADDC('.');
+		for (int i = 0; i  lena; i++)
+			ADDC(a[i]);
+		a += lena;
+	}
+}
+#endif
+
 /* XXX the daemon2_* functions should be in a library */
 
 int __daemon2_detach_pipe[2];
@@ -237,6 +271,9 @@ int main(int argc, char **argv) {
 	char pidfile_name[40];
 	FILE *f;
 	int one = 1;
+#ifdef DEBUG
+	char buf1[1024], buf2[1024];
+#endif
 
 	daemon2_fork();
 
@@ -276,7 +313,11 @@ int main(int argc, char **argv) {
 	f = fopen(pidfile_name, w);
 	fprintf(f, %d, getpid());
 	fclose(f);
+#ifdef DEBUG
+	daemon2_detach(0, 1);
+#else
 	daemon2_detach(0, 0);
+#endif
 
 	for (;;) {
 		unsigned char buf[512];
@@ -289,28 +330,47 @@ int main(int argc, char **argv) {
 		nrecv = recvfrom(s, buf, sizeof buf, 0, from.s, fromlen);
 		if (nrecv  0)
 			err(1, recvfrom);
-		if (nrecv  12)
-			continue; /* Too short */
-		if ((buf[2]  0x80) != 0)
-			continue; /* Not a query */
-		if (!(buf[4] == 0  buf[5] == 1))
-		continue; /* QDCOUNT is not 1 */
+		if (nrecv  12) {
+			DPRINTF(Too short %zd\n, nrecv);
+			continue;
+		}
+		if ((buf[2]  0x80) != 0) {
+			DPRINTF(Not a query 0x%x\n, buf[2]);
+			continue;
+		}
+		if (!(buf[4] == 0  buf[5] == 1)) {
+			DPRINTF(QCOUNT is not 1 0x%x 0x%x\n, buf[4], buf[5]);
+			continue; /* QDCOUNT is not 1 */
+		}
 
 		for (dp = data; dp-qname_size != 0; dp++) {
 			int qtype, qclass;
 			p = buf + 12; /* Point to QNAME */
 			int n = name_eq(p, (const unsigned char *) dp-qname);
-			if (n == 0)
+			if (n == 0) {
+DPRINTF(no match name %s != %s\n,
+name2str(p, buf1, sizeof(buf1)),
+name2str(dp-qname, buf2, sizeof(buf2)));
 continue; /* Name does not match */
+			}
+			DPRINTF(match name %s\n,
+			name2str(p, buf1, sizeof(buf1)));
 			p += n; /* Skip QNAME */
 			qtype = *p++  8;
 			qtype |= *p++;
-			if (qtype != dp-qtype)
+			if (qtype != dp-qtype) {
+DPRINTF(no match name 0x%x != 0x%x\n,
+qtype, dp-qtype);
 continue;
+			}
+			DPRINTF(match type 0x%x\n, qtype);
 			qclass = *p++  8;
 			qclass |= *p++;
-			if (qclass != 1) /* IN */
+			if (qclass != 1) { /* IN */
+DPRINTF(no match class %d != 1\n, qclass);
 continue;
+	

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

2014-01-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan  9 02:18:55 UTC 2014

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

Log Message:
add new resolv.conf file


To generate a diff of this commit:
cvs rdiff -u -r1.555 -r1.556 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.555 src/distrib/sets/lists/tests/mi:1.556
--- src/distrib/sets/lists/tests/mi:1.555	Tue Jan  7 11:47:13 2014
+++ src/distrib/sets/lists/tests/mi	Wed Jan  8 21:18:55 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.555 2014/01/07 16:47:13 gson Exp $
+# $NetBSD: mi,v 1.556 2014/01/09 02:18:55 christos Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -1983,7 +1983,8 @@
 ./usr/tests/lib/libc/net/h_nsd_recurse		tests-lib-tests	atf
 ./usr/tests/lib/libc/net/h_protoent		tests-lib-tests		atf
 ./usr/tests/lib/libc/net/h_servent		tests-lib-tests		atf
-./usr/tests/lib/libc/net/hosts		tests-lib-tests	atf
+./usr/tests/lib/libc/net/hosts			tests-lib-tests	atf
+./usr/tests/lib/libc/net/resolv.conf		tests-lib-tests	atf
 ./usr/tests/lib/libc/net/t_ether_aton		tests-lib-tests		atf
 ./usr/tests/lib/libc/net/t_getprotoent		tests-lib-tests		atf
 ./usr/tests/lib/libc/net/t_hostent		tests-lib-tests		atf