svn commit: r268735 - head/sys/dev/usb/controller

2014-07-16 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul 16 06:14:41 2014
New Revision: 268735
URL: http://svnweb.freebsd.org/changeset/base/268735

Log:
  Improve support for Intel Lynx Point USB 3.0 controllers by using the
  USB 2.0 port mask in addition to the USB 3.0 port mask. The hardware
  does not always accept when writing -1U to the port switching
  registers.
  
  MFC after:3 days
  Tested by:Huang Wen Hui huang...@gmail.com

Modified:
  head/sys/dev/usb/controller/xhci_pci.c

Modified: head/sys/dev/usb/controller/xhci_pci.c
==
--- head/sys/dev/usb/controller/xhci_pci.c  Wed Jul 16 02:02:46 2014
(r268734)
+++ head/sys/dev/usb/controller/xhci_pci.c  Wed Jul 16 06:14:41 2014
(r268735)
@@ -150,6 +150,8 @@ static int
 xhci_pci_port_route(device_t self, uint32_t set, uint32_t clear)
 {
uint32_t temp;
+   uint32_t usb3_mask;
+   uint32_t usb2_mask;
 
temp = pci_read_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 4) |
pci_read_config(self, PCI_XHCI_INTEL_XUSB2PR, 4);
@@ -158,10 +160,11 @@ xhci_pci_port_route(device_t self, uint3
temp = ~clear;
 
/* Don't set bits which the hardware doesn't support */
-   temp = pci_read_config(self, PCI_XHCI_INTEL_USB3PRM, 4);
+   usb3_mask = pci_read_config(self, PCI_XHCI_INTEL_USB3PRM, 4);
+   usb2_mask = pci_read_config(self, PCI_XHCI_INTEL_USB2PRM, 4);
 
-   pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp, 4);
-   pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp, 4);
+   pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp  usb3_mask, 4);
+   pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp  usb2_mask, 4);
 
device_printf(self, Port routing mask set to 0x%08x\n, temp);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268736 - stable/9/sys/dev/usb/net

2014-07-16 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul 16 06:18:02 2014
New Revision: 268736
URL: http://svnweb.freebsd.org/changeset/base/268736

Log:
  MFC r268582:
  Fix performance problems with AXGE network adapter in RX direction:
  - Remove 4 extra bytes from the ethernet payload.
  - The maximum RX buffer was incorrectly set. Increase it to 64K for
  now, until the exact limit is understood.
  - Enable hardware checksumming again.
  - Make hardware data structure packed.

Modified:
  stable/9/sys/dev/usb/net/if_axge.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/net/if_axge.c
==
--- stable/9/sys/dev/usb/net/if_axge.c  Wed Jul 16 06:14:41 2014
(r268735)
+++ stable/9/sys/dev/usb/net/if_axge.c  Wed Jul 16 06:18:02 2014
(r268736)
@@ -77,7 +77,7 @@ static const struct {
uint8_t timer_h;
uint8_t size;
uint8_t ifg;
-} axge_bulk_size[] = {
+} __packed axge_bulk_size[] = {
{ 7, 0x4f, 0x00, 0x12, 0xff },
{ 7, 0x20, 0x03, 0x16, 0xff },
{ 7, 0xae, 0x07, 0x18, 0xff },
@@ -153,7 +153,7 @@ static const struct usb_config axge_conf
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
-   .bufsize = 20480,
+   .bufsize = 65536,
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.callback = axge_bulk_read_callback,
.timeout = 0,   /* no timeout */
@@ -613,15 +613,14 @@ tr_setup:
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
usbd_transfer_submit(xfer);
uether_rxflush(ue);
-   return;
+   break;
 
default:
if (error != USB_ERR_CANCELLED) {
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
-   return;
-
+   break;
}
 }
 
@@ -965,8 +964,8 @@ axge_rx_frame(struct usb_ether *ue, stru
DPRINTF(Dropped a packet\n);
ue-ue_ifp-if_ierrors++;
}
-   if (pktlen = 2  (int)(pos + pktlen) = actlen) {
-   axge_rxeof(ue, pc, pos + 2, pktlen - 2, pkt_hdr);
+   if (pktlen = 6  (int)(pos + pktlen) = actlen) {
+   axge_rxeof(ue, pc, pos + 2, pktlen - 6, pkt_hdr);
} else {
DPRINTF(Invalid packet pos=%d len=%d\n,
(int)pos, (int)pktlen);
@@ -1001,7 +1000,7 @@ axge_rxeof(struct usb_ether *ue, struct 
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
 
ifp-if_ipackets++;
-#if 0
+
if ((pkt_hdr  (AXGE_RXHDR_L4CSUM_ERR | AXGE_RXHDR_L3CSUM_ERR)) == 0) {
if ((pkt_hdr  AXGE_RXHDR_L4_TYPE_MASK) ==
AXGE_RXHDR_L4_TYPE_TCP ||
@@ -1012,7 +1011,7 @@ axge_rxeof(struct usb_ether *ue, struct 
m-m_pkthdr.csum_data = 0x;
}
}
-#endif
+
_IF_ENQUEUE(ue-ue_rxq, m);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268737 - stable/10/sys/dev/usb/net

2014-07-16 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul 16 06:20:18 2014
New Revision: 268737
URL: http://svnweb.freebsd.org/changeset/base/268737

Log:
  MFC r268582:
  Fix performance problems with AXGE network adapter in RX direction:
  - Remove 4 extra bytes from the ethernet payload.
  - The maximum RX buffer was incorrectly set. Increase it to 64K for
  now, until the exact limit is understood.
  - Enable hardware checksumming again.
  - Make hardware data structure packed.

Modified:
  stable/10/sys/dev/usb/net/if_axge.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/net/if_axge.c
==
--- stable/10/sys/dev/usb/net/if_axge.c Wed Jul 16 06:18:02 2014
(r268736)
+++ stable/10/sys/dev/usb/net/if_axge.c Wed Jul 16 06:20:18 2014
(r268737)
@@ -77,7 +77,7 @@ static const struct {
uint8_t timer_h;
uint8_t size;
uint8_t ifg;
-} axge_bulk_size[] = {
+} __packed axge_bulk_size[] = {
{ 7, 0x4f, 0x00, 0x12, 0xff },
{ 7, 0x20, 0x03, 0x16, 0xff },
{ 7, 0xae, 0x07, 0x18, 0xff },
@@ -153,7 +153,7 @@ static const struct usb_config axge_conf
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
-   .bufsize = 20480,
+   .bufsize = 65536,
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.callback = axge_bulk_read_callback,
.timeout = 0,   /* no timeout */
@@ -613,15 +613,14 @@ tr_setup:
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
usbd_transfer_submit(xfer);
uether_rxflush(ue);
-   return;
+   break;
 
default:
if (error != USB_ERR_CANCELLED) {
usbd_xfer_set_stall(xfer);
goto tr_setup;
}
-   return;
-
+   break;
}
 }
 
@@ -965,8 +964,8 @@ axge_rx_frame(struct usb_ether *ue, stru
DPRINTF(Dropped a packet\n);
ue-ue_ifp-if_ierrors++;
}
-   if (pktlen = 2  (int)(pos + pktlen) = actlen) {
-   axge_rxeof(ue, pc, pos + 2, pktlen - 2, pkt_hdr);
+   if (pktlen = 6  (int)(pos + pktlen) = actlen) {
+   axge_rxeof(ue, pc, pos + 2, pktlen - 6, pkt_hdr);
} else {
DPRINTF(Invalid packet pos=%d len=%d\n,
(int)pos, (int)pktlen);
@@ -1001,7 +1000,7 @@ axge_rxeof(struct usb_ether *ue, struct 
usbd_copy_out(pc, offset, mtod(m, uint8_t *), len);
 
ifp-if_ipackets++;
-#if 0
+
if ((pkt_hdr  (AXGE_RXHDR_L4CSUM_ERR | AXGE_RXHDR_L3CSUM_ERR)) == 0) {
if ((pkt_hdr  AXGE_RXHDR_L4_TYPE_MASK) ==
AXGE_RXHDR_L4_TYPE_TCP ||
@@ -1012,7 +1011,7 @@ axge_rxeof(struct usb_ether *ue, struct 
m-m_pkthdr.csum_data = 0x;
}
}
-#endif
+
_IF_ENQUEUE(ue-ue_rxq, m);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268738 - stable/10/sys/dev/usb/input

2014-07-16 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul 16 06:22:35 2014
New Revision: 268738
URL: http://svnweb.freebsd.org/changeset/base/268738

Log:
  MFC r268583:
  Turn off blinking device leds at attach.
  
  PR:   183735

Modified:
  stable/10/sys/dev/usb/input/uhid.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/input/uhid.c
==
--- stable/10/sys/dev/usb/input/uhid.c  Wed Jul 16 06:20:18 2014
(r268737)
+++ stable/10/sys/dev/usb/input/uhid.c  Wed Jul 16 06:22:35 2014
(r268738)
@@ -759,9 +759,20 @@ uhid_attach(device_t dev)
sc-sc_flags |= UHID_FLAG_STATIC_DESC;
}
} else if ((uaa-info.bInterfaceClass == UICLASS_VENDOR) 
-   (uaa-info.bInterfaceSubClass == 
UISUBCLASS_XBOX360_CONTROLLER) 
+   (uaa-info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) 
(uaa-info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD)) {
-
+   static const uint8_t reportbuf[3] = {1, 3, 0};
+   /*
+* Turn off the four LEDs on the gamepad which
+* are blinking by default:
+*/
+   error = usbd_req_set_report(uaa-device, NULL,
+   __DECONST(void *, reportbuf), sizeof(reportbuf),
+   uaa-info.bIfaceIndex, UHID_OUTPUT_REPORT, 0);
+   if (error) {
+   DPRINTF(set output report failed, error=%s 
(ignored)\n,
+   usbd_errstr(error));
+   }
/* the Xbox 360 gamepad has no report descriptor */
sc-sc_repdesc_size = sizeof(uhid_xb360gp_report_descr);
sc-sc_repdesc_ptr = (void *)uhid_xb360gp_report_descr;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268740 - stable/8/sys/dev/usb/input

2014-07-16 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul 16 06:25:44 2014
New Revision: 268740
URL: http://svnweb.freebsd.org/changeset/base/268740

Log:
  MFC r268583:
  Turn off blinking device leds at attach.
  
  PR:   183735

Modified:
  stable/8/sys/dev/usb/input/uhid.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/input/uhid.c
==
--- stable/8/sys/dev/usb/input/uhid.c   Wed Jul 16 06:23:54 2014
(r268739)
+++ stable/8/sys/dev/usb/input/uhid.c   Wed Jul 16 06:25:44 2014
(r268740)
@@ -759,9 +759,20 @@ uhid_attach(device_t dev)
sc-sc_flags |= UHID_FLAG_STATIC_DESC;
}
} else if ((uaa-info.bInterfaceClass == UICLASS_VENDOR) 
-   (uaa-info.bInterfaceSubClass == 
UISUBCLASS_XBOX360_CONTROLLER) 
+   (uaa-info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) 
(uaa-info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD)) {
-
+   static const uint8_t reportbuf[3] = {1, 3, 0};
+   /*
+* Turn off the four LEDs on the gamepad which
+* are blinking by default:
+*/
+   error = usbd_req_set_report(uaa-device, NULL,
+   __DECONST(void *, reportbuf), sizeof(reportbuf),
+   uaa-info.bIfaceIndex, UHID_OUTPUT_REPORT, 0);
+   if (error) {
+   DPRINTF(set output report failed, error=%s 
(ignored)\n,
+   usbd_errstr(error));
+   }
/* the Xbox 360 gamepad has no report descriptor */
sc-sc_repdesc_size = sizeof(uhid_xb360gp_report_descr);
sc-sc_repdesc_ptr = (void *)uhid_xb360gp_report_descr;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 mjguzik gmail.com
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 anton.r...@isilon.com (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 sys/dtrace_bsd.h
  #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/cddl/dev/fbt/fbt.c
 index 7e256e7..0cc2db2 100644
 --- a/sys/cddl/dev/fbt/fbt.c
 +++ b/sys/cddl/dev/fbt/fbt.c
 @@ -232,13 +232,18 @@ fbt_provide_module_function(linker_file_t lf, int 
 symindx,
   int size;
   u_int8_t 

svn commit: r268741 - stable/10/lib/libc/gen

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

Log:
  MFC r268467:
  Implement sysconf(_SC_GETGR_R_SIZE_MAX) and sysconf(_SC_GETPW_R_SIZE_MAX).

Modified:
  stable/10/lib/libc/gen/sysconf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/sysconf.c
==
--- stable/10/lib/libc/gen/sysconf.cWed Jul 16 06:25:44 2014
(r268740)
+++ stable/10/lib/libc/gen/sysconf.cWed Jul 16 08:52:44 2014
(r268741)
@@ -367,11 +367,17 @@ yesno:
 * _POSIX_FILE_LOCKING, so we can't answer this one.
 */
 #endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS  -1
+
+   /*
+* SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
+* _SC_GETPW_R_SIZE_MAX:
+* Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
+* there is no hard limit on the size of the buffer needed to
+* store all the groups returned.
+*/
case _SC_GETGR_R_SIZE_MAX:
case _SC_GETPW_R_SIZE_MAX:
-#error somebody needs to implement this
-#endif
+   return (-1);
case _SC_HOST_NAME_MAX:
return (MAXHOSTNAMELEN - 1); /* does not include \0 */
case _SC_LOGIN_NAME_MAX:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268742 - stable/10/sys/amd64/amd64

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

Log:
  MFC r268471:
  For safety, ensure that any consumer of the set_regs() and
  ptrace_set_pc() use the correct return to userspace using iret.

Modified:
  stable/10/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/machdep.c
==
--- stable/10/sys/amd64/amd64/machdep.c Wed Jul 16 08:52:44 2014
(r268741)
+++ stable/10/sys/amd64/amd64/machdep.c Wed Jul 16 08:55:53 2014
(r268742)
@@ -1979,7 +1979,9 @@ makectx(struct trapframe *tf, struct pcb
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
+
td-td_frame-tf_rip = addr;
+   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
return (0);
 }
 
@@ -2079,8 +2081,8 @@ set_regs(struct thread *td, struct reg *
tp-tf_fs = regs-r_fs;
tp-tf_gs = regs-r_gs;
tp-tf_flags = TF_HASSEGS;
-   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
}
+   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-16 Thread O'Connor, Daniel

On 16 Jul 2014, at 14:49, Adrian Chadd adr...@freebsd.org wrote:
 On 15 July 2014 22:08, Mark Linimon lini...@lonesome.com 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268743 - stable/9/lib/libc/gen

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

Log:
  MFC r268467:
  Implement sysconf(_SC_GETGR_R_SIZE_MAX) and sysconf(_SC_GETPW_R_SIZE_MAX).

Modified:
  stable/9/lib/libc/gen/sysconf.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/sysconf.c
==
--- stable/9/lib/libc/gen/sysconf.c Wed Jul 16 08:55:53 2014
(r268742)
+++ stable/9/lib/libc/gen/sysconf.c Wed Jul 16 08:58:38 2014
(r268743)
@@ -367,11 +367,17 @@ yesno:
 * _POSIX_FILE_LOCKING, so we can't answer this one.
 */
 #endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS  -1
+
+   /*
+* SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
+* _SC_GETPW_R_SIZE_MAX:
+* Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
+* there is no hard limit on the size of the buffer needed to
+* store all the groups returned.
+*/
case _SC_GETGR_R_SIZE_MAX:
case _SC_GETPW_R_SIZE_MAX:
-#error somebody needs to implement this
-#endif
+   return (-1);
case _SC_HOST_NAME_MAX:
return (MAXHOSTNAMELEN - 1); /* does not include \0 */
case _SC_LOGIN_NAME_MAX:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268744 - stable/9/sys/amd64/amd64

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

Log:
  MFC r268471:
  For safety, ensure that any consumer of the set_regs() and
  ptrace_set_pc() use the correct return to userspace using iret.

Modified:
  stable/9/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/machdep.c
==
--- stable/9/sys/amd64/amd64/machdep.c  Wed Jul 16 08:58:38 2014
(r268743)
+++ stable/9/sys/amd64/amd64/machdep.c  Wed Jul 16 08:59:44 2014
(r268744)
@@ -1945,7 +1945,9 @@ makectx(struct trapframe *tf, struct pcb
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
+
td-td_frame-tf_rip = addr;
+   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
return (0);
 }
 
@@ -2045,8 +2047,8 @@ set_regs(struct thread *td, struct reg *
tp-tf_fs = regs-r_fs;
tp-tf_gs = regs-r_gs;
tp-tf_flags = TF_HASSEGS;
-   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
}
+   set_pcb_flags(td-td_pcb, PCB_FULL_IRET);
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 bsd.prog.mk

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 b...@freebsd.org
+.\ 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 b...@freebsd.org
+ * Copyright (c) 2014 Vsevolod Stakhov vsevo...@freebsd.org
+ * 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 

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

2014-07-16 Thread Jan Beich
Baptiste Daroussin b...@freebsd.org 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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] duration command
 +  arg ...\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 mjguzik gmail.com
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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:25:33PM +0200, Jan Beich wrote:
 Baptiste Daroussin b...@freebsd.org 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


pgp1sgZIsxqFK.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: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] duration command
  +arg ...\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


pgpePZlnJcGXL.pgp
Description: PGP signature


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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] duration command
   +  arg ...\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 mjguzik gmail.com
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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] duration command
 arg ...\n, getprogname());
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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] duration 
command
+arg ...\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


pgpvbs076Ys0Y.pgp
Description: PGP signature


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 sys/types.h
 +#include sys/time.h
 +#include sys/wait.h
 +#include signal.h
 +#include stdio.h
 +#include stdlib.h
 +#include string.h
 +#include sysexits.h
 +#include unistd.h
 +#include getopt.h
 +#include err.h
 +#include spawn.h
Is this header needed ?
The headers are unordered.

 +#include errno.h
 +#include stdbool.h
 +
 +#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] duration command
 +  arg ...\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;
 + }
 + }
 +
 + argc -= optind;
 + argv += optind;
 +
 + if (argc  2)
 + 

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] duration 
 command
 +  arg ...\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.


pgpU_D5OLbTW0.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 sys/cdefs.h
 __FBSDID($FreeBSD$);
 
-#include sys/types.h
-#include sys/time.h
-#include sys/wait.h
+#include err.h
+#include errno.h
+#include getopt.h
 #include signal.h
+#include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include sys/time.h
+#include sys/wait.h
 #include sysexits.h
 #include unistd.h
-#include getopt.h
-#include err.h
-#include spawn.h
-#include errno.h
-#include stdbool.h
 
 #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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 b...@freebsd.org
 + * Copyright (c) 2014 Vsevolod Stakhov vsevo...@freebsd.org
 + * 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



pgpm2RFoTuERI.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 b...@freebsd.org
  * Copyright (c) 2014 Vsevolod Stakhov vsevo...@freebsd.org
  * 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 sys/cdefs.h
  __FBSDID($FreeBSD$);
  
 -#include sys/types.h
 -#include sys/time.h
 -#include sys/wait.h
 +#include err.h
 +#include errno.h
 +#include getopt.h
  #include signal.h
 +#include stdbool.h
  #include stdio.h
  #include stdlib.h
  #include string.h
 +#include sys/time.h
 +#include sys/wait.h
  #include sysexits.h
  #include unistd.h
 -#include getopt.h
 -#include err.h
 -#include spawn.h
 -#include errno.h
 -#include stdbool.h
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.


pgpRD__G9r6fV.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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 sys/cdefs.h
   __FBSDID($FreeBSD$);
   
  -#include sys/types.h
  -#include sys/time.h
  -#include sys/wait.h
  +#include err.h
  +#include errno.h
  +#include getopt.h
   #include signal.h
  +#include stdbool.h
   #include stdio.h
   #include stdlib.h
   #include string.h
  +#include sys/time.h
  +#include sys/wait.h
   #include sysexits.h
   #include unistd.h
  -#include getopt.h
  -#include err.h
  -#include spawn.h
  -#include errno.h
  -#include stdbool.h
 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


pgpE0s61vq2vN.pgp
Description: PGP signature


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

2014-07-16 Thread Sergey Kandaurov
On 16 July 2014 13:55, Baptiste Daroussin b...@freebsd.org 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 b...@freebsd.org
 +.\ 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 b...@freebsd.org
 + * Copyright (c) 2014 Vsevolod Stakhov vsevo...@freebsd.org
 + * 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.
 + */
 +
 +#include sys/cdefs.h
 +__FBSDID($FreeBSD$);
 +
 +#include sys/types.h
 +#include 

svn commit: r268753 - stable/9/usr.bin/calendar/calendars

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:38:46 2014
New Revision: 268753
URL: http://svnweb.freebsd.org/changeset/base/268753

Log:
  Merge r268292 from head:
Dominion Day became Canada Day in 1982, update the holiday calendar.
  
  PR:   191533
  Submitted by: db

Modified:
  stable/9/usr.bin/calendar/calendars/calendar.holiday
Directory Properties:
  stable/9/usr.bin/calendar/   (props changed)
  stable/9/usr.bin/calendar/calendars/   (props changed)

Modified: stable/9/usr.bin/calendar/calendars/calendar.holiday
==
--- stable/9/usr.bin/calendar/calendars/calendar.holidayWed Jul 16 
12:37:36 2014(r268752)
+++ stable/9/usr.bin/calendar/calendars/calendar.holidayWed Jul 16 
12:38:46 2014(r268753)
@@ -248,7 +248,7 @@
 06/30  Day of the Army in Guatemala
 06/MonFirstJefferson Davis's Birthday in Alabama  Mississippi (1st Monday)
 06/MonFirstJefferson Davis's Birthday in Florida, Georgia,  S. Carolina
-07/01  Dominion Day in Canada
+07/01  Canada Day
 07/01  Freedom Day in Suriname
 07/01  Independence Day in Burundi
 07/01  National Day in Rwanda
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268754 - stable/9/games/fortune/datfiles

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:41:49 2014
New Revision: 268754
URL: http://svnweb.freebsd.org/changeset/base/268754

Log:
  Merge r268295 from head:
Fix equation and limerick to be correct.  NetBSD fixed this 14 years ago
(src/games/fortune/datfiles/fortunes2 1.7).
  
  PR:   188714
  Submitted by: ksmakoto dd.iij4u.or.jp

Modified:
  stable/9/games/fortune/datfiles/fortunes
Directory Properties:
  stable/9/games/fortune/   (props changed)

Modified: stable/9/games/fortune/datfiles/fortunes
==
--- stable/9/games/fortune/datfiles/fortunesWed Jul 16 12:38:46 2014
(r268753)
+++ stable/9/games/fortune/datfiles/fortunesWed Jul 16 12:41:49 2014
(r268754)
@@ -570,7 +570,7 @@ writing.  Always pick on the correct idi
 the verb.  Last but not least, avoid cliches like the plague; seek
 viable alternatives.
 %
- 1/2
+ 1/3
 /\(3)
 | 2  1/3
 |z dz cos(3 * PI / 9) = ln (e   )
@@ -578,7 +578,7 @@ viable alternatives.
\/ 1
 
 The integral of z squared, dz
-From 1 to the square root of 3
+From 1 to the cube root of 3
Times the cosine
Of 3 PI over nine
 Is the log of the cube root of e
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268755 - stable/10/games/fortune/datfiles

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:41:50 2014
New Revision: 268755
URL: http://svnweb.freebsd.org/changeset/base/268755

Log:
  Merge r268295 from head:
Fix equation and limerick to be correct.  NetBSD fixed this 14 years ago
(src/games/fortune/datfiles/fortunes2 1.7).
  
  PR:   188714
  Submitted by: ksmakoto dd.iij4u.or.jp

Modified:
  stable/10/games/fortune/datfiles/fortunes
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/games/fortune/datfiles/fortunes
==
--- stable/10/games/fortune/datfiles/fortunes   Wed Jul 16 12:41:49 2014
(r268754)
+++ stable/10/games/fortune/datfiles/fortunes   Wed Jul 16 12:41:50 2014
(r268755)
@@ -570,7 +570,7 @@ writing.  Always pick on the correct idi
 the verb.  Last but not least, avoid cliches like the plague; seek
 viable alternatives.
 %
- 1/2
+ 1/3
 /\(3)
 | 2  1/3
 |z dz cos(3 * PI / 9) = ln (e   )
@@ -578,7 +578,7 @@ viable alternatives.
\/ 1
 
 The integral of z squared, dz
-From 1 to the square root of 3
+From 1 to the cube root of 3
Times the cosine
Of 3 PI over nine
 Is the log of the cube root of e
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268756 - stable/10

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:45:13 2014
New Revision: 268756
URL: http://svnweb.freebsd.org/changeset/base/268756

Log:
  Merge r268342 from head:
Remove /usr/share/doc/psd/28.cvs/paper.ps.gz if it exists, as it is
obsolete since r251794.
  
  PR:   191003
  Submitted by: Vick Khera

Modified:
  stable/10/ObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/ObsoleteFiles.inc
==
--- stable/10/ObsoleteFiles.inc Wed Jul 16 12:41:50 2014(r268755)
+++ stable/10/ObsoleteFiles.inc Wed Jul 16 12:45:13 2014(r268756)
@@ -442,6 +442,7 @@ OLD_FILES+=usr/share/man/man9/vfs_mount.
 OLD_FILES+=usr/bin/cvs
 OLD_FILES+=usr/bin/cvsbug
 OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ascii.gz
+OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ps.gz
 OLD_DIRS+=usr/share/doc/psd/28.cvs
 OLD_FILES+=usr/share/examples/cvs/contrib/README
 OLD_FILES+=usr/share/examples/cvs/contrib/clmerge
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268758 - stable/10/share/examples/etc

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:49:56 2014
New Revision: 268758
URL: http://svnweb.freebsd.org/changeset/base/268758

Log:
  Merge r267865 from head:
Drop example variables for updating over csup.  These have not functioned
since r251084

Modified:
  stable/10/share/examples/etc/make.conf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/examples/etc/make.conf
==
--- stable/10/share/examples/etc/make.conf  Wed Jul 16 12:49:42 2014
(r268757)
+++ stable/10/share/examples/etc/make.conf  Wed Jul 16 12:49:56 2014
(r268758)
@@ -178,18 +178,6 @@
 #ENABLE_SUID_K5SU=
 #
 #
-# CVSup update flags.  Edit SUPFILE settings to reflect whichever distribution
-# file(s) you use on your site (see /usr/share/examples/cvsup/README for more
-# information on CVSup and these files).  To use, do make update in /usr/src.
-#
-#SUP_UPDATE=
-#
-#SUP=/usr/bin/csup
-#SUPFLAGS=   -L 2
-#SUPHOST=cvsup.uk.FreeBSD.org
-#SUPFILE=/usr/share/examples/cvsup/standard-supfile
-#PORTSSUPFILE=   /usr/share/examples/cvsup/ports-supfile
-#
 # top(1) uses a hash table for the user names.  The size of this hash
 # can be tuned to match the number of local users.  The table size should
 # be a prime number approximately twice as large as the number of lines in
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268757 - stable/9/share/examples/etc

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:49:42 2014
New Revision: 268757
URL: http://svnweb.freebsd.org/changeset/base/268757

Log:
  Merge r267865 from head:
Drop example variables for updating over csup.  These have not functioned
since r252305.

Modified:
  stable/9/share/examples/etc/make.conf
Directory Properties:
  stable/9/share/examples/   (props changed)
  stable/9/share/examples/etc/   (props changed)

Modified: stable/9/share/examples/etc/make.conf
==
--- stable/9/share/examples/etc/make.conf   Wed Jul 16 12:45:13 2014
(r268756)
+++ stable/9/share/examples/etc/make.conf   Wed Jul 16 12:49:42 2014
(r268757)
@@ -172,18 +172,6 @@
 #ENABLE_SUID_K5SU=
 #
 #
-# CVSup update flags.  Edit SUPFILE settings to reflect whichever distribution
-# file(s) you use on your site (see /usr/share/examples/cvsup/README for more
-# information on CVSup and these files).  To use, do make update in /usr/src.
-#
-#SUP_UPDATE=
-#
-#SUP=/usr/bin/csup
-#SUPFLAGS=   -L 2
-#SUPHOST=cvsup.uk.FreeBSD.org
-#SUPFILE=/usr/share/examples/cvsup/standard-supfile
-#PORTSSUPFILE=   /usr/share/examples/cvsup/ports-supfile
-#
 # top(1) uses a hash table for the user names.  The size of this hash
 # can be tuned to match the number of local users.  The table size should
 # be a prime number approximately twice as large as the number of lines in
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268759 - stable/10/share/man/man7

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:51:29 2014
New Revision: 268759
URL: http://svnweb.freebsd.org/changeset/base/268759

Log:
  Merge r267866 from head:
Drop references to updating over csup from build(7).

Modified:
  stable/10/share/man/man7/build.7
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man7/build.7
==
--- stable/10/share/man/man7/build.7Wed Jul 16 12:49:56 2014
(r268758)
+++ stable/10/share/man/man7/build.7Wed Jul 16 12:51:29 2014
(r268759)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 17, 2014
+.Dd June 25, 2014
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -40,8 +40,7 @@ normally
 and
 .Pa /usr/ports .
 These directories may be initially empty or non-existent until updated with
-.Xr csup 1 ,
-.Xr svn 1 ,
+.Xr svn 1
 or
 .Xr portsnap 8 .
 Directory
@@ -616,7 +615,6 @@ make TARGET=sparc64 DESTDIR=/clients/spa
 .Ed
 .Sh SEE ALSO
 .Xr cc 1 ,
-.Xr csup 1 ,
 .Xr install 1 ,
 .Xr make 1 ,
 .Xr svn 1 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268760 - stable/9/share/man/man7

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:52:05 2014
New Revision: 268760
URL: http://svnweb.freebsd.org/changeset/base/268760

Log:
  Merge r267866 from head:
Drop references to updating over csup from build(7).

Modified:
  stable/9/share/man/man7/build.7
Directory Properties:
  stable/9/share/man/man7/   (props changed)

Modified: stable/9/share/man/man7/build.7
==
--- stable/9/share/man/man7/build.7 Wed Jul 16 12:51:29 2014
(r268759)
+++ stable/9/share/man/man7/build.7 Wed Jul 16 12:52:05 2014
(r268760)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 10, 2012
+.Dd June 25, 2014
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -40,8 +40,7 @@ normally
 and
 .Pa /usr/ports .
 These directories may be initially empty or non-existent until updated with
-.Xr csup 1 ,
-.Xr svn 1 ,
+.Xr svn 1
 or
 .Xr portsnap 8 .
 Directory
@@ -593,7 +592,6 @@ make TARGET=sparc64 DESTDIR=/clients/spa
 .Ed
 .Sh SEE ALSO
 .Xr cc 1 ,
-.Xr csup 1 ,
 .Xr install 1 ,
 .Xr make 1 ,
 .Xr svn 1 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268761 - stable/9/usr.sbin/uhsoctl

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:57:50 2014
New Revision: 268761
URL: http://svnweb.freebsd.org/changeset/base/268761

Log:
  Merge r268298,r268299 from head:
Correct format string to fix build of uhsoctl when DEBUG is defined
  
  PR:   185007
  Submitted by: saper saper.info

Modified:
  stable/9/usr.sbin/uhsoctl/uhsoctl.c
Directory Properties:
  stable/9/usr.sbin/uhsoctl/   (props changed)

Modified: stable/9/usr.sbin/uhsoctl/uhsoctl.c
==
--- stable/9/usr.sbin/uhsoctl/uhsoctl.c Wed Jul 16 12:52:05 2014
(r268760)
+++ stable/9/usr.sbin/uhsoctl/uhsoctl.c Wed Jul 16 12:57:50 2014
(r268761)
@@ -601,7 +601,7 @@ at_cmd(struct ctx *ctx, const char *resp
if (resp != NULL) {
l = strlen(resp);
 #ifdef DEBUG
-   fprintf(stderr, SYNC_EXP: %s (%d)\n, resp, l);
+   fprintf(stderr, SYNC_EXP: %s (%zu)\n, resp, l);
 #endif
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268762 - stable/10/usr.sbin/uhsoctl

2014-07-16 Thread Gavin Atkinson
Author: gavin
Date: Wed Jul 16 12:57:53 2014
New Revision: 268762
URL: http://svnweb.freebsd.org/changeset/base/268762

Log:
  Merge r268298,r268299 from head:
Correct format string to fix build of uhsoctl when DEBUG is defined
  
  PR:   185007
  Submitted by: saper saper.info

Modified:
  stable/10/usr.sbin/uhsoctl/uhsoctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/uhsoctl/uhsoctl.c
==
--- stable/10/usr.sbin/uhsoctl/uhsoctl.cWed Jul 16 12:57:50 2014
(r268761)
+++ stable/10/usr.sbin/uhsoctl/uhsoctl.cWed Jul 16 12:57:53 2014
(r268762)
@@ -601,7 +601,7 @@ at_cmd(struct ctx *ctx, const char *resp
if (resp != NULL) {
l = strlen(resp);
 #ifdef DEBUG
-   fprintf(stderr, SYNC_EXP: %s (%d)\n, resp, l);
+   fprintf(stderr, SYNC_EXP: %s (%zu)\n, resp, l);
 #endif
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include sys/time.h
+#include sys/wait.h
+
 #include err.h
 #include errno.h
 #include getopt.h
@@ -36,8 +39,6 @@ __FBSDID($FreeBSD$);
 #include stdio.h
 #include stdlib.h
 #include string.h
-#include sys/time.h
-#include sys/wait.h
 #include sysexits.h
 #include unistd.h
 
@@ -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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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:
vrele(nd.ni_vp);
  

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 sys/proc.h
 #include sys/rwlock.h
 #include sys/sched.h
-#include sys/sf_buf.h
 #include sys/stat.h
 #include sys/systm.h
 #include sys/sysctl.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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_target_ports * (sizeof(struct 

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-all@freebsd.org; Bryan Drewery;
 src-committ...@freebsd.org; svn-src-h...@freebsd.org; Devin Teske
 Subject: Re: svn commit: r268641 - head/usr.sbin/service
 
 
 On 16 Jul 2014, at 14:49, Adrian Chadd adr...@freebsd.org wrote:
  On 15 July 2014 22:08, Mark Linimon lini...@lonesome.com 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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/number 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: ID-including-D-prefix 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/ID' ala 'review.freebsd.org/ID' or the like.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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/number 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: ID-including-D-prefix 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/ID' ala 'review.freebsd.org/ID' 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


pgpK6JQuQGz0X.pgp
Description: PGP signature


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 bsd.lib.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 j...@freebsd.org wrote:
 On Fri, Jun 20, 2014 at 1:14 PM, Jonathan Anderson jonat...@freebsd.org 
 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 dev/vt/hw/fb/vt_fb.h
 #include dev/vt/colors/vt_termcolors.h
 
-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:
-   

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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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-all@freebsd.org'; 'Bryan
 Drewery'; 'src-committ...@freebsd.org'; 'svn-src-h...@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-all@freebsd.org; Bryan Drewery;
  src-committ...@freebsd.org; svn-src-h...@freebsd.org; Devin Teske
  Subject: Re: svn commit: r268641 - head/usr.sbin/service
 
 
  On 16 Jul 2014, at 14:49, Adrian Chadd adr...@freebsd.org wrote:
   On 15 July 2014 22:08, Mark Linimon lini...@lonesome.com 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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 mjguzik gmail.com
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268775 - stable/10/lib/libproc

2014-07-16 Thread Dimitry Andric
Author: dim
Date: Wed Jul 16 21:04:31 2014
New Revision: 268775
URL: http://svnweb.freebsd.org/changeset/base/268775

Log:
  MFC r268463:
  
  In libproc, avoid calling __cxa_demangle(), and thus depending on either
  libcxxrt or libsupc++, if WITHOUT_CXX is defined. [1]
  
  Noticed by:   sbruno
  
  [1] However, on stable/10 this is more accurately described by
  WITHOUT_GNUCXX, so I've changed the test to that instead.

Modified:
  stable/10/lib/libproc/Makefile
  stable/10/lib/libproc/proc_sym.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libproc/Makefile
==
--- stable/10/lib/libproc/Makefile  Wed Jul 16 20:37:03 2014
(r268774)
+++ stable/10/lib/libproc/Makefile  Wed Jul 16 21:04:31 2014
(r268775)
@@ -18,9 +18,11 @@ CFLAGS+= -I${.CURDIR}
 .if ${MK_LIBCPLUSPLUS} != no
 LDADD+=-lcxxrt
 DPADD+=${LIBCXXRT}
-.else
+.elif ${MK_GNUCXX} != no
 LDADD+=-lsupc++
 DPADD+=${LIBSTDCPLUSPLUS}
+.else
+CFLAGS+=   -DNO_CXA_DEMANGLE
 .endif
 
 SHLIB_MAJOR=   2

Modified: stable/10/lib/libproc/proc_sym.c
==
--- stable/10/lib/libproc/proc_sym.cWed Jul 16 20:37:03 2014
(r268774)
+++ stable/10/lib/libproc/proc_sym.cWed Jul 16 21:04:31 2014
(r268775)
@@ -46,27 +46,34 @@
 
 #include _libproc.h
 
+#ifndef NO_CXA_DEMANGLE
 extern char *__cxa_demangle(const char *, char *, size_t *, int *);
+#endif /* NO_CXA_DEMANGLE */
 
 static voidproc_rdl2prmap(rd_loadobj_t *, prmap_t *);
 
 static void
 demangle(const char *symbol, char *buf, size_t len)
 {
+#ifndef NO_CXA_DEMANGLE
char *dembuf;
-   size_t demlen = len;
+   size_t demlen;
 
-   dembuf = malloc(len);
-   if (!dembuf)
-   goto fail;
-   dembuf = __cxa_demangle(symbol, dembuf, demlen, NULL);
-   if (!dembuf)
-   goto fail;
-   strlcpy(buf, dembuf, len);
-   free(dembuf);
+   if (symbol[0] == '_'  symbol[1] == 'Z'  symbol[2]) {
+   dembuf = malloc(len);
+   if (!dembuf)
+   goto fail;
+   demlen = len;
+   dembuf = __cxa_demangle(symbol, dembuf, demlen, NULL);
+   if (!dembuf)
+   goto fail;
+   strlcpy(buf, dembuf, len);
+   free(dembuf);
+   }
 
return;
 fail:
+#endif /* NO_CXA_DEMANGLE */
strlcpy(buf, symbol, len);
 }
 
@@ -291,10 +298,7 @@ proc_addr2sym(struct proc_handle *p, uin
if (addr = rsym  addr  rsym + sym.st_size) {
s = elf_strptr(e, dynsymstridx, sym.st_name);
if (s) {
-   if (s[0] == '_'  s[1] == 'Z'  s[2])
-   demangle(s, name, namesz);
-   else
-   strlcpy(name, s, namesz);
+   demangle(s, name, namesz);
memcpy(symcopy, sym, sizeof(sym));
/*
 * DTrace expects the st_value to contain
@@ -329,10 +333,7 @@ symtab:
if (addr = rsym  addr  rsym + sym.st_size) {
s = elf_strptr(e, symtabstridx, sym.st_name);
if (s) {
-   if (s[0] == '_'  s[1] == 'Z'  s[2])
-   demangle(s, name, namesz);
-   else
-   strlcpy(name, s, namesz);
+   demangle(s, name, namesz);
memcpy(symcopy, sym, sizeof(sym));
/*
 * DTrace expects the st_value to contain
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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)
+   next_bucket = eva;
+  

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:
+   return 

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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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


pgpao4D1UbFGY.pgp
Description: PGP signature


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 ? 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;
}
}
-
/*
  

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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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 b...@freebsd.org 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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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


pgp0EepJcVAP1.pgp
Description: PGP signature


svn commit: r268782 - in stable/10/lib/libedit: . TEST

2014-07-16 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 17 02:14:25 2014
New Revision: 268782
URL: http://svnweb.freebsd.org/changeset/base/268782

Log:
  MFC   r268502:
  Sync some (mostly cosmetical) changes from NetBSD
  
  Makefile,v 1.37
  tc1.c v 1.3
  Rename TEST/test.c tc1.c
  
  common.c,v 1.23
  pass lint on _LP64.
  
  emacs.c,v 1.22
  pass lint on _LP64.
  
  filecomplete.h,v 1.8
  mv NetBSD ID back from 1.9 as we don't
  have the widecharacter support.
  
  prompt.c,v 1.14
  prompt.h,v 1.9
  term.h,v 1.20
  read.h,v 1.6
  Update NetBSD version strings
  
  sys.h,v 1.12
  Misc sun stuff.
  
  tty.c 1.31
  handle EINTR in the termios operations
  Allow a single process to control multiple ttys (for pthreads using 
_REENTRANT)
  using multiple EditLine objects.
  pass lint on _LP64.
  Don't depend on side effects inside an assert
  
  Obtained from:NetBSD

Added:
  stable/10/lib/libedit/TEST/tc1.c
 - copied unchanged from r268502, head/lib/libedit/TEST/tc1.c
Deleted:
  stable/10/lib/libedit/TEST/test.c
Modified:
  stable/10/lib/libedit/Makefile
  stable/10/lib/libedit/common.c
  stable/10/lib/libedit/emacs.c
  stable/10/lib/libedit/filecomplete.h
  stable/10/lib/libedit/histedit.h
  stable/10/lib/libedit/prompt.c
  stable/10/lib/libedit/prompt.h
  stable/10/lib/libedit/read.h
  stable/10/lib/libedit/sys.h
  stable/10/lib/libedit/term.h
  stable/10/lib/libedit/tty.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libedit/Makefile
==
--- stable/10/lib/libedit/Makefile  Wed Jul 16 23:17:57 2014
(r268781)
+++ stable/10/lib/libedit/Makefile  Thu Jul 17 02:14:25 2014
(r268782)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $
+#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -70,9 +70,9 @@ editline.c: ${OSRCS}
 editline.o editline.po editline.So editline.ln:\
common.h emacs.h fcns.c fcns.h help.c help.h vi.h
 
-test.o: ${.CURDIR}/TEST/test.c
+tc1.o: ${.CURDIR}/TEST/tc1.c
 
-test: test.o libedit.a ${DPADD} ${LIBTERMCAP}
+test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP}
${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD}
 
 .include bsd.lib.mk

Copied: stable/10/lib/libedit/TEST/tc1.c (from r268502, 
head/lib/libedit/TEST/tc1.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/lib/libedit/TEST/tc1.cThu Jul 17 02:14:25 2014
(r268782, copy of r268502, head/lib/libedit/TEST/tc1.c)
@@ -0,0 +1,298 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__COPYRIGHT(@(#) Copyright (c) 1992, 1993\n\
+   The Regents of the University of California.  All rights reserved.\n);
+#endif /* not lint */
+
+#if !defined(lint)  !defined(SCCSID)
+static char sccsid[] = @(#)test.c 8.1 (Berkeley) 6/4/93;
+#endif /* not lint  not SCCSID */
+__RCSID($NetBSD: test.c,v 1.3 2009/07/17 12:25:52 christos Exp $);
+__FBSDID($FreeBSD$);
+
+/*
+ * test.c: A little test program
+ */
+#include sys.h
+#include stdio.h
+#include string.h
+#include signal.h
+#include 

svn commit: r268783 - in stable/9/lib/libedit: . TEST

2014-07-16 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 17 02:22:03 2014
New Revision: 268783
URL: http://svnweb.freebsd.org/changeset/base/268783

Log:
  MFC   r268502:
  Sync some (mostly cosmetical) changes from NetBSD
  
  Makefile,v 1.37
  tc1.c v 1.3
  Rename TEST/test.c tc1.c
  
  common.c,v 1.23
  pass lint on _LP64.
  
  emacs.c,v 1.22
  pass lint on _LP64.
  
  filecomplete.h,v 1.8
  mv NetBSD ID back from 1.9 as we don't
  have the widecharacter support.
  
  prompt.c,v 1.14
  prompt.h,v 1.9
  term.h,v 1.20
  read.h,v 1.6
  Update NetBSD version strings
  
  sys.h,v 1.12
  Misc sun stuff.
  
  tty.c 1.31
  handle EINTR in the termios operations
  Allow a single process to control multiple ttys (for pthreads using 
_REENTRANT)
  using multiple EditLine objects.
  pass lint on _LP64.
  Don't depend on side effects inside an assert
  
  Obtained from:NetBSD

Added:
  stable/9/lib/libedit/TEST/tc1.c
 - copied unchanged from r268502, head/lib/libedit/TEST/tc1.c
Deleted:
  stable/9/lib/libedit/TEST/test.c
Modified:
  stable/9/lib/libedit/Makefile
  stable/9/lib/libedit/common.c
  stable/9/lib/libedit/emacs.c
  stable/9/lib/libedit/filecomplete.h
  stable/9/lib/libedit/histedit.h
  stable/9/lib/libedit/prompt.c
  stable/9/lib/libedit/prompt.h
  stable/9/lib/libedit/read.h
  stable/9/lib/libedit/sys.h
  stable/9/lib/libedit/term.h
  stable/9/lib/libedit/tty.c
Directory Properties:
  stable/9/lib/libedit/   (props changed)

Modified: stable/9/lib/libedit/Makefile
==
--- stable/9/lib/libedit/Makefile   Thu Jul 17 02:14:25 2014
(r268782)
+++ stable/9/lib/libedit/Makefile   Thu Jul 17 02:22:03 2014
(r268783)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $
+#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -70,9 +70,9 @@ editline.c: ${OSRCS}
 editline.o editline.po editline.So editline.ln:\
common.h emacs.h fcns.c fcns.h help.c help.h vi.h
 
-test.o: ${.CURDIR}/TEST/test.c
+tc1.o: ${.CURDIR}/TEST/tc1.c
 
-test: test.o libedit.a ${DPADD} ${LIBTERMCAP}
+test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP}
${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD}
 
 .include bsd.lib.mk

Copied: stable/9/lib/libedit/TEST/tc1.c (from r268502, 
head/lib/libedit/TEST/tc1.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/lib/libedit/TEST/tc1.c Thu Jul 17 02:22:03 2014
(r268783, copy of r268502, head/lib/libedit/TEST/tc1.c)
@@ -0,0 +1,298 @@
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__COPYRIGHT(@(#) Copyright (c) 1992, 1993\n\
+   The Regents of the University of California.  All rights reserved.\n);
+#endif /* not lint */
+
+#if !defined(lint)  !defined(SCCSID)
+static char sccsid[] = @(#)test.c 8.1 (Berkeley) 6/4/93;
+#endif /* not lint  not SCCSID */
+__RCSID($NetBSD: test.c,v 1.3 2009/07/17 12:25:52 christos Exp $);
+__FBSDID($FreeBSD$);
+
+/*
+ * test.c: A little test program
+ */
+#include sys.h
+#include stdio.h
+#include string.h
+#include signal.h
+#include 

svn commit: r268784 - stable/10/sbin/fsck_msdosfs

2014-07-16 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 17 02:33:40 2014
New Revision: 268784
URL: http://svnweb.freebsd.org/changeset/base/268784

Log:
  MFC   r268628, r268631, r268635:
  
  Convert *rootDir from external to static.
  
  fsck_msdosfs: be a bit more permissive.
  
  The free space value in the FSInfo block is merely unitialized when it is
  0x. This fixes a bug found in NetBSD.
  
  Respect FSFIXFAT.
  
  Fix some whitespace issues while here.
  
  Obtained from:NetBSD (CVS rev. 1.22, rev. 1.9), OpenBSD (misc)

Modified:
  stable/10/sbin/fsck_msdosfs/check.c
  stable/10/sbin/fsck_msdosfs/ext.h
  stable/10/sbin/fsck_msdosfs/fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/fsck_msdosfs/check.c
==
--- stable/10/sbin/fsck_msdosfs/check.c Thu Jul 17 02:22:03 2014
(r268783)
+++ stable/10/sbin/fsck_msdosfs/check.c Thu Jul 17 02:33:40 2014
(r268784)
@@ -142,7 +142,7 @@ checkfilesys(const char *fname)
goto out;
 
/* now write the FATs */
-   if (mod  FSFATMOD) {
+   if (mod  (FSFATMOD|FSFIXFAT)) {
if (ask(1, Update FATs)) {
mod |= writefat(dosfs, boot, fat, mod  FSFIXFAT);
if (mod  FSFATAL)

Modified: stable/10/sbin/fsck_msdosfs/ext.h
==
--- stable/10/sbin/fsck_msdosfs/ext.h   Thu Jul 17 02:22:03 2014
(r268783)
+++ stable/10/sbin/fsck_msdosfs/ext.h   Thu Jul 17 02:33:40 2014
(r268784)
@@ -26,7 +26,7 @@
  */
 
 #ifndef EXT_H
-#define EXT_H
+#defineEXT_H
 
 #include sys/types.h
 
@@ -71,8 +71,8 @@ int checkfilesys(const char *);
 #defineFSFATMOD4   /* The FAT was modified */
 #defineFSERROR 8   /* Some unrecovered error 
remains */
 #defineFSFATAL 16  /* Some unrecoverable error 
occurred */
-#define FSDIRTY32  /* File system is dirty */
-#define FSFIXFAT   64  /* Fix file system FAT */
+#defineFSDIRTY 32  /* File system is dirty */
+#defineFSFIXFAT64  /* Fix file system FAT */
 
 /*
  * read a boot block in a machine independent fashion and translate

Modified: stable/10/sbin/fsck_msdosfs/fat.c
==
--- stable/10/sbin/fsck_msdosfs/fat.c   Thu Jul 17 02:22:03 2014
(r268783)
+++ stable/10/sbin/fsck_msdosfs/fat.c   Thu Jul 17 02:33:40 2014
(r268784)
@@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, 
ret |= FSDIRTY;
else {
/* just some odd byte sequence in FAT */
-   
+
switch (boot-ClustMask) {
case CLUST32_MASK:
pwarn(%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n,
@@ -262,7 +262,7 @@ readfat(int fs, struct bootblock *boot, 
break;
}
 
-   
+
if (ask(1, Correct))
ret |= FSFIXFAT;
}
@@ -653,7 +653,7 @@ checklost(int dosfs, struct bootblock *b
cl_t head;
int mod = FSOK;
int ret;
-   
+
for (head = CLUST_FIRST; head  boot-NumClusters; head++) {
/* find next untravelled chain */
if (fat[head].head != head
@@ -677,8 +677,9 @@ checklost(int dosfs, struct bootblock *b
 
if (boot-bpbFSInfo) {
ret = 0;
-   if (boot-FSFree != boot-NumFree) {
-   pwarn(Free space in FSInfo block (%d) not correct 
(%d)\n,
+   if (boot-FSFree != 0xU 
+   boot-FSFree != boot-NumFree) {
+   pwarn(Free space in FSInfo block (%u) not correct 
(%u)\n,
  boot-FSFree, boot-NumFree);
if (ask(1, Fix)) {
boot-FSFree = boot-NumFree;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268785 - stable/9/sbin/fsck_msdosfs

2014-07-16 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 17 02:43:53 2014
New Revision: 268785
URL: http://svnweb.freebsd.org/changeset/base/268785

Log:
  MFC   r268628, r268631, r268635:
  
  Convert *rootDir from external to static.
  
  fsck_msdosfs: be a bit more permissive.
  
  The free space value in the FSInfo block is merely unitialized when it is
  0x. This fixes a bug found in NetBSD.
  
  Respect FSFIXFAT.
  
  Fix some whitespace issues while here.
  
  Obtained from:NetBSD (CVS rev. 1.22, rev. 1.9), OpenBSD (misc)

Modified:
  stable/9/sbin/fsck_msdosfs/check.c
  stable/9/sbin/fsck_msdosfs/dir.c
  stable/9/sbin/fsck_msdosfs/ext.h
  stable/9/sbin/fsck_msdosfs/fat.c
Directory Properties:
  stable/9/sbin/fsck_msdosfs/   (props changed)

Modified: stable/9/sbin/fsck_msdosfs/check.c
==
--- stable/9/sbin/fsck_msdosfs/check.c  Thu Jul 17 02:33:40 2014
(r268784)
+++ stable/9/sbin/fsck_msdosfs/check.c  Thu Jul 17 02:43:53 2014
(r268785)
@@ -142,7 +142,7 @@ checkfilesys(const char *fname)
goto out;
 
/* now write the FATs */
-   if (mod  FSFATMOD) {
+   if (mod  (FSFATMOD|FSFIXFAT)) {
if (ask(1, Update FATs)) {
mod |= writefat(dosfs, boot, fat, mod  FSFIXFAT);
if (mod  FSFATAL)

Modified: stable/9/sbin/fsck_msdosfs/dir.c
==
--- stable/9/sbin/fsck_msdosfs/dir.cThu Jul 17 02:33:40 2014
(r268784)
+++ stable/9/sbin/fsck_msdosfs/dir.cThu Jul 17 02:43:53 2014
(r268785)
@@ -206,7 +206,7 @@ static char longName[DOSLONGNAMELEN] = 
 static u_char *buffer = NULL;
 static u_char *delbuf = NULL;
 
-struct dosDirEntry *rootDir;
+static struct dosDirEntry *rootDir;
 static struct dosDirEntry *lostDir;
 
 /*

Modified: stable/9/sbin/fsck_msdosfs/ext.h
==
--- stable/9/sbin/fsck_msdosfs/ext.hThu Jul 17 02:33:40 2014
(r268784)
+++ stable/9/sbin/fsck_msdosfs/ext.hThu Jul 17 02:43:53 2014
(r268785)
@@ -26,7 +26,7 @@
  */
 
 #ifndef EXT_H
-#define EXT_H
+#defineEXT_H
 
 #include sys/types.h
 
@@ -43,8 +43,6 @@ extern int preen; /* we are preening */
 extern int rdonly; /* device is opened read only (supersedes above) */
 extern int skipclean;  /* skip clean file systems if preening */
 
-extern struct dosDirEntry *rootDir;
-
 /*
  * function declarations
  */
@@ -71,8 +69,8 @@ int checkfilesys(const char *);
 #defineFSFATMOD4   /* The FAT was modified */
 #defineFSERROR 8   /* Some unrecovered error 
remains */
 #defineFSFATAL 16  /* Some unrecoverable error 
occurred */
-#define FSDIRTY32  /* File system is dirty */
-#define FSFIXFAT   64  /* Fix file system FAT */
+#defineFSDIRTY 32  /* File system is dirty */
+#defineFSFIXFAT64  /* Fix file system FAT */
 
 /*
  * read a boot block in a machine independent fashion and translate

Modified: stable/9/sbin/fsck_msdosfs/fat.c
==
--- stable/9/sbin/fsck_msdosfs/fat.cThu Jul 17 02:33:40 2014
(r268784)
+++ stable/9/sbin/fsck_msdosfs/fat.cThu Jul 17 02:43:53 2014
(r268785)
@@ -240,7 +240,7 @@ readfat(int fs, struct bootblock *boot, 
ret |= FSDIRTY;
else {
/* just some odd byte sequence in FAT */
-   
+
switch (boot-ClustMask) {
case CLUST32_MASK:
pwarn(%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n,
@@ -260,7 +260,7 @@ readfat(int fs, struct bootblock *boot, 
break;
}
 
-   
+
if (ask(1, Correct))
ret |= FSFIXFAT;
}
@@ -651,7 +651,7 @@ checklost(int dosfs, struct bootblock *b
cl_t head;
int mod = FSOK;
int ret;
-   
+
for (head = CLUST_FIRST; head  boot-NumClusters; head++) {
/* find next untravelled chain */
if (fat[head].head != head
@@ -675,8 +675,9 @@ checklost(int dosfs, struct bootblock *b
 
if (boot-bpbFSInfo) {
ret = 0;
-   if (boot-FSFree != boot-NumFree) {
-   pwarn(Free space in FSInfo block (%d) not correct 
(%d)\n,
+   if (boot-FSFree != 0xU 
+   boot-FSFree != boot-NumFree) {
+   pwarn(Free space in FSInfo block (%u) not correct 
(%u)\n,
  boot-FSFree, boot-NumFree);
if (ask(1, Fix)) {
 

svn commit: r268786 - in stable/10: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-07-16 Thread Xin LI
Author: delphij
Date: Thu Jul 17 05:20:18 2014
New Revision: 268786
URL: http://svnweb.freebsd.org/changeset/base/268786

Log:
  MFC r268116:
  
   - Fix handling of new style of ioctl in compatiblity mode [1];
   - Reorganize code and reduce diff from upstream;
   - Improve forward compatibility shims for previous kernel;
  
  Reported by:sbruno [1]

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
Thu Jul 17 02:43:53 2014(r268785)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
Thu Jul 17 05:20:18 2014(r268786)
@@ -72,16 +72,23 @@ zcmd_ioctl(int fd, int request, zfs_cmd_
if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
zfs_ioctl_version = get_zfs_ioctl_version();
 
-   if (zfs_ioctl_version == ZFS_IOCVER_LZC)
-   cflag = ZFS_CMD_COMPAT_LZC;
-   else if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN)
-   cflag = ZFS_CMD_COMPAT_DEADMAN;
-
-   /*
-* If vfs.zfs.version.ioctl is not defined, assume we have v28
-* compatible binaries and use vfs.zfs.version.spa to test for v15
-*/
-   if (zfs_ioctl_version  ZFS_IOCVER_DEADMAN) {
+   if (zfs_ioctl_version = ZFS_IOCVER_DEADMAN) {
+   switch (zfs_ioctl_version) {
+   case ZFS_IOCVER_ZCMD:
+   cflag = ZFS_CMD_COMPAT_ZCMD;
+   break;
+   case ZFS_IOCVER_LZC:
+   cflag = ZFS_CMD_COMPAT_LZC;
+   break;
+   case ZFS_IOCVER_DEADMAN:
+   cflag = ZFS_CMD_COMPAT_DEADMAN;
+   break;
+   }
+   } else {
+   /*
+* If vfs.zfs.version.ioctl is not defined, assume we have v28
+* compatible binaries and use vfs.zfs.version.spa to test for 
v15
+*/
cflag = ZFS_CMD_COMPAT_V28;
 
if (zfs_spa_version  0)

Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
==
--- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Thu Jul 17 02:43:53 2014(r268785)
+++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Thu Jul 17 05:20:18 2014(r268786)
@@ -697,6 +697,12 @@ zcmd_ioctl_compat(int fd, int request, z
zp.zfs_cmd_size = sizeof(zfs_cmd_t);
zp.zfs_ioctl_version = ZFS_IOCVER_CURRENT;
return (ioctl(fd, ncmd, zp));
+   case ZFS_CMD_COMPAT_ZCMD:
+   ncmd = _IOWR('Z', request, struct zfs_iocparm);
+   zp.zfs_cmd = (uint64_t)zc;
+   zp.zfs_cmd_size = sizeof(zfs_cmd_zcmd_t);
+   zp.zfs_ioctl_version = ZFS_IOCVER_ZCMD;
+   return (ioctl(fd, ncmd, zp));
case ZFS_CMD_COMPAT_LZC:
ncmd = _IOWR('Z', request, struct zfs_cmd);
return (ioctl(fd, ncmd, zc));
@@ -794,7 +800,8 @@ zfs_ioctl_compat_innvl(zfs_cmd_t *zc, nv
char *poolname, *snapname;
int err;
 
-   if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC)
+   if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC ||
+   cflag == ZFS_CMD_COMPAT_ZCMD)
goto out;
 
switch (vec) {
@@ -945,7 +952,8 @@ zfs_ioctl_compat_outnvl(zfs_cmd_t *zc, n
 {
nvlist_t *tmpnvl;
 
-   if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC)
+   if (cflag == ZFS_CMD_COMPAT_NONE || cflag == ZFS_CMD_COMPAT_LZC ||
+   cflag == ZFS_CMD_COMPAT_ZCMD)
return (outnvl);
 
switch (vec) {

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Thu Jul 17 02:43:53 2014(r268785)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Thu Jul 17 05:20:18 2014(r268786)
@@ -24,6 +24,7 @@
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek pa...@dawidek.net.
  * All rights reserved.
  * Copyright 2013 Martin Matuska m...@freebsd.org. All rights reserved.
+ * Copyright 2014 Xin Li delp...@freebsd.org. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 by 

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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org