chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
man: update systemctl man page
[elogind.git]
/
src
/
util.c
diff --git
a/src/util.c
b/src/util.c
index 41d8e7f999eeaffaf695d06bcbeea22e34ca9531..ea8bfc198457f554b678a41f63f65d44ac3410fa 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-46,6
+46,7
@@
#include <sys/prctl.h>
#include <sys/utsname.h>
#include <pwd.h>
#include <sys/prctl.h>
#include <sys/utsname.h>
#include <pwd.h>
+#include <netinet/ip.h>
#include "macro.h"
#include "util.h"
#include "macro.h"
#include "util.h"
@@
-2537,6
+2538,34
@@
int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
return 0;
}
return 0;
}
+cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
+ cpu_set_t *r;
+ unsigned n = 1024;
+
+ /* Allocates the cpuset in the right size */
+
+ for (;;) {
+ if (!(r = CPU_ALLOC(n)))
+ return NULL;
+
+ if (sched_getaffinity(0, CPU_ALLOC_SIZE(n), r) >= 0) {
+ CPU_ZERO_S(CPU_ALLOC_SIZE(n), r);
+
+ if (ncpus)
+ *ncpus = n;
+
+ return r;
+ }
+
+ CPU_FREE(r);
+
+ if (errno != EINVAL)
+ return NULL;
+
+ n *= 2;
+ }
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
@@
-2625,3
+2654,12
@@
static const char* const rlimit_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP(rlimit, int);
};
DEFINE_STRING_TABLE_LOOKUP(rlimit, int);
+
+static const char* const ip_tos_table[] = {
+ [IPTOS_LOWDELAY] = "low-delay",
+ [IPTOS_THROUGHPUT] = "throughput",
+ [IPTOS_RELIABILITY] = "reliability",
+ [IPTOS_LOWCOST] = "low-cost",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(ip_tos, int);