]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
5 years agoCommitted, CRIS port: fix fallout from time_t defaulting to 64 bits, part 1
Hans-Peter Nilsson [Thu, 13 Sep 2018 15:45:39 +0000 (17:45 +0200)]
Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 1

It's been a while...  I see the CRIS port broke with the
time_t-default-to-64-bit change, observable by a few test-cases in the
gcc fortran(!) tests failing, regressing when trying a recent newlib.

This is a two-part belt-and-suspenders change: adjust the CRIS port
gettimeofday syscall (the only one in newlib/CRIS passing a time_t or
struct timeval) to handle a userspace 64-bit time_t and secondly default
time_t to 32-bit long anyway.  I considered making the local
"kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t
being 64 bits, but thought it not worth bothering with the few move insns.
The effect of a 64-bit time_t is however observable as longer simulation
time when running the gcc testsuite and as bigger binaries without any
actual upside from the larger time_t size, so I thought better make the
default for this port go back to being a "long" again.

Tested by running the gcc testsuite over the three combinations of two
parts of the patch and observing the expected changes.  Committed.

libgloss:
Adjust for syscall and userspace having different time_t or timeval.
* cris/linunistd.h (kernel_time_t, kernel_suseconds_t, kernel_timeval):
New types.
(gettimeofday): Change the type of the first argument to be a
pointer to a struct kernel_timeval.
* cris/gensyscalls (_gettimeofday): Use an intermediate struct
kernel_timeval for the syscall and initialize the result from
that.

Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
5 years agoCygwin: console: make sure EnumFontFamiliesExW loop isn't infinite
Corinna Vinschen [Fri, 7 Sep 2018 11:49:54 +0000 (13:49 +0200)]
Cygwin: console: make sure EnumFontFamiliesExW loop isn't infinite

The current loop condition is borderline.  Make sure it ends and
choose a replacement char in the unlikely case the current console
font isn't recognized at all.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: store replacement char directly
Corinna Vinschen [Fri, 7 Sep 2018 11:48:35 +0000 (13:48 +0200)]
Cygwin: console: store replacement char directly

Rather than relying on an index variable, store the current
replacement char and use that directly in WriteConsoleW.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: don't hang in check_font with raster fonts
Corinna Vinschen [Fri, 7 Sep 2018 11:43:48 +0000 (13:43 +0200)]
Cygwin: console: don't hang in check_font with raster fonts

EnumFontFamiliesExW fails if the font is "Terminal" (aka "Raster Fonts")
and lfCharSet requests ANSI_CHARSET.  Using DEFAULT_CHARSET fixes this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agosearch: Fix Berkeley DB hash code for 16-bit targets.
Jon Beniston [Thu, 6 Sep 2018 12:53:15 +0000 (13:53 +0100)]
search: Fix Berkeley DB hash code for 16-bit targets.

hash.h: Use 32-bit type for data stored on disk, so code
works for 16 and 64-bit targets. Reduce maximum bucket size on 16-bit
targets, so it fits in available memory.
hash.c: Check bucket size isn't too big for target.
hash_buf.c: Fix overflow warning on 16-bit targets.

5 years agoUse !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]
Keith Packard [Thu, 6 Sep 2018 04:39:40 +0000 (21:39 -0700)]
Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]

When __HAVE_LOCALE_INFO__ is not selected, directly access the
existing _ctype_ variable from __locale_ctype_ptr() and
__locale_ctype_ptr_l(), eliminating the need for any locale or reent
structure

Signed-off-by: Keith Packard <keithp@keithp.com>
v2:
locale: fix conflict with __locale_ctype_ptr macro

If we are building without __HAVE_LOCALE_INFO__, there is a
macro providing __locale_ctype_ptr which in turn fouls up this
declaration.

Signed-off-by: Michael Lyle <mlyle@lyle.org>
5 years agostdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_point
Keith Packard [Thu, 6 Sep 2018 04:25:01 +0000 (21:25 -0700)]
stdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_point

The string/float conversion functions need to get the locale decimal
point. Instead of calling __localeconv_l (which copies locale data
into lconv form from __get_numeric_locale), use __get_numeric_locale
directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoInclude sys/syslimits.h in limits.h
Keith Packard [Thu, 6 Sep 2018 04:23:46 +0000 (21:23 -0700)]
Include sys/syslimits.h in limits.h

This makes sure any system-defined limits are specified before the
defaults are checked. Without this, ARG_MAX and PATH_MAX end up
getting the default definitions from limits.h rather than the defines
from syslimits.h. This could potentially cause problems when
different files used different values for the same name.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoxdr_private.h needs sys/types.h for u_char
Keith Packard [Thu, 6 Sep 2018 04:21:16 +0000 (21:21 -0700)]
xdr_private.h needs sys/types.h for u_char

u_char is defined in sys/types.h, which doesn't appear to get
included, at least in my environments.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoDocument the log table generation method
Szabolcs Nagy [Wed, 5 Sep 2018 11:15:55 +0000 (12:15 +0100)]
Document the log table generation method

Add comments with enough detail so the log lookup tables can be recreated.

5 years agostdlib/arc4random.c: Fix reseed count for 16-bit targets.
Jon Beniston [Wed, 5 Sep 2018 09:57:33 +0000 (10:57 +0100)]
stdlib/arc4random.c: Fix reseed count for 16-bit targets.

5 years agoCygwin: console: device context is process private
Corinna Vinschen [Thu, 6 Sep 2018 11:05:55 +0000 (13:05 +0200)]
Cygwin: console: device context is process private

Make sure device context is not copied to forked process.
It is a process-specific datastructure.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: improve replacement char algorithm
Corinna Vinschen [Wed, 5 Sep 2018 21:39:25 +0000 (23:39 +0200)]
Cygwin: console: improve replacement char algorithm

Try various Unicode characters which may be used as a replacement
character in case an invalid character has to be printed.

Current list is 0xfffd "REPLACEMENT CHARACTER", 0x25a1 "WHITE SQUARE",
and 0x2592 "MEDIUM SHADE" in that order.

Additionally workaround a problem with some fonts (namely DejaVu
Sans Mono) which are returned wit ha broken fontname with trailing
stray characters.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: console: use UNICODE API throughout
Corinna Vinschen [Wed, 5 Sep 2018 11:08:33 +0000 (13:08 +0200)]
Cygwin: console: use UNICODE API throughout

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Bump DLL version to 2.11.2
Corinna Vinschen [Wed, 5 Sep 2018 11:02:09 +0000 (13:02 +0200)]
Cygwin: Bump DLL version to 2.11.2

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoImprove strstr performance of short needles
Wilco Dijkstra [Tue, 4 Sep 2018 17:54:21 +0000 (17:54 +0000)]
Improve strstr performance of short needles

Improve strstr performance for the common case of short needles.  For a single
character strchr is best, for 2-4 characters a small loop is fastest.  For these
the speedup over the Two-Way algorithm is ~10 times on large strings.

Newlib builds, the new code passes GLIBC testsuite. OK for commit?

5 years agomath_config.h: Fix signed overflow warning for 16-bit targets cygwin-2_11_1-release
Jon Beniston [Fri, 31 Aug 2018 22:10:00 +0000 (23:10 +0100)]
math_config.h: Fix signed overflow warning for 16-bit targets

5 years agoe_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits...
Jon Beniston [Fri, 31 Aug 2018 21:42:29 +0000 (22:42 +0100)]
e_scalb.c: Call scalbln instead of scalbn on 16-bit targets to ensure constant fits in an int.

5 years agoAvoid ARM SWI Seek when querying file position
Andy Koppe [Fri, 31 Aug 2018 11:26:02 +0000 (12:26 +0100)]
Avoid ARM SWI Seek when querying file position

Issuing an ARM semi-hosting Seek command when just querying file
position with SEEK_CUR and offset zero is unnecessary, because unlike
the lseek() Unix system call the Seek command does not actually return
the file position. For that reason, syscalls.c for ARM keeps track of
file position in the 'poslog', so we can just return that.

Moreover, since the Seek command only accepts an absolute file position,
SEEK_CUR operations are implemented by adding the relative offset to the
position in the poslog. If the host implements non-binary files with
implicit carriage return characters but doesn't discount those implicit
CRs when implementing Seek (by just mapping straight to Windows file
operations), this actually ended up wrongly changing file position when
using SEEK_CUR with offset zero or functions like ftell() or fgetpos()
that are based on that.

Also, use off_t rather than int for the poslog.

5 years agoCygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars
Corinna Vinschen [Sat, 1 Sep 2018 19:34:34 +0000 (21:34 +0200)]
Cygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars

So far we printed a half filled square (0x2592) if the input char is
invalid, but using REPLACEMENT CHARACTER (0xfffd) is apparently the way
to go.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: fix Win32 path ".." backtracking
Corinna Vinschen [Sat, 1 Sep 2018 19:01:08 +0000 (21:01 +0200)]
Cygwin: fix Win32 path ".." backtracking

Commit 35998fc2fa6cbb7d761f6d88346246bd3627552b fixed the buffer underun
in win32 path normalization, but introduced a new bug: A wrong
assumption led to the inability to backtrack the path outside of the
current working directory in case of relative paths.

This patch fixes this problem, together with a minor problem if the CWD
is on a network share: The result erroneously started with tripple
backslash if the src path starts with a single backslash.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoAdd --disable-newlib-fno-builtin to allow compilation without -fno-builtin for smalle... newlib-snapshot-20180831
Jon Beniston [Fri, 31 Aug 2018 16:44:33 +0000 (17:44 +0100)]
Add --disable-newlib-fno-builtin to allow compilation without -fno-builtin for smaller and faster code.

5 years agoCygwin: Bump DLL version to 2.11.1
Corinna Vinschen [Fri, 31 Aug 2018 11:01:23 +0000 (13:01 +0200)]
Cygwin: Bump DLL version to 2.11.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoDrop non-reserved parameter names from sys/signal.h cygwin-2_11_0-release
Andy Koppe [Wed, 29 Aug 2018 14:37:13 +0000 (15:37 +0100)]
Drop non-reserved parameter names from sys/signal.h

Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header.

5 years agoUse __inhibit_loop_to_libcall in all memset/memcpy implementations
Keith Packard [Mon, 27 Aug 2018 18:32:31 +0000 (11:32 -0700)]
Use __inhibit_loop_to_libcall in all memset/memcpy implementations

This macro selects a compiler option that disables recognition of
common memset/memcpy patterns and converting those to direct
memset/memcpy calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoRemove unused variable 'one' from sf_cos.c
Keith Packard [Mon, 27 Aug 2018 18:32:29 +0000 (11:32 -0700)]
Remove unused variable 'one' from sf_cos.c

Defined, never mentioned.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoUse nanf("") instead of nanf(NULL)
Keith Packard [Mon, 27 Aug 2018 18:32:28 +0000 (11:32 -0700)]
Use nanf("") instead of nanf(NULL)

Newer GCC versions require a non-NULL argument to this function for
some reason.

Signed-off-by: Keith Packard <keithp@keithp.com>
5 years agoRISC-V: Fix _sbrk, it's failed only when return value is -1.
Denis Ivanov [Fri, 6 Jul 2018 16:03:23 +0000 (19:03 +0300)]
RISC-V: Fix _sbrk, it's failed only when return value is -1.

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
5 years agoRISC-V: Fixed return code in _times syscall.
Denis Ivanov [Fri, 6 Jul 2018 09:03:15 +0000 (12:03 +0300)]
RISC-V: Fixed return code in _times syscall.

Upon successful completion, times() shall return the elapsed real time,
in clock ticks, since an arbitrary point in the past (for example,
system start-up time).

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
5 years agoCygwin: Accommodate logon sessions on Windows 10
Corinna Vinschen [Tue, 28 Aug 2018 09:26:52 +0000 (11:26 +0200)]
Cygwin: Accommodate logon sessions on Windows 10

Starting with Windows 10, LookupAccountSid/Name return valid
info for the login session with new SID_NAME_USE value
SidTypeLogonSession.  To return the same info as on pre-Windows 10,
we have to handle this type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: drop workaround for missing USER_INFO_24 definition
Corinna Vinschen [Tue, 28 Aug 2018 09:24:59 +0000 (11:24 +0200)]
Cygwin: drop workaround for missing USER_INFO_24 definition

Recent mingw64 provide USER_INFO_24

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: add release note for previous ACL changes
Corinna Vinschen [Mon, 27 Aug 2018 16:30:59 +0000 (18:30 +0200)]
Cygwin: add release note for previous ACL changes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Add name->SID conversion for self-constructed names
Corinna Vinschen [Mon, 27 Aug 2018 16:28:33 +0000 (18:28 +0200)]
Cygwin: Add name->SID conversion for self-constructed names

...as far as it makes sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: don't return valid acl entry type for unknown SID
Corinna Vinschen [Mon, 27 Aug 2018 11:30:55 +0000 (13:30 +0200)]
Cygwin: don't return valid acl entry type for unknown SID

cygpsid::get_id neglects to set the type to 0 (ACL_UNDEFINED_TAG
in POSIX speak) if the SID can not be translated into a valid
uid or gid.  This in turn leads to incorrect handling of uid/gid -1
entries.

Fix this by setting type to 0 if the id is unknown.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: Remove union wait
Corinna Vinschen [Fri, 24 Aug 2018 18:57:47 +0000 (20:57 +0200)]
Cygwin: Remove union wait

This patch follows glibc.  Original commit message:

Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu, 14 Apr 2016 06:54:57 +0000

Remove union wait [BZ #19613]

The overloading approach in the W* macros was incompatible with
integer expressions of a type different from int.  Applications
using union wait and these macros will have to migrate to the
POSIX-specified int status type.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoRTEMS: Add kvaddr_t and ksize_t
Sebastian Huber [Thu, 23 Aug 2018 09:50:46 +0000 (11:50 +0200)]
RTEMS: Add kvaddr_t and ksize_t

These types were introduced by FreeBSD commit:

"Make struct xinpcb and friends word-size independent.

Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR: 228301 (exp-run by antoine)
Reviewed by: jtl, kib, rwatson (various versions)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15386"

In RTEMS, there is no user/kernel space separation.  So, use the types
size_t and uintptr_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_mman.h>
Sebastian Huber [Fri, 10 Aug 2018 05:45:23 +0000 (07:45 +0200)]
RTEMS: Introduce <machine/_kernel_mman.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_socket.h>
Sebastian Huber [Thu, 9 Aug 2018 05:04:00 +0000 (07:04 +0200)]
RTEMS: Introduce <machine/_kernel_socket.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_if.h>
Sebastian Huber [Wed, 8 Aug 2018 10:06:48 +0000 (12:06 +0200)]
RTEMS: Introduce <machine/_kernel_if.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_in.h>
Sebastian Huber [Wed, 8 Aug 2018 09:56:27 +0000 (11:56 +0200)]
RTEMS: Introduce <machine/_kernel_in.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_in6.h>
Sebastian Huber [Wed, 8 Aug 2018 09:51:11 +0000 (11:51 +0200)]
RTEMS: Introduce <machine/_kernel_in6.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Introduce <machine/_kernel_uio.h>
Sebastian Huber [Tue, 7 Aug 2018 13:35:37 +0000 (15:35 +0200)]
RTEMS: Introduce <machine/_kernel_uio.h>

This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Add __BSD_VISIBLE in <sys/_termios.h>
Sebastian Huber [Wed, 8 Aug 2018 09:04:10 +0000 (11:04 +0200)]
RTEMS: Add __BSD_VISIBLE in <sys/_termios.h>

The __XSI_VISIBLE is not enabled by default in Newlib.  This is an
incompatiblity between FreeBSD and glibc.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoRTEMS: Update FreeBSD version tags
Sebastian Huber [Wed, 8 Aug 2018 09:34:34 +0000 (11:34 +0200)]
RTEMS: Update FreeBSD version tags

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoAdd SOL_SOCKET level socket option
tuexen [Tue, 21 Aug 2018 14:04:30 +0000 (14:04 +0000)]
Add SOL_SOCKET level socket option

with name SO_DOMAIN to get the domain of a socket.

This is helpful when testing and Solaris and Linux have the same
socket option using the same name.

Reviewed by: bcr@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16791

5 years agoImplement a limit on on the number of IPv6 reassembly
jtl [Tue, 14 Aug 2018 17:27:41 +0000 (17:27 +0000)]
Implement a limit on on the number of IPv6 reassembly

queues per bucket.

There is a hashing algorithm which should distribute IPv6 reassembly
queues across the available buckets in a relatively even way. However,
if there is a flaw in the hashing algorithm which allows a large number
of IPv6 fragment reassembly queues to end up in a single bucket, a per-
bucket limit could help mitigate the performance impact of this flaw.

Implement such a limit, with a default of twice the maximum number of
reassembly queues divided by the number of buckets. Recalculate the
limit any time the maximum number of reassembly queues changes.
However, allow the user to override the value using a sysctl
(net.inet6.ip6.maxfragbucketsize).

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoAdd a limit of the number of fragments per IPv6 packet.
jtl [Tue, 14 Aug 2018 17:26:07 +0000 (17:26 +0000)]
Add a limit of the number of fragments per IPv6 packet.

The IPv4 fragment reassembly code supports a limit on the number of
fragments per packet. The default limit is currently 17 fragments.
Among other things, this limit serves to limit the number of fragments
the code must parse when trying to reassembly a packet.

Add a limit to the IPv6 reassembly code. By default, limit a packet
to 65 fragments (64 on the queue, plus one final fragment to complete
the packet). This allows an average fragment size of 1,008 bytes, which
should be sufficient to hold a fragment. (Recall that the IPv6 minimum
MTU is 1280 bytes. Therefore, this configuration allows a full-size
IPv6 packet to be fragmented on a link with the minimum MTU and still
carry approximately 272 bytes of headers before the fragmented portion
of the packet.)

Users can adjust this limit using the net.inet6.ip6.maxfragsperpacket
sysctl.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoThis commit brings in a new refactored TCP stack called Rack.
rrs [Thu, 7 Jun 2018 18:18:13 +0000 (18:18 +0000)]
This commit brings in a new refactored TCP stack called Rack.

Rack includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead time
is used to knwo when to retransmit. (see the I-D) - TLP (Tail Loss
Probe) where we will probe for tail-losses to attempt to try not to take
a retransmit time-out. (see the I-D) - Burst mitigation using TCPHTPS -
PRR (partial rate reduction) see the RFC.

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base  FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
   makeoptions WITH_EXTRA_TCP_STACKS=1
   options TCPHPTS

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15525

5 years agoLoad balance sockets with new SO_REUSEPORT_LB option.
sbruno [Wed, 6 Jun 2018 15:45:57 +0000 (15:45 +0000)]
Load balance sockets with new SO_REUSEPORT_LB option.

This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures:
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations:
As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or
threads sharing the same socket).

This is a substantially different contribution as compared to its original
incarnation at svn r332894 and reverted at svn r332967.  Thanks to rwatson@
for the substantive feedback that is included in this commit.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Obtained from: DragonflyBSD
Relnotes: Yes
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003

5 years agoiflib(9): Add support for cloning pseudo interfaces
mmacy [Fri, 11 May 2018 20:08:28 +0000 (20:08 +0000)]
iflib(9): Add support for cloning pseudo interfaces

Part 3 of many ...
The VPC framework relies heavily on cloning pseudo interfaces
(vmnics, vpc switch, vcpswitch port, hostif, vxlan if, etc).

This pulls in that piece. Some ancillary changes get pulled
in as a side effect.

Reviewed by: shurd@
Approved by: sbruno@
Sponsored by: Joyent, Inc.
Differential Revision: https://reviews.freebsd.org/D15347

5 years agoRevert r332894 at the request of the submitter.
sbruno [Tue, 24 Apr 2018 19:55:12 +0000 (19:55 +0000)]
Revert r332894 at the request of the submitter.

Submitted by: Johannes Lundberg <johalun0_gmail.com>
Sponsored by: Limelight Networks

5 years agoLoad balance sockets with new SO_REUSEPORT_LB option
sbruno [Mon, 23 Apr 2018 19:51:00 +0000 (19:51 +0000)]
Load balance sockets with new SO_REUSEPORT_LB option

This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations
As DragonflyBSD, a load balance group is limited to 256 pcbs
(256 programs or threads sharing the same socket).

Submitted by: Johannes Lundberg <johanlun0@gmail.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003

5 years agoAdd 32-bit compat for ioctls that take struct ifgroupreq.
brooks [Thu, 5 Apr 2018 22:14:55 +0000 (22:14 +0000)]
Add 32-bit compat for ioctls that take struct ifgroupreq.

Use an accessor to access ifgr_group and ifgr_groups.

Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such
as "case SIOCAIFGROUP:". This avoids poluting the switch statements
with large numbers of #ifdefs.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14960

5 years agoUse an accessor function to access ifr_data.
brooks [Fri, 30 Mar 2018 18:50:13 +0000 (18:50 +0000)]
Use an accessor function to access ifr_data.

This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).  This is believed to be sufficent to
fully support ifconfig on 32-bit systems.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14900

5 years agoImplement several enhancements to NUMA policies.
jeff [Thu, 29 Mar 2018 02:54:50 +0000 (02:54 +0000)]
Implement several enhancements to NUMA policies.

Add a new "interleave" allocation policy which stripes pages across
domains with a stride or width keeping contiguity within a multi-page
region.

Move the kernel to the dedicated numbered cpuset #2 making it possible
to assign kernel threads and memory policy separately from user.  This
also eliminates the need for the complicated interrupt binding code.

Add a sysctl API for viewing and manipulating domainsets.  Refactor some
of the cpuset_t manipulation code using the generic bitset type so that
it can be used for both.  This probably belongs in a dedicated subr file.

Attempt to improve the include situation.

Reviewed by: kib
Discussed with: jhb (cpuset parts)
Tested by: pho (before review feedback)
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14839

5 years agoFix access to ifru_buffer on freebsd32.
brooks [Tue, 27 Mar 2018 18:26:50 +0000 (18:26 +0000)]
Fix access to ifru_buffer on freebsd32.

Make all kernel accesses to ifru_buffer go via access functions
which take the process ABI into account and use an appropriate union
to access members in the correct place in struct ifreq.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14846

5 years agoAllow to specify PCP on packets not belonging to any VLAN.
kib [Tue, 27 Mar 2018 15:29:32 +0000 (15:29 +0000)]
Allow to specify PCP on packets not belonging to any VLAN.

According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be
considered as untagged, and only PCP and DEI values from the VLAN tag
are meaningful.  See for instance
https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html.

Make it possible to specify PCP value for outgoing packets on an
ethernet interface.  When PCP is supplied, the tag is appended, VLAN
id set to 0, and PCP is filled by the supplied value.  The code to do
VLAN tag encapsulation is refactored from the if_vlan.c and moved into
if_ethersubr.c.

Drivers might have issues with filtering VID 0 packets on
receive.  This bug should be fixed for each driver.

Reviewed by: ae (previous version), hselasky, melifaro
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D14702

5 years agoMove uio enums to sys/_uio.h.
brooks [Tue, 27 Mar 2018 15:20:03 +0000 (15:20 +0000)]
Move uio enums to sys/_uio.h.

Include _uio.h instead of uio.h in several headers to reduce header
polution.

Fix a few places that relied on header polution to get the uio.h header.

I have not moved struct uio as many more things that use it rely on
header polution to get other definitions from uio.h.

Reviewed by: cem, kib, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14811

5 years agoAdd the "TCP Blackbox Recorder"
jtl [Thu, 22 Mar 2018 09:40:08 +0000 (09:40 +0000)]
Add the "TCP Blackbox Recorder"

which we discussed at the developer summits at BSDCan and BSDCam in 2017.

The TCP Blackbox Recorder allows you to capture events on a TCP connection
in a ring buffer. It stores metadata with the event. It optionally stores
the TCP header associated with an event (if the event is associated with a
packet) and also optionally stores information on the sockets.

It supports setting a log ID on a TCP connection and using this to correlate
multiple connections that share a common log ID.

You can log connections in different modes. If you are doing a coordinated
test with a particular connection, you may tell the system to put it in
mode 4 (continuous dump). Or, if you just want to monitor for errors, you
can put it in mode 1 (ring buffer) and dump all the ring buffers associated
with the connection ID when we receive an error signal for that connection
ID. You can set a default mode that will be applied to a particular ratio
of incoming connections. You can also manually set a mode using a socket
option.

This commit includes only basic probes. rrs@ has added quite an abundance
of probes in his TCP development work. He plans to commit those soon.

There are user-space programs which we plan to commit as ports. These read
the data from the log device and output pcapng files, and then let you
analyze the data (and metadata) in the pcapng files.

Reviewed by: gnn (previous version)
Obtained from: Netflix, Inc.
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D11085

5 years agoAdd _IOC_NEWLEN() and _IOC_NEWTYPE() macros.
brooks [Fri, 16 Mar 2018 22:23:04 +0000 (22:23 +0000)]
Add _IOC_NEWLEN() and _IOC_NEWTYPE() macros.

These macros take an existing ioctl(2) command and replace the length
with the specified length or length of the specified type respectively.
These can be used to define commands for 32-bit compatibility with fewer
opportunities for cut-and-paste errors then a whole new definition.

Reviewed by: cem, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14706

5 years agoThis is an implementation of the client side of TCP Fast Open (TFO)
pkelsey [Mon, 26 Feb 2018 02:53:22 +0000 (02:53 +0000)]
This is an implementation of the client side of TCP Fast Open (TFO)

[RFC7413]. It also includes a pre-shared key mode of operation in which
the server requires the client to be in possession of a shared secret in
order to successfully open TFO connections with that server.

The names of some existing fastopen sysctls have changed (e.g.,
net.inet.tcp.fastopen.enabled -> net.inet.tcp.fastopen.server_enable).

Reviewed by: tuexen
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14047

5 years agoFollow the RFC6980 and silently ignore following IPv6 NDP messages
ae@FreeBSD.org [Fri, 15 Dec 2017 12:37:32 +0000 (12:37 +0000)]
Follow the RFC6980 and silently ignore following IPv6 NDP messages

that had the IPv6 fragmentation header:
o Neighbor Solicitation
o Neighbor Advertisement
o Router Solicitation
o Router Advertisement
o Redirect

Introduce M_FRAGMENTED mbuf flag, and set it after IPv6 fragment reassembly
is completed. Then check the presence of this flag in correspondig ND6
handling routines.

PR: 224247
MFC after: 2 weeks

5 years agoSPDX: license IDs for some ISC-related files.
pfg [Fri, 8 Dec 2017 15:57:29 +0000 (15:57 +0000)]
SPDX: license IDs for some ISC-related files.

5 years agoGarbage collect IFCAP_POLLING_NOCOUNT.
glebius [Wed, 6 Dec 2017 23:03:34 +0000 (23:03 +0000)]
Garbage collect IFCAP_POLLING_NOCOUNT.

It wasn't used since very beginning of polling(4). The module always
ignored return value from driver polling handler.

5 years agosys/sys: further adoption of SPDX licensing ID tags.
pfg [Mon, 27 Nov 2017 15:01:59 +0000 (15:01 +0000)]
sys/sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

5 years agoinclude: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:45:28 +0000 (19:45 +0000)]
include: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

5 years agosys: further adoption of SPDX licensing ID tags.
pfg [Mon, 20 Nov 2017 19:43:44 +0000 (19:43 +0000)]
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

5 years agoUse hardware timestamps to report packet timestamps
kib [Tue, 7 Nov 2017 09:46:26 +0000 (09:46 +0000)]
Use hardware timestamps to report packet timestamps

for SO_TIMESTAMP and other similar socket options.

Provide new control message SCM_TIME_INFO to supply information about
timestamp.  Currently it indicates that the timestamp was
hardware-assisted and high-precision, for software timestamps the
message is not returned.  Reserved fields are added to ABI to report
additional info about it, it is expected that raw hardware clock value
might be useful for some applications.

Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12638

5 years agoAdd a place for a driver to report rx timestamps
kib [Tue, 7 Nov 2017 09:29:14 +0000 (09:29 +0000)]
Add a place for a driver to report rx timestamps

in nanoseconds from boot for the received packets.

The rcv_tstmp field overlaps the place of Ln header length indicators,
not used by received packets.  The basic pkthdr rearrangement change
in sys/mbuf.h was provided by gallatin.

There are two accompanying M_ flags: M_TSTMP means that there is the
timestamp (and it was generated by hardware).

Another flag M_TSTMP_HPREC indicates that the timestamp is
high-precision.  Practically M_TSTMP_HPREC means that hardware
provided additional precision comparing with the stamps when the flag
is not set.  E.g., for ConnectX all packets are stamped by hardware
when PCIe transaction to write out the completion descriptor is
performed, but PTP packet are stamped on port.  For Intel cards, when
PTP assist is enabled, only PTP packets are stamped in the limited
number of registers, so if Intel cards ever start support this
mechanism, they would always set M_TSTMP | M_TSTMP_HPREC if hardware
timestamp is present for the given packet.

Add IFCAP_HWRXTSTMP interface capability to indicate the support for
hardware rx timestamping, and ifconfig(8) command to toggle it.

Based on the patch by: gallatin
Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks (? mbuf KBI issue)
X-Differential revision: https://reviews.freebsd.org/D12638

5 years agoif: Add ioctls to get RSS key and hash type/function.
sephe [Tue, 5 Sep 2017 05:28:52 +0000 (05:28 +0000)]
if: Add ioctls to get RSS key and hash type/function.

It will be needed by hn(4) to configure its RSS key and hash
type/function in the transparent VF mode in order to match VF's
RSS settings. The description of the transparent VF mode and
the RSS hash value issue are here:
https://svnweb.freebsd.org/base?view=revision&revision=322299
https://svnweb.freebsd.org/base?view=revision&revision=322485

These are generic enough to promise two independent IOCs instead
of abusing SIOCGDRVSPEC.

Setting RSS key and hash type/function is a different story,
which probably requires more discussion.

Comment about UDP_{IPV4,IPV6,IPV6_EX} were only in the patch
in the review request; these hash types are standardized now.

Reviewed by: gallatin
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12174

5 years agoCorrect sysctl names.
des [Wed, 9 Aug 2017 07:24:58 +0000 (07:24 +0000)]
Correct sysctl names.

5 years agoRelax visibility for some termios symbols.
kib [Fri, 4 Aug 2017 09:45:40 +0000 (09:45 +0000)]
Relax visibility for some termios symbols.

They are defined by XSI or newer SUS.
This is a follow-up to r318780.

Reported by: jbeich
Obtained from: DragonflyBSD commit e08b3836c962
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoImplement address space guards.
kib [Sat, 24 Jun 2017 17:01:11 +0000 (17:01 +0000)]
Implement address space guards.

Guard, requested by the MAP_GUARD mmap(2) flag, prevents the reuse of
the allocated address space, but does not allow instantiation of the
pages in the range.  It is useful for more explicit support for usual
two-stage reserve then commit allocators, since it prevents accidental
instantiation of the mapping, e.g. by mprotect(2).

Use guards to reimplement stack grow code.  Explicitely track stack
grow area with the guard, including the stack guard page.  On stack
grow, trivial shift of the guard map entry and stack map entry limits
makes the stack expansion.  Move the code to detect stack grow and
call vm_map_growstack(), from vm_fault() into vm_map_lookup().

As result, it is impossible to get random mapping to occur in the
stack grow area, or to overlap the stack guard page.

Enable stack guard page by default.

Reviewed by: alc, markj
Man page update reviewed by: alc, bjk, emaste, markj, pho
Tested by: pho, Qualys
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11306 (man pages)

5 years agoListening sockets improvements.
glebius [Thu, 8 Jun 2017 21:30:34 +0000 (21:30 +0000)]
Listening sockets improvements.

o Separate fields of struct socket that belong to listening from
  fields that belong to normal dataflow, and unionize them.  This
  shrinks the structure a bit.
  - Take out selinfo's from the socket buffers into the socket. The
    first reason is to support braindamaged scenario when a socket is
    added to kevent(2) and then listen(2) is cast on it. The second
    reason is that there is future plan to make socket buffers pluggable,
    so that for a dataflow socket a socket buffer can be changed, and
    in this case we also want to keep same selinfos through the lifetime
    of a socket.
  - Remove struct struct so_accf. Since now listening stuff no longer
    affects struct socket size, just move its fields into listening part
    of the union.
  - Provide sol_upcall field and enforce that so_upcall_set() may be called
    only on a dataflow socket, which has buffers, and for listening sockets
    provide solisten_upcall_set().

o Remove ACCEPT_LOCK() global.
  - Add a mutex to socket, to be used instead of socket buffer lock to lock
    fields of struct socket that don't belong to a socket buffer.
  - Allow to acquire two socket locks, but the first one must belong to a
    listening socket.
  - Make soref()/sorele() to use atomic(9).  This allows in some situations
    to do soref() without owning socket lock.  There is place for improvement
    here, it is possible to make sorele() also to lock optionally.
  - Most protocols aren't touched by this change, except UNIX local sockets.
    See below for more information.

o Reduce copy-and-paste in kernel modules that accept connections from
  listening sockets: provide function solisten_dequeue(), and use it in
  the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4),
  infiniband, rpc.

o UNIX local sockets.
  - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX
    local sockets.  Most races exist around spawning a new socket, when we
    are connecting to a local listening socket.  To cover them, we need to
    hold locks on both PCBs when spawning a third one.  This means holding
    them across sonewconn().  This creates a LOR between pcb locks and
    unp_list_lock.
  - To fix the new LOR, abandon the global unp_list_lock in favor of global
    unp_link_lock.  Indeed, separating these two locks didn't provide us any
    extra parralelism in the UNIX sockets.
  - Now call into uipc_attach() may happen with unp_link_lock hold if, we
    are accepting, or without unp_link_lock in case if we are just creating
    a socket.
  - Another problem in UNIX sockets is that uipc_close() basicly did nothing
    for a listening socket.  The vnode remained opened for connections.  This
    is fixed by removing vnode in uipc_close().  Maybe the right way would be
    to do it for all sockets (not only listening), simply move the vnode
    teardown from uipc_detach() to uipc_close()?

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9770

5 years agoImplement INHERIT_ZERO for minherit(2).
delphij [Tue, 14 Mar 2017 17:10:42 +0000 (17:10 +0000)]
Implement INHERIT_ZERO for minherit(2).

INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR: 182610
Reviewed by: kib (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D427

5 years agoRenumber copyright clause 4
imp [Tue, 28 Feb 2017 23:42:47 +0000 (23:42 +0000)]
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96

5 years agomprotect(): Change prototype to comply to POSIX.
ed@FreeBSD.org [Wed, 3 Aug 2016 06:33:04 +0000 (06:33 +0000)]
mprotect(): Change prototype to comply to POSIX.

Our mprotect() function seems to take a "const void *" address to the
pages whose permissions need to be adjusted. POSIX uses "void *". Simply
stick to the POSIX one to prevent us from writing unportable code.

PR: 211423 (exp-run)
Tested by: antoine@ (Thanks!)

5 years agoImplement process-shared locks support
kib [Sun, 28 Feb 2016 17:52:33 +0000 (17:52 +0000)]
Implement process-shared locks support

for libthr.so.3, without breaking the ABI. Special value is stored in
the lock pointer to indicate shared lock, and offline page in the shared
memory is allocated to store the actual lock.

Reviewed by: vangyzen (previous version)
Discussed with: deischen, emaste, jhb, rwatson,
Martin Simmons <martin@lispworks.com>
Tested by: pho
Sponsored by: The FreeBSD Foundation

5 years agoAdd a new file operations hook for mmap
jhb [Thu, 4 Jun 2015 19:41:15 +0000 (19:41 +0000)]
Add a new file operations hook for mmap

operations. File type-specific logic is now placed in the mmap hook
implementation rather than requiring it to be placed in
sys/vm/vm_mmap.c. This hook allows new file types to support mmap() as
well as potentially allowing mmap() for existing file types that do not
currently support any mapping.

The vm_mmap() function is now split up into two functions.  A new
vm_mmap_object() function handles the "back half" of vm_mmap() and accepts
a referenced VM object to map rather than a (handle, handle_type) tuple.
vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a
a VM object and then calling vm_mmap_object() to handle the actual mapping.
The vm_mmap() function remains for use by other parts of the kernel
(e.g. device drivers and exec) but now only supports mapping vnodes,
character devices, and anonymous memory.

The mmap() system call invokes vm_mmap_object() directly with a NULL object
for anonymous mappings.  For mappings using a file descriptor, the
descriptors fo_mmap() hook is invoked instead.  The fo_mmap() hook is
responsible for performing type-specific checks and adjustments to
arguments as well as possibly modifying mapping parameters such as flags
or the object offset.  The fo_mmap() hook routines then call
vm_mmap_object() to handle the actual mapping.

The fo_mmap() hook is optional.  If it is not set, then fo_mmap() will
fail with ENODEV.  A fo_mmap() hook is implemented for regular files,
character devices, and shared memory objects (created via shm_open()).

While here, consistently use the VM_PROT_* constants for the vm_prot_t
type for the 'prot' variable passed to vm_mmap() and vm_mmap_object()
as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines.
Previously some places were using the mmap()-specific PROT_* constants
instead.  While this happens to work because PROT_xx == VM_PROT_xx,
using VM_PROT_* is more correct.

Differential Revision: https://reviews.freebsd.org/D2658
Reviewed by: alc (glanced over), kib
MFC after: 1 month
Sponsored by: Chelsio

5 years agoRetire the unimplemented MAP_RENAME
jhb [Sat, 18 Oct 2014 12:28:51 +0000 (12:28 +0000)]
Retire the unimplemented MAP_RENAME

and MAP_NORESERVE flags to mmap(2). Older binaries are still permitted
to use these flags.

PR: 193961 (exp-run in ports)
Differential Revision: https://reviews.freebsd.org/D848
Reviewed by: kib

5 years agoAdd a new fo_fill_kinfo fileops method
jhb [Mon, 22 Sep 2014 16:20:47 +0000 (16:20 +0000)]
Add a new fo_fill_kinfo fileops method

to add type-specific information to struct kinfo_file. - Move the
various fill_*_info() methods out of kern_descrip.c and into the various
file type implementations. - Rework the support for kinfo_ofile to
generate a suitable kinfo_file object for each file and then convert
that to a kinfo_ofile structure rather than keeping a second, different
set of code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.

Differential Revision: https://reviews.freebsd.org/D775
Reviewed by: kib, glebius (earlier version)

5 years agoAdd MAP_EXCL flag for mmap(2).
kib [Thu, 19 Jun 2014 05:00:39 +0000 (05:00 +0000)]
Add MAP_EXCL flag for mmap(2).

It should be combined with MAP_FIXED, and prevents the request from
deleting existing mappings in the region, failing instead.

Reviewed by: alc
Discussed with: jhb
Tested by: markj, pho (previous version, as part of the bigger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoAdd a mmap flag (MAP_32BIT) on 64-bit platforms
jhb [Mon, 9 Sep 2013 18:11:59 +0000 (18:11 +0000)]
Add a mmap flag (MAP_32BIT) on 64-bit platforms

to request that a mapping use an address in the first 2GB of the
process's address space. This flag should have the same semantics as the
same flag on Linux.

To facilitate this, add a new parameter to vm_map_find() that specifies an
optional maximum virtual address.  While here, fix several callers of
vm_map_find() to use a VMFS_* constant for the findspace argument instead of
TRUE and FALSE.

Reviewed by: alc
Approved by: re (kib)

5 years agoImplement read(2)/write(2) and neccessary lseek(2)
kib [Wed, 21 Aug 2013 17:45:00 +0000 (17:45 +0000)]
Implement read(2)/write(2) and neccessary lseek(2)

for posix shmfd. Add MAC framework entries for posix shm read and write.

Do not allow implicit extension of the underlying memory segment past
the limit set by ftruncate(2) by either of the syscalls.  Read and
write returns short i/o, lseek(2) fails with EINVAL when resulting
offset does not fit into the limit.

Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation

5 years agoAdd __nl_item to <sys/_types.h> and use it
Sebastian Huber [Thu, 23 Aug 2018 10:13:02 +0000 (12:13 +0200)]
Add __nl_item to <sys/_types.h> and use it

Add __nl_item to <sys/_types.h> for FreeBSD compatibility.  Use it in
<langinfo.h> and the Cygwin <nl_types.h>.  Make the enum __nl_item in
<langinfo.h> anonymous.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
5 years agoCYgwin: fix typo in comment
Corinna Vinschen [Fri, 24 Aug 2018 11:36:06 +0000 (13:36 +0200)]
CYgwin: fix typo in comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoRTEMS: Add __tls_get_addr() to crt0
Sebastian Huber [Mon, 20 Aug 2018 11:20:06 +0000 (13:20 +0200)]
RTEMS: Add __tls_get_addr() to crt0

Add __tls_get_addr() for all targets to crt0.  This is not only used on
ARM.  In particular, it is used on RISC-V.  This helps to adequately
support the GCC libgomp.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de
5 years agoCygwin: get_mem_values: Fix prototype
Corinna Vinschen [Fri, 17 Aug 2018 18:40:18 +0000 (20:40 +0200)]
Cygwin: get_mem_values: Fix prototype

Incomplete change unsigned long -> size_t was only visible on 32 bit, sigh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: document /proc/<PID>/status and /proc/<PID>/statm patches
Corinna Vinschen [Fri, 17 Aug 2018 17:21:51 +0000 (19:21 +0200)]
Cygwin: document /proc/<PID>/status and /proc/<PID>/statm patches

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: get_mem_values: Return number of Cygwin pages in arguments
Corinna Vinschen [Fri, 17 Aug 2018 18:31:24 +0000 (20:31 +0200)]
Cygwin: get_mem_values: Return number of Cygwin pages in arguments

Simplify callers accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: get_mem_values: Convert arguments to call-by-reference
Corinna Vinschen [Fri, 17 Aug 2018 18:30:32 +0000 (20:30 +0200)]
Cygwin: get_mem_values: Convert arguments to call-by-reference

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoCygwin: get_mem_values: Return allocation as size_t values
Corinna Vinschen [Fri, 17 Aug 2018 17:30:28 +0000 (19:30 +0200)]
Cygwin: get_mem_values: Return allocation as size_t values

Use size_t in callers, too.  Fix __small_sprintf format specifiers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agoRevert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well...
Corinna Vinschen [Fri, 17 Aug 2018 17:16:42 +0000 (19:16 +0200)]
Revert "Use allocation granularity as the 'page_size' in /proc/<pid>/status as well, for consistency with /proc/<pid>/statm"

This reverts commit 8a32c24a7bdb0f3d80daa8f267cc63d15edcf771.

Replacing page_size() with allocation_granularity() was incorrect.
The values returned by get_mem_values() are # of pages of size
page_size().  Multiplying with allocation_granularity() here
results in values 16 times too big.

5 years agoCygwin: Add missing items to release notes
Corinna Vinschen [Fri, 17 Aug 2018 09:49:21 +0000 (11:49 +0200)]
Cygwin: Add missing items to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
5 years agosetfacl: Rename the option --file to --set-file, as on Linux
Ken Brown [Thu, 16 Aug 2018 18:55:28 +0000 (14:55 -0400)]
setfacl: Rename the option --file to --set-file, as on Linux

Retain --file as an undocumented option for backwards compatibility.

5 years agoFix strtof ("-nan") returns positive NaN
Masamichi Hosoda [Tue, 14 Aug 2018 23:39:22 +0000 (08:39 +0900)]
Fix strtof ("-nan") returns positive NaN

strtof ("-nan") returned positive NaN instead of negative NaN.
strtod ("-nan") and strtold ("-nan") return negative NaN.

Linux glibc has been fixed
that strto{f|d|ld} ("-nan") returns negative NaN.
https://sourceware.org/bugzilla/show_bug.cgi?id=23007

This commit makes strtof preserves the negative sign bit
when parsing "-nan" like glibc.

5 years agoRemove unused NaN's integer representation definitions
Masamichi Hosoda [Thu, 16 Aug 2018 00:46:43 +0000 (09:46 +0900)]
Remove unused NaN's integer representation definitions

By previous commit, strto{d|ld} ("nan")
does not use the definition of NaN.
There is no other function that uses the definitions.

This commit remove the definitions.

5 years agoFix strtod ("nan") and strtold ("nan") returns wrong negative NaN
Masamichi Hosoda [Thu, 16 Aug 2018 00:18:50 +0000 (09:18 +0900)]
Fix strtod ("nan") and strtold ("nan") returns wrong negative NaN

The definition of qNaN for x86_64 and i386 was wrong.
strto{d|ld} ("nan") returned wrong negative NaN
instead of correct positive NaN
since it used the wrong definition.

On the other hand, strtof ("nan") returns correct positive NaN
since it uses nanf ("") instead of the wrong definition.

This commit makes strto{d|ld} ("nan") uses {nan|nanl} ("")
like strtof ("nan") using.
So strto{d|ld} ("nan") returns positive NaN.

5 years agoImprove sincosf comments
Wilco Dijkstra [Thu, 16 Aug 2018 10:39:35 +0000 (10:39 +0000)]
Improve sincosf comments

Improve comments in sincosf implementation to make the code easier
to understand.  Rename the constant pi64 to pi63 since it's actually
PI * 2^-63.  Add comments for fields of sincos_t structure.  Add comments
describing implementation details to reduce_fast.

5 years agoCygwin: Add FE_ALL_EXCEPT change to release notes.
Corinna Vinschen [Wed, 15 Aug 2018 16:01:27 +0000 (18:01 +0200)]
Cygwin: Add FE_ALL_EXCEPT change to release notes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.073156 seconds and 5 git commands to generate.