99 lines
3.2 KiB
Diff
99 lines
3.2 KiB
Diff
--- udev-106/udevd.c.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udevd.c 2007-04-25 16:22:19.000000000 +0200
|
|
@@ -657,6 +657,7 @@
|
|
struct ucred *cred;
|
|
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
|
|
int *intval;
|
|
+ char *pos;
|
|
|
|
memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg));
|
|
iov.iov_base = &ctrl_msg;
|
|
@@ -693,6 +694,21 @@
|
|
}
|
|
|
|
switch (ctrl_msg.type) {
|
|
+ case UDEVD_CTRL_ENV:
|
|
+ pos = strchr(ctrl_msg.buf, '=');
|
|
+ if (pos == NULL) {
|
|
+ err("wrong key format '%s'", ctrl_msg.buf);
|
|
+ break;
|
|
+ }
|
|
+ pos[0] = '\0';
|
|
+ if (pos[1] == '\0') {
|
|
+ info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf);
|
|
+ unsetenv(ctrl_msg.buf);
|
|
+ } else {
|
|
+ info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]);
|
|
+ setenv(ctrl_msg.buf, &pos[1], 1);
|
|
+ }
|
|
+ break;
|
|
case UDEVD_CTRL_STOP_EXEC_QUEUE:
|
|
info("udevd message (STOP_EXEC_QUEUE) received");
|
|
stop_exec_q = 1;
|
|
--- udev-106/udevd.h.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udevd.h 2007-04-25 16:22:19.000000000 +0200
|
|
@@ -46,6 +46,7 @@
|
|
UDEVD_CTRL_SET_MAX_CHILDS,
|
|
UDEVD_CTRL_SET_MAX_CHILDS_RUNNING,
|
|
UDEVD_CTRL_RELOAD_RULES,
|
|
+ UDEVD_CTRL_ENV,
|
|
};
|
|
|
|
struct udevd_ctrl_msg {
|
|
--- udev-106/udev_rules_parse.c.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udev_rules_parse.c 2007-04-25 16:19:01.000000000 +0200
|
|
@@ -393,6 +393,7 @@
|
|
}
|
|
if (strncmp(attr, "PHYSDEV", 7) == 0)
|
|
physdev = 1;
|
|
+ dbg("add_rule_key_pair(%s %s)", attr, value);
|
|
if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0)
|
|
goto invalid;
|
|
valid = 1;
|
|
--- udev-106/udevd.8.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udevd.8 2007-04-25 16:22:19.000000000 +0200
|
|
@@ -65,6 +65,11 @@
|
|
.RS 4
|
|
udevcontrol starts the execution of events from udevd.
|
|
.RE
|
|
+.PP
|
|
+\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR
|
|
+.RS 4
|
|
+Set global variable.
|
|
+.RE
|
|
.SH "ENVIRONMENT"
|
|
.PP
|
|
\fBUDEV_LOG\fR
|
|
--- udev-106/udevd.xml.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udevd.xml 2007-04-25 16:22:19.000000000 +0200
|
|
@@ -93,6 +93,12 @@
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
+ <term><option>env <replaceable>var</replaceable>=<replaceable>value</replaceable></option></term>
|
|
+ <listitem>
|
|
+ <para>Set global variable.</para>
|
|
+ </listitem>
|
|
+ </varlistentry>
|
|
+ <varlistentry>
|
|
<term><option>start_exec_queue</option></term>
|
|
<listitem>
|
|
<para>udevcontrol starts the execution of events from udevd.</para>
|
|
--- udev-106/udevcontrol.c.setenv 2007-03-03 18:42:09.000000000 +0100
|
|
+++ udev-106/udevcontrol.c 2007-04-25 16:22:19.000000000 +0200
|
|
@@ -117,6 +117,15 @@
|
|
}
|
|
*intval = count;
|
|
info("send max_childs_running=%i", *intval);
|
|
+ } else if (!strncmp(arg, "env", strlen("env"))) {
|
|
+ val = argv[++i];
|
|
+ if (val == NULL) {
|
|
+ fprintf(stderr, "missing key\n");
|
|
+ goto exit;
|
|
+ }
|
|
+ ctrl_msg.type = UDEVD_CTRL_ENV;
|
|
+ strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf));
|
|
+ info("send env '%s'", val);
|
|
} else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
|
|
printf("Usage: udevcontrol COMMAND\n"
|
|
" log_priority=<level> set the udev log level for the daemon\n"
|