From 5005ca5991edb233d3a6bb41ba7d48d5f8a296ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 May 2006 12:20:51 +0200 Subject: remove udevsend --- Makefile | 2 - TODO | 2 +- udevd.c | 27 ++++-------- udevd.h | 3 -- udevsend.8 | 38 ---------------- udevsend.c | 138 ----------------------------------------------------------- udevsend.xml | 90 -------------------------------------- 7 files changed, 9 insertions(+), 291 deletions(-) delete mode 100644 udevsend.8 delete mode 100644 udevsend.c delete mode 100644 udevsend.xml diff --git a/Makefile b/Makefile index ce84c52f65..e39ebfebf4 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ PROGRAMS = \ udevd \ udevtrigger \ udevsettle \ - udevsend \ udevcontrol \ udevmonitor \ udevinfo \ @@ -87,7 +86,6 @@ MAN_PAGES = \ udevd.8 \ udevtrigger.8 \ udevsettle.8 \ - udevsend.8 \ udevtest.8 \ udevinfo.8 \ udevstart.8 diff --git a/TODO b/TODO index 1ef9c71f07..719f345a0e 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,7 @@ udev version: o remove MODALIAS + $modalias (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) - o remove udevsend, udevstart and their man pages + o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) diff --git a/udevd.c b/udevd.c index 705e2a9780..02c4887f54 100644 --- a/udevd.c +++ b/udevd.c @@ -559,19 +559,17 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) /* receive the udevd message from userspace */ static struct uevent_msg *get_udevd_msg(void) { - static struct udevd_msg usend_msg; - struct uevent_msg *msg; + static struct udevd_msg ctrl_msg; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; struct iovec iov; struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - int envbuf_size; int *intval; - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - iov.iov_base = &usend_msg; + memset(&ctrl_msg, 0x00, sizeof(struct udevd_msg)); + iov.iov_base = &ctrl_msg; iov.iov_len = sizeof(struct udevd_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); @@ -599,21 +597,12 @@ static struct uevent_msg *get_udevd_msg(void) return NULL; } - if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it", usend_msg.magic); + if (strncmp(ctrl_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { + err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); return NULL; } - switch (usend_msg.type) { - case UDEVD_UEVENT_UDEVSEND: - info("udevd event message received"); - envbuf_size = size - offsetof(struct udevd_msg, envbuf); - dbg("envbuf_size=%i", envbuf_size); - msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); - if (msg == NULL) - return NULL; - msg->type = usend_msg.type; - return msg; + switch (ctrl_msg.type) { case UDEVD_STOP_EXEC_QUEUE: info("udevd message (STOP_EXEC_QUEUE) received"); stop_exec_q = 1; @@ -624,14 +613,14 @@ static struct uevent_msg *get_udevd_msg(void) msg_queue_manager(); break; case UDEVD_SET_LOG_LEVEL: - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.envbuf; info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); udev_log_priority = *intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; case UDEVD_SET_MAX_CHILDS: - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.envbuf; info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); max_childs = *intval; break; diff --git a/udevd.h b/udevd.h index e6ed58d622..1e9c702896 100644 --- a/udevd.h +++ b/udevd.h @@ -23,8 +23,6 @@ #define UDEV_MAGIC "udevd_" UDEV_VERSION #define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" -#define UDEVSEND_WAIT_MAX_SECONDS 3 -#define UDEVSEND_WAIT_LOOP_PER_SECOND 10 #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 @@ -44,7 +42,6 @@ enum udevd_msg_type { UDEVD_UNKNOWN, - UDEVD_UEVENT_UDEVSEND, UDEVD_UEVENT_NETLINK, UDEVD_STOP_EXEC_QUEUE, UDEVD_START_EXEC_QUEUE, diff --git a/udevsend.8 b/udevsend.8 deleted file mode 100644 index b5028adca6..0000000000 --- a/udevsend.8 +++ /dev/null @@ -1,38 +0,0 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "UDEVSEND" "8" "August 2005" "udev" "udevsend" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevsend \- send the current environment to the udev daemon -.SH "SYNOPSIS" -.HP 9 -\fBudevsend\fR -.SH "DESCRIPTION" -.PP -Usually the udev daemon listens directly to the kernel uevents. udevsend may be used to pass events for already existing devices from a userspace application to the daemon. -.SH "ENVIRONMENT" -.TP -\fBACTION\fR -\fIadd\fR -or -\fIremove\fR -signifies the addition or the removal of a device. -.TP -\fBDEVPATH\fR -The sysfs devpath without the mountpoint but a leading slash. -.TP -\fBSUBSYSTEM\fR -The kernel subsystem the device belongs to. -.SH "AUTHOR" -.PP -Written by Kay Sievers -. -.SH "SEE ALSO" -.PP -\fBudev\fR(7), -\fBudevd\fR(8) diff --git a/udevsend.c b/udevsend.c deleted file mode 100644 index 9f5059a4c8..0000000000 --- a/udevsend.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * udevsend.c - * - * 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. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -/* global variables */ -static int sock = -1; - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - static struct udevd_msg usend_msg; - int usend_msg_len; - int i; - struct sockaddr_un saddr; - socklen_t addrlen; - int bufpos = 0; - int retval = 0; - const char *subsystem = NULL; - - logging_init("udevsend"); -#ifdef USE_LOG - udev_config_init(); -#endif - dbg("version %s", UDEV_VERSION); - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock < 0) { - err("error getting socket: %s", strerror(errno)); - retval = 1; - goto exit; - } - - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UEVENT_UDEVSEND; - - /* copy all keys to send buffer */ - for (i = 0; envp[i]; i++) { - const char *key; - int keylen; - - key = envp[i]; - keylen = strlen(key); - - /* ignore events which are already sent on the netlink socket */ - if (strncmp(key, "SEQNUM=", 7) == 0) { - dbg("ignoring event with SEQNUM set"); - retval = 0; - goto exit; - } - - /* prevent loops in the scripts we execute */ - if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { - err("event loop, already passed through the daemon, exit"); - retval = 2; - goto exit; - } - - if (bufpos + keylen >= UEVENT_BUFFER_SIZE-1) { - err("environment buffer too small, probably not called by the kernel"); - continue; - } - - /* remember the SUBSYSTEM */ - if (strncmp(key, "SUBSYSTEM=", 10) == 0) - subsystem = &key[10]; - - dbg("add '%s' to env[%i] buffer", key, i); - strcpy(&usend_msg.envbuf[bufpos], key); - bufpos += keylen + 1; - } - - usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; - dbg("usend_msg_len=%i", usend_msg_len); - - if (sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen) < 0) { - retval = 3; - err("error sending message: %s", strerror(errno)); - } - -exit: - if (sock != -1) - close(sock); - - logging_close(); - return retval; -} diff --git a/udevsend.xml b/udevsend.xml deleted file mode 100644 index 9e94ce1798..0000000000 --- a/udevsend.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - -
- - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
- udevsend - - - udevsend - August 2005 - udev - - - - udevsend - 8 - - - - udevsend - send the current environment to the udev daemon - - - - - udevsend - - - - DESCRIPTION - Usually the udev daemon listens directly to the kernel uevents. - udevsend may be used to pass events for already existing devices from - a userspace application to the daemon. - - - ENVIRONMENT - - - - - add or remove signifies - the addition or the removal of a device. - - - - - - - The sysfs devpath without the mountpoint but a leading slash. - - - - - - - The kernel subsystem the device belongs to. - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - , - - udevd8 - - - -
-
-- cgit v1.2.3-54-g00ecf