mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 19:21:53 +03:00
53921bfa44
On Thu, Jan 29, 2004 at 04:55:11PM +0100, Kay Sievers wrote: > On Thu, Jan 29, 2004 at 02:56:25AM +0100, Kay Sievers wrote: > > On Wed, Jan 28, 2004 at 10:47:36PM +0100, Kay Sievers wrote: > > > Oh, couldn't resist to try threads. > > > It's a multithreaded udevd that communicates through a localhost socket. > > > The message includes a magic with the udev version, so we don't accept > > > older udevsend's. > > > > > > No need for locking, cause we can't bind two sockets on the same address. > > > The daemon tries to connect and if it fails it starts the daemon. > > > > > > We create a thread for every incoming connection, handle over the socket, > > > sort the messages in the global message queue and exit the thread. > > > Huh, that was easy with threads :) > > > > > > With the addition of a message we wakeup the queue manager thread and > > > handle timeouts or move the message to the global exec list. This wakes > > > up the exec list manager who looks if a process is already running for this > > > device path. > > > If yes, the exec is delayed otherwise we create a thread that execs udev. > > > n the background. With the return of udev we free the message and wakeup > > > the exec list manager to look if something is pending. > > > > > > It is just a quick shot, cause I couldn't solve the problems with fork an > > > scheduling and I wanted to see if I'm to stupid :) > > > But if anybody with a better idea or more experience with I/O scheduling > > > we may go another way. The remaining problem is that klibc doesn't support > > > threads. > > > > > > By now, we don't exec anything, it's just a sleep 3 for every exec, > > > but you can see the queue management by watching syslog and do: > > > > > > DEVPATH=/abc ACTION=add SEQNUM=0 ./udevsend /abc > > Next version, switched to unix domain sockets. Next cleaned up version. Hey, nobody wants to try it :) Works for me, It's funny if I connect/disconnect my 4in1-usb-flash-reader every two seconds. The 2.6 usb rocks! I can connect/diconnect a hub with 3 devices plugged in every second and don't run into any problem but a _very_ big udevd queue.
84 lines
1.3 KiB
Bash
84 lines
1.3 KiB
Bash
#!/bin/sh
|
|
|
|
# add/rem/add/rem/add sequence of sda/sdb/sdc
|
|
# a few days longer and the socket of my usb-flash-reader is gone :)
|
|
|
|
export SEQNUM=3
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdc
|
|
./udevsend block
|
|
|
|
export SEQNUM=1
|
|
export ACTION=add
|
|
export DEVPATH=/block/sda
|
|
./udevsend block
|
|
|
|
export SEQNUM=2
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdb
|
|
./udevsend block
|
|
|
|
export SEQNUM=4
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sdc
|
|
./udevsend block
|
|
|
|
export SEQNUM=5
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sdb
|
|
./udevsend block
|
|
|
|
export SEQNUM=8
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdb
|
|
./udevsend block
|
|
|
|
export SEQNUM=6
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sda
|
|
./udevsend block
|
|
|
|
export SEQNUM=7
|
|
export ACTION=add
|
|
export DEVPATH=/block/sda
|
|
#./udevsend block
|
|
|
|
sleep 2
|
|
|
|
export SEQNUM=9
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdc
|
|
./udevsend block
|
|
|
|
export SEQNUM=11
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sdb
|
|
./udevsend block
|
|
|
|
export SEQNUM=10
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sdc
|
|
./udevsend block
|
|
|
|
export SEQNUM=13
|
|
export ACTION=add
|
|
export DEVPATH=/block/sda
|
|
./udevsend block
|
|
|
|
export SEQNUM=14
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdb
|
|
./udevsend block
|
|
|
|
export SEQNUM=15
|
|
export ACTION=add
|
|
export DEVPATH=/block/sdc
|
|
./udevsend block
|
|
|
|
sleep 2
|
|
|
|
export SEQNUM=12
|
|
export ACTION=remove
|
|
export DEVPATH=/block/sda
|
|
./udevsend block
|