mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-27 22:25:19 +07:00
childs -> children
This commit is contained in:
parent
88cbfb09ee
commit
87d55ff672
@ -32,8 +32,7 @@ enum udev_ctrl_msg_type {
|
|||||||
UDEV_CTRL_START_EXEC_QUEUE,
|
UDEV_CTRL_START_EXEC_QUEUE,
|
||||||
UDEV_CTRL_RELOAD_RULES,
|
UDEV_CTRL_RELOAD_RULES,
|
||||||
UDEV_CTRL_SET_ENV,
|
UDEV_CTRL_SET_ENV,
|
||||||
UDEV_CTRL_SET_MAX_CHILDS,
|
UDEV_CTRL_SET_CHILDREN_MAX,
|
||||||
UDEV_CTRL_SET_MAX_CHILDS_RUNNING,
|
|
||||||
UDEV_CTRL_SETTLE,
|
UDEV_CTRL_SETTLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,9 +184,9 @@ int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key)
|
|||||||
return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key);
|
return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count)
|
int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count)
|
||||||
{
|
{
|
||||||
return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL);
|
return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int udev_ctrl_send_settle(struct udev_ctrl *uctrl)
|
int udev_ctrl_send_settle(struct udev_ctrl *uctrl)
|
||||||
@ -306,9 +305,9 @@ const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg)
|
int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg)
|
||||||
{
|
{
|
||||||
if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_MAX_CHILDS)
|
if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX)
|
||||||
return ctrl_msg->ctrl_msg_wire.intval;
|
return ctrl_msg->ctrl_msg_wire.intval;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl);
|
|||||||
int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl);
|
int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl);
|
||||||
int udev_ctrl_send_settle(struct udev_ctrl *uctrl);
|
int udev_ctrl_send_settle(struct udev_ctrl *uctrl);
|
||||||
int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key);
|
int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key);
|
||||||
int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count);
|
int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count);
|
||||||
struct udev_ctrl_msg;
|
struct udev_ctrl_msg;
|
||||||
struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl);
|
struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl);
|
||||||
struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl);
|
struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl);
|
||||||
@ -139,7 +139,7 @@ int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg);
|
|||||||
int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg);
|
int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg);
|
||||||
pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg);
|
pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg);
|
||||||
const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
|
const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
|
||||||
int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg);
|
int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg);
|
||||||
|
|
||||||
/* libudev-list.c */
|
/* libudev-list.c */
|
||||||
struct udev_list_node {
|
struct udev_list_node {
|
||||||
|
@ -454,7 +454,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
|
|||||||
if (errpipe[READ_END] > 0)
|
if (errpipe[READ_END] > 0)
|
||||||
close(errpipe[READ_END]);
|
close(errpipe[READ_END]);
|
||||||
|
|
||||||
/* return the childs stdout string */
|
/* return the child's stdout string */
|
||||||
if (result) {
|
if (result) {
|
||||||
result[respos] = '\0';
|
result[respos] = '\0';
|
||||||
dbg(udev, "result='%s'\n", result);
|
dbg(udev, "result='%s'\n", result);
|
||||||
|
@ -35,7 +35,7 @@ static void print_help(void)
|
|||||||
" --start-exec-queue execute events, flush queue\n"
|
" --start-exec-queue execute events, flush queue\n"
|
||||||
" --reload-rules reloads the rules files\n"
|
" --reload-rules reloads the rules files\n"
|
||||||
" --property=<KEY>=<value> set a global property for all events\n"
|
" --property=<KEY>=<value> set a global property for all events\n"
|
||||||
" --max-childs=<N> maximum number of childs\n"
|
" --children-max=<N> maximum number of children\n"
|
||||||
" --help print this help text\n\n");
|
" --help print this help text\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[])
|
|||||||
{ "reload-rules", no_argument, NULL, 'R' },
|
{ "reload-rules", no_argument, NULL, 'R' },
|
||||||
{ "property", required_argument, NULL, 'p' },
|
{ "property", required_argument, NULL, 'p' },
|
||||||
{ "env", required_argument, NULL, 'p' },
|
{ "env", required_argument, NULL, 'p' },
|
||||||
{ "max-childs", required_argument, NULL, 'm' },
|
{ "children-max", required_argument, NULL, 'm' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@ -121,7 +121,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[])
|
|||||||
fprintf(stderr, "invalid number '%s'\n", optarg);
|
fprintf(stderr, "invalid number '%s'\n", optarg);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (udev_ctrl_send_set_max_childs(uctrl, i) < 0)
|
if (udev_ctrl_send_set_children_max(uctrl, i) < 0)
|
||||||
rc = 2;
|
rc = 2;
|
||||||
else
|
else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
@ -315,7 +315,7 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--max-childs=</option><replaceable>value</replaceable></term>
|
<term><option>--children-max=</option><replaceable>value</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Set the maximum number of events, udevd will handle at the
|
<para>Set the maximum number of events, udevd will handle at the
|
||||||
same time.</para>
|
same time.</para>
|
||||||
|
36
udev/udevd.c
36
udev/udevd.c
@ -78,8 +78,8 @@ static int worker_watch[2];
|
|||||||
static pid_t settle_pid;
|
static pid_t settle_pid;
|
||||||
static bool stop_exec_queue;
|
static bool stop_exec_queue;
|
||||||
static bool reload_config;
|
static bool reload_config;
|
||||||
static int max_childs;
|
static int children;
|
||||||
static int childs;
|
static int children_max;
|
||||||
static sigset_t orig_sigmask;
|
static sigset_t orig_sigmask;
|
||||||
static struct udev_list_node event_list;
|
static struct udev_list_node event_list;
|
||||||
static struct udev_list_node worker_list;
|
static struct udev_list_node worker_list;
|
||||||
@ -205,7 +205,7 @@ static void worker_unref(struct worker *worker)
|
|||||||
|
|
||||||
udev_list_node_remove(&worker->node);
|
udev_list_node_remove(&worker->node);
|
||||||
udev_monitor_unref(worker->monitor);
|
udev_monitor_unref(worker->monitor);
|
||||||
childs--;
|
children--;
|
||||||
info(worker->udev, "worker [%u] cleaned up\n", worker->pid);
|
info(worker->udev, "worker [%u] cleaned up\n", worker->pid);
|
||||||
free(worker);
|
free(worker);
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ static void worker_new(struct event *event)
|
|||||||
worker->event = event;
|
worker->event = event;
|
||||||
event->state = EVENT_RUNNING;
|
event->state = EVENT_RUNNING;
|
||||||
udev_list_node_append(&worker->node, &worker_list);
|
udev_list_node_append(&worker->node, &worker_list);
|
||||||
childs++;
|
children++;
|
||||||
info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid);
|
info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -386,8 +386,8 @@ static void event_run(struct event *event, bool force)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force && childs >= max_childs) {
|
if (!force && children >= children_max) {
|
||||||
info(event->udev, "maximum number (%i) of childs reached\n", childs);
|
info(event->udev, "maximum number (%i) of children reached\n", children);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,10 +431,10 @@ static void worker_kill(struct udev *udev, int retain)
|
|||||||
struct udev_list_node *loop;
|
struct udev_list_node *loop;
|
||||||
int max;
|
int max;
|
||||||
|
|
||||||
if (childs <= retain)
|
if (children <= retain)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
max = childs - retain;
|
max = children - retain;
|
||||||
|
|
||||||
udev_list_node_foreach(loop, &worker_list) {
|
udev_list_node_foreach(loop, &worker_list) {
|
||||||
struct worker *worker = node_to_worker(loop);
|
struct worker *worker = node_to_worker(loop);
|
||||||
@ -625,10 +625,10 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl)
|
|||||||
worker_kill(udev, 0);
|
worker_kill(udev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = udev_ctrl_get_set_max_childs(ctrl_msg);
|
i = udev_ctrl_get_set_children_max(ctrl_msg);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
info(udev, "udevd message (SET_MAX_CHILDS) received, max_childs=%i\n", i);
|
info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i);
|
||||||
max_childs = i;
|
children_max = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
settle_pid = udev_ctrl_get_settle(ctrl_msg);
|
settle_pid = udev_ctrl_get_settle(ctrl_msg);
|
||||||
@ -1177,21 +1177,21 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* in trace mode run one event after the other */
|
/* in trace mode run one event after the other */
|
||||||
if (debug_trace) {
|
if (debug_trace) {
|
||||||
max_childs = 1;
|
children_max = 1;
|
||||||
} else {
|
} else {
|
||||||
int memsize = mem_size_mb();
|
int memsize = mem_size_mb();
|
||||||
|
|
||||||
if (memsize > 0)
|
if (memsize > 0)
|
||||||
max_childs = 128 + (memsize / 8);
|
children_max = 128 + (memsize / 8);
|
||||||
else
|
else
|
||||||
max_childs = 128;
|
children_max = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* possibly overwrite maximum limit of executed events */
|
/* possibly overwrite maximum limit of executed events */
|
||||||
value = getenv("UDEVD_MAX_CHILDS");
|
value = getenv("UDEVD_MAX_CHILDREN");
|
||||||
if (value)
|
if (value)
|
||||||
max_childs = strtoul(value, NULL, 10);
|
children_max = strtoul(value, NULL, 10);
|
||||||
info(udev, "initialize max_childs to %u\n", max_childs);
|
info(udev, "initialize children_max to %u\n", children_max);
|
||||||
|
|
||||||
static_dev_create(udev);
|
static_dev_create(udev);
|
||||||
static_dev_create_from_modules(udev);
|
static_dev_create_from_modules(udev);
|
||||||
@ -1205,7 +1205,7 @@ int main(int argc, char *argv[])
|
|||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
/* set timeout to kill idle workers */
|
/* set timeout to kill idle workers */
|
||||||
if (udev_list_is_empty(&event_list) && childs > 2)
|
if (udev_list_is_empty(&event_list) && children > 2)
|
||||||
timeout = 3 * 1000;
|
timeout = 3 * 1000;
|
||||||
else
|
else
|
||||||
timeout = -1;
|
timeout = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user