Warn about sloppy disk I/O to vnd(4)

2011-08-25 Thread Matthew Dempsky
Unlike other disk drivers, vnd(4) allows raw reads and writes of
partial blocks.  E.g., if configured with a 512-byte sector size, it
will still allow commands like:

$ dd if=/dev/rvnd0c bs=42 skip=4096 count=1

(The same command will fail against /dev/rsd0c or if count=1 is
changed to count=2.)

Unfortunately, some of the distrib scripts currently rely on this
behavior (e.g., at least sgi and socppc).  I'd like to suggest the
diff below to help identify any others without causing any breakage.
It simply prints to dmesg whenever a partial block read or write is
attempted; e.g., for the above dd(1) command I got:

vnd0: sloppy read from proc 6365 (dd): blkno 336 bcount 42

Once snapshots are building without this warning, we can remove the
current kludge code in vndstrategy() that deals with partial blocks.

I don't think this warning should be very noisy, but if it turns out
to cause problems, we can easily tweak it as appopriate (e.g., only
print N consecutive messages from the same pid).

ok?

Index: vnd.c
===
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/vnd.c,v
retrieving revision 1.148
diff -u -p -r1.148 vnd.c
--- vnd.c   18 Jul 2011 02:49:20 -  1.148
+++ vnd.c   25 Aug 2011 01:55:51 -
@@ -304,6 +304,15 @@ vndstrategy(struct buf *bp)
if (sc->sc_keyctx == NULL) {
u_int32_t secsize = sc->sc_dk.dk_label->d_secsize;
bp->b_bcount = ((origbcount + secsize - 1) & ~(secsize - 1));
+#ifdef DIAGNOSTIC
+   if (bp->b_bcount != origbcount) {
+   struct proc *pr = curproc;
+   printf("%s: sloppy %s from proc %d (%s): "
+   "blkno %lld bcount %ld\n", sc->sc_dev.dv_xname,
+   (bp->b_flags & B_READ) ? "read" : "write",
+   pr->p_pid, pr->p_comm, bp->b_blkno, origbcount);
+   }
+#endif
}
 
if (bounds_check_with_label(bp, sc->sc_dk.dk_label) == -1) {



Re: more old stuff

2011-08-25 Thread Marc Espie
On Wed, Aug 24, 2011 at 07:22:47PM +0200, Landry Breuil wrote:
> On Wed, Aug 24, 2011 at 12:39:07PM +0200, Marc Espie wrote:
> > Apparently, nobody cares about fat packages.
> > 
> > Not surprisingly, killing that code simplifies a few things.
> > Especially since the necessity of passing arch around was only due to
> > the possibility of fat packages...
> 
> I don't see the relation between fat package and arch.. was one of the
> planned usecase 'build a single package containing a pkg for each archs' ?

Read the removed code. This is most of it.



Du har 1 ulest melding !

2011-08-25 Thread Western Union ALERT
Kjfre Western Union Medlem ,

Du har 1 ulest melding !

Din Western Union-konto er lest.

Logg inn pe din konto for e lxse problemet.

Klikk her for e logge inn

Thank you for using Western Union!

The Western Union Team.



Western Union E-post ID: PP 3182



Re: problem in manual page for ip(4)

2011-08-25 Thread Giovanni Bechis
On 08/25/11 14:44, Thomas de Grivel wrote:
> Including  before  makes it ok.
> So either the manual is wrong
> or sys/socket.h or netinet/in.h is wrong.
> 
Ok for this diff ?
 Cheers
  Giovanni
Index: ip.4
===
RCS file: /cvs/src/share/man/man4/ip.4,v
retrieving revision 1.32
diff -u -p -r1.32 ip.4
--- ip.415 Jun 2011 13:28:03 -  1.32
+++ ip.425 Aug 2011 13:58:51 -
@@ -37,6 +37,7 @@
 .Nm ip
 .Nd Internet Protocol
 .Sh SYNOPSIS
+.Fd #include 
 .Fd #include 
 .Fd #include 
 .Ft int
Index: ip6.4
===
RCS file: /cvs/src/share/man/man4/ip6.4,v
retrieving revision 1.23
diff -u -p -r1.23 ip6.4
--- ip6.4   31 Aug 2009 04:46:32 -  1.23
+++ ip6.4   25 Aug 2011 13:58:51 -
@@ -33,6 +33,7 @@
 .Nm ip6
 .Nd Internet Protocol version 6 (IPv6) network layer
 .Sh SYNOPSIS
+.In sys/types.h
 .In sys/socket.h
 .In netinet/in.h
 .Ft int



problem in manual page for ip(4)

2011-08-25 Thread Thomas de Grivel

Hi,

From ip(4) :

SYNOPSIS
 #include 
 #include 

However this fails :

$ cat > ip.c
#include 
#include 

int main() {
  return 0;
}
^D
$ gcc ip.c
In file included from ip.c:1:
/usr//include/sys/socket.h:105: error: expected specifier-qualifier-list 
before 'off_t'
/usr//include/sys/socket.h:162: error: expected specifier-qualifier-list 
before 'u_int8_t'
/usr//include/sys/socket.h:180: error: expected specifier-qualifier-list 
before 'u_int8_t'
/usr//include/sys/socket.h:249: error: expected specifier-qualifier-list 
before 'uid_t'
/usr//include/sys/socket.h:394: error: expected specifier-qualifier-list 
before 'socklen_t'
/usr//include/sys/socket.h:420: error: expected specifier-qualifier-list 
before 'socklen_t'
/usr//include/sys/socket.h:476: error: expected specifier-qualifier-list 
before 'caddr_t'

In file included from ip.c:1:
/usr//include/sys/socket.h:491: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:492: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:493: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:494: error: expected declaration specifiers 
or '...' before 'uid_t'
/usr//include/sys/socket.h:494: error: expected declaration specifiers 
or '...' before 'gid_t'
/usr//include/sys/socket.h:495: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:496: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:497: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/sys/socket.h:499: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'recv'
/usr//include/sys/socket.h:500: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'recvfrom'
/usr//include/sys/socket.h:501: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'recvmsg'
/usr//include/sys/socket.h:502: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'send'
/usr//include/sys/socket.h:503: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'sendto'
/usr//include/sys/socket.h:505: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'sendmsg'
/usr//include/sys/socket.h:506: error: expected declaration specifiers 
or '...' before 'socklen_t'

In file included from ip.c:2:
/usr//include/netinet/in.h:141: error: expected specifier-qualifier-list 
before 'in_addr_t'
/usr//include/netinet/in.h:225: error: expected specifier-qualifier-list 
before 'u_int8_t'
/usr//include/netinet/in.h:244: error: expected specifier-qualifier-list 
before 'int8_t'

In file included from /usr//include/netinet/in.h:732,
 from ip.c:2:
/usr//include/netinet6/in6.h:118: error: expected 
specifier-qualifier-list before 'u_int8_t'
/usr//include/netinet6/in6.h:140: error: expected 
specifier-qualifier-list before 'u_int8_t'
/usr//include/netinet6/in6.h:392: error: expected 
specifier-qualifier-list before 'u_long'
/usr//include/netinet6/in6.h:515: error: expected 
specifier-qualifier-list before 'u_int32_t'
/usr//include/netinet6/in6.h:799: error: expected ';', ',' or ')' before 
'*' token
/usr//include/netinet6/in6.h:801: error: expected '=', ',', ';', 'asm' 
or '__attribute__' before '*' token
/usr//include/netinet6/in6.h:802: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:803: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:805: error: expected '=', ',', ';', 'asm' 
or '__attribute__' before 'inet6_rthdr_space'
/usr//include/netinet6/in6.h:817: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:818: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:818: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:819: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:819: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:820: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:821: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:823: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:823: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:824: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:825: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:825: error: expected declaration specifiers 
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:826: error: expected declaration specifiers 
or '...' before 'socklen_t'
/usr//include/netine

Re: use strtonum to check Port statements in apache

2011-08-25 Thread Kenneth R Westerback
On Thu, Aug 25, 2011 at 08:25:00PM +1000, David Gwynne wrote:
> i want to push my "set scheme in http" diff again, but it makes
> sense to reuse server_port as part of that.
> 
> this makes server_port more palatable to me.
> 
> ok?

Can't see that this changes anything, and it does look better, so
ok krw@.

 Ken

> 
> Index: src/main/http_core.c
> ===
> RCS file: /cvs/src/usr.sbin/httpd/src/main/http_core.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 http_core.c
> --- src/main/http_core.c  10 May 2010 02:00:50 -  1.27
> +++ src/main/http_core.c  25 Aug 2011 10:23:02 -
> @@ -1779,14 +1779,16 @@ static const char *server_port(cmd_parms
>  if (err != NULL) {
>   return err;
>  }
> -port = atoi(arg);
> -if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */
> - return ap_pstrcat(cmd->temp_pool, "The port number \"", arg, 
> -   "\" is outside the appropriate range "
> -   "(i.e., 1..65535).", NULL);
> +
> +port = (int)strtonum(arg, 1, 65535, &err);
> +if (err != NULL) {
> + return ap_pstrcat(cmd->temp_pool,
> +   "The port number \"", arg, "\" is ", err, NULL);
>  }
> +
>  cmd->server->port = port;
> -return NULL;
> +
> +return (NULL);
>  }
>  
>  static const char *set_signature_flag(cmd_parms *cmd, core_dir_config *d, 



Re: problem in manual page for ip(4)

2011-08-25 Thread Thomas de Grivel

Le 08/25/11 14:44, Thomas de Grivel a icrit :

Hi,

 From ip(4) :

SYNOPSIS
#include 
#include 

However this fails :

$ cat > ip.c
#include 
#include 

int main() {
return 0;
}
^D
$ gcc ip.c
In file included from ip.c:1:
/usr//include/sys/socket.h:105: error: expected specifier-qualifier-list
before 'off_t'
/usr//include/sys/socket.h:162: error: expected specifier-qualifier-list
before 'u_int8_t'
/usr//include/sys/socket.h:180: error: expected specifier-qualifier-list
before 'u_int8_t'
/usr//include/sys/socket.h:249: error: expected specifier-qualifier-list
before 'uid_t'
/usr//include/sys/socket.h:394: error: expected specifier-qualifier-list
before 'socklen_t'
/usr//include/sys/socket.h:420: error: expected specifier-qualifier-list
before 'socklen_t'
/usr//include/sys/socket.h:476: error: expected specifier-qualifier-list
before 'caddr_t'
In file included from ip.c:1:
/usr//include/sys/socket.h:491: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:492: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:493: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:494: error: expected declaration specifiers
or '...' before 'uid_t'
/usr//include/sys/socket.h:494: error: expected declaration specifiers
or '...' before 'gid_t'
/usr//include/sys/socket.h:495: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:496: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:497: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/sys/socket.h:499: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'recv'
/usr//include/sys/socket.h:500: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'recvfrom'
/usr//include/sys/socket.h:501: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'recvmsg'
/usr//include/sys/socket.h:502: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'send'
/usr//include/sys/socket.h:503: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'sendto'
/usr//include/sys/socket.h:505: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'sendmsg'
/usr//include/sys/socket.h:506: error: expected declaration specifiers
or '...' before 'socklen_t'
In file included from ip.c:2:
/usr//include/netinet/in.h:141: error: expected specifier-qualifier-list
before 'in_addr_t'
/usr//include/netinet/in.h:225: error: expected specifier-qualifier-list
before 'u_int8_t'
/usr//include/netinet/in.h:244: error: expected specifier-qualifier-list
before 'int8_t'
In file included from /usr//include/netinet/in.h:732,
from ip.c:2:
/usr//include/netinet6/in6.h:118: error: expected
specifier-qualifier-list before 'u_int8_t'
/usr//include/netinet6/in6.h:140: error: expected
specifier-qualifier-list before 'u_int8_t'
/usr//include/netinet6/in6.h:392: error: expected
specifier-qualifier-list before 'u_long'
/usr//include/netinet6/in6.h:515: error: expected
specifier-qualifier-list before 'u_int32_t'
/usr//include/netinet6/in6.h:799: error: expected ';', ',' or ')' before
'*' token
/usr//include/netinet6/in6.h:801: error: expected '=', ',', ';', 'asm'
or '__attribute__' before '*' token
/usr//include/netinet6/in6.h:802: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:803: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:805: error: expected '=', ',', ';', 'asm'
or '__attribute__' before 'inet6_rthdr_space'
/usr//include/netinet6/in6.h:817: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:818: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:818: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:819: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:819: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:820: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:821: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:823: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:823: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:824: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:825: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:825: error: expected declaration specifiers
or '...' before 'u_int8_t'
/usr//include/netinet6/in6.h:826: error: expected declaration specifiers
or '...' before 'socklen_t'
/usr//include/netinet6/in6.h:827: error: expected d

remote dump to file

2011-08-25 Thread Manuel Giraud
Hi,

This patch makes the following command working:

$ RSH=ssh dump -0au -f remote:dump.0 /

even if dump.0 doesn't already exists on remote. Note: i cannot test
this patch on st(4) device.

Index: tape.c
===
RCS file: /cvs/src/sbin/dump/tape.c,v
retrieving revision 1.31
diff -u -p -r1.31 tape.c
--- tape.c  27 Oct 2009 23:59:32 -  1.31
+++ tape.c  25 Aug 2011 12:31:36 -
@@ -649,7 +649,7 @@ restore_check_point:
msg("Dumping volume %d on %s\n", tapeno, tape);
}
 #ifdef RDUMP
-   while ((tapefd = (host ? rmtopen(tape, 2) :
+   while ((tapefd = (host ? rmtopen(tape, O_WRONLY|O_CREAT) :
pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
 #else
while ((tapefd = (pipeout ? 1 :

-- 
Manuel Giraud



use strtonum to check Port statements in apache

2011-08-25 Thread David Gwynne
i want to push my "set scheme in http" diff again, but it makes
sense to reuse server_port as part of that.

this makes server_port more palatable to me.

ok?

Index: src/main/http_core.c
===
RCS file: /cvs/src/usr.sbin/httpd/src/main/http_core.c,v
retrieving revision 1.27
diff -u -p -r1.27 http_core.c
--- src/main/http_core.c10 May 2010 02:00:50 -  1.27
+++ src/main/http_core.c25 Aug 2011 10:23:02 -
@@ -1779,14 +1779,16 @@ static const char *server_port(cmd_parms
 if (err != NULL) {
return err;
 }
-port = atoi(arg);
-if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */
-   return ap_pstrcat(cmd->temp_pool, "The port number \"", arg, 
- "\" is outside the appropriate range "
- "(i.e., 1..65535).", NULL);
+
+port = (int)strtonum(arg, 1, 65535, &err);
+if (err != NULL) {
+   return ap_pstrcat(cmd->temp_pool,
+ "The port number \"", arg, "\" is ", err, NULL);
 }
+
 cmd->server->port = port;
-return NULL;
+
+return (NULL);
 }
 
 static const char *set_signature_flag(cmd_parms *cmd, core_dir_config *d,