- memset(msg, 0x00, sizeof(struct hotplug_msg));
- strfieldcpy(msg->magic, UDEV_MAGIC);
- msg->seqnum = seqnum;
- strfieldcpy(msg->action, action);
- strfieldcpy(msg->devpath, devpath);
- strfieldcpy(msg->subsystem, subsystem);
-}
-
-static int start_daemon(void)
-{
- pid_t pid;
- pid_t child_pid;
-
- pid = fork();
- switch (pid) {
- case 0:
- /* helper child */
- child_pid = fork();
- switch (child_pid) {
- case 0:
- /* daemon */
- setsid();
- chdir("/");
- execl(UDEVD_BIN, "udevd", NULL);
- dbg("exec of daemon failed");
- exit(1);
- case -1:
- dbg("fork of daemon failed");
- return -1;
- default:
- exit(0);
- }
- break;
- case -1:
- dbg("fork of helper failed");
- return -1;
- default:
- wait(NULL);
- }
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
- struct hotplug_msg msg;
- char *action;
- char *devpath;
- char *subsystem;
- char *seqnum;
- int seq;
- int retval = 1;
- int loop;
- struct timespec tspec;
- int sock;