document exit codes in the man pages
[vlock.git] / vlock-lockswitch.c
blob9f632515cbe94774c23ba62f96da02e6df4051bf
1 /* vlock-lockswitch.c -- console switch locking routine for vlock,
2 * the VT locking program for linux
4 * This program is copyright (C) 2007 Frank Benkstein, and is free
5 * software which is freely distributable under the terms of the
6 * GNU General Public License version 2, included as the file COPYING in this
7 * distribution. It is NOT public domain software, and any
8 * redistribution not permitted by the GNU General Public License is
9 * expressly forbidden without prior written permission from
10 * the author.
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #include <fcntl.h>
19 #include <sys/ioctl.h>
20 #include <sys/vt.h>
22 #include "vlock.h"
24 int main(void) {
25 int consfd;
27 if ((consfd = open(CONSOLE, O_RDWR)) < 0) {
28 perror("vlock-lockswitch: cannot open virtual console");
29 exit (1);
32 /* globally disable virtual console switching */
33 if (ioctl(consfd, VT_LOCKSWITCH) < 0) {
34 perror("vlock-lockswitch: could not disable console switching");
35 exit (1);
38 return 0;