libexplain  1.4.D001
libexplain/buffer/ewouldblock.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2009, 2013 Peter Miller
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as
00007  * published by the Free Software Foundation; either version 3 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License 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/buffer/ewouldblock.h>
00020 
00021 
00022 void
00023 explain_buffer_eagain(explain_string_buffer_t *sb, const char *caption)
00024 {
00025     explain_buffer_ewouldblock(sb, caption);
00026 }
00027 
00028 
00029 void
00030 explain_buffer_ewouldblock(explain_string_buffer_t *sb, const char *caption)
00031 {
00032     explain_string_buffer_printf_gettext
00033     (
00034         sb,
00035         /*
00036          * xgettext: this error message is issued to explain an
00037          * EWOULDBLOCK error.  It is a generic response, suitable for
00038          * many system calls, however there are also some more specific
00039          * EWOULDBLOCK messages that contributors should check for
00040          * re-usability before using this one.
00041          *
00042          * %1$s => the name of the system call
00043          */
00044         i18n("the %s would have had to wait to complete however it was "
00045             "instructed not to do so"),
00046         caption
00047     );
00048 }
00049 
00050 
00051 void
00052 explain_buffer_eagain_accept(explain_string_buffer_t *sb)
00053 {
00054     explain_string_buffer_printf_gettext
00055     (
00056         sb,
00057         /*
00058          * xgettext:  This message is used to explain an EAGAIN
00059          * error reprted by an accept(2) system call, in the case
00060          * where the socket is marked non-blocking (O_NONBLOCK) and
00061          * no connections are waiting to be accepted.
00062          */
00063         i18n("the socket is marked non-blocking and no connections "
00064             "are present to be accepted")
00065     );
00066 }
00067 
00068 
00069 /* vim: set ts=8 sw=4 et : */