Fix #45: add support for rlimit per service/run/task/inetd/tty

This patch extends the existing rlimit implementation to support setting
limits per service, run/task, inetd, and tty.

Use rlimit in /etc/finit.conf to change the global setting, which is
then inherited to each /etc/finit.d/*.conf.  For each .conf file the
rlimit is reinitialized to the global finit.conf settings.

Also, add `unlimited` keyword, to replace the now deprecated `infinity`
keyword.  The latter is however kept, for compatibility with previous
releases, for the foreseeable future.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-11-26 16:35:37 +01:00
1 parent 44007c86f2
commit b68c5c1291
12 files changed
+154 -76

No files matched your search

+5 -1
View File
@@ -26,6 +26,7 @@
#define FINIT_TTY_H_
#include <limits.h>
#include <sys/resource.h>
#include <lite/queue.h> /* BSD sys/queue.h API */
#define TTY_MAX_ARGS 16
@@ -43,6 +44,9 @@ typedef struct {
char *args[TTY_MAX_ARGS];
int pid;
/* Limits and scoping */
struct rlimit rlimit[RLIMIT_NLIMITS];
} finit_tty_t;
typedef struct tty_node {
@@ -61,7 +65,7 @@ void tty_mark (void);
void tty_check (tty_node_t *tty, struct timeval *mtime);
void tty_sweep (void);
int tty_register (char *line, struct timeval *mtime);
int tty_register (char *line, struct rlimit rlimit[], struct timeval *mtime);
int tty_unregister (tty_node_t *tty);
tty_node_t *tty_find (char *dev);