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