]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoImplement epoll_pwait() system call.
dchagin [Sun, 24 May 2015 18:00:14 +0000 (18:00 +0000)]
Implement epoll_pwait() system call.

9 years agoConvert signal number to native for VT_SETMODE ioctl and remove
dchagin [Sun, 24 May 2015 17:59:17 +0000 (17:59 +0000)]
Convert signal number to native for VT_SETMODE ioctl and remove
strange and invalid ISSIGVALID macro.
The code has not been tested right way but it was originally broken.

9 years agoRegen for r283480.
dchagin [Sun, 24 May 2015 17:58:24 +0000 (17:58 +0000)]
Regen for r283480.

9 years agoAdd utimensat() system call.
dchagin [Sun, 24 May 2015 17:57:07 +0000 (17:57 +0000)]
Add utimensat() system call.

The patch developed by Jilles Tjoelker and Andrew Wilcox and
adopted for lemul branch by me.

9 years agoThe kernel sends signals to the processes via ABI specific sv_sendsig method.
dchagin [Sun, 24 May 2015 17:56:02 +0000 (17:56 +0000)]
The kernel sends signals to the processes via ABI specific sv_sendsig method.
Native ABI do not need signal conversion, only emulators may want this. Usually
emulators implements its own sv_sendsig method. For now only ibcs2 emulator does
not have own sv_sendsig implementation and depends on native sendsig() method.
So, remove any extra attempts to convert signal numbers from native sendsig()
methods except from i386 where ibsc2 is living.

9 years agoSimplify linprocfs_doprocenviron(). Remove extra proc visibility checks
dchagin [Sun, 24 May 2015 17:53:48 +0000 (17:53 +0000)]
Simplify linprocfs_doprocenviron(). Remove extra proc visibility checks
and initialize pn_vis by well known procfs_candebug().

9 years agoConvert Linux signal number to the FreeBSD.
dchagin [Sun, 24 May 2015 17:49:09 +0000 (17:49 +0000)]
Convert Linux signal number to the FreeBSD.

9 years agoConvert Linux sigsets before showing.
dchagin [Sun, 24 May 2015 17:48:34 +0000 (17:48 +0000)]
Convert Linux sigsets before showing.
Linux kernel displays sigset always as 16x4 bit mask.

9 years agoRework signal code to allow using it by other modules, like linprocfs:
dchagin [Sun, 24 May 2015 17:47:20 +0000 (17:47 +0000)]
Rework signal code to allow using it by other modules, like linprocfs:

1. Linux sigset always 64 bit on all platforms. In order to move Linux
sigset code to the linux_common module define it as 64 bit int. Move
Linux sigset manipulation routines to the MI path.

2. Move Linux signal number definitions to the MI path. In general, they
are the same on all platforms except for a few signals.

3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion
tables to avoid conversion errors.

4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside
of allowed on Linux signal numbers.

PR: 197216

9 years agoAdd support for /proc/<pid>/auxv.
dchagin [Sun, 24 May 2015 17:46:04 +0000 (17:46 +0000)]
Add support for /proc/<pid>/auxv.

9 years agoAdd vdso and stack names to the /proc/self/maps.
dchagin [Sun, 24 May 2015 17:44:42 +0000 (17:44 +0000)]
Add vdso and stack names to the /proc/self/maps.

9 years agoAccording to Linux man sigaltstack(3) shall return EINVAL if the ss
dchagin [Sun, 24 May 2015 17:44:08 +0000 (17:44 +0000)]
According to Linux man sigaltstack(3) shall return EINVAL if the ss
argument is not a null pointer, and the ss_flags member pointed to by ss
contains flags other than SS_DISABLE. However, in fact, Linux also
allows SS_ONSTACK flag which is simply ignored.

For buggy apps (at least mono) ignore other than SS_DISABLE
flags as a Linux do.

While here move MI part of sigaltstack code to the appropriate place.

Reported by: abi at abinet dot ru

9 years agoAdd EPOLLERR flag handling to epoll.
dchagin [Sun, 24 May 2015 17:42:45 +0000 (17:42 +0000)]
Add EPOLLERR flag handling to epoll.

Tested by: abi at abinet dot ru

9 years agoAs fo_fill_kinfo() does not check fo_fill_kinfo to NULL
dchagin [Sun, 24 May 2015 17:40:14 +0000 (17:40 +0000)]
As fo_fill_kinfo() does not check fo_fill_kinfo to NULL
add a fo_fill_kinfo op to eventfdops.

Reported by: trinity

9 years agoRegen for r283467.
dchagin [Sun, 24 May 2015 17:39:18 +0000 (17:39 +0000)]
Regen for r283467.

9 years agoCall nosys in case when the incorrect syscall number is specified.
dchagin [Sun, 24 May 2015 17:38:02 +0000 (17:38 +0000)]
Call nosys in case when the incorrect syscall number is specified.

Reported by: trinity

9 years agoRegen for r283465.
dchagin [Sun, 24 May 2015 17:35:42 +0000 (17:35 +0000)]
Regen for r283465.

9 years agoAdd preliminary fallocate system call implementation
dchagin [Sun, 24 May 2015 17:33:21 +0000 (17:33 +0000)]
Add preliminary fallocate system call implementation
to emulate posix_fallocate() function.

Differential Revision: https://reviews.freebsd.org/D1523
Reviewed by: emaste

9 years agoDelete the duplicate of linux_to_native_clockid() function.
dchagin [Sun, 24 May 2015 17:30:31 +0000 (17:30 +0000)]
Delete the duplicate of linux_to_native_clockid() function.

Differential Revision: https://reviews.freebsd.org/D1521
Reviewed by: trasz

9 years agoDo not use struct l_timespec without conversion. While here move
dchagin [Sun, 24 May 2015 17:29:18 +0000 (17:29 +0000)]
Do not use struct l_timespec without conversion. While here move
args->timeout handling before acquiring the futex key at FUTEX_WAIT path.

Differential Revision: https://reviews.freebsd.org/D1520
Reviewed by: trasz

9 years agoAdd prototypes for static futex functions.
dchagin [Sun, 24 May 2015 17:27:59 +0000 (17:27 +0000)]
Add prototypes for static futex functions.

Differential Revision: https://reviews.freebsd.org/D1519
Reviewed by: trasz

9 years agoAs for now our tmpfs is no longer being considered
dchagin [Sun, 24 May 2015 17:26:58 +0000 (17:26 +0000)]
As for now our tmpfs is no longer being considered
"highly experimental" remove /dev/shm magic commited
in r218497 and convert tmpfs type to an expected magic number.

Differential Revision: https://reviews.freebsd.org/D1497
Reviewed by: emaste, trasz

9 years agoPrint out unsupported futex operation message only once for the process.
dchagin [Sun, 24 May 2015 17:25:57 +0000 (17:25 +0000)]
Print out unsupported futex operation message only once for the process.

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

9 years agoAdd some clock mappings used in glibc 2.20.
dchagin [Sun, 24 May 2015 17:23:08 +0000 (17:23 +0000)]
Add some clock mappings used in glibc 2.20.

Differential Revision: https://reviews.freebsd.org/D1465
Reviewd by: trasz

9 years agoImprove ktr(9) records in thread managment code.
dchagin [Sun, 24 May 2015 17:09:07 +0000 (17:09 +0000)]
Improve ktr(9) records in thread managment code.

Differential Revision: https://reviews.freebsd.org/D1464
Reviewed by: trasz

9 years agoUse local struct proc * varable instead of dereferencing td->td_proc.
dchagin [Sun, 24 May 2015 17:08:25 +0000 (17:08 +0000)]
Use local struct proc * varable instead of dereferencing td->td_proc.

Differential Revision: https://reviews.freebsd.org/D1463
Reviewed by: emaste

9 years agoAvoid unnecessary em zeroing in non-exec path
dchagin [Sun, 24 May 2015 17:07:10 +0000 (17:07 +0000)]
Avoid unnecessary em zeroing in non-exec path
as it already zeroed by malloc with M_ZERO flag
and move zeroing to the proper place in exec path.

Differential Revision: https://reviews.freebsd.org/D1462
Reviewed by: trasz

9 years agoRemove the unnecessary cast.
dchagin [Sun, 24 May 2015 17:05:59 +0000 (17:05 +0000)]
Remove the unnecessary cast.

Differential Revision: https://reviews.freebsd.org/D1461
Reviewed by: emaste

9 years agoRegen for r283451.
dchagin [Sun, 24 May 2015 17:00:43 +0000 (17:00 +0000)]
Regen for r283451.

9 years agoImplement ppoll() system call.
dchagin [Sun, 24 May 2015 16:59:25 +0000 (16:59 +0000)]
Implement ppoll() system call.

Differential Revision: https://reviews.freebsd.org/D1105
Reviewed by: trasz

9 years agotd_sigmask of a newly created thread copied from td.
dchagin [Sun, 24 May 2015 16:56:32 +0000 (16:56 +0000)]
td_sigmask of a newly created thread copied from td.
Remove excess initialization of td_sigmask.

Differential Revision: https://reviews.freebsd.org/D1128
Reviewed by: emaste

9 years agoUpdate Linux compat revision to 32.
dchagin [Sun, 24 May 2015 16:55:32 +0000 (16:55 +0000)]
Update Linux compat revision to 32.

Differential Revision: https://reviews.freebsd.org/D1122
Reviewed by: emaste

9 years agoConnect linux64 module to the build.
dchagin [Sun, 24 May 2015 16:53:32 +0000 (16:53 +0000)]
Connect linux64 module to the build.

Differential Revision: https://reviews.freebsd.org/D1097
Reviewed by: emaste

9 years agoFix linux_common module build with KTR option.
dchagin [Sun, 24 May 2015 16:52:45 +0000 (16:52 +0000)]
Fix linux_common module build with KTR option.

Differential Revision: https://reviews.freebsd.org/D1096
Reviewed by: trasz

9 years agoInclude opt_compat.h, so that COMPAT_LINUX32 is defined, and we can
dchagin [Sun, 24 May 2015 16:51:04 +0000 (16:51 +0000)]
Include opt_compat.h, so that COMPAT_LINUX32 is defined, and we can
access to the semop structs and functions.

Submitted by: cognet@

Differential Revision: https://reviews.freebsd.org/D1095
Reviewed by: trasz

9 years agoRegen for r283444.
dchagin [Sun, 24 May 2015 16:50:17 +0000 (16:50 +0000)]
Regen for r283444.

9 years agoImplement eventfd system call.
dchagin [Sun, 24 May 2015 16:49:14 +0000 (16:49 +0000)]
Implement eventfd system call.

Differential Revision: https://reviews.freebsd.org/D1094
In collaboration with: Jilles Tjoelker

9 years agoPut the correct value for the abi_nfdbits parameter of kern_select() for
dchagin [Sun, 24 May 2015 16:47:13 +0000 (16:47 +0000)]
Put the correct value for the abi_nfdbits parameter of kern_select() for
all supported Linuxulators.

Differential Revision: https://reviews.freebsd.org/D1093
Reviewed by: trasz

9 years agoRegen for r283441.
dchagin [Sun, 24 May 2015 16:42:49 +0000 (16:42 +0000)]
Regen for r283441.

9 years agoImplement epoll family system calls. This is a tiny wrapper
dchagin [Sun, 24 May 2015 16:41:39 +0000 (16:41 +0000)]
Implement epoll family system calls. This is a tiny wrapper
around kqueue() to implement epoll subset of functionality.
The kqueue user data are 32bit on i386 which is not enough for
epoll user data, so we keep user data in the proc emuldata.

Initial patch developed by rdivacky@ in 2007, then extended
by Yuri Victorovich @ r255672 and finished by me
in collaboration with mjg@ and jillies@.

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

9 years agoFor future use in the Linuxulator:
dchagin [Sun, 24 May 2015 16:36:29 +0000 (16:36 +0000)]
For future use in the Linuxulator:

1. Add a kern_kqueue() counterpart for kqueue() with flags parameter.

2. Be a bit secure. To avoid a double fp lookup add a kern_kevent_fp()
counterpart for kern_kevent() with file pointer parameter instead
of file descriptor an pass the buck to it.

Suggested by: mjg [2]

Differential Revision: https://reviews.freebsd.org/D1091
Reviewed by: trasz

9 years agoImplement F_DUPFD_CLOEXEC fcntl flag.
dchagin [Sun, 24 May 2015 16:34:57 +0000 (16:34 +0000)]
Implement F_DUPFD_CLOEXEC fcntl flag.

Differential Revision: https://reviews.freebsd.org/D1089
Reviewed by: trasz

9 years agoAdd several fcntl flags.
dchagin [Sun, 24 May 2015 16:32:52 +0000 (16:32 +0000)]
Add several fcntl flags.

Differential Revision: https://reviews.freebsd.org/D1088
Reviewed by: trasz

9 years agoTo avoid code duplication move open/fcntl definitions to the MI
dchagin [Sun, 24 May 2015 16:31:44 +0000 (16:31 +0000)]
To avoid code duplication move open/fcntl definitions to the MI
header file.

Differential Revision: https://reviews.freebsd.org/D1087
Reviewed by: trasz

9 years agoUse the BSD_TO_LINUX_SIGNAL() wherever there is no need
dchagin [Sun, 24 May 2015 16:30:23 +0000 (16:30 +0000)]
Use the BSD_TO_LINUX_SIGNAL() wherever there is no need
to check the ABI as it is known.

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

9 years agoConvert Linux wait options to the FreeBSD.
dchagin [Sun, 24 May 2015 16:28:58 +0000 (16:28 +0000)]
Convert Linux wait options to the FreeBSD.
Check wait options as a Linux do.
Linux always set WEXITED option not a WUNTRACED|WNOHANG
which is a strange bug.

Differential Revision: https://reviews.freebsd.org/D1085
Reviewed by: trasz

9 years agoSet WIFCONTINUED to the wait status if needed.
dchagin [Sun, 24 May 2015 16:27:38 +0000 (16:27 +0000)]
Set WIFCONTINUED to the wait status if needed.

Differential Revision: https://reviews.freebsd.org/D1083
Reviewed by: trasz

9 years agoRewrite linux_recvfrom. To avoid double conversion of sockaddr use
dchagin [Sun, 24 May 2015 16:26:55 +0000 (16:26 +0000)]
Rewrite linux_recvfrom. To avoid double conversion of sockaddr use
kern_recvit() directly.
And check fromlen parameter before sockaddr copyin and conversion.

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

9 years agoBeing exported through vdso the note.Linux section used by glibc
dchagin [Sun, 24 May 2015 16:25:44 +0000 (16:25 +0000)]
Being exported through vdso the note.Linux section used by glibc
to determine the kernel version (this saves one uname call).
Temporarily disable the export of a note.Linux section until I figured
out how to change the kernel version in the note.Linux on the fly.

Differential Revision: https://reviews.freebsd.org/D1081
Reviewed by: trasz

9 years agoAdd AT_RANDOM and AT_EXECFN auxiliary vector entries which are used by
dchagin [Sun, 24 May 2015 16:24:24 +0000 (16:24 +0000)]
Add AT_RANDOM and AT_EXECFN auxiliary vector entries which are used by
glibc. At list since glibc version 2.16 using AT_RANDOM is mandatory.

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

9 years agoTeach kdump to understand both linux emulation.
dchagin [Sun, 24 May 2015 16:22:03 +0000 (16:22 +0000)]
Teach kdump to understand both linux emulation.

Differential Revision: https://reviews.freebsd.org/D1079
Reviewed by: emaste

9 years agoRegen for r283428.
dchagin [Sun, 24 May 2015 16:19:57 +0000 (16:19 +0000)]
Regen for r283428.

9 years agoChange linux faccessat syscall definition to match actual linux one.
dchagin [Sun, 24 May 2015 16:18:03 +0000 (16:18 +0000)]
Change linux faccessat syscall definition to match actual linux one.

The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
within the glibc wrapper function for faccessat().  If either of these
flags are specified, then the wrapper function employs fstatat() to
determine access permissions.

Differential Revision: https://reviews.freebsd.org/D1078
Reviewed by: trasz

9 years agoWhere possible we will use M_LINUX malloc(9) type.
dchagin [Sun, 24 May 2015 16:14:41 +0000 (16:14 +0000)]
Where possible we will use M_LINUX malloc(9) type.
Move M_FUTEX defines to the linux_common.ko.

Differential Revision: https://reviews.freebsd.org/D1077
Reviewed by: emaste

9 years agoAdd support for getting the memory map from EFI if it has been pased in
andrew [Sun, 24 May 2015 16:11:30 +0000 (16:11 +0000)]
Add support for getting the memory map from EFI if it has been pased in
by loader.efi.

9 years agoRegen for r283424.
dchagin [Sun, 24 May 2015 16:11:21 +0000 (16:11 +0000)]
Regen for r283424.

9 years agoAdd preliminary support for x86-64 Linux binaries.
dchagin [Sun, 24 May 2015 16:07:11 +0000 (16:07 +0000)]
Add preliminary support for x86-64 Linux binaries.

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

9 years agoMove FEATURE macros for v4l and v4l2 to the common module.
dchagin [Sun, 24 May 2015 16:00:01 +0000 (16:00 +0000)]
Move FEATURE macros for v4l and v4l2 to the common module.

Differential Revision: https://reviews.freebsd.org/D1075
Reviewed by: emaste

9 years agoRefund the proc emuldata struct for future use. For now move flags from
dchagin [Sun, 24 May 2015 15:54:58 +0000 (15:54 +0000)]
Refund the proc emuldata struct for future use. For now move flags from
thread emuldata to proc emuldata as it was originally intended.

As we can have both 64 & 32 bit Linuxulator running any eventhandler
can be called twice for us. To prevent this move eventhandlers code
from linux_emul.c to the linux_common.ko module.

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

9 years agoIntroduce a new module linux_common.ko which is intended for the
dchagin [Sun, 24 May 2015 15:51:18 +0000 (15:51 +0000)]
Introduce a new module linux_common.ko which is intended for the
following primary purposes:

1. Remove the dependency of linsysfs and linprocfs modules from linux.ko,
which will be architecture specific on amd64.

2. Incorporate into linux_common.ko general code for platforms on which
we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).

3. Move malloc(9) declaration to linux_common.ko, to enable getting memory
usage statistics properly.

Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c
and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.

Temporarily remove dtrace garbage from linux_mib.c and linux_util.c

Differential Revision: https://reviews.freebsd.org/D1072
In collaboration with: Vassilis Laganakos.

Reviewed by: trasz

9 years agoAdd newfstatat system call for 64-bit Linuxulator.
dchagin [Sun, 24 May 2015 15:48:34 +0000 (15:48 +0000)]
Add newfstatat system call for 64-bit Linuxulator.

Differential Revision: https://reviews.freebsd.org/D1071
Reviewed by: trasz

9 years agoFix compilation with -DDEBUG option.
dchagin [Sun, 24 May 2015 15:47:15 +0000 (15:47 +0000)]
Fix compilation with -DDEBUG option.

Differential Revision: https://reviews.freebsd.org/D1070
Reviewed by: trasz

9 years agoWhen only 2 bytes can be read from a 4 byte UTF-16 character in a base64
tijl [Sun, 24 May 2015 15:47:06 +0000 (15:47 +0000)]
When only 2 bytes can be read from a 4 byte UTF-16 character in a base64
encoded chunk of a UTF-7 string, treat that as an incomplete character and
return an error instead of a shift sequence and no error.

Also check that the low 2 bytes have a valid value.

MFC after: 1 week

9 years agoAdd 64 bit support to the vdso.
dchagin [Sun, 24 May 2015 15:45:36 +0000 (15:45 +0000)]
Add 64 bit support to the vdso.

Differential Revision: https://reviews.freebsd.org/D1069
Reviewed by: trasz

9 years agox86_64 Linux do not use multiplexing on ipc system calls.
dchagin [Sun, 24 May 2015 15:44:41 +0000 (15:44 +0000)]
x86_64 Linux do not use multiplexing on ipc system calls.
Move struct ipc_perm definition to the MD path as it differs for 64 and
32 bit platform.

Differential Revision: https://reviews.freebsd.org/D1068
Reviewed by: trasz

9 years agoDisable i386 call for x86-64 Linux.
dchagin [Sun, 24 May 2015 15:43:53 +0000 (15:43 +0000)]
Disable i386 call for x86-64 Linux.

Differential Revision: https://reviews.freebsd.org/D1067
Reviewed by: trasz

9 years agoPrint out proper procmap entry for 64 bit binaries.
dchagin [Sun, 24 May 2015 15:42:36 +0000 (15:42 +0000)]
Print out proper procmap entry for 64 bit binaries.

Differential Revision: https://reviews.freebsd.org/D1066
Reviewed by: trasz

9 years ago64-bit paltforms, like x86_64, do not use multiplexing on
dchagin [Sun, 24 May 2015 15:41:27 +0000 (15:41 +0000)]
64-bit paltforms, like x86_64, do not use multiplexing on
socketcall system calls.

Differential Revision: https://reviews.freebsd.org/D1065
Reviewed by: trasz

9 years agoGet ready to commit x86_64 Linux emulation.
dchagin [Sun, 24 May 2015 15:39:08 +0000 (15:39 +0000)]
Get ready to commit x86_64 Linux emulation.
All fields of type l_int in struct statfs are defined
as l_long on i386 and amd64.

Differential Revision: https://reviews.freebsd.org/D1064
Reviewed by: trasz

9 years agoRemove stale comment about a signal trampoline which
dchagin [Sun, 24 May 2015 15:32:52 +0000 (15:32 +0000)]
Remove stale comment about a signal trampoline which
is moved to the shared page at r219609.

Differential Revision: https://reviews.freebsd.org/D1063
Reviewed by: trasz

9 years agoPut linux_platform into the vdso to avoid copying it onto the stack at
dchagin [Sun, 24 May 2015 15:30:52 +0000 (15:30 +0000)]
Put linux_platform into the vdso to avoid copying it onto the stack at
every exec.

Differential Revision: https://reviews.freebsd.org/D1062
Reviewed by: trasz

9 years agoEliminate a now unused global declaration of elf_linux_sysvec.
dchagin [Sun, 24 May 2015 15:29:20 +0000 (15:29 +0000)]
Eliminate a now unused global declaration of elf_linux_sysvec.

Differential Revision: https://reviews.freebsd.org/D1061
Reviewed by: trasz

9 years agoImplement vdso - virtual dynamic shared object. Through vdso Linux
dchagin [Sun, 24 May 2015 15:28:17 +0000 (15:28 +0000)]
Implement vdso - virtual dynamic shared object. Through vdso Linux
exposes functions from kernel with proper DWARF CFI information so that
it becomes easier to unwind through them.
Using vdso is a mandatory for a thread cancelation && cleanup
on a modern glibc.

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

9 years agoFix decoding of UTF-7 when a base64 encoded chunk appears at the end of
tijl [Sun, 24 May 2015 15:27:31 +0000 (15:27 +0000)]
Fix decoding of UTF-7 when a base64 encoded chunk appears at the end of
the input buffer.

_citrus_UTF7_mbtoutf16 stored the decoder state at the beginning so it
could restore this state on an incomplete character such that the next
call would restart the decoding.  The problem was that "-" (end of base64
mode) at the end of a string was also treated as an incomplete character
but was also removed from the state buffer.  So the initial state would be
restored (with base64 mode) and the next call would no longer see the "-"
so it continued in base64 mode.

This state saving/restoring isn't needed here.  It's already handled
elsewhere (citrus_iconv_std.c:_citrus_iconv_std_iconv_convert) so just
remove it.

Also initialise *nresult.

PR: 200398
Tested by: delphij
MFC after: 1 week

9 years agoRegen for r283403.
dchagin [Sun, 24 May 2015 15:22:33 +0000 (15:22 +0000)]
Regen for r283403.

9 years agoImplement pselect6() system call.
dchagin [Sun, 24 May 2015 15:21:25 +0000 (15:21 +0000)]
Implement pselect6() system call.

Differential Revision: https://reviews.freebsd.org/D1051
Reviewed by: trasz

9 years agoRegen for r283401.
dchagin [Sun, 24 May 2015 15:19:44 +0000 (15:19 +0000)]
Regen for r283401.

9 years agoImplement prlimit64() system call.
dchagin [Sun, 24 May 2015 15:18:19 +0000 (15:18 +0000)]
Implement prlimit64() system call.

Differential Revision: https://reviews.freebsd.org/D1050
Reviewed by: emaste, trasz

9 years agoRegen for r283399.
dchagin [Sun, 24 May 2015 15:15:46 +0000 (15:15 +0000)]
Regen for r283399.

9 years agoImplement dup3() system call.
dchagin [Sun, 24 May 2015 15:14:51 +0000 (15:14 +0000)]
Implement dup3() system call.

Differential Revision: https://reviews.freebsd.org/D1049
Reviewed by: emaste

9 years agoSched_rr_get_interval returns EINVAL in case when the invalid pid
dchagin [Sun, 24 May 2015 15:13:56 +0000 (15:13 +0000)]
Sched_rr_get_interval returns EINVAL in case when the invalid pid
specified. This silence the ltp tests.

Differential Revision: https://reviews.freebsd.org/D1048
Reviewed by: trasz

9 years agoRegen for r283396.
dchagin [Sun, 24 May 2015 15:12:38 +0000 (15:12 +0000)]
Regen for r283396.

9 years agoImplement rt_sigqueueinfo() system call.
dchagin [Sun, 24 May 2015 15:11:32 +0000 (15:11 +0000)]
Implement rt_sigqueueinfo() system call.

Differential Revision: https://reviews.freebsd.org/D1047
Reviewed by: trasz

9 years agoRegen for r283394.
dchagin [Sun, 24 May 2015 15:08:25 +0000 (15:08 +0000)]
Regen for r283394.

9 years agoImplement waitid() system call.
dchagin [Sun, 24 May 2015 15:06:39 +0000 (15:06 +0000)]
Implement waitid() system call.

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

9 years agoRegen for r283392.
dchagin [Sun, 24 May 2015 15:05:22 +0000 (15:05 +0000)]
Regen for r283392.

9 years agostruct l_rusage does not defined for i386 Linuxulator due to it's nature.
dchagin [Sun, 24 May 2015 15:04:12 +0000 (15:04 +0000)]
struct l_rusage does not defined for i386 Linuxulator due to it's nature.

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

9 years agoTo reduce code duplication introduce linux_copyout_rusage() method.
dchagin [Sun, 24 May 2015 15:03:09 +0000 (15:03 +0000)]
To reduce code duplication introduce linux_copyout_rusage() method.
Use it in linux_wait4() system call and move linux_wait4() to the MI path.
While here add a prototype for the static bsd_to_linux_rusage().

Differential Revision: https://reviews.freebsd.org/D2138
Reviewed by: trasz

9 years agoAdd a function for converting wait options.
dchagin [Sun, 24 May 2015 15:00:27 +0000 (15:00 +0000)]
Add a function for converting wait options.

Differential Revision: https://reviews.freebsd.org/D1045
Reviewed by: trasz

9 years agoAdd a siginfo_t conversion function.
dchagin [Sun, 24 May 2015 14:58:30 +0000 (14:58 +0000)]
Add a siginfo_t conversion function.

Differential Revision: https://reviews.freebsd.org/D1044
Reviewed by: emaste, trasz

9 years agoRemove a now unused define.
dchagin [Sun, 24 May 2015 14:57:39 +0000 (14:57 +0000)]
Remove a now unused define.

Differential Revision: https://reviews.freebsd.org/D1043
Reviewed by: trasz

9 years agoIntroduce LINUX_VERSION_STR, LINUX_VERSION_CODE macro for use instead
dchagin [Sun, 24 May 2015 14:56:21 +0000 (14:56 +0000)]
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.

Differential Revision: https://reviews.freebsd.org/D1042
Reviewed by: trasz

9 years agoSome style(9) && whitespaces fixes. No functional changes.
dchagin [Sun, 24 May 2015 14:55:12 +0000 (14:55 +0000)]
Some style(9) && whitespaces fixes. No functional changes.

Differential Revision: https://reviews.freebsd.org/D1041
Reviewed by: emaste

9 years agopthread_join() caller do futex_wait on child_clear_tid. As a results
dchagin [Sun, 24 May 2015 14:54:12 +0000 (14:54 +0000)]
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.

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

9 years agoSwitch linuxulator to use the native 1:1 threads.
dchagin [Sun, 24 May 2015 14:53:16 +0000 (14:53 +0000)]
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

9 years agoIn preparation for switching linuxulator to the use the native 1:1
dchagin [Sun, 24 May 2015 14:51:29 +0000 (14:51 +0000)]
In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die.

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

9 years agoIn preparation for switching linuxulator to the use the native 1:1
dchagin [Sun, 24 May 2015 14:49:21 +0000 (14:49 +0000)]
In preparation for switching linuxulator to the use the native 1:1
threads add per thread emulator state data.

Differential Revision: https://reviews.freebsd.org/D1037
Reviewed by: trasz

9 years agoRegen for r283379.
dchagin [Sun, 24 May 2015 14:47:00 +0000 (14:47 +0000)]
Regen for r283379.

9 years agoImplement a Linux version of sched_getparam() && sched_setparam().
dchagin [Sun, 24 May 2015 14:45:57 +0000 (14:45 +0000)]
Implement a Linux version of sched_getparam() && sched_setparam().
Temporarily use the first thread in proc.

Differential Revision: https://reviews.freebsd.org/D1036
Reviewed by: trasz

9 years agoRemove a now unused include.
dchagin [Sun, 24 May 2015 14:44:57 +0000 (14:44 +0000)]
Remove a now unused include.

Differential Revision: https://reviews.freebsd.org/D1035
Reviewed by: trasz