diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-28 20:35:05 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-28 20:35:05 +0200 |
commit | a401355d5aed89f686d178f01400432c71cf6380 (patch) | |
tree | ca0a5ab860aed72a38db571e7a43a5a38770a98e /extras/run_directory | |
parent | 1532b47bdf8cabc86d7e0f6d5e81342c42c48b2a (diff) |
finally remove the directory event-multiplexer crap
Diffstat (limited to 'extras/run_directory')
-rw-r--r-- | extras/run_directory/Makefile | 72 | ||||
-rw-r--r-- | extras/run_directory/README | 17 | ||||
-rw-r--r-- | extras/run_directory/RFC-dev.d | 50 | ||||
-rw-r--r-- | extras/run_directory/dev.d/default/pam_console.dev | 52 | ||||
-rw-r--r-- | extras/run_directory/dev.d/net/hotplug.dev | 21 | ||||
-rw-r--r-- | extras/run_directory/dev.d/snd/controlC0/alsa.dev | 2 | ||||
-rw-r--r-- | extras/run_directory/run_directory.c | 73 | ||||
-rw-r--r-- | extras/run_directory/run_directory.h | 3 | ||||
-rw-r--r-- | extras/run_directory/udev_run_devd.c | 95 | ||||
-rw-r--r-- | extras/run_directory/udev_run_hotplugd.c | 77 |
10 files changed, 0 insertions, 462 deletions
diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile deleted file mode 100644 index 3d1674436b..0000000000 --- a/extras/run_directory/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org> -# -# Released under the GNU General Public License, version 2. -# -PROG = udev_run_devd udev_run_hotplugd -OBJS = run_directory.o -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - @echo $@ "is DEPRECATED and will be removed, don't use it" - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - @echo $@ "is DEPRECATED and will be removed, don't use it" - $(INSTALL_PROGRAM) -D udev_run_devd $(DESTDIR)$(libudevdir)/udev_run_devd - $(INSTALL_PROGRAM) -D udev_run_hotplugd $(DESTDIR)$(libudevdir)/udev_run_hotplugd -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/udev_run_devd - - rm $(DESTDIR)$(libudevdir)/udev_run_hotplugd -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/run_directory/README b/extras/run_directory/README deleted file mode 100644 index feae2f81bf..0000000000 --- a/extras/run_directory/README +++ /dev/null @@ -1,17 +0,0 @@ -Use these binaries only if you need backward compatibility with -older udev versions. The use of /etc/dev.d/ is no longer recommended. -Use explicit udev rules with RUN keys to hook into the processing. - - /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely - removed from udev itself and must be emulated by calling small - helper binaries provided by these helpers: - make EXTRAS=extras/run_directory/ - will build udev_run_devd and udev_run_hotplugd, which can be called - from a rule if needed: - RUN+="/sbin/udev_run_hotplugd" - The recommended way to handle this is to convert all the calls from - the directories to explicit udev rules and get completely rid of the - multiplexing. (To catch a ttyUSB event, you now no longer need to - fork and exit 300 tty script instances on bootup you are not interested - in, it is just one rule that matches exactly that single device.) - diff --git a/extras/run_directory/RFC-dev.d b/extras/run_directory/RFC-dev.d deleted file mode 100644 index 1aca1aa393..0000000000 --- a/extras/run_directory/RFC-dev.d +++ /dev/null @@ -1,50 +0,0 @@ - /etc/dev.d/ How it works, and what it is for - - by Greg Kroah-Hartman <greg@kroah.com> March 2004 - -The /etc/dev.d directory works much like the /etc/hotplug.d/ directory -in that it is a place to put symlinks or programs that get called when -an event happens in the system. Programs will get called whenever the -device naming program in the system has either named a new device and -created a /dev node for it, or when a /dev node has been removed from -the system due to a device being removed. - -The directory tree under /etc/dev.d/ dictate which program is run first, -and when some programs will be run or not. The device naming program -calls the programs in the following order: - /etc/dev.d/DEVNAME/*.dev - /etc/dev.d/SUBSYSTEM/*.dev - /etc/dev.d/default/*.dev - -The .dev extension is needed to allow automatic package managers to -deposit backup files in these directories safely. - -The DEVNAME name is the name of the /dev file that has been created, or -for network devices, the name of the newly named network device. This -value, including the /dev path, will also be exported to userspace in -the DEVNAME environment variable. - -The SUBSYSTEM name is the name of the sysfs subsystem that originally -generated the hotplug event that caused the device naming program to -create or remove the /dev node originally. This value is passed to -userspace as the first argument to the program. - -The default directory will always be run, to enable programs to catch -every device add and remove in a single place. - -All environment variables that were originally passed by the hotplug -call that caused this device action will also be passed to the program -called in the /etc/dev.d/ directories. Examples of these variables are -ACTION, DEVPATH, and others. See the hotplug documentation for full -description of this - -An equivalent shell script that would do this same kind of action would -be: - DIR="/etc/dev.d" - export DEVNAME="whatever_dev_name_udev_just_gave" - for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - if [ -f $I ]; then $I $1 ; fi - done - exit 1; - - diff --git a/extras/run_directory/dev.d/default/pam_console.dev b/extras/run_directory/dev.d/default/pam_console.dev deleted file mode 100644 index 4c69ea3576..0000000000 --- a/extras/run_directory/dev.d/default/pam_console.dev +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Fedora solution to set the ownership/permissions of s device to the local -# logged in user. Uses the program pam_console_setowner to match the names of -# the device node and the symlinks against a device list and applies the -# configured ownership and permission to the node. - -[ "$ACTION" != "add" ] && exit 0 - -# we do not have console users in rc.sysinit -[ -n "$IN_INITLOG" ] && exit 0 - -if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \ - -a -e "$DEVNAME" ]; then - - if [ -x /usr/bin/logger ]; then - LOGGER=/usr/bin/logger - elif [ -x /bin/logger ]; then - LOGGER=/bin/logger - else - unset LOGGER - fi - # - # for diagnostics - # - if [ -t 1 -o -z "$LOGGER" ]; then - mesg () { - echo "$@" - } - else - mesg () { - $LOGGER -t $(basename $0)"[$$]" "$@" - } - fi - - debug_mesg () { - test "$udev_log" = "" -o "$udev_log" = "no" && return - mesg "$@" - } - - if [ -f /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf - fi - - SYMLINKS="" - for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do - [ $? -gt 0 ] && break - SYMLINKS="$SYMLINKS ${udev_root%%/}/$i" - done - debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS" - /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS -fi diff --git a/extras/run_directory/dev.d/net/hotplug.dev b/extras/run_directory/dev.d/net/hotplug.dev deleted file mode 100644 index e195b0f034..0000000000 --- a/extras/run_directory/dev.d/net/hotplug.dev +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Script to ensure that any network device that udev renames -# still gets the hotplug script run with the proper name. -# -# Released under the GPL v2 -# -# Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> -# - -# Do nothing if udev handles hotplug.d. -if [ "$MANAGED_EVENT" == "1" ]; then - exit 0 -fi - -# ok, we have renamed this device, so let the network hotplug script -# know about it to setup the device properly... -if [ -f /etc/hotplug.d/default/default.hotplug ]; then - exec /etc/hotplug.d/default/default.hotplug net -fi - diff --git a/extras/run_directory/dev.d/snd/controlC0/alsa.dev b/extras/run_directory/dev.d/snd/controlC0/alsa.dev deleted file mode 100644 index 642dde4f36..0000000000 --- a/extras/run_directory/dev.d/snd/controlC0/alsa.dev +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -e -exec /usr/sbin/alsactl restore 0 diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c deleted file mode 100644 index c715ca6bd3..0000000000 --- a/extras/run_directory/run_directory.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * udev_run_directory.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers <kay@vrfy.org> - * - * 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. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stddef.h> -#include <dirent.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <limits.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/stat.h> - -#include "../../udev.h" -#include "run_directory.h" - -static int exec_program(const char *filename, const char *subsystem) -{ - pid_t pid; - - dbg("running %s", filename); - pid = fork(); - switch (pid) { - case 0: - /* child */ - execl(filename, filename, subsystem, NULL); - dbg("exec of child failed"); - _exit(1); - case -1: - dbg("fork of child failed"); - break; - return -1; - default: - waitpid(pid, NULL, 0); - } - - return 0; -} - -int run_directory(const char *dir, const char *suffix, const char *subsystem) -{ - struct name_entry *name_loop, *name_tmp; - struct stat buf; - LIST_HEAD(name_list); - - dbg("looking at '%s'", dir); - - if (stat(dir, &buf) != 0) { - dbg("directory '%s' not found", dir); - return 0; - } - - add_matching_files(&name_list, dir, suffix); - - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - exec_program(name_loop->name, subsystem); - list_del(&name_loop->node); - } - - logging_close(); - return 0; -} diff --git a/extras/run_directory/run_directory.h b/extras/run_directory/run_directory.h deleted file mode 100644 index edb46ddd73..0000000000 --- a/extras/run_directory/run_directory.h +++ /dev/null @@ -1,3 +0,0 @@ - -extern int run_directory(const char *dir, const char *suffix, const char *subsystem); - diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c deleted file mode 100644 index 59ea766ac2..0000000000 --- a/extras/run_directory/udev_run_devd.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * udev_run_devd.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers <kay@vrfy.org> - * - * 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. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stddef.h> -#include <dirent.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <limits.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/stat.h> - -#include "../../udev.h" -#include "run_directory.h" - - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - char dirname[NAME_SIZE]; - const char *devname; - const char *my_devname; - const char *subsystem; - int fd; - - devname = getenv("DEVNAME"); - if (devname == NULL) - exit(0); - /* - * Hack, we are assuming that the device nodes are in /dev, - * if not, this will not work, but you should be using the - * RUN= rule anyway... - */ - my_devname = strstr(devname, "/dev/"); - if (my_devname != NULL) - my_devname = &my_devname[5]; - else - my_devname = devname; - - subsystem = argv[1]; - logging_init("udev_run_devd"); - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - dbg("running dev.d directory"); - - sprintf(dirname, "/etc/dev.d/%s", my_devname); - run_directory(dirname, ".dev", subsystem); - sprintf(dirname, "/etc/dev.d/%s", subsystem); - run_directory(dirname, ".dev", subsystem); - run_directory("/etc/dev.d/default", ".dev", subsystem); - - exit(0); -} diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c deleted file mode 100644 index f94c237e37..0000000000 --- a/extras/run_directory/udev_run_hotplugd.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * udev_run_hotplugd.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers <kay@vrfy.org> - * - * 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. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stddef.h> -#include <dirent.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <limits.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/stat.h> - -#include "../../udev.h" -#include "run_directory.h" - - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - char dirname[NAME_SIZE]; - const char *subsystem; - int fd; - - subsystem = argv[1]; - logging_init("udev_run_hotplugd"); - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - - dbg("running hotplug.d directory"); - - sprintf(dirname, "/etc/hotplug.d/%s", subsystem); - run_directory(dirname, ".hotplug", subsystem); - run_directory("/etc/hotplug.d/default", ".hotplug", subsystem); - exit(0); -} |