svn commit: r268793 - head/usr.sbin/chown/tests

2014-07-16 Thread Eitan Adler
Author: eadler
Date: Thu Jul 17 06:57:26 2014
New Revision: 268793
URL: http://svnweb.freebsd.org/changeset/base/268793

Log:
  chown: Fix chown test number

Modified:
  head/usr.sbin/chown/tests/chown-f_test.sh

Modified: head/usr.sbin/chown/tests/chown-f_test.sh
==
--- head/usr.sbin/chown/tests/chown-f_test.sh   Thu Jul 17 06:54:12 2014
(r268792)
+++ head/usr.sbin/chown/tests/chown-f_test.sh   Thu Jul 17 06:57:26 2014
(r268793)
@@ -7,7 +7,7 @@ echo "1..1"
 
 name="chown -f root:wheel file"
 if [ `id -u` -eq 0 ]; then
-   echo "ok 3 - $name # skip Test must not be uid 0."
+   echo "ok 1 - $name # skip Test must not be uid 0."
 else
 touch file
 output=$(chown -f root:wheel file 2>&1)
___
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: r268792 - head/usr.bin/units

2014-07-16 Thread Eitan Adler
Author: eadler
Date: Thu Jul 17 06:54:12 2014
New Revision: 268792
URL: http://svnweb.freebsd.org/changeset/base/268792

Log:
  units(1): Add support for output-format
Add support for the output-format argument.  This also exposes subtle
rounding differences between GNU units and our units.

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Thu Jul 17 06:36:22 2014(r268791)
+++ head/usr.bin/units/units.1  Thu Jul 17 06:54:12 2014(r268792)
@@ -17,6 +17,8 @@ The following options are available:
 Show an overview of options
 .It Fl f Ar filename No , Fl -file Ar filename
 Specify the name of the units data file to load.
+.It Fl e , Fl -exponential
+Behave as if -o '%6e' was typed.
 .It Fl q No , Fl -quiet
 Suppress prompting of the user for units and the display of statistics
 about the number of units loaded.
@@ -33,6 +35,8 @@ from other programs for easy to parse re
 .It Fl v No , Fl -verbose
 Print the units in the conversion output.
 Be more verbose in general.
+.It Fl o Ar format No , Fl -output-format Ar format
+Select the output format string by which numbers are printed.
 .It Fl V No , Fl -version
 Print the version number, usage, and then exit.
 .It Ar from-unit to-unit

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Thu Jul 17 06:36:22 2014(r268791)
+++ head/usr.bin/units/units.c  Thu Jul 17 06:54:12 2014(r268792)
@@ -75,6 +75,7 @@ static int unitcount;
 static int prefixcount;
 static bool verbose = false;
 static bool terse = false;
+static const char * outputformat;
 static const char * havestr;
 static const char * wantstr;
 
@@ -649,6 +650,7 @@ static void 
 showanswer(struct unittype * have, struct unittype * want)
 {
double ans;
+   char* oformat;
 
if (compareunits(have, want)) {
printf("conformability error\n");
@@ -668,11 +670,16 @@ showanswer(struct unittype * have, struc
else if (have->offset != want->offset) {
if (want->quantity)
printf("WARNING: conversion of non-proportional 
quantities.\n");
-   if (have->quantity)
-   printf("\t%.8g\n",
+   if (have->quantity) {
+   asprintf(&oformat, "\t%s\n", outputformat);
+   printf(oformat,
(have->factor + 
have->offset-want->offset)/want->factor);
+   free(oformat);
+   }
else {
-   printf("\t (-> x*%.8g %+.8g)\n\t (<- y*%.8g %+.8g)\n",
+   asprintf(&oformat, "\t (-> x*%sg %sg)\n\t (<- y*%sg 
%sg)\n",
+   outputformat, outputformat, outputformat, 
outputformat);
+   printf(oformat,
have->factor / want->factor,
(have->offset-want->offset)/want->factor,
want->factor / have->factor,
@@ -681,17 +688,33 @@ showanswer(struct unittype * have, struc
}
else {
ans = have->factor / want->factor;
-   if (verbose)
-   printf("\t%s = %.8g * %s\n", havestr, ans, wantstr);
-   else if (terse) 
-   printf("%.8g\n", ans);
-   else 
-   printf("\t* %.8g\n", ans);
 
-   if (verbose)
-   printf("\t%s = (1 / %.8g) * %s\n", havestr, 1/ans,  
wantstr);
-   else if (!terse)
-   printf("\t/ %.8g\n", 1/ans);
+   if (verbose) {
+   printf("\t%s = ", havestr);
+   printf(outputformat, ans);
+   printf(" * %s", wantstr);
+   printf("\n");
+   }
+   else if (terse) {
+   printf(outputformat, ans);
+   printf("\n");
+   }
+   else {
+   printf("\t* ");
+   printf(outputformat, ans);
+   printf("\n");
+   }
+
+   if (verbose) {
+   printf("\t%s = (1 / ", havestr);
+   printf(outputformat, 1/ans);
+   printf(") * %s\n", wantstr);
+   }
+   else if (!terse) {
+   printf("\t/ ");
+   printf(outputformat, 1/ans);
+   printf("\n");
+   }
}
 }
 
@@ -706,7 +729,9 @@ usage(void)
 
 static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
+   {"exponential", no_argument, NULL, 'e'},
{"file", required_argument, NULL, 'f'},
+   

svn commit: r268790 - head/sys/dev/ixgbe

2014-07-16 Thread Hiren Panchasara
Author: hiren
Date: Thu Jul 17 06:21:58 2014
New Revision: 268790
URL: http://svnweb.freebsd.org/changeset/base/268790

Log:
  Fix a typo.
  
  PR:   191898
  Submitted by: vsj...@gmail.com

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Thu Jul 17 05:54:58 2014(r268789)
+++ head/sys/dev/ixgbe/ixgbe.c  Thu Jul 17 06:21:58 2014(r268790)
@@ -304,7 +304,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, num_queues,
 */
 static int ixgbe_txd = PERFORM_TXD;
 SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0,
-"Number of receive descriptors per queue");
+"Number of transmit descriptors per queue");
 
 /* Number of RX descriptors per ring */
 static int ixgbe_rxd = PERFORM_RXD;
___
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: r268788 - head/sys/netinet

2014-07-16 Thread Adrian Chadd
Author: adrian
Date: Thu Jul 17 05:45:54 2014
New Revision: 268788
URL: http://svnweb.freebsd.org/changeset/base/268788

Log:
  Oops - somehow I missed the IP option numbers clashing with the multicast
  numbers below.
  
  Move them to a new set of non-clashing numbers.

Modified:
  head/sys/netinet/in.h

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Thu Jul 17 05:21:16 2014(r268787)
+++ head/sys/netinet/in.h   Thu Jul 17 05:45:54 2014(r268788)
@@ -470,10 +470,6 @@ __END_DECLS
 #defineIP_MINTTL   66   /* minimum TTL for packet or drop 
*/
 #defineIP_DONTFRAG 67   /* don't fragment packet */
 #defineIP_RECVTOS  68   /* bool; receive IP TOS w/dgram */
-#defineIP_FLOWID   69   /* get flow id for the given 
socket/inp */
-#defineIP_FLOWTYPE 70   /* get flow type (M_HASHTYPE) */
-/* 71 - XXX was IP_RSSCPUID - can recycle whenever */
-#defineIP_RSSBUCKETID  72   /* get RSS flowid -> bucket 
mapping */
 
 /* IPv4 Source Filter Multicast API [RFC3678] */
 #defineIP_ADD_SOURCE_MEMBERSHIP70   /* join a source-specific 
group */
@@ -492,6 +488,11 @@ __END_DECLS
 #defineMCAST_BLOCK_SOURCE  84   /* block a source */
 #defineMCAST_UNBLOCK_SOURCE85   /* unblock a source */
 
+/* Flow and RSS definitions */
+#defineIP_FLOWID   90   /* get flow id for the given 
socket/inp */
+#defineIP_FLOWTYPE 91   /* get flow type (M_HASHTYPE) */
+#defineIP_RSSBUCKETID  92   /* get RSS flowid -> bucket 
mapping */
+
 /*
  * Defaults and limits for options
  */
___
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: r268787 - in head/sys: kern net

2014-07-16 Thread Kevin Lo
Author: kevlo
Date: Thu Jul 17 05:21:16 2014
New Revision: 268787
URL: http://svnweb.freebsd.org/changeset/base/268787

Log:
  Deprecate m_act.  Use m_nextpkt always.

Modified:
  head/sys/kern/uipc_usrreq.c
  head/sys/net/if.c
  head/sys/net/if_spppsubr.c

Modified: head/sys/kern/uipc_usrreq.c
==
--- head/sys/kern/uipc_usrreq.c Thu Jul 17 05:20:18 2014(r268786)
+++ head/sys/kern/uipc_usrreq.c Thu Jul 17 05:21:16 2014(r268787)
@@ -2348,7 +2348,7 @@ unp_scan(struct mbuf *m0, void (*op)(str
}
}
}
-   m0 = m0->m_act;
+   m0 = m0->m_nextpkt;
}
 }
 

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Thu Jul 17 05:20:18 2014(r268786)
+++ head/sys/net/if.c   Thu Jul 17 05:21:16 2014(r268787)
@@ -2087,7 +2087,7 @@ if_qflush(struct ifnet *ifp)
 #endif
n = ifq->ifq_head;
while ((m = n) != 0) {
-   n = m->m_act;
+   n = m->m_nextpkt;
m_freem(m);
}
ifq->ifq_head = 0;

Modified: head/sys/net/if_spppsubr.c
==
--- head/sys/net/if_spppsubr.c  Thu Jul 17 05:20:18 2014(r268786)
+++ head/sys/net/if_spppsubr.c  Thu Jul 17 05:21:16 2014(r268787)
@@ -4753,7 +4753,7 @@ sppp_qflush(struct ifqueue *ifq)
 
n = ifq->ifq_head;
while ((m = n)) {
-   n = m->m_act;
+   n = m->m_nextpkt;
m_freem (m);
}
ifq->ifq_head = 0;
___
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: r267760 - head/sys/kern

2014-07-16 Thread Konstantin Belousov
On Sun, Jul 13, 2014 at 11:36:24PM +0200, Mateusz Guzik wrote:
> On Sun, Jul 13, 2014 at 04:26:52PM +0300, Konstantin Belousov wrote:
> > On Fri, Jul 11, 2014 at 01:19:25PM +0200, Mateusz Guzik wrote:
> > > On Fri, Jul 11, 2014 at 12:55:51PM +0300, Konstantin Belousov wrote:
> > > > The nolock version requires two atomics on both entry and leave from the
> > > > protected region, while sx-locked variant requires only one atomic for
> > > > entry and leave.
> > > > 
> > > > I am not sure why you decided to acquire p->p_keeplock in after the
> > > > proc lock in pget(), which indeed causes the complications of dropping
> > > > the proc_lock and rechecking to avoid LOR.  Did you tried to add a flag
> > > > to pfind*() functions to indicate that p_keeplock should be acquired,
> > > > instead ?
> > > 
> > > Lock is taken later to avoid waiting for finished exec/exit of processes
> > > we cannot return, so that e.g. procstat -fa does not trip over that
> > > much.
> > > 
> > > Right now only PROC_LOCK guarantees stability of p->p_ucred across pget
> > > operation. Without that the code would have to crget() and various
> > > functions modified to accept cred instead of proc, or 'imagelock'
> > > mechanism would have to be extended to also protect against cred
> > > changes.
> > No, you could get both locks, imagelock first, proc_lock next.
> > 
> 
> Ignoring allproc_lock:
> 
> sx lock case:
> filedesc out: slock + proc lock + proc unlock + sunlock
> exit/exec: xlock + xunlock
> 
> counter case:
> filedesc out: proc lock + proc unlock + proc lock + proc unlock
> exit/exec: just wait for imagelock to be 0
This should  be proc_lock/mwait/proc_lock, and proc_wait_imagelocked()
does this.

> 
> counter can result in temporary errors due to catching the process
> in exec, on the other hand slock before proc lock forces the caller to
> wait even for processes it cannot read
> 
> I find the counter case better.
> 
> sx:
> http://people.freebsd.org/~mjg/patches/sx-imagelock.patch
> 
> counter: 
> http://people.freebsd.org/~mjg/patches/counter-imagelock.patch
> 
> There is an additional problem with slocked case: witness report a lor
> with devfs vnodes.
> 
> lock order reversal:
>  1st 0xf80006fe6ab0 process imagelock (process imagelock) @ 
> /usr/src/sys/kern/kern_proc.c:287
>  2nd 0xf80018c88240 devfs (devfs) @ /usr/src/sys/kern/vfs_cache.c:1241
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe012324f120
> kdb_backtrace() at kdb_backtrace+0x39/frame 0xfe012324f1d0
> witness_checkorder() at witness_checkorder+0xdc2/frame 0xfe012324f260
> __lockmgr_args() at __lockmgr_args+0x588/frame 0xfe012324f3a0
> vop_stdlock() at vop_stdlock+0x3c/frame 0xfe012324f3c0
> VOP_LOCK1_APV() at VOP_LOCK1_APV+0xfc/frame 0xfe012324f3f0
> _vn_lock() at _vn_lock+0xaa/frame 0xfe012324f460
> vn_vptocnp_locked() at vn_vptocnp_locked+0xe8/frame 0xfe012324f4d0
> vn_fullpath1() at vn_fullpath1+0xb0/frame 0xfe012324f530
> vn_fullpath() at vn_fullpath+0xc1/frame 0xfe012324f580
> export_fd_to_sb() at export_fd_to_sb+0x489/frame 0xfe012324f7b0
> kern_proc_filedesc_out() at kern_proc_filedesc_out+0x1c6/frame 
> 0xfe012324f840
> sysctl_kern_proc_filedesc() at sysctl_kern_proc_filedesc+0x84/frame 
> 0xfe012324f900
> sysctl_root_handler_locked() at sysctl_root_handler_locked+0x68/frame 
> 0xfe012324f940
> sysctl_root() at sysctl_root+0x18e/frame 0xfe012324f990
> userland_sysctl() at userland_sysctl+0x192/frame 0xfe012324fa30
> 
> witness detected the following lock orders:
> devfs -> proctree
Where is the dependency catched comes from ?  I suspect it might be tty.

I consider this case as an advantage of using sx over the hand-rolled lock,
since the issue is/must be present with the counter as well, or the LOR
is false positive, possibly due to sx taken in shared mode.  But debugging
features of sx give the warning, while counter is silent.

That said, if the issue above is analyzed, I do not have any preference
and will not object strongly against you decision.

> proctree -> allproc
> allproc -> imagelock
> imagelock -> devfs


pgpP1zjhSwH3F.pgp
Description: PGP signature


Re: svn commit: r268779 - head/share/man/man5

2014-07-16 Thread Julio Merino
On Wed, Jul 16, 2014 at 6:16 PM, Baptiste Daroussin  wrote:
> On Wed, Jul 16, 2014 at 09:43:24PM +, Julio Merino wrote:
>> Author: jmmv
>> Date: Wed Jul 16 21:43:24 2014
>> New Revision: 268779
>> URL: http://svnweb.freebsd.org/changeset/base/268779
>>
>> Log:
>>   Regen after r268778 to replace WITH_TESTS with WITHOUT_TESTS.
>>
>> Modified:
>>   head/share/man/man5/src.conf.5
>>
>> Modified: head/share/man/man5/src.conf.5
>> ==
>> --- head/share/man/man5/src.conf.5Wed Jul 16 21:40:11 2014
>> (r268778)
>> +++ head/share/man/man5/src.conf.5Wed Jul 16 21:43:24 2014
>> (r268779)
>> @@ -1,7 +1,7 @@
>>  .\" DO NOT EDIT-- this file is automatically generated.
>>  .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 
>> 07:22:04Z des
>>  .\" $FreeBSD$
>> -.Dd July 10, 2014
>> +.Dd July 16, 2014
>>  .Dt SRC.CONF 5
>>  .Os
>>  .Sh NAME
>> @@ -346,6 +346,8 @@ When set, it also enforces the following
>>  .It
>>  .Va WITHOUT_CLANG_FULL
>>  .It
>> +.Va WITHOUT_GNUCXX
>> +.It
> The above looks unintended?

I don't know.  That came from running the makeman script and I was
just trusting it to be right.
___
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: r268781 - in head: . share/man/man9

2014-07-16 Thread Alan Cox
Author: alc
Date: Wed Jul 16 23:17:57 2014
New Revision: 268781
URL: http://svnweb.freebsd.org/changeset/base/268781

Log:
  Correct the name of the man page for pmap_ts_referenced().
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/ObsoleteFiles.inc
  head/share/man/man9/Makefile
  head/share/man/man9/pmap.9

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul 16 22:18:19 2014(r268780)
+++ head/ObsoleteFiles.inc  Wed Jul 16 23:17:57 2014(r268781)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20140716: Remove an incorrectly named man page
+OLD_FILES+=usr/share/man/man9/pmap_ts_modified.9.gz
 # 20140712: Removal of bsd.dtrace.mk
 OLD_FILES+=usr/share/mk/bsd.dtrace.mk
 # 20140705: turn libreadline into an internal lib

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileWed Jul 16 22:18:19 2014
(r268780)
+++ head/share/man/man9/MakefileWed Jul 16 23:17:57 2014
(r268781)
@@ -1048,7 +1048,7 @@ MLINKS+=pmap_clear_modify.9 pmap_clear_r
 MLINKS+=pmap_copy.9 pmap_copy_page.9
 MLINKS+=pmap_extract.9 pmap_extract_and_hold.9
 MLINKS+=pmap_init.9 pmap_init2.9
-MLINKS+=pmap_is_modified.9 pmap_ts_modified.9
+MLINKS+=pmap_is_modified.9 pmap_ts_referenced.9
 MLINKS+=pmap_page_protect.9 pmap_protect.9
 MLINKS+=pmap_pinit.9 pmap_pinit0.9 \
pmap_pinit.9 pmap_pinit2.9

Modified: head/share/man/man9/pmap.9
==
--- head/share/man/man9/pmap.9  Wed Jul 16 22:18:19 2014(r268780)
+++ head/share/man/man9/pmap.9  Wed Jul 16 23:17:57 2014(r268781)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 21, 2003
+.Dd July 16, 2014
 .Dt PMAP 9
 .Os
 .Sh NAME
@@ -119,7 +119,7 @@ operation.
 .Xr pmap_remove_all 9 ,
 .Xr pmap_remove_pages 9 ,
 .Xr pmap_resident_count 9 ,
-.Xr pmap_ts_modified 9 ,
+.Xr pmap_ts_referenced 9 ,
 .Xr pmap_wired_count 9 ,
 .Xr pmap_zero_area 9 ,
 .Xr pmap_zero_idle 9 ,
___
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: r268780 - in head: share/man/man9 sys/kern sys/sys

2014-07-16 Thread Don Lewis
Author: truckman
Date: Wed Jul 16 22:18:19 2014
New Revision: 268780
URL: http://svnweb.freebsd.org/changeset/base/268780

Log:
  Nuke the never-used RF_TIMESHARE feature, reducing the complexity of the
  code.  The consensus on arch@ is that this feature might have been useful
  in the distant past, but is now just unnecessary bloat.
  
  The int_rman_activate_resource() and int_rman_deactivate_resource()
  functions become trivial, so manually inline them.
  
  The special deferred handling of RF_ACTIVE is no longer needed in
  reserve_resource_bound(), so eliminate the associated code at the
  end of the function.
  
  These changes reduce the object file size by more than 500 bytes on i386.
  
  Update the rman.9 man page to reflect the removal of the RF_TIMESHARE
  feature.
  
  MFC after:2 weeks

Modified:
  head/share/man/man9/rman.9
  head/sys/kern/subr_rman.c
  head/sys/sys/rman.h

Modified: head/share/man/man9/rman.9
==
--- head/share/man/man9/rman.9  Wed Jul 16 21:43:24 2014(r268779)
+++ head/share/man/man9/rman.9  Wed Jul 16 22:18:19 2014(r268780)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2011
+.Dd July 15, 2014
 .Dt RMAN 9
 .Os
 .Sh NAME
@@ -141,13 +141,11 @@ represented by a 16-bit flag register, a
 #define RF_ALLOCATED0x0001 /* resource has been reserved */
 #define RF_ACTIVE   0x0002 /* resource allocation has been activated */
 #define RF_SHAREABLE0x0004 /* resource permits contemporaneous sharing */
-#define RF_TIMESHARE0x0008 /* resource permits time-division sharing */
-#define RF_WANTED   0x0010 /* somebody is waiting for this resource */
 #define RF_FIRSTSHARE   0x0020 /* first in sharing list */
 #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */
 .Ed
 .Pp
-The remainder of the flag bits are used to represent the desired alignment
+Bits 15:10  of the flag register are used to represent the desired alignment
 of the resource within the region.
 .Pp
 The
@@ -299,12 +297,9 @@ The
 .Fa bound
 argument must be a power of two.
 It may be set to zero to specify no boundary restriction.
-The default behavior is to allocate an exclusive segment, unless the
+A shared segment will be allocated if the
 .Dv RF_SHAREABLE
-or
-.Dv RF_TIMESHARE
-flags are set, in which case a shared
-segment will be allocated.
+flag is set, otherwise an exclusive segment will be allocated.
 If this shared segment already exists, the caller has its device
 added to the list of consumers.
 .Pp

Modified: head/sys/kern/subr_rman.c
==
--- head/sys/kern/subr_rman.c   Wed Jul 16 21:43:24 2014(r268779)
+++ head/sys/kern/subr_rman.c   Wed Jul 16 22:18:19 2014(r268780)
@@ -109,9 +109,6 @@ static MALLOC_DEFINE(M_RMAN, "rman", "Re
 
 struct rman_head rman_head;
 static struct mtx rman_mtx; /* mutex to protect rman_head */
-static int int_rman_activate_resource(struct rman *rm, struct resource_i *r,
-  struct resource_i **whohas);
-static int int_rman_deactivate_resource(struct resource_i *r);
 static int int_rman_release_resource(struct rman *rm, struct resource_i *r);
 
 static __inline struct resource_i *
@@ -321,7 +318,7 @@ rman_adjust_resource(struct resource *rr
 
/* Not supported for shared resources. */
r = rr->__r_i;
-   if (r->r_flags & (RF_TIMESHARE | RF_SHAREABLE))
+   if (r->r_flags & RF_SHAREABLE)
return (EINVAL);
 
/*
@@ -434,7 +431,7 @@ rman_adjust_resource(struct resource *rr
return (0);
 }
 
-#defineSHARE_TYPE(f)   (f & (RF_SHAREABLE | RF_TIMESHARE | 
RF_PREFETCHABLE))
+#defineSHARE_TYPE(f)   (f & (RF_SHAREABLE | RF_PREFETCHABLE))
 
 struct resource *
 rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
@@ -451,10 +448,9 @@ rman_reserve_resource_bound(struct rman 
   "length %#lx, flags %u, device %s\n", rm->rm_descr, start, end,
   count, flags,
   dev == NULL ? "" : device_get_nameunit(dev)));
-   KASSERT((flags & (RF_WANTED | RF_FIRSTSHARE)) == 0,
+   KASSERT((flags & RF_FIRSTSHARE) == 0,
("invalid flags %#x", flags));
-   new_rflags = (flags & ~(RF_ACTIVE | RF_WANTED | RF_FIRSTSHARE)) |
-   RF_ALLOCATED;
+   new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED;
 
mtx_lock(rm->rm_mtx);
 
@@ -600,7 +596,7 @@ rman_reserve_resource_bound(struct rman 
 * additional work, but this does not seem warranted.)
 */
DPRINTF(("no unshared regions found\n"));
-   if ((flags & (RF_SHAREABLE | RF_TIMESHARE)) == 0)
+   if ((flags & RF_SHAREABLE) == 0)
goto out;
 
for (s = r; s && s->r_end <= end; s = TAILQ_NEXT(s, r_link)) {
@@ -635,25 +631,11 @@ rman_reserve_resource_bound(struct rman 
goto out;
  

Re: svn commit: r268779 - head/share/man/man5

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 09:43:24PM +, Julio Merino wrote:
> Author: jmmv
> Date: Wed Jul 16 21:43:24 2014
> New Revision: 268779
> URL: http://svnweb.freebsd.org/changeset/base/268779
> 
> Log:
>   Regen after r268778 to replace WITH_TESTS with WITHOUT_TESTS.
> 
> Modified:
>   head/share/man/man5/src.conf.5
> 
> Modified: head/share/man/man5/src.conf.5
> ==
> --- head/share/man/man5/src.conf.5Wed Jul 16 21:40:11 2014
> (r268778)
> +++ head/share/man/man5/src.conf.5Wed Jul 16 21:43:24 2014
> (r268779)
> @@ -1,7 +1,7 @@
>  .\" DO NOT EDIT-- this file is automatically generated.
>  .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 
> 07:22:04Z des
>  .\" $FreeBSD$
> -.Dd July 10, 2014
> +.Dd July 16, 2014
>  .Dt SRC.CONF 5
>  .Os
>  .Sh NAME
> @@ -346,6 +346,8 @@ When set, it also enforces the following
>  .It
>  .Va WITHOUT_CLANG_FULL
>  .It
> +.Va WITHOUT_GNUCXX
> +.It
The above looks unintended?

regards,
Bapt


pgpatYi7itQd2.pgp
Description: PGP signature


svn commit: r268779 - head/share/man/man5

2014-07-16 Thread Julio Merino
Author: jmmv
Date: Wed Jul 16 21:43:24 2014
New Revision: 268779
URL: http://svnweb.freebsd.org/changeset/base/268779

Log:
  Regen after r268778 to replace WITH_TESTS with WITHOUT_TESTS.

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Wed Jul 16 21:40:11 2014
(r268778)
+++ head/share/man/man5/src.conf.5  Wed Jul 16 21:43:24 2014
(r268779)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z 
des
 .\" $FreeBSD$
-.Dd July 10, 2014
+.Dd July 16, 2014
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -346,6 +346,8 @@ When set, it also enforces the following
 .It
 .Va WITHOUT_CLANG_FULL
 .It
+.Va WITHOUT_GNUCXX
+.It
 .Va WITHOUT_GROFF
 .El
 .It Va WITH_DEBUG_FILES
@@ -1021,15 +1023,16 @@ Set to not build and install
 Set to not build
 .Xr telnet 8
 and related programs.
-.It Va WITH_TESTS
-.\" from FreeBSD: head/tools/build/options/WITH_TESTS 267432 2014-06-13 
00:05:06Z gjb
-Set to install the
+.It Va WITHOUT_TESTS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_TESTS 268778 2014-07-16 
21:40:11Z jmmv
+Set to not build nor install the
 .Fx
 Test Suite in
 .Pa /usr/tests/ .
 See
 .Xr tests 7
 for more details.
+This also disables the build of all test-related dependencies, including ATF.
 .It Va WITHOUT_TEXTPROC
 .\" from FreeBSD: head/tools/build/options/WITHOUT_TEXTPROC 183242 2008-09-21 
22:02:26Z sam
 Set to not build
___
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: r268778 - in head: share/mk tools/build/options

2014-07-16 Thread Julio Merino
Author: jmmv
Date: Wed Jul 16 21:40:11 2014
New Revision: 268778
URL: http://svnweb.freebsd.org/changeset/base/268778

Log:
  Enable MK_TESTS by default, take 2.
  
  This is a redo of r267424, which was reverted in r267432 because it broke
  "make buildworld" from FreeBSD 9.x.  This issue has been resolved and this
  change is still "make tinderbox" clean.

Added:
  head/tools/build/options/WITHOUT_TESTS
 - copied, changed from r268619, head/tools/build/options/WITH_TESTS
Deleted:
  head/tools/build/options/WITH_TESTS
Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Jul 16 21:26:26 2014(r268777)
+++ head/share/mk/src.opts.mk   Wed Jul 16 21:40:11 2014(r268778)
@@ -144,6 +144,7 @@ __DEFAULT_YES_OPTIONS = \
 SYSINSTALL \
 TCSH \
 TELNET \
+TESTS \
 TEXTPROC \
 UNBOUND \
 USB \
@@ -169,7 +170,6 @@ __DEFAULT_NO_OPTIONS = \
 SHARED_TOOLCHAIN \
 SORT_THREADS \
 SVN \
-TESTS \
 USB_GADGET_EXAMPLES
 
 #

Copied and modified: head/tools/build/options/WITHOUT_TESTS (from r268619, 
head/tools/build/options/WITH_TESTS)
==
--- head/tools/build/options/WITH_TESTS Mon Jul 14 12:24:38 2014
(r268619, copy source)
+++ head/tools/build/options/WITHOUT_TESTS  Wed Jul 16 21:40:11 2014
(r268778)
@@ -1,8 +1,9 @@
 .\" $FreeBSD$
-Set to install the
+Set to not build nor install the
 .Fx
 Test Suite in
 .Pa /usr/tests/ .
 See
 .Xr tests 7
 for more details.
+This also disables the build of all test-related dependencies, including ATF.
___
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: r268777 - in head: sys/amd64/include sys/amd64/vmm/intel usr.sbin/bhyve

2014-07-16 Thread Neel Natu
Author: neel
Date: Wed Jul 16 21:26:26 2014
New Revision: 268777
URL: http://svnweb.freebsd.org/changeset/base/268777

Log:
  Add emulation for legacy x86 task switching mechanism.
  
  FreeBSD/i386 uses task switching to handle double fault exceptions and this
  change enables that to work.
  
  Reported by:  glebius

Added:
  head/usr.sbin/bhyve/task_switch.c   (contents, props changed)
Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/intel/vmcs.c
  head/sys/amd64/vmm/intel/vmcs.h
  head/sys/amd64/vmm/intel/vmx.c
  head/usr.sbin/bhyve/Makefile
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyve/bhyverun.h

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hWed Jul 16 21:06:43 2014
(r268776)
+++ head/sys/amd64/include/vmm.hWed Jul 16 21:26:26 2014
(r268777)
@@ -75,6 +75,10 @@ enum vm_reg_name {
VM_REG_GUEST_GDTR,
VM_REG_GUEST_EFER,
VM_REG_GUEST_CR2,
+   VM_REG_GUEST_PDPTE0,
+   VM_REG_GUEST_PDPTE1,
+   VM_REG_GUEST_PDPTE2,
+   VM_REG_GUEST_PDPTE3,
VM_REG_LAST
 };
 
@@ -323,6 +327,7 @@ struct seg_desc {
uint32_taccess;
 };
 #defineSEG_DESC_TYPE(access)   ((access) & 0x001f)
+#defineSEG_DESC_DPL(access)(((access) >> 5) & 0x3)
 #defineSEG_DESC_PRESENT(access)(((access) & 0x0080) ? 1 : 0)
 #defineSEG_DESC_DEF32(access)  (((access) & 0x4000) ? 1 : 0)
 #defineSEG_DESC_GRANULARITY(access)(((access) & 0x8000) ? 1 : 0)
@@ -415,6 +420,7 @@ enum vm_exitcode {
VM_EXITCODE_IOAPIC_EOI,
VM_EXITCODE_SUSPENDED,
VM_EXITCODE_INOUT_STR,
+   VM_EXITCODE_TASK_SWITCH,
VM_EXITCODE_MAX
 };
 
@@ -439,6 +445,22 @@ struct vm_inout_str {
struct seg_desc seg_desc;
 };
 
+enum task_switch_reason {
+   TSR_CALL,
+   TSR_IRET,
+   TSR_JMP,
+   TSR_IDT_GATE,   /* task gate in IDT */
+};
+
+struct vm_task_switch {
+   uint16_ttsssel; /* new TSS selector */
+   int ext;/* task switch due to external event */
+   uint32_terrcode;
+   int errcode_valid;  /* push 'errcode' on the new stack */
+   enum task_switch_reason reason;
+   struct vm_guest_paging paging;
+};
+
 struct vm_exit {
enum vm_exitcodeexitcode;
int inst_length;/* 0 means unknown */
@@ -493,6 +515,7 @@ struct vm_exit {
struct {
enum vm_suspend_how how;
} suspended;
+   struct vm_task_switch task_switch;
} u;
 };
 

Modified: head/sys/amd64/vmm/intel/vmcs.c
==
--- head/sys/amd64/vmm/intel/vmcs.c Wed Jul 16 21:06:43 2014
(r268776)
+++ head/sys/amd64/vmm/intel/vmcs.c Wed Jul 16 21:26:26 2014
(r268777)
@@ -103,6 +103,14 @@ vmcs_field_encoding(int ident)
return (VMCS_GUEST_LDTR_SELECTOR);
case VM_REG_GUEST_EFER:
return (VMCS_GUEST_IA32_EFER);
+   case VM_REG_GUEST_PDPTE0:
+   return (VMCS_GUEST_PDPTE0);
+   case VM_REG_GUEST_PDPTE1:
+   return (VMCS_GUEST_PDPTE1);
+   case VM_REG_GUEST_PDPTE2:
+   return (VMCS_GUEST_PDPTE2);
+   case VM_REG_GUEST_PDPTE3:
+   return (VMCS_GUEST_PDPTE3);
default:
return (-1);
}

Modified: head/sys/amd64/vmm/intel/vmcs.h
==
--- head/sys/amd64/vmm/intel/vmcs.h Wed Jul 16 21:06:43 2014
(r268776)
+++ head/sys/amd64/vmm/intel/vmcs.h Wed Jul 16 21:26:26 2014
(r268777)
@@ -346,6 +346,9 @@ vmcs_write(uint32_t encoding, uint64_t v
 #defineVMCS_INTR_T_HWINTR  (0 << 8)
 #defineVMCS_INTR_T_NMI (2 << 8)
 #defineVMCS_INTR_T_HWEXCEPTION (3 << 8)
+#defineVMCS_INTR_T_SWINTR  (4 << 8)
+#defineVMCS_INTR_T_PRIV_SWEXCEPTION (5 << 8)
+#defineVMCS_INTR_T_SWEXCEPTION (6 << 8)
 #defineVMCS_INTR_DEL_ERRCODE   (1 << 11)
 
 /*

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Wed Jul 16 21:06:43 2014
(r268776)
+++ head/sys/amd64/vmm/intel/vmx.c  Wed Jul 16 21:26:26 2014
(r268777)
@@ -2020,6 +2020,26 @@ vmx_handle_apic_access(struct vmx *vmx, 
return (UNHANDLED);
 }
 
+static enum task_switch_reason
+vmx_task_switch_reason(uint64_t qual)
+{
+   int reason;
+
+   reason = (qual >> 30) & 0x3;
+   switch (reason) {
+   case 0:
+   return (TSR_CALL);
+   case 1:
+   return (TSR_IRET);
+   case 2:
+   return (TSR_JMP);
+   case 3:
+ 

svn commit: r268776 - head/sys/arm/arm

2014-07-16 Thread Alan Cox
Author: alc
Date: Wed Jul 16 21:06:43 2014
New Revision: 268776
URL: http://svnweb.freebsd.org/changeset/base/268776

Log:
  Implement pmap_unwire().  See r268327 for the motivation behind this change.

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Jul 16 21:04:31 2014(r268775)
+++ head/sys/arm/arm/pmap-v6.c  Wed Jul 16 21:06:43 2014(r268776)
@@ -3302,6 +3302,79 @@ out:
PMAP_UNLOCK(pmap);
 }
 
+/*
+ * Clear the wired attribute from the mappings for the specified range of
+ * addresses in the given pmap.  Every valid mapping within that range
+ * must have the wired attribute set.  In contrast, invalid mappings
+ * cannot have the wired attribute set, so they are ignored.
+ *
+ * XXX Wired mappings of unmanaged pages cannot be counted by this pmap
+ * implementation.
+ */
+void
+pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
+{
+   struct l2_bucket *l2b;
+   struct md_page *pvh;
+   pd_entry_t l1pd;
+   pt_entry_t *ptep, pte;
+   pv_entry_t pv;
+   vm_offset_t next_bucket;
+   vm_paddr_t pa;
+   vm_page_t m;
+ 
+   rw_wlock(&pvh_global_lock);
+   PMAP_LOCK(pmap);
+   while (sva < eva) {
+   next_bucket = L2_NEXT_BUCKET(sva);
+   l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)];
+   if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) {
+   pa = l1pd & L1_S_FRAME;
+   m = PHYS_TO_VM_PAGE(pa);
+   KASSERT(m != NULL && (m->oflags & VPO_UNMANAGED) == 0,
+   ("pmap_unwire: unmanaged 1mpage %p", m));
+   pvh = pa_to_pvh(pa);
+   pv = pmap_find_pv(pvh, pmap, trunc_1mpage(sva));
+   if ((pv->pv_flags & PVF_WIRED) == 0)
+   panic("pmap_unwire: pv %p isn't wired", pv);
+
+   /*
+* Are we unwiring the entire large page? If not,
+* demote the mapping and fall through.
+*/
+   if (sva + L1_S_SIZE == next_bucket &&
+   eva >= next_bucket) {
+   pv->pv_flags &= ~PVF_WIRED;
+   pmap->pm_stats.wired_count -= L2_PTE_NUM_TOTAL;
+   sva = next_bucket;
+   continue;
+   } else if (!pmap_demote_section(pmap, sva))
+   panic("pmap_unwire: demotion failed");
+   }
+   if (next_bucket > eva)
+   next_bucket = eva;
+   l2b = pmap_get_l2_bucket(pmap, sva);
+   if (l2b == NULL) {
+   sva = next_bucket;
+   continue;
+   }
+   for (ptep = &l2b->l2b_kva[l2pte_index(sva)]; sva < next_bucket;
+   sva += PAGE_SIZE, ptep++) {
+   if ((pte = *ptep) == 0 ||
+   (m = PHYS_TO_VM_PAGE(l2pte_pa(pte))) == NULL ||
+   (m->oflags & VPO_UNMANAGED) != 0)
+   continue;
+   pv = pmap_find_pv(&m->md, pmap, sva);
+   if ((pv->pv_flags & PVF_WIRED) == 0)
+   panic("pmap_unwire: pv %p isn't wired", pv);
+   pv->pv_flags &= ~PVF_WIRED;
+   pmap->pm_stats.wired_count--;
+   }
+   }
+   rw_wunlock(&pvh_global_lock);
+   PMAP_UNLOCK(pmap);
+}
+
 
 /*
  * Copy the range specified by src_addr/len

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Wed Jul 16 21:04:31 2014(r268775)
+++ head/sys/arm/arm/pmap.c Wed Jul 16 21:06:43 2014(r268776)
@@ -3570,6 +3570,52 @@ pmap_change_wiring(pmap_t pmap, vm_offse
PMAP_UNLOCK(pmap);
 }
 
+/*
+ * Clear the wired attribute from the mappings for the specified range of
+ * addresses in the given pmap.  Every valid mapping within that range
+ * must have the wired attribute set.  In contrast, invalid mappings
+ * cannot have the wired attribute set, so they are ignored.
+ *
+ * XXX Wired mappings of unmanaged pages cannot be counted by this pmap
+ * implementation.
+ */
+void
+pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
+{
+   struct l2_bucket *l2b;
+   pt_entry_t *ptep, pte;
+   pv_entry_t pv;
+   vm_offset_t next_bucket;
+   vm_page_t m;
+ 
+   rw_wlock(&pvh_global_lock);
+   PMAP_LOCK(pmap);
+   while (sva < eva) {
+   next_bucket = L2_NEXT_BUCKET(sva);
+   if (next_bucket > eva)
+  

svn commit: r268774 - head/sys/conf

2014-07-16 Thread Dimitry Andric
Author: dim
Date: Wed Jul 16 20:37:03 2014
New Revision: 268774
URL: http://svnweb.freebsd.org/changeset/base/268774

Log:
  After r261991, clang warnings about unused functions in the kernel were
  completely silenced.  Make sure these warnings appear again, so there is
  some incentive to fix them, but do not error out the whole kernel build
  for them.
  
  Noticed by:   ste...@pyro.eu.org
  PR:   191867
  MFC after:3 days

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Wed Jul 16 19:02:30 2014(r268773)
+++ head/sys/conf/kern.mk   Wed Jul 16 20:37:03 2014(r268774)
@@ -29,7 +29,7 @@ NO_WSOMETIMES_UNINITIALIZED=  -Wno-error-
 # enough to error out the whole kernel build.  Display them anyway, so there is
 # some incentive to fix them eventually.
 CWARNEXTRA?=   -Wno-error-tautological-compare -Wno-error-empty-body \
-   -Wno-error-parentheses-equality -Wno-unused-function \
+   -Wno-error-parentheses-equality -Wno-error-unused-function \
${NO_WFORMAT}
 .endif
 
___
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: r268773 - head/usr.sbin/service

2014-07-16 Thread Mateusz Guzik
On Wed, Jul 16, 2014 at 07:02:31PM +, Devin Teske wrote:
> Author: dteske
> Date: Wed Jul 16 19:02:30 2014
> New Revision: 268773
> URL: http://svnweb.freebsd.org/changeset/base/268773
> 
> Log:
>   Revert previous revision (r268461) for reasons documented in PR.
>   To use tmux in an rc.d script, use the new-session flag "-d".
>   To use screen in an rc.d script, use the "-dm" flag.
>   If you really need to launch an attached session, manually
>   export TERM=xterm (FreeBSD 9.0 or higher) or export TERM=cons25
>   for older releases.
>   
>   Reported by:bdrewery
>   Discussed on:   src-committers, svn-src-all, svn-src-head
>   PR: bin/191869
> 
> Modified:
>   head/usr.sbin/service/service.sh
> 
> Modified: head/usr.sbin/service/service.sh
> ==
> --- head/usr.sbin/service/service.sh  Wed Jul 16 18:52:21 2014
> (r268772)
> +++ head/usr.sbin/service/service.sh  Wed Jul 16 19:02:30 2014
> (r268773)
> @@ -139,7 +139,7 @@ cd /
>  for dir in /etc/rc.d $local_startup; do
>   if [ -x "$dir/$script" ]; then
>   [ -n "$VERBOSE" ] && echo "$script is located in $dir"
> - exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin 
> TERM="$TERM" $dir/$script $*
> + exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin 
> $dir/$script $*
>   fi
>  done
>  
> 

Thank you.

-- 
Mateusz Guzik 
___
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: r268641 - head/usr.sbin/service

2014-07-16 Thread dteske


> -Original Message-
> From: Devin Teske [mailto:de...@shxd.cx]
> Sent: Wednesday, July 16, 2014 9:20 AM
> To: 'O'Connor, Daniel'; 'Adrian Chadd'
> Cc: 'Mark Linimon'; 'Mateusz Guzik'; 'svn-src-...@freebsd.org'; 'Bryan
> Drewery'; 'src-committ...@freebsd.org'; 'svn-src-head@freebsd.org'; 'Devin
> Teske'
> Subject: RE: svn commit: r268641 - head/usr.sbin/service
> 
> 
> 
> > -Original Message-
> > From: owner-src-committ...@freebsd.org [mailto:owner-src-
> > committ...@freebsd.org] On Behalf Of O'Connor, Daniel
> > Sent: Wednesday, July 16, 2014 1:58 AM
> > To: Adrian Chadd
> > Cc: Mark Linimon; Mateusz Guzik; svn-src-...@freebsd.org; Bryan Drewery;
> > src-committ...@freebsd.org; svn-src-head@freebsd.org; Devin Teske
> > Subject: Re: svn commit: r268641 - head/usr.sbin/service
> >
> >
> > On 16 Jul 2014, at 14:49, Adrian Chadd  wrote:
> > > On 15 July 2014 22:08, Mark Linimon  wrote:
> > >> On Tue, Jul 15, 2014 at 07:13:44PM -0700, dte...@freebsd.org wrote:
> > >>> destroying all vestiges of that environment purely for the sake of
> > >>> saying "it's clean" seems counter to the UNIX pathos.
> > >>
> > >> I think you mean "ethos" here, but frankly I like it better this way.
> > >
> > > I'm a bit confused by this thread.
> > >
> > > screen and tmux are interactive processes. They're not designed to be
> > > run as UNIX services.
> > >
> > > Why is this even happening?
> >
> > The mine craft server port uses tmux so you can fiddle with the MC
console
> > later.
> >
> > Neither screen nor tmux cares if TERM is set when it is run, e.g.
> >
> > [midget 18:25] ~ >env -i /usr/local/bin/tmux new-session -d
> > [midget 18:25] ~ >tmux ls
> > 0: 1 windows (created Wed Jul 16 18:25:33 2014) [241x38]
> >
> > [midget 18:26] ~ >env -i /usr/local/bin/screen -d -m
> > [midget 18:26] ~ >screen -ls
> > There are screens on:
> > 30081..midget   (Detached)
> > 3 Sockets in /tmp/screens/S-darius.
> >
> 
> Looks like "-d" is the magic that needs to be used in rc.d scripts.
> 
> Thanks! I'll start spreading that knowledge and reverse r268641.

Reverted. Thanks much!
-- 
Devin

___
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: r268773 - head/usr.sbin/service

2014-07-16 Thread Devin Teske
Author: dteske
Date: Wed Jul 16 19:02:30 2014
New Revision: 268773
URL: http://svnweb.freebsd.org/changeset/base/268773

Log:
  Revert previous revision (r268461) for reasons documented in PR.
  To use tmux in an rc.d script, use the new-session flag "-d".
  To use screen in an rc.d script, use the "-dm" flag.
  If you really need to launch an attached session, manually
  export TERM=xterm (FreeBSD 9.0 or higher) or export TERM=cons25
  for older releases.
  
  Reported by:  bdrewery
  Discussed on: src-committers, svn-src-all, svn-src-head
  PR:   bin/191869

Modified:
  head/usr.sbin/service/service.sh

Modified: head/usr.sbin/service/service.sh
==
--- head/usr.sbin/service/service.shWed Jul 16 18:52:21 2014
(r268772)
+++ head/usr.sbin/service/service.shWed Jul 16 19:02:30 2014
(r268773)
@@ -139,7 +139,7 @@ cd /
 for dir in /etc/rc.d $local_startup; do
if [ -x "$dir/$script" ]; then
[ -n "$VERBOSE" ] && echo "$script is located in $dir"
-   exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin 
TERM="$TERM" $dir/$script $*
+   exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin 
$dir/$script $*
fi
 done
 
___
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: r268772 - head/sys/dev/vt/hw/efifb

2014-07-16 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Jul 16 18:52:21 2014
New Revision: 268772
URL: http://svnweb.freebsd.org/changeset/base/268772

Log:
  Allow efifb to be used with xf86-video-scfb. This is important for EFI
  systems without either a CSM or real graphics drivers, such as my Lenovo
  Haswell laptop.
  
  This provides working X with the small complication of a console cursor
  permanently overlaid on the upper-left corner of the screen that will be
  dealt with later.
  
  Also remove some redundant screen clearing.

Modified:
  head/sys/dev/vt/hw/efifb/efifb.c

Modified: head/sys/dev/vt/hw/efifb/efifb.c
==
--- head/sys/dev/vt/hw/efifb/efifb.cWed Jul 16 18:49:46 2014
(r268771)
+++ head/sys/dev/vt/hw/efifb/efifb.cWed Jul 16 18:52:21 2014
(r268772)
@@ -62,6 +62,8 @@ static struct vt_driver vt_efifb_driver 
.vd_blank = vt_fb_blank,
.vd_bitbltchr = vt_fb_bitbltchr,
.vd_maskbitbltchr = vt_fb_maskbitbltchr,
+   .vd_fb_ioctl = vt_fb_ioctl,
+   .vd_fb_mmap = vt_fb_mmap,
/* Better than VGA, but still generic driver. */
.vd_priority = VD_PRIORITY_GENERIC + 1,
 };
@@ -97,7 +99,7 @@ vt_efifb_probe(struct vt_device *vd)
 static int
 vt_efifb_init(struct vt_device *vd)
 {
-   int depth, d, i, len;
+   int depth, d;
struct fb_info  *info;
struct efi_fb   *efifb;
caddr_t kmdp;
@@ -142,12 +144,6 @@ vt_efifb_init(struct vt_device *vd)
 */
info->fb_vbase = PHYS_TO_DMAP(efifb->fb_addr);
 
-   /* blank full size */
-   len = info->fb_size / 4;
-   for (i = 0; i < len; i++) {
-   ((uint32_t *)info->fb_vbase)[i] = 0;
-   }
-
/* Get pixel storage size. */
info->fb_bpp = info->fb_stride / info->fb_width * 8;
 
___
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: r268771 - in head/sys: dev/fb dev/vt/hw/fb sys

2014-07-16 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Jul 16 18:49:46 2014
New Revision: 268771
URL: http://svnweb.freebsd.org/changeset/base/268771

Log:
  Allow console drivers active from early boot to be used with xf86-video-scfb,
  rather than only drivers attached later on. This involves a small amount of
  code duplication with dev/fb/fbd.c, which will fixed later on.
  
  Also improve performance of vt_blank() by making it not read from the
  framebuffer unnecessarily.

Modified:
  head/sys/dev/fb/fbd.c
  head/sys/dev/vt/hw/fb/vt_fb.c
  head/sys/dev/vt/hw/fb/vt_fb.h
  head/sys/sys/fbio.h

Modified: head/sys/dev/fb/fbd.c
==
--- head/sys/dev/fb/fbd.c   Wed Jul 16 16:42:58 2014(r268770)
+++ head/sys/dev/fb/fbd.c   Wed Jul 16 18:49:46 2014(r268771)
@@ -257,9 +257,6 @@ fb_probe(struct fb_info *info)
} else if (info->fb_vbase != 0) {
if (info->fb_pbase == 0) {
info->fb_flags |= FB_FLAG_NOMMAP;
-   } else {
-   if (info->fb_mmap == NULL)
-   info->fb_mmap = &fb_mmap;
}
info->wr1 = &vt_fb_mem_wr1;
info->wr2 = &vt_fb_mem_wr2;
@@ -268,10 +265,6 @@ fb_probe(struct fb_info *info)
} else
return (ENXIO);
 
-   if (info->fb_ioctl == NULL)
-   info->fb_ioctl = &fb_ioctl;
-
-
return (0);
 }
 

Modified: head/sys/dev/vt/hw/fb/vt_fb.c
==
--- head/sys/dev/vt/hw/fb/vt_fb.c   Wed Jul 16 16:42:58 2014
(r268770)
+++ head/sys/dev/vt/hw/fb/vt_fb.c   Wed Jul 16 18:49:46 2014
(r268771)
@@ -41,10 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static int vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data,
-struct thread *td);
-static int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset,
-vm_paddr_t *paddr, int prot, vm_memattr_t *memattr);
 void vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2,
 int fill, term_color_t color);
 void vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color);
@@ -65,20 +61,47 @@ static struct vt_driver vt_fb_driver = {
 
 VT_DRIVER_DECLARE(vt_fb, vt_fb_driver);
 
-static int
+int
 vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, struct thread *td)
 {
struct fb_info *info;
+   int error = 0;
 
info = vd->vd_softc;
 
-   if (info->fb_ioctl == NULL)
-   return (-1);
+   switch (cmd) {
+   case FBIOGTYPE:
+   bcopy(info, (struct fbtype *)data, sizeof(struct fbtype));
+   break;
+
+   case FBIO_GETWINORG:/* get frame buffer window origin */
+   *(u_int *)data = 0;
+   break;
+
+   case FBIO_GETDISPSTART: /* get display start address */
+   ((video_display_start_t *)data)->x = 0;
+   ((video_display_start_t *)data)->y = 0;
+   break;
+
+   case FBIO_GETLINEWIDTH: /* get scan line width in bytes */
+   *(u_int *)data = info->fb_stride;
+   break;
 
-   return (info->fb_ioctl(info->fb_cdev, cmd, data, 0, td));
+   case FBIO_BLANK:/* blank display */
+   if (vd->vd_driver->vd_blank == NULL)
+   return (ENODEV);
+   vd->vd_driver->vd_blank(vd, TC_BLACK);
+   break;
+
+   default:
+   error = ENOIOCTL;
+   break;
+   }
+
+   return (error);
 }
 
-static int
+int
 vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot, vm_memattr_t *memattr)
 {
@@ -86,10 +109,18 @@ vt_fb_mmap(struct vt_device *vd, vm_ooff
 
info = vd->vd_softc;
 
-   if (info->fb_ioctl == NULL)
-   return (ENXIO);
+   if (info->fb_flags & FB_FLAG_NOMMAP)
+   return (ENODEV);
 
-   return (info->fb_mmap(info->fb_cdev, offset, paddr, prot, memattr));
+   if (offset >= 0 && offset < info->fb_size) {
+   *paddr = info->fb_pbase + offset;
+   #ifdef VM_MEMATTR_WRITE_COMBINING
+   *memattr = VM_MEMATTR_WRITE_COMBINING;
+   #endif
+   return (0);
+   }
+
+   return (EINVAL);
 }
 
 void
@@ -147,41 +178,42 @@ vt_fb_blank(struct vt_device *vd, term_c
 {
struct fb_info *info;
uint32_t c;
-   u_int o;
+   u_int o, h;
 
info = vd->vd_softc;
c = info->fb_cmap[color];
 
switch (FBTYPE_GET_BYTESPP(info)) {
case 1:
-   for (o = 0; o < info->fb_stride; o++)
-   info->wr1(info, o, c);
+   for (h = 0; h < info->fb_stride; h++)
+   for (o = 0; o < info->fb_stride; o++)
+   info->wr1(info, h*info->fb_stride + o, c);
break;
case 2:
-   f

Re: svn commit: r267679 - in head: etc/mtree libexec/rtld-elf libexec/rtld-elf/tests libexec/rtld-elf/tests/libpythagoras libexec/rtld-elf/tests/target

2014-07-16 Thread Julio Merino
On Mon, Jul 14, 2014 at 7:35 PM, Julio Merino  wrote:
> On Fri, Jun 20, 2014 at 1:14 PM, Jonathan Anderson  
> wrote:
>> Author: jonathan
>> Date: Fri Jun 20 17:14:59 2014
>> New Revision: 267679
>> URL: http://svnweb.freebsd.org/changeset/base/267679
>>
>> Log:
>>   Test RTLD's new LD_LIBRARY_PATH_FDS variable.
>
> This breaks "make tinderbox" when WITH_TESTS is set.

Fixed in r268770.
___
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: r268770 - head/libexec/rtld-elf/tests/libpythagoras

2014-07-16 Thread Julio Merino
Author: jmmv
Date: Wed Jul 16 16:42:58 2014
New Revision: 268770
URL: http://svnweb.freebsd.org/changeset/base/268770

Log:
  libpythagoras needs libm.
  
  This fixes "make tinderbox" failures on various architectures when
  WITH_TESTS=yes is enabled.  Problem introduced in r267679.

Modified:
  head/libexec/rtld-elf/tests/libpythagoras/Makefile

Modified: head/libexec/rtld-elf/tests/libpythagoras/Makefile
==
--- head/libexec/rtld-elf/tests/libpythagoras/Makefile  Wed Jul 16 16:38:25 
2014(r268769)
+++ head/libexec/rtld-elf/tests/libpythagoras/Makefile  Wed Jul 16 16:42:58 
2014(r268770)
@@ -10,4 +10,7 @@ SHLIBDIR= ${TESTSBASE}${TESTSDIR}/libexe
 
 SRCS=  pythagoras.c
 
+DPADD= ${LIBM}
+LDADD= -lm
+
 .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: Phabric IDs / URLs in commits

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 11:41:34AM -0400, John Baldwin wrote:
> On Wednesday, July 16, 2014 09:27:57 AM Kubilay Kocak wrote:
> > On 16/07/2014 1:12 AM, John Baldwin wrote:
> > > On Friday, July 11, 2014 1:54:42 pm Baptiste Daroussin wrote:
> > >> On Fri, Jul 11, 2014 at 12:38:23PM -0400, John Baldwin wrote:
> > >>> On Friday, July 11, 2014 12:16:26 pm John Baldwin wrote:
> >  Author: jhb
> >  Date: Fri Jul 11 16:16:26 2014
> >  New Revision: 268531
> >  URL: http://svnweb.freebsd.org/changeset/base/268531
> >  
> >  Log:
> >    Fix some edge cases with rewinddir():
> >    - In the unionfs case, opendir() and fdopendir() read the directory's
> >    full
> >    
> >  contents and cache it.  This cache is not refreshed when
> >  rewinddir() is
> >  called, so rewinddir() will not notice updates to a directory.  Fix
> >  this
> >  by splitting the code to fetch a directory's contents out of
> >  __opendir_common() into a new _filldir() function and call this
> >  from
> >  rewinddir() when operating on a unionfs directory.
> >    
> >    - If rewinddir() is called on a directory opened with fdopendir()
> >    before
> >    
> >  any directory entries are fetched, rewinddir() will not adjust the
> >  seek
> >  location of the backing file descriptor.  If the file descriptor
> >  passed
> >  to fdopendir() had a non-zero offset, the rewinddir() will not
> >  rewind to
> >  the beginning.  Fix this by always seeking back to 0 in
> >  rewinddir().
> >  This means the dd_rewind hack can also be removed.
> >    
> >    While here, add missing locking to rewinddir().
> >    
> >    CR:  https://phabric.freebsd.org/D312
> >    Reviewed by: jilles
> >    MFC after:   1 week
> > >>> 
> > >>> Just picking my own commit here as a sample case.
> > >>> 
> > >>> I think we should be annotating commits with phabricator code reviews in
> > >>> some way when a change has gone through that review.  It is very useful
> > >>> to get back to the review details from the commit log message in
> > >>> svnweb, etc.
> > >>> 
> > >>> I can see a number of different ways to do this, but I do think it would
> > >>> be
> > >>> nice to pick a consistent way to do it.
> > >>> 
> > >>> Things to consider:
> > >>> 
> > >>> 1) The tag ("CR:" is what I used above).  I don't care, just pick one. 
> > >>> I
> > >>> 
> > >>>chose CR since Warner used it previously.  Whatever we decide, we
> > >>>should
> > >>>add it to the template.
> > >>> 
> > >>> 2) ID vs full URL.  For PRs we just list the bug ID and not the full URL
> > >>> 
> > >>>(same for Coverity).  I would be fine with that so long as someone
> > >>>hacks
> > >>>up svnweb to convert the IDs into links (the way it handles PR bug
> > >>>numbers).  OTOH, if you use the full URL you get that for free in
> > >>>svnweb,
> > >>>and you also get it in mail clients, etc.  It helps that the URL
> > >>>isn't but
> > >>>so long.
> > >> 
> > >> for bugs we could use http://bugs.FreeBSD.org/ that also works
> > >> and it is short :)
> > > 
> > > Ok, so Bryan said ports uses 'Phabric: Dxxx' and I read Baptiste's e-mail
> > > as a preference for the URL itself (no preference on the prefix though?) 
> > > Any other thoughts?  I probably lean towards the full URL personally
> > > since it requires less work (no hacking on svnweb) and works
> > > out-of-the-box in more forums (e-mail, etc.)
> > +100 on CR:  without URL's to keep them decoupled
> > and forever valid in the (probably very likely) case we change
> > hostnames/urls.
> > 
> > I'm liking phabric so far, but would opt for a more concrete
> > review.freebsd.org if I had the choice (and when it's ready). This way
> > our "review" processes and workflows can be extended or modified
> > orthogonal to the tool in use.
> 
> Note that we could choose a "canonical" URL similar to how we have done
> for 'bugs.freebsd.org/' ala 'review.freebsd.org/' or the like.
> 
> -- 
> John Baldwin

Btw the template is deeply related to phabricator, making a freebsd specific
template will be hard.

Over to volunteer :)

regards,
Bapt


pgpGg77zpchWJ.pgp
Description: PGP signature


Re: Phabric IDs / URLs in commits

2014-07-16 Thread John Baldwin
On Wednesday, July 16, 2014 09:27:57 AM Kubilay Kocak wrote:
> On 16/07/2014 1:12 AM, John Baldwin wrote:
> > On Friday, July 11, 2014 1:54:42 pm Baptiste Daroussin wrote:
> >> On Fri, Jul 11, 2014 at 12:38:23PM -0400, John Baldwin wrote:
> >>> On Friday, July 11, 2014 12:16:26 pm John Baldwin wrote:
>  Author: jhb
>  Date: Fri Jul 11 16:16:26 2014
>  New Revision: 268531
>  URL: http://svnweb.freebsd.org/changeset/base/268531
>  
>  Log:
>    Fix some edge cases with rewinddir():
>    - In the unionfs case, opendir() and fdopendir() read the directory's
>    full
>    
>  contents and cache it.  This cache is not refreshed when
>  rewinddir() is
>  called, so rewinddir() will not notice updates to a directory.  Fix
>  this
>  by splitting the code to fetch a directory's contents out of
>  __opendir_common() into a new _filldir() function and call this
>  from
>  rewinddir() when operating on a unionfs directory.
>    
>    - If rewinddir() is called on a directory opened with fdopendir()
>    before
>    
>  any directory entries are fetched, rewinddir() will not adjust the
>  seek
>  location of the backing file descriptor.  If the file descriptor
>  passed
>  to fdopendir() had a non-zero offset, the rewinddir() will not
>  rewind to
>  the beginning.  Fix this by always seeking back to 0 in
>  rewinddir().
>  This means the dd_rewind hack can also be removed.
>    
>    While here, add missing locking to rewinddir().
>    
>    CR:https://phabric.freebsd.org/D312
>    Reviewed by:   jilles
>    MFC after: 1 week
> >>> 
> >>> Just picking my own commit here as a sample case.
> >>> 
> >>> I think we should be annotating commits with phabricator code reviews in
> >>> some way when a change has gone through that review.  It is very useful
> >>> to get back to the review details from the commit log message in
> >>> svnweb, etc.
> >>> 
> >>> I can see a number of different ways to do this, but I do think it would
> >>> be
> >>> nice to pick a consistent way to do it.
> >>> 
> >>> Things to consider:
> >>> 
> >>> 1) The tag ("CR:" is what I used above).  I don't care, just pick one. 
> >>> I
> >>> 
> >>>chose CR since Warner used it previously.  Whatever we decide, we
> >>>should
> >>>add it to the template.
> >>> 
> >>> 2) ID vs full URL.  For PRs we just list the bug ID and not the full URL
> >>> 
> >>>(same for Coverity).  I would be fine with that so long as someone
> >>>hacks
> >>>up svnweb to convert the IDs into links (the way it handles PR bug
> >>>numbers).  OTOH, if you use the full URL you get that for free in
> >>>svnweb,
> >>>and you also get it in mail clients, etc.  It helps that the URL
> >>>isn't but
> >>>so long.
> >> 
> >> for bugs we could use http://bugs.FreeBSD.org/ that also works
> >> and it is short :)
> > 
> > Ok, so Bryan said ports uses 'Phabric: Dxxx' and I read Baptiste's e-mail
> > as a preference for the URL itself (no preference on the prefix though?) 
> > Any other thoughts?  I probably lean towards the full URL personally
> > since it requires less work (no hacking on svnweb) and works
> > out-of-the-box in more forums (e-mail, etc.)
> +100 on CR:  without URL's to keep them decoupled
> and forever valid in the (probably very likely) case we change
> hostnames/urls.
> 
> I'm liking phabric so far, but would opt for a more concrete
> review.freebsd.org if I had the choice (and when it's ready). This way
> our "review" processes and workflows can be extended or modified
> orthogonal to the tool in use.

Note that we could choose a "canonical" URL similar to how we have done
for 'bugs.freebsd.org/' ala 'review.freebsd.org/' or the like.

-- 
John Baldwin
___
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: r268641 - head/usr.sbin/service

2014-07-16 Thread dteske


> -Original Message-
> From: owner-src-committ...@freebsd.org [mailto:owner-src-
> committ...@freebsd.org] On Behalf Of O'Connor, Daniel
> Sent: Wednesday, July 16, 2014 1:58 AM
> To: Adrian Chadd
> Cc: Mark Linimon; Mateusz Guzik; svn-src-...@freebsd.org; Bryan Drewery;
> src-committ...@freebsd.org; svn-src-head@freebsd.org; Devin Teske
> Subject: Re: svn commit: r268641 - head/usr.sbin/service
> 
> 
> On 16 Jul 2014, at 14:49, Adrian Chadd  wrote:
> > On 15 July 2014 22:08, Mark Linimon  wrote:
> >> On Tue, Jul 15, 2014 at 07:13:44PM -0700, dte...@freebsd.org wrote:
> >>> destroying all vestiges of that environment purely for the sake of
> >>> saying "it's clean" seems counter to the UNIX pathos.
> >>
> >> I think you mean "ethos" here, but frankly I like it better this way.
> >
> > I'm a bit confused by this thread.
> >
> > screen and tmux are interactive processes. They're not designed to be
> > run as UNIX services.
> >
> > Why is this even happening?
> 
> The mine craft server port uses tmux so you can fiddle with the MC console
> later.
> 
> Neither screen nor tmux cares if TERM is set when it is run, e.g.
> 
> [midget 18:25] ~ >env -i /usr/local/bin/tmux new-session -d
> [midget 18:25] ~ >tmux ls
> 0: 1 windows (created Wed Jul 16 18:25:33 2014) [241x38]
> 
> [midget 18:26] ~ >env -i /usr/local/bin/screen -d -m
> [midget 18:26] ~ >screen -ls
> There are screens on:
>   30081..midget   (Detached)
> 3 Sockets in /tmp/screens/S-darius.
> 

Looks like "-d" is the magic that needs to be used in rc.d scripts.

Thanks! I'll start spreading that knowledge and reverse r268641.
-- 
Devin

___
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: r268767 - in head: sys/cam/ctl sys/cam/scsi sys/conf sys/modules/ctl usr.sbin/ctladm

2014-07-16 Thread Alexander Motin
Author: mav
Date: Wed Jul 16 15:57:17 2014
New Revision: 268767
URL: http://svnweb.freebsd.org/changeset/base/268767

Log:
  Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.
  
  This allows to clone VMs and move them between LUNs inside one storage
  host without generating extra network traffic to the initiator and back,
  and without being limited by network bandwidth.
  
  LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set.
  For LUNs without these IDs VMWare will use traditional copy operations.
  
  Beware: the above LUN IDs explicitly set to values non-unique from the VM
  cluster point of view may cause data corruption if wrong LUN is addressed!
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Added:
  head/sys/cam/ctl/ctl_tpc.c   (contents, props changed)
  head/sys/cam/ctl/ctl_tpc.h   (contents, props changed)
  head/sys/cam/ctl/ctl_tpc_local.c   (contents, props changed)
Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_cmd_table.c
  head/sys/cam/ctl/ctl_frontend.c
  head/sys/cam/ctl/ctl_frontend.h
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/ctl/ctl_ser_table.c
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/cam/scsi/scsi_all.h
  head/sys/conf/files
  head/sys/modules/ctl/Makefile
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Jul 16 14:08:01 2014(r268766)
+++ head/sys/cam/ctl/ctl.c  Wed Jul 16 15:57:17 2014(r268767)
@@ -320,10 +320,10 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb
 
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
- * SCSI Ports (0x88), Block limits (0xB0) and
+ * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0) and
  * Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  6
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  7
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -349,8 +349,6 @@ static int ctl_ioctl_fill_ooa(struct ctl
  struct ctl_ooa_entry *kern_entries);
 static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
 struct thread *td);
-uint32_t ctl_get_resindex(struct ctl_nexus *nexus);
-uint32_t ctl_port_idx(int port_num);
 static uint32_t ctl_map_lun(int port_num, uint32_t lun);
 static uint32_t ctl_map_lun_back(int port_num, uint32_t lun);
 #ifdef unused
@@ -4598,6 +4596,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
TAILQ_INIT(&lun->ooa_queue);
TAILQ_INIT(&lun->blocked_queue);
STAILQ_INIT(&lun->error_list);
+   ctl_tpc_init(lun);
 
/*
 * Initialize the mode page index.
@@ -4749,6 +4748,7 @@ ctl_free_lun(struct ctl_lun *lun)
atomic_subtract_int(&lun->be_lun->be->num_luns, 1);
lun->be_lun->lun_shutdown(lun->be_lun->be_lun);
 
+   ctl_tpc_shutdown(lun);
mtx_destroy(&lun->lun_lock);
free(lun->lun_devid, M_CTL);
if (lun->flags & CTL_LUN_MALLOCED)
@@ -9821,10 +9821,12 @@ ctl_inquiry_evpd_supported(struct ctl_sc
pages->page_list[2] = SVPD_DEVICE_ID;
/* SCSI Ports */
pages->page_list[3] = SVPD_SCSI_PORTS;
+   /* Third-party Copy */
+   pages->page_list[4] = SVPD_SCSI_TPC;
/* Block limits */
-   pages->page_list[4] = SVPD_BLOCK_LIMITS;
+   pages->page_list[5] = SVPD_BLOCK_LIMITS;
/* Logical Block Provisioning */
-   pages->page_list[5] = SVPD_LBP;
+   pages->page_list[6] = SVPD_LBP;
 
ctsio->scsi_status = SCSI_STATUS_OK;
 
@@ -10023,7 +10025,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
struct scsi_vpd_port_designation_cont *pdc;
struct ctl_lun *lun;
struct ctl_port *port;
-   int data_len, num_target_ports, id_len, g, pg, p;
+   int data_len, num_target_ports, iid_len, id_len, g, pg, p;
int num_target_port_groups, single;
 
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
@@ -10034,6 +10036,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
else
num_target_port_groups = NUM_TARGET_PORT_GROUPS;
num_target_ports = 0;
+   iid_len = 0;
id_len = 0;
mtx_lock(&softc->ctl_lock);
STAILQ_FOREACH(port, &softc->port_list, links) {
@@ -10043,6 +10046,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
CTL_MAX_LUNS)
continue;
num_target_ports++;
+   if (port->init_devid)
+   iid_len += port->init_devid->len;
if (port->port_devid)
id_len += port->port_devid->len;
}
@@ -10050,7 +10055,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s
 
data_len = sizeof(struct scsi_vpd_scsi_ports) + num_target_port_groups *
num_targe

svn commit: r268766 - head/sys/fs/tmpfs

2014-07-16 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 16 14:08:01 2014
New Revision: 268766
URL: http://svnweb.freebsd.org/changeset/base/268766

Log:
  Do not ignore error from tmpfs_alloc_vp().  It results in access to
  the random memory.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 14:06:16 2014
(r268765)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 14:08:01 2014
(r268766)
@@ -185,7 +185,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg
cnp->cn_flags |= SAVENAME;
} else {
error = tmpfs_alloc_vp(dvp->v_mount, tnode,
-   cnp->cn_lkflags, vpp);
+   cnp->cn_lkflags, vpp);
+   if (error != 0)
+   goto out;
}
}
}
___
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: r268765 - head/sys/fs/tmpfs

2014-07-16 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 16 14:06:16 2014
New Revision: 268765
URL: http://svnweb.freebsd.org/changeset/base/268765

Log:
  Remove unused header.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 14:04:46 2014
(r268764)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 14:06:16 2014
(r268765)
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #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"


svn commit: r268764 - in head/sys: fs/ext2fs fs/nandfs fs/nfsclient fs/nullfs fs/tmpfs kern ufs/ufs

2014-07-16 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 16 14:04:46 2014
New Revision: 268764
URL: http://svnweb.freebsd.org/changeset/base/268764

Log:
  Check for the cross-device cross-link attempt in the VFS, instead of
  forcing filesystem VOP_LINK() methods to repeat the code.  In
  tmpfs_link(), remove redundand check for the type of the source,
  already done by VFS.
  
  Note that NFS server already performs this check before calling
  VOP_LINK().
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/nandfs/nandfs_vnops.c
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/nullfs/null_vnops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/kern/vfs_syscalls.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Wed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/fs/ext2fs/ext2_vnops.c Wed Jul 16 14:04:46 2014
(r268764)
@@ -666,10 +666,6 @@ ext2_link(struct vop_link_args *ap)
if ((cnp->cn_flags & HASBUF) == 0)
panic("ext2_link: no name");
 #endif
-   if (tdvp->v_mount != vp->v_mount) {
-   error = EXDEV;
-   goto out;
-   }
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) {
error = EMLINK;

Modified: head/sys/fs/nandfs/nandfs_vnops.c
==
--- head/sys/fs/nandfs/nandfs_vnops.c   Wed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/fs/nandfs/nandfs_vnops.c   Wed Jul 16 14:04:46 2014
(r268764)
@@ -1355,9 +1355,6 @@ nandfs_link(struct vop_link_args *ap)
struct nandfs_inode *inode = &node->nn_inode;
int error;
 
-   if (tdvp->v_mount != vp->v_mount)
-   return (EXDEV);
-
if (inode->i_links_count >= LINK_MAX)
return (EMLINK);
 

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Wed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Wed Jul 16 14:04:46 2014
(r268764)
@@ -1976,10 +1976,6 @@ nfs_link(struct vop_link_args *ap)
struct nfsvattr nfsva, dnfsva;
int error = 0, attrflag, dattrflag;
 
-   if (vp->v_mount != tdvp->v_mount) {
-   return (EXDEV);
-   }
-
/*
 * Push all writes to the server, so that the attribute cache
 * doesn't get "out of sync" with the server.

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Wed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/fs/nullfs/null_vnops.c Wed Jul 16 14:04:46 2014
(r268764)
@@ -858,15 +858,6 @@ null_vptocnp(struct vop_vptocnp_args *ap
return (error);
 }
 
-static int
-null_link(struct vop_link_args *ap)
-{
-
-   if (ap->a_tdvp->v_mount != ap->a_vp->v_mount)
-   return (EXDEV);
-   return (null_bypass((struct vop_generic_args *)ap));
-}
-
 /*
  * Global vfs data structures
  */
@@ -880,7 +871,6 @@ struct vop_vector null_vnodeops = {
.vop_getwritemount =null_getwritemount,
.vop_inactive = null_inactive,
.vop_islocked = vop_stdislocked,
-   .vop_link = null_link,
.vop_lock1 =null_lock,
.vop_lookup =   null_lookup,
.vop_open = null_open,

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 16 14:04:46 2014
(r268764)
@@ -571,21 +571,6 @@ tmpfs_link(struct vop_link_args *v)
MPASS(VOP_ISLOCKED(dvp));
MPASS(cnp->cn_flags & HASBUF);
MPASS(dvp != vp); /* XXX When can this be false? */
-
-   /* XXX: Why aren't the following two tests done by the caller? */
-
-   /* Hard links of directories are forbidden. */
-   if (vp->v_type == VDIR) {
-   error = EPERM;
-   goto out;
-   }
-
-   /* Cannot create cross-device links. */
-   if (dvp->v_mount != vp->v_mount) {
-   error = EXDEV;
-   goto out;
-   }
-
node = VP_TO_TMPFS_NODE(vp);
 
/* Ensure that we do not overflow the maximum number of links imposed

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cWed Jul 16 13:52:05 2014
(r268763)
+++ head/sys/kern/vfs_syscalls.cWed Jul 16 14:04:46 2014
(r268764)
@@ -1578,7 +1578,15 @@ again:

svn commit: r268763 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 13:52:05 2014
New Revision: 268763
URL: http://svnweb.freebsd.org/changeset/base/268763

Log:
  Sort properly the headers
  While here space/tabs cleanup
  
  Reviewed by:  kib

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 12:57:53 2014
(r268762)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 13:52:05 2014
(r268763)
@@ -28,6 +28,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -36,8 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 
@@ -90,7 +91,7 @@ parse_duration(const char *duration)
default:
errx(EX_USAGE, "invalid duration");
}
-   
+
if (ret < 0 || ret >= 1UL)
errx(EX_USAGE, "invalid duration");
 
@@ -114,7 +115,7 @@ parse_signal(const char *str)
if (strcasecmp(str, sys_signame[i]) == 0)
return (i);
}
-   
+
errx(EX_USAGE, "invalid signal");
 }
 
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Sergey Kandaurov
On 16 July 2014 13:55, Baptiste Daroussin  wrote:
> Author: bapt
> Date: Wed Jul 16 09:55:36 2014
> New Revision: 268745
> URL: http://svnweb.freebsd.org/changeset/base/268745
>
> Log:
>   New BSDL timeout(1) utility compatible with GNU timeout
[...]
(sorry, missed this in a previous reply)

> Added: head/usr.bin/timeout/timeout.1
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.bin/timeout/timeout.1  Wed Jul 16 09:55:36 2014
> (r268745)
> @@ -0,0 +1,70 @@
> +.\" Copyright (c) 2014 Baptiste Daroussin 
> +.\" All rights reserved.
> +.\"
> +.\" Redistribution and use in source and binary forms, with or without
> +.\" modification, are permitted provided that the following conditions
> +.\" are met:
> +.\" 1. Redistributions of source code must retain the above copyright
> +.\"notice, this list of conditions and the following disclaimer.
> +.\" 2. Redistributions in binary form must reproduce the above copyright
> +.\"notice, this list of conditions and the following disclaimer in the
> +.\"documentation and/or other materials provided with the distribution.
> +.\"
> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
> PURPOSE
> +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
> CONSEQUENTIAL
> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
> STRICT
> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> +.\" SUCH DAMAGE.
> +.\"
> +.\" $FreeBSD$
> +.\"
> +.Dd July 16, 2014
> +.Dt TIMEOUT 1
> +.Os
> +.Sh NAME
> +.Nm timeout
> +.Nd run a command with a time limit
> +.Sh SYNOPSIS
> +.Nm
> +.Op Fl -signal Ar sig | Fl s Ar sig
> +.Op Fl -preserve-status
> +.Op Fl -kill-after Ar time | Fl k Ar time
> +.Op Fl -foreground
> +.Ao Ar duration Ac
> +.Ao Ar command Ac
> +.Ao Ar args ... Ac
> +.Sh DESCRIPTION
> +.Nm

please

The
.Nm
utility

> +starts the
> +.Ar command
> +with its
> +.Ar args
> +and kills if it is still runs after

and kills _it_ ?

> +.Ar duration .

in what units?

> +.Bl -tag -width "-k time, --kill-after time"
> +.It Fl -preserve-status
> +Always exist with the same status as
> +.Ar command
> +even if it times out.
> +.It Fl -foreground
> +Do not propagate timeout to the
> +.Ar command
> +children.
> +.It Fl s Ar sig , Fl -signal Ar sig
> +Speficy the signal to send on timeout by default
> +.Ar SIGTERM .
> +.It Fl k Ar time , Fl -kill-after Ar time
> +Send a second kill if the
> +.Ar command
> +is still running after
> +.Ar time
> +seconds after the first signal was sent
> +.Sh SEE ALSO
> +.Xr signal 3 ,
> +.Xr kill 1

The entries are unsorted.

>
> Added: head/usr.bin/timeout/timeout.c
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.bin/timeout/timeout.c  Wed Jul 16 09:55:36 2014
> (r268745)
> @@ -0,0 +1,336 @@
> +/*-
> + * Copyright (c) 2014 Baptiste Daroussin 
> + * Copyright (c) 2014 Vsevolod Stakhov 
> + * All rights reserved.
> + *~
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer
> + *in this position and unchanged.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *~
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#inc

Re: svn commit: r268750 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 03:19:00PM +0300, Konstantin Belousov wrote:
G
> On Wed, Jul 16, 2014 at 11:41:28AM +, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Wed Jul 16 11:41:28 2014
> > New Revision: 268750
> > URL: http://svnweb.freebsd.org/changeset/base/268750
> > 
> > Log:
> >   Sort headers
> >   Constify long options
> >   Remove useless call to sigemptyset
> >   properly check errno when waiting for a process status when a SIGCHLD is 
> > received
> > 
> > Modified:
> >   head/usr.bin/timeout/timeout.c
> > 
> > Modified: head/usr.bin/timeout/timeout.c
> > ==
> > --- head/usr.bin/timeout/timeout.c  Wed Jul 16 11:30:04 2014
> > (r268749)
> > +++ head/usr.bin/timeout/timeout.c  Wed Jul 16 11:41:28 2014
> > (r268750)
> > @@ -28,20 +28,18 @@
> >  #include 
> >  __FBSDID("$FreeBSD$");
> >  
> > -#include 
> > -#include 
> > -#include 
> > +#include 
> > +#include 
> > +#include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> > -#include 
> > -#include 
> > -#include 
> > -#include 
> > -#include 
> This is not proper sorting.  sys/*.h comes first, usermode headers
> second.
> >  
> >  #define EXIT_TIMEOUT 124
> >  
> > @@ -188,7 +186,7 @@ main(int argc, char **argv)
> > cpid = -1;
> > pgid = -1;
> >  
> > -   struct option longopts[] = {
> > +   const struct option longopts[] = {
> I noted that this should be static const, not just const.

static const is just not working here. because of the 2 first entries.
> 
> The curious tendency of late is people committing changes without
> getting final confirmation from reviewer. Asking to look at the patch
> before commit would avoid repo churn.

Maybe because the code is sitting on code reviews for a while and that I
adressed all the issue commented there

regards,
Bapt


pgp1Duz7D7zcf.pgp
Description: PGP signature


Re: svn commit: r268750 - head/usr.bin/timeout

2014-07-16 Thread Alexey Dokuchaev
On Wed, Jul 16, 2014 at 03:19:00PM +0300, Konstantin Belousov wrote:
> The curious tendency of late is people committing changes without
> getting final confirmation from reviewer. Asking to look at the patch
> before commit would avoid repo churn.

Big +1.

./danfe
___
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: r268750 - head/usr.bin/timeout

2014-07-16 Thread Konstantin Belousov
On Wed, Jul 16, 2014 at 11:41:28AM +, Baptiste Daroussin wrote:
> Author: bapt
> Date: Wed Jul 16 11:41:28 2014
> New Revision: 268750
> URL: http://svnweb.freebsd.org/changeset/base/268750
> 
> Log:
>   Sort headers
>   Constify long options
>   Remove useless call to sigemptyset
>   properly check errno when waiting for a process status when a SIGCHLD is 
> received
> 
> Modified:
>   head/usr.bin/timeout/timeout.c
> 
> Modified: head/usr.bin/timeout/timeout.c
> ==
> --- head/usr.bin/timeout/timeout.cWed Jul 16 11:30:04 2014
> (r268749)
> +++ head/usr.bin/timeout/timeout.cWed Jul 16 11:41:28 2014
> (r268750)
> @@ -28,20 +28,18 @@
>  #include 
>  __FBSDID("$FreeBSD$");
>  
> -#include 
> -#include 
> -#include 
> +#include 
> +#include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
This is not proper sorting.  sys/*.h comes first, usermode headers
second.
>  
>  #define EXIT_TIMEOUT 124
>  
> @@ -188,7 +186,7 @@ main(int argc, char **argv)
>   cpid = -1;
>   pgid = -1;
>  
> - struct option longopts[] = {
> + const struct option longopts[] = {
I noted that this should be static const, not just const.

The curious tendency of late is people committing changes without
getting final confirmation from reviewer. Asking to look at the patch
before commit would avoid repo churn.


pgpiP4l85FbDP.pgp
Description: PGP signature


svn commit: r268751 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 12:09:12 2014
New Revision: 268751
URL: http://svnweb.freebsd.org/changeset/base/268751

Log:
  White space fixes

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 11:41:28 2014
(r268750)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 12:09:12 2014
(r268751)
@@ -2,7 +2,7 @@
  * Copyright (c) 2014 Baptiste Daroussin 
  * Copyright (c) 2014 Vsevolod Stakhov 
  * All rights reserved.
- *~
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -12,7 +12,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- *~
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Sergey Kandaurov
On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> Author: bapt
> Date: Wed Jul 16 09:55:36 2014
> New Revision: 268745
> URL: http://svnweb.freebsd.org/changeset/base/268745
> 
> Log:
>   New BSDL timeout(1) utility compatible with GNU timeout

The purpose of this utility is unclear.

[...]
> +.Ar args
> +and kills if it is still runs after
> +.Ar duration .
> +.Bl -tag -width "-k time, --kill-after time"

mdoc warning: A .Bl directive has no matching .El

> +.It Fl -preserve-status
> +Always exist with the same status as
> +.Ar command
> +even if it times out.
> +.It Fl -foreground
> +Do not propagate timeout to the
> +.Ar command
> +children.
> +.It Fl s Ar sig , Fl -signal Ar sig
> +Speficy the signal to send on timeout by default
> +.Ar SIGTERM .
> +.It Fl k Ar time , Fl -kill-after Ar time
> +Send a second kill if the
> +.Ar command
> +is still running after
> +.Ar time
> +seconds after the first signal was sent
> +.Sh SEE ALSO
> +.Xr signal 3 ,
> +.Xr kill 1
> 
> Added: head/usr.bin/timeout/timeout.c
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.bin/timeout/timeout.cWed Jul 16 09:55:36 2014
> (r268745)
> @@ -0,0 +1,336 @@
> +/*-
> + * Copyright (c) 2014 Baptiste Daroussin 
> + * Copyright (c) 2014 Vsevolod Stakhov 
> + * All rights reserved.
> + *~

hah? looks like an editor issue

> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer
> + *in this position and unchanged.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *~

same here



pgppUBO6D1amc.pgp
Description: PGP signature


svn commit: r268750 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 11:41:28 2014
New Revision: 268750
URL: http://svnweb.freebsd.org/changeset/base/268750

Log:
  Sort headers
  Constify long options
  Remove useless call to sigemptyset
  properly check errno when waiting for a process status when a SIGCHLD is 
received

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 11:30:04 2014
(r268749)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 11:41:28 2014
(r268750)
@@ -28,20 +28,18 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #define EXIT_TIMEOUT 124
 
@@ -188,7 +186,7 @@ main(int argc, char **argv)
cpid = -1;
pgid = -1;
 
-   struct option longopts[] = {
+   const struct option longopts[] = {
{ "preserve-status", no_argument,   &preserve,1 },
{ "foreground",  no_argument,   &foreground,  1 },
{ "kill-after",  required_argument, NULL,'k'},
@@ -271,15 +269,13 @@ main(int argc, char **argv)
/* parent continues here */
set_interval(first_kill);
 
-   sigemptyset(&signals.sa_mask);
-
for (;;) {
sigemptyset(&signals.sa_mask);
sigsuspend(&signals.sa_mask);
 
if (sig_chld) {
sig_chld = 0;
-   while (((cpid = wait(&status)) < 0) && errno != EINTR)
+   while (((cpid = wait(&status)) < 0) && errno == EINTR)
continue;
 
if (cpid == pid) {
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Konstantin Belousov
On Wed, Jul 16, 2014 at 01:29:14PM +0200, Baptiste Daroussin wrote:
> On Wed, Jul 16, 2014 at 12:45:12PM +0200, Mateusz Guzik wrote:
> > On Wed, Jul 16, 2014 at 12:34:11PM +0200, Baptiste Daroussin wrote:
> > > On Wed, Jul 16, 2014 at 12:29:08PM +0200, Mateusz Guzik wrote:
> > > > On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> > > > > +static void
> > > > > +usage(void)
> > > > > +{
> > > > > + fprintf(stderr, "Usage: %s [--signal sig | -s sig] 
> > > > > [--preserve-status]"
> > > > > + " [--kill-after time | -k time] [--foreground]  
> > > > > "
> > > > > + " \n", getprogname());
> > > > > +
> > > > 
> > > > Missing newline at the begnning.
> > > New line at the beginning?
> > > > 
> > 
> > static void
> > usage(void)
> > {
> > 
> > fprintf(...);
> 
> Fixed
> > 
> > > > > + exit(EX_USAGE);
> > > > > +}
> > > > > +
> > > > > + switch(signo) {
> > > > > + case 0:
> > > > 
> > > > sig 0? I doubt it is ever delivered.
> > > 
> > > one of the tests from the GNU testsuite is passing 0 signal
> > 
> > I even checked. The kernel is not going to deliver signal 0, so checking
> > for it in signal handler does not seem to make sense.
> > 
> > Does the testcaes fail without it or something?
> > 
> 
> Yes the test fails without it

Which test ? Kernel never delivers signal 0.  There were some bugs in
libthr which caused some signals to be reported as signal 0, they are
supposedly fixed.

The kill(0, pid) is defined as testing for the pid existence, but the
target process is not interrupted.


pgpwD1uuuFkTI.pgp
Description: PGP signature


Re: svn commit: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Konstantin Belousov
On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
Is this header needed ?
The headers are unordered.

> +#include 
> +#include 
> +
> +#define EXIT_TIMEOUT 124
> +
> +static sig_atomic_t sig_chld = 0;
> +static sig_atomic_t sig_term = 0;
> +static sig_atomic_t sig_alrm = 0;
> +static sig_atomic_t sig_ign = 0;
> +
> +static void
> +usage(void)
> +{
There should be empty line after '{' if no local vars are declared.

> + fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
> + " [--kill-after time | -k time] [--foreground]  "
> + " \n", getprogname());
> +
> + exit(EX_USAGE);
> +}
> +
> +static double
> +parse_duration(const char *duration)
> +{
> + double ret;
> + char *end;
> +
> + ret = strtod(duration, &end);
> + if (ret == 0 && end == duration)
> + errx(EXIT_FAILURE, "invalid duration");
> +
> + if (end == NULL || *end == '\0')
> + return (ret);
> +
> + if (end != NULL && *(end + 1) != '\0')
> + errx(EX_USAGE, "invalid duration");
> +
> + switch (*end) {
> + case 's':
> + break;
> + case 'm':
> + ret *= 60;
> + break;
> + case 'h':
> + ret *= 60 * 60;
> + break;
> + case 'd':
> + ret *= 60 * 60 * 24;
> + break;
> + default:
> + errx(EX_USAGE, "invalid duration");
> + }
> + 
> + if (ret < 0 || ret >= 1UL)
> + errx(EX_USAGE, "invalid duration");
> +
> + return (ret);
> +}
> +
> +static int
> +parse_signal(const char *str)
> +{
> + int sig, i;
> + const char *err;
> +
> + sig = strtonum(str, 0, sys_nsig, &err);
> +
> + if (err == NULL)
> + return (sig);
> + if (strncasecmp(str, "SIG", 3) == 0)
> + str += 3;
> +
> + for (i = 1; i < sys_nsig; i++) {
> + if (strcasecmp(str, sys_signame[i]) == 0)
> + return (i);
> + }
> + 
> + errx(EX_USAGE, "invalid signal");
> +}
> +
> +static void
> +sig_handler(int signo)
> +{
> + if (sig_ign != 0 && signo == sig_ign) {
> + sig_ign = 0;
> + return;
> + }
> +
> + switch(signo) {
> + case 0:
> + case SIGINT:
> + case SIGHUP:
> + case SIGQUIT:
> + case SIGTERM:
> + sig_term = signo;
> + break;
> + case SIGCHLD:
> + sig_chld = 1;
> + break;
> + case SIGALRM:
> + sig_alrm = 1;
> + break;
> + }
> +}
> +
> +static void
> +set_interval(double iv)
> +{
> + struct itimerval tim;
> +
> + memset(&tim, 0, sizeof(tim));
> + tim.it_value.tv_sec = (time_t)iv;
> + iv -= (time_t)iv;
> + tim.it_value.tv_usec = (suseconds_t)(iv * 100UL);
> +
> + if (setitimer(ITIMER_REAL, &tim, NULL) == -1)
> + err(EX_OSERR, "setitimer()");
> +}
> +
> +int
> +main(int argc, char **argv)
> +{
> + int ch;
> + unsigned long i;
> + int foreground, preserve;
> + int error, pstat, status;
> + int killsig = SIGTERM;
> + int killedwith;
> + pid_t pgid, pid, cpid;
> + double first_kill;
> + double second_kill;
> + bool timedout = false;
> + bool do_second_kill = false;
> + struct sigaction signals;
> + int signums[] = {
> + -1,
> + SIGTERM,
> + SIGINT,
> + SIGHUP,
> + SIGCHLD,
> + SIGALRM,
> + SIGQUIT,
> + };
> +
> + foreground = preserve = 0;
> + second_kill = 0;
> + cpid = -1;
> +
> + struct option longopts[] = {
This should be static const.

> + { "preserve-status", no_argument,   &preserve,1 },
> + { "foreground",  no_argument,   &foreground,  1 },
> + { "kill-after",  required_argument, NULL,'k'},
> + { "signal",  required_argument, NULL,'s'},
> + { "help",no_argument,   NULL,'h'},
> + { NULL,  0, NULL, 0 }
> + };
> +
> + while ((ch = getopt_long(argc, argv, "+k:s:h", longopts, NULL)) != -1) {
> + switch (ch) {
> + case 'k':
> + do_second_kill = true;
> + second_kill = parse_duration(optarg);
> + break;
> + case 's':
> + killsig = parse_signal(optarg);
> + break;
> + case 0:
> + break;
> + case 'h':
> + default:
> + usage();
> + break;
> + }
> +  

svn commit: r268749 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 11:30:04 2014
New Revision: 268749
URL: http://svnweb.freebsd.org/changeset/base/268749

Log:
  Fix typo

Modified:
  head/usr.bin/timeout/timeout.1

Modified: head/usr.bin/timeout/timeout.1
==
--- head/usr.bin/timeout/timeout.1  Wed Jul 16 11:28:53 2014
(r268748)
+++ head/usr.bin/timeout/timeout.1  Wed Jul 16 11:30:04 2014
(r268749)
@@ -49,7 +49,7 @@ and kills if it is still runs after
 .Ar duration .
 .Bl -tag -width "-k time, --kill-after time"
 .It Fl -preserve-status
-Always exist with the same status as
+Always exits with the same status as
 .Ar command
 even if it times out.
 .It Fl -foreground
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 12:45:12PM +0200, Mateusz Guzik wrote:
> On Wed, Jul 16, 2014 at 12:34:11PM +0200, Baptiste Daroussin wrote:
> > On Wed, Jul 16, 2014 at 12:29:08PM +0200, Mateusz Guzik wrote:
> > > On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> > > > +static void
> > > > +usage(void)
> > > > +{
> > > > +   fprintf(stderr, "Usage: %s [--signal sig | -s sig] 
> > > > [--preserve-status]"
> > > > +   " [--kill-after time | -k time] [--foreground]  
> > > > "
> > > > +   " \n", getprogname());
> > > > +
> > > 
> > > Missing newline at the begnning.
> > New line at the beginning?
> > > 
> 
> static void
> usage(void)
> {
> 
>   fprintf(...);

Fixed
> 
> > > > +   exit(EX_USAGE);
> > > > +}
> > > > +
> > > > +   switch(signo) {
> > > > +   case 0:
> > > 
> > > sig 0? I doubt it is ever delivered.
> > 
> > one of the tests from the GNU testsuite is passing 0 signal
> 
> I even checked. The kernel is not going to deliver signal 0, so checking
> for it in signal handler does not seem to make sense.
> 
> Does the testcaes fail without it or something?
> 

Yes the test fails without it

regards,
Bapt


pgpHiZYYpE7Oi.pgp
Description: PGP signature


svn commit: r268748 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 11:28:53 2014
New Revision: 268748
URL: http://svnweb.freebsd.org/changeset/base/268748

Log:
  Style(9) fix

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 10:37:05 2014
(r268747)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 11:28:53 2014
(r268748)
@@ -53,6 +53,7 @@ static sig_atomic_t sig_ign = 0;
 static void
 usage(void)
 {
+
fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
" [--kill-after time | -k time] [--foreground]  "
" \n", getprogname());
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Mateusz Guzik
On Wed, Jul 16, 2014 at 12:34:11PM +0200, Baptiste Daroussin wrote:
> On Wed, Jul 16, 2014 at 12:29:08PM +0200, Mateusz Guzik wrote:
> > On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> > > +static void
> > > +usage(void)
> > > +{
> > > + fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
> > > + " [--kill-after time | -k time] [--foreground]  "
> > > + " \n", getprogname());
> > > +
> > 
> > Missing newline at the begnning.
> New line at the beginning?
> > 

static void
usage(void)
{

fprintf(...);

> > > + exit(EX_USAGE);
> > > +}
> > > +
> > > + switch(signo) {
> > > + case 0:
> > 
> > sig 0? I doubt it is ever delivered.
> 
> one of the tests from the GNU testsuite is passing 0 signal

I even checked. The kernel is not going to deliver signal 0, so checking
for it in signal handler does not seem to make sense.

Does the testcaes fail without it or something?

-- 
Mateusz Guzik 
___
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: r268747 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 10:37:05 2014
New Revision: 268747
URL: http://svnweb.freebsd.org/changeset/base/268747

Log:
  Fix build with gcc

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 10:34:55 2014
(r268746)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 10:37:05 2014
(r268747)
@@ -102,11 +102,11 @@ static int
 parse_signal(const char *str)
 {
int sig, i;
-   const char *err;
+   const char *errstr;
 
-   sig = strtonum(str, 0, sys_nsig, &err);
+   sig = strtonum(str, 0, sys_nsig, &errstr);
 
-   if (err == NULL)
+   if (errstr == NULL)
return (sig);
if (strncasecmp(str, "SIG", 3) == 0)
str += 3;
@@ -166,7 +166,6 @@ main(int argc, char **argv)
int foreground, preserve;
int error, pstat, status;
int killsig = SIGTERM;
-   int killedwith;
pid_t pgid, pid, cpid;
double first_kill;
double second_kill;
@@ -186,6 +185,7 @@ main(int argc, char **argv)
foreground = preserve = 0;
second_kill = 0;
cpid = -1;
+   pgid = -1;
 
struct option longopts[] = {
{ "preserve-status", no_argument,   &preserve,1 },
@@ -273,7 +273,6 @@ main(int argc, char **argv)
sigemptyset(&signals.sa_mask);
 
for (;;) {
-   killedwith = killsig;
sigemptyset(&signals.sa_mask);
sigsuspend(&signals.sa_mask);
 
___
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: r268746 - head/usr.bin/timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 10:34:55 2014
New Revision: 268746
URL: http://svnweb.freebsd.org/changeset/base/268746

Log:
  Fix indentation

Modified:
  head/usr.bin/timeout/timeout.c

Modified: head/usr.bin/timeout/timeout.c
==
--- head/usr.bin/timeout/timeout.c  Wed Jul 16 09:55:36 2014
(r268745)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 10:34:55 2014
(r268746)
@@ -330,7 +330,7 @@ main(int argc, char **argv)
pstat = 128 + WTERMSIG(pstat);
 
if (timedout && !preserve)
-   pstat = EXIT_TIMEOUT;
+   pstat = EXIT_TIMEOUT;
 
return (pstat);
 }
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 12:29:08PM +0200, Mateusz Guzik wrote:
> On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Wed Jul 16 09:55:36 2014
> > New Revision: 268745
> > URL: http://svnweb.freebsd.org/changeset/base/268745
> > 
> > Log:
> >   New BSDL timeout(1) utility compatible with GNU timeout
> >   
> >   it fully passes the GNU timeout regression tests, it is written in a 
> > mostly
> >   portable way (only signal parsing is relying on non portable structures)
> >   
> >   Phabric:  D377
> > 
> > +static sig_atomic_t sig_chld = 0;
> > +static sig_atomic_t sig_term = 0;
> > +static sig_atomic_t sig_alrm = 0;
> > +static sig_atomic_t sig_ign = 0;
> > +
> 
> No reason to se these explicitely to 0.
> 
> > +static void
> > +usage(void)
> > +{
> > +   fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
> > +   " [--kill-after time | -k time] [--foreground]  "
> > +   " \n", getprogname());
> > +
> 
> Missing newline at the begnning.
New line at the beginning?
> 
> > +   exit(EX_USAGE);
> > +}
> > +
> > +   switch(signo) {
> > +   case 0:
> 
> sig 0? I doubt it is ever delivered.

one of the tests from the GNU testsuite is passing 0 signal
> 
> > +   if (timedout && !preserve)
> > +   pstat = EXIT_TIMEOUT;
> > +
> 
> Bad indentation.

right I'll fix

regards,
Bapt


pgpUoN6Mm1iuH.pgp
Description: PGP signature


Re: svn commit: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Baptiste Daroussin
On Wed, Jul 16, 2014 at 12:25:33PM +0200, Jan Beich wrote:
> Baptiste Daroussin  writes:
> 
> > Author: bapt
> > Date: Wed Jul 16 09:55:36 2014
> > New Revision: 268745
> > URL: http://svnweb.freebsd.org/changeset/base/268745
> >
> > Log:
> >   New BSDL timeout(1) utility compatible with GNU timeout
> >   
> >   it fully passes the GNU timeout regression tests, it is written in a 
> > mostly
> >   portable way (only signal parsing is relying on non portable structures)
> 
> --version is not supported unlike GNU timeout.

True because I found it not accurate in our case.
> 
> > +.It Fl -preserve-status
> > +Always exist with the same status as
> 
> Exist? What does timeout(1) without the option? The man page lacks
> EXIT STATUS section.
> 
>   $ timeout 1 sleep 10
>   zsh: exit 124

Yes man page could be improved a bit
> 
>   $ timeout --preserve-status 1 sleep 10
>   zsh: exit 143

signaled program have a exit which is 128 + SIGNAL (this is not documented on
GNU version) yes I should document it
> 
> > +   switch (*end) {
> > +   case 's':
> > +   break;
> > +   case 'm':
> > +   ret *= 60;
> > +   break;
> > +   case 'h':
> > +   ret *= 60 * 60;
> > +   break;
> > +   case 'd':
> > +   ret *= 60 * 60 * 24;
> > +   break;
> 
> These suffixes are not documented.

True.

regards,
Bapt


pgpWMlgqFMXDQ.pgp
Description: PGP signature


Re: svn commit: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Mateusz Guzik
On Wed, Jul 16, 2014 at 09:55:36AM +, Baptiste Daroussin wrote:
> Author: bapt
> Date: Wed Jul 16 09:55:36 2014
> New Revision: 268745
> URL: http://svnweb.freebsd.org/changeset/base/268745
> 
> Log:
>   New BSDL timeout(1) utility compatible with GNU timeout
>   
>   it fully passes the GNU timeout regression tests, it is written in a mostly
>   portable way (only signal parsing is relying on non portable structures)
>   
>   Phabric:D377
> 
> +static sig_atomic_t sig_chld = 0;
> +static sig_atomic_t sig_term = 0;
> +static sig_atomic_t sig_alrm = 0;
> +static sig_atomic_t sig_ign = 0;
> +

No reason to se these explicitely to 0.

> +static void
> +usage(void)
> +{
> + fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
> + " [--kill-after time | -k time] [--foreground]  "
> + " \n", getprogname());
> +

Missing newline at the begnning.

> + exit(EX_USAGE);
> +}
> +
> + switch(signo) {
> + case 0:

sig 0? I doubt it is ever delivered.

> + if (timedout && !preserve)
> + pstat = EXIT_TIMEOUT;
> +

Bad indentation.

> + return (pstat);
> +}
> 

-- 
Mateusz Guzik 
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Jan Beich
Baptiste Daroussin  writes:

> Author: bapt
> Date: Wed Jul 16 09:55:36 2014
> New Revision: 268745
> URL: http://svnweb.freebsd.org/changeset/base/268745
>
> Log:
>   New BSDL timeout(1) utility compatible with GNU timeout
>   
>   it fully passes the GNU timeout regression tests, it is written in a mostly
>   portable way (only signal parsing is relying on non portable structures)

--version is not supported unlike GNU timeout.

> +.It Fl -preserve-status
> +Always exist with the same status as

Exist? What does timeout(1) without the option? The man page lacks
EXIT STATUS section.

  $ timeout 1 sleep 10
  zsh: exit 124

  $ timeout --preserve-status 1 sleep 10
  zsh: exit 143

> + switch (*end) {
> + case 's':
> + break;
> + case 'm':
> + ret *= 60;
> + break;
> + case 'h':
> + ret *= 60 * 60;
> + break;
> + case 'd':
> + ret *= 60 * 60 * 24;
> + break;

These suffixes are not documented.

-

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
___
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: r268745 - in head/usr.bin: . timeout

2014-07-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul 16 09:55:36 2014
New Revision: 268745
URL: http://svnweb.freebsd.org/changeset/base/268745

Log:
  New BSDL timeout(1) utility compatible with GNU timeout
  
  it fully passes the GNU timeout regression tests, it is written in a mostly
  portable way (only signal parsing is relying on non portable structures)
  
  Phabric:  D377

Added:
  head/usr.bin/timeout/
  head/usr.bin/timeout/Makefile   (contents, props changed)
  head/usr.bin/timeout/timeout.1   (contents, props changed)
  head/usr.bin/timeout/timeout.c   (contents, props changed)
Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Wed Jul 16 08:59:44 2014(r268744)
+++ head/usr.bin/Makefile   Wed Jul 16 09:55:36 2014(r268745)
@@ -163,6 +163,7 @@ SUBDIR= alias \
${_tests} \
tftp \
time \
+   timeout \
tip \
top \
touch \

Added: head/usr.bin/timeout/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/timeout/Makefile   Wed Jul 16 09:55:36 2014
(r268745)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG=  timeout
+
+.include 

Added: head/usr.bin/timeout/timeout.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/timeout/timeout.1  Wed Jul 16 09:55:36 2014
(r268745)
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2014 Baptiste Daroussin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2014
+.Dt TIMEOUT 1
+.Os
+.Sh NAME
+.Nm timeout
+.Nd run a command with a time limit
+.Sh SYNOPSIS
+.Nm
+.Op Fl -signal Ar sig | Fl s Ar sig
+.Op Fl -preserve-status
+.Op Fl -kill-after Ar time | Fl k Ar time
+.Op Fl -foreground
+.Ao Ar duration Ac
+.Ao Ar command Ac
+.Ao Ar args ... Ac
+.Sh DESCRIPTION
+.Nm
+starts the
+.Ar command
+with its
+.Ar args
+and kills if it is still runs after
+.Ar duration .
+.Bl -tag -width "-k time, --kill-after time"
+.It Fl -preserve-status
+Always exist with the same status as
+.Ar command
+even if it times out.
+.It Fl -foreground
+Do not propagate timeout to the
+.Ar command
+children.
+.It Fl s Ar sig , Fl -signal Ar sig
+Speficy the signal to send on timeout by default
+.Ar SIGTERM .
+.It Fl k Ar time , Fl -kill-after Ar time
+Send a second kill if the
+.Ar command
+is still running after
+.Ar time
+seconds after the first signal was sent
+.Sh SEE ALSO
+.Xr signal 3 ,
+.Xr kill 1

Added: head/usr.bin/timeout/timeout.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/timeout/timeout.c  Wed Jul 16 09:55:36 2014
(r268745)
@@ -0,0 +1,336 @@
+/*-
+ * Copyright (c) 2014 Baptiste Daroussin 
+ * Copyright (c) 2014 Vsevolod Stakhov 
+ * All rights reserved.
+ *~
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *~
+ * THIS SOFTWARE IS PR

Re: svn commit: r268641 - head/usr.sbin/service

2014-07-16 Thread O'Connor, Daniel

On 16 Jul 2014, at 14:49, Adrian Chadd  wrote:
> On 15 July 2014 22:08, Mark Linimon  wrote:
>> On Tue, Jul 15, 2014 at 07:13:44PM -0700, dte...@freebsd.org wrote:
>>> destroying all vestiges of that environment purely for the sake of
>>> saying "it's clean" seems counter to the UNIX pathos.
>> 
>> I think you mean "ethos" here, but frankly I like it better this way.
> 
> I'm a bit confused by this thread.
> 
> screen and tmux are interactive processes. They're not designed to be
> run as UNIX services.
> 
> Why is this even happening?

The mine craft server port uses tmux so you can fiddle with the MC console 
later.

Neither screen nor tmux cares if TERM is set when it is run, e.g.

[midget 18:25] ~ >env -i /usr/local/bin/tmux new-session -d
[midget 18:25] ~ >tmux ls
0: 1 windows (created Wed Jul 16 18:25:33 2014) [241x38]

[midget 18:26] ~ >env -i /usr/local/bin/screen -d -m
[midget 18:26] ~ >screen -ls
There are screens on:
30081..midget   (Detached)
3 Sockets in /tmp/screens/S-darius.


Regards,
Daniel O’Connor



___
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: r268600 - in head/sys: amd64/amd64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 cddl/dev/dtrace/mips cddl/dev/dtrace/powerpc i386/i386 mips/mips powerpc/aim sys

2014-07-16 Thread Konstantin Belousov
On Wed, Jul 16, 2014 at 12:11:23AM -0400, Mark Johnston wrote:
> On Mon, Jul 14, 2014 at 11:10:50AM +0300, Konstantin Belousov wrote:
> > On Mon, Jul 14, 2014 at 04:38:17AM +, Mark Johnston wrote:
> > > Author: markj
> > > Date: Mon Jul 14 04:38:17 2014
> > > New Revision: 268600
> > > URL: http://svnweb.freebsd.org/changeset/base/268600
> > > 
> > > Log:
> > >   Invoke the DTrace trap handler before calling trap() on amd64. This 
> > > matches
> > >   the upstream implementation and helps ensure that a trap induced by 
> > > tracing
> > >   fbt::trap:entry is handled without recursively generating another trap.
> > >   
> > >   This makes it possible to run most (but not all) of the DTrace tests 
> > > under
> > >   common/safety/ without triggering a kernel panic.
> > >   
> > >   Submitted by:   Anton Rang  (original version)
> > >   Phabric:D95
> > > 
> > > Modified:
> > >   head/sys/amd64/amd64/exception.S
> > >   head/sys/amd64/amd64/trap.c
> > >   head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
> > >   head/sys/cddl/dev/dtrace/i386/dtrace_subr.c
> > >   head/sys/cddl/dev/dtrace/mips/dtrace_subr.c
> > >   head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c
> > >   head/sys/i386/i386/trap.c
> > >   head/sys/mips/mips/trap.c
> > >   head/sys/powerpc/aim/trap.c
> > >   head/sys/sys/dtrace_bsd.h
> > > 
> > > Modified: head/sys/amd64/amd64/exception.S
> > > ==
> > > --- head/sys/amd64/amd64/exception.S  Mon Jul 14 00:16:49 2014
> > > (r268599)
> > > +++ head/sys/amd64/amd64/exception.S  Mon Jul 14 04:38:17 2014
> > > (r268600)
> > > @@ -228,7 +228,24 @@ alltraps_pushregs_no_rdi:
> > >   .type   calltrap,@function
> > >  calltrap:
> > >   movq%rsp,%rdi
> > > +#ifdef KDTRACE_HOOKS
> > > + /*
> > > +  * Give DTrace a chance to vet this trap and skip the call to trap() if
> > > +  * it turns out that it was caused by a DTrace probe.
> > > +  */
> > > + movqdtrace_trap_func,%rax
> > > + testq   %rax,%rax
> > > + je  skiphook
> > > + call*%rax
> > > + testq   %rax,%rax
> > > + jne skiptrap
> > > + movq%rsp,%rdi
> > > +skiphook:
> > > +#endif
> > >   calltrap
> > Why is this fragment done in asm ?  I see it relatively easy to
> > either move to the start of trap(), or create a new wrapper around
> > current trap() which calls dtrace_trap_func conditionally, and then
> > resorts to the old trap.
> 
> You're right, it looks like this could be done in C by introducing a
> wrapper. I'm not sure how moving the conditional call to
> dtrace_trap_func() around within trap() would fix the original problem,
> though.
Ok.

> 
> The diff below adds such a wrapper, and modifies DTrace to explicitly
> ignore it when creating function boundary probes. Additionally, trap()
> is marked __noinline to ensure that it can still be instrumented. I've
> named it "_trap" for now for lack of a better name, but that will need
> to change.
Looks fine.  This should also fix the issue of kgdb and ddb not able to
unwind the trap frames.

> 
> Thanks,
> -Mark
> 
> diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
> index bb5fd56..3d34724 100644
> --- a/sys/amd64/amd64/exception.S
> +++ b/sys/amd64/amd64/exception.S
> @@ -228,24 +228,7 @@ alltraps_pushregs_no_rdi:
>   .type   calltrap,@function
>  calltrap:
>   movq%rsp,%rdi
> -#ifdef KDTRACE_HOOKS
> - /*
> -  * Give DTrace a chance to vet this trap and skip the call to trap() if
> -  * it turns out that it was caused by a DTrace probe.
> -  */
> - movqdtrace_trap_func,%rax
> - testq   %rax,%rax
> - je  skiphook
> - call*%rax
> - testq   %rax,%rax
> - jne skiptrap
> - movq%rsp,%rdi
> -skiphook:
> -#endif
> - calltrap
> -#ifdef KDTRACE_HOOKS
> -skiptrap:
> -#endif
> + call_trap
>   MEXITCOUNT
>   jmp doreti  /* Handle any pending ASTs */
>  
> diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
> index d9203bc..545174a 100644
> --- a/sys/amd64/amd64/trap.c
> +++ b/sys/amd64/amd64/trap.c
> @@ -97,7 +97,8 @@ PMC_SOFT_DEFINE( , , page_fault, write);
>  #include 
>  #endif
>  
> -extern void trap(struct trapframe *frame);
> +extern void _trap(struct trapframe *frame);
> +extern void __noinline trap(struct trapframe *frame);
>  extern void syscall(struct trapframe *frame);
>  void dblfault_handler(struct trapframe *frame);
>  
> @@ -604,6 +605,19 @@ out:
>   return;
>  }
>  
> +/*
> + * Ensure that we ignore any DTrace-induced faults. This function cannot
> + * be instrumented, so it cannot generate such faults itself.
> + */
> +void
> +_trap(struct trapframe *frame)
> +{
> +
> + if (dtrace_trap_func != NULL && (*dtrace_trap_func)(frame))
> + return;
> + trap(frame);
> +}
> +
>  static int
>  trap_pfault(frame, usermode)
>   struct trapframe *frame;
> diff --git a/sys/cddl/dev/fbt/fbt.c b/sys/cd

Re: svn commit: r268641 - head/usr.sbin/service

2014-07-16 Thread Mateusz Guzik
On Tue, Jul 15, 2014 at 07:48:46PM -0700, dte...@freebsd.org wrote:
> > -Original Message-
> > From: owner-src-committ...@freebsd.org [mailto:owner-src-
> > committ...@freebsd.org] On Behalf Of Mateusz Guzik
> > Sent: Tuesday, July 15, 2014 12:16 PM
> > 
> > Indeed, the whole point is to NOT inherit anything from calling process.
> > 
> 
> If that were the point, then we have an issue. Because as it stands,
> service(8) does _not_ accurately provide the same environment as boot.
> 
> Take the following boot script:
> 
> dte...@scribe9.vicor.com ~ $ cat /etc/rc.d/foo
> #!/bin/sh
> # PROVIDE: foo
> set > /tmp/termtest
> . /etc/rc.subr
> name=foo
> rcvar=foo_enable
> command="/usr/local/bin/tmux"
> foo_flags="new -s foo ls"
> load_rc_config $name
> run_rc_command "$1"
> 
> Now reboot to find the following in /tmp/termtest:
> 
[snip]

> Compare that with the following:
> 
> dte...@scribe9.vicor.com ~ $ sr service foo start
> dte...@scribe9.vicor.com ~ $ cat /tmp/termtest
> HOME=/
> IFS='
> '
> OPTIND=1
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> PPID=1285
> PS1='# '
> PS2='> '
> PS4='+ '
> PWD=/
> 
> Looks to me like some things are being inherited.
> Notably, it would appear that the rc.d scripts are
> run within the parent namespace which has had
> source_rc_confs() called (I'm leaving alone for the
> moment that this indicates that each rc-script is
> being less than efficient by re-sourcing rc.subr).
>

Well, let me be more specific: the point is to not inherit random stuff
which happens to be in the environment so that it does not end up in an
environment of the new process.

With than in mind here is an environment from something which was executed, not
rc.d script itself:
HOME=/
IFS='   
'
OPTIND=1
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PPID=802
PS1='# '
PS2='> '
PS4='+ '
PWD=/
RC_PID=18

Which pretty much matches 'service foo start' invocation by hand.
 
Although RC_PID seems spurious.

> Given the above (that we are farther from a "clean
> environment" than one might expect), is it really
> that big of a deal to expose $TERM? If so, what are
> the serious issues that could arise?
> 
> I personally cannot think of any shortcomings or
> fallout from adding $TERM to be exposed.

It does not make things work on boot, so you can expect people to
complain about it.

As was noted elsewhere, this is a change to the runtime which is not
needed for most. In best case it is a noop, in worst it breaks things.
It is best to not introduce differences when they are not needed

It seems the easiest thing would be to have this whole business
restricted to custom scripts dealing with tmux.

Error message could be improved to note TERM was not set.
Maybe a tmux-specific wrapper to run stuff detached should be added to
the port? It would take care of settng TERM based on some config.

Putting TERM for everyone just because the service happened to be start
by hand does not look justifiable.

-- 
Mateusz Guzik 
___
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"