eudev/udevd.h
Kay Sievers 1bc3362678 add udevmonitor, to debug netlink+udev events at the same time
This rule:
  RUN+="socket:/org/kernel/udev/monitor"

send the event to the running monitor. Running udevstart give a nice
monitor output. Also the delay between the kernel uevent and the udev
udev event can be investigated:

  pim:/home/kay/src/udev-kay # ./udevmonitor
  UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1
  UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0
  UEVENT[1122920113] add@/class/scsi_host/host12
  UEVENT[1122920113] add@/class/usb_device/usbdev2.99
  UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host12/target12:0:0/12:0:0:0
  UDEV  [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1
  UEVENT[1122920113] add@/block/sda
  UEVENT[1122920113] add@/class/scsi_generic/sg0
  UEVENT[1122920113] add@/class/scsi_device/12:0:0:0
  UDEV  [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0
  UDEV  [1122920113] add@/class/scsi_host/host12
  UDEV  [1122920113] add@/class/usb_device/usbdev2.99
  UDEV  [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host12/target12:0:0/12:0:0:0
  UDEV  [1122920113] add@/block/sda
  UDEV  [1122920113] add@/class/scsi_generic/sg0
  UDEV  [1122920113] add@/class/scsi_device/12:0:0:0
  UEVENT[1122920115] add@/block/sda/sda1
  UDEV  [1122920115] add@/block/sda/sda1

  pim:/home/kay/src/udev-kay # ./udevmonitor --env
  UDEV  [1122920185] add@/block/sda/sda1
  ACTION=add
  DEVPATH=/block/sda/sda1
  SUBSYSTEM=block
  SEQNUM=2159
  MINOR=1
  MAJOR=8
  PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host13/target13:0:0/13:0:0:0
  PHYSDEVBUS=scsi
  PHYSDEVDRIVER=sd
  UDEVD_EVENT=1
  UDEV_LOG=3
  ID_VENDOR=IBM
  ID_MODEL=Memory_Key
  ID_REVISION=3.04
  ID_SERIAL=IBM_Memory_Key_0218B301030027E8
  ID_TYPE=disk
  ID_BUS=usb
  ID_PATH=usb-0218B301030027E8:0:0:0
  ID_FS_USAGE=filesystem
  ID_FS_TYPE=vfat
  ID_FS_VERSION=FAT16
  ID_FS_UUID=42D8-9E02
  ID_FS_LABEL_SAFE=s_p_c
  DEVNAME=/dev/sda1

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-01 20:22:46 +02:00

81 lines
2.1 KiB
C

/*
* udevd.h
*
* Copyright (C) 2004 Ling, Xiaofeng <xiaofeng.ling@intel.com>
* Copyright (C) 2004-2005 Kay Sievers <kay.sievers@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.
*
* 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 "list.h"
#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
/* duration of initialization phase with shorter timeout */
#define UDEVD_INIT_TIME 5
#define UDEVD_INIT_EVENT_TIMEOUT 2
/* timeout to wait for missing events */
#define UDEVD_EVENT_TIMEOUT 5
/* maximum limit of runnig childs */
#define UDEVD_MAX_CHILDS 64
/* start to throttle forking if maximum number of running childs in our session is reached */
#define UDEVD_MAX_CHILDS_RUNNING 8
/* environment buffer, should match the kernel's size in lib/kobject_uevent.h */
#define UEVENT_BUFFER_SIZE 1024
#define UEVENT_NUM_ENVP 32
enum udevd_msg_type {
UDEVD_UNKNOWN,
UDEVD_UEVENT_UDEVSEND,
UDEVD_UEVENT_INITSEND,
UDEVD_UEVENT_NETLINK,
UDEVD_STOP_EXEC_QUEUE,
UDEVD_START_EXEC_QUEUE,
UDEVD_SET_LOG_LEVEL,
UDEVD_SET_MAX_CHILDS,
};
struct udevd_msg {
char magic[32];
enum udevd_msg_type type;
char envbuf[UEVENT_BUFFER_SIZE+512];
};
struct uevent_msg {
enum udevd_msg_type type;
struct list_head node;
pid_t pid;
long queue_time;
char *action;
char *devpath;
char *subsystem;
dev_t devt;
unsigned long long seqnum;
char *physdevpath;
unsigned int timeout;
char *envp[UEVENT_NUM_ENVP+1];
char envbuf[];
};