Use spawn to run udevadm

Signed-off-by: Alexey Gladkov <legion@altlinux.org>
This commit is contained in:
Alexey Gladkov 2016-05-16 18:57:12 +02:00
parent 35bf95867a
commit bc936fd7c2
3 changed files with 11 additions and 2 deletions

View File

@ -35,7 +35,9 @@
#include "mount.h"
#include "cdrom.h"
#include "init.h"
extern char *udevtrigger_add[];
extern char version[];
static int mount_iso9660(char * dev_name)
@ -199,7 +201,9 @@ enum return_type cdrom_prepare(void)
fprintf(stderr,"%c[1A",27);
for(i=0; i<timeout; i++) {
if(i%period==0) system("udevadm trigger --action=add");
if (i % period == 0) {
spawn(udevtrigger_add);
}
sleep(1);
if(opendir("/dev/disk/"))break;
fprintf(stderr,"\rwaiting for /dev/disk/ %d...",i);

6
disk.c
View File

@ -39,7 +39,9 @@
#include "automatic.h"
#include "disk.h"
#include "init.h"
extern char *udevtrigger_add[];
extern char version[];
struct partition_detection_anchor {
@ -336,7 +338,9 @@ enum return_type disk_prepare(void)
update_splash("prepare");
fprintf(stderr,"%c[1A",27);
for(i=0; i<timeout; i++) {
if(i%period==0) system("udevadm trigger --action=add");
if (i % period == 0) {
spawn(udevtrigger_add);
}
sleep(1);
if(opendir("/dev/disk/"))break;
fprintf(stderr,"\rwaiting for /dev/disk/ %d...",i);

1
init.c
View File

@ -59,6 +59,7 @@ char ** myenv = NULL;
char *udevd[] = {"/sbin/udevd", "udevd", "--resolve-names=never", NULL};
char *udevtrigger[] = {"/sbin/udevadm", "udevadm", "trigger", NULL};
char *udevtrigger_add[] = {"/sbin/udevadm", "udevadm", "trigger", "--action=add", NULL};
char *udevsettle[] = {"/sbin/udevadm", "udevadm", "settle", NULL};
char *init_top[] = {"/sbin/init-top", "init-top", NULL};