http://www.azstarnet.com/~ymg/files/slsnif-0.4.0.tar.gz
[slsnif.git] / src / devlck.h
1 /*  devlck.h
2  *  Copyright (C) 2001 Yan "Warrior" Gurtovoy (ymg@azstarnet.com)
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 #ifndef HAVE_DEVLCK_H
20
21 #define HAVE_DEVLCK_H
22
23 #include <signal.h>
24 #include <unistd.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <errno.h>
28 #include <paths.h>
29 #include <string.h>
30 #include <sys/stat.h>
31 #include <sys/types.h>
32 #include <sys/param.h>
33
34 #ifdef HAVE_LINUX_KDEV_T_H
35 #include <linux/kdev_t.h>
36 #else
37 /* define MAJOR() and MINOR() here */
38 #define MAJOR(dev)      ((dev)>>8)
39 #define MINOR(dev)      ((dev) & 0xff)
40 #endif
41
42 #ifdef HAVE_LINUX_MAJOR_H
43 #include <linux/major.h>
44 #else
45 /* define TTY_MAJOR and TTYAUX_MAJOR here*/
46 #define TTY_MAJOR 4
47 #define TTYAUX_MAJOR 5
48 #endif
49
50 #ifndef _PATH_LOCK
51 #define LOCK_PATH "/var/lock"
52 #else
53 #define LOCK_PATH _PATH_LOCK
54 #endif
55
56 #ifndef MAXPATHLEN
57 #define MAXPATHLEN 255
58 #endif
59
60 #define DINVNAME "Invalid device name"
61 #define DACCFAIL "Failed to access device"
62 #define RACECOND "Unable to obtain lock. Detected race condition with process "
63 #define REMFAIL  "Failed to remove lock file "
64
65 typedef struct {
66     struct stat strec;       /* stat structure */
67     char        fsstnd[256]; /* FSSTND-1.2 lock file name */
68     char        svr4[256];   /* SVr4 lock file name */
69 } devrec;
70
71 #endif