[PATCH] add support for UDEV_NO_SLEEP env variable so Gentoo people will be happy.
Actually, I'm happy to, startup time is much smaller...
This commit is contained in:
parent
8fff7b42b4
commit
961e47847c
|
@ -623,7 +623,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de
|
||||||
tspec.tv_nsec = 10000000; /* sleep 10 millisec */
|
tspec.tv_nsec = 10000000; /* sleep 10 millisec */
|
||||||
loop = 10;
|
loop = 10;
|
||||||
while (loop--) {
|
while (loop--) {
|
||||||
nanosleep(&tspec, NULL);
|
if (udev_sleep)
|
||||||
|
nanosleep(&tspec, NULL);
|
||||||
if (class_dev_parent)
|
if (class_dev_parent)
|
||||||
sysfs_device = sysfs_get_classdev_device(class_dev_parent);
|
sysfs_device = sysfs_get_classdev_device(class_dev_parent);
|
||||||
else
|
else
|
||||||
|
@ -650,7 +651,8 @@ device_found:
|
||||||
loop = 10;
|
loop = 10;
|
||||||
tspec.tv_nsec = 10000000;
|
tspec.tv_nsec = 10000000;
|
||||||
while (loop--) {
|
while (loop--) {
|
||||||
nanosleep(&tspec, NULL);
|
if (udev_sleep)
|
||||||
|
nanosleep(&tspec, NULL);
|
||||||
sysfs_get_device_bus(sysfs_device);
|
sysfs_get_device_bus(sysfs_device);
|
||||||
|
|
||||||
if (sysfs_device->bus[0] != '\0')
|
if (sysfs_device->bus[0] != '\0')
|
||||||
|
|
1
udev.h
1
udev.h
|
@ -78,5 +78,6 @@ extern char default_mode_str[MODE_SIZE];
|
||||||
extern char default_owner_str[OWNER_SIZE];
|
extern char default_owner_str[OWNER_SIZE];
|
||||||
extern char default_group_str[GROUP_SIZE];
|
extern char default_group_str[GROUP_SIZE];
|
||||||
extern int udev_log;
|
extern int udev_log;
|
||||||
|
extern int udev_sleep;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,6 +49,7 @@ char default_mode_str[MODE_SIZE];
|
||||||
char default_owner_str[OWNER_SIZE];
|
char default_owner_str[OWNER_SIZE];
|
||||||
char default_group_str[GROUP_SIZE];
|
char default_group_str[GROUP_SIZE];
|
||||||
int udev_log;
|
int udev_log;
|
||||||
|
int udev_sleep;
|
||||||
|
|
||||||
|
|
||||||
static int string_is_true(char *str)
|
static int string_is_true(char *str)
|
||||||
|
@ -71,6 +72,10 @@ static void init_variables(void)
|
||||||
strfieldcpy(udev_rules_filename, UDEV_RULES_FILE);
|
strfieldcpy(udev_rules_filename, UDEV_RULES_FILE);
|
||||||
strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE);
|
strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE);
|
||||||
udev_log = string_is_true(UDEV_LOG_DEFAULT);
|
udev_log = string_is_true(UDEV_LOG_DEFAULT);
|
||||||
|
|
||||||
|
udev_sleep = 1;
|
||||||
|
if (getenv("UDEV_NO_SLEEP") != NULL)
|
||||||
|
udev_sleep = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define set_var(_name, _var) \
|
#define set_var(_name, _var) \
|
||||||
|
|
Loading…
Reference in a new issue