CVS commit: src/crypto/external/bsd/libsaslc/dist/man

2011-03-22 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar 22 07:06:02 UTC 2011

Modified Files:
src/crypto/external/bsd/libsaslc/dist/man: libsaslc.3

Log Message:
* Remove saslc_strmech(), which does not appear in the sources.
  Instead, document saslc_sess_getmech().

* Add FUNCTIONS and describe the functions in a list for readability.

* Sort SYNOPSIS in the order of appearance in FUNCTIONS.

* Split couple of long paragraphs for readability.

* Split the code example into EXAMPLES.

* Add missing prototypes to SYNOPSIS.

* Small markup improvements.

No contextual change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3

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

Modified files:

Index: src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3
diff -u src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.10 src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.11
--- src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.10	Sun Feb 20 01:59:46 2011
+++ src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3	Tue Mar 22 07:06:02 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: libsaslc.3,v 1.10 2011/02/20 01:59:46 christos Exp $
+.\	$NetBSD: libsaslc.3,v 1.11 2011/03/22 07:06:02 jruoho Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -34,21 +34,21 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 18, 2011
+.Dd March 22, 2011
 .Dt LIBSASLC 3
 .Os
 .Sh NAME
 .Nm saslc_alloc ,
 .Nm saslc_end ,
 .Nm saslc_init ,
+.Nm saslc_sess_init ,
+.Nm saslc_sess_end ,
+.Nm saslc_sess_getprop ,
+.Nm saslc_sess_setprop ,
 .Nm saslc_sess_cont ,
 .Nm saslc_sess_decode ,
 .Nm saslc_sess_encode ,
-.Nm saslc_sess_end ,
 .Nm saslc_sess_getmech ,
-.Nm saslc_sess_getprop ,
-.Nm saslc_sess_init ,
-.Nm saslc_sess_setprop ,
 .Nm saslc_sess_strerror ,
 .Nm saslc_strerror
 .Nd Simple Authentication and Security Layer client library
@@ -62,6 +62,15 @@
 .Fn saslc_end saslc_t *ctx
 .Ft int
 .Fn saslc_init saslc_t *ctx const char *appname const char *cfgpath
+.Ft saslc_sess_t *
+.Fn saslc_sess_init saslc_t *ctx const char *mechs const char *secopts
+.Ft void
+.Fn saslc_sess_end saslc_sess_t *sess
+.Ft const char *
+.Fn saslc_sess_getprop saslc_sess_t *sess const char *key
+.Ft int
+.Fn saslc_sess_setprop saslc_sess_t *sess const char *key \
+const char *value
 .Ft int
 .Fn saslc_sess_cont saslc_sess_t *sess const void *in size_t inlen \
 void* *out size_t *outlen
@@ -71,23 +80,25 @@
 .Ft ssize_t
 .Fn saslc_sess_encode saslc_sess_t *sess const void *in size_t inlen \
 void* *out size_t *outlen
-.Ft void
-.Fn saslc_sess_end saslc_sess_t *sess
 .Ft const char *
 .Fn saslc_sess_getmech saslc_sess_t *sess
 .Ft const char *
-.Fn saslc_sess_getprop saslc_sess_t *sess const char *key
-.Ft saslc_sess_t *
-.Fn saslc_sess_init saslc_t *ctx const char *mechs const char *secopts
-.Ft int
-.Fn saslc_sess_setprop saslc_sess_t *sess const char *key \
-const char *value
-.Ft const char *
 .Fn saslc_sess_strerror saslc_sess_t *sess
 .Ft const char *
 .Fn saslc_strerror saslc_t *ctx
 .Sh DESCRIPTION
 The
+.Nm libsaslc
+library offers a client interface for the
+Simple Authentication and Security Layer
+.Pq Tn SASL .
+The library is heavily influenced by its use with
+.Xr postfix 1 .
+.Sh FUNCTIONS
+The following functions are available in the library.
+.Bl -tag -width compact
+.It Fn saslc_alloc 
+The
 .Fn saslc_alloc
 function allocates and returns a new saslc context.
 The context is uninitialized: see
@@ -95,7 +106,7 @@
 Returns
 .Dv NULL
 on error.
-.Pp
+.It Fn saslc_end ctx
 The
 .Fn saslc_end
 function destroys and deallocate resources used by the context
@@ -103,7 +114,7 @@
 The context shouldn't have any sessions assigned to it.
 Returns 0 on success and \-1 if the context has active sessions and
 cannot be deallocated.
-.Pp
+.It Fn saslc_init ctx appname cfgpath
 The
 .Fn saslc_init
 function initializes the saslc context
@@ -123,7 +134,7 @@
 for a location and if that is not found it uses the default path
 .Pa /etc/saslc.d .
 Returns 0 on success and \-1 on failure.
-.Pp
+.It Fn saslc_sess_init ctx mechs secopts
 The
 .Fn saslc_sess_init
 function creates new session assigned to the
@@ -160,14 +171,14 @@
 Returns a session handle or
 .Dv NULL
 on error or no match.
-.Pp
+.It Fn saslc_sess_end sess
 The
 .Fn saslc_sess_end
 function ends the sasl session
 .Ar sess .
 It destroys and deallocates all internal resources.
 This does not fail.
-.Pp
+.It Fn saslc_sess_getprop sess key
 The
 .Fn saslc_sess_getprop
 function gets the property indicated by the
@@ -180,7 +191,7 @@
 Returns the property value or
 .Dv NULL
 if the property is not found.
-.Pp
+.It Fn saslc_sess_setprop sess key value
 The
 .Fn saslc_sess_setprop
 function sets the property indexed by
@@ -198,28 +209,10 @@
 .Dv NULL ,
 

CVS commit: src/lib/libnpf

2011-03-22 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar 22 07:28:42 UTC 2011

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

Log Message:
* As is customary, append the parameter names from
  SYNOPSIS to the description of the functions.

* Use .Ss for non-standard subtitles.

* Fix two identical subtitles.

* Add missing .It's, fix few .Ft's.

* Use a little more markup.

* Improve offsets.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/lib/libnpf/npf.3:1.3
--- src/lib/libnpf/npf.3:1.2	Wed Feb  2 09:05:01 2011
+++ src/lib/libnpf/npf.3	Tue Mar 22 07:28:41 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: npf.3,v 1.2 2011/02/02 09:05:01 wiz Exp $
+.\	$NetBSD: npf.3,v 1.3 2011/03/22 07:28:41 jruoho Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 2, 2011
+.Dd March 22, 2011
 .Dt NPF 3
 .Os
 .Sh NAME
@@ -76,7 +76,7 @@
 .Fn npf_table_create int index int type
 .Ft int
 .Fn npf_table_add_entry nl_table_t *tl in_addr_t addr in_addr_t mask
-.Fa bool
+.Ft bool
 .Fn npf_table_exists_p nl_config_t *ncf u_int tid
 .Ft int
 .Fn npf_table_insert nl_config_t *ncf nl_table_t *tl
@@ -97,19 +97,23 @@
 tables, procedures, or translation policies.
 The configuration can be submitted to the kernel.
 .\ -
-.Sh CONFIGURATION
+.Sh FUNCTIONS
+.Ss Configuration
 .Bl -tag -width 4n
 .It Fn npf_config_create
 Create a configuration.
-.It Fn npf_config_submit
-Submit configuration to the kernel.
-.It Fn npf_config_destroy
-Destroy the configuration.
+.It Fn npf_config_submit ncf fd
+Submit configuration
+.Fa ncf
+to the kernel.
+.It Fn npf_config_destroy ncf
+Destroy the configuration
+.Fa ncf .
 .El
 .\ ---
-.Sh RULE INTERFACE
+.Ss Rule interface
 .Bl -tag -width 4n
-.It Fn npf_rule_create
+.It Fn npf_rule_create name attr if_idx
 Create a rule with a given name, attribute and priorty.
 Name can be
 .Dv NULL ,
@@ -148,7 +152,7 @@
 .Xr if_nametoindex 3 .
 Zero indicates any interface.
 .\ ---
-.It Fn npf_rule_setcode
+.It Fn npf_rule_setcode rl type code sz
 Assign compiled code for the rule specified by
 .Fa rl ,
 used for filter criteria.
@@ -162,7 +166,7 @@
 .Dv NPF_CODE_NCODE
 should be passed.
 .\ ---
-.It Fn npf_rule_insert
+.It Fn npf_rule_insert ncf parent rl pri
 Insert the rule into the set of parent rule specified by
 .Fa parent .
 If value of
@@ -177,28 +181,28 @@
 A special constant
 .Dv NPF_PRI_NEXT
 may be passed to use the value of last used priority incremented by 1.
-.It npf_rule_setproc
+.It Fn npf_rule_setproc ncf rl name
 Set procedure for the specified rule.
-.It Fn npf_rule_destroy
+.It Fn npf_rule_destroy rl
 Destroy the given rule.
 .El
 .\ -
-.Sh RULE PROCEDURE INTERFACE
+.Ss Rule procedure interface
 .Bl -tag -width 4n
-.It Fn npf_rproc_create
+.It Fn npf_rproc_create name
 Create a rule procedure with a given
 .Fa name .
 Name must be unique for each procedure.
-.It Fn npf_rproc_insert
+.It Fn npf_rproc_insert ncf rp
 Insert rule procedure into the specified configuration.
 .El
 .\ -
-.Sh TRANSLATION INTERFACE
+.Ss Translation interface
 .Bl -tag -width 4n
-.It Fn npf_nat_create
+.It Fn npf_nat_create type flags if_idx addr af port
 Create a NAT translation policy of a specified type.
 There are two types:
-.Bl -tag -width indent
+.Bl -tag -width NPF_NAT_PORTMAP 
 .It Dv NPF_NATIN
 Inbound NAT policy.
 .It Dv NPF_NATOUT
@@ -206,8 +210,10 @@
 .El
 .Pp
 A bi-directional NAT is obtained by combining two policies.
-The following flags are supported:
-.Bl -tag -width indent
+The following
+.Fa flags
+are supported:
+.Bl -tag -width NPF_NAT_PORTMAP 
 .It Dv NPF_NAT_PORTS
 Indicates to perform port translation.
 Otherwise, port translation is not performed and
@@ -232,16 +238,16 @@
 for IPv4 or
 .Dv AF_INET6
 for IPv6 address.
-.It Fn npf_nat_insert
+.It Fn npf_nat_insert ncf nt pri
 Insert NAT policy, its rule, into the specified configuration.
 .El
 .\ -
-.Sh TABLE INTERFACE
+.Ss Table interface
 .Bl -tag -width 4n
-.It Fn npf_table_create
+.It Fn npf_table_create index type
 Create NPF table of specified type.
 The following types are supported:
-.Bl -tag -width indent
+.Bl -tag -width NPF_TABLE_RBTREE 
 .It Dv NPF_TABLE_HASH
 Indicates to use hash table for storage.
 .It Dv NPF_TABLE_RBTREE
@@ -251,14 +257,14 @@
 which should be in the range between 1 and
 .Dv NPF_MAX_TABLE_ID .
 .El
-.It Fn npf_table_add_entry
+.It Fn npf_table_add_entry tl addr mask
 Add an entry of IPv4 address and mask, specified by
 .Fa addr
 and
 .Fa mask ,
 to the table specified by
 .Fa tl .
-.It Fn npf_table_exists_p
+.It Fn npf_table_exists_p ncf name
 Determine whether table with ID
 .Fa tid
 exists in the 

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

2011-03-22 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar 22 07:31:42 UTC 2011

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Use .Ss for non-standard subtitles in the DESCRIPTION.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.4 src/usr.sbin/npf/npfctl/npf.conf.5:1.5
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.4	Wed Feb  2 02:20:25 2011
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Tue Mar 22 07:31:42 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: npf.conf.5,v 1.4 2011/02/02 02:20:25 rmind Exp $
+.\	$NetBSD: npf.conf.5,v 1.5 2011/03/22 07:31:42 jruoho Exp $
 .\
 .\ Copyright (c) 2009-2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 2, 2011
+.Dd March 22, 2011
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -38,13 +38,13 @@
 .Nm
 is the default configuration file for NPF packet filter.
 It can contain definitions, grouped rules, rule procedures, and tables.
-.Sh DEFINITIONS
+.Ss Definitions
 Definitions are general purpose keywords which can be used in the
 ruleset to make it more flexible and easier to manage.
 Most commonly, definitions are used to define one of the following:
 IP addresses, networks, ports, or interfaces.
 Definitions can contain multiple elements.
-.Sh GROUPS
+.Ss Groups
 Having one huge ruleset for all interfaces or directions might be
 inefficient; therefore, NPF requires that all rules be defined within groups.
 Groups can be thought of as higher level rules which have subrules.
@@ -52,7 +52,7 @@
 Packets matching group criteria are passed to the ruleset of that group.
 If a packet does not match any group, it is passed to the default group.
 The default group must always be defined.
-.Sh RULES
+.Ss Rules
 Rules, which are the main part of NPF configuration, describe the criteria
 used to inspect and make decisions about packets.
 Currently, NPF supports filtering on the following criteria: interface,
@@ -80,7 +80,7 @@
 .Pp
 Definitions (prefixed with $) and tables (specified by an ID within
 \*[Lt]\*[Gt] marks) can be used in the filter options of rules.
-.Sh RULE PROCEDURES AND NORMALIZATION
+.Ss Rule procedures and normalization
 Rule procedures are provided to perform packet transformations and various
 additional procedures on the packets.
 It should be noted that rule procedures are applied for the connections,
@@ -94,7 +94,7 @@
 If a matching rule is going to drop the packet, normalization functions
 are not performed.
 Packet logging is performed both in packet passing and blocking cases.
-.Sh NAT
+.Ss Network address translation
 Rules for address translation can be added.
 Translation is performed on the specified interface, assigning the specified
 address of said interface.
@@ -111,7 +111,7 @@
 See
 .Xr sysctl 7
 for more details.
-.Sh TABLES
+.Ss Tables
 Certain configurations might use very large sets of IP addresses or change
 sets frequently.
 Storing large IP sets in the configuration file or performing frequent



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

2011-03-22 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar 22 07:40:10 UTC 2011

Modified Files:
src/usr.sbin/npf/npfctl: npfctl.8

Log Message:
Use 'offset indent' for the list of commands. Emphasize valid commands.
Remove PERFORMANCE (too small paragraph to warrant a section).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfctl/npfctl.8

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npfctl.8
diff -u src/usr.sbin/npf/npfctl/npfctl.8:1.4 src/usr.sbin/npf/npfctl/npfctl.8:1.5
--- src/usr.sbin/npf/npfctl/npfctl.8:1.4	Tue Jan 18 20:33:45 2011
+++ src/usr.sbin/npf/npfctl/npfctl.8	Tue Mar 22 07:40:10 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: npfctl.8,v 1.4 2011/01/18 20:33:45 rmind Exp $
+.\	$NetBSD: npfctl.8,v 1.5 2011/03/22 07:40:10 jruoho Exp $
 .\
 .\ Copyright (c) 2009-2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd January 18, 2011
+.Dd March 22, 2011
 .Dt NPFCTL 8
 .Os
 .Sh NAME
@@ -49,16 +49,16 @@
 .Ar command ,
 specifies the action to take.
 Valid commands are:
-.Bl -tag -width reload
-.It start
+.Bl -tag -width reload -offset 3n
+.It Ic start
 Enable packet inspection using the currently loaded configuration, if any.
 Note that this command does not load or reload the configuration,
 or affect existing sessions.
-.It stop
+.It Ic stop
 Disable packet inspection.
 This command does not change the currently loaded configuration,
 or affect existing sessions.
-.It reload Op Ar path
+.It Ic reload Op Ar path
 Load or reload configuration from file.
 The configuration file at
 .Pa /etc/npf.conf
@@ -70,46 +70,45 @@
 Note that change of filter criteria will not expire associated sessions.
 The reload operation (i.e., replacing the ruleset, NAT policies and tables)
 is atomic.
-.It flush
+.It Ic flush
 Flush configuration.
 That is, remove all rules, tables and expire all sessions.
 This command does not disable packet inspection.
-.It table Ar tid
+.It Ic table Ar tid
 List all entries in the currently loaded table specified by
 .Ar tid .
 Fail if
 .Ar tid
 does not exist.
-.It table Ar tid Aq Ar addr/mask
+.It Ic table Ar tid Aq Ar addr/mask
 Query the table
 .Ar tid
 for a specific IPv4 CIDR, specified by
 .Ar addr/mask .
 If no mask is specified, a single host is assumed.
-.It table Ar tid Ar [ add | rem ] Aq Ar addr/mask
+.It Ic table Ar tid Ar [ add | rem ] Aq Ar addr/mask
 In table
 .Ar tid ,
 add or remove the IPv4 CIDR specified by
 .Aq Ar addr/mask .
-.It sess-save
+.It Ic sess-save
 Save all active sessions.
 The data will be stored in the
 .Pa /var/db/npf_sessions.db
 file.
 Administrator may want to stop the packet inspection before the
 session saving.
-.It sess-load
+.It Ic sess-load
 Load saved sessions from the file.
 Note that original configuration should be loaded before the session loading.
 In a case of NAT policy changes, sessions which lose an associated policy
 will not be loaded.
 Any existing sessions during the load operation will be expired.
 Administrator may want to start packet inspection after the session loading.
-.It stats
+.It Ic stats
 Print various statistics.
 .El
-.\ -
-.Sh PERFORMANCE
+.Pp
 Reloading the configuration is a relatively expensive operation.
 Therefore, frequent reloads should be avoided.
 Use of tables should be considered as an alternative design.



CVS commit: [netbsd-4] src/usr.sbin/nfsd

2011-03-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 22 08:01:38 UTC 2011

Modified Files:
src/usr.sbin/nfsd [netbsd-4]: nfsd.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1414):
usr.sbin/nfsd/nfsd.c: revision 1.57 via patch
PR/42486: Ed Ravin nfsd sometimes exits prematurely during port-scan fix
from freebsd bin 61084 applied (preserving errno properly). The accept
code should be merged.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.49.2.1 src/usr.sbin/nfsd/nfsd.c

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

Modified files:

Index: src/usr.sbin/nfsd/nfsd.c
diff -u src/usr.sbin/nfsd/nfsd.c:1.49 src/usr.sbin/nfsd/nfsd.c:1.49.2.1
--- src/usr.sbin/nfsd/nfsd.c:1.49	Sat Oct  7 17:27:57 2006
+++ src/usr.sbin/nfsd/nfsd.c	Tue Mar 22 08:01:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsd.c,v 1.49 2006/10/07 17:27:57 elad Exp $	*/
+/*	$NetBSD: nfsd.c,v 1.49.2.1 2011/03/22 08:01:38 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = @(#)nfsd.c	8.9 (Berkeley) 3/29/95;
 #else
-__RCSID($NetBSD: nfsd.c,v 1.49 2006/10/07 17:27:57 elad Exp $);
+__RCSID($NetBSD: nfsd.c,v 1.49.2.1 2011/03/22 08:01:38 snj Exp $);
 #endif
 #endif /* not lint */
 
@@ -131,7 +131,7 @@
 #endif
 	struct pollfd set[4];
 	socklen_t len;
-	int ch, cltpflag, connect_type_cnt, i, maxsock, msgsock;
+	int ch, cltpflag, connect_type_cnt, i, maxsock, msgsock, serrno;
 	int nfsdcnt, nfssvc_flag, on = 1, reregister, sock, tcpflag, tcpsock;
 	int tcp6sock, ip6flag;
 	int tp4cnt, tp4flag, tpipcnt, tpipflag, udpflag, ecode, s;
@@ -623,7 +623,10 @@
 			len = sizeof(inetpeer);
 			if ((msgsock = accept(tcpsock,
 			(struct sockaddr *)inetpeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero));
@@ -642,7 +645,10 @@
 			len = sizeof(inet6peer);
 			if ((msgsock = accept(tcp6sock,
 			(struct sockaddr *)inet6peer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,
@@ -661,7 +667,10 @@
 			len = sizeof(isopeer);
 			if ((msgsock = accept(tp4sock,
 			(struct sockaddr *)isopeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,
@@ -679,7 +688,10 @@
 			len = sizeof(inetpeer);
 			if ((msgsock = accept(tpipsock,
 			(struct sockaddr *)inetpeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,



CVS commit: [netbsd-4] src/doc

2011-03-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 22 08:02:50 UTC 2011

Modified Files:
src/doc [netbsd-4]: CHANGES-4.1

Log Message:
Ticket 1414.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.218 -r1.1.2.219 src/doc/CHANGES-4.1

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

Modified files:

Index: src/doc/CHANGES-4.1
diff -u src/doc/CHANGES-4.1:1.1.2.218 src/doc/CHANGES-4.1:1.1.2.219
--- src/doc/CHANGES-4.1:1.1.2.218	Sun Mar 20 20:52:29 2011
+++ src/doc/CHANGES-4.1	Tue Mar 22 08:02:50 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: CHANGES-4.1,v 1.1.2.218 2011/03/20 20:52:29 bouyer Exp $
+#	$NetBSD: CHANGES-4.1,v 1.1.2.219 2011/03/22 08:02:50 snj Exp $
 
 A complete list of changes from the NetBSD 4.0 release to the NetBSD 4.1
 release:
@@ -4399,3 +4399,10 @@
 	Check for number of processes resource violation in execve().
 	[spz, ticket #1421]
 
+usr.sbin/nfsd/nfsd.c1.57 via patch
+
+	PR/42486: Ed Ravin nfsd sometimes exits prematurely during
+	port-scan fix from freebsd bin 61084 applied (preserving errno
+	properly).
+	[bouyer, ticket #1414]
+



CVS commit: src/crypto/external/bsd/libsaslc/dist/man

2011-03-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 22 09:42:00 UTC 2011

Modified Files:
src/crypto/external/bsd/libsaslc/dist/man: libsaslc.3

Log Message:
Sort sections.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3

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

Modified files:

Index: src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3
diff -u src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.11 src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.12
--- src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3:1.11	Tue Mar 22 07:06:02 2011
+++ src/crypto/external/bsd/libsaslc/dist/man/libsaslc.3	Tue Mar 22 09:42:00 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: libsaslc.3,v 1.11 2011/03/22 07:06:02 jruoho Exp $
+.\	$NetBSD: libsaslc.3,v 1.12 2011/03/22 09:42:00 wiz Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -309,84 +309,6 @@
 Neither function will ever return
 .Dv NULL .
 .El
-.Sh EXAMPLES
-The following code fragments illustrate the possible use of the
-functions described above.
-.Bd -literal
-int
-decode_stream(saslc_sess_t *sess, int fdin, int fdout)
-{
-	uint8_t buf[BUFSIZE];
-	uint8_t *in;
-	void *out;
-	size_t inlen, outlen;
-	ssize_t n, rval;
-.Pp
-	for (;;) {
-		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
-			return \-1;
-		if (rval == 0)
-			break;
-		in = buf;
-		inlen = rval;
-		while (inlen  0) {
-			rval = saslc_sess_decode(sess, in, inlen, out,
-			outlen);
-			if (rval == \-1)
-return \-1;
-			if (outlen  0) {
-n = write(fdout, out, outlen);
-free(out);
-if (n == \-1)
-	return \-1;
-			}
-			in += rval;
-			inlen -= rval;
-		}
-	}
-	return 0;
-}
-.Pp
-int
-encode_stream(saslc_sess_t *sess, int fdin, int fdout)
-{
-	uint8_t buf[BUFSIZE];
-	uint8_t *in;
-	void *out;
-	size_t inlen, outlen;
-	ssize_t n, rval;
-.Pp
-	for (;;) {
-		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
-			return \-1;
-		if (rval == 0)
-			break;
-		in = buf;
-		inlen = rval;
-		while (inlen  0) {
-			rval = saslc_sess_encode(sess, in, inlen, out,
-			outlen);
-			if (rval == \-1)
-return \-1;
-			if (outlen  0) {
-n = write(fdout, out, outlen);
-free(out);
-if (n == \-1)
-	return \-1;
-			}
-			in += rval;
-			inlen -= rval;
-		}
-	}
-	/* flush internal encoder buffer */
-	if (saslc_sess_encode(sess, NULL, 0, out, outlen) == \-1)
-		return \-1;
-	if (outlen  0)
-		if (write(fdout, out, outlen) == \-1)
-			return \-1;
-	return 0;
-}
-.Ed
 .Sh CONFIGURATION
 The library uses three types of dictionaries: context (or global),
 session, and mechanism, and they are searched in that order by
@@ -785,6 +707,84 @@
 .Pp
 to obtain a ticket for the postfix user with the postfix credential
 and you should be good to go!
+.Sh EXAMPLES
+The following code fragments illustrate the possible use of the
+functions described above.
+.Bd -literal
+int
+decode_stream(saslc_sess_t *sess, int fdin, int fdout)
+{
+	uint8_t buf[BUFSIZE];
+	uint8_t *in;
+	void *out;
+	size_t inlen, outlen;
+	ssize_t n, rval;
+.Pp
+	for (;;) {
+		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
+			return \-1;
+		if (rval == 0)
+			break;
+		in = buf;
+		inlen = rval;
+		while (inlen  0) {
+			rval = saslc_sess_decode(sess, in, inlen, out,
+			outlen);
+			if (rval == \-1)
+return \-1;
+			if (outlen  0) {
+n = write(fdout, out, outlen);
+free(out);
+if (n == \-1)
+	return \-1;
+			}
+			in += rval;
+			inlen -= rval;
+		}
+	}
+	return 0;
+}
+.Pp
+int
+encode_stream(saslc_sess_t *sess, int fdin, int fdout)
+{
+	uint8_t buf[BUFSIZE];
+	uint8_t *in;
+	void *out;
+	size_t inlen, outlen;
+	ssize_t n, rval;
+.Pp
+	for (;;) {
+		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
+			return \-1;
+		if (rval == 0)
+			break;
+		in = buf;
+		inlen = rval;
+		while (inlen  0) {
+			rval = saslc_sess_encode(sess, in, inlen, out,
+			outlen);
+			if (rval == \-1)
+return \-1;
+			if (outlen  0) {
+n = write(fdout, out, outlen);
+free(out);
+if (n == \-1)
+	return \-1;
+			}
+			in += rval;
+			inlen -= rval;
+		}
+	}
+	/* flush internal encoder buffer */
+	if (saslc_sess_encode(sess, NULL, 0, out, outlen) == \-1)
+		return \-1;
+	if (outlen  0)
+		if (write(fdout, out, outlen) == \-1)
+			return \-1;
+	return 0;
+}
+.Ed
 .Sh COMPATIBILITY
 There exist other SASL client library implementations including Cyrus SASL
 (http://asg.web.cmu.edu/sasl/sasl-library.html) and GNU SASL



CVS commit: src/lib/libc/arch/sparc64

2011-03-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 22 12:24:54 UTC 2011

Modified Files:
src/lib/libc/arch/sparc64: Makefile.inc
Removed Files:
src/lib/libc/arch/sparc64/gen: divrem.m4

Log Message:
Remove the sparc-v7 compatibility wrapper functions (.div, .mul, ... .urem),
the compiler never generates (or did generate in the past) 64bit code to call
them, and they are still present in our 32bit compat library.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/arch/sparc64/Makefile.inc
cvs rdiff -u -r1.4 -r0 src/lib/libc/arch/sparc64/gen/divrem.m4

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

Modified files:

Index: src/lib/libc/arch/sparc64/Makefile.inc
diff -u src/lib/libc/arch/sparc64/Makefile.inc:1.14 src/lib/libc/arch/sparc64/Makefile.inc:1.15
--- src/lib/libc/arch/sparc64/Makefile.inc:1.14	Sun Mar  6 10:32:47 2011
+++ src/lib/libc/arch/sparc64/Makefile.inc	Tue Mar 22 12:24:53 2011
@@ -1,39 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.14 2011/03/06 10:32:47 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2011/03/22 12:24:53 martin Exp $
 
 SRCS+=	__sigaction14_sigtramp.c __sigtramp2.S
 
 # Some assembler files use v9a extensions.
 AFLAGS+= -Wa,-Av9a
 
-# `source' files built from m4 source
-# the name `div.o' is taken for the ANSI C `div' function, hence sdiv here
-SRCS+=	rem.S sdiv.S udiv.S urem.S
-CLEANFILES+=rem.S sdiv.S udiv.S urem.S
-
-sdiv.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
-	@echo 'building ${.TARGET} from ${.ALLSRC}'
-	@(echo define(NAME,\`.div')define(OP,\`div')define(S,\`true'); \
-	 cat ${.ALLSRC}) | ${TOOL_M4}  ${.TARGET}
-	@chmod 444 ${.TARGET}
-
-udiv.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
-	@echo 'building ${.TARGET} from ${.ALLSRC}'
-	@(echo define(NAME,\`.udiv')define(OP,\`div')define(S,\`false'); \
-	 cat ${.ALLSRC}) | ${TOOL_M4}  ${.TARGET}
-	@chmod 444 ${.TARGET}
-
-rem.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
-	@echo 'building ${.TARGET} from ${.ALLSRC}'
-	@(echo define(NAME,\`.rem')define(OP,\`rem')define(S,\`true'); \
-	 cat ${.ALLSRC}) | ${TOOL_M4}  ${.TARGET}
-	@chmod 444 ${.TARGET}
-
-urem.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
-	@echo 'building ${.TARGET} from ${.ALLSRC}'
-	@(echo define(NAME,\`.urem')define(OP,\`rem')define(S,\`false'); \
-	 cat ${.ALLSRC}) | ${TOOL_M4}  ${.TARGET}
-	@chmod 444 ${.TARGET}
-
 .PATH: ${ARCHDIR}/softfloat
 SRCS+= qp.c
 CPPFLAGS+=	-DSOFTFLOATSPARC64_FOR_GCC -DEXCEPTIONS_WITH_SOFTFLOAT



CVS commit: src/doc

2011-03-22 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Mar 22 15:14:43 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
D-Link DSM-G600 support.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1524 src/doc/CHANGES:1.1525
--- src/doc/CHANGES:1.1524	Sun Mar 20 23:19:35 2011
+++ src/doc/CHANGES	Tue Mar 22 15:14:43 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1524 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1525 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -892,3 +892,4 @@
 	mips: add MIPS32R2 and MIPS64R2 support.  [matt 20110314]
 	hppa: add TLS support.  [skrll 20110317]
 	gdtoa: Import the latest [christos 20110319]
+	sandpoint: D-Link DSM-G600 support. [phx 20110319]



CVS commit: src/sys

2011-03-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 22 15:16:23 UTC 2011

Modified Files:
src/sys/kern: subr_pool.c vfs_lookup.c
src/sys/rump/librump/rumpkern: rump.c

Log Message:
pnbuf_cache is used all over the place outside of vfs, so put it
in one place to avoid many definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.233 -r1.234 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.188 src/sys/kern/subr_pool.c:1.189
--- src/sys/kern/subr_pool.c:1.188	Mon Jan 17 07:36:58 2011
+++ src/sys/kern/subr_pool.c	Tue Mar 22 15:16:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.188 2011/01/17 07:36:58 uebayasi Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.189 2011/03/22 15:16:23 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.188 2011/01/17 07:36:58 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.189 2011/03/22 15:16:23 pooka Exp $);
 
 #include opt_ddb.h
 #include opt_pool.h
@@ -182,6 +182,8 @@
 static struct pool cache_pool;
 static struct pool cache_cpu_pool;
 
+pool_cache_t pnbuf_cache;	/* pathname buffer cache */
+
 /* List of all caches. */
 TAILQ_HEAD(,pool_cache) pool_cache_head =
 TAILQ_HEAD_INITIALIZER(pool_cache_head);

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.131 src/sys/kern/vfs_lookup.c:1.132
--- src/sys/kern/vfs_lookup.c:1.131	Tue Jan  4 07:43:42 2011
+++ src/sys/kern/vfs_lookup.c	Tue Mar 22 15:16:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.131 2011/01/04 07:43:42 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.132 2011/03/22 15:16:23 pooka Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.131 2011/01/04 07:43:42 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.132 2011/03/22 15:16:23 pooka Exp $);
 
 #include opt_magiclinks.h
 
@@ -63,8 +63,6 @@
 
 int vfs_magiclinks = MAGICLINKS;
 
-pool_cache_t pnbuf_cache;	/* pathname buffer cache */
-
 /*
  * Substitute replacement text for 'magic' strings in symlinks.
  * Returns 0 if successful, and returns non-zero if an error

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.233 src/sys/rump/librump/rumpkern/rump.c:1.234
--- src/sys/rump/librump/rumpkern/rump.c:1.233	Mon Mar 21 16:41:08 2011
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Mar 22 15:16:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.233 2011/03/21 16:41:08 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.234 2011/03/22 15:16:23 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.233 2011/03/21 16:41:08 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.234 2011/03/22 15:16:23 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -51,6 +51,7 @@
 #include sys/ksyms.h
 #include sys/msgbuf.h
 #include sys/module.h
+#include sys/namei.h
 #include sys/once.h
 #include sys/percpu.h
 #include sys/pipe.h
@@ -125,7 +126,6 @@
 /*
  * Make sure pnbuf_cache is available even without vfs
  */
-struct pool_cache *pnbuf_cache;
 int rump_initpnbufpool(void);
 int rump_initpnbufpool(void)
 {



CVS commit: src/tests/dev/cgd

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 16:16:31 UTC 2011

Modified Files:
src/tests/dev/cgd: t_cgd.sh

Log Message:
Force cleanup parts to exit with a success status.  Failures in cleanup
should not be allowed by atf-run (although they currently are ignored).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/cgd/t_cgd.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/dev/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.7 src/tests/dev/cgd/t_cgd.sh:1.8
--- src/tests/dev/cgd/t_cgd.sh:1.7	Fri Feb  4 19:58:10 2011
+++ src/tests/dev/cgd/t_cgd.sh	Tue Mar 22 16:16:30 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.7 2011/02/04 19:58:10 pooka Exp $
+#	$NetBSD: t_cgd.sh,v 1.8 2011/03/22 16:16:30 jmmv Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -57,7 +57,7 @@
 basic_cleanup()
 {
 
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 atf_test_case wrongpass cleanup
@@ -94,7 +94,7 @@
 wrongpass_cleanup()
 {
 
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 
@@ -122,7 +122,7 @@
 
 non512_cleanup()
 {
-	env RUMP_SERVER=unix://csock rump.halt
+	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
 atf_init_test_cases()



CVS commit: src/tests/fs/common

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 16:50:16 UTC 2011

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Remove unnecessary (and broken) cleanup routines.

The cleanup routines were being used to kill the rump process and to delete
the temporary image file.  These are things automatically done by atf-run,
but it looks like this code was added here to workaround a previous bug in
the atf-run code.

Note that, in the existing form, the cleanup routines segfault (haven't
spent the time to track down why).  atf-run does not care about this
(although it should), buy Kyua does.

As a side effect, this has a teeny-tiny performance speedup in the execution
of the tests including this file.

OKed by njoly@.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.33 src/tests/fs/common/h_fsmacros.h:1.34
--- src/tests/fs/common/h_fsmacros.h:1.33	Sat Mar  5 20:56:28 2011
+++ src/tests/fs/common/h_fsmacros.h	Tue Mar 22 16:50:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.33 2011/03/05 20:56:28 pooka Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.34 2011/03/22 16:50:16 jmmv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 } while (/*CONSTCOND*/0);
 
 #define ATF_TC_FSADD(fs,type,func,desc)	\
-	ATF_TC_WITH_CLEANUP(fs##_##func);\
+	ATF_TC(fs##_##func);		\
 	ATF_TC_HEAD(fs##_##func,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr, type  test for  desc);	\
@@ -120,18 +120,10 @@
 			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
 			atf_tc_fail_errno(unmount failed);		\
 		}			\
-	}\
-	\
-	ATF_TC_CLEANUP(fs##_##func,tc)	\
-	{\
-		if (!atf_check_fstype(tc, #fs))\
-			return;		\
-		if (fs##_fstest_delfs(tc, fs##func##tmp) != 0)		\
-			atf_tc_fail_errno(delfs failed);		\
 	}
 
 #define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_)		\
-	ATF_TC_WITH_CLEANUP(_fs_##_##_func_);\
+	ATF_TC(_fs_##_##_func_);	\
 	ATF_TC_HEAD(_fs_##_##_func_,tc)	\
 	{\
 		atf_tc_set_md_var(tc, descr,_type_ test for _desc_);\
@@ -156,14 +148,6 @@
 			rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1);	\
 			atf_tc_fail_errno(unmount failed);		\
 		}			\
-	}\
-	\
-	ATF_TC_CLEANUP(_fs_##_##_func_,tc)\
-	{\
-		if (!atf_check_fstype(tc, #_fs_))			\
-			return;		\
-		if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0)	\
-			atf_tc_fail_errno(delfs failed);		\
 	}
 
 #define ATF_TP_FSADD(fs,func)		\



CVS commit: src/tests/lib/librumphijack

2011-03-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 22 17:07:11 UTC 2011

Modified Files:
src/tests/lib/librumphijack: t_tcpip.sh

Log Message:
check that nfsd works with kernel module autoloading


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/librumphijack/t_tcpip.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/librumphijack/t_tcpip.sh
diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.7 src/tests/lib/librumphijack/t_tcpip.sh:1.8
--- src/tests/lib/librumphijack/t_tcpip.sh:1.7	Thu Mar 10 13:42:33 2011
+++ src/tests/lib/librumphijack/t_tcpip.sh	Tue Mar 22 17:07:11 2011
@@ -1,4 +1,4 @@
-#   $NetBSD: t_tcpip.sh,v 1.7 2011/03/10 13:42:33 pooka Exp $
+#   $NetBSD: t_tcpip.sh,v 1.8 2011/03/22 17:07:11 pooka Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -146,14 +146,7 @@
 	# sshd dies due to RUMPHIJACK_RETRYCONNECT=1d6
 }
 
-
-atf_test_case nfs cleanup
-nfs_head()
-{
-atf_set descr Test hijacked nfsd and mount_nfs
-}
-
-nfs_body()
+test_nfs()
 {
 
 	magicstr='wind in my hair'
@@ -162,11 +155,7 @@
 
 	# start nfs kernel server.  this is a mouthful
 	export RUMP_SERVER=unix://serversock
-	atf_check -s exit:0 rump_server -lrumpvfs -lrumpdev -lrumpnet	\
-	-lrumpnet_net -lrumpnet_netinet -lrumpnet_local		\
-	-lrumpnet_shmif -lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs	\
-	-lrumpfs_nfsserver		\
-	-d key=/dk,hostpath=ffs.img,size=host ${RUMP_SERVER}
+	atf_check -s exit:0 rump_server $* ${RUMP_SERVER}
 
 	atf_check -s exit:0 rump.ifconfig shmif0 create
 	atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
@@ -223,20 +212,54 @@
 	atf_check -s exit:0 mount_nfs 10.1.1.1:/export /rump/mnt
 
 	atf_check -s exit:0 -o inline:${magicstr}\n cat /rump/mnt/im_alive
+	atf_check -s exit:0 -o match:'.*im_alive$' ls -l /rump/mnt/im_alive
 }
 
-nfs_cleanup()
+
+atf_test_case nfs cleanup
+nfs_head()
+{
+atf_set descr Test hijacked nfsd and mount_nfs
+}
+
+nfs_body()
 {
+	test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net		\
+	-lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif		\
+	-lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs -lrumpfs_nfsserver	\
+	-d key=/dk,hostpath=ffs.img,size=host
+}
 
+nfs_cleanup()
+{
 	RUMP_SERVER=unix://serversock rump.halt 2 /dev/null
 	RUMP_SERVER=unix://clientsock rump.halt 2 /dev/null
 	:
 }
 
+atf_test_case nfs_autoload cleanup
+nfs_autoload_head()
+{
+atf_set descr Test hijacked nfsd with autoload from /stand
+}
+
+nfs_autoload_body()
+{
+	[ `uname -m` = i386 ] || atf_skip test currently valid only on i386
+	test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net		\
+	-lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif		\
+	-lrumpdev_disk -d key=/dk,hostpath=ffs.img,size=host
+}
+
+nfs_autoload_cleanup()
+{
+	nfs_cleanup
+}
 
 atf_init_test_cases()
 {
 	atf_add_test_case http
 	atf_add_test_case ssh
 	atf_add_test_case nfs
+	atf_add_test_case nfs_autoload
 }



CVS commit: [netbsd-5-0] src/sys/net

2011-03-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 22 20:02:36 UTC 2011

Modified Files:
src/sys/net [netbsd-5-0]: bpf_filter.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1571):
sys/net/bpf_filter.c: revision 1.36, 1.42 - 1.46 via patch
Avoid stack memory disclosure by keeping track during filter validation time
of initialized memory. Idea taken from linux.
Use __CTASSERT
Use kmem instead of malloc. Requested by rmind.
Fix userland build.
delint.
the correct check for BPF_K is with BPF_SRC for BPF_ALU ops, from
Guy Harris per PR kern/43185
fixes possible division-by-zero crashes by evil filter expressions
like len / 0 = 1
pullup candidate


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/net/bpf_filter.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/net/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.35 src/sys/net/bpf_filter.c:1.35.10.1
--- src/sys/net/bpf_filter.c:1.35	Wed Aug 20 13:01:54 2008
+++ src/sys/net/bpf_filter.c	Tue Mar 22 20:02:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf_filter.c,v 1.35 2008/08/20 13:01:54 joerg Exp $	*/
+/*	$NetBSD: bpf_filter.c,v 1.35.10.1 2011/03/22 20:02:36 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.35 2008/08/20 13:01:54 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.35.10.1 2011/03/22 20:02:36 bouyer Exp $);
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -48,6 +48,7 @@
 
 #include sys/param.h
 #include sys/time.h
+#include sys/kmem.h
 #include sys/endian.h
 
 #define EXTRACT_SHORT(p)	be16dec(p)
@@ -147,8 +148,7 @@
 	A = 0;
 	X = 0;
 	--pc;
-	/* CONSTCOND */
-	while (1) {
+	for (;;) {
 		++pc;
 		switch (pc-code) {
 
@@ -157,6 +157,7 @@
 			return 0;
 #else
 			abort();
+			/*NOTREACHED*/
 #endif
 		case BPF_RET|BPF_K:
 			return (u_int)pc-k;
@@ -461,16 +462,38 @@
  * The kernel needs to be able to verify an application's filter code.
  * Otherwise, a bogus program could easily crash the system.
  */
+CTASSERT(BPF_MEMWORDS == sizeof(uint16_t) * NBBY);
+
 int
-bpf_validate(struct bpf_insn *f, int len)
+bpf_validate(struct bpf_insn *f, int signed_len)
 {
-	u_int i, from;
-	struct bpf_insn *p;
+	u_int i, from, len, ok = 0;
+	const struct bpf_insn *p;
+#if defined(KERNEL) || defined(_KERNEL)
+	uint16_t *mem, invalid;
+	size_t size;
+#endif
 
-	if (len  1 || len  BPF_MAXINSNS)
+	len = (u_int)signed_len;
+	if (len  1)
+		return 0;
+#if defined(KERNEL) || defined(_KERNEL)
+	if (len  BPF_MAXINSNS)
+		return 0;
+#endif 
+	if (BPF_CLASS(f[len - 1].code) != BPF_RET)
 		return 0;
 
+#if defined(KERNEL) || defined(_KERNEL)
+	mem = kmem_zalloc(size = sizeof(*mem) * len, KM_SLEEP);
+	invalid = ~0;   /* All is invalid on startup */
+#endif
+
 	for (i = 0; i  len; ++i) {
+#if defined(KERNEL) || defined(_KERNEL)
+		/* blend in any invalid bits for current pc */
+		invalid |= mem[i];
+#endif
 		p = f[i];
 		switch (BPF_CLASS(p-code)) {
 		/*
@@ -480,8 +503,22 @@
 		case BPF_LDX:
 			switch (BPF_MODE(p-code)) {
 			case BPF_MEM:
+/*
+ * There's no maximum packet data size
+ * in userland.  The runtime packet length
+ * check suffices.
+ */
+#if defined(KERNEL) || defined(_KERNEL)
+/*
+ * More strict check with actual packet length
+ * is done runtime.
+ */
 if (p-k = BPF_MEMWORDS)
-	return 0;
+	goto out;
+/* check for current memory invalid */
+if (invalid  (1  p-k))
+	goto out;
+#endif
 break;
 			case BPF_ABS:
 			case BPF_IND:
@@ -490,13 +527,17 @@
 			case BPF_LEN:
 break;
 			default:
-return 0;
+goto out;
 			}
 			break;
 		case BPF_ST:
 		case BPF_STX:
 			if (p-k = BPF_MEMWORDS)
-return 0;
+goto out;
+#if defined(KERNEL) || defined(_KERNEL)
+			/* validate the memory word */
+			invalid = ~(1  p-k);
+#endif
 			break;
 		case BPF_ALU:
 			switch (BPF_OP(p-code)) {
@@ -513,11 +554,11 @@
 /*
  * Check for constant division by 0.
  */
-if (BPF_RVAL(p-code) == BPF_K  p-k == 0)
-	return 0;
+if (BPF_SRC(p-code) == BPF_K  p-k == 0)
+	goto out;
 break;
 			default:
-return 0;
+goto out;
 			}
 			break;
 		case BPF_JMP:
@@ -540,18 +581,37 @@
 			from = i + 1;
 			switch (BPF_OP(p-code)) {
 			case BPF_JA:
-if (from + p-k  from || from + p-k = len)
-	return 0;
+if (from + p-k = len)
+	goto out;
+#if defined(KERNEL) || defined(_KERNEL)
+if (from + p-k  from)
+	goto out;
+/*
+ * mark the currently invalid bits for the
+ * destination
+ */
+mem[from + p-k] |= invalid;
+invalid = 0;
+#endif
 break;
 			case BPF_JEQ:
 			case BPF_JGT:
 			case BPF_JGE:
 			case BPF_JSET:
 if (from + p-jt = len || from + p-jf = len) 
-	return 0;
+	goto out;
+#if defined(KERNEL) || 

CVS commit: [netbsd-5-0] src/doc

2011-03-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 22 20:03:05 UTC 2011

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
ticket 1571


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-5.0.3

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

Modified files:

Index: src/doc/CHANGES-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.30 src/doc/CHANGES-5.0.3:1.1.2.31
--- src/doc/CHANGES-5.0.3:1.1.2.30	Sun Mar 20 21:33:41 2011
+++ src/doc/CHANGES-5.0.3	Tue Mar 22 20:03:04 2011
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.30 2011/03/20 21:33:41 bouyer Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.31 2011/03/22 20:03:04 bouyer Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -2602,3 +2602,13 @@
 	Reported by Maksymilian Arciemowicz
 	[spz, ticket #1574]
 
+sys/net/bpf_filter.c1.36, 1.42 - 1.46 via patch
+
+	Avoid stack memory disclosure by keeping track during filter
+	validation time of initialized memory. Idea taken from linux.
+	the correct check for BPF_K is with BPF_SRC for BPF_ALU ops, from
+	Guy Harris per PR kern/43185
+	fixes possible division-by-zero crashes by evil filter expressions
+	like len / 0 = 1
+	[spz, ticket #1571]
+



CVS commit: src/sys/fs/msdosfs

2011-03-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Mar 22 20:33:51 UTC 2011

Modified Files:
src/sys/fs/msdosfs: msdosfs_denode.c

Log Message:
When truncating a file purge the fat cache after setting the new size
and after all io but before actually updating the cluster chain.

Both uvm_vnp_zerorange() and vtruncbuf() call get/putpages - bmap - pcbmap
and here the fat cache gets updated with information no longer valid after
truncation.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/fs/msdosfs/msdosfs_denode.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/msdosfs/msdosfs_denode.c
diff -u src/sys/fs/msdosfs/msdosfs_denode.c:1.41 src/sys/fs/msdosfs/msdosfs_denode.c:1.42
--- src/sys/fs/msdosfs/msdosfs_denode.c:1.41	Sun Mar 20 12:21:28 2011
+++ src/sys/fs/msdosfs/msdosfs_denode.c	Tue Mar 22 20:33:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_denode.c,v 1.41 2011/03/20 12:21:28 hannken Exp $	*/
+/*	$NetBSD: msdosfs_denode.c,v 1.42 2011/03/22 20:33:51 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.41 2011/03/20 12:21:28 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.42 2011/03/22 20:33:51 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -461,8 +461,6 @@
 		}
 	}
 
-	fc_purge(dep, lastblock + 1);
-
 	/*
 	 * If the new length is not a multiple of the cluster size then we
 	 * must zero the tail end of the new last cluster in case it
@@ -506,6 +504,8 @@
 	   allerror, eofentry);
 #endif
 
+	fc_purge(dep, lastblock + 1);
+
 	/*
 	 * If we need to break the cluster chain for the file then do it
 	 * now.



CVS commit: src/share/man/man8

2011-03-22 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Mar 22 22:17:44 UTC 2011

Modified Files:
src/share/man/man8: MAKEDEV.8

Log Message:
Regen to catch up divers changes.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man8/MAKEDEV.8

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

Modified files:

Index: src/share/man/man8/MAKEDEV.8
diff -u src/share/man/man8/MAKEDEV.8:1.38 src/share/man/man8/MAKEDEV.8:1.39
--- src/share/man/man8/MAKEDEV.8:1.38	Tue Mar 23 19:22:41 2010
+++ src/share/man/man8/MAKEDEV.8	Tue Mar 22 22:17:44 2011
@@ -6,7 +6,7 @@
 .\ *** DO NOT EDIT - any changes will be lost!!!
 .\ *** --
 .\
-.\ $NetBSD: MAKEDEV.8,v 1.38 2010/03/23 19:22:41 jakllsch Exp $
+.\ $NetBSD: MAKEDEV.8,v 1.39 2011/03/22 22:17:44 njoly Exp $
 .\
 .\ Copyright (c) 2001, 2003, 2007, 2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -35,7 +35,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd March 23, 2010
+.Dd March 22, 2011
 .Dt MAKEDEV 8
 .Os
 .Sh NAME
@@ -352,7 +352,8 @@
 ``file'' pseudo-disks, see
 .Xr \vnd 4
 . It Ar xbd#
-Xen virtual disks
+Xen virtual disks, see
+.Xr \xbd 4
 . It Ar xd#
 Xylogic 753/7053 disks, see
 .Xr \sparc/xd 4
@@ -411,8 +412,7 @@
 .Xr \cy 4
 . It Ar ttye#
 ITE bitmapped consoles, see
-.Xr \amiga/ite 4 ,
-.Xr \hp300/ite 4
+.Xr \amiga/ite 4
 . It Ar ttyv0
 pccons
 . It Ar ttyC?
@@ -471,6 +471,7 @@
 pccons (arc)
 . It Ar dz#
 UNIBUS DZ11 and DZ32 (vax), see
+.Xr \emips/dz 4 ,
 .Xr \vax/dz 4
 . It Ar dh#
 UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11) (vax), see
@@ -511,6 +512,7 @@
 .Xr \vax/dmz 4
 . It Ar dz#
 UNIBUS DZ11 and DZ32, see
+.Xr \emips/dz 4 ,
 .Xr \vax/dz 4
 . It Ar scc#
 82530 serial interface, see
@@ -724,14 +726,13 @@
 File descriptors
 . It Ar grf#
 Graphics frame buffer device, see
-.Xr \amiga/grf 4 ,
-.Xr \hp300/grf 4
+.Xr \amiga/grf 4
 . It Ar hdaudio#
 High Definition audio control device, see
 .Xr \hdaudio 4
 . It Ar hil
 HP300 HIL input devices, see
-.Xr \hp300/hil 4
+.Xr \hil 4
 . It Ar icp
 ICP-Vortex/Intel RAID control interface, see
 .Xr \icp 4
@@ -752,8 +753,7 @@
 .Xr \irframe 4
 . It Ar ite#
 Terminal emulator interface to HP300 graphics devices, see
-.Xr \amiga/ite 4 ,
-.Xr \hp300/ite 4
+.Xr \amiga/ite 4
 . It Ar joy#
 Joystick device, see
 .Xr \joy 4
@@ -777,6 +777,8 @@
 . It Ar np#
 UNIBUS Ethernet co-processor interface, for downloading., see
 .Xr \vax/np 4
+. It Ar npf
+NPF packet filter
 . It Ar nsmb#
 SMB requester, see
 .Xr \nsmb 4



CVS commit: src/lib/librumpuser

2011-03-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 22 22:27:33 UTC 2011

Modified Files:
src/lib/librumpuser: rumpuser_dl.c

Log Message:
make work on nb5 again


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/librumpuser/rumpuser_dl.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/librumpuser/rumpuser_dl.c
diff -u src/lib/librumpuser/rumpuser_dl.c:1.6 src/lib/librumpuser/rumpuser_dl.c:1.7
--- src/lib/librumpuser/rumpuser_dl.c:1.6	Wed Mar 16 11:44:01 2011
+++ src/lib/librumpuser/rumpuser_dl.c	Tue Mar 22 22:27:33 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_dl.c,v 1.6 2011/03/16 11:44:01 njoly Exp $	*/
+/*  $NetBSD: rumpuser_dl.c,v 1.7 2011/03/22 22:27:33 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: rumpuser_dl.c,v 1.6 2011/03/16 11:44:01 njoly Exp $);
+__RCSID($NetBSD: rumpuser_dl.c,v 1.7 2011/03/22 22:27:33 pooka Exp $);
 
 #include sys/types.h
 #include sys/time.h
@@ -57,6 +57,11 @@
 static char *strtab = NULL;
 static unsigned char eident;
 
+/* nb5 compat */
+#ifndef Elf_Symindx
+#define Elf_Symindx uint32_t
+#endif
+
 static void *
 reservespace(void *store, size_t *storesize,
 	size_t storeoff, size_t required)



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

2011-03-22 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Mar 22 22:29:18 UTC 2011

Modified Files:
src/tests/lib/libc/stdlib: t_strtox.c

Log Message:
Test case from PR/44189 should not fail anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_strtox.c

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

Modified files:

Index: src/tests/lib/libc/stdlib/t_strtox.c
diff -u src/tests/lib/libc/stdlib/t_strtox.c:1.2 src/tests/lib/libc/stdlib/t_strtox.c:1.3
--- src/tests/lib/libc/stdlib/t_strtox.c:1.2	Mon Dec  6 17:30:07 2010
+++ src/tests/lib/libc/stdlib/t_strtox.c	Tue Mar 22 22:29:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtox.c,v 1.2 2010/12/06 17:30:07 pooka Exp $	*/
+/*	$NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 njoly Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_strtox.c,v 1.2 2010/12/06 17:30:07 pooka Exp $);
+__RCSID($NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 njoly Exp $);
 
 #include atf-c.h
 #include stdlib.h
@@ -50,10 +50,8 @@
 	str = -0x0;
 	ATF_REQUIRE(strtod(str, end) == -0.0  end == str+4);
 
-	atf_tc_expect_fail(PR lib/44189);
 	str = -0x;
 	ATF_REQUIRE(strtod(str, end) == -0.0  end == str+2);
-	atf_tc_expect_pass();
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/doc

2011-03-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 22 22:33:10 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
document what i did


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1525 src/doc/CHANGES:1.1526
--- src/doc/CHANGES:1.1525	Tue Mar 22 15:14:43 2011
+++ src/doc/CHANGES	Tue Mar 22 22:33:10 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1525 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1526 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -703,6 +703,7 @@
 	tests(7): Convert the lint1 and libobjc tests to ATF.  [jmmv 20100718]
 	amd64, i386: Intel Firmware Hub Random Number Generator support moved
 		from pchb(4) to fwhrng(4) at ichlpcib(4).  [jakllsch 20100723]
+	tests(7): Add NFS (client and server) to VFS tests [pooka 20100726]
 	i386: Add PAE support. [jym 20100727]
 	hpcarm, hpcmips, hpcsh: Switch to using Xorg servers and binaries.
 		[tsutsui 20100731]
@@ -710,22 +711,33 @@
 		[kiyohara 20100801]
 	tests(7): Convert the sort tests to ATF.  [jmmv 20100801]
 	wpa: New wpa_supplicant and hostapd 0.7.2 [christos 20100804]
+	tests(7): Add elementary tests for the audio subsystem.
+		[pooka 20100804]
 	hpcarm: Improve console speed on W-ZERO3 machines using
 		write through mapping for framebuffer memory.
 		[tsutsui 20100808]
 	bind: Update to 9.7.2b1. [christos 20100806]
+	newfs(8): Add -G parameter to allow creating test images.
+		[pooka 20100809]
+	rump(3): Support carp(4) in the networking stack.  [pooka 20100810]
 	acpicpu(4): Add a driver for ACPI-based processor functionality.
 		[jruoho 20100815]
 	network: Added NPF - a new packet filter. [rmind 20100822]
+	rump(3): Add rumpdev_scsipi.  [pooka 20100823]
+	rump(3): Add a virtual SCSI target used for testing of scsipi(9)
+		and SCSI devices.  [pooka 20100823]
 	tests(7): Convert the libdes tests to ATF.  [jmmv 20100825]
 	awk(1): upgrade to 20100523 [christos 20100826]
 	ntp: switch build to ntp 4.2.6 (imported 20091213 in external/bsd/ntp)
 		[kardel 20100827]
+	rump(3): Support setuid(2), geteuid(2), etc.  [pooka 20100830]
 	dreamcast: Fix a long standing GD-ROM driver bug so that file system
 		on GD-ROM works properly.  The problem is reported and tracked
 		by Yasushi Oshima. [tsutsui 20100831]
 	omapfb: a simple driver for OMAP 3xxx on-chip video, especially the
 		Beagleboard [macallan 20100831]
+	rump_lwproc(3): Add an interface for process/thread management
+		in a rump kernel.  [pooka 20100901]
 	hpcarm: Add an install kernel for JORNADA720 and make sysinst(8)
 		choose a proper default kernel per running installation kernel.
 		[tsutsui 20100904]
@@ -733,6 +745,10 @@
 		year is 2000 or older. To override this behaviour, set
 		acpi_force_load=1 or add options ACPI_BLACKLIST_YEAR=0 to your
 		kernel config. [jmcneill 20100906]
+	rump(3): Significantly improve VM performance for large objects.
+		[pooka 20100907]
+	rump(3): Make the pagedaemon flush VFS objects and drain the
+		kmem/kernel_map in case of memory shortage.  [pooka 20100908]
 	amd64, i386: Enable Ext2fs support in bootloader. [tsutsui 20100911]
 	m68k: Re-enable m68k optimized in_cksum routine.  Makes
 		~5% improvements of ttcp(1) xfer rates. [tsutsui 20100919]
@@ -757,14 +773,20 @@
 		on m68k ports.  [tsutsui 20101014]
 	sun3: Make common module(7) binaries work on both sun3 and sun3x.
 		[tsutsui 20101015]
+	virt(4): Make interface a cloner.  [pooka 20101019]
 	atf(7): Import 0.11.  [jmmv 20101020]
+	rump_sp(7): Initial import of remote rump kernel access
+		protocol.  [pooka 20101027]
 	lua(1): Import of Lua 5.1.4. [mbalmer 20101031]
 	raidframe(4): Support greater than 2TB devices.  [mrg 20101101]
 	xz(1): Import of XZ 5.0.0. [joerg 20101102]
 	otus(4): Port the Atheros AR9001U from OpenBSD (Anon Ymous)
 		[christos 20101103]
+	rumpclient(3): Add a clientside library for remote rump kernel
+		access.  [pooka 20101104]
 	fujitsu(4): Add brightness and hotkey drivers for Fujitsu laptops.
 		[gsutre 20101105]
+	rump_sp(7): Support local domain sockets.  [pooka 20101105]
 	schide(4): Add Intel SCH IDE driver from OpenBSD.
 		[jakllsch 20101106]
 	atf(7): Import 0.12.  [jmmv 20101107]
@@ -772,6 +794,7 @@
 		[skrll 20101109]
 	nside(4): Add a driver for the National Semiconductor PC87415 IDE
 		controller. [skrll 20101110]
+	tests(7): Add basic tests for cgd(4).  [pooka 2010]
 	dreamcast: Switch to using Xorg servers and binaries.
 		[tsutsui 20101112]
 	et(4): Add a driver for Agere/LSI ET1310/ET1301 10/100/Gigabit
@@ -782,14 +805,21 @@
 		[bsh 20101113]
 	evbarm: Add initial support for Sharp NetWalker MID.
 		[bsh 20101113]
+	ifconfig(8): Add the linkstr command which can be used to communicate
+		an arbitrary string with the interface 

CVS commit: src/tests/lib/libutil

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 23:07:32 UTC 2011

Modified Files:
src/tests/lib/libutil: Makefile
Added Files:
src/tests/lib/libutil: t_pidfile.c

Log Message:
Add some tests for pidfile(3).

I want to touch this module to attempt a feature addition but I need some
tests beforehand!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libutil/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libutil/t_pidfile.c

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

Modified files:

Index: src/tests/lib/libutil/Makefile
diff -u src/tests/lib/libutil/Makefile:1.2 src/tests/lib/libutil/Makefile:1.3
--- src/tests/lib/libutil/Makefile:1.2	Mon Dec 20 16:23:01 2010
+++ src/tests/lib/libutil/Makefile	Tue Mar 22 23:07:32 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2010/12/20 16:23:01 njoly Exp $
+# $NetBSD: Makefile,v 1.3 2011/03/22 23:07:32 jmmv Exp $
 
 NOMAN=		# defined
 
@@ -10,6 +10,7 @@
 LDADD+=		-lutil
 
 TESTS_C=	t_parsedate
+TESTS_C+=	t_pidfile
 TESTS_C+=	t_snprintb
 TESTS_C+=	t_sockaddr_snprintf
 

Added files:

Index: src/tests/lib/libutil/t_pidfile.c
diff -u /dev/null src/tests/lib/libutil/t_pidfile.c:1.1
--- /dev/null	Tue Mar 22 23:07:32 2011
+++ src/tests/lib/libutil/t_pidfile.c	Tue Mar 22 23:07:32 2011
@@ -0,0 +1,260 @@
+/* $NetBSD: t_pidfile.c,v 1.1 2011/03/22 23:07:32 jmmv Exp $ */
+
+/*
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This file implements tests for the pidfile(3) functions.
+ *
+ * The tests here are tricky because we need to validate that the atexit(3)
+ * handler registered by pidfile(3) correctly deletes the generated pidfile.
+ * To do so:
+ * 1) We spawn a subprocess in every test case,
+ * 2) Run our test code in such subprocesses.  We cannot call any of the ATF
+ *primitives from inside these.
+ * 3) Wait for the subprocess to terminate and ensure it exited successfully.
+ * 4) Check that the pidfile(s) created in the subprocess are gone.
+ *
+ * Additionally, pidfile(3) hardcodes a path to a directory writable only by
+ * root (/var/run).  This makes us require root privileges to execute these
+ * tests.
+ */
+
+#include sys/cdefs.h
+__COPYRIGHT(@(#) Copyright (c) 2011\
+ The NetBSD Foundation, inc. All rights reserved.);
+__RCSID($NetBSD: t_pidfile.c,v 1.1 2011/03/22 23:07:32 jmmv Exp $);
+
+#include sys/wait.h
+
+#include assert.h
+#include err.h
+#include stdbool.h
+#include stdio.h
+#include stdlib.h
+#include paths.h
+#include unistd.h
+#include util.h
+
+#include atf-c.h
+
+/* Used by routines that can be called both from the parent and the child
+ * code to implement proper error reporting. */
+static bool in_child = false;
+
+/* Callable from the test case child code. */
+static void
+check_pidfile(const char *path)
+{
+	FILE *file;
+	int pid;
+
+	printf(Validating contents of pidfile '%s'\n, path);
+
+	if ((file = fopen(path, r)) == NULL)
+		errx(EXIT_FAILURE, Cannot open expected pidfile '%s', path);
+
+	if (fscanf(file, %d, pid) == -1)
+		errx(EXIT_FAILURE, Failed to read pid from pidfile '%s',
+		path);
+
+	printf(Read pid %d, current pid %d\n, pid, getpid());
+	if (pid != getpid())
+		errx(EXIT_FAILURE, Pid in pidfile (%d) does not match 
+		current pid (%d), pid, getpid());
+}
+
+/* Callable from the test case parent/child code. */
+static void
+ensure_deleted(const char *path)
+{
+	printf(Ensuring pidfile %s does not exist any more\n, path);
+	if (access(path, R_OK) != -1) {
+		unlink(path);
+		if (in_child)
+			errx(EXIT_FAILURE, The pidfile %s was not deleted,
+			

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

2011-03-22 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Mar 22 23:07:50 UTC 2011

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

Log Message:
+tests/lib/libutil/t_pidfile


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 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.272 src/distrib/sets/lists/tests/mi:1.273
--- src/distrib/sets/lists/tests/mi:1.272	Sat Mar 19 06:39:17 2011
+++ src/distrib/sets/lists/tests/mi	Tue Mar 22 23:07:49 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.272 2011/03/19 06:39:17 jruoho Exp $
+# $NetBSD: mi,v 1.273 2011/03/22 23:07:49 jmmv Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -497,6 +497,7 @@
 ./usr/libdata/debug/usr/tests/lib/libskey/t_algorithms.debug		tests-lib-debug		debug,atf,skey
 ./usr/libdata/debug/usr/tests/lib/libutiltests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libutil/t_parsedate.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libutil/t_pidfile.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libutil/t_snprintb.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libutil/t_sockaddr_snprintf.debug	tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/libexec	tests-lib-debug
@@ -1981,6 +1982,7 @@
 ./usr/tests/lib/libutiltests-lib-tests		atf
 ./usr/tests/lib/libutil/Atffile			tests-lib-tests		atf
 ./usr/tests/lib/libutil/t_parsedate		tests-lib-tests		atf
+./usr/tests/lib/libutil/t_pidfile		tests-lib-tests		atf
 ./usr/tests/lib/libutil/t_snprintb		tests-lib-tests		atf
 ./usr/tests/lib/libutil/t_sockaddr_snprintf	tests-lib-tests		atf
 ./usr/tests/libexectests-lib-tests



CVS commit: src/sys

2011-03-22 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Mar 23 00:58:40 UTC 2011

Modified Files:
src/sys/kern: vfs_bio.c
src/sys/ufs/lfs: lfs_segment.c

Log Message:
G/C count_lock_queue (unused for 12 years)


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/kern/vfs_bio.c
cvs rdiff -u -r1.217 -r1.218 src/sys/ufs/lfs/lfs_segment.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.227 src/sys/kern/vfs_bio.c:1.228
--- src/sys/kern/vfs_bio.c:1.227	Mon Jan 17 07:13:32 2011
+++ src/sys/kern/vfs_bio.c	Wed Mar 23 00:58:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.227 2011/01/17 07:13:32 uebayasi Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.228 2011/03/23 00:58:38 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.227 2011/01/17 07:13:32 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.228 2011/03/23 00:58:38 rmind Exp $);
 
 #include opt_bufcache.h
 
@@ -181,7 +181,6 @@
 static void buf_mrelease(void *, size_t);
 static void binsheadfree(buf_t *, struct bqueue *);
 static void binstailfree(buf_t *, struct bqueue *);
-int count_lock_queue(void); /* XXX */
 #ifdef DEBUG
 static int checkfreelist(buf_t *, struct bqueue *, int);
 #endif
@@ -1577,22 +1576,6 @@
 }
 
 /*
- * Return a count of buffers on the locked queue.
- */
-int
-count_lock_queue(void)
-{
-	buf_t *bp;
-	int n = 0;
-
-	mutex_enter(bufcache_lock);
-	TAILQ_FOREACH(bp, bufqueues[BQ_LOCKED].bq_queue, b_freelist)
-		n++;
-	mutex_exit(bufcache_lock);
-	return (n);
-}
-
-/*
  * Wait for all buffers to complete I/O
  * Return the number of stuck buffers.
  */

Index: src/sys/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.217 src/sys/ufs/lfs/lfs_segment.c:1.218
--- src/sys/ufs/lfs/lfs_segment.c:1.217	Wed Jul 21 17:52:13 2010
+++ src/sys/ufs/lfs/lfs_segment.c	Wed Mar 23 00:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.217 2010/07/21 17:52:13 hannken Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.218 2011/03/23 00:58:39 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_segment.c,v 1.217 2010/07/21 17:52:13 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_segment.c,v 1.218 2011/03/23 00:58:39 rmind Exp $);
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -108,7 +108,6 @@
 
 MALLOC_JUSTDEFINE(M_SEGMENT, LFS segment, Segment for LFS);
 
-extern int count_lock_queue(void);
 extern kmutex_t vnode_free_list_lock;		/* XXX */
 
 static void lfs_generic_callback(struct buf *, void (*)(struct buf *));



CVS commit: othersrc/external/bsd/rs

2011-03-22 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 23 03:17:48 UTC 2011

Modified Files:
othersrc/external/bsd/rs/dist: librs.3 main.c rs.c rs.h
othersrc/external/bsd/rs/librs: shlib_version
othersrc/external/bsd/rs/rs: Makefile

Log Message:
+ add code to store the encoding parameters in the generated output
+ use the encoding parameters at decode time
+ add a test for non-standard encoding values
+ update manual page to incorporate some feedback from David Young - more
to come
+ bring manual page up to date
+ bump shlib major number


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/dist/librs.3 \
othersrc/external/bsd/rs/dist/rs.c othersrc/external/bsd/rs/dist/rs.h
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/rs/dist/main.c
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/librs/shlib_version
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/rs/rs/Makefile

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

Modified files:

Index: othersrc/external/bsd/rs/dist/librs.3
diff -u othersrc/external/bsd/rs/dist/librs.3:1.1.1.1 othersrc/external/bsd/rs/dist/librs.3:1.2
--- othersrc/external/bsd/rs/dist/librs.3:1.1.1.1	Sat Mar 12 08:08:29 2011
+++ othersrc/external/bsd/rs/dist/librs.3	Wed Mar 23 03:17:48 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: librs.3,v 1.1.1.1 2011/03/12 08:08:29 agc Exp $
+.\ $NetBSD: librs.3,v 1.2 2011/03/23 03:17:48 agc Exp $
 .\
 .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -23,12 +23,12 @@
 .\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\/
-.Dd March 9, 2011
+.Dd March 22, 2011
 .Dt LIBRS 3
 .Os
 .Sh NAME
 .Nm librs
-.Nd reed-solomon erasure code library
+.Nd Reed-Solomon forward erasure code library
 .Sh LIBRARY
 .Lb librs
 .Sh SYNOPSIS
@@ -46,6 +46,14 @@
 .Fo rs_decode
 .Fa rs_t *rs const void *input size_t insize uint8_t *output size_t outsize
 .Fc
+.Ft ssize_t
+.Fo rs_get_header
+.Fa rs_t *rs void *input size_t size
+.Fc
+.Ft ssize_t
+.Fo rs_put_header
+.Fa rs_t *rs const void *input size_t size
+.Fc
 .Sh DESCRIPTION
 The
 .Nm
@@ -86,6 +94,30 @@
 function, the output will be split up into slices of
 256 bytes, and the final buffer may contain less than
 256 bytes.
+.Pp
+The
+.Fn rs_put_header
+function is used to store information about the encoding in
+the output that is generated. This will allow a future call
+of the
+.Fn rs_decode
+function to know the exact coding parameters in order to reconstruct
+the original data, by using the
+.Fn rs_get_header
+function.
+.Pp
+The output size from the
+.Fn rs_encode 
+function depends on the number of parity bytes, and the number of
+data bytes used.
+In addition, there is an overhead of 12 bytes to hold the
+encoding information.
+For example, a
+.Dv 28,24
+encoding will use 4 parity bytes for every 24 data bytes.
+This means that the output will be at least
+.Dv (((datasize / 6) + 1) * 7) + 12
+bytes long.
 .Sh HISTORY
 The
 .Nm
Index: othersrc/external/bsd/rs/dist/rs.c
diff -u othersrc/external/bsd/rs/dist/rs.c:1.1.1.1 othersrc/external/bsd/rs/dist/rs.c:1.2
--- othersrc/external/bsd/rs/dist/rs.c:1.1.1.1	Sat Mar 12 08:08:29 2011
+++ othersrc/external/bsd/rs/dist/rs.c	Wed Mar 23 03:17:48 2011
@@ -63,6 +63,8 @@
 #define USE_ARG(x)		/*LINTED*/(void)(x)
 #endif
 
+#define RS_MAGIC		rs1
+
 /* set up the gf8 tables */
 static int
 galois_inits(const unsigned poly)
@@ -208,9 +210,9 @@
 	uint8_t	product[MAX_DEGREE * 2];
 	int	i;
 
-	poly_mult(product, rs-lambda, rs-syndrome, rs-parityc * 2);
-	poly_zero(rs-omega, rs-parityc * 2);
-	for (i = 0; i  rs-parityc; i++) {
+	poly_mult(product, rs-lambda, rs-syndrome, rs-header.parityc * 2);
+	poly_zero(rs-omega, rs-header.parityc * 2);
+	for (i = 0; i  rs-header.parityc; i++) {
 		rs-omega[i] = product[i];
 	}
 }
@@ -264,36 +266,36 @@
 	int	n;
 
 	/* initialize Gamma, the erasure locator polynomial */
-	init_gamma(rs, gamma, rs-parityc * 2);
+	init_gamma(rs, gamma, rs-header.parityc * 2);
 
 	/* initialize to z */
-	(void) memcpy(D, gamma, rs-parityc * 2);
-	poly_mul_z(D, rs-parityc * 2);
+	(void) memcpy(D, gamma, rs-header.parityc * 2);
+	poly_mul_z(D, rs-header.parityc * 2);
 
-	(void) memcpy(psi, gamma, rs-parityc * 2);
+	(void) memcpy(psi, gamma, rs-header.parityc * 2);
 	k = -1;
 
-	for (L = n = 0; n  rs-parityc; n++) {
+	for (L = n = 0; n  rs-header.parityc; n++) {
 		if ((d = compute_discrepancy(psi, rs-syndrome, L, n)) != 0) {
 			/* psi2 = psi - d*D */
-			for (i = 0; i  rs-parityc * 2; i++) {
+			for (i = 0; i  rs-header.parityc * 2; i++) {
 psi2[i] = psi[i] ^ gfmult(d, D[i]);
 			}
 			if (L  (n - k)) {
 L2 = n - k;
 k = n - L;
 /* D = poly_scale(psi, gfinv(d), rs-parityc * 2); */
-for (i = 0; i  rs-parityc * 2; i++) {
+for (i = 0; i  rs-header.parityc * 2; i++) {
 	D[i] = 

CVS commit: src/sys/dev

2011-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 23 04:02:43 UTC 2011

Modified Files:
src/sys/dev/ic: ct65550.c ct65550reg.h ct65550var.h
src/sys/dev/pci: chipsfb.c

Log Message:
complete the driver/bus frontend split and make sure the driver can deal with
both PCI and VLB variants of the chip


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/ct65550.c src/sys/dev/ic/ct65550reg.h \
src/sys/dev/ic/ct65550var.h
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/chipsfb.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/ic/ct65550.c
diff -u src/sys/dev/ic/ct65550.c:1.1 src/sys/dev/ic/ct65550.c:1.2
--- src/sys/dev/ic/ct65550.c:1.1	Wed Feb  9 21:18:04 2011
+++ src/sys/dev/ic/ct65550.c	Wed Mar 23 04:02:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ct65550.c,v 1.1 2011/02/09 21:18:04 macallan Exp $	*/
+/*	$NetBSD: ct65550.c,v 1.2 2011/03/23 04:02:43 macallan Exp $	*/
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ct65550.c,v 1.1 2011/02/09 21:18:04 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: ct65550.c,v 1.2 2011/03/23 04:02:43 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -130,13 +130,13 @@
 static inline void
 chipsfb_write32(struct chipsfb_softc *sc, uint32_t reg, uint32_t val)
 {
-	bus_space_write_4(sc-sc_fbt, sc-sc_fbh, reg, val);
+	bus_space_write_4(sc-sc_memt, sc-sc_mmregh, reg, val);
 }
 
 static inline uint32_t
 chipsfb_read32(struct chipsfb_softc *sc, uint32_t reg)
 {
-	return bus_space_read_4(sc-sc_fbt, sc-sc_fbh, reg);
+	return bus_space_read_4(sc-sc_memt, sc-sc_mmregh, reg);
 }
 
 static inline void
@@ -203,10 +203,8 @@
 #ifdef CHIPSFB_DEBUG
 	printf(prop_dictionary_externalize(dict));
 #endif
-
 	chipsfb_init(sc);
 
-	/* we should read these from the chip instead of depending on OF */
 	width = height = -1;
 
 	/* detect panel size */
@@ -218,7 +216,12 @@
 	height |= (chipsfb_read_indexed(sc, CT_FP_INDEX, FP_VERT_OVERFLOW_1)
 	 0x0f)  8;
 	height++;
-	aprint_verbose(Panel size: %d x %d\n, width, height);
+	if ((width  640) || ( width  1280) || (height  480) ||
+	(height  1024)) {
+		/* no sane values in the panel registers */
+		width = height = -1;
+	} else
+		aprint_verbose(Panel size: %d x %d\n, width, height);
 
 	if (!prop_dictionary_get_uint32(dict, width, sc-width))
 		sc-width = width;
@@ -255,9 +258,6 @@
 		 * since we're not the console we can postpone the rest
 		 * until someone actually allocates a screen for us
 		 */
-#ifdef notyet
-		chipsfb_set_videomode(sc, videomode_list[0]);
-#endif
 	}
 
 	rasops_unpack_attr(defattr, fg, bg, ul);
@@ -269,7 +269,7 @@
 
 	aprint_normal_dev(sc-sc_dev, %d MB aperture, %d MB VRAM at 0x%08x\n,
 	(u_int)(sc-sc_fbsize  20),
-	sc-memsize  20, (u_int)sc-sc_fb);
+	(int)sc-memsize  20, (u_int)sc-sc_fb);
 #ifdef CHIPSFB_DEBUG
 	aprint_debug(fb: %08lx\n, (ulong)ri-ri_bits);
 #endif
@@ -644,7 +644,7 @@
 		bork = data[i];
 		latch |= (bork  shift);
 		if (shift == 24) {
-			chipsfb_write32(sc, CT_OFF_DATA, latch);
+			chipsfb_write32(sc, CT_OFF_DATA - CT_OFF_BITBLT, latch);
 			latch = 0;
 			shift = 0;
 		} else
@@ -652,12 +652,12 @@
 	}
 
 	if (shift != 0) {
-		chipsfb_write32(sc, CT_OFF_DATA, latch);
+		chipsfb_write32(sc, CT_OFF_DATA - CT_OFF_BITBLT, latch);
 	}
 
 	/* apparently the chip wants 64bit-aligned data or it won't go idle */
 	if ((count + 3)  0x04) {
-		chipsfb_write32(sc, CT_OFF_DATA, 0);
+		chipsfb_write32(sc, CT_OFF_DATA - CT_OFF_BITBLT, 0);
 	}
 #ifdef CHIPSFB_WAIT
 	chipsfb_wait_idle(sc);
@@ -760,10 +760,13 @@
 	struct chipsfb_softc *sc = vd-cookie;
 	paddr_t pa;
 
+	if (sc-sc_mmap != NULL)
+		return sc-sc_mmap(v, vs, offset, prot);
+
 	/* 'regular' framebuffer mmap()ing */
 	if (offset  sc-memsize) {
-		pa = bus_space_mmap(sc-sc_fbt, offset, 0, prot,
-		BUS_SPACE_MAP_LINEAR);
+		pa = bus_space_mmap(sc-sc_memt, offset, 0, prot,
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE);
 		return pa;
 	}
 
@@ -809,7 +812,7 @@
 	ri-ri_stride = sc-width;
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
-	ri-ri_bits = bus_space_vaddr(sc-sc_fbt, sc-sc_fbh);
+	ri-ri_bits = bus_space_vaddr(sc-sc_memt, sc-sc_fbh);
 
 #ifdef CHIPSFB_DEBUG
 	aprint_debug(addr: %08lx\n, (ulong)ri-ri_bits);
@@ -866,14 +869,14 @@
 	 * if what we wrote to 0 is left untouched. Max. fb size is 4MB so
 	 * we voluntarily stop there.
 	 */
-	chipsfb_write32(sc, 0, 0xf0f0f0f0);
-	chipsfb_write32(sc, ofs, 0x0f0f0f0f);
-	while ((chipsfb_read32(sc, 0) == 0xf0f0f0f0) 
-	(chipsfb_read32(sc, ofs) == 0x0f0f0f0f) 
+	bus_space_write_4(sc-sc_memt, sc-sc_fbh, 0, 0xf0f0f0f0);
+	bus_space_write_4(sc-sc_memt, sc-sc_fbh, ofs, 0x0f0f0f0f);
+	while ((bus_space_read_4(sc-sc_memt, sc-sc_fbh, 0) == 0xf0f0f0f0) 
+	(bus_space_read_4(sc-sc_memt, sc-sc_fbh, ofs) == 0x0f0f0f0f) 
 	(ofs  0x0040)) {
 
 		ofs += 0x0008;
-		

CVS commit: src/sys/arch/shark

2011-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 23 04:06:04 UTC 2011

Modified Files:
src/sys/arch/shark/conf: files.shark
src/sys/arch/shark/ofw: ofw.c
src/sys/arch/shark/shark: consinit.c
Added Files:
src/sys/arch/shark/ofw: chipsfb_ofbus.c

Log Message:
add support for chipsfb at ofbus


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/shark/conf/files.shark
cvs rdiff -u -r0 -r1.1 src/sys/arch/shark/ofw/chipsfb_ofbus.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/shark/ofw/ofw.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/shark/shark/consinit.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/shark/conf/files.shark
diff -u src/sys/arch/shark/conf/files.shark:1.17 src/sys/arch/shark/conf/files.shark:1.18
--- src/sys/arch/shark/conf/files.shark:1.17	Wed Feb 20 21:43:35 2008
+++ src/sys/arch/shark/conf/files.shark	Wed Mar 23 04:06:03 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.shark,v 1.17 2008/02/20 21:43:35 drochner Exp $
+#	$NetBSD: files.shark,v 1.18 2011/03/23 04:06:03 macallan Exp $
 #
 # First try for arm-specific configuration info
 #
@@ -126,6 +126,10 @@
 attach	igsfb at ofbus with igsfb_ofbus
 file	arch/shark/ofw/igsfb_ofbus.c		igsfb_ofbus needs-flag
 
+# ofbus CT 65550
+attach	chipsfb at ofbus with chipsfb_ofbus
+file	arch/shark/ofw/chipsfb_ofbus.c		chipsfb_ofbus needs-flag
+
 # Smart Card Reader
 device	scr: tty
 file	arch/shark/shark/scr.c			scr needs-flag

Index: src/sys/arch/shark/ofw/ofw.c
diff -u src/sys/arch/shark/ofw/ofw.c:1.54 src/sys/arch/shark/ofw/ofw.c:1.55
--- src/sys/arch/shark/ofw/ofw.c:1.54	Fri Nov 12 13:40:10 2010
+++ src/sys/arch/shark/ofw/ofw.c	Wed Mar 23 04:06:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw.c,v 1.54 2010/11/12 13:40:10 uebayasi Exp $	*/
+/*	$NetBSD: ofw.c,v 1.55 2011/03/23 04:06:03 macallan Exp $	*/
 
 /*
  * Copyright 1997
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw.c,v 1.54 2010/11/12 13:40:10 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw.c,v 1.55 2011/03/23 04:06:03 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,6 +78,7 @@
 
 #include isadma.h
 #include igsfb_ofbus.h
+#include chipsfb_ofbus.h
 #include vga_ofbus.h
 
 #define IO_VIRT_BASE (OFW_VIRT_BASE + OFW_VIRT_SIZE)
@@ -145,7 +146,7 @@
 
 int ofw_callbacks = 0;		/* debugging counter */
 
-#if (NIGSFB_OFBUS  0) || (NVGA_OFBUS  0)
+#if (NIGSFB_OFBUS  0) || (NCHIPSFB_OFBUS  0) || (NVGA_OFBUS  0)
 int console_ihandle = 0;
 static void reset_screen(void);
 #endif
@@ -404,7 +405,7 @@
 		*ap++ = 0;
 		if (ap[-2] == '-')
 			*ap1 = 0;
-#if (NIGSFB_OFBUS  0) || (NVGA_OFBUS  0)
+#if (NIGSFB_OFBUS  0) || (NCHIPSFB_OFBUS  0) || (NVGA_OFBUS  0)
 		reset_screen();
 #endif
 		OF_boot(str);
@@ -413,7 +414,7 @@
 
 ofw_exit:
 	printf(Calling OF_exit...\n);
-#if (NIGSFB_OFBUS  0) || (NVGA_OFBUS  0)
+#if (NIGSFB_OFBUS  0) || (NCHIPSFB_OFBUS  0) || (NVGA_OFBUS  0)
 	reset_screen();
 #endif
 	OF_exit();
@@ -1946,7 +1947,7 @@
 
 }
 
-#if (NIGSFB_OFBUS  0) || (NVGA_OFBUS  0)
+#if (NIGSFB_OFBUS  0) || (NCHIPSFB_OFBUS  0) || (NVGA_OFBUS  0)
 static void
 reset_screen(void)
 {

Index: src/sys/arch/shark/shark/consinit.c
diff -u src/sys/arch/shark/shark/consinit.c:1.9 src/sys/arch/shark/shark/consinit.c:1.10
--- src/sys/arch/shark/shark/consinit.c:1.9	Wed Mar 18 10:22:36 2009
+++ src/sys/arch/shark/shark/consinit.c	Wed Mar 23 04:06:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.9 2009/03/18 10:22:36 cegger Exp $	*/
+/*	$NetBSD: consinit.c,v 1.10 2011/03/23 04:06:03 macallan Exp $	*/
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.9 2009/03/18 10:22:36 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.10 2011/03/23 04:06:03 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -71,8 +71,13 @@
 #endif
 
 #include igsfb_ofbus.h
+#include chipsfb_ofbus.h
 #include shark/ofw/igsfb_ofbusvar.h
 
+#if (NCHIPSFB_OFBUS  0)
+extern int chipsfb_ofbus_cnattach(bus_space_tag_t, bus_space_tag_t);
+#endif
+
 #if (NCOM  0)
 #ifndef CONADDR
 #define CONADDR 0x3f8
@@ -114,7 +119,7 @@
 #endif
 
 	if (!comconsole) {
-#if (NVGA  0) || (NIGSFB_OFBUS  0)
+#if (NVGA  0) || (NCHIPSFB_OFBUS  0) || (NIGSFB_OFBUS  0)
 #if (NIGSFB_OFBUS  0)
 		if (!igsfb_ofbus_cnattach(isa_io_bs_tag, isa_mem_bs_tag)) {
 #if (NPCKBC  0)
@@ -124,6 +129,15 @@
 			return;
 		}
 #endif /* NIGSFB_OFBUS */
+#if (NCHIPSFB_OFBUS  0)
+		if (!chipsfb_ofbus_cnattach(isa_io_bs_tag, isa_mem_bs_tag)) {
+#if (NPCKBC  0)
+			pckbc_cnattach(isa_io_bs_tag, IO_KBD, KBCMDP,
+			PCKBC_KBD_SLOT);
+#endif /* NPCKBC */
+			return;
+		}
+#endif /* NCHIPSFB_OFBUS */
 #if (NVGA_OFBUS  0)
 		if (!vga_ofbus_cnattach(isa_io_bs_tag, isa_mem_bs_tag)) {
 #if (NPCKBC  0)
@@ -133,6 +147,7 @@
 			return;
 		}
 #endif /* NVGA_OFBUS */
+
 #else /* NVGA */
 #if (NOFCONS  0)
 		cp = ofcons;

Added 

CVS commit: src/doc

2011-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 23 04:08:53 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
mention chipsfb on shark


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1526 src/doc/CHANGES:1.1527
--- src/doc/CHANGES:1.1526	Tue Mar 22 22:33:10 2011
+++ src/doc/CHANGES	Wed Mar 23 04:08:52 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1526 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1527 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -969,3 +969,4 @@
 	hppa: add TLS support.  [skrll 20110317]
 	gdtoa: Import the latest [christos 20110319]
 	sandpoint: D-Link DSM-G600 support. [phx 20110319]
+	shark: chipsfb now works on shark. [macallan 20110323]



CVS commit: src/sys/arch/shark/conf

2011-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 23 04:46:29 UTC 2011

Modified Files:
src/sys/arch/shark/conf: GENERIC

Log Message:
add chipsfb


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/shark/conf/GENERIC

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/shark/conf/GENERIC
diff -u src/sys/arch/shark/conf/GENERIC:1.93 src/sys/arch/shark/conf/GENERIC:1.94
--- src/sys/arch/shark/conf/GENERIC:1.93	Sun Mar  6 17:08:31 2011
+++ src/sys/arch/shark/conf/GENERIC	Wed Mar 23 04:46:29 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.93 2011/03/06 17:08:31 bouyer Exp $
+#	$NetBSD: GENERIC,v 1.94 2011/03/23 04:46:29 macallan Exp $
 #
 # Generic Shark configuration.
 #
@@ -7,7 +7,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC-$Revision: 1.93 $
+#ident		GENERIC-$Revision: 1.94 $
 
 # estimated number of users
 maxusers	32
@@ -251,7 +251,8 @@
 pckbd*		at pckbc?
 pms*		at pckbc?
 vga*		at ofbus?
-igsfb*		at ofbus?
+igsfb*		at ofbus?	# IGS CyberPro in rev. 5 sharks
+chipsfb*	at ofbus?	# CT 65550 in rev. 4 and earlier
 wsdisplay*	at wsemuldisplaydev?
 wskbd*		at pckbd? console ?
 wsmouse*	at pms? mux 0



CVS commit: othersrc/external/bsd/rs/rs

2011-03-22 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Mar 23 04:56:33 UTC 2011

Modified Files:
othersrc/external/bsd/rs/rs: Makefile

Log Message:
add a test for nested rs encoding, remarkably similar to the rs encoding
steps in CIRC (in use on CDs), but without the cross-interleaving - the
test uses the same 28,24 then 32,28 encodings.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/rs/rs/Makefile

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

Modified files:

Index: othersrc/external/bsd/rs/rs/Makefile
diff -u othersrc/external/bsd/rs/rs/Makefile:1.2 othersrc/external/bsd/rs/rs/Makefile:1.3
--- othersrc/external/bsd/rs/rs/Makefile:1.2	Wed Mar 23 03:17:48 2011
+++ othersrc/external/bsd/rs/rs/Makefile	Wed Mar 23 04:56:33 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2011/03/23 03:17:48 agc Exp $
+# $NetBSD: Makefile,v 1.3 2011/03/23 04:56:33 agc Exp $
 
 .include bsd.own.mk
 
@@ -37,3 +37,7 @@
 	./${PROG} -d -o a3 a2
 	diff Makefile a3
 	rm -f a2 a3
+	./${PROG} -p 28,24 Makefile | ./${PROG} -o a2 -p 32,28
+	./${PROG} -d a2 | ./${PROG} -d -o a3
+	diff Makefile a3
+	rm -f a2 a3