dovecot-2.1: Added restrict_get_fd_limit()
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 23 19:51:19 EET 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/0644361ca409
changeset: 13755:0644361ca409
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 23 19:51:01 2011 +0200
description:
Added restrict_get_fd_limit()
diffstat:
src/lib/restrict-process-size.c | 12 ++++++++++++
src/lib/restrict-process-size.h | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
diffs (30 lines):
diff -r deaebb4dc98c -r 0644361ca409 src/lib/restrict-process-size.c
--- a/src/lib/restrict-process-size.c Wed Nov 23 19:19:19 2011 +0200
+++ b/src/lib/restrict-process-size.c Wed Nov 23 19:51:01 2011 +0200
@@ -80,3 +80,15 @@
return -1;
#endif
}
+
+int restrict_get_fd_limit(rlim_t *limit_r)
+{
+ struct rlimit rlim;
+
+ if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
+ i_error("getrlimit(RLIMIT_NOFILE) failed: %m");
+ return -1;
+ }
+ *limit_r = rlim.rlim_cur;
+ return 0;
+}
diff -r deaebb4dc98c -r 0644361ca409 src/lib/restrict-process-size.h
--- a/src/lib/restrict-process-size.h Wed Nov 23 19:19:19 2011 +0200
+++ b/src/lib/restrict-process-size.h Wed Nov 23 19:51:01 2011 +0200
@@ -17,5 +17,7 @@
int restrict_get_core_limit(rlim_t *limit_r);
/* Get the process count limit. Returns 0 if ok, -1 if lookup failed. */
int restrict_get_process_limit(rlim_t *limit_r);
+/* Get the fd limit. Returns 0 if ok, -1 if lookup failed. */
+int restrict_get_fd_limit(rlim_t *limit_r);
#endif
More information about the dovecot-cvs
mailing list