diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-10-09 21:02:23 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-10-09 21:02:23 +0000 |
| commit | e54757bb6377880f5314edbc2ef30fce1e936d11 (patch) | |
| tree | d58b8185402dab79ee22b2fde663db2a14a092dc /miscutils/devfsd.c | |
| parent | d74ee701257eea6e8073a896a844a2236d9a0e47 (diff) | |
| download | busybox-w32-e54757bb6377880f5314edbc2ef30fce1e936d11.tar.gz busybox-w32-e54757bb6377880f5314edbc2ef30fce1e936d11.tar.bz2 busybox-w32-e54757bb6377880f5314edbc2ef30fce1e936d11.zip | |
Do not use kernel headers
git-svn-id: svn://busybox.net/trunk/busybox@7629 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'miscutils/devfsd.c')
| -rw-r--r-- | miscutils/devfsd.c | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 4391f341d..a53328fab 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
| @@ -57,8 +57,6 @@ | |||
| 57 | #include <stdarg.h> | 57 | #include <stdarg.h> |
| 58 | #include <string.h> | 58 | #include <string.h> |
| 59 | #include <ctype.h> | 59 | #include <ctype.h> |
| 60 | #include <pwd.h> | ||
| 61 | #include <grp.h> | ||
| 62 | #include <sys/time.h> | 60 | #include <sys/time.h> |
| 63 | #include <sys/stat.h> | 61 | #include <sys/stat.h> |
| 64 | #include <sys/types.h> | 62 | #include <sys/types.h> |
| @@ -68,20 +66,59 @@ | |||
| 68 | #include <sys/un.h> | 66 | #include <sys/un.h> |
| 69 | #include <dirent.h> | 67 | #include <dirent.h> |
| 70 | #include <fcntl.h> | 68 | #include <fcntl.h> |
| 71 | #include <linux/major.h> | ||
| 72 | #include <linux/devfs_fs.h> | ||
| 73 | #include <linux/kdev_t.h> | ||
| 74 | #include <syslog.h> | 69 | #include <syslog.h> |
| 75 | #include <signal.h> | 70 | #include <signal.h> |
| 76 | #include <regex.h> | 71 | #include <regex.h> |
| 77 | #include <errno.h> | 72 | #include <errno.h> |
| 73 | #include <sys/sysmacros.h> | ||
| 74 | |||
| 75 | |||
| 76 | /* Various defines taken from linux/major.h */ | ||
| 77 | #define IDE0_MAJOR 3 | ||
| 78 | #define IDE1_MAJOR 22 | ||
| 79 | #define IDE2_MAJOR 33 | ||
| 80 | #define IDE3_MAJOR 34 | ||
| 81 | #define IDE4_MAJOR 56 | ||
| 82 | #define IDE5_MAJOR 57 | ||
| 83 | #define IDE6_MAJOR 88 | ||
| 84 | #define IDE7_MAJOR 89 | ||
| 85 | #define IDE8_MAJOR 90 | ||
| 86 | #define IDE9_MAJOR 91 | ||
| 87 | |||
| 88 | |||
| 89 | /* Various defines taken from linux/devfs_fs.h */ | ||
| 90 | #define DEVFSD_PROTOCOL_REVISION_KERNEL 5 | ||
| 91 | #define DEVFSD_IOCTL_BASE 'd' | ||
| 92 | /* These are the various ioctls */ | ||
| 93 | #define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int) | ||
| 94 | #define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int) | ||
| 95 | #define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int) | ||
| 96 | #define DEVFSDIOC_SET_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int) | ||
| 97 | #define DEVFSD_NOTIFY_REGISTERED 0 | ||
| 98 | #define DEVFSD_NOTIFY_UNREGISTERED 1 | ||
| 99 | #define DEVFSD_NOTIFY_ASYNC_OPEN 2 | ||
| 100 | #define DEVFSD_NOTIFY_CLOSE 3 | ||
| 101 | #define DEVFSD_NOTIFY_LOOKUP 4 | ||
| 102 | #define DEVFSD_NOTIFY_CHANGE 5 | ||
| 103 | #define DEVFSD_NOTIFY_CREATE 6 | ||
| 104 | #define DEVFSD_NOTIFY_DELETE 7 | ||
| 105 | #define DEVFS_PATHLEN 1024 /* Never change this otherwise the | ||
| 106 | binary interface will change */ | ||
| 107 | struct devfsd_notify_struct | ||
| 108 | { /* Use native C types to ensure same types in kernel and user space */ | ||
| 109 | unsigned int type; /* DEVFSD_NOTIFY_* value */ | ||
| 110 | unsigned int mode; /* Mode of the inode or device entry */ | ||
| 111 | unsigned int major; /* Major number of device entry */ | ||
| 112 | unsigned int minor; /* Minor number of device entry */ | ||
| 113 | unsigned int uid; /* Uid of process, inode or device entry */ | ||
| 114 | unsigned int gid; /* Gid of process, inode or device entry */ | ||
| 115 | unsigned int overrun_count; /* Number of lost events */ | ||
| 116 | unsigned int namelen; /* Number of characters not including '\0' */ | ||
| 117 | /* The device name MUST come last */ | ||
| 118 | char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */ | ||
| 119 | }; | ||
| 120 | |||
| 78 | 121 | ||
| 79 | #ifndef IDE6_MAJOR /* In case we're building with an ancient kernel */ | ||
| 80 | # define IDE6_MAJOR 88 | ||
| 81 | # define IDE7_MAJOR 89 | ||
| 82 | # define IDE8_MAJOR 90 | ||
| 83 | # define IDE9_MAJOR 91 | ||
| 84 | #endif | ||
| 85 | 122 | ||
| 86 | /* These are now in Config.in */ | 123 | /* These are now in Config.in */ |
| 87 | /* define this if you want to have more output on stderr and syslog at the same time */ | 124 | /* define this if you want to have more output on stderr and syslog at the same time */ |
| @@ -1340,8 +1377,8 @@ static void do_scan_and_service (const char *dir_name) | |||
| 1340 | memset (&info, 0, sizeof info); | 1377 | memset (&info, 0, sizeof info); |
| 1341 | info.type = DEVFSD_NOTIFY_REGISTERED; | 1378 | info.type = DEVFSD_NOTIFY_REGISTERED; |
| 1342 | info.mode = statbuf.st_mode; | 1379 | info.mode = statbuf.st_mode; |
| 1343 | info.major = MAJOR (statbuf.st_rdev); | 1380 | info.major = major (statbuf.st_rdev); |
| 1344 | info.minor = MINOR (statbuf.st_rdev); | 1381 | info.minor = minor (statbuf.st_rdev); |
| 1345 | info.uid = statbuf.st_uid; | 1382 | info.uid = statbuf.st_uid; |
| 1346 | info.gid = statbuf.st_gid; | 1383 | info.gid = statbuf.st_gid; |
| 1347 | snprintf (info.devname, sizeof (info.devname), "%s", path + strlen (mount_point) + 1); | 1384 | snprintf (info.devname, sizeof (info.devname), "%s", path + strlen (mount_point) + 1); |
