Commit Graph

836 Commits

Author SHA1 Message Date
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
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
675b20da1b Update personality(2) to match Linux definition where the argument is an
unsigned long.
2009-11-24 10:42:43 +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
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
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
haad
5200b9b492 Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
2009-08-09 22:49:00 +00:00
njoly
3d5d2c8f61 Make compat linux/linux32 getdents(2) fail with ENOTDIR instead of
EINVAL when file descriptor does not refer to a directory.
2009-07-22 15:49:29 +00:00
njoly
dd5f408241 Do reject unknown/invalid linux clockid. 2009-07-21 18:42:56 +00:00
dholland
effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
njoly
de2e7a9c8e sched_getaffinity(2) update:
- dynamically calculate the cpu mask size,
- return it upon success,
- fix generated cpu mask.
2009-06-23 13:18:59 +00:00
njoly
9edecd8c07 In linux_sys_sched_getaffinity(), do not leak memory on error. 2009-06-18 20:36:28 +00:00
njoly
f50c7f6eb2 Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
2009-06-17 14:18:51 +00:00
njoly
cb90fdddc4 Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the
msg_controllen size, when converting the control message buffer from
native (previous version was missing the linux_cmsghdr size).
2009-06-16 23:17:02 +00:00
njoly
83618982c2 For linux cmsg header copyout, use the linux structure size, not the
native one.
2009-06-16 22:56:49 +00:00
njoly
405a83b592 Make compat linux sendmsg/recvmsg output msghdr and control messages
buffers with ktrace(1), just like the native functions.
2009-06-16 15:56:10 +00:00
njoly
198ddcca4b In sendmsg(2), do copy the msghdr structure before trying to use it. 2009-06-11 19:57:58 +00:00
njoly
a9b9e78076 Small rt_queueinfo(2) update, to require a linux_siginfo structure.
While here, cleanup ifdef out argument types.
2009-06-08 13:23:16 +00:00
njoly
5932e6a6cd Add the mask value returned by siggetmask. 2009-06-02 16:53:07 +00:00
njoly
7c47c56d95 Make nice(2) return EPERM on error, not EACCES (from sys_setpriority). 2009-06-02 13:00:23 +00:00
njoly
d22e6f64ab Add native to linux siginfo si_status translation, used on i386 and
amd64.
2009-05-29 14:19:12 +00:00
pooka
dfb36ab4e4 pad -> PAD 2009-05-15 16:59:07 +00:00
njoly
d3dabe1260 Add IPC_64 support for all semctl(2)/msgctl(2). Needed, at least on
i386 for Linux 2.6 emulation.
2009-04-23 17:40:57 +00:00
christos
2b1b4bc6ef Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
2009-03-29 19:21:19 +00:00
mrg
fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
cegger
9fca5da616 ansify function definitions 2009-03-15 15:55:51 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
christos
7fd1fc871c fix robust_list pointer mess! 2009-03-14 20:18:27 +00:00
rmind
f54234d142 Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490.  Reviewed by <ad>.
2009-02-23 20:28:58 +00:00
njoly
dc871322e1 Do not protect native_to_linux_si_code() under LINUX_NPTL anymore, now
that linux si_code definitions are MI.
2009-02-18 14:43:22 +00:00
njoly
a1cf1f2eab Add IPC_64 support for all shmctl(2) commands, not only for STAT/SET.
This make it work on i386 under 2.6 emulation.
2009-02-18 14:30:43 +00:00
njoly
0ebed1143f Small personality(2) update.
- Allow querying current personality.
- Use symbolic names instead of magic values.
2009-01-19 13:31:40 +00:00
njoly
25a76c08aa Convert linux/linux32 wait(4) to use a compat50 rusage structure. 2009-01-17 22:28:52 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
njoly
16cef148ad Restore expected FUTEX_WAIT behaviour with NULL timeout argument,
which was broken in my recent timespec cleanup/fix.
2009-01-08 12:46:23 +00:00