]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/lockd/lockd.c
Autogen update
[nfs-utils.git] / utils / lockd / lockd.c
1 /*
2  * lockd
3  *
4  * This is the user level part of lockd. This is very primitive, because
5  * all the work is now done in the kernel module.
6  *
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12
13 #include <stdio.h>
14 #include <unistd.h>
15 #include <string.h>
16 #include <errno.h>
17 #include <nfslib.h>
18
19
20
21 static void     usage(const char *);
22
23 int
24 main(int argc, char **argv)
25 {
26         int error;
27
28         if (argc > 1)
29                 usage (argv [0]);
30         
31         if (chdir(NFS_STATEDIR)) {
32                 fprintf(stderr, "%s: chdir(%s) failed: %s\n",
33                         argv [0], NFS_STATEDIR, strerror(errno));
34                 exit(1);
35         }
36
37         if ((error = lockdsvc()) < 0) {
38                 if (errno == EINVAL)
39                         /* Ignore EINVAL since kernel may start
40                            lockd automatically. */
41                         error = 0;
42                 else
43                         perror("lockdsvc");
44         }
45
46         return (error != 0);
47 }
48
49 static void
50 usage(const char *prog)
51 {
52         fprintf(stderr, "usage:\n%s\n", prog);
53         exit(2);
54 }