Commit Graph

201099 Commits

Author SHA1 Message Date
dchagin
b9febf10b6 MFC r283389:
Add a siginfo_t conversion function.
2016-01-09 15:21:45 +00:00
dchagin
06c014ef0f MFC r283388:
Remove a now unused define.
2016-01-09 15:20:48 +00:00
dchagin
a014fbe805 MFC r283386:
Introduce LINUX_VERSION_STR, LINUX_VERSION_CODE macro for use instead
of harcoded pr_osrelease, pr_osrel values. This will be used later in
the VDSO.
2016-01-09 15:19:43 +00:00
dchagin
2646cf70a0 MFC r283385:
Some style(9) && whitespaces fixes. No functional changes.
2016-01-09 15:18:36 +00:00
dchagin
ef31cbb1cc MFC r283384:
pthread_join() caller do futex_wait on child_clear_tid. As a results
of multiple simultaneous calls to pthread_join() specifying the same
target thread are undefined wake up the one thread.
2016-01-09 15:17:34 +00:00
dchagin
cb3b38d164 MFC r283383:
Switch linuxulator to use the native 1:1 threads.

The reasons:
1. Get rid of the stubs/quirks with process dethreading,
   process reparent when the process group leader exits and close
   to this problems on wait(), waitpid(), etc.
2. Reuse our kernel code instead of writing excessive thread
   managment routines in Linuxulator.

Implementation details:

1. The thread is created via kern_thr_new() in the clone() call with
   the CLONE_THREAD parameter. Thus, everything else is a process.
2. The test that the process has a threads is done via P_HADTHREADS
   bit p_flag of struct proc.
3. Per thread emulator state data structure is now located in the
   struct thread and freed in the thread_dtor() hook.
   Mandatory holdig of the p_mtx required when referencing emuldata
   from the other threads.
4. PID mangling has changed. Now Linux pid is the native tid
   and Linux tgid is the native pid, with the exception of the first
   thread in the process where tid and pid are one and the same.

Ugliness:

   In case when the Linux thread is the initial thread in the thread
   group thread id is equal to the process id. Glibc depends on this
   magic (assert in pthread_getattr_np.c). So for system calls that
   take thread id as a parameter we should use the special method
   to reference struct thread.
2016-01-09 15:16:13 +00:00
dchagin
ccb67dae7f To facillitate Linuxulator merging temporarilly revert r288994 (by bdrewery). 2016-01-09 15:12:31 +00:00
dchagin
2b83b41438 MFC r283382:
In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die.
2016-01-09 14:53:08 +00:00
dchagin
0a5c3d637a MFC r283381:
In preparation for switching linuxulator to the use the native 1:1
threads add per thread emulator state data.
2016-01-09 14:51:50 +00:00
dchagin
c12aa632f3 Regen fro r293487. 2016-01-09 14:48:23 +00:00
dchagin
31e61f6749 MFC r283379:
Implement a Linux version of sched_getparam() && sched_setparam().
Temporarily use the first thread in proc.
2016-01-09 14:47:08 +00:00
dchagin
65d490113d MFC r283378:
Remove a now unused include.
2016-01-09 14:45:41 +00:00
dchagin
0553d7262b MFC r283377:
In preparation for switching linuxulator to the use the native 1:1
threads split sys_sched_getparam(), sys_sched_setparam(),
sys_sched_getscheduler(), sys_sched_setscheduler() to their kern_*
counterparts and add targettd parameter to allow specify the target
thread directly by callee.
2016-01-09 14:44:41 +00:00
dchagin
f8883c94b2 Regen for r293483. 2016-01-09 14:43:16 +00:00
dchagin
921615e079 MFC r283375:
In preparation for switching linuxulator to the use the native 1:1
threads use MI linux_sched_rr_get_interval() in i386.
2016-01-09 14:41:58 +00:00
dchagin
fd9d33be2a MFC r283374:
In preparation for switching linuxulator to the use the native 1:1
threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval().
Add a kern_sched_rr_get_interval() counterpart which takes a targettd
parameter to allow specify target thread directly by callee (new Linuxulator).

Linuxulator temporarily uses first thread in proc.

Move linux_sched_rr_get_interval() to the MI part.
2016-01-09 14:40:38 +00:00
dchagin
a07a85c065 MFC r283373:
In preparation for switching linuxulator to the use the native 1:1
threads introduce kern_thr_alloc() which will be used later in the
linux_clone().
2016-01-09 14:38:29 +00:00
dchagin
b18ea4d2a0 MFC r283372:
In preparation for switching linuxulator to the use the native 1:1
threads split sys_thr_exit() up into sys_thr_exit() and kern_thr_exit().
Move
Where the second will be used in linux_exit() system call later.
2016-01-09 14:36:44 +00:00
dchagin
994d3d5889 Regen for r293478. 2016-01-09 14:34:29 +00:00
dchagin
e060fa6fed MFC r283370:
In preparation for switching linuxulator to the use the native 1:1
threads introduce linux_exit() stub instead of sys_exit() call
(which terminates process).
In the new linuxulator exit() system call terminates the calling
thread (not a whole process).
2016-01-09 14:33:10 +00:00
dchagin
358125d39c MFC r283369:
In preparation for switching linuxulator to the use the native 1:1
threads print the thread id in addition to the pid in debug messages.
2016-01-09 14:31:03 +00:00
dchagin
d948b5accf Bump __FreeBSD_version after utimensat merge made in r293473. 2016-01-09 14:24:11 +00:00
dchagin
9d72460893 Regen for r293474. 2016-01-09 14:21:46 +00:00
dchagin
6aeea6cc62 MFC r277610 (by jillies):
Add futimens and utimensat system calls.
2016-01-09 14:20:23 +00:00
dchagin
939deb4336 To facillitate an upcoming Linuxulator merging partially
MFC r275121 (by kib). Only merge the syntax changes from r275121,
PROC_*LOCK() macros still lock the same proc spinlock.

The process spin lock currently has the following distinct uses:

- Threads lifetime cycle, in particular, counting of the threads in
  the process, and interlocking with process mutex and thread lock.
  The main reason of this is that turnstile locks are after thread
  locks, so you e.g. cannot unlock blockable mutex (think process
  mutex) while owning thread lock.

- Virtual and profiling itimers, since the timers activation is done
  from the clock interrupt context.  Replace the p_slock by p_itimmtx
  and PROC_ITIMLOCK().

- Profiling code (profil(2)), for similar reason.  Replace the p_slock
  by p_profmtx and PROC_PROFLOCK().

- Resource usage accounting.  Need for the spinlock there is subtle,
  my understanding is that spinlock blocks context switching for the
  current thread, which prevents td_runtime and similar fields from
  changing (updates are done at the mi_switch()).  Replace the p_slock
  by p_statmtx and PROC_STATLOCK().

Discussed with:	kib
2016-01-09 14:08:10 +00:00
rpokala
8120f17059 MFC r292123: Document mps.enable_ssu
mps(4) sends StartStopUnit to SATA direct-access devices during shutdown.
Document the tunables which control that behavior.

Approved by:	jhb
Sponsored by:	Panasas, Inc.
2016-01-09 05:07:02 +00:00
rpokala
d5fe9e0efa MFC r291114: popen() requires check for fdopen() failure
Move fdopen() up near other resource allocation like malloc(); do proper
deallocation on failure later on in the function.

Approved by:	jhb
Sponsored by:	Panasas, Inc.
2016-01-09 05:05:15 +00:00
rpokala
c2abf823f0 MFC r279567, r279568: Add and document an option to cause syslogd to run
in the foreground.

This allows a separate process to monitor when and how syslogd exits. That
process can then restart syslogd if needed.

Approved by:	jhb
Sponsored by:	Panasas, Inc.
2016-01-09 05:02:35 +00:00
emaste
b3f7d55af1 MFC r293055: kbdmap.5: Use current names for ASCII control codes lf, ff, us
Refer to the old names nl, np, ns as historical aliases.

PR:		205776, 205778
2016-01-09 01:01:04 +00:00
kib
44e96d0cbb MFC r292749:
Do not substitute interpeter if the brand interpreter path is
different from the interpreter path requested by the binary.
2016-01-09 00:34:48 +00:00
gjb
1acda3f94c MFC r293173, r293231:
r293173:
  Fix path to include .OBJDIR to avoid polluting the source
  tree during 'make release'.

 r293231:
  Add a new target to touch the ${.OBJDIR}/release file, which
  indicates the 'release' target has run (in order to prevent
  subsequent invocations that may clobber original build output).

Sponsored by:	The FreeBSD Foundation
2016-01-09 00:31:24 +00:00
emaste
93299e0ba8 MFC r293047: Use correct name 'us' for character 31 in keymaps
'ns' was a historical accident, and kbdcontrol(1) has accepted the
correct 'us' as well as 'ns' since r38139.

PR:		205776
2016-01-09 00:28:34 +00:00
jpaetzel
7e9f675c8e MFC 293043
Unset the gss kernel state when gssd exits

When gssd exits it leaves the kernel state set by
gssd_syscall().  nfsd sees this and waits endlessly
in an unkillable state for gssd to come back.  If you
had acidentally started gssd then stopped it, then
started nfsd you'd be in a bad way until you either
restarted gssd or rebooted the system.  This change
fixes that by setting the kernel state to "" when
gssd exits.
2016-01-08 23:58:32 +00:00
kib
c3db70fd0c MFC r293042:
Minor style cleanup.
2016-01-08 10:35:57 +00:00
stas
a223c7416c MFC r291545: make the number of fasttrap probes and the size of the trace points hash table
tunable via sysctl or kernel tunables.
2016-01-08 03:45:28 +00:00
araujo
2a244ee71d MFC: r292982
Remove unused variable after r292981 to unbreak the build.

MFC: r292981

Clean up unused-but-set-variable spotted by gcc-4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4773
2016-01-08 03:02:19 +00:00
araujo
97dfaa4116 MFC: r292980
Clean up unused-but-set-variable spotted by gcc4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4774
2016-01-08 02:59:56 +00:00
araujo
9f419b5317 MFC: r292972
Wrap using #ifdef 'notyet' those variables and statements not yet
implemented to lower the compiler warnings.

It fix the case of unused-but-set-variable spotted by gcc4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4775
2016-01-08 02:58:10 +00:00
araujo
f6284c5ff8 MFC: r292971
Clean up unused-but-set-variable spotted by gcc-4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4776
2016-01-08 02:56:21 +00:00
araujo
b6b275587f MFC: r292970
Clean up unused-but-set-variable spotted by gcc-4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4777
2016-01-08 02:54:21 +00:00
araujo
b3dc960e19 MFC: r292969
Clean up unused-but-set-variable spotted by gcc-4.9.

Reviewed by:	ngie
Approved by:	rodrigc (mentor)
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4778
2016-01-08 02:52:04 +00:00
stas
e4679b3dbb MFC r277938 (by hiren): make syncookie_mac() use 'tcp_seq irs' in computing hash. 2016-01-08 00:46:28 +00:00
stas
060003c8c0 MFC r292047: RPC: populate local address for rendezvous transporter. 2016-01-08 00:21:55 +00:00
bdrewery
012c5f2da9 MFC r291941:
Replace unneeded manual dependency on header by adding it to SRCS.
2016-01-07 23:26:16 +00:00
glebius
235e0ef9f7 Merge r293282 from head:
Provide knob NO_INSTALLEXTRAKERNELS. If defined, extra kernels in KERNCONF
 won't be installed, only the first one would.

Turn NO_INSTALLEXTRAKERNELS=yes on stable/10 to preserve original
behaviour of not installing additional kernels built.

Reported & tested by:	Trond Endrestøl <Trond.Endrestol fagskolen.gjovik.no>
Reported & tested by:	dhw
2016-01-07 23:10:44 +00:00
bdrewery
94e10a453c MFC r291611:
Add NO_INSTALLKERNEL to undo the assumption that the first KERNCONF will be
  installed as "kernel".  This is relevant for packaging of the kernel when not
  wanting a default "kernel.txz".
2016-01-07 22:06:05 +00:00
bdrewery
d931913fc5 MFC r291610:
Allow storing package(world|kernel) tarballs into a different location at
  PACKAGEDIR.
2016-01-07 22:05:04 +00:00
wollman
b52158b80d MFH r292836:
in6_if2idlen: treat bridge(4) interfaces like other Ethernet interfaces

    bridge(4) interfaces have an if_type of IFT_BRIDGE, rather than
    IFT_ETHER, even though they only support Ethernet-style links.  This
    caused in6_if2idlen to emit an "unknown link type (209)" warning to
    the console every time it was called.  Add IFT_BRIDGE to the case
    statement in the appropriate place, indicating that it uses the same
    IPv6 address format as other Ethernet-like interfaces.
2016-01-07 20:43:45 +00:00
emaste
ab9ee23bab MFC r280808 by andrew: Reorder sys/boot/Makefile for the efi loader move
As these will depend on ficl having been built, and are set via
bsd.arch.inc.mk we need to place this after ficl.

As Makefile.amd64 is now late enough we can add the i386 directory to
this.
2016-01-07 20:34:06 +00:00
emaste
926d90c28b MFC r281524 by andrew@: Use MACHINE in the efi loader when it is what we mean
It may not be the same as MACHINE_CPUARCH, it just happened to be the
case the architectures this code currently supports.

Fixes build failure reported by Oliver Pinter.
2016-01-07 20:10:49 +00:00