]> git.ipfire.org Git - thirdparty/systemd.git/blame - udevd.h
udevd: improve timeout handling
[thirdparty/systemd.git] / udevd.h
CommitLineData
7fafc032
KS
1/*
2 * udevd.h
3 *
4 * Userspace devfs
5 *
6 * Copyright (C) 2004 Ling, Xiaofeng <xiaofeng.ling@intel.com>
53921bfa 7 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
7fafc032
KS
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
a695feae 25#include "list.h"
33db4b8d 26
8e2229c4 27#define UDEV_MAGIC "udevd_" UDEV_VERSION
872344c4 28#define UDEVD_SOCK_PATH "udevd"
a15f42c4
KS
29#define UDEVSEND_WAIT_MAX_SECONDS 3
30#define UDEVSEND_WAIT_LOOP_PER_SECOND 10
085cce37
KS
31
32#define UDEVD_PRIORITY -4
33#define UDEV_PRIORITY -2
34
35/* duration of initialization phase with shorter timeout */
a15f42c4
KS
36#define UDEVD_INIT_TIME 5
37#define UDEVD_INIT_EVENT_TIMEOUT 2
085cce37
KS
38
39/* timeout to wait for missing events */
a15f42c4 40#define UDEVD_EVENT_TIMEOUT 5
5cab7caa 41
a15f42c4
KS
42/* maximum limit of runnig childs */
43#define UDEVD_MAX_CHILDS 64
085cce37 44/* start to throttle forking if maximum number of running childs in our session is reached */
a15f42c4 45#define UDEVD_MAX_CHILDS_RUNNING 8
085cce37 46
4a231017 47/* environment buffer, should match the kernel's size in lib/kobject_uevent.h */
3b47c739
KS
48#define UEVENT_BUFFER_SIZE 1024
49#define UEVENT_NUM_ENVP 32
7fafc032 50
3b47c739
KS
51enum udevd_msg_type {
52 UDEVD_UNKNOWN,
53 UDEVD_UEVENT,
54 UDEVD_STOP_EXEC_QUEUE,
55 UDEVD_START_EXEC_QUEUE,
4a231017
KS
56};
57
3b47c739
KS
58
59struct udevd_msg {
60 char magic[32];
61 enum udevd_msg_type type;
62 char envbuf[UEVENT_BUFFER_SIZE+512];
63};
64
65struct uevent_msg {
f8a178a3 66 struct list_head node;
35b7d88c 67 pid_t pid;
e5a2989e 68 long queue_time;
4a231017
KS
69 char *action;
70 char *devpath;
71 char *subsystem;
72 unsigned long long seqnum;
79721e0a 73 char *physdevpath;
7f7ae03a 74 unsigned int timeout;
3b47c739 75 char *envp[UEVENT_NUM_ENVP+1];
4a231017 76 char envbuf[];
7fafc032 77};