Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+#include <sys/resource.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
INSTANCE_ATTR_ENV,
INSTANCE_ATTR_DATA,
INSTANCE_ATTR_NETDEV,
INSTANCE_ATTR_ENV,
INSTANCE_ATTR_DATA,
INSTANCE_ATTR_NETDEV,
[INSTANCE_ATTR_ENV] = { "env", BLOBMSG_TYPE_TABLE },
[INSTANCE_ATTR_DATA] = { "data", BLOBMSG_TYPE_TABLE },
[INSTANCE_ATTR_NETDEV] = { "netdev", BLOBMSG_TYPE_ARRAY },
[INSTANCE_ATTR_ENV] = { "env", BLOBMSG_TYPE_TABLE },
[INSTANCE_ATTR_DATA] = { "data", BLOBMSG_TYPE_TABLE },
[INSTANCE_ATTR_NETDEV] = { "netdev", BLOBMSG_TYPE_ARRAY },
+ [INSTANCE_ATTR_NICE] = { "nice", BLOBMSG_TYPE_INT32 },
};
struct instance_netdev {
};
struct instance_netdev {
int argc = 1; /* NULL terminated */
int rem;
int argc = 1; /* NULL terminated */
int rem;
+ if (in->nice)
+ setpriority(PRIO_PROCESS, 0, in->nice);
+
blobmsg_for_each_attr(cur, in->command, rem)
argc++;
blobmsg_for_each_attr(cur, in->command, rem)
argc++;
if (!blobmsg_list_equal(&in->netdev, &in_new->netdev))
return true;
if (!blobmsg_list_equal(&in->netdev, &in_new->netdev))
return true;
+ if (in->nice != in_new->nice)
+ return true;
+
+ if ((cur = tb[INSTANCE_ATTR_NICE])) {
+ in->nice = (int8_t) blobmsg_get_u32(cur);
+ if (in->nice < -20 || in->nice > 20)
+ return false;
+ }
+
if ((cur = tb[INSTANCE_ATTR_ENV])) {
if (!blobmsg_check_attr_list(cur, BLOBMSG_TYPE_STRING))
return false;
if ((cur = tb[INSTANCE_ATTR_ENV])) {
if (!blobmsg_check_attr_list(cur, BLOBMSG_TYPE_STRING))
return false;
struct service *srv;
const char *name;
struct service *srv;
const char *name;
bool valid;
bool restart;
bool valid;
bool restart;
struct blob_attr *config;
struct uloop_process proc;
struct uloop_timeout timeout;
struct blob_attr *config;
struct uloop_process proc;
struct uloop_timeout timeout;