libexplain  1.4.D001
libexplain/iocontrol/vt_lockswitch.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2009-2011, 2013 Peter Miller
00004  *
00005  * This program is free software; you can redistribute it and/or modify it
00006  * under the terms of the GNU Lesser General Public License as published by
00007  * the Free Software Foundation; either version 3 of the License, or (at your
00008  * option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,but WITHOUT
00011  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00013  * for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <libexplain/ac/sys/ioctl.h>
00020 #include <libexplain/ac/errno.h>
00021 #include <libexplain/ac/linux/vt.h>
00022 
00023 #include <libexplain/buffer/eperm.h>
00024 #include <libexplain/capability.h>
00025 #include <libexplain/iocontrol/generic.h>
00026 #include <libexplain/iocontrol/vt_lockswitch.h>
00027 
00028 #ifdef VT_LOCKSWITCH
00029 
00030 
00031 static void
00032 print_explanation(const explain_iocontrol_t *p, explain_string_buffer_t *sb, int
00033     errnum, int fildes, int request, const void *data)
00034 {
00035     switch (errnum)
00036     {
00037     case EPERM:
00038         if (!explain_capability_sys_tty_config())
00039         {
00040             explain_buffer_eperm_sys_tty_config(sb, "ioctl VT_LOCKSWITCH");
00041             break;
00042         }
00043         goto generic;
00044 
00045     default:
00046         generic:
00047         explain_iocontrol_generic_print_explanation
00048         (
00049             p,
00050             sb,
00051             errnum,
00052             fildes,
00053             request,
00054             data
00055         );
00056         break;
00057     }
00058 }
00059 
00060 
00061 const explain_iocontrol_t explain_iocontrol_vt_lockswitch =
00062 {
00063     "VT_LOCKSWITCH", /* name */
00064     VT_LOCKSWITCH, /* value */
00065     0, /* disambiguate */
00066     0, /* print_name */
00067     explain_iocontrol_generic_print_data_ignored, /* print_data */
00068     print_explanation,
00069     0, /* print_data_returned */
00070     NOT_A_POINTER, /* data_size */
00071     "intptr_t", /* data_type */
00072     0, /* flags */
00073     __FILE__,
00074     __LINE__,
00075 };
00076 
00077 #else /* ndef VT_LOCKSWITCH */
00078 
00079 const explain_iocontrol_t explain_iocontrol_vt_lockswitch =
00080 {
00081     0, /* name */
00082     0, /* value */
00083     0, /* disambiguate */
00084     0, /* print_name */
00085     0, /* print_data */
00086     0, /* print_explanation */
00087     0, /* print_data_returned */
00088     0, /* data_size */
00089     0, /* data_type */
00090     0, /* flags */
00091     __FILE__,
00092     __LINE__,
00093 };
00094 
00095 #endif /* VT_LOCKSWITCH */
00096 
00097 
00098 /* vim: set ts=8 sw=4 et : */