Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/lib/libperfuse Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/80066e467b8a
branches: netbsd-7
changeset: 799544:80066e467b8a
user: snj <snj%NetBSD.org@localhost>
date: Thu Aug 06 21:52:13 2015 +0000
description:
Pull up following revision(s) (requested by christos in ticket #923):
lib/libperfuse/perfuse.c: revision 1.37
Deal with limits properly.
Don't print strerror() 2ice.
XXX: pullup-7
diffstat:
lib/libperfuse/perfuse.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diffs (63 lines):
diff -r 0154d9f6072a -r 80066e467b8a lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c Thu Aug 06 21:50:36 2015 +0000
+++ b/lib/libperfuse/perfuse.c Thu Aug 06 21:52:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfuse.c,v 1.31.10.4 2015/02/27 19:39:56 martin Exp $ */
+/* $NetBSD: perfuse.c,v 1.31.10.5 2015/08/06 21:52:13 snj Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -391,6 +391,27 @@
return ps->ps_unique++;
}
+static void
+updatelimit(const char *func, int lim, const char *name)
+{
+ struct rlimit rl;
+
+ /* Try infinity but that will fail unless we are root */
+ rl.rlim_cur = RLIM_INFINITY;
+ rl.rlim_max = RLIM_INFINITY;
+ if (setrlimit(lim, &rl) != -1)
+ return;
+
+ /* Get and set to the maximum allowed */
+ if (getrlimit(lim, &rl) == -1)
+ DERR(EX_OSERR, "%s: getrlimit %s failed", func, name);
+
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(lim, &rl) == -1)
+ DERR(EX_OSERR, "%s: setrlimit %s to %ju failed", func,
+ name, (uintmax_t)rl.rlim_cur);
+}
+
struct puffs_usermount *
perfuse_init(struct perfuse_callbacks *pc, struct perfuse_mount_info *pmi)
{
@@ -402,23 +423,12 @@
unsigned int puffs_flags;
struct puffs_node *pn_root;
struct puffs_pathobj *po_root;
- struct rlimit rl;
/*
* perfused can grow quite large, let assume there's enough ram ...
*/
- rl.rlim_cur = RLIM_INFINITY;
- rl.rlim_max = RLIM_INFINITY;
-
- if (setrlimit(RLIMIT_DATA, &rl) < 0) {
- DERR(EX_OSERR, "%s: setrlimit failed: %s", __func__,
- strerror(errno));
- }
-
- if (setrlimit(RLIMIT_AS, &rl) < 0) {
- DERR(EX_OSERR, "%s: setrlimit failed: %s", __func__,
- strerror(errno));
- }
+ updatelimit(__func__, RLIMIT_DATA, "RLIMIT_DATA");
+ updatelimit(__func__, RLIMIT_AS, "RLIMIT_AS");
ps = init_state();
ps->ps_owner_uid = pmi->pmi_uid;
Home |
Main Index |
Thread Index |
Old Index