svn commit: r286390 - head/sys/vm

2015-08-06 Thread Alan Cox
Author: alc
Date: Thu Aug  6 21:27:50 2015
New Revision: 286390
URL: https://svnweb.freebsd.org/changeset/base/286390

Log:
  Introduce a sysctl for reporting the number of fully populated reservations.

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Thu Aug  6 20:59:03 2015(r286389)
+++ head/sys/vm/vm_reserv.c Thu Aug  6 21:27:50 2015(r286390)
@@ -217,6 +217,11 @@ static long vm_reserv_freed;
 SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD,
 vm_reserv_freed, 0, Cumulative number of freed reservations);
 
+static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS);
+
+SYSCTL_PROC(_vm_reserv, OID_AUTO, fullpop, CTLTYPE_INT | CTLFLAG_RD, NULL, 0,
+sysctl_vm_reserv_fullpop, I, Current number of full reservations);
+
 static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS);
 
 SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 
0,
@@ -235,6 +240,33 @@ static voidvm_reserv_populate(vm_reser
 static voidvm_reserv_reclaim(vm_reserv_t rv);
 
 /*
+ * Returns the current number of full reservations.
+ *
+ * Since the number of full reservations is computed without acquiring the
+ * free page queue lock, the returned value may be inexact.
+ */
+static int
+sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
+{
+   vm_paddr_t paddr;
+   struct vm_phys_seg *seg;
+   vm_reserv_t rv;
+   int fullpop, segind;
+
+   fullpop = 0;
+   for (segind = 0; segind  vm_phys_nsegs; segind++) {
+   seg = vm_phys_segs[segind];
+   paddr = roundup2(seg-start, VM_LEVEL_0_SIZE);
+   while (paddr + VM_LEVEL_0_SIZE = seg-end) {
+   rv = vm_reserv_array[paddr  VM_LEVEL_0_SHIFT];
+   fullpop += rv-popcnt == VM_LEVEL_0_NPAGES;
+   paddr += VM_LEVEL_0_SIZE;
+   }
+   }
+   return (sysctl_handle_int(oidp, fullpop, 0, req));
+}
+
+/*
  * Describes the current state of the partially-populated reservation queue.
  */
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286385 - in head/sys/dev/usb: . serial

2015-08-06 Thread Ian Lepore
Author: ian
Date: Thu Aug  6 19:47:04 2015
New Revision: 286385
URL: https://svnweb.freebsd.org/changeset/base/286385

Log:
  Return the current ftdi bitbang mode with the UFTDIIOC_GET_BITMODE ioctl.
  
  The ftdi chip itself has a get bitmode command that doesn't actually
  return the current bitmode, just a snapshot of the gpio lines.  The chip
  apparently has no way to provide the current bitmode.
  
  This implements the functionality at the driver level.  The driver starts
  out assuming the chip is in UART mode (which it will be, coming out of
  reset) and keeps track of every successful set-bitmode operation so that
  it can always return the current mode with UFTDIIOC_GET_BITMODE.

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/uftdiio.h

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Thu Aug  6 19:45:25 2015
(r286384)
+++ head/sys/dev/usb/serial/uftdi.c Thu Aug  6 19:47:04 2015
(r286385)
@@ -161,6 +161,7 @@ struct uftdi_softc {
uint8_t sc_hdrlen;
uint8_t sc_msr;
uint8_t sc_lsr;
+   uint8_t sc_bitmode;
 };
 
 struct uftdi_param_config {
@@ -196,7 +197,7 @@ static void uftdi_cfg_get_status(struct 
uint8_t *);
 static int uftdi_reset(struct ucom_softc *, int);
 static int uftdi_set_bitmode(struct ucom_softc *, uint8_t, uint8_t);
-static int uftdi_get_bitmode(struct ucom_softc *, uint8_t *);
+static int uftdi_get_bitmode(struct ucom_softc *, uint8_t *, uint8_t *);
 static int uftdi_set_latency(struct ucom_softc *, int);
 static int uftdi_get_latency(struct ucom_softc *, int *);
 static int uftdi_set_event_char(struct ucom_softc *, int);
@@ -1090,6 +1091,7 @@ uftdi_attach(device_t dev)
sc-sc_udev = uaa-device;
sc-sc_dev = dev;
sc-sc_unit = device_get_unit(dev);
+   sc-sc_bitmode = UFTDI_BITMODE_NONE;
 
device_set_usb_desc(dev);
mtx_init(sc-sc_mtx, uftdi, NULL, MTX_DEF);
@@ -1681,6 +1683,7 @@ uftdi_set_bitmode(struct ucom_softc *uco
 {
struct uftdi_softc *sc = ucom-sc_parent;
usb_device_request_t req;
+   int rv;
 
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_SET_BITMODE;
@@ -1693,11 +1696,15 @@ uftdi_set_bitmode(struct ucom_softc *uco
else
USETW2(req.wValue, (1  bitmode), iomask);
 
-   return (usbd_do_request(sc-sc_udev, sc-sc_mtx, req, NULL));
+   rv = usbd_do_request(sc-sc_udev, sc-sc_mtx, req, NULL);
+   if (rv == USB_ERR_NORMAL_COMPLETION)
+   sc-sc_bitmode = bitmode;
+
+   return (rv);
 }
 
 static int
-uftdi_get_bitmode(struct ucom_softc *ucom, uint8_t *iomask)
+uftdi_get_bitmode(struct ucom_softc *ucom, uint8_t *bitmode, uint8_t *iomask)
 {
struct uftdi_softc *sc = ucom-sc_parent;
usb_device_request_t req;
@@ -1709,6 +1716,7 @@ uftdi_get_bitmode(struct ucom_softc *uco
USETW(req.wLength, 1);
USETW(req.wValue,  0);
 
+   *bitmode = sc-sc_bitmode;
return (usbd_do_request(sc-sc_udev, sc-sc_mtx, req, iomask));
 }
 
@@ -1891,7 +1899,7 @@ uftdi_ioctl(struct ucom_softc *ucom, uin
break;
case UFTDIIOC_GET_BITMODE:
mode = (struct uftdi_bitmode *)data;
-   err = uftdi_get_bitmode(ucom, mode-iomask);
+   err = uftdi_get_bitmode(ucom, mode-mode, mode-iomask);
break;
case UFTDIIOC_SET_LATENCY:
err = uftdi_set_latency(ucom, *((int *)data));

Modified: head/sys/dev/usb/uftdiio.h
==
--- head/sys/dev/usb/uftdiio.h  Thu Aug  6 19:45:25 2015(r286384)
+++ head/sys/dev/usb/uftdiio.h  Thu Aug  6 19:47:04 2015(r286385)
@@ -43,7 +43,7 @@ enum uftdi_bitmodes
UFTDI_BITMODE_CPU_EMUL = 3,
UFTDI_BITMODE_FAST_SERIAL = 4,
UFTDI_BITMODE_CBUS = 5,
-   UFTDI_BITMODE_NONE = 0xff,
+   UFTDI_BITMODE_NONE = 0xff,  /* aka UART mode. */
 };
 
 /*
@@ -52,8 +52,9 @@ enum uftdi_bitmodes
  *   iomask = Mask of bits enabled for bitbang output.
  *
  * For UFTDIIOC_GET_BITMODE:
- *   mode   = Unused.
- *   iomask = Returned snapshot of bitbang pin states at time of call.
+ *   mode   = Mode most recently set using UFTDIIOC_SET_BITMODE.
+ *   iomask = Returned snapshot of DBUS0..DBUS7 pin states at time of call.
+ *Pin states can be read in any mode, not just bitbang modes.
  */
 struct uftdi_bitmode
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286389 - head/share/man/man4

2015-08-06 Thread Ian Lepore
Author: ian
Date: Thu Aug  6 20:59:03 2015
New Revision: 286389
URL: https://svnweb.freebsd.org/changeset/base/286389

Log:
  Document the recently added get-bitmode and eeprom read/write functionality.

Modified:
  head/share/man/man4/uftdi.4

Modified: head/share/man/man4/uftdi.4
==
--- head/share/man/man4/uftdi.4 Thu Aug  6 20:05:40 2015(r286388)
+++ head/share/man/man4/uftdi.4 Thu Aug  6 20:59:03 2015(r286389)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 31, 2014
+.Dd August 6, 2015
 .Dt UFTDI 4
 .Os
 .Sh NAME
@@ -110,6 +110,11 @@ The
 must be one of the
 .Va uftdi_bitmodes
 values.
+Setting
+.Va mode
+to
+.Dv UFTDI_BITMODE_NONE
+returns the channel to standard UART mode.
 .Bd -literal
 enum uftdi_bitmodes
 {
@@ -139,12 +144,15 @@ and
 data which either reflects pin state or is interpreted
 as MPSSE commands and parameters, depending on the mode.
 .It Dv UFTDIIOC_GET_BITMODE Pq Vt struct uftdi_bitmode
-Return the state of the bitbang pins at the time of the call in the
+Return the current bitbang mode in the
+.Va mode
+member, and the state of the DBUS0..DBUS7 pins at the time
+of the call in the
 .Va iomask
 member.
-The
-.Va mode
-member is unused.
+The pin state can be read while the chip is in any mode, including
+.Dv UFTDI_BITMODE_NONE
+(UART) mode.
 .It Dv UFTDIIOC_SET_ERROR_CHAR Pq Vt int
 Set the character which is inserted into the buffer to mark
 the point of an error such as FIFO overflow.
@@ -164,6 +172,54 @@ This is the
 .Va bcdDevice
 value from the
 .Va usb_device_descriptor .
+.It Dv UFTDIIOC_READ_EEPROM Pq Vt struct uftdi_eeio
+Read one or more words from the configuration eeprom.
+The FTDI chip performs eeprom I/O in 16-bit words.
+Set
+.Va offset
+and
+.Va length
+to values evenly divisible by two before the call, and the
+.Va data
+array will contain the requested values from eeprom after the call.
+.Bd -literal
+struct uftdi_eeio
+{
+   uint16_t offset;
+   uint16_t length;
+   uint16_t data[64];
+};
+.Ed
+.Pp
+The FT232R chip has an internal eeprom.
+An external serial eeprom is optional on other FTDI chips.
+The eeprom may contain 64, 128, or 256 words, 
+depending on the part used.
+Multiple calls may be needed to read or write the larger parts.
+When no eeprom is present, all words in the returned data are 0x.
+An erased eeprom also reads as all 0x.
+.It Dv UFTDIIOC_WRITE_EEPROM Pq Vt struct uftdi_eeio
+Write one or more words to the configuration eeprom.
+The
+.Va uftdi_eeio
+values are as described for
+.Dv UFTDIIOC_READ_EEPROM .
+.Pp
+The FTDI chip does a blind write to the eeprom, and it will appear
+to succeed even when no eeprom is present.
+To ensure a good write you must read back and verify the data.
+It is
+.Em not
+necessary to erase before writing.
+Any position within the eeprom can be overwritten at any time.
+.It Dv UFTDIIOC_ERASE_EEPROM Pq Vt int
+Erase the entire eeprom.
+This is useful primarily for test and debugging, as there is no
+need to erase before writing.
+To help prevent accidental erasure caused by calling the wrong
+ioctl, you must pass the special value
+.Dv UFTDI_CONFIRM_ERASE
+as the argument to this ioctl.
 .El
 .Sh HARDWARE
 The
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286360 - head/sbin/mdconfig

2015-08-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Aug  6 07:47:13 2015
New Revision: 286360
URL: https://svnweb.freebsd.org/changeset/base/286360

Log:
  Tweak mdconfig(8) manual page, in particular revise the EXAMPLES
  section.  This removes stuff that doesn't really belong there,
  and simplifies examples for the basic operations.
  
  Reviewed by:  wblock@
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D3198

Modified:
  head/sbin/mdconfig/mdconfig.8

Modified: head/sbin/mdconfig/mdconfig.8
==
--- head/sbin/mdconfig/mdconfig.8   Thu Aug  6 06:47:28 2015
(r286359)
+++ head/sbin/mdconfig/mdconfig.8   Thu Aug  6 07:47:13 2015
(r286360)
@@ -37,12 +37,12 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd November 30, 2013
+.Dd August 6, 2015
 .Dt MDCONFIG 8
 .Os
 .Sh NAME
 .Nm mdconfig
-.Nd configure and enable memory disks
+.Nd create and control memory disks
 .Sh SYNOPSIS
 .Nm
 .Fl a
@@ -75,7 +75,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility configures and enables
+utility creates and controls
 .Xr md 4
 devices.
 .Pp
@@ -103,7 +103,7 @@ If the
 .Fl o Cm reserve
 option is not set, creating and filling a large
 malloc-backed memory disk is a very easy way to
-panic a system.
+panic the system.
 .It Cm vnode
 A file specified with
 .Fl f Ar file
@@ -164,7 +164,9 @@ or
 .Cm t
 which
 denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively.
-The
+When used without the
+.Fl r
+option, the
 .Fl a
 and
 .Fl t Ar swap
@@ -206,6 +208,11 @@ Enable/disable compression features to r
 .It Oo Cm no Oc Ns Cm force
 Disable/enable extra sanity checks to prevent the user from doing something
 that might adversely affect the system.
+This can be used with the
+.Fl u
+flag to forcibly destroy an
+.Xr md 4
+disk that is still in use.
 .It Oo Cm no Oc Ns Cm readonly
 Enable/disable readonly mode.
 .El
@@ -227,66 +234,58 @@ is provided for convenience as an abbrev
 .Fl t Ar vnode
 .Fl f Ar file .
 .Sh EXAMPLES
-Create a 4 megabyte
-.Xr malloc 9
-backed memory disk.
-The name of the allocated unit will be printed on stdout, such as
-.Dq Li md3 :
-.Pp
-.Dl mdconfig -a -t malloc -s 4m
-.Pp
-Create a disk named
-.Pa /dev/md4
-with
+Create a disk with
 .Pa /tmp/boot.flp
-as backing storage:
+as backing storage.
+The name of the allocated unit will be printed on stdout, such as
+.Dq Li md0 :
+.Bd -literal -offset indent
+mdconfig /tmp/boot.flp
+.Ed
 .Pp
-.Dl mdconfig -a -t vnode -f /tmp/boot.flp -u md4
+Create a 1 gigabyte swap backed memory disk named
+.Dq Li md3 :
+.Bd -literal -offset indent
+mdconfig -s 1g -u md3
+.Ed
 .Pp
 Detach and free all resources used by
-.Pa /dev/md4 :
+.Pa /dev/md3 :
+.Bd -literal -offset indent
+mdconfig -du md3
+.Ed
+.Pp
+Show detailed information on current memory disks:
+.Bd -literal -offset indent
+mdconfig -lv
+.Ed
 .Pp
-.Dl mdconfig -d -u md4
+Resize the
+.Dq Li md3
+memory disk to 2 gigabytes:
+.Bd -literal -offset indent
+mdconfig -rs 2g -u md3
+.Ed
 .Pp
-Create a 128MByte swap backed disk, initialize an
+Create a 1 gigabyte swap backed disk, initialize an
 .Xr ffs 7
 file system on it, and mount it on
 .Pa /tmp :
 .Bd -literal -offset indent
-mdconfig -a -t swap -s 128M -u md10
+mdconfig -s 1g -u md10
 newfs -U /dev/md10
 mount /dev/md10 /tmp
 chmod 1777 /tmp
 .Ed
 .Pp
-Create a 5MB file-backed disk
-.Po Fl a
-and
-.Fl t Ar vnode
-are implied
-.Pc :
-.Bd -literal -offset indent
-dd if=/dev/zero of=somebackingfile bs=1k count=5k
-mdconfig -f somebackingfile -u md0
-bsdlabel -w md0 auto
-newfs md0c
-mount /dev/md0c /mnt
-.Ed
-.Pp
-Create an
-.Xr md 4
-device out of an ISO 9660 CD image file
-.Po Fl a
-and
-.Fl t Ar vnode
-are implied
-.Pc , using the first available
+Create a memory disk out of an ISO 9660 CD image file,
+using the first available
 .Xr md 4
-device, and then mount the new memory disk:
+device, and then mount it:
 .Bd -literal -offset indent
 mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt
-.Pp
 .Ed
+.Pp
 Create a file-backed device from a hard disk image that begins
 with 512K of raw header information.
 .Xr gnop 8
@@ -294,7 +293,7 @@ is used to skip over the header informat
 .Pa md1.nop
 to the start of the filesystem in the image.
 .Bd -literal -offset indent
-mdconfig -f diskimage.img -u md1
+mdconfig -u md1 -f diskimage.img
 gnop create -o 512K md1
 mount /dev/md1.nop /mnt
 .Ed
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286383 - head/usr.bin/truss

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 19:36:47 2015
New Revision: 286383
URL: https://svnweb.freebsd.org/changeset/base/286383

Log:
  Whitespace fixes to consistently use spaces before }'s and
  wrap long lines.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug  6 19:29:26 2015
(r286382)
+++ head/usr.bin/truss/syscalls.c   Thu Aug  6 19:36:47 2015
(r286383)
@@ -101,9 +101,9 @@ static struct syscall syscalls[] = {
{ .name = getegid, .ret_type = 1, .nargs = 0 },
{ .name = geteuid, .ret_type = 1, .nargs = 0 },
{ .name = linux_readlink, .ret_type = 1, .nargs = 3,
- .args = { { Name, 0 }, { Name | OUT, 1 }, { Int, 2 }}},
+ .args = { { Name, 0 }, { Name | OUT, 1 }, { Int, 2 } } },
{ .name = linux_socketcall, .ret_type = 1, .nargs = 2,
- .args = { { Int, 0 }, { LinuxSockArgs, 1 }}},
+ .args = { { Int, 0 }, { LinuxSockArgs, 1 } } },
{ .name = getgid, .ret_type = 1, .nargs = 0 },
{ .name = getpid, .ret_type = 1, .nargs = 0 },
{ .name = getpgid, .ret_type = 1, .nargs = 1,
@@ -119,13 +119,15 @@ static struct syscall syscalls[] = {
  .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 },
{ Int, 3 } } },
{ .name = lseek, .ret_type = 2, .nargs = 3,
- .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, { Whence, 1 + 
QUAD_SLOTS + QUAD_ALIGN } } },
+ .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN },
+   { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } },
{ .name = linux_lseek, .ret_type = 2, .nargs = 3,
  .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } },
{ .name = mmap, .ret_type = 2, .nargs = 6,
- .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, { 
Int, 4 }, { Quad, 5 + QUAD_ALIGN } } },
+ .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 },
+   { Int, 4 }, { Quad, 5 + QUAD_ALIGN } } },
{ .name = linux_mkdir, .ret_type = 1, .nargs = 2,
- .args = { { Name | IN, 0}, {Int, 1}}},
+ .args = { { Name | IN, 0 }, { Int, 1 } } },
{ .name = mprotect, .ret_type = 1, .nargs = 3,
  .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } },
{ .name = open, .ret_type = 1, .nargs = 3,
@@ -180,7 +182,7 @@ static struct syscall syscalls[] = {
  .args = { { Atfd, 0 }, { Name, 1 }, { Int, 2 }, { Int, 3 },
{ Atflags, 4 } } },
{ .name = linux_stat64, .ret_type = 1, .nargs = 3,
- .args = { { Name | IN, 0 }, { Ptr | OUT, 1 }, { Ptr | IN, 1 }}},
+ .args = { { Name | IN, 0 }, { Ptr | OUT, 1 }, { Ptr | IN, 1 } } },
{ .name = mount, .ret_type = 0, .nargs = 4,
  .args = { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } },
{ .name = umount, .ret_type = 0, .nargs = 2,
@@ -197,7 +199,7 @@ static struct syscall syscalls[] = {
{ .name = linux_newstat, .ret_type = 1, .nargs = 2,
  .args = { { Name | IN, 0 }, { Ptr | OUT, 1 } } },
{ .name = linux_access, .ret_type = 1, .nargs = 2,
- .args = { { Name, 0 }, { Accessmode, 1 }}},
+ .args = { { Name, 0 }, { Accessmode, 1 } } },
{ .name = linux_newfstat, .ret_type = 1, .nargs = 2,
  .args = { { Int, 0 }, { Ptr | OUT, 1 } } },
{ .name = write, .ret_type = 1, .nargs = 3,
@@ -216,7 +218,8 @@ static struct syscall syscalls[] = {
  .args = { { Atfd, 0 }, { Name | IN, 1 }, { Accessmode, 2 },
{ Atflags, 3 } } },
{ .name = sigaction, .ret_type = 1, .nargs = 3,
- .args = { { Signal, 0 }, { Sigaction | IN, 1 }, { Sigaction | OUT, 2 
} } },
+ .args = { { Signal, 0 }, { Sigaction | IN, 1 },
+   { Sigaction | OUT, 2 } } },
{ .name = accept, .ret_type = 1, .nargs = 3,
  .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
{ .name = bind, .ret_type = 1, .nargs = 3,
@@ -234,13 +237,17 @@ static struct syscall syscalls[] = {
{ .name = getsockname, .ret_type = 1, .nargs = 3,
  .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
{ .name = recvfrom, .ret_type = 1, .nargs = 6,
- .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 }, 
{ Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } },
+ .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 },
+   { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } },
{ .name = sendto, .ret_type = 1, .nargs = 6,
- .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 }, 
{ Sockaddr | IN, 4 }, { Ptr | IN, 5 } } },
+ .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 },
+   { Sockaddr | IN, 4 }, { Ptr | IN, 5 } } },
{ .name = execve, .ret_type = 1, .nargs = 

svn commit: r286388 - head/usr.bin/truss

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 20:05:40 2015
New Revision: 286388
URL: https://svnweb.freebsd.org/changeset/base/286388

Log:
  Consistently use both leading and trailing spaces inside of the {}'s
  when pretty-printing structures.  Most structures used both spaces,
  but some only used a trailing space and some used neither.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug  6 19:53:41 2015
(r286387)
+++ head/usr.bin/truss/syscalls.c   Thu Aug  6 20:05:40 2015
(r286388)
@@ -847,7 +847,7 @@ print_arg(struct syscall_args *sc, unsig
struct timespec ts;
if (get_struct(pid, (void *)args[sc-offset], ts,
sizeof(ts)) != -1)
-   asprintf(tmp, {%ld.%09ld }, (long)ts.tv_sec,
+   asprintf(tmp, { %ld.%09ld }, (long)ts.tv_sec,
ts.tv_nsec);
else
asprintf(tmp, 0x%lx, args[sc-offset]);
@@ -863,7 +863,7 @@ print_arg(struct syscall_args *sc, unsig
if (get_struct(pid, (void *)args[sc-offset], ts, sizeof(ts))
!= -1) {
fp = open_memstream(tmp, len);
-   fputc('{', fp);
+   fputs({ , fp);
sep = ;
for (i = 0; i  nitems(ts); i++) {
fputs(sep, fp);
@@ -881,7 +881,7 @@ print_arg(struct syscall_args *sc, unsig
break;
}
}
-   fputc('}', fp);
+   fputs( }, fp);
fclose(fp);
} else
asprintf(tmp, 0x%lx, args[sc-offset]);
@@ -891,7 +891,7 @@ print_arg(struct syscall_args *sc, unsig
struct timeval tv;
if (get_struct(pid, (void *)args[sc-offset], tv, sizeof(tv))
!= -1)
-   asprintf(tmp, {%ld.%06ld }, (long)tv.tv_sec,
+   asprintf(tmp, { %ld.%06ld }, (long)tv.tv_sec,
tv.tv_usec);
else
asprintf(tmp, 0x%lx, args[sc-offset]);
@@ -901,7 +901,7 @@ print_arg(struct syscall_args *sc, unsig
struct timeval tv[2];
if (get_struct(pid, (void *)args[sc-offset], tv, sizeof(tv))
!= -1)
-   asprintf(tmp, {%ld.%06ld, %ld.%06ld },
+   asprintf(tmp, { %ld.%06ld, %ld.%06ld },
(long)tv[0].tv_sec, tv[0].tv_usec,
(long)tv[1].tv_sec, tv[1].tv_usec);
else
@@ -912,7 +912,7 @@ print_arg(struct syscall_args *sc, unsig
struct itimerval itv;
if (get_struct(pid, (void *)args[sc-offset], itv,
sizeof(itv)) != -1)
-   asprintf(tmp, {%ld.%06ld, %ld.%06ld },
+   asprintf(tmp, { %ld.%06ld, %ld.%06ld },
(long)itv.it_interval.tv_sec,
itv.it_interval.tv_usec,
(long)itv.it_value.tv_sec,
@@ -1016,6 +1016,7 @@ print_arg(struct syscall_args *sc, unsig
tmpsize);
 
tmp[used++] = '{';
+   tmp[used++] = ' ';
for (i = 0; i  numfds; i++) {
 
u = snprintf(tmp + used, per_fd, %s%d/%s,
@@ -1024,6 +1025,7 @@ print_arg(struct syscall_args *sc, unsig
if (u  0)
used += u  per_fd ? u : per_fd;
}
+   tmp[used++] = ' ';
tmp[used++] = '}';
tmp[used++] = '\0';
} else {
@@ -1056,6 +1058,7 @@ print_arg(struct syscall_args *sc, unsig
output, tmpsize);
 
tmp[used++] = '{';
+   tmp[used++] = ' ';
for (i = 0; i  numfds; i++) {
if (FD_ISSET(i, fds)) {
u = snprintf(tmp + used, per_fd, %d ,
@@ -1064,8 +1067,6 @@ print_arg(struct syscall_args *sc, unsig
used += u  per_fd ? u : per_fd;
}
}
-   if (tmp[used-1] == ' ')
-   used--;
tmp[used++] = '}';
tmp[used++] = '\0';
} else
@@ -1266,8 +1267,9 @@ print_arg(struct syscall_args *sc, unsig
default:
sa = (struct sockaddr *)ss;

Re: svn commit: r286395 - head/usr.bin/mkimg

2015-08-06 Thread Glen Barber
On Thu, Aug 06, 2015 at 09:45:45PM -0700, Marcel Moolenaar wrote:
 
  On Aug 6, 2015, at 9:31 PM, Glen Barber g...@freebsd.org wrote:
  
  On Fri, Aug 07, 2015 at 04:27:52AM +, Marcel Moolenaar wrote:
  Author: marcel
  Date: Fri Aug  7 04:27:51 2015
  New Revision: 286395
  URL: https://svnweb.freebsd.org/changeset/base/286395
  
  Log:
   Fix the dynamic VHD format to work with qemu. The size of the disk
   is taken to match the geometry and only when the geometry is max'd
   out, is the actual recorded size taken.
  
   Note that qemu has the same logic for the fixed VHD format. However
   that is known to conflict with Microsoft Azure, where the recorded
   size of the image is what counts.
  
  
  I'll test this out on the next 11-CURRENT builds.  (Based on the content
  of the commit log, it's unclear to me if you received my last reply on
  this topic, so if you didn't let me know.)
 
 I tested this in Azure: the fixed format VHD hasn't been
 changed.
 

Doh.  Sorry, misread the log.  (And all these formats...!)  :)

Glen



pgp7ENBP_PxCO.pgp
Description: PGP signature


Re: svn commit: r286395 - head/usr.bin/mkimg

2015-08-06 Thread Glen Barber
On Fri, Aug 07, 2015 at 04:27:52AM +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Fri Aug  7 04:27:51 2015
 New Revision: 286395
 URL: https://svnweb.freebsd.org/changeset/base/286395
 
 Log:
   Fix the dynamic VHD format to work with qemu. The size of the disk
   is taken to match the geometry and only when the geometry is max'd
   out, is the actual recorded size taken.
   
   Note that qemu has the same logic for the fixed VHD format. However
   that is known to conflict with Microsoft Azure, where the recorded
   size of the image is what counts.
   

I'll test this out on the next 11-CURRENT builds.  (Based on the content
of the commit log, it's unclear to me if you received my last reply on
this topic, so if you didn't let me know.)

In any case, thanks! :)

Glen



pgpt4mNlHKcPb.pgp
Description: PGP signature


svn commit: r286400 - head/contrib/sendmail

2015-08-06 Thread Gregory Neil Shapiro
Author: gshapiro
Date: Fri Aug  7 04:58:35 2015
New Revision: 286400
URL: https://svnweb.freebsd.org/changeset/base/286400

Log:
  Reminder to check tools/build/mk/OptionalObsoleteFiles.inc on new
  version imports.
  
  Obtained from:garga@

Modified:
  head/contrib/sendmail/FREEBSD-upgrade

Modified: head/contrib/sendmail/FREEBSD-upgrade
==
--- head/contrib/sendmail/FREEBSD-upgrade   Fri Aug  7 04:38:13 2015
(r286399)
+++ head/contrib/sendmail/FREEBSD-upgrade   Fri Aug  7 04:58:35 2015
(r286400)
@@ -86,6 +86,7 @@ infrastructure in FreeBSD:
share/man/man8/rc.sendmail.8
share/mk/bsd.libnames.mk
share/sendmail/Makefile
+   tools/build/mk/OptionalObsoleteFiles.inc
usr.bin/Makefile
usr.bin/vacation/Makefile
usr.sbin/Makefile
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286395 - head/usr.bin/mkimg

2015-08-06 Thread Marcel Moolenaar
Author: marcel
Date: Fri Aug  7 04:27:51 2015
New Revision: 286395
URL: https://svnweb.freebsd.org/changeset/base/286395

Log:
  Fix the dynamic VHD format to work with qemu. The size of the disk
  is taken to match the geometry and only when the geometry is max'd
  out, is the actual recorded size taken.
  
  Note that qemu has the same logic for the fixed VHD format. However
  that is known to conflict with Microsoft Azure, where the recorded
  size of the image is what counts.
  
  Pointed out by: gjb@

Modified:
  head/usr.bin/mkimg/vhd.c

Modified: head/usr.bin/mkimg/vhd.c
==
--- head/usr.bin/mkimg/vhd.cFri Aug  7 02:37:47 2015(r286394)
+++ head/usr.bin/mkimg/vhd.cFri Aug  7 04:27:51 2015(r286395)
@@ -159,6 +159,34 @@ vhd_geometry(uint64_t image_size, struct
geom-cylinders = cth / geom-heads;
 }
 
+static uint64_t
+vhd_resize(uint64_t origsz)
+{
+   struct vhd_geom geom;
+   uint64_t newsz;
+
+   /*
+* Round the image size to the pre-determined geometry that
+* matches the image size. This circular dependency implies
+* that we need to loop to handle boundary conditions.
+* The first time, newsz equals origsz and the geometry will
+* typically yield a new size that's smaller. We keep adding
+* cylinder's worth of sectors to the new size until its
+* larger or equal or origsz. But during those iterations,
+* the geometry can change, so we need to account for that.
+*/
+   newsz = origsz;
+   while (1) {
+   vhd_geometry(newsz, geom);
+   newsz = (int64_t)geom.cylinders * geom.heads *
+   geom.sectors * VHD_SECTOR_SIZE;
+   if (newsz = origsz)
+   break;
+   newsz += geom.heads * geom.sectors * VHD_SECTOR_SIZE;
+   }
+   return (newsz);
+}
+
 static uint32_t
 vhd_timestamp(void)
 {
@@ -256,8 +284,7 @@ vhd_dyn_resize(lba_t imgsz)
 {
uint64_t imagesz;
 
-   imagesz = imgsz * secsz;
-   imagesz = (imagesz + VHD_BLOCK_SIZE - 1)  ~(VHD_BLOCK_SIZE - 1);
+   imagesz = vhd_resize(imgsz * secsz);
return (image_set_size(imagesz / secsz));
 }
 
@@ -266,7 +293,7 @@ vhd_dyn_write(int fd)
 {
struct vhd_footer footer;
struct vhd_dyn_header header;
-   uint64_t imgsz;
+   uint64_t imgsz, rawsz;
lba_t blk, blkcnt, nblks;
uint32_t *bat;
void *bitmap;
@@ -274,13 +301,14 @@ vhd_dyn_write(int fd)
uint32_t sector;
int bat_entries, error, entry;
 
-   imgsz = image_get_size() * secsz;
-   bat_entries = imgsz / VHD_BLOCK_SIZE;
+   rawsz = image_get_size() * secsz;
+   imgsz = (rawsz + VHD_BLOCK_SIZE - 1)  ~(VHD_BLOCK_SIZE - 1);
 
-   vhd_make_footer(footer, imgsz, VHD_DISK_TYPE_DYNAMIC, sizeof(footer));
+   vhd_make_footer(footer, rawsz, VHD_DISK_TYPE_DYNAMIC, sizeof(footer));
if (sparse_write(fd, footer, sizeof(footer))  0)
return (errno);
 
+   bat_entries = imgsz / VHD_BLOCK_SIZE;
memset(header, 0, sizeof(header));
be64enc(header.cookie, VHD_HEADER_COOKIE);
be64enc(header.data_offset, ~0ULL);
@@ -321,7 +349,7 @@ vhd_dyn_write(int fd)
blk = 0;
blkcnt = VHD_BLOCK_SIZE / secsz;
error = 0;
-   nblks = image_get_size();
+   nblks = rawsz / secsz;
while (blk  nblks) {
if (!image_data(blk, blkcnt)) {
blk += blkcnt;
@@ -331,15 +359,20 @@ vhd_dyn_write(int fd)
error = errno;
break;
}
+   /* Handle partial last block */
+   if (blk + blkcnt  nblks)
+   blkcnt = nblks - blk;
error = image_copyout_region(fd, blk, blkcnt);
if (error)
break;
blk += blkcnt;
}
free(bitmap);
-   if (blk != nblks)
+   if (error)
+   return (error);
+   error = image_copyout_zeroes(fd, imgsz - rawsz);
+   if (error)
return (error);
-
if (sparse_write(fd, footer, sizeof(footer))  0)
return (errno);
 
@@ -362,24 +395,9 @@ FORMAT_DEFINE(vhd_dyn_format);
 static int
 vhd_fix_resize(lba_t imgsz)
 {
-   struct vhd_geom geom;
-   int64_t imagesz;
+   uint64_t imagesz;
 
-   /*
-* Round the image size to the pre-determined geometry that
-* matches the image size. This circular dependency implies
-* that we need to loop to handle boundary conditions.
-*/
-   imgsz *= secsz;
-   imagesz = imgsz;
-   while (1) {
-   vhd_geometry(imagesz, geom);
-   imagesz = (int64_t)geom.cylinders * geom.heads *
-   geom.sectors * VHD_SECTOR_SIZE;
-   if (imagesz = imgsz)
-  

svn commit: r286394 - head/usr.bin/ypmatch

2015-08-06 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri Aug  7 02:37:47 2015
New Revision: 286394
URL: https://svnweb.freebsd.org/changeset/base/286394

Log:
  Get closest as possible with style(9). No functional change.
  
  Differential Revision:D3295
  Reviewed by:  bapt

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

Modified: head/usr.bin/ypmatch/ypmatch.c
==
--- head/usr.bin/ypmatch/ypmatch.c  Fri Aug  7 02:05:16 2015
(r286393)
+++ head/usr.bin/ypmatch/ypmatch.c  Fri Aug  7 02:37:47 2015
(r286394)
@@ -34,20 +34,19 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/types.h
 #include sys/socket.h
+
+#include ctype.h
+#include err.h
 #include stdio.h
 #include stdlib.h
 #include string.h
 #include unistd.h
-#include ctype.h
-#include err.h
 
 #include rpc/rpc.h
 #include rpc/xdr.h
 #include rpcsvc/yp_prot.h
 #include rpcsvc/ypclnt.h
 
-void   usage(void);
-
 static const struct ypalias {
char *alias, *name;
 } ypaliases[] = {
@@ -63,11 +62,11 @@ static const struct ypalias {
{ ethers, ethers.byname },
 };
 
-void
+static void
 usage(void)
 {
-   fprintf(stderr,
-   usage: ypmatch [-kt] [-d domain] key ... mapname\n
+   fprintf(stderr, %s\n%s\n,
+   usage: ypmatch [-kt] [-d domain] key ... mapname,
   ypmatch -x\n);
fprintf(stderr,
where\n
@@ -82,8 +81,6 @@ int
 main(int argc, char *argv[])
 {
char *domainname, *inkey, *inmap, *outbuf;
-   extern char *optarg;
-   extern int optind;
int outbuflen, key, notrans, rval;
int c, r;
u_int i;
@@ -114,12 +111,12 @@ main(int argc, char *argv[])
if ((argc-optind)  2 )
usage();
 
-   if (!domainname) {
+   if (domainname == NULL) {
yp_get_default_domain(domainname);
}
 
inmap = argv[argc-1];
-   if (!notrans) {
+   if (notrans == 0) {
for (i=0; isizeof ypaliases/sizeof ypaliases[0]; i++)
if (strcmp(inmap, ypaliases[i].alias) == 0)
inmap = ypaliases[i].name;
@@ -138,10 +135,9 @@ main(int argc, char *argv[])
printf(%*.*s\n, outbuflen, outbuflen, outbuf);
break;
case YPERR_YPBIND:
-   errx(1, yp_match: not running ypbind);
-   exit(1);
+   errx(1, not running ypbind);
default:
-   errx(1, Can't match key %s in map %s. Reason: %s\n,
+   errx(1, can't match key %s in map %s. Reason: %s,
inkey, inmap, yperr_string(r));
rval = 1;
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286395 - head/usr.bin/mkimg

2015-08-06 Thread Marcel Moolenaar

 On Aug 6, 2015, at 9:31 PM, Glen Barber g...@freebsd.org wrote:
 
 On Fri, Aug 07, 2015 at 04:27:52AM +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Fri Aug  7 04:27:51 2015
 New Revision: 286395
 URL: https://svnweb.freebsd.org/changeset/base/286395
 
 Log:
  Fix the dynamic VHD format to work with qemu. The size of the disk
  is taken to match the geometry and only when the geometry is max'd
  out, is the actual recorded size taken.
 
  Note that qemu has the same logic for the fixed VHD format. However
  that is known to conflict with Microsoft Azure, where the recorded
  size of the image is what counts.
 
 
 I'll test this out on the next 11-CURRENT builds.  (Based on the content
 of the commit log, it's unclear to me if you received my last reply on
 this topic, so if you didn't let me know.)

I tested this in Azure: the fixed format VHD hasn't been
changed.

--
Marcel Moolenaar
mar...@xcllnt.net




signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r286393 - head/share/man/man4

2015-08-06 Thread Kevin Lo
Author: kevlo
Date: Fri Aug  7 02:05:16 2015
New Revision: 286393
URL: https://svnweb.freebsd.org/changeset/base/286393

Log:
  Add support for ASUS WL-100g.

Modified:
  head/share/man/man4/bwi.4

Modified: head/share/man/man4/bwi.4
==
--- head/share/man/man4/bwi.4   Thu Aug  6 23:44:46 2015(r286392)
+++ head/share/man/man4/bwi.4   Fri Aug  7 02:05:16 2015(r286393)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 6, 2011
+.Dd August 7, 2015
 .Dt BWI 4
 .Os
 .Sh NAME
@@ -76,6 +76,7 @@ driver supports Broadcom BCM43xx based w
 .It Em Card Ta Em Chip Ta Em Bus Ta Em Standard
 .It Apple Airport Extreme BCM4306 PCI b/g
 .It Apple Airport Extreme BCM4318 PCI b/g
+.It ASUS WL-100g  BCM4306 CardBus b/g
 .It ASUS WL-138g  BCM4318 PCI b/g
 .It Buffalo WLI-CB-G54S   BCM4318 CardBus b/g
 .It Buffalo WLI-PCI-G54S  BCM4306 PCI b/g
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286392 - head/etc

2015-08-06 Thread Xin LI
Author: delphij
Date: Thu Aug  6 23:44:46 2015
New Revision: 286392
URL: https://svnweb.freebsd.org/changeset/base/286392

Log:
  Now that the portsnap buildbox is generating the raw bits for INDEX-11,
  add it to the set of INDEX files built by portsnap.
  
  MFC after:2 weeks

Modified:
  head/etc/portsnap.conf

Modified: head/etc/portsnap.conf
==
--- head/etc/portsnap.conf  Thu Aug  6 22:01:09 2015(r286391)
+++ head/etc/portsnap.conf  Thu Aug  6 23:44:46 2015(r286392)
@@ -32,3 +32,4 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddb
 # List of INDEX files to build and the DESCRIBE file to use for each
 INDEX INDEX-9 DESCRIBE.9
 INDEX INDEX-10 DESCRIBE.10
+INDEX INDEX-11 DESCRIBE.11
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286359 - head/sys/compat/cloudabi

2015-08-06 Thread Ed Schouten
Author: ed
Date: Thu Aug  6 06:47:28 2015
New Revision: 286359
URL: https://svnweb.freebsd.org/changeset/base/286359

Log:
  Add file_open(): the underlying system call of openat().
  
  CloudABI purely operates on file descriptor rights (CAP_*). File
  descriptor access modes (O_ACCMODE) are emulated on top of rights.
  
  Instead of accepting the traditional flags argument, file_open() copies
  in an fdstat_t object that contains the initial rights the descriptor
  should have, but also file descriptor flags that should persist after
  opening (APPEND, NONBLOCK, *SYNC). Only flags that don't persist (EXCL,
  TRUNC, CREAT, DIRECTORY) are passed in as an argument.
  
  file_open() first converts the rights, the persistent flags and the
  non-persistent flags to fflags. It then calls into vn_open(). If
  successful, it installs the file descriptor with the requested
  rights, trimming off rights that don't apply to the type of
  the file that has been opened.
  
  Unlike kern_openat(), this function does not support /dev/fd/*. I can't
  think of a reason why we need to support this for CloudABI.
  
  Obtained from:https://github.com/NuxiNL/freebsd
  Differential Revision:https://reviews.freebsd.org/D3235

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/cloudabi/cloudabi_file.c
  head/sys/compat/cloudabi/cloudabi_util.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Thu Aug  6 01:49:18 2015
(r286358)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Thu Aug  6 06:47:28 2015
(r286359)
@@ -290,7 +290,7 @@ cloudabi_convert_filetype(const struct f
 }
 
 /* Removes rights that conflict with the file descriptor type. */
-static void
+void
 cloudabi_remove_conflicting_rights(cloudabi_filetype_t filetype,
 cloudabi_rights_t *base, cloudabi_rights_t *inheriting)
 {
@@ -499,6 +499,25 @@ cloudabi_sys_fd_stat_get(struct thread *
return (copyout(fsb, (void *)uap-buf, sizeof(fsb)));
 }
 
+/* Converts CloudABI rights to a set of Capsicum capabilities. */
+int
+cloudabi_convert_rights(cloudabi_rights_t in, cap_rights_t *out)
+{
+
+   cap_rights_init(out);
+#define MAPPING(cloudabi, ...) do {\
+   if (in  (cloudabi)) {  \
+   cap_rights_set(out, ##__VA_ARGS__); \
+   in = ~(cloudabi);  \
+   }   \
+} while (0);
+   RIGHTS_MAPPINGS
+#undef MAPPING
+   if (in != 0)
+   return (ENOTCAPABLE);
+   return (0);
+}
+
 int
 cloudabi_sys_fd_stat_put(struct thread *td,
 struct cloudabi_sys_fd_stat_put_args *uap)

Modified: head/sys/compat/cloudabi/cloudabi_file.c
==
--- head/sys/compat/cloudabi/cloudabi_file.cThu Aug  6 01:49:18 2015
(r286358)
+++ head/sys/compat/cloudabi/cloudabi_file.cThu Aug  6 06:47:28 2015
(r286359)
@@ -197,9 +197,128 @@ int
 cloudabi_sys_file_open(struct thread *td,
 struct cloudabi_sys_file_open_args *uap)
 {
+   cloudabi_fdstat_t fds;
+   cap_rights_t rights;
+   struct filecaps fcaps = {};
+   struct nameidata nd;
+   struct file *fp;
+   struct vnode *vp;
+   char *path;
+   int error, fd, fflags;
+   bool read, write;
+
+   error = copyin(uap-fds, fds, sizeof(fds));
+   if (error != 0)
+   return (error);
+
+   /* All the requested rights should be set on the descriptor. */
+   error = cloudabi_convert_rights(
+   fds.fs_rights_base | fds.fs_rights_inheriting, rights);
+   if (error != 0)
+   return (error);
+   cap_rights_set(rights, CAP_LOOKUP);
 
-   /* Not implemented. */
-   return (ENOSYS);
+   /* Convert rights to corresponding access mode. */
+   read = (fds.fs_rights_base  (CLOUDABI_RIGHT_FD_READ |
+   CLOUDABI_RIGHT_FILE_READDIR | CLOUDABI_RIGHT_MEM_MAP_EXEC)) != 0;
+   write = (fds.fs_rights_base  (CLOUDABI_RIGHT_FD_DATASYNC |
+   CLOUDABI_RIGHT_FD_WRITE | CLOUDABI_RIGHT_FILE_ALLOCATE |
+   CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE)) != 0;
+   fflags = read ? write ? FREAD | FWRITE : FREAD : FWRITE;
+
+   /* Convert open flags. */
+   if ((uap-oflags  CLOUDABI_O_CREAT) != 0) {
+   fflags |= O_CREAT;
+   cap_rights_set(rights, CAP_CREATE);
+   }
+   if ((uap-oflags  CLOUDABI_O_DIRECTORY) != 0)
+   fflags |= O_DIRECTORY;
+   if ((uap-oflags  CLOUDABI_O_EXCL) != 0)
+   fflags |= O_EXCL;
+   if ((uap-oflags  CLOUDABI_O_TRUNC) != 0) {
+   fflags |= O_TRUNC;
+   cap_rights_set(rights, CAP_FTRUNCATE);
+   }
+   if ((fds.fs_flags  CLOUDABI_FDFLAG_APPEND) != 0)
+   fflags |= O_APPEND;
+   if 

Re: svn commit: r286337 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-08-06 Thread Oliver Pinter
Cool! Please send me the patch. :)

Thank you!

(My last sync was from 2014 August or November in my branch:
https://github.com/opntr/pkg/commit/f6c84ecd8a30a77eeefd8106496e6692d6348190
)

On 8/6/15, Ermal Luçi ermal.l...@gmail.com wrote:
 I did the port for pfSense and the whole stack works from HEAD into
 10-STABLE.

 Just minor modifications were required.
 If you want i can try to send the diff.

 On Wed, Aug 5, 2015 at 11:55 PM, Oliver Pinter 
 oliver.pin...@hardenedbsd.org wrote:

 Yup. :) If you need testers with the backport, then ping me. ;)

 On Wed, Aug 5, 2015 at 11:23 PM, Adrian Chadd adr...@freebsd.org wrote:
  The whole wifi stack / drivers need backporting. :)
 
 
 
  -a
 
 
  On 5 August 2015 at 12:41, Shawn Webb shawn.w...@hardenedbsd.org
 wrote:
  On Wed, 2015-08-05 at 19:32 +, Adrian Chadd wrote:
  Author: adrian
  Date: Wed Aug  5 19:32:35 2015
  New Revision: 286337
  URL: https://svnweb.freebsd.org/changeset/base/286337
 
  Log:
Add TXOP enforce support to the AR9300 HAL.
 
This is required for (more) correct TDMA support.  Without it, the
code tries to calculate the required guard interval based on the
current rate, and since this is an 11n NIC and people try using
11n, it calls ath_hal_computetxtime() on an 11n rate which then
panics.
 
This doesn't fix TDMA slave mode on AR9300 - it just makes it
have one less bug.
 
Reported by:Berislav Purgar bpur...@gmail.com
 
  Modified:
head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
 
  Hey Adrian,
 
  Can this be MFC'd?
 
  Thanks,
 
  --
  Shawn Webb
  HardenedBSD
 
  GPG Key ID:  0x6A84658F52456EEE
  GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245
  6EEE
  ___
  svn-src-head@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/svn-src-head
  To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org




 --
 Ermal

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

Re: svn commit: r286337 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-08-06 Thread Adrian Chadd
Ermal - yes please. :) Or, just do the MFC yourself. :)


-a


On 6 August 2015 at 00:21, Ermal Luçi ermal.l...@gmail.com wrote:
 I did the port for pfSense and the whole stack works from HEAD into
 10-STABLE.

 Just minor modifications were required.
 If you want i can try to send the diff.

 On Wed, Aug 5, 2015 at 11:55 PM, Oliver Pinter
 oliver.pin...@hardenedbsd.org wrote:

 Yup. :) If you need testers with the backport, then ping me. ;)

 On Wed, Aug 5, 2015 at 11:23 PM, Adrian Chadd adr...@freebsd.org wrote:
  The whole wifi stack / drivers need backporting. :)
 
 
 
  -a
 
 
  On 5 August 2015 at 12:41, Shawn Webb shawn.w...@hardenedbsd.org
  wrote:
  On Wed, 2015-08-05 at 19:32 +, Adrian Chadd wrote:
  Author: adrian
  Date: Wed Aug  5 19:32:35 2015
  New Revision: 286337
  URL: https://svnweb.freebsd.org/changeset/base/286337
 
  Log:
Add TXOP enforce support to the AR9300 HAL.
 
This is required for (more) correct TDMA support.  Without it, the
code tries to calculate the required guard interval based on the
current rate, and since this is an 11n NIC and people try using
11n, it calls ath_hal_computetxtime() on an 11n rate which then
panics.
 
This doesn't fix TDMA slave mode on AR9300 - it just makes it
have one less bug.
 
Reported by:Berislav Purgar bpur...@gmail.com
 
  Modified:
head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
 
  Hey Adrian,
 
  Can this be MFC'd?
 
  Thanks,
 
  --
  Shawn Webb
  HardenedBSD
 
  GPG Key ID:  0x6A84658F52456EEE
  GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
  ___
  svn-src-head@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/svn-src-head
  To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org




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

svn commit: r286374 - head/sys/x86/x86

2015-08-06 Thread Konstantin Belousov
Author: kib
Date: Thu Aug  6 18:02:54 2015
New Revision: 286374
URL: https://svnweb.freebsd.org/changeset/base/286374

Log:
  Formally pair store_rel(smp_started) with load_acq(smp_started).
  The expected semantic is to have misc. data, e.g. CPU bitmaps, visible
  in the BSP after smp_started is written by the last started AP, which
  formally requires acquire barrier on the load.  The change is mostly
  nop due to the ordered behaviour of the x86 CPUs.
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Thu Aug  6 17:13:34 2015(r286373)
+++ head/sys/x86/x86/mp_x86.c   Thu Aug  6 18:02:54 2015(r286374)
@@ -602,7 +602,7 @@ init_secondary_tail(void)
mtx_unlock_spin(ap_boot_mtx);
 
/* Wait until all the AP's are up. */
-   while (smp_started == 0)
+   while (atomic_load_acq_int(smp_started) == 0)
ia32_pause();
 
/* Start per-CPU event timers. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286372 - in head/sys: amd64/include/xen dev/xen/balloon dev/xen/blkfront dev/xen/control dev/xen/netback dev/xen/netfront dev/xen/pcifront i386/include/xen x86/xen

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 17:07:21 2015
New Revision: 286372
URL: https://svnweb.freebsd.org/changeset/base/286372

Log:
  Remove some more vestiges of the Xen PV domu support.  Specifically,
  use vtophys() directly instead of vtomach() and retire the no-longer-used
  headers machine/xenfunc.h and machine/xenvar.h.
  
  Reported by:  bde (stale bits in machine/xenfunc.h)
  Reviewed by:  royger (earlier version)
  Differential Revision:https://reviews.freebsd.org/D3266

Deleted:
  head/sys/amd64/include/xen/xenfunc.h
  head/sys/amd64/include/xen/xenvar.h
  head/sys/i386/include/xen/xenfunc.h
  head/sys/i386/include/xen/xenvar.h
Modified:
  head/sys/dev/xen/balloon/balloon.c
  head/sys/dev/xen/blkfront/blkfront.c
  head/sys/dev/xen/control/control.c
  head/sys/dev/xen/netback/netback.c
  head/sys/dev/xen/netfront/netfront.c
  head/sys/dev/xen/pcifront/pcifront.c
  head/sys/x86/xen/xen_intr.c

Modified: head/sys/dev/xen/balloon/balloon.c
==
--- head/sys/dev/xen/balloon/balloon.c  Thu Aug  6 16:50:37 2015
(r286371)
+++ head/sys/dev/xen/balloon/balloon.c  Thu Aug  6 17:07:21 2015
(r286372)
@@ -49,8 +49,6 @@ __FBSDID($FreeBSD$);
 #include xen/features.h
 #include xen/xenstore/xenstorevar.h
 
-#include machine/xen/xenvar.h
-
 static MALLOC_DEFINE(M_BALLOON, Balloon, Xen Balloon Driver);
 
 /* Convert from KB (as fetched from xenstore) to number of PAGES */

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cThu Aug  6 16:50:37 2015
(r286371)
+++ head/sys/dev/xen/blkfront/blkfront.cThu Aug  6 17:07:21 2015
(r286372)
@@ -60,7 +60,6 @@ __FBSDID($FreeBSD$);
 #include xen/xenbus/xenbusvar.h
 
 #include machine/_inttypes.h
-#include machine/xen/xenvar.h
 
 #include geom/geom_disk.h
 
@@ -762,7 +761,7 @@ xbd_alloc_ring(struct xbd_softc *sc)
 i++, sring_page_addr += PAGE_SIZE) {
 
error = xenbus_grant_ring(sc-xbd_dev,
-   (vtomach(sring_page_addr)  PAGE_SHIFT),
+   (vtophys(sring_page_addr)  PAGE_SHIFT),
sc-xbd_ring_ref[i]);
if (error) {
xenbus_dev_fatal(sc-xbd_dev, error,
@@ -1305,7 +1304,7 @@ xbd_connect(struct xbd_softc *sc)
for (j = 0; j  sc-xbd_max_request_indirectpages; j++) {
if (gnttab_grant_foreign_access(
xenbus_get_otherend_id(sc-xbd_dev),
-   (vtomach(indirectpages)  PAGE_SHIFT) + j,
+   (vtophys(indirectpages)  PAGE_SHIFT) + j,
1 /* grant read-only access */,
cm-cm_indirectionrefs[j]))
break;

Modified: head/sys/dev/xen/control/control.c
==
--- head/sys/dev/xen/control/control.c  Thu Aug  6 16:50:37 2015
(r286371)
+++ head/sys/dev/xen/control/control.c  Thu Aug  6 17:07:21 2015
(r286372)
@@ -145,9 +145,6 @@ __FBSDID($FreeBSD$);
 
 #include xen/xenbus/xenbusvar.h
 
-#include machine/xen/xenvar.h
-#include machine/xen/xenfunc.h
-
 /*--- Forward Declarations --*/
 /** Function signature for shutdown event handlers. */
 typedefvoid (xctrl_shutdown_handler_t)(void);

Modified: head/sys/dev/xen/netback/netback.c
==
--- head/sys/dev/xen/netback/netback.c  Thu Aug  6 16:50:37 2015
(r286371)
+++ head/sys/dev/xen/netback/netback.c  Thu Aug  6 17:07:21 2015
(r286372)
@@ -87,8 +87,6 @@ __FBSDID($FreeBSD$);
 #include xen/interface/io/netif.h
 #include xen/xenbus/xenbusvar.h
 
-#include machine/xen/xenvar.h
-
 /*--- Compile-time Tunables 
--*/
 
 /*-- Macros 
--*/
@@ -132,7 +130,7 @@ static MALLOC_DEFINE(M_XENNETBACK, xnb
req  rsp ? req : rsp;  \
 })
 
-#definevirt_to_mfn(x) (vtomach(x)  PAGE_SHIFT)
+#definevirt_to_mfn(x) (vtophys(x)  PAGE_SHIFT)
 #definevirt_to_offset(x) ((x)  (PAGE_SIZE - 1))
 
 /**

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Aug  6 16:50:37 2015
(r286371)
+++ head/sys/dev/xen/netfront/netfront.cThu Aug  6 17:07:21 2015
(r286372)
@@ -86,8 +86,6 @@ __FBSDID($FreeBSD$);
 #include xen/interface/io/netif.h
 #include xen/xenbus/xenbusvar.h
 
-#include machine/xen/xenvar.h
-
 #include xenbus_if.h
 
 /* Features supported by all backends.  TSO and LRO can be negotiated */

svn commit: r286373 - head/sys/geom/eli

2015-08-06 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Aug  6 17:13:34 2015
New Revision: 286373
URL: https://svnweb.freebsd.org/changeset/base/286373

Log:
  After crypto_dispatch() bio might be already delivered and destroyed,
  so we cannot access it anymore. Setting an error later lead to memory
  corruption.
  
  Assert that crypto_dispatch() was successful. It can fail only if we pass a
  bogus crypto request, which is a bug in the program, not a runtime condition.
  
  PR:   199705
  Submitted by: luke.tw
  Reviewed by:  emaste
  MFC after:3 days

Modified:
  head/sys/geom/eli/g_eli_integrity.c
  head/sys/geom/eli/g_eli_privacy.c

Modified: head/sys/geom/eli/g_eli_integrity.c
==
--- head/sys/geom/eli/g_eli_integrity.c Thu Aug  6 17:07:21 2015
(r286372)
+++ head/sys/geom/eli/g_eli_integrity.c Thu Aug  6 17:13:34 2015
(r286373)
@@ -408,8 +408,8 @@ g_eli_auth_run(struct g_eli_worker *wr, 
struct cryptodesc *crde, *crda;
u_int i, lsec, nsec, data_secsize, decr_secsize, encr_secsize;
off_t dstoff;
-   int err, error;
u_char *p, *data, *auth, *authkey, *plaindata;
+   int error;
 
G_ELI_LOGREQ(3, bp, %s, __func__);
 
@@ -451,7 +451,6 @@ g_eli_auth_run(struct g_eli_worker *wr, 
bp-bio_inbed = 0;
bp-bio_children = nsec;
 
-   error = 0;
for (i = 1; i = nsec; i++, dstoff += encr_secsize) {
crp = (struct cryptop *)p;  p += sizeof(*crp);
crde = (struct cryptodesc *)p;  p += sizeof(*crde);
@@ -519,10 +518,8 @@ g_eli_auth_run(struct g_eli_worker *wr, 
crda-crd_klen = G_ELI_AUTH_SECKEYLEN * 8;
 
crp-crp_etype = 0;
-   err = crypto_dispatch(crp);
-   if (err != 0  error == 0)
-   error = err;
+   error = crypto_dispatch(crp);
+   KASSERT(error == 0, (crypto_dispatch() failed (error=%d),
+   error));
}
-   if (bp-bio_error == 0)
-   bp-bio_error = error;
 }

Modified: head/sys/geom/eli/g_eli_privacy.c
==
--- head/sys/geom/eli/g_eli_privacy.c   Thu Aug  6 17:07:21 2015
(r286372)
+++ head/sys/geom/eli/g_eli_privacy.c   Thu Aug  6 17:13:34 2015
(r286373)
@@ -230,10 +230,10 @@ g_eli_crypto_run(struct g_eli_worker *wr
struct cryptop *crp;
struct cryptodesc *crd;
u_int i, nsec, secsize;
-   int err, error;
off_t dstoff;
size_t size;
u_char *p, *data;
+   int error;
 
G_ELI_LOGREQ(3, bp, %s, __func__);
 
@@ -271,7 +271,6 @@ g_eli_crypto_run(struct g_eli_worker *wr
bcopy(bp-bio_data, data, bp-bio_length);
}
 
-   error = 0;
for (i = 0, dstoff = bp-bio_offset; i  nsec; i++, dstoff += secsize) {
crp = (struct cryptop *)p;  p += sizeof(*crp);
crd = (struct cryptodesc *)p;   p += sizeof(*crd);
@@ -308,10 +307,8 @@ g_eli_crypto_run(struct g_eli_worker *wr
crd-crd_next = NULL;
 
crp-crp_etype = 0;
-   err = crypto_dispatch(crp);
-   if (error == 0)
-   error = err;
+   error = crypto_dispatch(crp);
+   KASSERT(error == 0, (crypto_dispatch() failed (error=%d),
+   error));
}
-   if (bp-bio_error == 0)
-   bp-bio_error = error;
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286375 - head/etc

2015-08-06 Thread Xin LI
Author: delphij
Date: Thu Aug  6 18:15:56 2015
New Revision: 286375
URL: https://svnweb.freebsd.org/changeset/base/286375

Log:
  Now that stable/8 is EOL, stop building INDEX-8.
  
  MFC after:1 week

Modified:
  head/etc/portsnap.conf

Modified: head/etc/portsnap.conf
==
--- head/etc/portsnap.conf  Thu Aug  6 18:02:54 2015(r286374)
+++ head/etc/portsnap.conf  Thu Aug  6 18:15:56 2015(r286375)
@@ -30,6 +30,5 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddb
 # REFUSE korean polish portuguese russian ukrainian vietnamese
 
 # List of INDEX files to build and the DESCRIBE file to use for each
-INDEX INDEX-8 DESCRIBE.8
 INDEX INDEX-9 DESCRIBE.9
 INDEX INDEX-10 DESCRIBE.10
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286371 - head/sys/fs/devfs

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 16:50:37 2015
New Revision: 286371
URL: https://svnweb.freebsd.org/changeset/base/286371

Log:
  The changes that introduced fo_mmap() treated all character device
  mappings as if MAP_SHARED was always present since in general MAP_PRIVATE
  is not permitted for character devices.  However, there is one exception
  in that MAP_PRIVATE mappings are permitted for /dev/zero.
  
  Only require a writable file descriptor (FWRITE) for shared, writable
  mappings of character devices.  vm_mmap_cdev() will reject any private
  mappings for other devices.
  
  Reviewed by:  kib
  Reported by:  sbruno (broke qemu cross-builds), peter
  Differential Revision:https://reviews.freebsd.org/D3316

Modified:
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Thu Aug  6 16:14:29 2015
(r286370)
+++ head/sys/fs/devfs/devfs_vnops.c Thu Aug  6 16:50:37 2015
(r286371)
@@ -1774,13 +1774,24 @@ devfs_mmap_f(struct file *fp, vm_map_t m
return (EACCES);
 
/*
-* Character devices always share mappings, so
-* require a writable fd for writable mappings.
+* If we are sharing potential changes via MAP_SHARED and we
+* are trying to get write permission although we opened it
+* without asking for it, bail out.
+*
+* Note that most character devices always share mappings.
+* The one exception is that D_MMAP_ANON devices
+* (i.e. /dev/zero) permit private writable mappings.
+*
+* Rely on vm_mmap_cdev() to fail invalid MAP_PRIVATE requests
+* as well as updating maxprot to permit writing for
+* D_MMAP_ANON devices rather than doing that here.
 */
-   if ((fp-f_flag  FWRITE) != 0)
-   maxprot |= VM_PROT_WRITE;
-   else if ((prot  VM_PROT_WRITE) != 0)
-   return (EACCES);
+   if ((flags  MAP_SHARED) != 0) {
+   if ((fp-f_flag  FWRITE) != 0)
+   maxprot |= VM_PROT_WRITE;
+   else if ((prot  VM_PROT_WRITE) != 0)
+   return (EACCES);
+   }
maxprot = cap_maxprot;
 
fpop = td-td_fpop;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286382 - in head/sys/dev/usb: . serial

2015-08-06 Thread Ian Lepore
Author: ian
Date: Thu Aug  6 19:29:26 2015
New Revision: 286382
URL: https://svnweb.freebsd.org/changeset/base/286382

Log:
  Add support to the uftdi driver for reading and writing the serial eeprom
  that can be attached to the chips, via ioctl() calls.

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/uftdi_reg.h
  head/sys/dev/usb/uftdiio.h

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Thu Aug  6 19:08:33 2015
(r286381)
+++ head/sys/dev/usb/serial/uftdi.c Thu Aug  6 19:29:26 2015
(r286382)
@@ -1791,6 +1791,82 @@ uftdi_set_error_char(struct ucom_softc *
 }
 
 static int
+uftdi_read_eeprom(struct ucom_softc *ucom, struct uftdi_eeio *eeio)
+{
+   struct uftdi_softc *sc = ucom-sc_parent;
+   usb_device_request_t req;
+   usb_error_t err;
+   uint16_t widx, wlength, woffset;
+
+   /* Offset and length must both be evenly divisible by two. */
+   if ((eeio-offset | eeio-length)  0x01)
+   return (EINVAL);
+
+   woffset = eeio-offset / 2U;
+   wlength = eeio-length / 2U;
+   for (widx = 0; widx  wlength; widx++) {
+   req.bmRequestType = UT_READ_VENDOR_DEVICE;
+   req.bRequest = FTDI_SIO_READ_EEPROM;
+   USETW(req.wIndex, widx + woffset);
+   USETW(req.wLength, 2);
+   USETW(req.wValue, 0);
+   err = usbd_do_request(sc-sc_udev, sc-sc_mtx, req,
+   eeio-data[widx]);
+   if (err != USB_ERR_NORMAL_COMPLETION)
+   return (err);
+   }
+   return (USB_ERR_NORMAL_COMPLETION);
+}
+
+static int
+uftdi_write_eeprom(struct ucom_softc *ucom, struct uftdi_eeio *eeio)
+{
+   struct uftdi_softc *sc = ucom-sc_parent;
+   usb_device_request_t req;
+   usb_error_t err;
+   uint16_t widx, wlength, woffset;
+
+   /* Offset and length must both be evenly divisible by two. */
+   if ((eeio-offset | eeio-length)  0x01)
+   return (EINVAL);
+
+   woffset = eeio-offset / 2U;
+   wlength = eeio-length / 2U;
+   for (widx = 0; widx  wlength; widx++) {
+   req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+   req.bRequest = FTDI_SIO_WRITE_EEPROM;
+   USETW(req.wIndex, widx + woffset);
+   USETW(req.wLength, 0);
+   USETW(req.wValue, eeio-data[widx]);
+   err = usbd_do_request(sc-sc_udev, sc-sc_mtx, req, NULL);
+   if (err != USB_ERR_NORMAL_COMPLETION)
+   return (err);
+   }
+   return (USB_ERR_NORMAL_COMPLETION);
+}
+
+static int
+uftdi_erase_eeprom(struct ucom_softc *ucom, int confirmation)
+{
+   struct uftdi_softc *sc = ucom-sc_parent;
+   usb_device_request_t req;
+   usb_error_t err;
+
+   /* Small effort to prevent accidental erasure. */
+   if (confirmation != UFTDI_CONFIRM_ERASE)
+   return (EINVAL);
+
+   req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+   req.bRequest = FTDI_SIO_ERASE_EEPROM;
+   USETW(req.wIndex, 0);
+   USETW(req.wLength, 0);
+   USETW(req.wValue, 0);
+   err = usbd_do_request(sc-sc_udev, sc-sc_mtx, req, NULL);
+
+   return (err);
+}
+
+static int
 uftdi_ioctl(struct ucom_softc *ucom, uint32_t cmd, caddr_t data,
 int flag, struct thread *td)
 {
@@ -1833,6 +1909,15 @@ uftdi_ioctl(struct ucom_softc *ucom, uin
*(int *)data = sc-sc_bcdDevice;
err = 0;
break;
+   case UFTDIIOC_READ_EEPROM:
+   err = uftdi_read_eeprom(ucom, (struct uftdi_eeio *)data);
+   break;
+   case UFTDIIOC_WRITE_EEPROM:
+   err = uftdi_write_eeprom(ucom, (struct uftdi_eeio *)data);
+   break;
+   case UFTDIIOC_ERASE_EEPROM:
+   err = uftdi_erase_eeprom(ucom, *(int *)data);
+   break;
default:
return (ENOIOCTL);
}

Modified: head/sys/dev/usb/serial/uftdi_reg.h
==
--- head/sys/dev/usb/serial/uftdi_reg.h Thu Aug  6 19:08:33 2015
(r286381)
+++ head/sys/dev/usb/serial/uftdi_reg.h Thu Aug  6 19:29:26 2015
(r286382)
@@ -31,7 +31,10 @@
 #defineFTDI_SIO_SET_LATENCY9   /* Set the latency timer */
 #defineFTDI_SIO_GET_LATENCY10  /* Read the latency timer */
 #defineFTDI_SIO_SET_BITMODE11  /* Set the bit bang I/O mode */
-#defineFTDI_SIO_GET_BITMODE12  /* Read pin states in bit bang 
mode */
+#defineFTDI_SIO_GET_BITMODE12  /* Read pin states from any 
mode */
+#defineFTDI_SIO_READ_EEPROM144 /* Read eeprom word */
+#defineFTDI_SIO_WRITE_EEPROM   145 /* Write eeprom word */
+#defineFTDI_SIO_ERASE_EEPROM   146 /* Erase entire eeprom */
 
 /* Port 

svn commit: r286381 - head/usr.bin/truss

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 19:08:33 2015
New Revision: 286381
URL: https://svnweb.freebsd.org/changeset/base/286381

Log:
  Decode the arguments passed to the *at() family of system calls.  This is
  especially useful now that libc's open() always calls openat().  While here,
  fix a few other things:
  - Decode the mode argument passed to access(), eaccess(), and faccessat().
  - Decode the atfd paramete to pretty-print AT_FDCWD.
  - Decode the special AT_* flags used with some of the *at() system calls.
  - Decode arguments for fchmod(), lchmod(), fchown(), lchown(), eaccess(),
and futimens().
  - Decode both of the timeval structures passed to futimes() instead of just
the first one.

Modified:
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscall.h
==
--- head/usr.bin/truss/syscall.hThu Aug  6 18:32:32 2015
(r286380)
+++ head/usr.bin/truss/syscall.hThu Aug  6 19:08:33 2015
(r286381)
@@ -41,7 +41,7 @@ enum Argtype { None = 1, Hex, Octal, Int
Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
-   LinuxSockArgs, Umtxop };
+   LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode };
 
 #defineARG_MASK0xff
 #defineOUT 0x100

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug  6 18:32:32 2015
(r286380)
+++ head/usr.bin/truss/syscalls.c   Thu Aug  6 19:08:33 2015
(r286381)
@@ -115,6 +115,9 @@ static struct syscall syscalls[] = {
{ .name = getuid, .ret_type = 1, .nargs = 0 },
{ .name = readlink, .ret_type = 1, .nargs = 3,
  .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Int, 2 } } },
+   { .name = readlinkat, .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 },
+   { Int, 3 } } },
{ .name = lseek, .ret_type = 2, .nargs = 3,
  .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, { Whence, 1 + 
QUAD_SLOTS + QUAD_ALIGN } } },
{ .name = linux_lseek, .ret_type = 2, .nargs = 3,
@@ -127,28 +130,55 @@ static struct syscall syscalls[] = {
  .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } },
{ .name = open, .ret_type = 1, .nargs = 3,
  .args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } },
+   { .name = openat, .ret_type = 1, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name | IN, 1 }, { Open, 2 },
+   { Octal, 3 } } },
{ .name = mkdir, .ret_type = 1, .nargs = 2,
  .args = { { Name, 0 }, { Octal, 1 } } },
+   { .name = mkdirat, .ret_type = 1, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } },
{ .name = linux_open, .ret_type = 1, .nargs = 3,
  .args = { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } },
{ .name = close, .ret_type = 1, .nargs = 1,
  .args = { { Int, 0 } } },
{ .name = link, .ret_type = 0, .nargs = 2,
  .args = { { Name, 0 }, { Name, 1 } } },
+   { .name = linkat, .ret_type = 0, .nargs = 5,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 },
+   { Atflags, 4 } } },
{ .name = unlink, .ret_type = 0, .nargs = 1,
  .args = { { Name, 0 } } },
+   { .name = unlinkat, .ret_type = 0, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Atflags, 2 } } },
{ .name = chdir, .ret_type = 0, .nargs = 1,
  .args = { { Name, 0 } } },
{ .name = chroot, .ret_type = 0, .nargs = 1,
  .args = { { Name, 0 } } },
{ .name = mkfifo, .ret_type = 0, .nargs = 2,
  .args = { { Name, 0 }, { Octal, 1 } } },
+   { .name = mkfifoat, .ret_type = 0, .nargs = 3,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } },
{ .name = mknod, .ret_type = 0, .nargs = 3,
  .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } },
+   { .name = mknodat, .ret_type = 0, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } },
{ .name = chmod, .ret_type = 0, .nargs = 2,
  .args = { { Name, 0 }, { Octal, 1 } } },
+   { .name = fchmod, .ret_type = 0, .nargs = 2,
+ .args = { { Int, 0 }, { Octal, 1 } } },
+   { .name = lchmod, .ret_type = 0, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
+   { .name = fchmodat, .ret_type = 0, .nargs = 4,
+ .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Atflags, 3 } } },
{ .name = chown, .ret_type = 0, .nargs = 3,
  .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } },
+   { .name = fchown, .ret_type = 0, .nargs = 3,
+ .args = { { 

svn commit: r286380 - head/usr.bin/truss

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 18:32:32 2015
New Revision: 286380
URL: https://svnweb.freebsd.org/changeset/base/286380

Log:
  Decode the arguments to mkfifo() and fix an off-by-one error in the arguments
  to mknod().

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug  6 18:29:26 2015
(r286379)
+++ head/usr.bin/truss/syscalls.c   Thu Aug  6 18:32:32 2015
(r286380)
@@ -141,8 +141,10 @@ static struct syscall syscalls[] = {
  .args = { { Name, 0 } } },
{ .name = chroot, .ret_type = 0, .nargs = 1,
  .args = { { Name, 0 } } },
+   { .name = mkfifo, .ret_type = 0, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
{ .name = mknod, .ret_type = 0, .nargs = 3,
- .args = { { Name, 0 }, { Octal, 1 }, { Int, 3 } } },
+ .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } },
{ .name = chmod, .ret_type = 0, .nargs = 2,
  .args = { { Name, 0 }, { Octal, 1 } } },
{ .name = chown, .ret_type = 0, .nargs = 3,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286378 - head/usr.bin/truss

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 18:28:15 2015
New Revision: 286378
URL: https://svnweb.freebsd.org/changeset/base/286378

Log:
  Don't mark the fcntl flag argument as an output parameter so that it is
  always decoded.  Previously the argument was not decoded if fcntl() failed.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Aug  6 18:19:30 2015
(r286377)
+++ head/usr.bin/truss/syscalls.c   Thu Aug  6 18:28:15 2015
(r286378)
@@ -93,7 +93,7 @@ static const char rcsid[] =
  */
 static struct syscall syscalls[] = {
{ .name = fcntl, .ret_type = 1, .nargs = 3,
- .args = { { Int, 0 }, { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } },
+ .args = { { Int, 0 }, { Fcntl, 1 }, { Fcntlflag, 2 } } },
{ .name = fork, .ret_type = 1, .nargs = 0 },
{ .name = vfork, .ret_type = 1, .nargs = 0 },
{ .name = rfork, .ret_type = 1, .nargs = 1,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286364 - head/release/doc/en_US.ISO8859-1/relnotes stable/10/release/doc/en_US.ISO8859-1/relnotes

2015-08-06 Thread Glen Barber
Author: gjb
Date: Thu Aug  6 14:13:01 2015
New Revision: 286364
URL: https://svnweb.freebsd.org/changeset/base/286364

Log:
  Fix a typo.
  
  Submitted by: pkelsey
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Changes in other areas also in this revision:
Modified:
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Aug  6 
14:05:17 2015(r286363)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Aug  6 
14:13:01 2015(r286364)
@@ -1405,7 +1405,7 @@
   os;./para
 
 sect2 xml:id=network-protocols
-  titleNetwork Procols/title
+  titleNetwork Protocols/title
 
   para revision=263140Support for the IPX network transport
protocol has been removed, and will not be supported in
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286363 - head/sys/dev/wtap

2015-08-06 Thread Gleb Smirnoff
Author: glebius
Date: Thu Aug  6 14:05:17 2015
New Revision: 286363
URL: https://svnweb.freebsd.org/changeset/base/286363

Log:
  Make it compilable. No idea if it works.

Modified:
  head/sys/dev/wtap/if_wtap.c
  head/sys/dev/wtap/if_wtapvar.h

Modified: head/sys/dev/wtap/if_wtap.c
==
--- head/sys/dev/wtap/if_wtap.c Thu Aug  6 08:51:15 2015(r286362)
+++ head/sys/dev/wtap/if_wtap.c Thu Aug  6 14:05:17 2015(r286363)
@@ -163,13 +163,13 @@ wtap_media_change(struct ifnet *ifp)
  */
 static void
 wtap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m,
-int subtype, int rssi, int nf)
+int subtype, const struct ieee80211_rx_stats *stats, int rssi, int nf)
 {
struct ieee80211vap *vap = ni-ni_vap;
 #if 0
DWTAP_PRINTF([%d] %s\n, myath_id(ni), __func__);
 #endif
-   WTAP_VAP(vap)-av_recv_mgmt(ni, m, subtype, rssi, nf);
+   WTAP_VAP(vap)-av_recv_mgmt(ni, m, subtype, stats, rssi, nf);
 }
 
 static int

Modified: head/sys/dev/wtap/if_wtapvar.h
==
--- head/sys/dev/wtap/if_wtapvar.h  Thu Aug  6 08:51:15 2015
(r286362)
+++ head/sys/dev/wtap/if_wtapvar.h  Thu Aug  6 14:05:17 2015
(r286363)
@@ -120,7 +120,7 @@ struct wtap_vap {
struct callout  av_swba;/* software beacon alert */
uint32_tav_bcinterval;  /* beacon interval */
void (*av_recv_mgmt)(struct ieee80211_node *,
-   struct mbuf *, int, int, int);
+   struct mbuf *, int, const struct ieee80211_rx_stats *, int, int);
int (*av_newstate)(struct ieee80211vap *,
enum ieee80211_state, int);
void (*av_bmiss)(struct ieee80211vap *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286361 - head/sbin/mdconfig

2015-08-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Aug  6 07:49:34 2015
New Revision: 286361
URL: https://svnweb.freebsd.org/changeset/base/286361

Log:
  Whoops, wrong flag.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/mdconfig/mdconfig.8

Modified: head/sbin/mdconfig/mdconfig.8
==
--- head/sbin/mdconfig/mdconfig.8   Thu Aug  6 07:47:13 2015
(r286360)
+++ head/sbin/mdconfig/mdconfig.8   Thu Aug  6 07:49:34 2015
(r286361)
@@ -209,7 +209,7 @@ Enable/disable compression features to r
 Disable/enable extra sanity checks to prevent the user from doing something
 that might adversely affect the system.
 This can be used with the
-.Fl u
+.Fl d
 flag to forcibly destroy an
 .Xr md 4
 disk that is still in use.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286323 - head/sys/compat/cloudabi

2015-08-06 Thread Ed Schouten
Hi Pedro,

2015-08-05 18:49 GMT+02:00 Pedro Giffuni p...@freebsd.org:
 This just reminded me:

 Clang has support for type-safety attributes[1] for fcntl and ioctls.

 I gave them a try[2] but they broke compatibility.
 For a clean ABI you should consider them.

That's interesting. That could also be useful for [gs]etsockopt().
Will take a look!

-- 
Ed Schouten e...@nuxi.nl
Nuxi, 's-Hertogenbosch, the Netherlands
KvK/VAT number: 62051717
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r286337 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-08-06 Thread Ermal Luçi
I did the port for pfSense and the whole stack works from HEAD into
10-STABLE.

Just minor modifications were required.
If you want i can try to send the diff.

On Wed, Aug 5, 2015 at 11:55 PM, Oliver Pinter 
oliver.pin...@hardenedbsd.org wrote:

 Yup. :) If you need testers with the backport, then ping me. ;)

 On Wed, Aug 5, 2015 at 11:23 PM, Adrian Chadd adr...@freebsd.org wrote:
  The whole wifi stack / drivers need backporting. :)
 
 
 
  -a
 
 
  On 5 August 2015 at 12:41, Shawn Webb shawn.w...@hardenedbsd.org
 wrote:
  On Wed, 2015-08-05 at 19:32 +, Adrian Chadd wrote:
  Author: adrian
  Date: Wed Aug  5 19:32:35 2015
  New Revision: 286337
  URL: https://svnweb.freebsd.org/changeset/base/286337
 
  Log:
Add TXOP enforce support to the AR9300 HAL.
 
This is required for (more) correct TDMA support.  Without it, the
code tries to calculate the required guard interval based on the
current rate, and since this is an 11n NIC and people try using
11n, it calls ath_hal_computetxtime() on an 11n rate which then
panics.
 
This doesn't fix TDMA slave mode on AR9300 - it just makes it
have one less bug.
 
Reported by:Berislav Purgar bpur...@gmail.com
 
  Modified:
head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
 
  Hey Adrian,
 
  Can this be MFC'd?
 
  Thanks,
 
  --
  Shawn Webb
  HardenedBSD
 
  GPG Key ID:  0x6A84658F52456EEE
  GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
  ___
  svn-src-head@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/svn-src-head
  To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org




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


Re: svn commit: r286329 - in head/etc: defaults rc.d

2015-08-06 Thread Dmitry Sivachenko

 On 5 авг. 2015 г., at 20:38, Edward Tomasz Napierala tr...@freebsd.org 
 wrote:
 
 Author: trasz
 Date: Wed Aug  5 17:38:02 2015
 New Revision: 286329
 URL: https://svnweb.freebsd.org/changeset/base/286329
 
 Log:
  Make rctl_enable rc variable actually work.  To avoid breaking existing
  setups that worked before, flip the default to YES.  Most people don't
  have /etc/rctl.conf, so they won't be affected in any way.
 
  MFC after:   1 month
  Sponsored by:The FreeBSD Foundation
 
 Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/rctl
 
 Modified: head/etc/defaults/rc.conf
 ==
 --- head/etc/defaults/rc.conf Wed Aug  5 17:21:42 2015(r286328)
 +++ head/etc/defaults/rc.conf Wed Aug  5 17:38:02 2015(r286329)
 @@ -664,7 +664,7 @@ opensm_enable=NO# Opensm(8) for infin
 casperd_enable=YES  # casperd(8) daemon
 
 # rctl(8) requires kernel options RACCT and RCTL
 -rctl_enable=NO # Load rctl(8) rules on boot
 +rctl_enable=YES# Load rctl(8) rules on boot


Sad to see that rarely used feature has default as YES.

PS: Please adjust rc.conf(5) accordingly, it assumes the default is NO.

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

svn commit: r286366 - head/sys/arm64/arm64

2015-08-06 Thread Andrew Turner
Author: andrew
Date: Thu Aug  6 14:49:23 2015
New Revision: 286366
URL: https://svnweb.freebsd.org/changeset/base/286366

Log:
  Fill in dump_avail based on the physical memory from EFI.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/machdep.c

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Thu Aug  6 14:13:44 2015
(r286365)
+++ head/sys/arm64/arm64/machdep.c  Thu Aug  6 14:49:23 2015
(r286366)
@@ -822,8 +822,13 @@ initarm(struct arm64_bootparams *abp)
 
/* Print the memory map */
mem_len = 0;
-   for (i = 0; i  physmap_idx; i += 2)
+   for (i = 0; i  physmap_idx; i += 2) {
+   dump_avail[i] = physmap[i];
+   dump_avail[i + 1] = physmap[i + 1];
mem_len += physmap[i + 1] - physmap[i];
+   }
+   dump_avail[i] = 0;
+   dump_avail[i + 1] = 0;
 
/* Set the pcpu data, this is needed by pmap_bootstrap */
pcpup = __pcpu[0];
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286369 - head/tests/sys/vm

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 16:12:12 2015
New Revision: 286369
URL: https://svnweb.freebsd.org/changeset/base/286369

Log:
  Convert the map_at_zero test case to ATF.  In particular, this will
  facilitate adding more mmap() tests.
  
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D3268

Modified:
  head/tests/sys/vm/Makefile
  head/tests/sys/vm/mmap_test.c

Modified: head/tests/sys/vm/Makefile
==
--- head/tests/sys/vm/Makefile  Thu Aug  6 16:07:27 2015(r286368)
+++ head/tests/sys/vm/Makefile  Thu Aug  6 16:12:12 2015(r286369)
@@ -2,6 +2,6 @@
 
 TESTSDIR=  ${TESTSBASE}/sys/vm
 
-TAP_TESTS_C+=  mmap_test
+ATF_TESTS_C+=  mmap_test
 
 .include bsd.test.mk

Modified: head/tests/sys/vm/mmap_test.c
==
--- head/tests/sys/vm/mmap_test.c   Thu Aug  6 16:07:27 2015
(r286368)
+++ head/tests/sys/vm/mmap_test.c   Thu Aug  6 16:12:12 2015
(r286369)
@@ -29,16 +29,14 @@
 #include sys/param.h
 #include sys/mman.h
 #include sys/sysctl.h
-#include sys/types.h
 
+#include atf-c.h
 #include errno.h
-#include stdio.h
-#include string.h
 
 static const struct {
void*addr;
int ok[2];  /* Depending on security.bsd.map_at_zero {0, !=0}. */
-} tests[] = {
+} map_at_zero_tests[] = {
{ (void *)0,{ 0, 1 } }, /* Test sysctl. */
{ (void *)1,{ 0, 0 } },
{ (void *)(PAGE_SIZE - 1),  { 0, 0 } },
@@ -52,54 +50,43 @@ static const struct {
 
 #defineMAP_AT_ZERO security.bsd.map_at_zero
 
-int
-main(void)
+ATF_TC_WITHOUT_HEAD(mmap__map_at_zero);
+ATF_TC_BODY(mmap__map_at_zero, tc)
 {
void *p;
size_t len;
-   int i, error, mib[3], map_at_zero;
-
-   error = 0;
-
-   /* Get the current sysctl value of security.bsd.map_at_zero. */
-   len = sizeof(mib) / sizeof(*mib);
-   if (sysctlnametomib(MAP_AT_ZERO, mib, len) == -1) {
-   printf(1..0 # SKIP: sysctlnametomib(\%s\) failed: %s\n,
-   MAP_AT_ZERO, strerror(errno));
-   return (0);
-   }
+   unsigned int i;
+   int map_at_zero;
 
len = sizeof(map_at_zero);
-   if (sysctl(mib, 3, map_at_zero, len, NULL, 0) == -1) {
-   printf(1..0 # SKIP: sysctl for %s failed: %s\n, MAP_AT_ZERO,
+   if (sysctlbyname(MAP_AT_ZERO, map_at_zero, len, NULL, 0) == -1) {
+   atf_tc_skip(sysctl for %s failed: %s\n, MAP_AT_ZERO,
strerror(errno));
-   return (0);
+   return;
}
 
/* Normalize to 0 or 1 for array access. */
map_at_zero = !!map_at_zero;
 
-   printf(1..%zu\n, nitems(tests));
-   for (i = 0; i  (int)nitems(tests); i++) {
-   p = mmap((void *)tests[i].addr, PAGE_SIZE,
+   for (i = 0; i  nitems(map_at_zero_tests); i++) {
+   p = mmap((void *)map_at_zero_tests[i].addr, PAGE_SIZE,
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED,
-1, 0);
if (p == MAP_FAILED) {
-   if (tests[i].ok[map_at_zero] != 0)
-   error++;
-   printf(%sok %d # mmap(%p, ...) failed\n,
-   tests[i].ok[map_at_zero] == 0 ?  : not ,
-   i + 1,
-   tests[i].addr);
+   ATF_CHECK_MSG(map_at_zero_tests[i].ok[map_at_zero] == 0,
+   mmap(%p, ...) failed, map_at_zero_tests[i].addr);
} else {
-   if (tests[i].ok[map_at_zero] != 1)
-   error++;
-   printf(%sok %d # mmap(%p, ...) succeeded: p=%p\n,
-   tests[i].ok[map_at_zero] == 1 ?  : not ,
-   i + 1,
-   tests[i].addr, p);
+   ATF_CHECK_MSG(map_at_zero_tests[i].ok[map_at_zero] == 1,
+   mmap(%p, ...) succeeded: p=%p\n,
+   map_at_zero_tests[i].addr, p);
}
}
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+   ATF_TP_ADD_TC(tp, mmap__map_at_zero);
 
-   return (error != 0);
+   return (atf_no_error());
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286370 - head/tests/sys/vm

2015-08-06 Thread John Baldwin
Author: jhb
Date: Thu Aug  6 16:14:29 2015
New Revision: 286370
URL: https://svnweb.freebsd.org/changeset/base/286370

Log:
  Add various tests to ensure that invalid arguments passed to mmap()
  trigger failures.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D3269

Modified:
  head/tests/sys/vm/mmap_test.c

Modified: head/tests/sys/vm/mmap_test.c
==
--- head/tests/sys/vm/mmap_test.c   Thu Aug  6 16:12:12 2015
(r286369)
+++ head/tests/sys/vm/mmap_test.c   Thu Aug  6 16:14:29 2015
(r286370)
@@ -32,6 +32,10 @@
 
 #include atf-c.h
 #include errno.h
+#include fcntl.h
+#include stdarg.h
+#include stdio.h
+#include stdlib.h
 
 static const struct {
void*addr;
@@ -83,10 +87,78 @@ ATF_TC_BODY(mmap__map_at_zero, tc)
}
 }
 
+static void
+checked_mmap(int prot, int flags, int fd, int error, const char *msg)
+{
+   void *p;
+
+   p = mmap(NULL, getpagesize(), prot, flags, fd, 0);
+   if (p == MAP_FAILED) {
+   if (error == 0)
+   ATF_CHECK_MSG(0, %s failed with errno %d, msg,
+   errno);
+   else
+   ATF_CHECK_EQ_MSG(error, errno,
+   %s failed with wrong errno %d (expected %d), msg,
+   errno, error);
+   } else {
+   ATF_CHECK_MSG(error == 0, %s succeeded, msg);
+   munmap(p, getpagesize());
+   }
+}
+
+ATF_TC_WITHOUT_HEAD(mmap__bad_arguments);
+ATF_TC_BODY(mmap__bad_arguments, tc)
+{
+   int fd;
+
+   ATF_REQUIRE((fd = shm_open(SHM_ANON, O_RDWR, 0644)) = 0);
+   ATF_REQUIRE(ftruncate(fd, getpagesize()) == 0);
+
+   /* These should work. */
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON, -1, 0,
+   simple MAP_ANON);
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0,
+   simple shm fd shared);
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0,
+   simple shm fd private);
+
+   /* Extra PROT flags. */
+   checked_mmap(PROT_READ | PROT_WRITE | 0x10, MAP_ANON, -1, EINVAL,
+   MAP_ANON with extra PROT flags);
+   checked_mmap(0x, MAP_SHARED, fd, EINVAL,
+   shm fd with garbage PROT);
+
+   /* Undefined flag. */
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_RESERVED0080, -1,
+   EINVAL, Undefined flag);
+
+   /* Both MAP_SHARED and MAP_PRIVATE */
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE |
+   MAP_SHARED, -1, EINVAL, MAP_ANON with both SHARED and PRIVATE);
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_SHARED, fd,
+   EINVAL, shm fd with both SHARED and PRIVATE);
+
+   /* At least one of MAP_SHARED or MAP_PRIVATE without ANON */
+   checked_mmap(PROT_READ | PROT_WRITE, 0, fd, EINVAL,
+   shm fd without sharing flag);
+
+   /* MAP_ANON with either sharing flag (impacts fork). */
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0,
+   shared MAP_ANON);
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0,
+   private MAP_ANON);
+
+   /* MAP_ANON should require an fd of -1. */
+   checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, EINVAL,
+   MAP_ANON with fd != -1);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
ATF_TP_ADD_TC(tp, mmap__map_at_zero);
+   ATF_TP_ADD_TC(tp, mmap__bad_arguments);
 
return (atf_no_error());
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286368 - in head: . sys/boot/forth sys/boot/i386/loader sys/boot/mips/beri/loader sys/boot/pc98/loader sys/boot/powerpc/kboot sys/boot/powerpc/ofw sys/boot/powerpc/ps3 sys/boot/sparc64...

2015-08-06 Thread Allan Jude
Author: allanjude
Date: Thu Aug  6 16:07:27 2015
New Revision: 286368
URL: https://svnweb.freebsd.org/changeset/base/286368

Log:
  Remove guards around overwriting loader.rc and menu.rc
  
  There have been .local version of each for user modifications for some time
  This allows users to receive future updates to these files
  
  PR:   183765
  Submitted by: Bertram Scharpf, Nikolai Lifanov (patch)
  Reviewed by:  dteske, loos, eadler
  Approved by:  bapt (mentor)
  MFC after:1 month
  Relnotes: yes
  Sponsored by: ScaleEngine Inc.
  Differential Revision:https://reviews.freebsd.org/D3176

Modified:
  head/UPDATING
  head/sys/boot/forth/loader.rc
  head/sys/boot/forth/menu.rc
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/pc98/loader/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/sparc64/loader/Makefile

Modified: head/UPDATING
==
--- head/UPDATING   Thu Aug  6 15:30:14 2015(r286367)
+++ head/UPDATING   Thu Aug  6 16:07:27 2015(r286368)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20150806:
+   The menu.rc and loader.rc files will now be replaced during 
+   upgrades. Please migrate local changes to menu.rc.local and
+   loader.rc.local instead.
+
 20150805:
GNU Binutils versions of addr2line, c++filt, nm, readelf, size,
strings and strip have been removed. The src.conf(5) knob

Modified: head/sys/boot/forth/loader.rc
==
--- head/sys/boot/forth/loader.rc   Thu Aug  6 15:30:14 2015
(r286367)
+++ head/sys/boot/forth/loader.rc   Thu Aug  6 16:07:27 2015
(r286368)
@@ -1,6 +1,9 @@
 \ Loader.rc
 \ $FreeBSD$
 \
+\ You should not edit this file! Put any overrides in loader.rc.local
+\ instead as this file can be replaced during system updates.
+\
 \ Includes additional commands
 include /boot/loader.4th
 try-include /boot/loader.rc.local

Modified: head/sys/boot/forth/menu.rc
==
--- head/sys/boot/forth/menu.rc Thu Aug  6 15:30:14 2015(r286367)
+++ head/sys/boot/forth/menu.rc Thu Aug  6 16:07:27 2015(r286368)
@@ -1,6 +1,9 @@
 \ Menu.rc
 \ $FreeBSD$
 \
+\ You should not edit this file! Put any overrides in menu.rc.local
+\ instead as this file can be replaced during system updates.
+\
 \ Load required Forth modules
 include /boot/version.4th
 include /boot/brand.4th

Modified: head/sys/boot/i386/loader/Makefile
==
--- head/sys/boot/i386/loader/Makefile  Thu Aug  6 15:30:14 2015
(r286367)
+++ head/sys/boot/i386/loader/Makefile  Thu Aug  6 16:07:27 2015
(r286368)
@@ -110,12 +110,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
 .include   ${.CURDIR}/../../forth/Makefile.inc
 FILES+=pcibios.4th
 
-.if !exists(${DESTDIR}/boot/loader.rc)
-FILES+=loader.rc
-.endif
-.if !exists(${DESTDIR}/boot/menu.rc)
-FILES+= menu.rc
-.endif
+FILES+=loader.rc menu.rc
 .endif
 
 # XXX crt0.o needs to be first for pxeboot(8) to work

Modified: head/sys/boot/mips/beri/loader/Makefile
==
--- head/sys/boot/mips/beri/loader/Makefile Thu Aug  6 15:30:14 2015
(r286367)
+++ head/sys/boot/mips/beri/loader/Makefile Thu Aug  6 16:07:27 2015
(r286368)
@@ -125,13 +125,7 @@ loader.help: help.common help.mips
 .PATH: ${.CURDIR}/../../../forth
 .include   ${.CURDIR}/../../../forth/Makefile.inc
 
-.if !exists(${DESTDIR}/boot/loader.rc)
-FILES+= loader.rc
-.endif
-
-.if !exists(${DESTDIR}/boot/menu.rc)
-FILES+= menu.rc
-.endif
+FILES+= loader.rc menu.rc
 
 .if defined(LOADER_USB_SUPPORT)
 # Do garbage collection

Modified: head/sys/boot/pc98/loader/Makefile
==
--- head/sys/boot/pc98/loader/Makefile  Thu Aug  6 15:30:14 2015
(r286367)
+++ head/sys/boot/pc98/loader/Makefile  Thu Aug  6 16:07:27 2015
(r286368)
@@ -90,12 +90,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
 .PATH: ${.CURDIR}/../../forth
 .include   ${.CURDIR}/../../forth/Makefile.inc
 
-.if !exists(${DESTDIR}/boot/loader.rc)
-FILES+=${.CURDIR}/../../i386/loader/loader.rc
-.endif
-.if !exists(${DESTDIR}/boot/menu.rc)
-FILES+= menu.rc
-.endif
+FILES+=${.CURDIR}/../../i386/loader/loader.rc menu.rc
 
 # XXX crt0.o needs to be first for pxeboot(8) to work
 OBJS=  ${BTXCRT}

Modified: head/sys/boot/powerpc/kboot/Makefile

svn commit: r286367 - head/sys/geom/uzip

2015-08-06 Thread Garrett Cooper
Author: ngie
Date: Thu Aug  6 15:30:14 2015
New Revision: 286367
URL: https://svnweb.freebsd.org/changeset/base/286367

Log:
  Make some debug printf's into DPRINTF's to reduce noise on attach/detach
  
  Differential Revision: https://reviews.freebsd.org/D3306
  MFC after: 1 week
  Reviewed by: loos
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/geom/uzip/g_uzip.c

Modified: head/sys/geom/uzip/g_uzip.c
==
--- head/sys/geom/uzip/g_uzip.c Thu Aug  6 14:49:23 2015(r286366)
+++ head/sys/geom/uzip/g_uzip.c Thu Aug  6 15:30:14 2015(r286367)
@@ -94,8 +94,8 @@ g_uzip_softc_free(struct g_uzip_softc *s
 {
 
if (gp != NULL) {
-   printf(%s: %d requests, %d cached\n,
-   gp-name, sc-req_total, sc-req_cached);
+   DPRINTF((%s: %d requests, %d cached\n,
+   gp-name, sc-req_total, sc-req_cached));
}
if (sc-offsets != NULL) {
free(sc-offsets, M_GEOM_UZIP);
@@ -519,7 +519,7 @@ g_uzip_taste(struct g_class *mp, struct 
gp-name,
pp2-sectorsize, (intmax_t)pp2-mediasize,
pp2-stripeoffset, pp2-stripesize, pp2-flags));
-   printf(%s: %u x %u blocks\n, gp-name, sc-nblocks, sc-blksz);
+   DPRINTF((%s: %u x %u blocks\n, gp-name, sc-nblocks, sc-blksz));
return (gp);
 
 err:
@@ -547,7 +547,7 @@ g_uzip_destroy_geom(struct gctl_req *req
g_topology_assert();
 
if (gp-softc == NULL) {
-   printf(%s(%s): gp-softc == NULL\n, __func__, gp-name);
+   DPRINTF((%s(%s): gp-softc == NULL\n, __func__, gp-name));
return (ENXIO);
}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org