aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_emul.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement PTRACE_O_TRACESYSGOOD. This makes Linux strace(1) work.Edward Tomasz Napierala2019-05-191-0/+3
| | | | | | | | | | Reviewed by: dchagin MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20200 Notes: svn path=/head/; revision=347971
* Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.Dmitry Chagin2019-04-301-1/+0
| | | | | | | | | It was first introduced in r163734 and missied by me in r283383. MFC after: 1 week Notes: svn path=/head/; revision=346965
* linuxulator: deduplicate linux_exec_imgact_tryEd Maste2018-04-091-0/+1
| | | | | | | | | | | | Previously linuxulator had three identical copies of linux_exec_imgact_try. Deduplicate before adding another arch to linuxulator. Sponsored by: Turing Robotic Industries Inc Differential Revision: https://reviews.freebsd.org/D14856 Notes: svn path=/head/; revision=332333
* Share Linux errno table with libsysdecodeEd Maste2018-03-221-1/+1
| | | | | | | | | Requested by: jhb Reviewed by: jhb Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=331356
* Share a single bsd-linux errno table across MD consumersEd Maste2018-03-161-0/+2
| | | | | | | | | | | | | | | | | | | | Three copies of the linuxulator linux_sysvec.c contained identical BSD to Linux errno translation tables, and future work to support other architectures will also use the same table. Move the table to a common file to be used by all. Make it 'const int' to place it in .rodata. (Some existing Linux architectures use MD errno values, but x86 and Arm share the generic set.) This change should introduce no functional change; a followup will add missing errno values. MFC after: 3 weeks Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14665 Notes: svn path=/head/; revision=331056
* Rationalize license text on Linuxolator filesEd Maste2018-03-011-15/+13
| | | | | | | | | | | | | | | | Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Additional files still waiting on permission from others are listed in review D14210. Approved by: dchagin, rdivacky, sos MFC after: 1 week MFC with: r329370 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=330239
* sys/compat: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326266
* Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag.Dmitry Chagin2016-07-101-0/+1
| | | | | | | | | | In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap(). Linux/i386 set this flag automatically if the binary requires executable stack. READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit. Notes: svn path=/head/; revision=302515
* Print out unsupported futex operation message only once for the process.Dmitry Chagin2015-05-241-0/+1
| | | | | | | Differential Revision: https://reviews.freebsd.org/D1498 Notes: svn path=/head/; revision=283460
* Implement epoll family system calls. This is a tiny wrapperDmitry Chagin2015-05-241-0/+3
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=283441
* Refund the proc emuldata struct for future use. For now move flags fromDmitry Chagin2015-05-241-5/+16
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=283422
* Switch linuxulator to use the native 1:1 threads.Dmitry Chagin2015-05-241-64/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=283383
* - >500 static DTrace probes for the linuxulatorAlexander Leidinger2012-05-051-7/+36
| | | | | | | | | | | | | | | | | | | | | - DTrace scripts to check for errors, performance, ... they serve mostly as examples of what you can do with the static probe;s with moderate load the scripts may be overwhelmed, excessive lock-tracing may influence program behavior (see the last design decission) Design decissions: - use "linuxulator" as the provider for the native bitsize; add the bitsize for the non-native emulation (e.g. "linuxuator32" on amd64) - Add probes only for locks which are acquired in one function and released in another function. Locks which are aquired and released in the same function should be easy to pair in the code, inter-function locking is more easy to verify in DTrace. - Probes for locks should be fired after locking and before releasing to prevent races (to provide data/function stability in DTrace, see the man-page of "dtrace -v ..." and the corresponding DTrace docs). Notes: svn path=/head/; revision=235063
* Extend struct sysvec with new method sv_schedtail, which is used for anDmitry Chagin2011-03-081-1/+1
| | | | | | | | | | | | | | | | | | explicit process at fork trampoline path instead of eventhadler(schedtail) invocation for each child process. Remove eventhandler(schedtail) code and change linux ABI to use newly added sysvec method. While here replace explicit comparing of module sysentvec structure with the newly created process sysentvec to detect the linux ABI. Discussed with: kib MFC after: 2 Week Notes: svn path=/head/; revision=219405
* Rename used_requeue and use it as bitwise field to store more flags.Dmitry Chagin2011-02-121-1/+5
| | | | | | | Reimplement used_requeue logic with LINUX_XDEPR_REQUEUEOP flag. Notes: svn path=/head/; revision=218621
* By using the 32-bit Linux version of Sun's Java Development Kit 1.6Alexander Leidinger2010-11-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes. 2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm. The submitters fix this in a similar way to how NetBSD handles this. I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him). The patches committed here are from [2], with some little modifications from me to the style. PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt <stefan.schmidt@stadtbuch.de>, gk Reviewed by: rdivacky (in april 2010) MFC after: 5 days Notes: svn path=/head/; revision=215664
* Remove support for FUTEX_REQUEUE operation.Dmitry Chagin2009-04-191-0/+1
| | | | | | | | | | | | | | | | | | | Glibc does not use this operation since 2.3.3 version (Jun 2004), as it is racy and replaced by FUTEX_CMP_REQUEUE operation. Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when FUTEX_REQUEUE returned EINVAL. Any application directly using FUTEX_REQUEUE without return value checking are definitely broken. Limit quantity of messages per process about unsupported operation. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=191269
* Include linux_futex.h before linux_emul.hDmitry Chagin2009-03-151-2/+0
| | | | | | | | Approved by: kib (mentor) MFC after: 6 days Notes: svn path=/head/; revision=189861
* Implement robust futexes. Most of the code is modelled afterRoman Divacky2008-05-131-0/+4
| | | | | | | | | | | | | | what Linux does. This is because robust futexes are mostly userspace thing which we cannot alter. Two syscalls maintain pointer to userspace list and when process exits a routine walks this list waking up processes sleeping on futexes from that list. Reviewed by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=178976
* MFP4: Turn emul_lock into a mutex.Jung-uk Kim2007-04-021-12/+12
| | | | | | | Submitted by: rdivacky Notes: svn path=/head/; revision=168275
* MFp4 (112498):Alexander Leidinger2007-01-071-2/+2
| | | | | | | | | Rename the locking flags to EMUL_DOLOCK and EMUL_DONTLOCK to prevent confusion. Submitted by: rdivacky Notes: svn path=/head/; revision=165867
* MFp4:Alexander Leidinger2006-12-311-13/+13
| | | | | | | - semi-automatic style fixes Notes: svn path=/head/; revision=165688
* MFP4:Alexander Leidinger2006-10-281-0/+2
| | | | | | | | | | Implement prctl(). Submitted by: rdivacky Tested with: LTP Notes: svn path=/head/; revision=163734
* Move some stuff into headers where they belong.Alexander Leidinger2006-08-171-0/+3
| | | | | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal Notes: svn path=/head/; revision=161419
* Style fixes to comments.Alexander Leidinger2006-08-161-1/+2
| | | | | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal Notes: svn path=/head/; revision=161365
* Add some new files needed for linux 2.6.x compatibility.Alexander Leidinger2006-08-151-0/+74
Please don't style(9) the NetBSD code, we want to stay in sync. Not imported on a vendor branch since we need local changes. Sponsored by: Google SoC 2006 Submitted by: rdivacky With help from: manu@NetBSD.org Obtained from: NetBSD (linux_{futex,time}.*) Notes: svn path=/head/; revision=161304