diff options
author | dillon <dillon@FreeBSD.org> | 2002-06-26 00:29:28 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-06-26 00:29:28 +0000 |
commit | ff4bf466480a64136e0e6a7758a29624eafbd106 (patch) | |
tree | a346a6d505627055a83c70b91c8751c9f2aa92ed /sys/vm/vm_unix.c | |
parent | b6fded0fafcf9aca9e1db60dc0d8d9ed9c48393e (diff) | |
download | FreeBSD-src-ff4bf466480a64136e0e6a7758a29624eafbd106.zip FreeBSD-src-ff4bf466480a64136e0e6a7758a29624eafbd106.tar.gz |
Part I of RLIMIT_VMEM implementation. Implement core functionality for
a new resource limit that covers a process's entire VM space, including
mmap()'d space.
(Part II will be additional code to check RLIMIT_VMEM during exec() but it
needs more fleshing out).
PR: kern/18209
Submitted by: Andrey Alekseyev <uitm@zenon.net>, Dmitry Kim <jason@nichego.net>
MFC after: 7 days
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r-- | sys/vm/vm_unix.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index bf932fd..1d02f39 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -107,6 +107,11 @@ obreak(td, uap) goto done; } if (new > old) { + if (vm->vm_map.size + (new - old) > + td->td_proc->p_rlimit[RLIMIT_VMEM].rlim_cur) { + error = ENOMEM; + goto done; + } rv = vm_map_insert(&vm->vm_map, NULL, 0, old, new, VM_PROT_ALL, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) { |