udevd - bring into sbin, add rc script
authorAlex Hornung <ahornung@gmail.com>
Sat, 10 Jul 2010 08:41:40 +0000 (09:41 +0100)
committerAlex Hornung <ahornung@gmail.com>
Sat, 10 Jul 2010 22:10:17 +0000 (23:10 +0100)
* Bring udevd into sbin so it can be used very early on, for example in
  the initrd environment.

* Add an rc script for udevd.

* Remove debugging flags from libdevattr Makefile

14 files changed:
etc/rc.d/Makefile
etc/rc.d/udevd [new file with mode: 0644]
lib/libdevattr/Makefile
sbin/Makefile
sbin/udevd/Makefile [moved from usr.sbin/udevd/Makefile with 90% similarity]
sbin/udevd/mktest [moved from usr.sbin/udevd/mktest with 100% similarity]
sbin/udevd/test_udevd.c [moved from usr.sbin/udevd/test_udevd.c with 100% similarity]
sbin/udevd/udevd.c [moved from usr.sbin/udevd/udevd.c with 99% similarity]
sbin/udevd/udevd.h [moved from usr.sbin/udevd/udevd.h with 100% similarity]
sbin/udevd/udevd_client.c [moved from usr.sbin/udevd/udevd_client.c with 100% similarity]
sbin/udevd/udevd_monitor.c [moved from usr.sbin/udevd/udevd_monitor.c with 100% similarity]
sbin/udevd/udevd_pdev.c [moved from usr.sbin/udevd/udevd_pdev.c with 100% similarity]
sbin/udevd/udevd_socket.c [moved from usr.sbin/udevd/udevd_socket.c with 100% similarity]
usr.sbin/Makefile

index b85004b..1a58987 100644 (file)
@@ -22,7 +22,7 @@ FILES=        DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \
        quota random rarpd rcconf resident rndcontrol root route6d routed \
        routing rpcbind rtadvd rtsold rwho sysdb savecore sdpd securelevel \
        sendmail sensorsd serial sppp sshd statd swap1 syscons sysctl syslogd \
-       timed ttys usbd varsym vinum vkernel virecover \
+       timed ttys udevd usbd varsym vinum vkernel virecover \
        watchdogd wpa_supplicant \
        ypbind yppasswdd ypserv ypset ypupdated ypxfrd
 
diff --git a/etc/rc.d/udevd b/etc/rc.d/udevd
new file mode 100644 (file)
index 0000000..7fbef5d
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+# PROVIDE: udevd
+# REQUIRE: syslogd
+
+. /etc/rc.subr
+
+name="udevd"
+rcvar=`set_rcvar`
+command="/sbin/${name}"
+
+load_rc_config $name
+run_rc_command "$1"
index 340eaa8..7e7f120 100644 (file)
@@ -2,7 +2,6 @@ LIB=    devattr
 SRCS=  devattr.c devattr_device.c devattr_enumerate.c devattr_monitor.c
 
 WARNS?=        6
-DEBUG_FLAGS=-g
 
 LDADD+=        -lprop
 DPADD+=        ${LIBPROP}
index 36bb84b..4655bc6 100644 (file)
@@ -91,6 +91,7 @@ SUBDIR=       adjkerntz \
        swapon \
        sysctl \
        tunefs \
+       udevd \
        umount \
        vinum
 
similarity index 90%
rename from usr.sbin/udevd/Makefile
rename to sbin/udevd/Makefile
index 9e1c3f5..371a89b 100644 (file)
@@ -1,4 +1,3 @@
-DEBUG_FLAGS=-g
 PROG=  udevd
 SRCS=  udevd.c udevd_client.c udevd_monitor.c udevd_pdev.c 
 SRCS+= udevd_socket.c
similarity index 100%
rename from usr.sbin/udevd/mktest
rename to sbin/udevd/mktest
similarity index 99%
rename from usr.sbin/udevd/udevd.c
rename to sbin/udevd/udevd.c
index bed883c..015998e 100644 (file)
@@ -321,17 +321,17 @@ int main(int argc __unused, char *argv[] __unused)
                err(1, "%s", UDEV_DEVICE_PATH);
        unblock_descriptor(udevfd);
 
-       //if (daemon(0, 0) == -1)
-       //      err(1, "daemon");
+       s = init_local_server(LISTEN_SOCKET_FILE, SOCK_STREAM, 0);
+       if (s < 0)
+               err(1, "init_local_server");
+
+       if (daemon(0, 0) == -1)
+               err(1, "daemon");
 
        syslog(LOG_ERR, "udevd started");
 
        pdev_array_entry_insert(udev_getdevs(udevfd));
 
-       s = init_local_server(LISTEN_SOCKET_FILE, SOCK_STREAM, 0);
-       if (s < 0)
-               err(1, "init_local_server");
-
        memset(fds, 0 , sizeof(fds));
        fds[UDEV_DEVICE_FD_IDX].fd = udevfd;
        fds[UDEV_DEVICE_FD_IDX].events = POLLIN;
similarity index 100%
rename from usr.sbin/udevd/udevd.h
rename to sbin/udevd/udevd.h
index 93b02fd..a262c45 100644 (file)
@@ -123,7 +123,6 @@ SUBDIR= 802_11 \
        traceroute6 \
        trpt \
        tzsetup \
-       udevd \
        usbd \
        usbdevs \
        vidcontrol \