]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMFP r274553:
Alexander V. Chernikov [Sat, 8 Aug 2015 17:48:54 +0000 (17:48 +0000)]
MFP r274553:
* Move lle creation/deletion from lla_lookup to separate functions:
  lla_lookup(LLE_CREATE) -> lla_create
  lla_lookup(LLE_DELETE) -> lla_delete
lla_create now returns with LLE_EXCLUSIVE lock for lle.
* Provide typedefs for new/existing lltable callbacks.

Reviewed by: ae

8 years agoRemove some code duplication.
Alexander Motin [Sat, 8 Aug 2015 16:39:28 +0000 (16:39 +0000)]
Remove some code duplication.

MFC after: 1 week

8 years agoSimplify ip[6] simploop:
Alexander V. Chernikov [Sat, 8 Aug 2015 15:58:35 +0000 (15:58 +0000)]
Simplify ip[6] simploop:
Do not pass 'dst' sockaddr to ip[6]_mloopback:
  - We have explicit check for AF_INET in ip_output()
  - We assume ip header inside passed mbuf in ip_mloopback
  - We assume ip6 header inside passed mbuf in ip6_mloopback

8 years agoAdd missing files to sendmail obsolete files list
Renato Botelho [Sat, 8 Aug 2015 15:51:29 +0000 (15:51 +0000)]
Add missing files to sendmail obsolete files list

Approved by: gshapiro
MFC after: 3 days
Sponsored by: Netgate
Differential Revision: https://reviews.freebsd.org/D3302

8 years agoAdd const-qualifiers for source mbuf argument in m_dup(), m_copym(),
Alexander V. Chernikov [Sat, 8 Aug 2015 15:50:46 +0000 (15:50 +0000)]
Add const-qualifiers for source mbuf argument in m_dup(), m_copym(),
  m_dup_pkthdr() and m_tag_copy_chain().

8 years agoDisable 32-bit PIO for 6Gbit/s Intel SATA controllers.
Alexander Motin [Sat, 8 Aug 2015 11:48:11 +0000 (11:48 +0000)]
Disable 32-bit PIO for 6Gbit/s Intel SATA controllers.

For some reason 32-bit PIO writes are not working on 6Gbit/s Intel SATA
ports, while 16/32-bit PIO reads and 16-bit PIO writes are working fine.
3Gbit/s ports on the same controllers have no this problem.

Workaround this by disabling 32-bit PIO for all Intel controllers that may
have 6Gbit/s ports.  It halves PIO performance from 6MB/s to 3MB/s, but
who bother about speed of such rare and slow mode, which is also highly
discouraged by SATA specifications?

MFC after: 2 weeks

8 years agoDon't panic if disk lost TRIM support due to switching to PIO mode.
Alexander Motin [Sat, 8 Aug 2015 11:22:45 +0000 (11:22 +0000)]
Don't panic if disk lost TRIM support due to switching to PIO mode.

MFC after: 1 week

8 years agoFix interaction between libedit initialization and Capsicum
Edward Tomasz Napierala [Sat, 8 Aug 2015 10:38:37 +0000 (10:38 +0000)]
Fix interaction between libedit initialization and Capsicum
in units(1). The most visible is the removal of libedit warnings
about being unable to open termcap database.

Reviewed by: eadler@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3322

8 years agoAllow to disable BIO_DELETE passthru in fstab for swap-on-geli devices by
Pawel Jakub Dawidek [Sat, 8 Aug 2015 09:57:38 +0000 (09:57 +0000)]
Allow to disable BIO_DELETE passthru in fstab for swap-on-geli devices by
passing 'notrim' option.

PR: 198863
Submitted by: Matthew D. Fuller fullermd at over-yonder dot net

8 years agoEnable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when
Pawel Jakub Dawidek [Sat, 8 Aug 2015 09:51:38 +0000 (09:51 +0000)]
Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when
GELI is used on a SSD or inside virtual machine, so that guest can tell
host that it is no longer using some of the storage.

Enabling BIO_DELETE passthru comes with a small security consequence - an
attacker can tell how much space is being really used on encrypted device and
has less data no analyse then. This is why the -T option can be given to the
init subcommand to turn off this behaviour and -t/T options for the configure
subcommand can be used to adjust this setting later.

PR: 198863
Submitted by: Matthew D. Fuller fullermd at over-yonder dot net

This commit also includes a fix from Fabian Keil freebsd-listen at
fabiankeil.de for 'configure' on onetime providers which is not strictly
related, but is entangled in the same code, so would cause conflicts if
separated out.

8 years agoFix a kernel assertion issue introduced with r286227:
Julien Charbon [Sat, 8 Aug 2015 08:40:36 +0000 (08:40 +0000)]
Fix a kernel assertion issue introduced with r286227:
Avoid too strict INP_INFO_RLOCK_ASSERT checks due to
tcp_notify() being called from in6_pcbnotify().

Reported by: Larry Rosenman <ler@lerctr.org>
Submitted by: markj, jch

8 years agoiwmfw: fix the path to the firmware file.
Rui Paulo [Sat, 8 Aug 2015 06:08:20 +0000 (06:08 +0000)]
iwmfw: fix the path to the firmware file.

8 years agoImport OpenBSD's iwm WiFi driver for Intel 3160/7260/7265.
Rui Paulo [Sat, 8 Aug 2015 06:06:48 +0000 (06:06 +0000)]
Import OpenBSD's iwm WiFi driver for Intel 3160/7260/7265.

There are still several bugs, but I've been using it for a while now.
Thanks to all the testers and to Adrian for his help with this
driver.

This driver isn't connected to the build yet, but it will be soon.

There's no MFC planned because the driver isn't very stable yet.

Reviewed by: adrian
Obtained from: https://github.com/rpaulo/iwm
Tested by: adrian, gjb, dumbbell (others that I forgot).
Relnotes: yes

8 years agoDocument the application interface.
Marcel Moolenaar [Sat, 8 Aug 2015 04:59:27 +0000 (04:59 +0000)]
Document the application interface.

8 years agoRevert the wifi ifnet changes until things are more baked and tested.
Adrian Chadd [Sat, 8 Aug 2015 01:10:17 +0000 (01:10 +0000)]
Revert the wifi ifnet changes until things are more baked and tested.

* 286410
* 286413
* 286416

The initial commit broke a variety of debug and features that aren't
in the GENERIC kernels but are enabled in other platforms.

8 years agoOnly process the PPS event types currently enabled in pps_params.mode.
Ian Lepore [Fri, 7 Aug 2015 23:31:31 +0000 (23:31 +0000)]
Only process the PPS event types currently enabled in pps_params.mode.

This makes the PPS API behave correctly, but isn't ideal -- we still end
up capturing PPS data for non-enabled edges, we just don't process the
data into an event that becomes visible outside of kern_tc.  That's because
the event type isn't passed to pps_capture(), so it can't do the filtering.
Any solution for capture filtering is going to require touching every driver.

8 years agoRFC 2783 requires a status of ETIMEDOUT, not EWOULDBLOCK, on a timeout.
Ian Lepore [Fri, 7 Aug 2015 21:14:19 +0000 (21:14 +0000)]
RFC 2783 requires a status of ETIMEDOUT, not EWOULDBLOCK, on a timeout.

8 years ago- Use an explicit "depends_on module kernel" guard in DTrace libraries that
Mark Johnston [Fri, 7 Aug 2015 19:56:22 +0000 (19:56 +0000)]
- Use an explicit "depends_on module kernel" guard in DTrace libraries that
  reference types defined in the kernel. Otherwise dtrace(1) expects to find
  CTF definitions for all referenced types, which is not very reasonable
  when it is being used in a build environment. This was previously worked
  around by adding "-x nolibs" to dtrace -h or -G invocations, but as of
  r283025, dtrace(1) actually handles dependencies properly, so this is no
  longer necessary.
- Remove "pragma ident" directives from DTrace libraries, as they're being
  phased out upstream as well.

Submitted by: Krister Johansen <Krister.Johansen@isilon.com> [1]
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix typo introduced in previous commit.
Marcel Moolenaar [Fri, 7 Aug 2015 18:40:44 +0000 (18:40 +0000)]
Fix typo introduced in previous commit.

Pointed out by: Nikolai Lifanov <lifanov at mail.lifanov.com>

8 years agoipv4_is_zeronet() and ipv4_is_loopback() expect an address in network
Mark Johnston [Fri, 7 Aug 2015 18:30:11 +0000 (18:30 +0000)]
ipv4_is_zeronet() and ipv4_is_loopback() expect an address in network
order, but IN_ZERONET and IN_LOOPBACK expect it in host order.

Submitted by: Tao Liu <Tao.Liu@isilon.com>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoo Fix a typo.
Marcel Moolenaar [Fri, 7 Aug 2015 17:22:37 +0000 (17:22 +0000)]
o  Fix a typo.
o  Describe the file formats mkimg can create.

8 years agoFix mtx_assert() argument.
Gleb Smirnoff [Fri, 7 Aug 2015 16:23:16 +0000 (16:23 +0000)]
Fix mtx_assert() argument.

8 years agoAdd unmapped I/O support to ata(4) driver.
Alexander Motin [Fri, 7 Aug 2015 14:38:26 +0000 (14:38 +0000)]
Add unmapped I/O support to ata(4) driver.

Main problem there was PIO mode support, that required KVA mapping.
Handle that case using recently added pmap_quick_enter_page(9) KPI,
mapping data pages to KVA one at a time.

8 years agoAdd more ifdefs to fix build with GCC after r286406.
Alexander Motin [Fri, 7 Aug 2015 14:12:51 +0000 (14:12 +0000)]
Add more ifdefs to fix build with GCC after r286406.

8 years agoFix !MWL_DEBUG build.
Gleb Smirnoff [Fri, 7 Aug 2015 12:34:20 +0000 (12:34 +0000)]
Fix !MWL_DEBUG build.

8 years agoCreate man page for pmap_quick_enter_page(9) and pmap_quick_remove_page(9)
Jason A. Harmening [Fri, 7 Aug 2015 12:13:15 +0000 (12:13 +0000)]
Create man page for pmap_quick_enter_page(9) and pmap_quick_remove_page(9)

Reviewed by: kib, brueffer, wblock
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D3312

8 years agoChange KPI of how device drivers that provide wireless connectivity interact
Gleb Smirnoff [Fri, 7 Aug 2015 11:43:14 +0000 (11:43 +0000)]
Change KPI of how device drivers that provide wireless connectivity interact
with the net80211 stack.

Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.

Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:

- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
  the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
  driver about any changes: number of wlan(4) interfaces, number of them
  in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
  driver experiences errors and can not attribute them to any specific
  interface, driver updates ic_oerrors or ic_ierrors counters.

Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
  now provided by net.wlan.devices sysctl.

Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@,
op@ and lev@, who also participated in testing. Details here:

https://wiki.freebsd.org/projects/ifnet/net80211

Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not
tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances
of problems are low. The wtap wasn't compilable even before this change.
But the ndis driver is complex, and it is likely to be broken with this
commit. Help with testing and debugging it is appreciated.

Differential Revision: D2655, D2740
Sponsored by: Nginx, Inc.
Sponsored by: Netflix

8 years agoManpage cleanup.
Christian Brueffer [Fri, 7 Aug 2015 10:48:52 +0000 (10:48 +0000)]
Manpage cleanup.

- new sentence -> new line
- fix manpage references
- fix macro usage
- fix a typo

MFC after: 1 week

8 years agoAttach dwmmc to the ofwbus, som devicetrees place it here.
Andrew Turner [Fri, 7 Aug 2015 08:57:58 +0000 (08:57 +0000)]
Attach dwmmc to the ofwbus, som devicetrees place it here.

Sponsored by: ABT Systems Ltd

8 years agoStop including machine/fdt.h, it's unneeded, and purposefully
Andrew Turner [Fri, 7 Aug 2015 08:54:50 +0000 (08:54 +0000)]
Stop including machine/fdt.h, it's unneeded, and purposefully
unimplemented on arm64.

Sponsored by: ABT Systems Ltd

8 years agoWrap some unused functions with notyet, it is necessary to be able to
Marcelo Araujo [Fri, 7 Aug 2015 08:30:43 +0000 (08:30 +0000)]
Wrap some unused functions with notyet, it is necessary to be able to
build the modules/ctl directly.
Remove a dead MALLOC_DEFINE.

Differential Revision: D3329
Reviewed by: mav
Sponsored by: gandi.net

8 years agoMinor style cleanup of the code surrounding r286404.
Konstantin Belousov [Fri, 7 Aug 2015 08:24:12 +0000 (08:24 +0000)]
Minor style cleanup of the code surrounding r286404.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoThe condition to use direct processing for the unmapped bio is
Konstantin Belousov [Fri, 7 Aug 2015 08:13:34 +0000 (08:13 +0000)]
The condition to use direct processing for the unmapped bio is
reverted.  We can do direct processing when g_io_check() does not need
to perform transient remapping of the bio, otherwise the thread has to
sleep.

Reviewed by: mav (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove an extra new line on usage().
Marcelo Araujo [Fri, 7 Aug 2015 07:05:47 +0000 (07:05 +0000)]
Remove an extra new line on usage().
Rename domain to domainname to be identical to the man page.

Reported by: bde

8 years agoFix variable 'old' is used uninitialized whenever '&&' condition is false.
Marcelo Araujo [Fri, 7 Aug 2015 06:15:01 +0000 (06:15 +0000)]
Fix variable 'old' is used uninitialized whenever '&&' condition is false.
Spotted by clang.

Differential Revision: D2721
Reviewed by: rodrigc, bapt

8 years agoRemove unused i386 header privatespace.h. For the native kernel, its
Konstantin Belousov [Fri, 7 Aug 2015 05:59:58 +0000 (05:59 +0000)]
Remove unused i386 header privatespace.h.  For the native kernel, its
use was removed in r173592 (Nov 2007), yet Xen PV bits continued
referencing the privatespace structure, and were removed in r282274
(Apr 2015).

Discussed with: jhb
Sponsored by: The FreeBSD Foundation

8 years agoReminder to check tools/build/mk/OptionalObsoleteFiles.inc on new
Gregory Neil Shapiro [Fri, 7 Aug 2015 04:58:35 +0000 (04:58 +0000)]
Reminder to check tools/build/mk/OptionalObsoleteFiles.inc on new
version imports.

Obtained from: garga@

8 years agoRebase after r286395: rounding fix for dynamic VHD
Marcel Moolenaar [Fri, 7 Aug 2015 04:35:43 +0000 (04:35 +0000)]
Rebase after r286395: rounding fix for dynamic VHD

8 years agoFix the dynamic VHD format to work with qemu. The size of the disk
Marcel Moolenaar [Fri, 7 Aug 2015 04:27:51 +0000 (04:27 +0000)]
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@

8 years agoGet closest as possible with style(9). No functional change.
Marcelo Araujo [Fri, 7 Aug 2015 02:37:47 +0000 (02:37 +0000)]
Get closest as possible with style(9). No functional change.

Differential Revision: D3295
Reviewed by: bapt

8 years agoAdd support for ASUS WL-100g.
Kevin Lo [Fri, 7 Aug 2015 02:05:16 +0000 (02:05 +0000)]
Add support for ASUS WL-100g.

8 years agoNow that the portsnap buildbox is generating the raw bits for INDEX-11,
Xin LI [Thu, 6 Aug 2015 23:44:46 +0000 (23:44 +0000)]
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

8 years agoIntroduce a sysctl for reporting the number of fully populated reservations.
Alan Cox [Thu, 6 Aug 2015 21:27:50 +0000 (21:27 +0000)]
Introduce a sysctl for reporting the number of fully populated reservations.

8 years agoDocument the recently added get-bitmode and eeprom read/write functionality.
Ian Lepore [Thu, 6 Aug 2015 20:59:03 +0000 (20:59 +0000)]
Document the recently added get-bitmode and eeprom read/write functionality.

8 years agoConsistently use both leading and trailing spaces inside of the {}'s
John Baldwin [Thu, 6 Aug 2015 20:05:40 +0000 (20:05 +0000)]
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.

8 years agoReturn the current ftdi bitbang mode with the UFTDIIOC_GET_BITMODE ioctl.
Ian Lepore [Thu, 6 Aug 2015 19:47:04 +0000 (19:47 +0000)]
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.

8 years agoWhitespace fixes to consistently use spaces before }'s and
John Baldwin [Thu, 6 Aug 2015 19:36:47 +0000 (19:36 +0000)]
Whitespace fixes to consistently use spaces before }'s and
wrap long lines.

8 years agoAdd support to the uftdi driver for reading and writing the serial eeprom
Ian Lepore [Thu, 6 Aug 2015 19:29:26 +0000 (19:29 +0000)]
Add support to the uftdi driver for reading and writing the serial eeprom
that can be attached to the chips, via ioctl() calls.

8 years agoDecode the arguments passed to the *at() family of system calls. This is
John Baldwin [Thu, 6 Aug 2015 19:08:33 +0000 (19:08 +0000)]
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.

8 years agoDecode the arguments to mkfifo() and fix an off-by-one error in the arguments
John Baldwin [Thu, 6 Aug 2015 18:32:32 +0000 (18:32 +0000)]
Decode the arguments to mkfifo() and fix an off-by-one error in the arguments
to mknod().

8 years agoDon't mark the fcntl flag argument as an output parameter so that it is
John Baldwin [Thu, 6 Aug 2015 18:28:15 +0000 (18:28 +0000)]
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.

8 years agoNow that stable/8 is EOL, stop building INDEX-8.
Xin LI [Thu, 6 Aug 2015 18:15:56 +0000 (18:15 +0000)]
Now that stable/8 is EOL, stop building INDEX-8.

MFC after: 1 week

8 years agoFormally pair store_rel(&smp_started) with load_acq(&smp_started).
Konstantin Belousov [Thu, 6 Aug 2015 18:02:54 +0000 (18:02 +0000)]
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

8 years agoAfter crypto_dispatch() bio might be already delivered and destroyed,
Pawel Jakub Dawidek [Thu, 6 Aug 2015 17:13:34 +0000 (17:13 +0000)]
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

8 years agoRemove some more vestiges of the Xen PV domu support. Specifically,
John Baldwin [Thu, 6 Aug 2015 17:07:21 +0000 (17:07 +0000)]
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

8 years agoThe changes that introduced fo_mmap() treated all character device
John Baldwin [Thu, 6 Aug 2015 16:50:37 +0000 (16:50 +0000)]
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

8 years agoAdd various tests to ensure that invalid arguments passed to mmap()
John Baldwin [Thu, 6 Aug 2015 16:14:29 +0000 (16:14 +0000)]
Add various tests to ensure that invalid arguments passed to mmap()
trigger failures.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D3269

8 years agoConvert the map_at_zero test case to ATF. In particular, this will
John Baldwin [Thu, 6 Aug 2015 16:12:12 +0000 (16:12 +0000)]
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

8 years agoRemove guards around overwriting loader.rc and menu.rc
Allan Jude [Thu, 6 Aug 2015 16:07:27 +0000 (16:07 +0000)]
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

8 years agoMake some debug printf's into DPRINTF's to reduce noise on attach/detach
Enji Cooper [Thu, 6 Aug 2015 15:30:14 +0000 (15:30 +0000)]
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

8 years agoFill in dump_avail based on the physical memory from EFI.
Andrew Turner [Thu, 6 Aug 2015 14:49:23 +0000 (14:49 +0000)]
Fill in dump_avail based on the physical memory from EFI.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoFix a typo.
Glen Barber [Thu, 6 Aug 2015 14:13:01 +0000 (14:13 +0000)]
Fix a typo.

Submitted by: pkelsey
Sponsored by: The FreeBSD Foundation

8 years agoMake it compilable. No idea if it works.
Gleb Smirnoff [Thu, 6 Aug 2015 14:05:17 +0000 (14:05 +0000)]
Make it compilable. No idea if it works.

8 years agoWhoops, wrong flag.
Edward Tomasz Napierala [Thu, 6 Aug 2015 07:49:34 +0000 (07:49 +0000)]
Whoops, wrong flag.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoTweak mdconfig(8) manual page, in particular revise the EXAMPLES
Edward Tomasz Napierala [Thu, 6 Aug 2015 07:47:13 +0000 (07:47 +0000)]
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

8 years agoAdd file_open(): the underlying system call of openat().
Ed Schouten [Thu, 6 Aug 2015 06:47:28 +0000 (06:47 +0000)]
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

8 years agoAdd recently added values of various flags and enumerations including
John Baldwin [Thu, 6 Aug 2015 01:49:18 +0000 (01:49 +0000)]
Add recently added values of various flags and enumerations including
kevent filters, kevent flags, flags to mmap, seek locations, fcntl
operations, file flags, socket domains, open flags, resource limits, and
pathconf values.

8 years agonfsclient: Protest loudly when GETATTR responses are invalid
Conrad Meyer [Wed, 5 Aug 2015 22:27:30 +0000 (22:27 +0000)]
nfsclient: Protest loudly when GETATTR responses are invalid

BROKEN NFS SERVER OR MIDDLEWARE: Certain WAN "accelerators" attempt to cache
NFS GETATTR traffic, but actually corrupt it (e.g., responding to requests
with attributes for totally different files).

Warn very verbosely when this is detected. Linux' NFS client has a similar
warning.

Adds a sysctl/tunable (vfs.nfs.fileid_maxwarnings) to configure the quantity
of warnings; default to 10. (Zero disables; -1 is unlimited.)

Adds a failpoint to aid in validating the warning / behavior with a
non-broken server. Use something like:

    sysctl 'debug.fail_point.nfscl_force_fileid_warning=10%return(1)'

Reviewed by: rmacklem
Approved by: markj (mentor)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3304

8 years agoPass SYNCHRONIZE CACHE command parameters to backends.
Alexander Motin [Wed, 5 Aug 2015 22:24:49 +0000 (22:24 +0000)]
Pass SYNCHRONIZE CACHE command parameters to backends.

At this point IMMED flag is translated to MNT_NOWAIT flag of VOP_FSYNC(),
hoping that file system implements that (ZFS seems doesn't).

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

8 years agoFix a bug which could make routed(8) daemon exit by sending a special RIP
Xin LI [Wed, 5 Aug 2015 22:04:56 +0000 (22:04 +0000)]
Fix a bug which could make routed(8) daemon exit by sending a special RIP
query from a remote machine, similar to SA-14:21.routed.

Submitted by: hrs

8 years agoFix shell injection vulnerability in patch(1) via ed(1) by
Xin LI [Wed, 5 Aug 2015 22:04:54 +0000 (22:04 +0000)]
Fix shell injection vulnerability in patch(1) via ed(1) by
tightening sanity check of the input. [1]

While I'm there also replace ed(1) with red(1) because we do
not need the unrestricted functionality. [2]

Obtained from: Bitrig [1], DragonFly [2]
Security: CVE-2015-1418 [1]

8 years agoRelax serialization of SYNCHRONIZE CACHE commands.
Alexander Motin [Wed, 5 Aug 2015 21:58:32 +0000 (21:58 +0000)]
Relax serialization of SYNCHRONIZE CACHE commands.

Before this change SYNCHRONIZE CACHE commands were executed exclusively,
as if they had ORDERED tag.  But looking through SCSI specs I've found
no any reason to be so strict.  For reads this ordering seems pointless.
For writes it looks less obvious, so I left ordering against preceeding
write commands, while following ones are no longer required to wait.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

8 years agofind: Fix segfault with very long path in -exec/-ok ... {} \;.
Jilles Tjoelker [Wed, 5 Aug 2015 21:33:30 +0000 (21:33 +0000)]
find: Fix segfault with very long path in -exec/-ok ... {} \;.

If the resulting argument is longer than MAXPATHLEN, realloc() was called to
extend the space, but the new pointer was not correctly stored.

Different from what OpenBSD has done, rewrite brace_subst() to calculate the
necessary space first and realloc() at most once.

As before, the e_len fields are not updated in case of a realloc.
Therefore, a following long argument will do another realloc.

PR: 201750
MFC after: 1 week

8 years agoAdd a hack-around to this fatal taskqueue running whilst the NIC
Adrian Chadd [Wed, 5 Aug 2015 21:22:25 +0000 (21:22 +0000)]
Add a hack-around to this fatal taskqueue running whilst the NIC
is detaching.

This mostly fixes a panic - the reset path shouldn't run whilst
the NIC is being torn down.

It's not locked, so it's "mostly" ok, but most of the rest of
the driver doesn't read sc->invalid with sensible locking. Grr.

The real solution is to cleanly tear down taskqueues in the detach/suspend
phase, but ..

8 years agoAdd a missing method - ath_hal_settsf64().
Adrian Chadd [Wed, 5 Aug 2015 21:16:12 +0000 (21:16 +0000)]
Add a missing method - ath_hal_settsf64().

This is required for TDMA slave mode.

8 years agoAdd regression tests for a bug reported in stable/10
Baptiste Daroussin [Wed, 5 Aug 2015 21:11:32 +0000 (21:11 +0000)]
Add regression tests for a bug reported in stable/10

While pw(8) on head is not affected it is worth adding more regression tests
ensuring this bug will not happen unnoticed in the futur

8 years agocxgbe(4): Update T5 and T4 firmwares bundled with the driver to 1.14.4.0. The
Navdeep Parhar [Wed, 5 Aug 2015 19:45:11 +0000 (19:45 +0000)]
cxgbe(4):  Update T5 and T4 firmwares bundled with the driver to 1.14.4.0.  The
changes in the firmwares since 1.11.27.0 are listed here (straight copy-paste
from the "Release Notes.txt" accompanying the Chelsio Unified Wire 2.11.1.0
release on the website).

22.1. T5 Firmware
+++++++++++++++++++++++++++++++++

Version : 1.14.4.0
Date    : 08/05/2015
================================================================================

FIXES
-----

BASE:
- Fixes a potential data path hang by properly programming PMTX congestion
  threshold settings.
- Fixes a potential initialization error when accessing a configuration file
  stored on the flash.
- Fixes a regression where SGE resources can be miss-sized if iWARP is disabled.

ETH:
- Fixes a timing issue that would prevent CR4 links from coming up with some
  switches.

FOFCoE:
- Defers fcoe linkdown mailbox command handling till LOGO is sent.
- Updates vlan prio for all outstanding IOs during dcbx update.

ENHANCEMENTS
------------

BASE:
- Adds support for PAUSE OFF watchdog.
- Reports devlog access information in PCIE_FW_PF register 7.

ETH:
- Enhances segmentation offload to include VxLAN and Geneve.
- Adds PTP support.
- Adds new interface to allow the driver to query the VI rss table base
  addresses.
- Allows the driver to program the SGE ingrext contxt CongDrop field.

OFLD:
- Adds new interface for the driver to specify offloaded connections TCP snd
  and rcv scale factors.

iSCSI:
- Adds support for iscsi segmentatation offload (ISO).
- Adds support for iscsi t10-dif offload.

FOiSCSI:
- Sets FORCE_BIT for cut through processing for FOiSCSI.

FOFCoE:
- Adds support for FCoE BB6.
- Improves WRITE performance.

================================================================================
================================================================================

Version : 1.13.32.0
Date    : 03/25/2015
================================================================================

FIXES
-----

BASE:
- Fixes FW_CAPS_CONFIG_CMD return value on error (was positive instead of
   negative)
- Fixes FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ indication (was wrong on certain
   adapter configurations)
- Fixes config file based PL_TIMEOUT register programming

ETH:
- Fixes a potential EO UDP SEG header corruption
- Fixes an issue where 1000Base-X was not enabled correctly when using QSA
   modules

OFLD:
- Fixes timeout issue with half-open connections
- Fixes FW_FLOWC_WR processing when state is set to finwait1

FOFCoE:
- Fixes fcoe xchg leaks in linkdown/peer down path
- Fixes cleanup in FCoE linkdown and fixed buf timer flowid abuse
- Fixes fw crash by clearing fcf flowc during bye

FOiSCSI:
- Don't create a new tcp socket if ERL0 attempt has timed out.

ENHANCEMENTS
------------

BASE:
- Adds support for VFs on PFs 4 to 7
- Adds support for QPs/CQs on any physical and virtual function

ETH:
- Stops sending LACP frames on loopback interface
- Adds an AUTOEQU indication to CPL_SGE_EGR_UPDATE
- Adds support for CR4 links (BEAN/AEC on 40G TwinAx cables)

OFLD:
- Improves default settings of LAN and CLUSTER TCP timer settings
- Sends Negative Advice CPLs to software

FOISCSI:
- Adds IPv6 support for foiscsi. Keeps backward compatibility with
   old foiscsi drivers which doesn't support ipv6.

FOFCoE:
- Added fcoe debug support in flowc dump

================================================================================
================================================================================

Version : 1.12.25.0
Date    : 10/22/2014
================================================================================

FIXES
-----

BASE:
- Improves precision of the Weight Round Robing Traffic Management Algorithm
- Fixes an issue where the link would intermittently fail to come up
- Fixes an issue where adapters with an external PHY couldn't run at 100Mbps
- Fixes an issue where active optical cables were not recognized
- Fixes link advertising issues on T520-BT (speed and pause frames) that would
  cause the link to negotiate unexpected settings
- Forces link restart when auto-negotiation is disabled
- Fix an issue where pause frames wouldn't be fully disabled even if requested

ETH:
- Fixes NVGRE Segmentation Offload network header generation.

DCBX:
- Fixes an issue where some settings were not being sent to the switch
  correctly
- Fixes an issue where back-to-back DCBX port updates could get overwritten by
  FW
- Fixes a firmware crash on DCBX APP information request before link up

FOiSCSI:
- Fixes abort task leak in tmf response handling
- Fixes TCP RST handling while in iSCSI ERL0
- Fixes a firmware crash on BYE without INIT

ENHANCEMENTS
-------------

BASE:
- Adds link partner settings reporting when available
- Adds QSA support (in conjunction with QSA VPD)
- Adds T520-BT LED support
- Reports NOTSUPPORTED for modules with an unhandled identifier

DCBX:
- Adds version reporting (indicating which version FW is trying to negotiate)
- Adds IEEE support
- Reports LLDP time outs

FOiSCSI:
- Add support for multiple iSCSI DDP client
- Sends DHCP renew request when lease expires

================================================================================

22.2. T4 Firmware
+++++++++++++++++

Version : 1.14.4.0
Date    : 08/05/2015
================================================================================

FIXES
-----

BASE:
- Fixes a potential initialization error when accessing a configuration file
  stored on the flash.
- Initialize PCIE_DBG_INDIR_REQ.Enable to 0, as hardware failed to do so and
  register dumps could result in errors.

ETH:
- Fixes an issue that sometimes prevented the link from coming up in CR adapters.

ENHANCEMENTS
------------

BASE:
- Adds support for PAUSE OFF watchdog.
- Reports devlog access information in PCIE_FW_PF register 7.

ETH:
- Adds new interface to allow the driver to query the VI rss table base
  addresses.

OFLD:
- Adds new interface for the driver to specify offloaded connections TCP snd
  and rcv scale factors.

================================================================================
================================================================================

Version : 1.13.32.0
Date    : 03/25/2015
================================================================================

FIXES
-----

BASE:
- Fixes FW_CAPS_CONFIG_CMD return value on error (was positive instead of
    negative)
- Fixes FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ indication (was wrong on certain
    adapter configurations)
- Fixes config file based PL_TIMEOUT register programming

ETH:
- Fixes a potential EO UDP SEG header corruption

OFLD:
- Fixes timeout issue with half-open connections
- Fixes FW_FLOWC_WR processing when state is set to finwait1

FOiSCSI:
- Don't create a new tcp socket if ERL0 attempt has timed out.

ENHANCEMENTS
------------

ETH:
- Stops sending LACP frames on loopback interface
- Adds an AUTOEQU indication to CPL_SGE_EGR_UPDATE

OFLD:
- Improves default settings of LAN and CLUSTER TCP timer settings
- Sends Negative Advice CPLs to software

================================================================================
================================================================================

Version : 1.12.25.0
Date    : 10/22/2014
================================================================================

FIXES
-----

BASE:
- Improves precision of the Weight Round Robing Traffic Management Algorithm
- Forces link restart when auto-negotiation is disabled
- Fix an issue where pause frames wouldn't be fully disabled even if requested

DCBX:
- Fixes an issue where some settings were not being sent to the switch
  correctly
- Fixes an issue where back-to-back DCBX port updates could get overwritten by
  FW
- Fixes a firmware crash on DCBX APP information request before link up

FOiSCSI:
- Fixes abort task leak in tmf response handling
- Fixes TCP RST handling while in iSCSI ERL0
- Fixes a firmware crash on BYE without INIT

ENHANCEMENTS
------------

BASE:
- Adds link partner settings reporting when available
- Firmware now reports NOTSUPPORTED for modules with an unhandled identifier

DCBX:
- Adds version reporting (indicating which version FW is trying to negotiate)
- Adds IEEE support
- Reports LLDP time outs

FOiSCSI:
- Adds support for multiple iSCSI DDP clients
- Sends DHCP renew request when lease expires

================================================================================

Obtained from: Chelsio Communications
MFC after: 2 weeks
Sponsored by: Chelsio Communications

8 years agoAdd TXOP enforce support to the AR9300 HAL.
Adrian Chadd [Wed, 5 Aug 2015 19:32:35 +0000 (19:32 +0000)]
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 <bpurgar@gmail.com>

8 years agoRationalize BSD license on sys/*/include/in_cksum.h
Ed Maste [Wed, 5 Aug 2015 19:05:12 +0000 (19:05 +0000)]
Rationalize BSD license on sys/*/include/in_cksum.h

Remove the advertising clause from the Regents of the University of
California's license, per the letter dated July 22, 1999.

Update clause numbering.

8 years agoRemove empty directories left by r286332
Ed Maste [Wed, 5 Aug 2015 18:55:40 +0000 (18:55 +0000)]
Remove empty directories left by r286332

Reported by: garga

8 years agoRemove old GNU Binutils tools now provided by ELF Tool Chain
Ed Maste [Wed, 5 Aug 2015 18:30:00 +0000 (18:30 +0000)]
Remove old GNU Binutils tools now provided by ELF Tool Chain

Reviewed by: bapt, brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3238

8 years agoRework get_string() to make it more robust when fetching strings of unknown
John Baldwin [Wed, 5 Aug 2015 18:14:01 +0000 (18:14 +0000)]
Rework get_string() to make it more robust when fetching strings of unknown
length.  In particular, instead of blinding fetching 1k blocks, do an initial
fetch up to the end of the current page followed by page-sized fetches up to
the maximum size.  Previously if the 1k buffer crossed a page boundary and
the second page was not valid, the entire operation would fail.

8 years agoWhitespace fix: remove some spurious spaces before commas.
John Baldwin [Wed, 5 Aug 2015 18:10:46 +0000 (18:10 +0000)]
Whitespace fix: remove some spurious spaces before commas.

8 years agoMake rctl_enable rc variable actually work. To avoid breaking existing
Edward Tomasz Napierala [Wed, 5 Aug 2015 17:38:02 +0000 (17:38 +0000)]
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

8 years agoFix more style issues.
Jung-uk Kim [Wed, 5 Aug 2015 17:21:42 +0000 (17:21 +0000)]
Fix more style issues.

Submitted by: bde

8 years agoRationalize BSD license on sys/*/include/float.h
Ed Maste [Wed, 5 Aug 2015 17:05:35 +0000 (17:05 +0000)]
Rationalize BSD license on sys/*/include/float.h

Remove the advertising clause from the Regents of the University of
California's license, per the letter dated July 22, 1999.

Update clause numbering.

8 years agoCorrect the previous commit: remove the DECLARE_MODULE().
Ed Schouten [Wed, 5 Aug 2015 16:53:49 +0000 (16:53 +0000)]
Correct the previous commit: remove the DECLARE_MODULE().

It looks like a MODULE_VERSION() can also appear on its own -- there is
no need to use explicitly use DECLARE_MODULE(). Looking at other
modules, this seems common practice.

8 years agoAdd DECLARE_MODULE() to the "cloudabi" kernel module.
Ed Schouten [Wed, 5 Aug 2015 16:45:47 +0000 (16:45 +0000)]
Add DECLARE_MODULE() to the "cloudabi" kernel module.

This kernel module does not require any explicit initialization, but a
module declaration is needed to let the "cloudabi64" kernel module
automatically pull this in.

Obtained from: https://github.com/NuxiNL/freebsd

8 years agoMake fcntl(F_SETFL) work.
Ed Schouten [Wed, 5 Aug 2015 16:15:43 +0000 (16:15 +0000)]
Make fcntl(F_SETFL) work.

The stat_put() system call can be used to modify file descriptor
attributes, such as flags, but also Capsicum permission bits. Support
for changing Capsicum bits will be added as soon as its dependent
changes have been pushed through code review.

Obtained from: https://github.com/NuxiNL/freebsd

8 years agoFix `make depend` in sys/modules
Li-Wen Hsu [Wed, 5 Aug 2015 14:45:52 +0000 (14:45 +0000)]
Fix `make depend` in sys/modules

Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D3291

8 years agoIssue all reads of single XCOPY segment simultaneously.
Alexander Motin [Wed, 5 Aug 2015 13:46:15 +0000 (13:46 +0000)]
Issue all reads of single XCOPY segment simultaneously.

During vMotion and Clone VMware by default runs multiple sequential 4MB
XCOPY requests same time.  If CTL issues reads sequentially in 1MB chunks
for each XCOPY command, reads from different commands are not detected
as sequential by serseq option code and allowed to execute simultaneously.
Such read pattern confused ZFS prefetcher, causing suboptimal disk access.
Issuing all reads same time make serseq code work properly, serializing
reads both within each XCOPY command and between them.

My tests with ZFS pool of 14 disks in RAID10 shows prefetcher efficiency
improved from 37% to 99.7%, copying speed improved by 10-60%, average
read latency reduced twice on HDD layer and by five times on zvol layer.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

8 years agoRegenerate the system call table.
Ed Schouten [Wed, 5 Aug 2015 13:10:13 +0000 (13:10 +0000)]
Regenerate the system call table.

8 years agoImport the latest CloudABI system call definitions and table.
Ed Schouten [Wed, 5 Aug 2015 13:09:46 +0000 (13:09 +0000)]
Import the latest CloudABI system call definitions and table.

We're going to need these for next code I'm going to send out for
review: support for poll() and kqueue() on CloudABI.

8 years agoDisable SSE in libthr
Eric van Gyzen [Wed, 5 Aug 2015 12:53:55 +0000 (12:53 +0000)]
Disable SSE in libthr

Clang emits SSE instructions on amd64 in the common path of
pthread_mutex_unlock.  If the thread does not otherwise use SSE,
this usage incurs a context-switch of the FPU/SSE state, which
reduces the performance of multiple real-world applications by a
non-trivial amount (3-5% in one application).

Instead of this change, I experimented with eagerly switching the
FPU state at context-switch time.  This did not help.  Most of the
cost seems to be in the read/write of memory--as kib@ stated--and
not in the #NM handling.  I tested on machines with and without
XSAVEOPT.

One counter-argument to this change is that most applications already
use SIMD, and the number of applications and amount of SIMD usage
are only increasing.  This is absolutely true.  I agree that--in
general and in principle--this change is in the wrong direction.
However, there are applications that do not use enough SSE to offset
the extra context-switch cost.  SSE does not provide a clear benefit
in the current libthr code with the current compiler, but it does
provide a clear loss in some cases.  Therefore, disabling SSE in
libthr is a non-loss for most, and a gain for some.

I refrained from disabling SSE in libc--as was suggested--because
I can't make the above argument for libc.  It provides a wide variety
of code; each case should be analyzed separately.

https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html

Suggestions from: dim, jmg, rpaulo
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell Inc.

8 years agoFix UP build after r286296, ensure that CPU_FOREACH() is defined.
Konstantin Belousov [Wed, 5 Aug 2015 10:50:33 +0000 (10:50 +0000)]
Fix UP build after r286296, ensure that CPU_FOREACH() is defined.

Sponsored by: The FreeBSD Foundation

8 years agoProperly sort the function declarations added in r286296
Jason A. Harmening [Wed, 5 Aug 2015 10:48:32 +0000 (10:48 +0000)]
Properly sort the function declarations added in r286296

Submitted by: alc
Approved by: kib (mentor)

8 years agoAdd the remaining pointer size independent CloudABI socket system calls.
Ed Schouten [Wed, 5 Aug 2015 08:18:05 +0000 (08:18 +0000)]
Add the remaining pointer size independent CloudABI socket system calls.

CloudABI uses a structure called cloudabi_sockstat_t. Think of it as
'struct stat' for sockets. It is used by functions such as
getsockname(), getpeername(), some of the getsockopt() values, etc.

This change implements the sock_stat_get() system call that returns a
copy of this structure. The accept() system call should also return a
full copy of this structure eventually, but for now we're only
interested in the peer address. Add a TODO() to make sure this is
patched up later on.

Differential Revision: https://reviews.freebsd.org/D3218

8 years agoAllow the creation of polling descriptors (kqueues) on CloudABI.
Ed Schouten [Wed, 5 Aug 2015 07:37:06 +0000 (07:37 +0000)]
Allow the creation of polling descriptors (kqueues) on CloudABI.

8 years agoAllow the creation of kqueues with a restricted set of Capsicum rights.
Ed Schouten [Wed, 5 Aug 2015 07:36:50 +0000 (07:36 +0000)]
Allow the creation of kqueues with a restricted set of Capsicum rights.

On CloudABI we want to create file descriptors with just the minimal set
of Capsicum rights in place. The reason for this is that it makes it
easier to obtain uniform behaviour across different operating systems.

By explicitly whitelisting the operations, we can return consistent
error codes, but also prevent applications from depending OS-specific
behaviour.

Extend kern_kqueue() to take an additional struct filecaps that is
passed on to falloc_caps(). Update the existing consumers to pass in
NULL.

Differential Revision: https://reviews.freebsd.org/D3259

8 years agoMake it possible to implement poll(2) on top of kqueue(2).
Ed Schouten [Wed, 5 Aug 2015 07:34:29 +0000 (07:34 +0000)]
Make it possible to implement poll(2) on top of kqueue(2).

It looks like EVFILT_READ and EVFILT_WRITE trigger under the same
conditions as poll()'s POLLRDNORM and POLLWRNORM as described by POSIX.
The only difference is that POLLRDNORM has to be triggered on regular
files unconditionally, whereas EVFILT_READ only triggers when not EOF.

Introduce a new flag, NOTE_FILE_POLL, that can be used to make
EVFILT_READ and EVFILT_WRITE behave identically to poll(). This flag
will be used by cloudlibc's poll() function.

Reviewed by: jmg
Differential Revision: https://reviews.freebsd.org/D3303