chiark / gitweb /
udevd: add initsend
[elogind.git] / udevd.h
1 /*
2  * udevd.h
3  *
4  * Userspace devfs
5  *
6  * Copyright (C) 2004 Ling, Xiaofeng <xiaofeng.ling@intel.com>
7  * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
8  *
9  *
10  *      This program is free software; you can redistribute it and/or modify it
11  *      under the terms of the GNU General Public License as published by the
12  *      Free Software Foundation version 2 of the License.
13  * 
14  *      This program is distributed in the hope that it will be useful, but
15  *      WITHOUT ANY WARRANTY; without even the implied warranty of
16  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *      General Public License for more details.
18  * 
19  *      You should have received a copy of the GNU General Public License along
20  *      with this program; if not, write to the Free Software Foundation, Inc.,
21  *      675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  */
24
25 #include "list.h"
26
27 #define UDEV_MAGIC                      "udevd_" UDEV_VERSION
28 #define UDEVD_SOCK_PATH                 "udevd"
29 #define SEND_WAIT_MAX_SECONDS           3
30 #define SEND_WAIT_LOOP_PER_SECOND       10
31
32 #define UDEVD_PRIORITY                  -4
33 #define UDEV_PRIORITY                   -2
34
35 /* duration of initialization phase with shorter timeout */
36 #define INIT_TIME_SEC                   5
37 #define EVENT_INIT_TIMEOUT_SEC          2
38
39 /* timeout to wait for missing events */
40 #define EVENT_TIMEOUT_SEC               10
41
42 /* start to throttle forking if maximum number of running childs in our session is reached */
43 #define THROTTLE_MAX_RUNNING_CHILDS     10
44
45 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */
46 #define UEVENT_BUFFER_SIZE              1024
47 #define UEVENT_NUM_ENVP                 32
48
49 enum udevd_msg_type {
50         UDEVD_UNKNOWN,
51         UDEVD_UEVENT,
52         UDEVD_STOP_EXEC_QUEUE,
53         UDEVD_START_EXEC_QUEUE,
54 };
55
56
57 struct udevd_msg {
58         char magic[32];
59         enum udevd_msg_type type;
60         char envbuf[UEVENT_BUFFER_SIZE+512];
61 };
62
63 struct uevent_msg {
64         struct list_head node;
65         pid_t pid;
66         long queue_time;
67         char *action;
68         char *devpath;
69         char *subsystem;
70         unsigned long long seqnum;
71         char *physdevpath;
72         unsigned int timeout;
73         char *envp[UEVENT_NUM_ENVP+1];
74         char envbuf[];
75 };