Re: svn commit: r278616 - in head: . contrib/netbsd-tests/games etc etc/mtree etc/root games games/caesar games/fortune/datfiles release/scripts share/man/man4 share/man/man6 share/man/man7 share/mk s

2015-02-12 Thread Slawa Olhovchenkov
On Thu, Feb 12, 2015 at 05:35:00AM +, Colin Percival wrote:

> Author: cperciva
> Date: Thu Feb 12 05:35:00 2015
> New Revision: 278616
> URL: https://svnweb.freebsd.org/changeset/base/278616
> 
> Log:
>   Step 1 of eliminating the "games" distribution: Move binaries to /usr/bin;
>   update paths; and include everything in the "base" distribution.
>   
>   The "games" distribution being optional made sense when there were more
>   games and we had small disks; but the "games-like" games were moved into
>   the ports tree a dozen years ago and the remaining "utility-like" games
>   occupy less than 0.001% of my laptop's small hard drive.  Meanwhile every
>   new user is confronted by the question "do you want games installed" when
>   they they try to install FreeBSD.
>   
>   The next steps will be:
>   
>   2. Removing punch card (bcd, ppt), phase-of-moon (pom), clock (grdc), and
>   caesar cipher (caesar, rot13) utilities.  I intend to keep fortune, factor,
>   morse, number, primes, and random, since there is evidence that those are
>   still being used.

Please, keep pom.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278619 - head/sys/cam/ctl

2015-02-12 Thread Alexander Motin
Author: mav
Date: Thu Feb 12 10:28:45 2015
New Revision: 278619
URL: https://svnweb.freebsd.org/changeset/base/278619

Log:
  Make WRITE SAME commands respect physical block size.
  
  This change by 2-3 times improves performance of misaligned WRITE SAME
  commands by avoiding unneeded read-modify-write cycles inside ZFS.
  
  MFC after:1 week

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cThu Feb 12 07:22:46 2015
(r278618)
+++ head/sys/cam/ctl/ctl_backend_block.cThu Feb 12 10:28:45 2015
(r278619)
@@ -1187,7 +1187,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
struct ctl_be_block_io *beio;
struct ctl_be_block_softc *softc;
struct ctl_lba_len_flags *lbalen;
-   uint64_t len_left, lba;
+   uint64_t len_left, lba, pb, pbo, adj;
int i, seglen;
uint8_t *buf, *end;
 
@@ -1241,6 +1241,8 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
DPRINTF("WRITE SAME at LBA %jx len %u\n",
   (uintmax_t)lbalen->lba, lbalen->len);
 
+   pb = (uint64_t)be_lun->blocksize << be_lun->pblockexp;
+   pbo = pb - (uint64_t)be_lun->blocksize * be_lun->pblockoff;
len_left = (uint64_t)lbalen->len * be_lun->blocksize;
for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) {
 
@@ -1248,7 +1250,15 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
 * Setup the S/G entry for this chunk.
 */
seglen = MIN(CTLBLK_MAX_SEG, len_left);
-   seglen -= seglen % be_lun->blocksize;
+   if (pb > be_lun->blocksize) {
+   adj = ((lbalen->lba + lba) * be_lun->blocksize +
+   seglen - pbo) % pb;
+   if (seglen > adj)
+   seglen -= adj;
+   else
+   seglen -= seglen % be_lun->blocksize;
+   } else
+   seglen -= seglen % be_lun->blocksize;
beio->sg_segs[i].len = seglen;
beio->sg_segs[i].addr = uma_zalloc(be_lun->lun_zone, M_WAITOK);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278589 - head/usr.sbin/flowctl

2015-02-12 Thread Bruce Evans

On Wed, 11 Feb 2015, Pedro F. Giffuni wrote:


Log:
 flowctl: Replace alloca() with an array.

 Reviewed by:   glebius

Modified:
 head/usr.sbin/flowctl/flowctl.c

Modified: head/usr.sbin/flowctl/flowctl.c
==
--- head/usr.sbin/flowctl/flowctl.c Wed Feb 11 17:41:23 2015
(r278588)
+++ head/usr.sbin/flowctl/flowctl.c Wed Feb 11 17:46:35 2015
(r278589)
@@ -222,12 +222,10 @@ ctl_show(int argc, char **argv)
static void
do_show(int version, void (*func)(struct ngnf_show_header *))
{
-   struct ng_mesg *ng_mesg;
+   struct ng_mesg ng_mesg[SORCVBUF_SIZE];
struct ngnf_show_header req, *resp;
int token, nread;

-   ng_mesg = alloca(SORCVBUF_SIZE);
-
req.version = version;
req.hash_id = req.list_id = 0;


It is surprising that this even compiles.  It replaces the allocation
of 1 (variable-size, using a perhaps-standard form of the struct hack)
struct of size SORCVBUF_SIZE with that of SORCVBUF_SIZE (fixed-size)
structs, each of too-small size.  This accidentally allocates enough
storage since 1 * SORCVBUF_SIZE < SORCVBUF_SIZE * sizeof(any).

It changes the variable type significantly, from a pointer to 1 struct to
the bogus array.

In 1 place, the array decays to a pointer to its first element without
too much magic.  (The magic is larger than usual since the struct hack
is used.  The first element is too small and is overrun.  This works
because the pointer isn't really a pointer to a struct.)

In 4 places, the array decays to a pointer to its first element more
magically.  It is surprising that ng_mesg->header means the same thing
as ng_mesg[0].header when ng_mesg is an array.

Using alloca() was ugly, but correctly reflected what was going on.
It is an optimization of mallocing the struct.  VLAs don't work as
well as alloca() for variable-sized structs.  I don't see how they
can be used at all.  Since we allocate the maximum size needed, we
don't even need a VLA, and could almost use

u_char buf[SORCVBUF_SIZE]
struct ng_mesg *ng_mesg;

ng_msg = (struct ng_mesg *)buf;

but this doesn't guarantee the necessary alignment like malloc() and
alloca() do.  It also takes more code than alloca().  To get the
necessary alignment, you would have to use some alignment hack,
e.g., put buf in a union with the struct (only works for fixed-size
allocation), or perhaps use an array not quite as in this commit:

struct ng_mesg buf[howmany(SORCVBUF_SIZE, sizeof(struct ng_mesg))];
struct ng_mesg *ng_mesg;

ng_msg = &buf[0];

This form works using VLAs (SORCVBUF_SIZE can be variable), but is much
uglier than using alloca().

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278621 - head/usr.sbin/ctladm

2015-02-12 Thread Alexander Motin
Author: mav
Date: Thu Feb 12 11:27:54 2015
New Revision: 278621
URL: https://svnweb.freebsd.org/changeset/base/278621

Log:
  Fix man page to match real option names.
  
  MFC after:3 days

Modified:
  head/usr.sbin/ctladm/ctladm.8

Modified: head/usr.sbin/ctladm/ctladm.8
==
--- head/usr.sbin/ctladm/ctladm.8   Thu Feb 12 11:10:07 2015
(r278620)
+++ head/usr.sbin/ctladm/ctladm.8   Thu Feb 12 11:27:54 2015
(r278621)
@@ -1035,11 +1035,11 @@ Set to "off" to allow them be issued in 
 Parallel issue of consecutive operations may confuse logic of the
 backing file system, hurting performance; but it may improve performance
 of backing stores without prefetch/write-back.
-.It Va psectorsize
-.It Va psectoroffset
+.It Va pblocksize
+.It Va pblockoffset
 Specify physical block size and offset of the device.
-.It Va usectorsize
-.It Va usectoroffset
+.It Va ublocksize
+.It Va ublockoffset
 Specify UNMAP block size and offset of the device.
 .It Va rpm
 .It Va rpm
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278622 - in head/usr.sbin: ctld iscsid

2015-02-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 12 11:57:31 2015
New Revision: 278622
URL: https://svnweb.freebsd.org/changeset/base/278622

Log:
  Remove unused code.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctld.h
  head/usr.sbin/ctld/keys.c
  head/usr.sbin/iscsid/iscsid.h
  head/usr.sbin/iscsid/keys.c

Modified: head/usr.sbin/ctld/ctld.h
==
--- head/usr.sbin/ctld/ctld.h   Thu Feb 12 11:27:54 2015(r278621)
+++ head/usr.sbin/ctld/ctld.h   Thu Feb 12 11:57:31 2015(r278622)
@@ -416,7 +416,6 @@ voidkeys_delete(struct keys *keys);
 void   keys_load(struct keys *keys, const struct pdu *pdu);
 void   keys_save(struct keys *keys, struct pdu *pdu);
 const char *keys_find(struct keys *keys, const char *name);
-intkeys_find_int(struct keys *keys, const char *name);
 void   keys_add(struct keys *keys,
const char *name, const char *value);
 void   keys_add_int(struct keys *keys,

Modified: head/usr.sbin/ctld/keys.c
==
--- head/usr.sbin/ctld/keys.c   Thu Feb 12 11:27:54 2015(r278621)
+++ head/usr.sbin/ctld/keys.c   Thu Feb 12 11:57:31 2015(r278622)
@@ -161,26 +161,6 @@ keys_find(struct keys *keys, const char 
return (NULL);
 }
 
-int
-keys_find_int(struct keys *keys, const char *name)
-{
-   const char *str;
-   char *endptr;
-   int num;
-
-   str = keys_find(keys, name);
-   if (str == NULL)
-   return (-1);
-
-   num = strtoul(str, &endptr, 10);
-   if (*endptr != '\0') {
-   log_debugx("invalid numeric value \"%s\"", str);
-   return (-1);
-   }
-
-   return (num);
-}
-
 void
 keys_add(struct keys *keys, const char *name, const char *value)
 {

Modified: head/usr.sbin/iscsid/iscsid.h
==
--- head/usr.sbin/iscsid/iscsid.h   Thu Feb 12 11:27:54 2015
(r278621)
+++ head/usr.sbin/iscsid/iscsid.h   Thu Feb 12 11:57:31 2015
(r278622)
@@ -116,7 +116,6 @@ voidkeys_delete(struct keys *key);
 void   keys_load(struct keys *keys, const struct pdu *pdu);
 void   keys_save(struct keys *keys, struct pdu *pdu);
 const char *keys_find(struct keys *keys, const char *name);
-intkeys_find_int(struct keys *keys, const char *name);
 void   keys_add(struct keys *keys,
const char *name, const char *value);
 void   keys_add_int(struct keys *keys,

Modified: head/usr.sbin/iscsid/keys.c
==
--- head/usr.sbin/iscsid/keys.c Thu Feb 12 11:27:54 2015(r278621)
+++ head/usr.sbin/iscsid/keys.c Thu Feb 12 11:57:31 2015(r278622)
@@ -162,26 +162,6 @@ keys_find(struct keys *keys, const char 
return (NULL);
 }
 
-int
-keys_find_int(struct keys *keys, const char *name)
-{
-   const char *str;
-   char *endptr;
-   int num;
-
-   str = keys_find(keys, name);
-   if (str == NULL)
-   return (-1);
-
-   num = strtoul(str, &endptr, 10);
-   if (*endptr != '\0') {
-   log_debugx("invalid numeric value \"%s\"", str);
-   return (-1);
-   }
-
-   return (num);
-}
-
 void
 keys_add(struct keys *keys, const char *name, const char *value)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278623 - head/sys/kern

2015-02-12 Thread Randall Stewart
Author: rrs
Date: Thu Feb 12 13:31:08 2015
New Revision: 278623
URL: https://svnweb.freebsd.org/changeset/base/278623

Log:
  This fixes a bug I in-advertantly inserted when I updated the callout
  code in my last commit. The cc_exec_next is used to track the next
  when a direct call is being made from callout. It is *never* used
  in the in-direct method. When macro-izing I made it so that it
  would separate out direct/vs/non-direct. This is incorrect and can
  cause panics as Peter Holm has found for me (Thanks so much Peter for
  all your help in this). What this change does is restore that behavior
  but also get rid of the cc_next from the array and instead make it
  be part of the base callout structure. This way no one else will get
  confused since we will never use it for non-direct.
  
  Reviewed by:  Peter Holm and more importantly tested by him ;-)
  MFC after:3 days.
  Sponsored by: Netflix Inc.

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cThu Feb 12 11:57:31 2015
(r278622)
+++ head/sys/kern/kern_timeout.cThu Feb 12 13:31:08 2015
(r278623)
@@ -135,7 +135,6 @@ u_int callwheelsize, callwheelmask;
  * the migrating callout is already running.
  */
 struct cc_exec {
-   struct callout  *cc_next;
struct callout  *cc_curr;
 #ifdef SMP
void(*ce_migration_func)(void *);
@@ -155,6 +154,7 @@ struct cc_exec {
 struct callout_cpu {
struct mtx_padalign cc_lock;
struct cc_exec  cc_exec_entity[2];
+   struct callout  *cc_next;
struct callout  *cc_callout;
struct callout_list *cc_callwheel;
struct callout_tailqcc_expireq;
@@ -167,7 +167,7 @@ struct callout_cpu {
 };
 
 #definecc_exec_curr(cc, dir)   cc->cc_exec_entity[dir].cc_curr
-#definecc_exec_next(cc, dir)   cc->cc_exec_entity[dir].cc_next
+#definecc_exec_next(cc)cc->cc_next
 #definecc_exec_cancel(cc, dir) 
cc->cc_exec_entity[dir].cc_cancel
 #definecc_exec_waiting(cc, dir)
cc->cc_exec_entity[dir].cc_waiting
 #ifdef SMP
@@ -226,7 +226,6 @@ cc_cce_cleanup(struct callout_cpu *cc, i
 {
 
cc_exec_curr(cc, direct) = NULL;
-   cc_exec_next(cc, direct) = NULL;
cc_exec_cancel(cc, direct) = false;
cc_exec_waiting(cc, direct) = false;
 #ifdef SMP
@@ -482,7 +481,7 @@ callout_process(sbintime_t now)
 #ifdef CALLOUT_PROFILING
++depth_dir;
 #endif
-   cc_exec_next(cc, 1) =
+   cc_exec_next(cc) =
LIST_NEXT(tmp, c_links.le);
cc->cc_bucket = firstb & callwheelmask;
LIST_REMOVE(tmp, c_links.le);
@@ -491,7 +490,8 @@ callout_process(sbintime_t now)
&mpcalls_dir, &lockcalls_dir, NULL,
 #endif
1);
-   tmp = cc_exec_next(cc, 1);
+   tmp = cc_exec_next(cc);
+   cc_exec_next(cc) = NULL;
} else {
tmpn = LIST_NEXT(tmp, c_links.le);
LIST_REMOVE(tmp, c_links.le);
@@ -575,7 +575,7 @@ callout_lock(struct callout *c)
 static void
 callout_cc_add(struct callout *c, struct callout_cpu *cc,
 sbintime_t sbt, sbintime_t precision, void (*func)(void *),
-void *arg, int cpu, int flags, int direct)
+void *arg, int cpu, int flags)
 {
int bucket;
 
@@ -584,8 +584,6 @@ callout_cc_add(struct callout *c, struct
sbt = cc->cc_lastscan;
c->c_arg = arg;
c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING);
-   if (flags & C_DIRECT_EXEC)
-   c->c_flags |= CALLOUT_DIRECT;
c->c_flags &= ~CALLOUT_PROCESSED;
c->c_func = func;
c->c_time = sbt;
@@ -596,7 +594,7 @@ callout_cc_add(struct callout *c, struct
(u_int)(c->c_precision & 0x));
LIST_INSERT_HEAD(&cc->cc_callwheel[bucket], c, c_links.le);
if (cc->cc_bucket == bucket)
-   cc_exec_next(cc, direct) = c;
+   cc_exec_next(cc) = c;
 #ifndef NO_EVENTTIMERS
/*
 * Inform the eventtimers(4) subsystem there's a new callout
@@ -790,7 +788,7 @@ skip:
new_cc = callout_cpu_switch(c, cc, new_cpu);
flags = (direct) ? C_DIRECT_EXEC : 0;
callout_cc_add(c, new_cc, new_time, new_prec, new_func,
-   new_arg, new_cpu, flags, direct);
+   new_arg, new_cpu, flags);
 

Re: svn commit: r278616 - in head: . contrib/netbsd-tests/games etc etc/mtree etc/root games games/caesar games/fortune/datfiles release/scripts share/man/man4 share/man/man6 share/man/man7 share/mk s

2015-02-12 Thread Jan Beich
Devin Teske  writes:

> PLEASE! Do NOT remove the grand digital clock (grdc).
>
> So many of us over the years have used it as a terminal keeper-aliver :) (and 
> as a clock, to boot).
>
> I will be very sad if you remove grdc.

Aren't there better alternatives in ports? clock-mode in sysutils/tmux,
sysutils/tty-clock, sysutils/currtime to name a few.

OTOH, grdc(6) lacks a license, unmaintained, has a few PRs with patches.
Not to mention it paints the whole terminal black sans the glitchy
NCURSES_ASSUMED_COLORS=-1,-1.


signature.asc
Description: PGP signature


svn commit: r278625 - head/sys/cam/ctl

2015-02-12 Thread Alexander Motin
Author: mav
Date: Thu Feb 12 15:46:44 2015
New Revision: 278625
URL: https://svnweb.freebsd.org/changeset/base/278625

Log:
  Make XCOPY and WUT commands respect physical block size/offset.
  
  This change by 2-3 times improves performance of misaligned XCOPY and WUT
  commands by avoiding unneeded read-modify-write cycles inside ZFS.
  
  MFC after:1 week

Modified:
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_tpc.c
  head/sys/cam/ctl/ctl_tpc.h
  head/sys/cam/ctl/ctl_tpc_local.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cThu Feb 12 15:34:16 2015
(r278624)
+++ head/sys/cam/ctl/ctl_backend_block.cThu Feb 12 15:46:44 2015
(r278625)
@@ -1187,7 +1187,8 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
struct ctl_be_block_io *beio;
struct ctl_be_block_softc *softc;
struct ctl_lba_len_flags *lbalen;
-   uint64_t len_left, lba, pb, pbo, adj;
+   uint64_t len_left, lba;
+   uint32_t pb, pbo, adj;
int i, seglen;
uint8_t *buf, *end;
 
@@ -1241,8 +1242,11 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
DPRINTF("WRITE SAME at LBA %jx len %u\n",
   (uintmax_t)lbalen->lba, lbalen->len);
 
-   pb = (uint64_t)be_lun->blocksize << be_lun->pblockexp;
-   pbo = pb - (uint64_t)be_lun->blocksize * be_lun->pblockoff;
+   pb = be_lun->blocksize << be_lun->pblockexp;
+   if (be_lun->pblockoff > 0)
+   pbo = pb - be_lun->blocksize * be_lun->pblockoff;
+   else
+   pbo = 0;
len_left = (uint64_t)lbalen->len * be_lun->blocksize;
for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) {
 

Modified: head/sys/cam/ctl/ctl_tpc.c
==
--- head/sys/cam/ctl/ctl_tpc.c  Thu Feb 12 15:34:16 2015(r278624)
+++ head/sys/cam/ctl/ctl_tpc.c  Thu Feb 12 15:46:44 2015(r278625)
@@ -785,18 +785,25 @@ ctl_copy_operation_abort(struct ctl_scsi
 }
 
 static uint64_t
-tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss)
+tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss,
+uint32_t *pb, uint32_t *pbo)
 {
 
if (idx == 0x) {
if (ss && list->lun->be_lun)
*ss = list->lun->be_lun->blocksize;
+   if (pb && list->lun->be_lun)
+   *pb = list->lun->be_lun->blocksize <<
+   list->lun->be_lun->pblockexp;
+   if (pbo && list->lun->be_lun)
+   *pbo = list->lun->be_lun->blocksize *
+   list->lun->be_lun->pblockoff;
return (list->lun->lun);
}
if (idx >= list->ncscd)
return (UINT64_MAX);
return (tpcl_resolve(list->lun->ctl_softc,
-   list->init_port, &list->cscd[idx], ss));
+   list->init_port, &list->cscd[idx], ss, pb, pbo));
 }
 
 static int
@@ -809,7 +816,7 @@ tpc_process_b2b(struct tpc_list *list)
uint64_t sl, dl;
off_t srclba, dstlba, numbytes, donebytes, roundbytes;
int numlba;
-   uint32_t srcblock, dstblock;
+   uint32_t srcblock, dstblock, pb, pbo, adj;
 
if (list->stage == 1) {
while ((tior = TAILQ_FIRST(&list->allio)) != NULL) {
@@ -834,14 +841,16 @@ tpc_process_b2b(struct tpc_list *list)
 
TAILQ_INIT(&list->allio);
seg = (struct scsi_ec_segment_b2b *)list->seg[list->curseg];
-   sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), &srcblock);
-   dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), &dstblock);
+   sl = tpc_resolve(list, scsi_2btoul(seg->src_cscd), &srcblock, NULL, 
NULL);
+   dl = tpc_resolve(list, scsi_2btoul(seg->dst_cscd), &dstblock, &pb, 
&pbo);
if (sl >= CTL_MAX_LUNS || dl >= CTL_MAX_LUNS) {
ctl_set_sense(list->ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_COPY_ABORTED,
/*asc*/ 0x08, /*ascq*/ 0x04, SSD_ELEM_NONE);
return (CTL_RETVAL_ERROR);
}
+   if (pbo > 0)
+   pbo = pb - pbo;
sdstp = &list->cscd[scsi_2btoul(seg->src_cscd)].dtsp;
if (scsi_3btoul(sdstp->block_length) != 0)
srcblock = scsi_3btoul(sdstp->block_length);
@@ -878,7 +887,16 @@ tpc_process_b2b(struct tpc_list *list)
prun = &run;
list->tbdio = 1;
while (donebytes < numbytes) {
-   roundbytes = MIN(numbytes - donebytes, TPC_MAX_IO_SIZE);
+   roundbytes = numbytes - donebytes;
+   if (roundbytes > TPC_MAX_IO_SIZE) {
+   roundbytes = TPC_MAX_IO_SIZE;
+   roundbytes -= roundbytes % dstblock;
+   if (pb > dstblock) {
+   adj = (dstlba * dstblock + roundbytes - pbo) % 
pb;
+  

svn commit: r278627 - head/lib/libthr

2015-02-12 Thread Konstantin Belousov
Author: kib
Date: Thu Feb 12 17:16:54 2015
New Revision: 278627
URL: https://svnweb.freebsd.org/changeset/base/278627

Log:
  Update libthr(3) man page to reflect the work done to support dlopen.
  
  Noted and reviewed by:bdrewery
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libthr/libthr.3

Modified: head/lib/libthr/libthr.3
==
--- head/lib/libthr/libthr.3Thu Feb 12 17:01:54 2015(r278626)
+++ head/lib/libthr/libthr.3Thu Feb 12 17:16:54 2015(r278627)
@@ -1,5 +1,5 @@
 .\" Copyright (c) 2005 Robert N. M. Watson
-.\" Copyright (c) 2014 The FreeBSD Foundation, Inc.
+.\" Copyright (c) 2014,2015 The FreeBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" Part of this documentation was written by
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 26, 2014
+.Dd February 12, 2015
 .Dt LIBTHR 3
 .Os
 .Sh NAME
@@ -200,45 +200,25 @@ Bigger values reduce the frequency of th
 The value must be between 0 and 255.
 .El
 .Sh INTERACTION WITH RUN-TIME LINKER
-The
+On load,
 .Nm
-library must appear before
-.Li libc
-in the global order of depended objects.
-.Pp
-Loading
-.Nm
-with the
-.Xr dlopen 3
-call in the process after the program binary is activated
-is not supported, and causes miscellaneous and hard-to-diagnose misbehaviour.
-This is due to
-.Nm
-interposing several important
-.Li libc
-symbols to provide thread-safe services.
-In particular,
-.Dv errno
-and the locking stubs from
-.Li libc
-are affected.
-This requirement is currently not enforced.
-.Pp
-If the program loads any modules at run-time, and those modules may require
-threading services, the main program binary must be linked with
-.Li libpthread ,
-even if it does not require any services from the library.
+installs interposing handlers into the hooks exported by
+.Li libc .
+The interposers provide real locking implementation instead of the
+stubs for single-threaded processes in
+.Li ,
+cancellation support and some modifications to the signal operations.
 .Pp
 .Nm
 cannot be unloaded; the
 .Xr dlclose 3
 function does not perform any action when called with a handle for
 .Nm .
-One of the reasons is that the interposing of
+One of the reasons is that the internal interposing of
 .Li libc
 functions cannot be undone.
 .Sh SIGNALS
-The implementation also interposes the user-installed
+The implementation interposes the user-installed
 .Xr signal 3
 handlers.
 This interposing is done to postpone signal delivery to threads which
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278633 - head/bin/pkill/tests

2015-02-12 Thread Garrett Cooper
Author: ngie
Date: Thu Feb 12 20:57:57 2015
New Revision: 278633
URL: https://svnweb.freebsd.org/changeset/base/278633

Log:
  Refactor the tests
  
  1. `id -u` -> 0 is now only checked once; the entire test script is now 
skipped
 if this assertion is violated
  2. De-dent whitespace, based on 1.
  3. Only setup the symlink for $sleep once at the top of the script, and tear 
it
 down once at the bottom of the script

Modified:
  head/bin/pkill/tests/pgrep-j_test.sh

Modified: head/bin/pkill/tests/pgrep-j_test.sh
==
--- head/bin/pkill/tests/pgrep-j_test.shThu Feb 12 20:35:30 2015
(r278632)
+++ head/bin/pkill/tests/pgrep-j_test.shThu Feb 12 20:57:57 2015
(r278633)
@@ -19,79 +19,68 @@ jail_name_to_jid()
 
 base=pgrep_j_test
 
+if [ `id -u` -ne 0 ]; then
+   echo "1..0 # skip Test needs uid 0."
+   exit 0
+fi
+
 echo "1..3"
 
+sleep=$(pwd)/sleep.txt
+ln -sf /bin/sleep $sleep
+
 name="pgrep -j "
-if [ `id -u` -eq 0 ]; then
-   sleep=$(pwd)/sleep.txt
-   ln -sf /bin/sleep $sleep
-   jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
-   command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
-
-   jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
-   command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
-
-   jid1=$(jail_name_to_jid ${base}_1_1)
-   jid2=$(jail_name_to_jid ${base}_1_2)
-   jid="${jid1},${jid2}"
-   pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)"
-   pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
-   $(cat ${PWD}/${base}_1_2.pid) | sort)
-   if [ "$pid1" = "$pid2" ]; then
-   echo "ok 1 - $name"
-   else
-   echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile 
output: '$(echo $pid2)'"
-   fi
-   [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
-   [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
-   rm -f $sleep
+jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
+
+jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
+
+jid1=$(jail_name_to_jid ${base}_1_1)
+jid2=$(jail_name_to_jid ${base}_1_2)
+jid="${jid1},${jid2}"
+pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)"
+pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
+$(cat ${PWD}/${base}_1_2.pid) | sort)
+if [ "$pid1" = "$pid2" ]; then
+   echo "ok 1 - $name"
 else
-   echo "ok 1 - $name # skip Test needs uid 0."
+   echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile output: 
'$(echo $pid2)'"
 fi
+[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
+[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
 
 name="pgrep -j any"
-if [ `id -u` -eq 0 ]; then
-   sleep=$(pwd)/sleep.txt
-   ln -sf /bin/sleep $sleep
-   jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
-   command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
-
-   jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
-   command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
-
-   sleep 2
-   pid1="$(pgrep -f -x -j any "$sleep 5" | sort)"
-   pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
-   $(cat ${PWD}/${base}_2_2.pid) | sort)
-   if [ "$pid1" = "$pid2" ]; then
-   echo "ok 2 - $name"
-   else
-   echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile 
output: '$(echo $pid2)'"
-   fi
-   [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
-   [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
-   rm -f $sleep
+jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
+
+jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
+command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
+
+sleep 2
+pid1="$(pgrep -f -x -j any "$sleep 5" | sort)"
+pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
+$(cat ${PWD}/${base}_2_2.pid) | sort)
+if [ "$pid1" = "$pid2" ]; then
+   echo "ok 2 - $name"
 else
-   echo "ok 2 - $name # skip Test needs uid 0."
+   echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile output: 
'$(echo $pid2)'"
 fi
+[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
+[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
 
 name="pgrep -j none"
-if [ `id -u` -eq 0 ]; then
-   sleep=$(pwd)/sleep.txt
-   ln -sf /bin/sleep $sleep
-   daemon -p ${PWD}/${base}_3_1.pid $sleep 5 &
-   jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
-   command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
-   sleep 2
-   pid="$(pgrep -f -x -j none "$sleep 5")"
-   if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
-   echo "ok 

svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb 12 21:07:42 2015
New Revision: 278634
URL: https://svnweb.freebsd.org/changeset/base/278634

Log:
  ulimit(3): Fix broken check.
  
  The existing implementation had a broken comparison that could overflow.
  Replace this with a check that avoids the overflow before it happens.
  
  Consistently return a maximum value also on the case of negative
  arguments since negative is considered an overflow and means
  infinity for our current setrlimit().
  
  Discussed with:   bde (rather extensively)
  
  CID:  1199295
  MFC after:1 week

Modified:
  head/lib/libc/gen/ulimit.c

Modified: head/lib/libc/gen/ulimit.c
==
--- head/lib/libc/gen/ulimit.c  Thu Feb 12 20:57:57 2015(r278633)
+++ head/lib/libc/gen/ulimit.c  Thu Feb 12 21:07:42 2015(r278634)
@@ -53,13 +53,13 @@ ulimit(int cmd, ...)
va_start(ap, cmd);
arg = va_arg(ap, long);
va_end(ap);
+   if (arg > RLIM_INFINITY / 512 || arg < 0)
+   arg = RLIM_INFINITY / 512;
limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512;
 
/* The setrlimit() function sets errno to EPERM if needed. */
if (setrlimit(RLIMIT_FSIZE, &limit) == -1)
return (-1);
-   if (arg * 512 > LONG_MAX)
-   return (LONG_MAX);
return (arg);
} else {
errno = EINVAL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278636 - head/bin/pkill/tests

2015-02-12 Thread Garrett Cooper
Author: ngie
Date: Thu Feb 12 21:10:32 2015
New Revision: 278636
URL: https://svnweb.freebsd.org/changeset/base/278636

Log:
  Parameterize out the amount of sleep done in each test
  
  Set the value in each test to a different amount to avoid potential
  side-effects with other instances of the test (or lingering processes) still
  being present on the system

Modified:
  head/bin/pkill/tests/pgrep-j_test.sh

Modified: head/bin/pkill/tests/pgrep-j_test.sh
==
--- head/bin/pkill/tests/pgrep-j_test.shThu Feb 12 21:10:24 2015
(r278635)
+++ head/bin/pkill/tests/pgrep-j_test.shThu Feb 12 21:10:32 2015
(r278636)
@@ -30,16 +30,17 @@ sleep=$(pwd)/sleep.txt
 ln -sf /bin/sleep $sleep
 
 name="pgrep -j "
+sleep_amount=5
 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
+command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount &
 
 jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
+command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount &
 
 jid1=$(jail_name_to_jid ${base}_1_1)
 jid2=$(jail_name_to_jid ${base}_1_2)
 jid="${jid1},${jid2}"
-pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)"
+pid1="$(pgrep -f -x -j $jid "$sleep $sleep_amount" | sort)"
 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
 $(cat ${PWD}/${base}_1_2.pid) | sort)
 if [ "$pid1" = "$pid2" ]; then
@@ -51,14 +52,15 @@ fi
 [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
 
 name="pgrep -j any"
+sleep_amount=6
 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
+command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount &
 
 jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
+command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount &
 
 sleep 2
-pid1="$(pgrep -f -x -j any "$sleep 5" | sort)"
+pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)"
 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
 $(cat ${PWD}/${base}_2_2.pid) | sort)
 if [ "$pid1" = "$pid2" ]; then
@@ -70,11 +72,12 @@ fi
 [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
 
 name="pgrep -j none"
-daemon -p ${PWD}/${base}_3_1.pid $sleep 5 &
+sleep_amount=7
+daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount &
 jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
-command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
+command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount &
 sleep 2
-pid="$(pgrep -f -x -j none "$sleep 5")"
+pid="$(pgrep -f -x -j none "$sleep $sleep_amount")"
 if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
echo "ok 3 - $name"
 else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278323 - in head: etc/rc.d usr.sbin/jail

2015-02-12 Thread Garrett Cooper
On Feb 9, 2015, at 18:51, James Gritton  wrote:

> On 2015-02-06 22:23, Garrett Cooper wrote:
>> On Feb 6, 2015, at 18:38, James Gritton  wrote:
>>> On 2015-02-06 19:23, Garrett Cooper wrote:
 I think you broke the Jenkins tests runs, and potentially jail support
 in some edgecases:
 https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/651/
>>> Where do I go from here?  There error you refer to certainly seems 
>>> jail-related, which leads me to guess at something disconnected between the 
>>> matching rc.d/jail and jail(8) change (i.e. using the new rc file with the 
>>> old jail program).  But that's really just a wild guess.  Is there 
>>> somewhere I look for more information?  For example, where does Jenkins 
>>> actually do its thing?
>>> Sorry for being so stupid in this - Jenkins has only been on the very edge 
>>> of my awareness until now.
>> I honestly don’t think it’s Jenkins because Jenkins runs in bhyve. I
>> think you accidentally broke option handling in the jail configuration
>> (please see my other reply about added “break;” statements).
>> ...
>> You can verify your changes by doing:
>> % (cd /usr/tests/bin/pkill; sudo kyua test)
> 
> After some testing and looking around, I've decided the problem definitely 
> isn't in rc.d where I thought it might be.  I've also decided it's probably 
> not in my patch either.
> 
> I've run this kyua test on a 10 system (don't have current handy for such 
> things at the moment), and sometimes I would see a failure and sometimes I 
> wouldn't.  This was whether I was using the new or old jail code.  Later in 
> the day, when the box was less loaded, it seemed to always pass.  Looking at 
> the pkill-j_test script, I see jails being created with sleep commands both 
> inside and outside the jail around its creation.  I'm guessing this script is 
> very sensitive to timing issues that could be cause by (among other things) 
> system load.  The jail commands in this script were also very simple, with 
> the only parameters used being: path, name, ip4.addr, and command.  This 
> isn't some kind of esoteric exercising of the jail(8) options, and I would 
> expect if it works at one time it would work at another.  I've "hand-run" 
> these particular jail commands and couldn't get them to fail (and the actual 
> content of the jail(8) changes were tests already).
> 
> I looked at the freebsd-current (I think) list where the Jenkins errors are 
> posted, and it's true it started failing the pkill-j test at the time I made 
> my change.  But it's also true that it had failed that test once the day 
> before my change, and then started passing it again.  This particular test 
> just seems to be fragile.
> 
> So I don't have anywhere else to go with this.  I'm going to assume jail(8) 
> isn't the problem here.

The tests are racy and make some interesting assumptions. It appears that 
WITNESS plays a part in it, and I bet VIMAGE (something that I don’t have in my 
kernel config) plays a part in it too. I say this because I just ran into the 
issue when running the tests in a tight loop on my VMware workstation 7 
instance with code from r278636.

Doesn’t surprise me because before r272305, it was failing consistently on 
head, so what Craig did in that commit helped, but it didn’t fully fix the 
raciness of the tests.

I’m going to recompile my system with VIMAGE and see if that impacts 
performance of the tests, and if so, I’ll adjust the sleep between setting up 
the jailed instances, and waiting for them to be fully formed.

Thanks!

$ while : ; do sudo prove -rv pgrep-j_test.sh || break; done
pgrep-j_test.sh .. 
1..3
usage: pgrep [-LSfilnoqvx] [-d delim] [-F pidfile] [-G gid] [-M core] [-N 
system]
 [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]
 [-s sid] [-t tty] [-u euid] pattern ...
not ok 1 - pgrep -j  # pgrep output: '', pidfile output: '74275 74278'
ok 2 - pgrep -j any
ok 3 - pgrep -j none
Failed 1/3 subtests 

Test Summary Report
---
pgrep-j_test.sh (Wstat: 0 Tests: 3 Failed: 1)
  Failed test:  1
Files=1, Tests=3,  5 wallclock secs ( 0.04 usr  0.02 sys +  0.02 cusr  0.55 
csys =  0.63 CPU)
Result: FAIL


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r278323 - in head: etc/rc.d usr.sbin/jail

2015-02-12 Thread Garrett Cooper
On Feb 12, 2015, at 13:12, Garrett Cooper  wrote:

> On Feb 9, 2015, at 18:51, James Gritton  wrote:
> 
>> On 2015-02-06 22:23, Garrett Cooper wrote:
>>> On Feb 6, 2015, at 18:38, James Gritton  wrote:
 On 2015-02-06 19:23, Garrett Cooper wrote:
> I think you broke the Jenkins tests runs, and potentially jail support
> in some edgecases:
> https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/651/
 Where do I go from here?  There error you refer to certainly seems 
 jail-related, which leads me to guess at something disconnected between 
 the matching rc.d/jail and jail(8) change (i.e. using the new rc file with 
 the old jail program).  But that's really just a wild guess.  Is there 
 somewhere I look for more information?  For example, where does Jenkins 
 actually do its thing?
 Sorry for being so stupid in this - Jenkins has only been on the very edge 
 of my awareness until now.
>>> I honestly don’t think it’s Jenkins because Jenkins runs in bhyve. I
>>> think you accidentally broke option handling in the jail configuration
>>> (please see my other reply about added “break;” statements).
>>> ...
>>> You can verify your changes by doing:
>>> % (cd /usr/tests/bin/pkill; sudo kyua test)
>> 
>> After some testing and looking around, I've decided the problem definitely 
>> isn't in rc.d where I thought it might be.  I've also decided it's probably 
>> not in my patch either.
>> 
>> I've run this kyua test on a 10 system (don't have current handy for such 
>> things at the moment), and sometimes I would see a failure and sometimes I 
>> wouldn't.  This was whether I was using the new or old jail code.  Later in 
>> the day, when the box was less loaded, it seemed to always pass.  Looking at 
>> the pkill-j_test script, I see jails being created with sleep commands both 
>> inside and outside the jail around its creation.  I'm guessing this script 
>> is very sensitive to timing issues that could be cause by (among other 
>> things) system load.  The jail commands in this script were also very 
>> simple, with the only parameters used being: path, name, ip4.addr, and 
>> command.  This isn't some kind of esoteric exercising of the jail(8) 
>> options, and I would expect if it works at one time it would work at 
>> another.  I've "hand-run" these particular jail commands and couldn't get 
>> them to fail (and the actual content of the jail(8) changes were tests 
>> already).
>> 
>> I looked at the freebsd-current (I think) list where the Jenkins errors are 
>> posted, and it's true it started failing the pkill-j test at the time I made 
>> my change. But it's also true that it had failed that test once the day 
>> before my change, and then started passing it again.  This particular test 
>> just seems to be fragile.
>> 
>> So I don't have anywhere else to go with this.  I'm going to assume jail(8) 
>> isn't the problem here.
> 
> The tests are racy and make some interesting assumptions. It appears that 
> WITNESS plays a part in it, and I bet VIMAGE (something that I don’t have in 
> my kernel config) plays a part in it too. I say this because I just ran into 
> the issue when running the tests in a tight loop on my VMware workstation 7 
> instance with code from r278636.
> 
> Doesn’t surprise me because before r272305, it was failing consistently on 
> head, so what Craig did in that commit helped, but it didn’t fully fix the 
> raciness of the tests.
> 
> I’m going to recompile my system with VIMAGE and see if that impacts 
> performance of the tests, and if so, I’ll adjust the sleep between setting up 
> the jailed instances, and waiting for them to be fully formed.
> 
> Thanks!
> 
> $ while : ; do sudo prove -rv pgrep-j_test.sh || break; done
> pgrep-j_test.sh .. 
> 1..3
> usage: pgrep [-LSfilnoqvx] [-d delim] [-F pidfile] [-G gid] [-M core] [-N 
> system]
> [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]
> [-s sid] [-t tty] [-u euid] pattern ...
> not ok 1 - pgrep -j  # pgrep output: '', pidfile output: '74275 74278'
> ok 2 - pgrep -j any
> ok 3 - pgrep -j none
> Failed 1/3 subtests 
> 
> Test Summary Report
> ---
> pgrep-j_test.sh (Wstat: 0 Tests: 3 Failed: 1)
>  Failed test:  1
> Files=1, Tests=3,  5 wallclock secs ( 0.04 usr  0.02 sys +  0.02 cusr  0.55 
> csys =  0.63 CPU)
> Result: FAIL

This Jenkins run is interesting: 
https://jenkins.freebsd.org/job/FreeBSD_HEAD-tests2/686/testReport/junit/bin.pkill/pgrep-j_test/main/
 . The first run passed, but the second one didn’t (more output than expected). 
This error shouldn’t occur after r278636, but it definitely confirms the fact 
that the test is racy, in other ways.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r278475 - head/usr.sbin/pw/tests

2015-02-12 Thread Garrett Cooper
Hi Brad,

On Feb 9, 2015, at 13:15, Brad Davis  wrote:

> Author: brd (doc committer)
> Date: Mon Feb  9 21:15:52 2015
> New Revision: 278475
> URL: https://svnweb.freebsd.org/changeset/base/278475
> 
> Log:
>  Add tests for `pw usernext'.
> 
>  PR:  197120
>  Submitted by:Robert O'Neil 
>  Approved by: will
> 
> Added:
>  head/usr.sbin/pw/tests/pw_usernext.sh   (contents, props changed)
> Modified:
>  head/usr.sbin/pw/tests/Makefile

…

> + var0=1
> + LIMIT=`jot -r 1 2 10`
> + while [ "$var0" -lt "$LIMIT" ]
> + do
> + atf_check -s exit:0 ${PW} useradd -n test$var0 -g 0
> + var0=`expr $var0 + 1`
> + done
> + atf_check -s exit:0 -o match:"100${LIMIT}:1001}” \

This line is incorrect (there’s a trailing `}` after 1001).

Removing it will fix the test, but is assuming that 1001 will always be the 
next group correct (it’s correct in the default install, but IIRC it wasn’t 
correct if you started groups at gid=500)?

Wouldn’t it be safer to create a bogus group, get the gid for the group, then 
test to ensure that that god is matched?

Thanks!


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r278640 - head/sys/netgraph

2015-02-12 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 12 22:20:34 2015
New Revision: 278640
URL: https://svnweb.freebsd.org/changeset/base/278640

Log:
  Revise default limit for maximum of netgraph data items.
  With modern internet speeds the limit can be reached even
  on a single L2TP link.

Modified:
  head/sys/netgraph/ng_base.c

Modified: head/sys/netgraph/ng_base.c
==
--- head/sys/netgraph/ng_base.c Thu Feb 12 21:20:28 2015(r278639)
+++ head/sys/netgraph/ng_base.c Thu Feb 12 22:20:34 2015(r278640)
@@ -2952,7 +2952,7 @@ uma_zone_tng_qzone;
 uma_zone_t ng_qdzone;
 static int numthreads = 0; /* number of queue threads */
 static int maxalloc = 4096;/* limit the damage of a leak */
-static int maxdata = 512;  /* limit the damage of a DoS */
+static int maxdata = 4096; /* limit the damage of a DoS */
 
 SYSCTL_INT(_net_graph, OID_AUTO, threads, CTLFLAG_RDTUN, &numthreads,
 0, "Number of queue processing threads");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Bjoern A. Zeeb

> On 12 Feb 2015, at 21:07 , Pedro F. Giffuni  wrote:
> 
> Author: pfg
> Date: Thu Feb 12 21:07:42 2015
> New Revision: 278634
> URL: https://svnweb.freebsd.org/changeset/base/278634
> 
> Log:
>  ulimit(3): Fix broken check.
> 
>  The existing implementation had a broken comparison that could overflow.
>  Replace this with a check that avoids the overflow before it happens.
> 
>  Consistently return a maximum value also on the case of negative
>  arguments since negative is considered an overflow and means
>  infinity for our current setrlimit().
> 
>  Discussed with:  bde (rather extensively)
> 

Did this compile?


>  CID: 1199295
>  MFC after:   1 week
> 
> Modified:
>  head/lib/libc/gen/ulimit.c
> 
> Modified: head/lib/libc/gen/ulimit.c
> ==
> --- head/lib/libc/gen/ulimit.cThu Feb 12 20:57:57 2015
> (r278633)
> +++ head/lib/libc/gen/ulimit.cThu Feb 12 21:07:42 2015
> (r278634)
> @@ -53,13 +53,13 @@ ulimit(int cmd, ...)
>   va_start(ap, cmd);
>   arg = va_arg(ap, long);
>   va_end(ap);
> + if (arg > RLIM_INFINITY / 512 || arg < 0)
> + arg = RLIM_INFINITY / 512;
>   limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512;
> 
>   /* The setrlimit() function sets errno to EPERM if needed. */
>   if (setrlimit(RLIMIT_FSIZE, &limit) == -1)
>   return (-1);
> - if (arg * 512 > LONG_MAX)
> - return (LONG_MAX);
>   return (arg);
>   } else {
>   errno = EINVAL;
> 

— 
Bjoern A. Zeeb  Charles Haddon Spurgeon:
"Friendship is one of the sweetest joys of life.  Many might have failed
 beneath the bitterness of their trial  had they not found a friend."

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r278080 - head/sbin/ifconfig

2015-02-12 Thread Gleb Smirnoff
On Mon, Feb 02, 2015 at 01:03:05PM +, Vsevolod Stakhov wrote:
V> Author: vsevolod (ports committer)
V> Date: Mon Feb  2 13:03:04 2015
V> New Revision: 278080
V> URL: https://svnweb.freebsd.org/changeset/base/278080
V> 
V> Log:
V>   Reorganize the list of addresses associated with an interface and group 
them
V>   based on the address family. This should help to recognize interfaces with
V>   multiple AF (e.g. ipv4 and ipv6) with many aliases or additional 
addresses. The
V>   order of addresses inside a single group is strictly preserved.
V>   
V>   Improve the scope_id output for AF_INET6 families, as the
V>   current approach uses hexadecimal string that is basically the ID of an
V>   interface, whilst this information is already depicted by getnameinfo(3) 
call.
V>   Therefore, now ifconfig just prints the scope of address as it is defined 
in
V>   2.4 of RFC 2373.
V>   
V>   PR:197270
V>   Approved by:   bapt
V>   MFC after: 2 weeks

What about getifaddrs(3) sorting addresses?

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Pedro Giffuni


On 02/12/15 17:27, Bjoern A. Zeeb wrote:

On 12 Feb 2015, at 21:07 , Pedro F. Giffuni  wrote:

Author: pfg
Date: Thu Feb 12 21:07:42 2015
New Revision: 278634
URL: https://svnweb.freebsd.org/changeset/base/278634

Log:
  ulimit(3): Fix broken check.

  The existing implementation had a broken comparison that could overflow.
  Replace this with a check that avoids the overflow before it happens.

  Consistently return a maximum value also on the case of negative
  arguments since negative is considered an overflow and means
  infinity for our current setrlimit().

  Discussed with:   bde (rather extensively)


Did this compile?



Yes! Any log message to share?

Pedro.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Bjoern A. Zeeb

> On 12 Feb 2015, at 22:34 , Pedro Giffuni  wrote:
> 
> 
> On 02/12/15 17:27, Bjoern A. Zeeb wrote:
>>> On 12 Feb 2015, at 21:07 , Pedro F. Giffuni  wrote:
>>> 
>>> Author: pfg
>>> Date: Thu Feb 12 21:07:42 2015
>>> New Revision: 278634
>>> URL: https://svnweb.freebsd.org/changeset/base/278634
>>> 
>>> Log:
>>>  ulimit(3): Fix broken check.
>>> 
>>>  The existing implementation had a broken comparison that could overflow.
>>>  Replace this with a check that avoids the overflow before it happens.
>>> 
>>>  Consistently return a maximum value also on the case of negative
>>>  arguments since negative is considered an overflow and means
>>>  infinity for our current setrlimit().
>>> 
>>>  Discussed with:bde (rather extensively)
>>> 
>> Did this compile?
>> 
> 
> Yes! Any log message to share?

Now I do again; had lost them due to buildworld starting over again:

===> lib/libc_nonshared (obj,depend,all,install)
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c: In function 'ulimit':
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:56: warning: comparison is 
always false due to limited range of data type
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:57: warning: overflow in 
implicit constant conversion
--- ulimit.So ---
*** [ulimit.So] Error code 1


mips.mipsn32 buildworld failed, check _.mips.mipsn32.buildworld for details
mips.mips buildworld failed, check _.mips.mips.buildworld for details
powerpc.powerpc buildworld failed, check _.powerpc.powerpc.buildworld for 
details
mips.mipsel buildworld failed, check _.mips.mipsel.buildworld for details
arm.armeb buildworld failed, check _.arm.armeb.buildworld for details
arm.armv6hf buildworld failed, check _.arm.armv6hf.buildworld for details
arm.arm buildworld failed, check _.arm.arm.buildworld for details
arm.armv6 buildworld failed, check _.arm.armv6.buildworld for details
pc98.i386 buildworld failed, check _.pc98.i386.buildworld for details
i386.i386 buildworld failed, check _.i386.i386.buildworld for details
powerpc.powerpc64 buildworld failed, check _.powerpc.powerpc64.buildworld for 
details
amd64.amd64 buildworld failed, check _.amd64.amd64.buildworld for details


___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278641 - head/tools/tools/netmap

2015-02-12 Thread George V. Neville-Neil
Author: gnn
Date: Thu Feb 12 23:00:31 2015
New Revision: 278641
URL: https://svnweb.freebsd.org/changeset/base/278641

Log:
  Silence a warning.

Modified:
  head/tools/tools/netmap/pkt-gen.c

Modified: head/tools/tools/netmap/pkt-gen.c
==
--- head/tools/tools/netmap/pkt-gen.c   Thu Feb 12 22:20:34 2015
(r278640)
+++ head/tools/tools/netmap/pkt-gen.c   Thu Feb 12 23:00:31 2015
(r278641)
@@ -1817,7 +1817,7 @@ main(int arc, char **argv)
 
}
 
-   if (g.ifname == NULL) {
+   if (strlen(g.ifname) <=0 ) {
D("missing ifname");
usage();
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278642 - in head/usr.bin: chpass passwd

2015-02-12 Thread Baptiste Daroussin
Author: bapt
Date: Thu Feb 12 23:08:27 2015
New Revision: 278642
URL: https://svnweb.freebsd.org/changeset/base/278642

Log:
  Use PRECIOUSPROG instead of custom code to handle schg
  
  This allows to preserve schg when installed with -DNO_ROOT
  
  MFC after:1 week

Modified:
  head/usr.bin/chpass/Makefile
  head/usr.bin/passwd/Makefile

Modified: head/usr.bin/chpass/Makefile
==
--- head/usr.bin/chpass/MakefileThu Feb 12 23:00:31 2015
(r278641)
+++ head/usr.bin/chpass/MakefileThu Feb 12 23:08:27 2015
(r278642)
@@ -9,6 +9,7 @@ PROG=   chpass
 SRCS=  chpass.c edit.c field.c pw_scan.c table.c util.c
 BINOWN=root
 BINMODE=4555
+PRECIOUSPROG=
 .if ${MK_NIS} != "no"
 CFLAGS+= -DYP
 .endif
@@ -34,16 +35,4 @@ MLINKS=  chpass.1 chfn.1 chpass.1 chsh.1
 MLINKS+= chpass.1 ypchpass.1 chpass.1 ypchfn.1 chpass.1 ypchsh.1
 .endif
 
-beforeinstall:
-.for i in chpass chfn chsh ypchpass ypchfn ypchsh
-.if exists(${DESTDIR}${BINDIR}/$i)
-   -chflags noschg ${DESTDIR}${BINDIR}/$i
-.endif
-.endfor
-
-.if !defined(NO_FSCHG)
-afterinstall:
-   -chflags schg ${DESTDIR}${BINDIR}/chpass
-.endif
-
 .include 

Modified: head/usr.bin/passwd/Makefile
==
--- head/usr.bin/passwd/MakefileThu Feb 12 23:00:31 2015
(r278641)
+++ head/usr.bin/passwd/MakefileThu Feb 12 23:08:27 2015
(r278642)
@@ -7,20 +7,10 @@ PROG   = passwd
 BINOWN  = root
 BINMODE = 4555
 LIBADD   = pam
+PRECIOUSPROG=
 .if ${MK_NIS} != "no"
 LINKS   = ${BINDIR}/passwd ${BINDIR}/yppasswd
 MLINKS  = passwd.1 yppasswd.1
 .endif
 
-beforeinstall:
-.for i in passwd yppasswd
-   [ ! -e ${DESTDIR}${BINDIR}/$i ] || \
-   chflags noschg ${DESTDIR}${BINDIR}/$i || true
-.endfor
-
-.if !defined(NO_FSCHG)
-afterinstall:
-   -chflags schg ${DESTDIR}${BINDIR}/passwd
-.endif
-
 .include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Pedro Giffuni


On 02/12/15 17:44, Bjoern A. Zeeb wrote:

On 12 Feb 2015, at 22:34 , Pedro Giffuni  wrote:


On 02/12/15 17:27, Bjoern A. Zeeb wrote:

On 12 Feb 2015, at 21:07 , Pedro F. Giffuni  wrote:

Author: pfg
Date: Thu Feb 12 21:07:42 2015
New Revision: 278634
URL: https://svnweb.freebsd.org/changeset/base/278634

Log:
  ulimit(3): Fix broken check.

  The existing implementation had a broken comparison that could overflow.
  Replace this with a check that avoids the overflow before it happens.

  Consistently return a maximum value also on the case of negative
  arguments since negative is considered an overflow and means
  infinity for our current setrlimit().

  Discussed with:   bde (rather extensively)


Did this compile?


Yes! Any log message to share?

Now I do again; had lost them due to buildworld starting over again:

===> lib/libc_nonshared (obj,depend,all,install)
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c: In function 'ulimit':
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:56: warning: comparison is 
always false due to limited range of data type
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:57: warning: overflow in 
implicit constant conversion
--- ulimit.So ---
*** [ulimit.So] Error code 1


mips.mipsn32 buildworld failed, check _.mips.mipsn32.buildworld for details
mips.mips buildworld failed, check _.mips.mips.buildworld for details
powerpc.powerpc buildworld failed, check _.powerpc.powerpc.buildworld for 
details
mips.mipsel buildworld failed, check _.mips.mipsel.buildworld for details
arm.armeb buildworld failed, check _.arm.armeb.buildworld for details
arm.armv6hf buildworld failed, check _.arm.armv6hf.buildworld for details
arm.arm buildworld failed, check _.arm.arm.buildworld for details
arm.armv6 buildworld failed, check _.arm.armv6.buildworld for details
pc98.i386 buildworld failed, check _.pc98.i386.buildworld for details
i386.i386 buildworld failed, check _.i386.i386.buildworld for details
powerpc.powerpc64 buildworld failed, check _.powerpc.powerpc64.buildworld for 
details
amd64.amd64 buildworld failed, check _.amd64.amd64.buildworld for details



Thank you!

This will sound strange but I can't confirm, and I can't see anything
obviously wrong.

I have the revert ready but let me wait for jenkins to catch the
failure first.

Pedro.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Garrett Cooper
On Feb 12, 2015, at 15:14, Pedro Giffuni  wrote:

> On 02/12/15 17:44, Bjoern A. Zeeb wrote:
>>> On 12 Feb 2015, at 22:34 , Pedro Giffuni  wrote:

...

> Thank you!
> 
> This will sound strange but I can't confirm, and I can't see anything
> obviously wrong.
> 
> I have the revert ready but let me wait for jenkins to catch the
> failure first.

it broke the Jenkins build as well:

https://jenkins.freebsd.org/job/FreeBSD_HEAD/2364/console

Thanks!


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r278649 - head/lib/libc/gen

2015-02-12 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 13 00:21:54 2015
New Revision: 278649
URL: https://svnweb.freebsd.org/changeset/base/278649

Log:
  Revert 278634: This broke the build due to the compiler being too clever.
  
  Will be back, with proper compiler workarounds.

Modified:
  head/lib/libc/gen/ulimit.c

Modified: head/lib/libc/gen/ulimit.c
==
--- head/lib/libc/gen/ulimit.c  Fri Feb 13 00:17:22 2015(r278648)
+++ head/lib/libc/gen/ulimit.c  Fri Feb 13 00:21:54 2015(r278649)
@@ -53,13 +53,13 @@ ulimit(int cmd, ...)
va_start(ap, cmd);
arg = va_arg(ap, long);
va_end(ap);
-   if (arg > RLIM_INFINITY / 512 || arg < 0)
-   arg = RLIM_INFINITY / 512;
limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512;
 
/* The setrlimit() function sets errno to EPERM if needed. */
if (setrlimit(RLIMIT_FSIZE, &limit) == -1)
return (-1);
+   if (arg * 512 > LONG_MAX)
+   return (LONG_MAX);
return (arg);
} else {
errno = EINVAL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Pedro Giffuni


On 02/12/15 18:54, Garrett Cooper wrote:

On Feb 12, 2015, at 15:14, Pedro Giffuni  wrote:


On 02/12/15 17:44, Bjoern A. Zeeb wrote:

On 12 Feb 2015, at 22:34 , Pedro Giffuni  wrote:

...


Thank you!

This will sound strange but I can't confirm, and I can't see anything
obviously wrong.

I have the revert ready but let me wait for jenkins to catch the
failure first.

it broke the Jenkins build as well:

https://jenkins.freebsd.org/job/FreeBSD_HEAD/2364/console

Thanks!

Thank you ... I can reproduce it now.

Pedro.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278653 - head/bin/pkill/tests

2015-02-12 Thread Garrett Cooper
Author: ngie
Date: Fri Feb 13 01:07:12 2015
New Revision: 278653
URL: https://svnweb.freebsd.org/changeset/base/278653

Log:
  Call wait to ensure that background processes have died
  
  This is being done to establish parity with pgrep-j_test

Modified:
  head/bin/pkill/tests/pgrep-j_test.sh

Modified: head/bin/pkill/tests/pgrep-j_test.sh
==
--- head/bin/pkill/tests/pgrep-j_test.shFri Feb 13 00:49:47 2015
(r278652)
+++ head/bin/pkill/tests/pgrep-j_test.shFri Feb 13 01:07:12 2015
(r278653)
@@ -50,6 +50,7 @@ else
 fi
 [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
 [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
+wait
 
 name="pgrep -j any"
 sleep_amount=6
@@ -70,6 +71,7 @@ else
 fi
 [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
 [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
+wait
 
 name="pgrep -j none"
 sleep_amount=7
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278653 - head/bin/pkill/tests

2015-02-12 Thread Garrett Cooper
On Feb 12, 2015, at 17:07, Garrett Cooper  wrote:

> Author: ngie
> Date: Fri Feb 13 01:07:12 2015
> New Revision: 278653
> URL: https://svnweb.freebsd.org/changeset/base/278653
> 
> Log:
>  Call wait to ensure that background processes have died
> 
>  This is being done to establish parity with pgrep-j_test

I meant pkill-j_test.


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r278654 - head/sbin/sysctl

2015-02-12 Thread John-Mark Gurney
Author: jmg
Date: Fri Feb 13 01:20:37 2015
New Revision: 278654
URL: https://svnweb.freebsd.org/changeset/base/278654

Log:
  add support for specifying an initial buffer size when fetching a
  sysctl... This is useful for kern.arandom which (without -B) will
  happily return 0 bytes, which isn't too useful or random...
  
  fix spelling (thanks igor!) of settable while I'm here...

Modified:
  head/sbin/sysctl/sysctl.8
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.8
==
--- head/sbin/sysctl/sysctl.8   Fri Feb 13 01:07:12 2015(r278653)
+++ head/sbin/sysctl/sysctl.8   Fri Feb 13 01:20:37 2015(r278654)
@@ -28,7 +28,7 @@
 .\"From: @(#)sysctl.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd December 13, 2012
+.Dd February 12, 2015
 .Dt SYSCTL 8
 .Os
 .Sh NAME
@@ -37,11 +37,13 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl bdehiNnoRTqx
+.Op Fl B Ar bufsize
 .Op Fl f Ar filename
 .Ar name Ns Op = Ns Ar value
 .Ar ...
 .Nm
 .Op Fl bdehNnoRTqx
+.Op Fl B Ar bufsize
 .Fl a
 .Sh DESCRIPTION
 The
@@ -68,6 +70,15 @@ the command line.
 Force the value of the variable(s) to be output in raw, binary format.
 No names are printed and no terminating newlines are output.
 This is mostly useful with a single variable.
+.It Fl B Ar bufsize
+Set the buffer size to read from the
+.Nm
+to
+.Ar bufsize .
+This is necessary for a
+.Nm
+that has variable length, and the probe value of 0 is a valid length, such as
+.Va kern.arandom .
 .It Fl d
 Print the description of the variable instead of its value.
 .It Fl e
@@ -128,7 +139,7 @@ Suppress some warnings generated by
 .Nm
 to standard error.
 .It Fl T
-Display only variables that are setable via loader (CTLFLAG_TUN).
+Display only variables that are settable via loader (CTLFLAG_TUN).
 .It Fl W
 Display only writable variables that are not statistical.
 Useful for determining the set of runtime tunable sysctls.

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Fri Feb 13 01:07:12 2015(r278653)
+++ head/sbin/sysctl/sysctl.c   Fri Feb 13 01:20:37 2015(r278654)
@@ -71,7 +71,7 @@ static const char rcsid[] =
 
 static const char *conffile;
 
-static int aflag, bflag, dflag, eflag, hflag, iflag;
+static int aflag, bflag, Bflag, dflag, eflag, hflag, iflag;
 static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
 
 static int oidfmt(int *, int, char *, u_int *);
@@ -112,8 +112,8 @@ usage(void)
 {
 
(void)fprintf(stderr, "%s\n%s\n",
-   "usage: sysctl [-bdehiNnoqTWx] [-f filename] name[=value] ...",
-   "   sysctl [-bdehNnoqTWx] -a");
+   "usage: sysctl [-bdehiNnoqTWx] [ -B  ] [-f filename] 
name[=value] ...",
+   "   sysctl [-bdehNnoqTWx] [ -B  ] -a");
exit(1);
 }
 
@@ -127,7 +127,7 @@ main(int argc, char **argv)
setbuf(stdout,0);
setbuf(stderr,0);
 
-   while ((ch = getopt(argc, argv, "Aabdef:hiNnoqTwWxX")) != -1) {
+   while ((ch = getopt(argc, argv, "AabB:def:hiNnoqTwWxX")) != -1) {
switch (ch) {
case 'A':
/* compatibility */
@@ -139,6 +139,9 @@ main(int argc, char **argv)
case 'b':
bflag = 1;
break;
+   case 'B':
+   Bflag = strtol(optarg, NULL, 0);
+   break;
case 'd':
dflag = 1;
break;
@@ -222,7 +225,7 @@ parse(const char *string, int lineno)
unsigned int uintval;
long longval;
unsigned long ulongval;
-   size_t newsize = 0;
+   size_t newsize = Bflag;
int64_t i64val;
uint64_t u64val;
int mib[CTL_MAXNAME];
@@ -815,9 +818,13 @@ show_var(int *oid, int nlen)
return (0);
}
/* find an estimate of how much we need for this var */
-   j = 0;
-   i = sysctl(oid, nlen, 0, &j, 0, 0);
-   j += j; /* we want to be sure :-) */
+   if (Bflag)
+   j = Bflag;
+   else {
+   j = 0;
+   i = sysctl(oid, nlen, 0, &j, 0, 0);
+   j += j; /* we want to be sure :-) */
+   }
 
val = oval = malloc(j + 1);
if (val == NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278655 - in head/sys: amd64/amd64 i386/i386

2015-02-12 Thread Mark Johnston
Author: markj
Date: Fri Feb 13 01:35:53 2015
New Revision: 278655
URL: https://svnweb.freebsd.org/changeset/base/278655

Log:
  Add support for decoding multibyte NOPs.
  
  Differential Revision:https://reviews.freebsd.org/D1830
  Reviewed by:  jhb, kib
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Divison

Modified:
  head/sys/amd64/amd64/db_disasm.c
  head/sys/i386/i386/db_disasm.c

Modified: head/sys/amd64/amd64/db_disasm.c
==
--- head/sys/amd64/amd64/db_disasm.cFri Feb 13 01:20:37 2015
(r278654)
+++ head/sys/amd64/amd64/db_disasm.cFri Feb 13 01:35:53 2015
(r278655)
@@ -250,6 +250,26 @@ static const struct inst db_inst_0f0x[] 
 /*0f*/ { "",  FALSE, NONE,  0,   0 },
 };
 
+static const struct inst db_inst_0f1x[] = {
+/*10*/ { "",  FALSE, NONE,  0,   0 },
+/*11*/ { "",  FALSE, NONE,  0,   0 },
+/*12*/ { "",  FALSE, NONE,  0,   0 },
+/*13*/ { "",  FALSE, NONE,  0,   0 },
+/*14*/ { "",  FALSE, NONE,  0,   0 },
+/*15*/ { "",  FALSE, NONE,  0,   0 },
+/*16*/ { "",  FALSE, NONE,  0,   0 },
+/*17*/ { "",  FALSE, NONE,  0,   0 },
+
+/*18*/ { "",  FALSE, NONE,  0,   0 },
+/*19*/ { "",  FALSE, NONE,  0,   0 },
+/*1a*/ { "",  FALSE, NONE,  0,   0 },
+/*1b*/ { "",  FALSE, NONE,  0,   0 },
+/*1c*/ { "",  FALSE, NONE,  0,   0 },
+/*1d*/ { "",  FALSE, NONE,  0,   0 },
+/*1e*/ { "",  FALSE, NONE,  0,   0 },
+/*1f*/ { "nopl",  TRUE,  SDEP,  0,   "nopw" },
+};
+
 static const struct inst db_inst_0f2x[] = {
 /*20*/ { "mov",   TRUE,  LONG,  op2(CR,El),  0 },
 /*21*/ { "mov",   TRUE,  LONG,  op2(DR,El),  0 },
@@ -431,7 +451,7 @@ static const struct inst db_inst_0fcx[] 
 
 static const struct inst * const db_inst_0f[] = {
db_inst_0f0x,
-   0,
+   db_inst_0f1x,
db_inst_0f2x,
db_inst_0f3x,
db_inst_0f4x,

Modified: head/sys/i386/i386/db_disasm.c
==
--- head/sys/i386/i386/db_disasm.c  Fri Feb 13 01:20:37 2015
(r278654)
+++ head/sys/i386/i386/db_disasm.c  Fri Feb 13 01:35:53 2015
(r278655)
@@ -195,6 +195,26 @@ static const struct inst db_inst_0f0x[] 
 /*0f*/ { "",  FALSE, NONE,  0,   0 },
 };
 
+static const struct inst db_inst_0f1x[] = {
+/*10*/ { "",  FALSE, NONE,  0,   0 },
+/*11*/ { "",  FALSE, NONE,  0,   0 },
+/*12*/ { "",  FALSE, NONE,  0,   0 },
+/*13*/ { "",  FALSE, NONE,  0,   0 },
+/*14*/ { "",  FALSE, NONE,  0,   0 },
+/*15*/ { "",  FALSE, NONE,  0,   0 },
+/*16*/ { "",  FALSE, NONE,  0,   0 },
+/*17*/ { "",  FALSE, NONE,  0,   0 },
+
+/*18*/ { "",  FALSE, NONE,  0,   0 },
+/*19*/ { "",  FALSE, NONE,  0,   0 },
+/*1a*/ { "",  FALSE, NONE,  0,   0 },
+/*1b*/ { "",  FALSE, NONE,  0,   0 },
+/*1c*/ { "",  FALSE, NONE,  0,   0 },
+/*1d*/ { "",  FALSE, NONE,  0,   0 },
+/*1e*/ { "",  FALSE, NONE,  0,   0 },
+/*1f*/ { "nopl",  TRUE,  SDEP,  0,   "nopw" },
+};
+
 static const struct inst db_inst_0f2x[] = {
 /*20*/ { "mov",   TRUE,  LONG,  op2(CR,El),  0 },
 /*21*/ { "mov",   TRUE,  LONG,  op2(DR,El),  0 },
@@ -356,7 +376,7 @@ static const struct inst db_inst_0fcx[] 
 
 static const struct inst * const db_inst_0f[] = {
db_inst_0f0x,
-   0,
+   db_inst_0f1x,
db_inst_0f2x,
db_inst_0f3x,
db_inst_0f4x,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278657 - head/sys/contrib/vchiq/interface/compat

2015-02-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Feb 13 02:10:09 2015
New Revision: 278657
URL: https://svnweb.freebsd.org/changeset/base/278657

Log:
  Fix build without INVARIANTS/INVARIANT_SUPPORT:
  - Replace "emulation" of return in lmutex_lock_interruptible macros by
  proper static/inline function.
  
  Submitted by: Guy Yur

Modified:
  head/sys/contrib/vchiq/interface/compat/vchi_bsd.h

Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h
==
--- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h  Fri Feb 13 02:02:12 
2015(r278656)
+++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h  Fri Feb 13 02:10:09 
2015(r278657)
@@ -151,10 +151,16 @@ struct mutex {
 
 #definelmutex_init(lock)   mtx_init(&(lock)->mtx, #lock, NULL, 
MTX_DEF)
 #define lmutex_lock(lock)  mtx_lock(&(lock)->mtx)
-#definelmutex_lock_interruptible(lock) (mtx_lock(&(lock)->mtx),0)
 #definelmutex_unlock(lock) mtx_unlock(&(lock)->mtx)
 #definelmutex_destroy(lock)mtx_destroy(&(lock)->mtx)
 
+static __inline int 
+lmutex_lock_interruptible(struct mutex *lock)
+{
+   mtx_lock(&(lock)->mtx);
+   return 0;
+}
+
 /*
  * Rwlock API
  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278616 - in head: . contrib/netbsd-tests/games etc etc/mtree etc/root games games/caesar games/fortune/datfiles release/scripts share/man/man4 share/man/man6 share/man/man7 share/mk s

2015-02-12 Thread Stanislav Sedov

> On Feb 11, 2015, at 10:17 PM, Devin Teske  wrote:
> 
> PLEASE! Do NOT remove the grand digital clock (grdc).
> 
> So many of us over the years have used it as a terminal keeper-aliver :) (and 
> as a clock, to boot).
> 
> I will be very sad if you remove grdc.
> 

+1

I’d also vote for keeping rot13 and caesar as it is routinely useful.  They are 
quite
small and does not require a lot of maintaining work to keep around.

Just my 0.02.

--
ST4096-RIPE



___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r278658 - head/lib/libproc

2015-02-12 Thread Rui Paulo
Author: rpaulo
Date: Fri Feb 13 03:18:29 2015
New Revision: 278658
URL: https://svnweb.freebsd.org/changeset/base/278658

Log:
  Teach libproc how to find debugging symbols in /usr/lib/debug.
  
  MFC after:1 week

Modified:
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/proc_sym.c
==
--- head/lib/libproc/proc_sym.c Fri Feb 13 02:10:09 2015(r278657)
+++ head/lib/libproc/proc_sym.c Fri Feb 13 03:18:29 2015(r278658)
@@ -82,6 +82,21 @@ fail:
strlcpy(buf, symbol, len);
 }
 
+static int
+find_dbg_obj(const char *path)
+{
+   int fd;
+   char dbg_path[PATH_MAX];
+
+   snprintf(dbg_path, sizeof(dbg_path),
+   "/usr/lib/debug/%s.debug", path);
+   fd = open(dbg_path, O_RDONLY);
+   if (fd > 0)
+   return (fd);
+   else
+   return (open(path, O_RDONLY));
+}
+
 static void
 proc_rdl2prmap(rd_loadobj_t *rdl, prmap_t *map)
 {
@@ -295,7 +310,7 @@ proc_addr2sym(struct proc_handle *p, uin
 
if ((map = proc_addr2map(p, addr)) == NULL)
return (-1);
-   if ((fd = open(map->pr_mapname, O_RDONLY, 0)) < 0) {
+   if ((fd = find_dbg_obj(map->pr_mapname)) < 0) {
DPRINTF("ERROR: open %s failed", map->pr_mapname);
goto err0;
}
@@ -443,7 +458,7 @@ proc_name2sym(struct proc_handle *p, con
DPRINTFX("ERROR: couldn't find object %s", object);
goto err0;
}
-   if ((fd = open(map->pr_mapname, O_RDONLY, 0)) < 0) {
+   if ((fd = find_dbg_obj(map->pr_mapname)) < 0) {
DPRINTF("ERROR: open %s failed", map->pr_mapname);
goto err0;
}
@@ -539,7 +554,7 @@ proc_iter_symbyaddr(struct proc_handle *
 
if ((map = proc_name2map(p, object)) == NULL)
return (-1);
-   if ((fd = open(map->pr_mapname, O_RDONLY)) < 0) {
+   if ((fd = find_dbg_obj(map->pr_mapname)) < 0) {
DPRINTF("ERROR: open %s failed", map->pr_mapname);
goto err0;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278642 - in head/usr.bin: chpass passwd

2015-02-12 Thread Ian Lepore
On Thu, 2015-02-12 at 23:08 +, Baptiste Daroussin wrote:
> Author: bapt
> Date: Thu Feb 12 23:08:27 2015
> New Revision: 278642
> URL: https://svnweb.freebsd.org/changeset/base/278642
> 
> Log:
>   Use PRECIOUSPROG instead of custom code to handle schg
>   
>   This allows to preserve schg when installed with -DNO_ROOT
>   
>   MFC after:  1 week
> 
> Modified:
>   head/usr.bin/chpass/Makefile
>   head/usr.bin/passwd/Makefile
> 
> Modified: head/usr.bin/chpass/Makefile
> ==
> --- head/usr.bin/chpass/Makefile  Thu Feb 12 23:00:31 2015
> (r278641)
> +++ head/usr.bin/chpass/Makefile  Thu Feb 12 23:08:27 2015
> (r278642)
> @@ -9,6 +9,7 @@ PROG= chpass
>  SRCS=chpass.c edit.c field.c pw_scan.c table.c util.c
>  BINOWN=  root
>  BINMODE=4555
> +PRECIOUSPROG=
>  .if ${MK_NIS} != "no"
>  CFLAGS+= -DYP
>  .endif
> @@ -34,16 +35,4 @@ MLINKS=chpass.1 chfn.1 chpass.1 chsh.1
>  MLINKS+= chpass.1 ypchpass.1 chpass.1 ypchfn.1 chpass.1 ypchsh.1
>  .endif
>  
> -beforeinstall:
> -.for i in chpass chfn chsh ypchpass ypchfn ypchsh
> -.if exists(${DESTDIR}${BINDIR}/$i)
> - -chflags noschg ${DESTDIR}${BINDIR}/$i
> -.endif
> -.endfor
> -

It looks like the removal of this beforeinstall target is causing
failure to re-install over an existing copy of the program.

-- Ian


___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Bruce Evans

On Thu, 12 Feb 2015, Bjoern A. Zeeb wrote:


On 12 Feb 2015, at 22:34 , Pedro Giffuni  wrote:


On 02/12/15 17:27, Bjoern A. Zeeb wrote:

On 12 Feb 2015, at 21:07 , Pedro F. Giffuni  wrote:
...
Log:
 ulimit(3): Fix broken check.
...

Did this compile?


Yes! Any log message to share?


Now I do again; had lost them due to buildworld starting over again:

===> lib/libc_nonshared (obj,depend,all,install)
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c: In function 'ulimit':
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:56: warning: comparison is 
always false due to limited range of data type
/scratch/tmp/bz/head.svn/lib/libc/gen/ulimit.c:57: warning: overflow in 
implicit constant conversion
--- ulimit.So ---
*** [ulimit.So] Error code 1


Grump.  The first warning inhibits doing clean range checking.  Considered
the following simplified case:

long arg;

/*
 * We want to know if arg is representable as an rlim_t.  This is
 * remarkably difficult.  The following doesn't work due to
 * compiler zeal and other bugs:
 */
if (arg > RLIM_INFINITY)
err(...);

The check is false on all arches since RLIM_INFINITY happens to be >=
LONG_MAX, and excessively zealous compilers warn.

This omits complications for negative args (see below).  There are also
system bugs for negative args.  POSIX specifies that rlim_t shall be an
unsigned type, but in FreeBSD it is still a signed type like it always
was.  FreeBSD is also missing POSIX's magic values RLIM_SAVED_{MAX,CUR}
for handling unrepresentable values.  After fixing the type, these
could be used for the historical mishandling of historical negative
values and might even allow binary compatibility for those values.

The second warning is about a bug.  A last-minute change made the error
handling the same for all negative values (representable or not) as for
unrepresentable positive values.  But that doesn't work, since it give
an overflow in live code as well as in dead code.  We also depend on
the compiler understanding the range checking and not warning for overflows
in dead code.  The unsimplified code for this is:

if (arg > RLIM_INFINITY / 512)
arg = RLIM_INFINITY / 512;

or equivalently:

arg = MIN(arg, RLIM_INFINITY / 512);

The check is vacuously false on 64-bit arches only.  The assignment overflows
on 32-bit arches only.  So zealous compilers have something to warn about
in both lines.  We want a warning for only the second line iff it is live
and overflows.  This requires the compiler to understand when the first
line is vacuously false so that the second line is dead, but not warn
about the first line.

Other common forms of the range check shouldn't work any better:

if ((rlim_t)arg > RLIM_INFINITY)

If rlim_t were unsigned as specified by POSIX, then this cast would probably
just be a bug.  Otherwise, it should have no effect in the vacuously false
case.  We depend on it having no effect so that the compiler knows when
the following code is dead.

rlim_t tmp;

tmp = arg;
if (tmp != arg)
err(1, "arg not representable by rlim_t");

The compiler should still be able to see when the comparison is vacuously
false.  This form of the comparison is also more difficult to write when
the limit is not simply the maximum for the type.  Here we want to multiply
by 512, but there may be no type that can hold the result.

This shows that the MIN() macro is hard to used with mixed types and
zealous compilers.  Using doesn't avoid many of the problems in the
imin() family.  With this family, you have to translate all typedefed
types to basic types and promote to a larger common type, if any.  This
tends to hide the original values, so the zealous compilers are not
smart enough to warn.  However, smart ones should see inside:

arg = llmin(arg, RLIM_INFINITY / 512);

and warn for it too.

Add complications for portability to BSD and POSIX for the full mess.
Translation of typedefed types for the imin() family becomes impossible
because there is no suitable larger common type in some cases; using
MIN() gives unwanted (un)sign extension in these cases.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r278634 - head/lib/libc/gen

2015-02-12 Thread Andrey Chernov
On 13.02.2015 10:18, Bruce Evans wrote:
> if (arg > RLIM_INFINITY)
> err(...);

Checking for RLIM_INFINITY is wrong here, since it is ulong long max,
considering
arg = va_arg(ap, long);
and ulimit(3) stating that arg is always plain long.

Proper check will be

if (arg < 0) {
errno = EINVAL;
return (-1);
}
if (arg > LONG_MAX / 512)
arg = LONG_MAX / 512;

That all. In pure theoretical case RLIM_INFINITY is less than LONG_MAX,
it is job of underlying setrlimit(2) to return error.

-- 
http://ache.vniz.net/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278664 - head/usr.bin/chpass

2015-02-12 Thread Baptiste Daroussin
Author: bapt
Date: Fri Feb 13 07:51:26 2015
New Revision: 278664
URL: https://svnweb.freebsd.org/changeset/base/278664

Log:
  Partially revert 278642
  
  On reinstall (overwrite) install(1) does not handle chflags
  
  Reported by:  ian

Modified:
  head/usr.bin/chpass/Makefile

Modified: head/usr.bin/chpass/Makefile
==
--- head/usr.bin/chpass/MakefileFri Feb 13 07:51:15 2015
(r278663)
+++ head/usr.bin/chpass/MakefileFri Feb 13 07:51:26 2015
(r278664)
@@ -9,7 +9,6 @@ PROG=   chpass
 SRCS=  chpass.c edit.c field.c pw_scan.c table.c util.c
 BINOWN=root
 BINMODE=4555
-PRECIOUSPROG=
 .if ${MK_NIS} != "no"
 CFLAGS+= -DYP
 .endif
@@ -35,4 +34,16 @@ MLINKS=  chpass.1 chfn.1 chpass.1 chsh.1
 MLINKS+= chpass.1 ypchpass.1 chpass.1 ypchfn.1 chpass.1 ypchsh.1
 .endif
 
+beforeinstall:
+.for i in chpass chfn chsh ypchpass ypchfn ypchsh
+.if exists(${DESTDIR}${BINDIR}/$i)
+   -chflags noschg ${DESTDIR}${BINDIR}/$i
+.endif
+.endfor
+
+.if !defined(NO_FSCHG)
+afterinstall:
+   -chflags schg ${DESTDIR}${BINDIR}/chpass
+.endif
+
 .include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"