Commit Graph

1541 Commits

Author SHA1 Message Date
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
chs 6842940109 personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes.  for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
2010-11-02 18:18:07 +00:00
chs fc7a196102 implement the following syscalls for linux32:
truncate64
  ftruncate64
  profil
  ioperm
  iopl
  setdomainname
  modify_ldt
  statfs64
  fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
2010-11-02 18:14:05 +00:00
chs 3c3115da20 update linux_sys_socket() to understand the flags that are now
included in the "type" parameter.  in linux_sys_sendmsg(),
if we see an SCM_CREDENTIALS control message, just drop it
instead of giving an error.  the linux and native versions of
the cred-passing operation are very different and some apps
(eg. linux pulseaudio library talking to a native server)
will work without the control data.
2010-11-02 18:02:59 +00:00
chs 069ef5a4d0 define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
2010-11-02 18:01:25 +00:00
chs 38b9dc3505 implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
2010-09-21 19:26:18 +00:00
chs e0ef945cee recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same.  fixes part of PR 43695.
2010-09-11 20:53:04 +00:00
chs 590b90699b always supply an auxiliary vector for linux ELF processes.
static executables (such as newer versions of /sbin/ldconfig)
require this to work properly.  since static executables
also don't have a PT_PHDR entry, use the same heuristic as
linux does to provide a value for AT_PHDR in this case.
2010-09-11 20:49:28 +00:00
njoly 328f6885dc Add CLOCK_MONOTONIC support for compat linux/linux32
clock_nanosleep(2).
2010-07-12 12:01:53 +00:00
chs d916122e7d regen 2010-07-07 01:31:51 +00:00
chs 33fa5ccbbf many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
 - support new-style (NPTL) linux pthreads on all platforms.
   clone() with CLONE_THREAD uses 1 process with many LWPs
   instead of separate processes.
 - move the contents of sys__lwp_setprivate() into a new
   lwp_setprivate() and use that everywhere.
 - update linux_release[] and linux32_release[] to "2.6.18".
 - adjust placement of emul fork/exec/exit hooks as needed
   and adjust other emul code to match.
 - convert all struct emul definitions to use named initializers.
 - change the pid allocator to allow multiple pids to refer to the same proc.
 - remove a few fields from struct proc that are no longer needed.
 - disable the non-functional "vdso" code in linux32/amd64,
   glibc works fine without it.
 - fix a race in the futex code where we could miss a wakeup after
   a requeue operation.
 - redo futex locking to be a little more efficient.
2010-07-07 01:30:32 +00:00
rmind 3c507045e2 Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour.  Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
2010-07-01 02:38:26 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
joerg f5b7f56dbd Use struct segment_descriptor for pcb_fsd and pcb_gsd instead of int[2]. 2010-04-23 16:07:33 +00:00
chs e59be4800f regen 2010-04-23 03:03:03 +00:00
chs 822c314290 add missing argument to clone(). the symptom of this was that pthread_join()
would sometimes get stuck, such as in our "mutex2" regression test.
2010-04-23 03:02:16 +00:00
njoly e05f3d58b2 Do not use 0 for pointers, but NULL. 2010-04-08 15:59:37 +00:00
njoly 4f2ea8f3c9 Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
2010-04-08 11:51:13 +00:00
njoly 0876f873dd Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
2010-04-03 17:20:05 +00:00
njoly 6d63d66929 Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
2010-03-29 15:34:07 +00:00
he 7a30544200 When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
2010-03-03 08:20:38 +00:00
pooka a9b0264ca7 Nuke fs_lfs.h included for unknown reasons (if there was a reason
other than "accident", i hereby declare that reason invalid)
2010-03-02 15:46:19 +00:00
njoly db6e663a4c Small typo in comment. 2010-02-09 16:46:07 +00:00
wiz cc199107ab Remove extra parenthesis. Found by cppcheck, reported by
Henning Petersen in PR 42732.
2010-02-03 13:48:53 +00:00
wiz 11b7e600cb Missing printf in sys/compat/linux/arch/powerpc/linux_machdep.c
found by cppcheck and reported by Henning Petersen in PR 42720.
2010-02-02 15:02:07 +00:00
mbalmer 93f06d875c Remove extra semicolon. 2010-01-05 13:22:40 +00:00
matt 15aa4c53c9 Regen (new makesyscalls.sh) 2009-12-14 00:53:32 +00:00
matt e110dba586 Merge from matt-nb5-mips64 2009-12-14 00:47:10 +00:00
matt 6a9e4e8eeb Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds).  Should result in no code differences.
2009-12-10 14:13:48 +00:00
pooka 70d4493c77 Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs.  User functionality remains the same.
2009-12-05 20:11:01 +00:00
dsl ea4ea02d98 Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
2009-11-28 22:11:42 +00:00
njoly 4898628cc1 Regen for personality(2) update. 2009-11-24 10:44:41 +00:00
njoly 675b20da1b Update personality(2) to match Linux definition where the argument is an
unsigned long.
2009-11-24 10:42:43 +00:00
rmind eaddd78061 Use lwp_getpcb() in compat code, clean from struct user. 2009-11-23 00:46:06 +00:00
njoly 87483a8bda Make compat linux/linux32 msgrcv_msgarg type member of type
long/netbsd32_long to match linux definition.
2009-11-18 15:19:24 +00:00
joerg bf54b26c0c Make sure to never leak padding space before copyout or copyin
uninitialized fields by explicitly using memset in the conversion
routines.
2009-11-16 08:44:19 +00:00
joerg e7123f329a Return the result of copyout. Reminded by Niolas Joly. 2009-11-13 22:39:35 +00:00
joerg 8277e92195 Provide SIOCGIFNAME. 2009-11-13 21:45:03 +00:00
rmind 1283950019 - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
2009-11-11 09:48:50 +00:00
rmind 4c1098f541 do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden.  Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
2009-11-04 21:23:02 +00:00
njoly a135bd0847 Regen for struct linux_stat64 fix. 2009-10-30 10:58:15 +00:00
njoly e8df95dcb7 stat64 syscalls require struct linux_stat64. 2009-10-30 10:57:40 +00:00
rmind 554a0142dc Initialise struct emul members by name (it is readable now and one can search
them in the tree).
2009-10-25 01:14:03 +00:00
rmind 40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
taca 5a6dad0a4b Trying to fix build problem. Thanks to joerg's advise. 2009-09-20 10:29:30 +00:00
njoly 1e0366323b Use correct sched_setscheduler syscall 3rd argument type. 2009-09-03 17:15:17 +00:00
dholland dbb9a41442 Another one that needs <sys/exec_aout.h>. 2009-08-28 01:39:03 +00:00
drochner eec7391fde remove some "inline" from functions which are defined in a .c file
but used elsewhere -- gcc-4.4.1 doesn't like it and I doubt it
had any effect
2009-08-18 11:22:09 +00:00
christos f73ec80b69 more debugging for mmap 2009-08-18 02:04:14 +00:00
matt 7bb407d6e3 Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
2009-08-15 23:39:35 +00:00