freebsd-skq/sys/compat
Dmitry Chagin 81338031c4 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.

Differential Revision:	https://reviews.freebsd.org/D1039
2015-05-24 14:53:16 +00:00
..
freebsd32 On exec, single-threading must be enforced before arguments space is 2015-05-10 09:00:40 +00:00
ia32 In preparation for switching linuxulator to the use the native 1:1 2015-05-24 14:51:29 +00:00
linprocfs Rewrite linprocfs_domtab() as a wrapper around kern_getfsstat(). This 2015-04-15 09:13:11 +00:00
linsysfs Provide includes that are needed in these files, and before were read 2013-10-26 18:18:50 +00:00
linux Switch linuxulator to use the native 1:1 threads. 2015-05-24 14:53:16 +00:00
ndis CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
netbsd Remove some more NetBSD compat shims and other unused bits from these 2012-09-10 18:49:49 +00:00
svr4 In preparation for switching linuxulator to the use the native 1:1 2015-05-24 14:51:29 +00:00
x86bios Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00