sigaction(SIGTERM, &act, NULL);
/* trigger timeout to prevent hanging processes */
- alarm(UDEV_ALARM_TIMEOUT);
+ alarm(UDEV_EVENT_TIMEOUT);
action = getenv("ACTION");
devpath = getenv("DEVPATH");
retval = udev_device_event(&rules, udev);
+ /* rules may change/disable the timeout */
+ if (udev->event_timeout >= 0)
+ alarm(udev->event_timeout);
+
if (retval == 0 && !udev->ignore_device && udev_run)
udev_rules_run(udev);
Create the device nodes for all available partitions of a block device\. This may be useful for removable media devices where media changes are not detected\.
.RE
.PP
+\fBevent_timeout=\fR
+.RS 4
+Number of seconds an event will wait for operations to finish, before it will terminate itself\.
+.RE
+.PP
\fBstring_escape=\fR\fB\fInone|replace\fR\fR
.RS 4
Usually control and other possibly unsafe characters are replaced in strings used for device naming\. The mode of replacement can be specified with this option\.
#define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?,"
#define DEFAULT_PARTITIONS_COUNT 15
-#define UDEV_ALARM_TIMEOUT 180
+#define UDEV_EVENT_TIMEOUT 180
#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
int ignore_remove;
char program_result[PATH_SIZE];
int link_priority;
+ int event_timeout;
int test_run;
};
detected.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>event_timeout=</option></term>
+ <listitem>
+ <para>Number of seconds an event will wait for operations to finish, before it
+ will terminate itself.</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><option>string_escape=<replaceable>none|replace</replaceable></option></term>
<listitem>
strcpy(udev->owner, "root");
strcpy(udev->group, "root");
+ udev->event_timeout = -1;
+
return udev;
}
udev->link_priority = rule->link_priority;
info("link_priority=%i\n", udev->link_priority);
}
+ if (rule->event_timeout >= 0) {
+ udev->event_timeout = rule->event_timeout;
+ info("event_timeout=%i\n", udev->event_timeout);
+ }
/* apply all_partitions option only at a main block device */
if (rule->partitions &&
strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') {
enum escape_type string_escape;
unsigned int link_priority;
+ int event_timeout;
unsigned int partitions;
unsigned int last_rule:1,
run_ignore_error:1,
memset(buf, 0x00, sizeof(buf));
rule = (struct udev_rule *) buf;
+ rule->event_timeout = -1;
linepos = line;
valid = 0;
rule->link_priority = atoi(&pos[strlen("link_priority=")]);
dbg("link priority=%i\n", rule->link_priority);
}
+ pos = strstr(value, "event_timeout=");
+ if (pos != NULL) {
+ rule->event_timeout = atoi(&pos[strlen("event_timeout=")]);
+ dbg("event timout=%i\n", rule->event_timeout);
+ }
pos = strstr(value, "string_escape=");
if (pos != NULL) {
pos = &pos[strlen("string_escape=")];
sigaction(SIGHUP, &act, NULL);
/* trigger timeout to prevent hanging processes */
- alarm(UDEV_ALARM_TIMEOUT);
+ alarm(UDEV_EVENT_TIMEOUT);
/* reconstruct event environment from message */
for (i = 0; msg->envp[i]; i++)
retval = udev_device_event(&rules, udev);
+ /* rules may change/disable the timeout */
+ if (udev->event_timeout >= 0)
+ alarm(udev->event_timeout);
+
/* run programs collected by RUN-key*/
if (retval == 0 && !udev->ignore_device && udev_run)
retval = udev_rules_run(udev);
info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem);
retval = udev_device_event(&rules, udev);
+
+ if (udev->event_timeout >= 0)
+ info("custom event timeout: %i\n", udev->event_timeout);
+
if (retval == 0 && !udev->ignore_device && udev_run) {
struct name_entry *name_loop;