X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udevsend.c;h=29d5bc155e969976ff004b5afeb70d7ba5e8944e;hp=888a88daa0bd51a34644e634f71167333efd96fa;hb=0b3dfb3d72e1df5f38ecb9669e37e5e77d958343;hpb=a15f42c46a7b9ceb5850ea4334c95f099ce74a6f diff --git a/udevsend.c b/udevsend.c index 888a88daa..29d5bc155 100644 --- a/udevsend.c +++ b/udevsend.c @@ -1,12 +1,9 @@ /* * udevsend.c * - * Userspace devfs - * * Copyright (C) 2004 Ling, Xiaofeng * Copyright (C) 2004 Kay Sievers * - * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2 of the License. @@ -22,17 +19,17 @@ * */ -#include -#include -#include -#include -#include -#include #include #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include "udev.h" @@ -92,27 +89,6 @@ static int start_daemon(void) return 0; } -static void run_udev(const char *subsystem) -{ - char *const argv[] = { "udev", (char *)subsystem, NULL }; - pid_t pid; - - pid = fork(); - switch (pid) { - case 0: - /* child */ - execv(UDEV_BIN, argv); - err("exec of udev child failed"); - _exit(1); - break; - case -1: - err("fork of udev child failed"); - break; - default: - waitpid(pid, NULL, 0); - } -} - int main(int argc, char *argv[], char *envp[]) { static struct udevd_msg usend_msg; @@ -135,7 +111,7 @@ int main(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { err("error getting socket"); - goto fallback; + goto exit; } memset(&saddr, 0x00, sizeof(struct sockaddr_un)); @@ -146,7 +122,7 @@ int main(int argc, char *argv[], char *envp[]) memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UEVENT; + usend_msg.type = UDEVD_UEVENT_UDEVSEND; /* copy all keys to send buffer */ for (i = 0; envp[i]; i++) { @@ -195,7 +171,7 @@ int main(int argc, char *argv[], char *envp[]) if (errno != ECONNREFUSED) { err("error sending message (%s)", strerror(errno)); - goto fallback; + goto exit; } if (!started_daemon) { @@ -203,7 +179,7 @@ int main(int argc, char *argv[], char *envp[]) retval = start_daemon(); if (retval) { dbg("error starting daemon"); - goto fallback; + goto exit; } dbg("udevd daemon started"); started_daemon = 1; @@ -213,10 +189,6 @@ int main(int argc, char *argv[], char *envp[]) } } -fallback: - err("unable to connect to event daemon, try to call udev directly"); - run_udev(subsystem); - exit: if (sock != -1) close(sock);