[Bug 589] New: feature req: Linux uevent processing support

bugzilla at busybox.net bugzilla at busybox.net
Wed Sep 2 13:59:32 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=589

           Summary: feature req: Linux uevent processing support
           Product: Busybox
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: arekm at maven.pl
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


Please consider adding builtin commands for processing uevent support.

uevent is Linux kernel mechanism for sending notifications to userspace. It's
done via netlink. This means that shell itself needs to support uevent to
gather netlink notifications.

uevent start [X] - start gathering uevent messages where X is optional max
number of stored events (oldest entries are dropped)

uevent get - get one gathered uevent message from shell memory [1, see below]

uevent stop - stop gathering uevent messages

uevent flush - drop all gathered messages

Example code on how to gather uevent messages:
http://lwn.net/Articles/242046/ (as you see it's done via netlink socket and
you need to poll, so it has to be shell feature)

http://git.fedorahosted.org/git/?p=mkinitrd;a=blob;f=nash/uevent.c;h=a05bd9896e37d22153d32f4074b635c973b367aa;hb=HEAD
(nash is fedora shell used for initrd)

Example usage in shell script:

uevent start 1000
while [ 1 ]; do
  uevent get
  if [ -n "$UEVENTDATE" ]; then
     echo "New event gathered at $UEVENTDATE"
     echo "ACTION: $UDEVNET_ACTION"
     echo "SUBSYSTEM: $UEVENT_SUBSYSTEM"
  fi
done


1.

uevent message can look like this:

UDEV_LOG=3
ACTION=remove   
DEVPATH=/block/sdb
SUBSYSTEM=block   
DEVNAME=/dev/sdb  
DEVTYPE=disk      
PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host11/target11:0:0/11:0:0:0
PHYSDEVBUS=scsi                                                                 
PHYSDEVDRIVER=sd                                                                
SEQNUM=3068                                                                     
MAJOR=8                                                                         
MINOR=16                                                                        
ID_VENDOR=Kingston                                                              
ID_VENDOR_ENC=Kingston                                                          
ID_VENDOR_ID=13fe                                                               
ID_MODEL=DataTraveler_2.0                                                       
ID_MODEL_ENC=DataTraveler\x202.0                                                
ID_MODEL_ID=1d00                                                                
ID_REVISION=PMAP                                                                
ID_SERIAL=Kingston_DataTraveler_2.0_5B7A1093032E-0:0                            
ID_SERIAL_SHORT=5B7A1093032E

so I guess "uevent get" should
- remove all UEVENT_* variables
- set all variables delivered via netlink as shell env variables but with
UEVENT_ prefix (so for example we would get env vars UEVENT_BUS=scsi or
UEVENT_DEVPATH=/block/sdb). Set additional UEVENTDATE=date of gathering of the
event.


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list