diff options
author | Colin Walters <walters@verbum.org> | 2011-01-31 15:22:14 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2011-02-03 13:25:34 -0500 |
commit | 66a09fa7c3c8e4232b4225c49d01d9efb97458c9 (patch) | |
tree | fc1d6d281bd48532ccc9af33dd6c76a74af5b14f /bus/bus.c | |
parent | a0e8ae3b77e5ec33e5661f82320cdef4466a9f9d (diff) |
bus: Raise file descriptor limit to match configuration
The default configuration has hardcoded 2048 complete connections,
and 64 incomplete. We need at least that number of file descriptors,
plus some for internal use.
In the bus, attempt to call setrlimit() before we drop privileges.
Practically speaking for this means the system bus gets it, the
session bus doesn't.
http://bugs.freedesktop.org/show_bug.cgi?id=33474
Reviewed-By: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/bus.c')
-rw-r--r-- | bus/bus.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -644,6 +644,24 @@ oom: return FALSE; } +static void +raise_file_descriptor_limit (BusContext *context) +{ + + /* I just picked this out of thin air; we need some extra + * descriptors for things like any internal pipes we create, + * inotify, connections to SELinux, etc. + */ + unsigned int arbitrary_extra_fds = 32; + unsigned int limit; + + limit = context->limits.max_completed_connections + + context->limits.max_incomplete_connections + + arbitrary_extra_fds; + + _dbus_request_file_descriptor_limit (limit); +} + static dbus_bool_t process_config_postinit (BusContext *context, BusConfigParser *parser, @@ -652,6 +670,8 @@ process_config_postinit (BusContext *context, DBusHashTable *service_context_table; DBusList *watched_dirs = NULL; + raise_file_descriptor_limit (context); + service_context_table = bus_config_parser_steal_service_context_table (parser); if (!bus_registry_set_service_context_table (context->registry, service_context_table)) |