summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux
Commit message (Collapse)AuthorAgeFilesLines
* Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.ed2010-03-281-9/+9
| | | | | | | | | | | | | | | A nice thing about POSIX 2008 is that it finally standardizes a way to obtain file access/modification/change times in sub-second precision, namely using struct timespec, which we already have for a very long time. Unfortunately POSIX uses different names. This commit adds compatibility macros, so existing code should still build properly. Also change all source code in the kernel to work without any of the compatibility macros. This makes it all a less ambiguous. I am also renaming st_birthtime to st_birthtim, even though it was a local extension anyway. It seems Cygwin also has a st_birthtim.
* Change the arguments of exec_setregs() so that it receives a pointernwhitehorn2010-03-251-5/+4
| | | | | | | | to the image_params struct instead of several members of that struct individually. This makes it easier to expand its arguments in the future without touching all platforms. Reviewed by: jhb
* Fix some problems with effective mmap() offsets > 32 bits. This wasjhb2009-10-281-34/+31
| | | | | | | | | | | | partially fixed on amd64 earlier. Rather than forcing linux_mmap_common() to use a 32-bit offset, have it accept a 64-bit file offset. This offset is then passed to the real mmap() call. Rather than inventing a structure to hold the normal linux_mmap args that has a 64-bit offset, just pass each of the arguments individually to linux_mmap_common() since that more closes matches the existing style of various kern_foo() functions. Submitted by: Christian Zander @ Nvidia MFC after: 1 week
* In r197963, a race with thread being selected for signal deliverykib2009-10-271-12/+6
| | | | | | | | | | | | | while in kernel mode, and later changing signal mask to block the signal, was fixed for sigprocmask(2) and ptread_exit(3). The same race exists for sigreturn(2), setcontext(2) and swapcontext(2) syscalls. Use kern_sigprocmask() instead of direct manipulation of td_sigmask to reschedule newly blocked signals, closing the race. Reviewed by: davidxu Tested by: pho MFC after: 1 month
* As jhb@ pointed out to me, r197057 was incorrect, not least because thesedes2009-09-101-0/+7
| | | | are generated files.
* Fix handling of .note.ABI-tag section for GNU systems [1].bz2009-08-241-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle GNU/Linux according to LSB Core Specification 4.0, Chapter 11. Object Format, 11.8. ABI note tag. Also check the first word of desc, not only name, according to glibc abi-tags specification to distinguish between Linux and kFreeBSD. Add explicit handling for Debian GNU/kFreeBSD, which runs on our kernels as well [2]. In {amd64,i386}/trap.c, when checking osrel of the current process, also check the ABI to not change the signal behaviour for Linux binary processes, now that we save an osrel version for all three from the lists above in struct proc [2]. These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD and Linux binaries on the same machine again for at least i386 and amd64, and no longer break kFreeBSD which was detected as GNU(/Linux). PR: kern/135468 Submitted by: dchagin [1] (initial patch) Suggested by: kib [2] Tested by: Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD Reviewed by: kib MFC after: 3 days
* Return ENOSYS instead of EINVAL for invalid function codes to match thejhb2009-06-261-4/+1
| | | | | | | behavior of Linux. Reported by: Alexander Best alexbestms of math.uni-muenster.de Approved by: re (kib)
* Implement accept4 syscall.dchagin2009-06-011-0/+1
| | | | | Approved by: kib (mentor) MFC after: 1 month
* Regenerate generated syscall files following changes to struct sysent inrwatson2009-06-011-317/+317
| | | | r193234.
* Somewhere between 2.6.23 and 2.6.27, Linux added SOCK_CLOEXEC anddchagin2009-05-161-0/+1
| | | | | | | | | | SOCK_NONBLOCK flags, that allow to save fcntl() calls. Implement a variation of the socket() syscall which takes a flags in addition to the type argument. Approved by: kib (mentor) MFC after: 1 month
* Do not export AT_CLKTCK when emulating Linux kernel priordchagin2009-05-101-1/+11
| | | | | | | | | | | | | | to 2.4.0, as it has appeared in the 2.4.0-rc7 first time. Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), glibc falls back to the hard-coded CLK_TCK value when aux entry is not present. Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value. For older applications/libc's which depends on hard-coded CLK_TCK value user should set compat.linux.osrelease less than 2.4.0. Approved by: kib (mentor)
* Rework r189362, r191883.dchagin2009-05-101-1/+2
| | | | | | | | | The frequency of the statistics clock is given by stathz. Use stathz if it is available, otherwise use hz. Pointed out by: bde Approved by: kib (mentor)
* Move the per-prison Linux MIB from a private one-off pointer to the newjamie2009-05-071-0/+2
| | | | | | | | | OSD-based jail extensions. This allows the Linux MIB to accessed via jail_set and jail_get, and serves as a demonstration of adding jail support to a module. Reviewed by: dchagin, kib Approved by: bz (mentor)
* To avoid excessive code duplication move MI definitions to the MIdchagin2009-05-071-8/+0
| | | | | | | header file. As it is defined in Linux. Approved by: kib (mentor) MFC after: 1 month
* Move extern variable definitions to the header file.dchagin2009-05-021-3/+1
| | | | | Approved by: kib (mentor) MFC after: 1 month
* Reimplement futexes.dchagin2009-05-011-3/+3
| | | | | | | | | | | | | | | | | | | | Old implemention used Giant to protect the kernel data structures, but at the same time called malloc(M_WAITOK), that could cause the calling thread to sleep and lost Giant protection. User-visible result was the missed wakeup. New implementation uses one sx lock per futex. The sx protects the futex structures and allows to sleep while copyin or copyout are performed. Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation is requested and either caller specified futexes are equial or second futex already exists. This is acceptable since the situation can only occur from the application error, and glibc falls back to old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error. Approved by: kib (mentor) MFC after: 1 month
* Fix KBI breakage by r190520 which affects older linux.ko binaries:dchagin2009-04-051-2/+2
| | | | | | | | | | | | | | 1) Move the new field (brand_note) to the end of the Brandinfo structure. 2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer is valid. 3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old modules won't have the flag set, so the new field brand_note would be ignored. Suggested by: jhb Reviewed by: jhb Approved by: kib (mentor) MFC after: 6 days
* Implement new way of branding ELF binaries by looking to adchagin2009-03-131-2/+14
| | | | | | | | | | | | ".note.ABI-tag" section. The search order of a brand is changed, now first of all the ".note.ABI-tag" is looked through. Move code which fetch osreldate for ELF binary to check_note() handler. PR: 118473 Approved by: kib (mentor)
* A better fix for handling different FPU initial control words for differentjhb2009-03-051-7/+3
| | | | | | | | | | | | | | | | ABIs: - Store the FPU initial control word in the pcb for each thread. - When first using the FPU, load the initial control word after restoring the clean state if it is not the standard control word. - Provide a correct control word for Linux/i386 binaries under FreeBSD/amd64. - Adjust the control word returned for fpugetregs()/npxgetregs() when a thread hasn't used the FPU yet to reflect the real initial control word for the current ABI. - The Linux/i386 ABI for FreeBSD/i386 now properly sets the right control word instead of trashing whatever the current state of the FPU is. Reviewed by: bde
* Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries whichdchagin2009-03-042-5/+165
| | | | | | | | | | | | | | are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" from some programs at start, among them are top and pkill. Do the assignment of the vector entries in elf_linux_fixup() as it is done in glibc. Fix some minor style issues. Submitted by: Marcin Cieslak <saper at SYSTEM PL> Approved by: kib (mentor) MFC after: 1 week
* Adapt linux emulation to use cv for vfork wait.kib2009-02-181-2/+2
| | | | | Submitted by: Takahiro Kurosawa <takahiro.kurosawa gmail com> PR: kern/131506
* Change some movl's to mov's. Newer GAS no longer accept 'movl' instructionsobrien2009-01-311-2/+2
| | | | | | for moving between a segment register and a 32-bit memory location. Looked at by: jhb
* Remove obsolete AT_DEBUG stuff. It never should have been committedimp2008-12-171-2/+0
| | | | | | in the first place, let alone migrated to linux emulation. Reviewed by: peter, rdivacky
* Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64.kib2008-11-291-0/+16
| | | | | | | | Change types used in the linux' struct msghdr and struct cmsghdr definitions to the properly-sized architecture-specific types. Move ancillary data handler from linux_sendit() to linux_sendmsg(). Submitted by: dchagin
* Add sv_flags field to struct sysentvec with intention to provide descriptionkib2008-11-221-2/+4
| | | | | | | | of the ABI of the currently executing image. Change some places to test the flags instead of explicit comparing with address of known sysentvec structures to determine ABI features. Discussed with: dchagin, imp, jhb, peter
* In the robust futexes list head, futex_offset shall be signed,kib2008-11-161-1/+1
| | | | | | and glibc actually supplies negative offsets. Change l_ulong to l_long. Submitted by: dchagin
* Several cleanups related to pipe(2).ed2008-11-111-15/+5
| | | | | | | | | | | | | | | | | | - Use `fildes[2]' instead of `*fildes' to make more clear that pipe(2) fills an array with two descriptors. - Remove EFAULT from the manual page. Because of the current calling convention, pipe(2) raises a segmentation fault when an invalid address is passed. - Introduce kern_pipe() to make it easier for binary emulations to implement pipe(2). - Make Linux binary emulation use kern_pipe(), which means we don't have to recover td_retval after calling the FreeBSD system call. Approved by: rdivacky Discussed on: arch
* Regenerate system call tables for r184789.ed2008-11-093-5/+11
|
* Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.ed2008-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Looking at our source code history, it seems the uname(), getdomainname() and setdomainname() system calls got deprecated somewhere after FreeBSD 1.1, but they have never been phased out properly. Because we don't have a COMPAT_FREEBSD1, just use COMPAT_FREEBSD4. Also fix the Linuxolator to build without the setdomainname() routine by just making it call userland_sysctl on kern.domainname. Also replace the setdomainname()'s implementation to use this approach, because we're duplicating code with sysctl_domainname(). I wasn't able to keep these three routines working in our COMPAT_FREEBSD32, because that would require yet another keyword for syscalls.master (COMPAT4+NOPROTO). Because this routine is probably unused already, this won't be a problem in practice. If it turns out to be a problem, we'll just restore this functionality. Reviewed by: rdivacky, kib
* Correctly fill siginfo for the signals delivered by linux tkill/tgkill.kib2008-10-192-14/+22
| | | | | | | | | | | | | | | | | | | | | It is required for async cancellation to work. Fix PROC_LOCK leak in linux_tgkill when signal delivery attempt is made to not linux process. Do not call em_find(p, ...) with p unlocked. Move common code for linux_tkill() and linux_tgkill() into linux_do_tkill(). Change linux siginfo_t definition to match actual linux one. Extend uid fields to 4 bytes from 2. The extension does not change structure layout and is binary compatible with previous definition, because i386 is little endian, and each uid field has 2 byte padding after it. Reported by: Nicolas Joly <njoly pasteur fr> Submitted by: dchangin MFC after: 1 month
* Make robust futexes work on linux32/amd64. Use PTRIN to readkib2008-10-141-0/+11
| | | | | | | | user-mode pointers. Change types used in the structures definitions to properly-sized architecture-specific types. Submitted by: dchagin MFC after: 1 week
* Change the static struct sysentvec and struct Elf_Brandinfo initializerskib2008-09-241-74/+76
| | | | | | | | | | | to the C99 style. At least, it is easier to read sysent definitions that way, and search for the actual instances of sigcode etc. Explicitely initialize sysentvec.sv_maxssiz that was missed in most sysvecs. No objection from: jhb MFC after: 1 month
* Segment registers are stored in the uc_mcontext member of the structkib2008-09-072-1/+3
| | | | | | | | | l_ucontext. To restore the registers content, trampoline needs to dereference uc_mcontext instead of taking some undefined values from l_ucontext. Submitted by: Dmitry Chagin <dchagin@> MFC after: 1 week
* Regen.rdivacky2008-05-133-7/+10
| | | | Approved by: kib (mentor)
* Implement robust futexes. Most of the code is modelled afterrdivacky2008-05-132-4/+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
* Implement linux_truncate64() syscall.rdivacky2008-04-231-1/+0
| | | | | Tested by: Aline de Freitas <aline@riseup.net> Approved by: kib (mentor)
* Regenerate.jkim2008-04-163-4/+46
|
* Add stubs for syscalls introduced in Linux 2.6.17 kernel.jkim2008-04-162-0/+12
| | | | | | Some GNU libc version started using them before 2.6.17 was officially out. MFC after: 3 days
* Regeneratekib2008-04-083-41/+73
|
* Implement the linux syscallskib2008-04-084-28/+25
| | | | | | | | | openat, mkdirat, mknodat, fchownat, futimesat, fstatat, unlinkat, renameat, linkat, symlinkat, readlinkat, fchmodat, faccessat. Submitted by: rdivacky Sponsored by: Google Summer of Code 2007 Tested by: pho
* Add the support for the AT_FDCWD and fd-relative name lookups to thekib2008-03-311-0/+1
| | | | | | | | | namei(9). Based on the submission by rdivacky, sponsored by Google Summer of Code 2007 Reviewed by: rwatson, rdivacky Tested by: pho
* Regen.rdivacky2008-03-163-4/+12
|
* Implement sched_setaffinity and get_setaffinity usingrdivacky2008-03-161-1/+2
| | | | | | | real cpu affinity setting primitives. Reviewed by: jeff Approved by: kib (mentor)
* Since version 4.3, gcc changed its behaviour concerning the i386/amd64kib2008-03-131-2/+2
| | | | | | | | | | | | | | | | | | ABI and the direction flag, that is it now assumes that the direction flag is cleared at the entry of a function and it doesn't clear once more if needed. This new behaviour conforms to the i386/amd64 ABI. Modify the signal handler frame setup code to clear the DF {e,r}flags bit on the amd64/i386 for the signal handlers. jhb@ noted that it might break old apps if they assumed DF == 1 would be preserved in the signal handlers, but that such apps should be rare and that older versions of gcc would not generate such apps. Submitted by: Aurelien Jarno <aurelien aurel32 net> PR: 121422 Reviewed by: jhb MFC after: 2 weeks
* Remove kernel support for M:N threading.jeff2008-03-121-2/+1
| | | | | | | | While the KSE project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the kse library was never developed to its full potential. Backwards compatibility will be provided via libmap.conf for dynamically linked binaries and static binaries will be broken.
* Fix Linux mmap with MAP_GROWSDOWN flag.jkim2008-02-111-14/+15
| | | | | | | Reported by: Andriy Gapon (avg at icyb dot net dot ua) Tested by: Andriy Gapon (avg at icyb dot net dot ua) Pointyhat: me MFC after: 3 days
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-131-2/+1
| | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-101-1/+1
| | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
* Implement read_default_ldt in linux_modify_ldt(). It copies out zeroedkib2007-11-261-0/+9
| | | | | | | | descriptor, like real Linux does. Tested by: Yuriy Tsibizov <yuriy.tsibizov at gmail com> Submitted by: rdivacky MFC after: 1 week
* Fix for the panic("vm_thread_new: kstack allocation failed") andkib2007-11-051-1/+3
| | | | | | | | | | | | | | | | | | | | silent NULL pointer dereference in the i386 and sparc64 pmap_pinit() when the kmem_alloc_nofault() failed to allocate address space. Both functions now return error instead of panicing or dereferencing NULL. As consequence, vmspace_exec() and vmspace_unshare() returns the errno int. struct vmspace arg was added to vm_forkproc() to avoid dealing with failed allocation when most of the fork1() job is already done. The kernel stack for the thread is now set up in the thread_alloc(), that itself may return NULL. Also, allocation of the first process thread is performed in the fork1() to properly deal with stack allocation failure. proc_linkup() is separated into proc_linkup() called from fork1(), and proc_linkup0(), that is used to set up the kernel process (was known as swapper). In collaboration with: Peter Holm Reviewed by: jhb
OpenPOWER on IntegriCloud