summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-15 14:50:11 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-15 15:25:40 +0200
commit7bf411e4f60e80d835f65768df1041a79683f6ca (patch)
tree87f8f0990dd7820bdc9317571969c89265bc930e
parente8e09c9b8900fd47366b926ee90059e2926cb0bc (diff)
rlimit: RLIMIT_RTTIME is in usec, not nsec
We are taking the liberty not to bump the bus API. This should be unproblematic since it's only an auxiliary function, and not exported in any binary API (but is in a drop-in file).
-rw-r--r--README2
-rw-r--r--rtkit-daemon.c28
-rw-r--r--rtkit-test.c8
-rw-r--r--rtkit.c6
-rw-r--r--rtkit.h2
5 files changed, 23 insertions, 23 deletions
diff --git a/README b/README
index 206773d..df98529 100644
--- a/README
+++ b/README
@@ -163,7 +163,7 @@ DAEMON:
system is overloaded already handing out further RT scheduling
will be delayed a bit.
- --rttime-nsec-max= may be used to control which RLIMIT_RTTIME
+ --rttime-usec-max= may be used to control which RLIMIT_RTTIME
value clients need to have chosen at minumum before they may
acquire RT scheduling through RealtimeKit.
diff --git a/rtkit-daemon.c b/rtkit-daemon.c
index c8f630a..3da800f 100644
--- a/rtkit-daemon.c
+++ b/rtkit-daemon.c
@@ -92,7 +92,7 @@
" <method name=\"ResetKnown\"/>\n" \
" <method name=\"ResetAll\"/>\n" \
" <method name=\"Exit\"/>\n" \
- " <property name=\"RTTimeNSecMax\" type=\"x\" access=\"read\"/>\n" \
+ " <property name=\"RTTimeUSecMax\" type=\"x\" access=\"read\"/>\n" \
" <property name=\"MaxRealtimePriority\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"MinNiceLevel\" type=\"i\" access=\"read\"/>\n" \
" </interface>\n" \
@@ -139,7 +139,7 @@ static int min_nice_level = -15;
static const char *username = "rtkit";
/* Enforce that clients have RLIMIT_RTTIME set to a value <= this */
-static unsigned long long rttime_nsec_max = 200000000ULL; /* 200 ms */
+static unsigned long long rttime_usec_max = 200000ULL; /* 200 ms */
/* How many users do we supervise at max? */
static unsigned users_max = 2048;
@@ -662,7 +662,7 @@ static int verify_process_rttime(struct process *p) {
if (errno != 0 || !e || *e != 0)
break;
- if (rttime <= rttime_nsec_max)
+ if (rttime <= rttime_usec_max)
good = true;
break;
@@ -1292,8 +1292,8 @@ static void add_variant(
}
static int handle_dbus_prop_get(const char* property, DBusMessage *r) {
- if (strcmp(property, "RTTimeNSecMax") == 0)
- add_variant(r, DBUS_TYPE_INT64, &rttime_nsec_max);
+ if (strcmp(property, "RTTimeUSecMax") == 0)
+ add_variant(r, DBUS_TYPE_INT64, &rttime_usec_max);
else if (strcmp(property, "MaxRealtimePriority") == 0)
add_variant(r, DBUS_TYPE_INT32, &max_realtime_priority);
else if (strcmp(property, "MinNiceLevel") == 0)
@@ -1863,7 +1863,7 @@ static int set_resource_limits(void) {
int r;
assert(table[7].id == RLIMIT_RTTIME);
- table[7].value = rttime_nsec_max; /* Do as I say AND do as I do */
+ table[7].value = rttime_usec_max; /* Do as I say AND do as I do */
if (!do_limit_resources)
return 0;
@@ -1903,7 +1903,7 @@ enum {
ARG_MAX_REALTIME_PRIORITY,
ARG_MIN_NICE_LEVEL,
ARG_USER_NAME,
- ARG_RTTIME_NSEC_MAX,
+ ARG_RTTIME_USEC_MAX,
ARG_USERS_MAX,
ARG_PROCESSES_PER_USER_MAX,
ARG_THREADS_PER_USER_MAX,
@@ -1932,7 +1932,7 @@ static const struct option long_options[] = {
{ "max-realtime-priority", required_argument, 0, ARG_MAX_REALTIME_PRIORITY },
{ "min-nice-level", required_argument, 0, ARG_MIN_NICE_LEVEL },
{ "user-name", required_argument, 0, ARG_USER_NAME },
- { "rttime-nsec-max", required_argument, 0, ARG_RTTIME_NSEC_MAX },
+ { "rttime-usec-max", required_argument, 0, ARG_RTTIME_USEC_MAX },
{ "users-max", required_argument, 0, ARG_USERS_MAX },
{ "processes-per-user-max", required_argument, 0, ARG_PROCESSES_PER_USER_MAX },
{ "threads-per-user-max", required_argument, 0, ARG_THREADS_PER_USER_MAX },
@@ -1982,7 +1982,7 @@ static void show_help(const char *exe) {
" --our-nice-level=[%i..%i] Nice level for the daemon (%i)\n"
" --max-realtime-priority=[%i..%i] Max realtime priority for clients (%u)\n"
" --min-nice-level=[%i..%i] Min nice level for clients (%i)\n\n"
- " --rttime-nsec-max=NSEC Require clients to have set RLIMIT_RTTIME\n"
+ " --rttime-usec-max=USEC Require clients to have set RLIMIT_RTTIME\n"
" not greater than this (%llu)\n\n"
" --users-max=INT How many users this daemon will serve at\n"
" max at the same time (%u)\n"
@@ -2011,7 +2011,7 @@ static void show_help(const char *exe) {
PRIO_MIN, PRIO_MAX-1, our_nice_level,
sched_get_priority_min(sched_policy), sched_get_priority_max(sched_policy), max_realtime_priority,
PRIO_MIN, PRIO_MAX-1, min_nice_level,
- rttime_nsec_max,
+ rttime_usec_max,
users_max,
processes_per_user_max,
threads_per_user_max,
@@ -2113,13 +2113,13 @@ static int parse_command_line(int argc, char *argv[], int *ret) {
break;
}
- case ARG_RTTIME_NSEC_MAX: {
+ case ARG_RTTIME_USEC_MAX: {
char *e = NULL;
errno = 0;
- rttime_nsec_max = strtoull(optarg, &e, 0);
- if (errno != 0 || !e || *e || rttime_nsec_max <= 0) {
- fprintf(stderr, "--rttime-nsec-max parameter invalid.\n");
+ rttime_usec_max = strtoull(optarg, &e, 0);
+ if (errno != 0 || !e || *e || rttime_usec_max <= 0) {
+ fprintf(stderr, "--rttime-usec-max parameter invalid.\n");
return -1;
}
break;
diff --git a/rtkit-test.c b/rtkit-test.c
index a6b79df..01f7684 100644
--- a/rtkit-test.c
+++ b/rtkit-test.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[]) {
DBusError error;
DBusConnection *bus;
int r, max_realtime_priority, min_nice_level;
- long long rttime_nsec_max;
+ long long rttime_usec_max;
struct rlimit rlim;
dbus_error_init(&error);
@@ -97,10 +97,10 @@ int main(int argc, char *argv[]) {
else
printf("Min nice level is: %d\n", min_nice_level);
- if ((rttime_nsec_max = rtkit_get_rttime_nsec_max(bus)) < 0)
- fprintf(stderr, "Failed to retrieve rttime limit: %s\n", strerror(-rttime_nsec_max));
+ if ((rttime_usec_max = rtkit_get_rttime_usec_max(bus)) < 0)
+ fprintf(stderr, "Failed to retrieve rttime limit: %s\n", strerror(-rttime_usec_max));
else
- printf("Rttime limit is: %lld ns\n", rttime_nsec_max);
+ printf("Rttime limit is: %lld ns\n", rttime_usec_max);
memset(&rlim, 0, sizeof(rlim));
rlim.rlim_cur = rlim.rlim_max = 100000000ULL; /* 100ms */
diff --git a/rtkit.c b/rtkit.c
index 77731d9..a7dc3d9 100644
--- a/rtkit.c
+++ b/rtkit.c
@@ -155,11 +155,11 @@ int rtkit_get_min_nice_level(DBusConnection *connection, int* min_nice_level) {
return err;
}
-long long rtkit_get_rttime_nsec_max(DBusConnection *connection) {
+long long rtkit_get_rttime_usec_max(DBusConnection *connection) {
long long retval;
int err;
- err = rtkit_get_int_property(connection, "RTTimeNSecMax", &retval);
+ err = rtkit_get_int_property(connection, "RTTimeUSecMax", &retval);
return err < 0 ? err : retval;
}
@@ -301,7 +301,7 @@ int rtkit_get_min_nice_level(DBusConnection *connection, int* min_nice_level) {
return -ENOTSUP;
}
-long long rtkit_get_rttime_nsec_max(DBusConnection *connection) {
+long long rtkit_get_rttime_usec_max(DBusConnection *connection) {
return -ENOTSUP;
}
diff --git a/rtkit.h b/rtkit.h
index 2b5b2c2..ac4d599 100644
--- a/rtkit.h
+++ b/rtkit.h
@@ -69,7 +69,7 @@ int rtkit_get_min_nice_level(DBusConnection *system_bus, int* min_nice_level);
/* Return the maximum value of RLIMIT_RTTIME to set before attempting a
* realtime request. A negative value is an errno style error code.
*/
-long long rtkit_get_rttime_nsec_max(DBusConnection *system_bus);
+long long rtkit_get_rttime_usec_max(DBusConnection *system_bus);
#ifdef __cplusplus