mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
missing: if RLIMIT_RTTIME is not defined by the libc, then we need a new define for the max number of rlimits, too
This commit is contained in:
parent
a049d1a972
commit
517d56b1d0
@ -1676,7 +1676,7 @@ int exec_spawn(ExecCommand *command,
|
|||||||
|
|
||||||
if (apply_permissions) {
|
if (apply_permissions) {
|
||||||
|
|
||||||
for (i = 0; i < RLIMIT_NLIMITS; i++) {
|
for (i = 0; i < _RLIMIT_MAX; i++) {
|
||||||
if (!context->rlimit[i])
|
if (!context->rlimit[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ typedef struct ExecRuntime ExecRuntime;
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "fdset.h"
|
#include "fdset.h"
|
||||||
|
#include "missing.h"
|
||||||
|
|
||||||
typedef enum ExecInput {
|
typedef enum ExecInput {
|
||||||
EXEC_INPUT_NULL,
|
EXEC_INPUT_NULL,
|
||||||
@ -93,7 +94,7 @@ struct ExecContext {
|
|||||||
char **environment;
|
char **environment;
|
||||||
char **environment_files;
|
char **environment_files;
|
||||||
|
|
||||||
struct rlimit *rlimit[RLIMIT_NLIMITS];
|
struct rlimit *rlimit[_RLIMIT_MAX];
|
||||||
char *working_directory, *root_directory;
|
char *working_directory, *root_directory;
|
||||||
|
|
||||||
mode_t umask;
|
mode_t umask;
|
||||||
|
@ -105,7 +105,7 @@ static unsigned arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
|
|||||||
static usec_t arg_runtime_watchdog = 0;
|
static usec_t arg_runtime_watchdog = 0;
|
||||||
static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
|
static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
|
||||||
static char **arg_default_environment = NULL;
|
static char **arg_default_environment = NULL;
|
||||||
static struct rlimit *arg_default_rlimit[RLIMIT_NLIMITS] = {};
|
static struct rlimit *arg_default_rlimit[_RLIMIT_MAX] = {};
|
||||||
static uint64_t arg_capability_bounding_set_drop = 0;
|
static uint64_t arg_capability_bounding_set_drop = 0;
|
||||||
static nsec_t arg_timer_slack_nsec = (nsec_t) -1;
|
static nsec_t arg_timer_slack_nsec = (nsec_t) -1;
|
||||||
static Set* arg_syscall_archs = NULL;
|
static Set* arg_syscall_archs = NULL;
|
||||||
|
@ -810,7 +810,7 @@ void manager_free(Manager *m) {
|
|||||||
free(m->switch_root);
|
free(m->switch_root);
|
||||||
free(m->switch_root_init);
|
free(m->switch_root_init);
|
||||||
|
|
||||||
for (i = 0; i < RLIMIT_NLIMITS; i++)
|
for (i = 0; i < _RLIMIT_MAX; i++)
|
||||||
free(m->rlimit[i]);
|
free(m->rlimit[i]);
|
||||||
|
|
||||||
assert(hashmap_isempty(m->units_requiring_mounts_for));
|
assert(hashmap_isempty(m->units_requiring_mounts_for));
|
||||||
@ -2728,7 +2728,7 @@ int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit) {
|
|||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
for (i = 0; i < RLIMIT_NLIMITS; i++) {
|
for (i = 0; i < _RLIMIT_MAX; i++) {
|
||||||
if (!default_rlimit[i])
|
if (!default_rlimit[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ struct Manager {
|
|||||||
bool default_memory_accounting;
|
bool default_memory_accounting;
|
||||||
bool default_blockio_accounting;
|
bool default_blockio_accounting;
|
||||||
|
|
||||||
struct rlimit *rlimit[RLIMIT_NLIMITS];
|
struct rlimit *rlimit[_RLIMIT_MAX];
|
||||||
|
|
||||||
/* non-zero if we are reloading or reexecuting, */
|
/* non-zero if we are reloading or reexecuting, */
|
||||||
int n_reloading;
|
int n_reloading;
|
||||||
|
@ -2803,7 +2803,7 @@ int unit_exec_context_patch_defaults(Unit *u, ExecContext *c) {
|
|||||||
* _after_ the rest of the settings have been initialized */
|
* _after_ the rest of the settings have been initialized */
|
||||||
|
|
||||||
/* This only copies in the ones that need memory */
|
/* This only copies in the ones that need memory */
|
||||||
for (i = 0; i < RLIMIT_NLIMITS; i++)
|
for (i = 0; i < _RLIMIT_MAX; i++)
|
||||||
if (u->manager->rlimit[i] && !c->rlimit[i]) {
|
if (u->manager->rlimit[i] && !c->rlimit[i]) {
|
||||||
c->rlimit[i] = newdup(struct rlimit, u->manager->rlimit[i], 1);
|
c->rlimit[i] = newdup(struct rlimit, u->manager->rlimit[i], 1);
|
||||||
if (!c->rlimit[i])
|
if (!c->rlimit[i])
|
||||||
|
@ -47,6 +47,9 @@
|
|||||||
#define RLIMIT_RTTIME 15
|
#define RLIMIT_RTTIME 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
|
||||||
|
#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
|
||||||
|
|
||||||
#ifndef F_LINUX_SPECIFIC_BASE
|
#ifndef F_LINUX_SPECIFIC_BASE
|
||||||
#define F_LINUX_SPECIFIC_BASE 1024
|
#define F_LINUX_SPECIFIC_BASE 1024
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
#include "gunicode.h"
|
#include "gunicode.h"
|
||||||
#include "virt.h"
|
#include "virt.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
#include "missing.h"
|
||||||
|
|
||||||
int saved_argc = 0;
|
int saved_argc = 0;
|
||||||
char **saved_argv = NULL;
|
char **saved_argv = NULL;
|
||||||
@ -4713,7 +4714,7 @@ static const char* const sched_policy_table[] = {
|
|||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(sched_policy, int, INT_MAX);
|
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(sched_policy, int, INT_MAX);
|
||||||
|
|
||||||
static const char* const rlimit_table[] = {
|
static const char* const rlimit_table[_RLIMIT_MAX] = {
|
||||||
[RLIMIT_CPU] = "LimitCPU",
|
[RLIMIT_CPU] = "LimitCPU",
|
||||||
[RLIMIT_FSIZE] = "LimitFSIZE",
|
[RLIMIT_FSIZE] = "LimitFSIZE",
|
||||||
[RLIMIT_DATA] = "LimitDATA",
|
[RLIMIT_DATA] = "LimitDATA",
|
||||||
|
Loading…
Reference in New Issue
Block a user