source: branches/3.0/mindi-busybox/console-tools/fgconsole.c @ 3085

Last change on this file since 3085 was 2725, checked in by bruno, 8 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
  • Property svn:eol-style set to native
File size: 795 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini fgconsole implementation for busybox
4 *
5 * Copyright (C) 2010 by Grigory Batalov <bga@altlinux.org>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */
9
10#include "libbb.h"
11
12/* From <linux/vt.h> */
13struct vt_stat {
14    unsigned short v_active;        /* active vt */
15    unsigned short v_signal;        /* signal to send */
16    unsigned short v_state;         /* vt bitmask */
17};
18enum { VT_GETSTATE = 0x5603 }; /* get global vt state info */
19
20int fgconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
21int fgconsole_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
22{
23    struct vt_stat vtstat;
24
25    vtstat.v_active = 0;
26    xioctl(get_console_fd_or_die(), VT_GETSTATE, &vtstat);
27    printf("%d\n", vtstat.v_active);
28
29    return EXIT_SUCCESS;
30}
Note: See TracBrowser for help on using the repository browser.