Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/tmpfs Make tmpfs write fail when process file size li...
details: https://anonhg.NetBSD.org/src/rev/fbeba45c0482
branches: trunk
changeset: 748227:fbeba45c0482
user: njoly <njoly%NetBSD.org@localhost>
date: Sat Oct 17 22:20:56 2009 +0000
description:
Make tmpfs write fail when process file size limit is reached.
diffstat:
sys/fs/tmpfs/tmpfs_vnops.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r a8804df77755 -r fbeba45c0482 sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 17 21:36:02 2009 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 17 22:20:56 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_vnops.c,v 1.63 2009/10/06 00:17:24 rmind Exp $ */
+/* $NetBSD: tmpfs_vnops.c,v 1.64 2009/10/17 22:20:56 njoly Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.63 2009/10/06 00:17:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.64 2009/10/17 22:20:56 njoly Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@@ -594,6 +594,7 @@
bool extended;
int error;
off_t oldsize;
+ struct proc *p = curproc;
struct tmpfs_node *node;
struct uvm_object *uobj;
@@ -612,6 +613,15 @@
goto out;
}
+ if (((uio->uio_offset + uio->uio_resid) >
+ p->p_rlimit[RLIMIT_FSIZE].rlim_cur)) {
+ mutex_enter(proc_lock);
+ psignal(p, SIGXFSZ);
+ mutex_exit(proc_lock);
+ error = EFBIG;
+ goto out;
+ }
+
if (ioflag & IO_APPEND)
uio->uio_offset = node->tn_size;
Home |
Main Index |
Thread Index |
Old Index