Commit Graph

298 Commits

Author SHA1 Message Date
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
dholland 869e0ec654 Use uintptr_t instead of uint32_t as an intermediate stage when
casting from off_t to a pointer. This way it compiles in a 64-bit
world. Dunno if it'll work though with 64-bit mips kernel addresses,
which are in the negative range of 64-bit off_t.
2009-08-31 05:36:23 +00:00
dholland 97d7a71b45 Use uintptr_t instead of int when munging fcntl flags, which are
pointer-sized integers. Now builds in a 64-bit world, might even work :-)
2009-08-31 05:34:16 +00:00
tsutsui 296279ad74 pad -> PAD, to follow src/sys/kern/makesyscalls.sh rev 1.87. 2009-06-28 09:50:57 +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 c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +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
pooka 5d19acad62 Regen to prove I didn't screw up the conversion: purely RCSID changes. 2009-01-13 22:33:08 +00:00
pooka a9a2ce837b Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat).  Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
2009-01-13 22:27:43 +00:00
rumble 40019d9470 regen. 2009-01-11 20:00:14 +00:00
rumble 5e7d8a6495 Fix time_t change fallout. 2009-01-11 20:00:06 +00:00
cegger 53d5928d58 make this compile 2008-11-21 20:53:28 +00:00
ad 92ce8c6a3d Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
2008-11-19 18:35:57 +00:00
rmind 160268aca6 Remove proc_representative_lwp(), use a simple LIST_FIRST() instead.
OK by <ad>.
2008-07-02 19:49:58 +00:00
tnn 503997e388 Try to adapt the usema driver to new select/poll world order.
Also fix build with DEBUG_IRIX defined.
Fixes PR port-sgimips/38367 and makes GENERIC build again.
Only build tested because something else is still wrong with compat_irix.
2008-05-10 12:57:18 +00:00
tnn a1744e1285 Make it build, struct vfsops gained a member.
(Making compat_irix actually work again is a project for another day.)
2008-05-09 20:49:14 +00:00
ad 1074fa7182 Ignore processes with PK_MARKER set. 2008-04-29 15:55:24 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 284c2b9aef Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
2008-04-24 18:39:20 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
ad dd55791531 Regen. 2008-04-23 14:10:03 +00:00
ad 7cb840338e -SYCALL_MPSAFE 2008-04-23 14:07:49 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
tnn f85d89c5de v_interlock is a kmutex_t now, simple_lock() -> mutex_enter(). 2008-03-07 00:03:39 +00:00
rafal 77f8afb936 Adapt to renamelock_{enter, exit} addition to struct vfsops. 2008-01-29 04:06:46 +00:00
tsutsui ae2fa185c0 VOP_LEASE is gone. 2008-01-26 15:48:11 +00:00
tsutsui e44e8e02b0 Fix fallout from v_specinfo removal. 2008-01-26 15:37:35 +00:00
ad 1997a1e1f4 Remove VOP_LEASE. Discussed on tech-kern. 2008-01-25 14:32:11 +00:00
elad c27d5f30b6 Tons of process scope changes.
- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
    requests, and add specific requests for set/get scheduler policy and
    set/get scheduler parameters.

  - Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
    requests.

  - Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

  - Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
    process information is being looked at (entry itself, args, env,
    open files).

  - Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

  - Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

  - Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

  - Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
2008-01-23 15:04:38 +00:00
dsl f3df4c2289 include sys/simplock.h 2008-01-06 13:18:19 +00:00
dsl 95a195791a Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
2008-01-05 19:14:07 +00:00
dsl 6fb2884c3a regen 2007-12-20 23:07:25 +00:00
dsl 7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
dogcow 9ad45b39e6 more NDINIT fallout. not completely compile-tested. 2007-12-09 13:34:23 +00:00
dsl 28bae79b27 ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
2007-12-08 18:35:53 +00:00
ad 937533671d lockmgr -> rwlock 2007-12-06 14:53:35 +00:00
dsl f2af9174b9 Remove all the __P 2007-12-04 18:40:07 +00:00
pooka e49789dd46 more l removal 2007-11-28 18:50:10 +00:00
he 756f91194a Follow up the removal of the lwp argument to VOP_ functions.
In some cases, use curlwp instead of the now missing argument.
2007-11-28 10:34:37 +00:00
dogcow 3c143b9440 more lwp cacking fallout 2007-11-27 23:30:56 +00:00
he 525420f3c8 Remove a now-unused local variable. 2007-09-30 10:35:16 +00:00
dsl 2e20a70dbf Change the way p->p_limit (and hence p->p_rlimit) is locked.
Should fix PR/36939 and make the rlimit code MP safe.
Posted for comment to tech-kern (non received!)

The p_limit field (for a process) is only be changed once (on the first
  write), and a reference to the old structure is kept (for code paths
  that have cached the pointer).
Only p->p_limit is now locked by p->p_mutex, and since the referenced memory
  will not go away, is only needed if the pointer is to be changed.
The contents of 'struct plimit' are all locked by pl_mutex, except that the
  code doesn't bother to acquire it for reads (which are basically atomic).
Add FORK_SHARELIMIT that causes fork1() to share the limits between parent
  and child, use it for the IRIX_PR_SULIMIT.
Fix borked test for both IRIX_PR_SUMASK and IRIX_PR_SDIR being set.
2007-09-29 12:22:30 +00:00
dsl 4bacff8183 Rename members of 'struct plimit' so that the fields are 'pl_xxx' and
no longer have the same names as members of 'struct proc'.
2007-09-21 19:19:20 +00:00
dsl cfc71184cd Make thsi compile again after the recent changes to select/poll.
It really should be doing things properly though.
2007-07-13 20:46:04 +00:00
dsl 758f9f5cde Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
2007-07-12 19:41:57 +00:00
dsl 10b01b226a There is no need to copy data out to userspace when its address is being
passed to the driver as the ioctl 'data' argument.
Change boths parts to expect a kernel memory buffer.
2007-05-13 15:57:39 +00:00
dsl 06b3498b98 Fix compilation 2007-05-13 15:56:17 +00:00
dsl dc41e5b5bd Change the way the irix 32bit signal mask request is done to avoid the
stackgap.  I'm actually susre this code is buggy, possibly slightly less
so than before.
2007-05-13 15:39:29 +00:00
dsl 8beba9d093 There is no need to use the stackgap for get/setrlimit. 2007-05-12 21:07:02 +00:00
rumble 18ae6034fe Make this compile again (untested). 2007-05-11 02:25:34 +00:00