libexplain
1.4.D001
|
00001 /* 00002 * libexplain - Explain errno values returned by libc functions 00003 * Copyright (C) 2008, 2009, 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 00008 * 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/ac/errno.h> 00020 #include <libexplain/ac/unistd.h> 00021 00022 #include <libexplain/buffer/errno/wait3.h> 00023 #include <libexplain/buffer/errno/wait4.h> 00024 #include <libexplain/buffer/pointer.h> 00025 #include <libexplain/buffer/waitpid_options.h> 00026 #include <libexplain/explanation.h> 00027 00028 00029 static void 00030 explain_buffer_errno_wait3_system_call(explain_string_buffer_t *sb, 00031 int errnum, int *status, int options, struct rusage *rusage) 00032 { 00033 (void)errnum; 00034 explain_string_buffer_puts(sb, "wait3(status = "); 00035 explain_buffer_pointer(sb, status); 00036 explain_string_buffer_puts(sb, ", options = "); 00037 explain_buffer_waitpid_options(sb, options); 00038 explain_string_buffer_puts(sb, ", rusage = "); 00039 explain_buffer_pointer(sb, rusage); 00040 explain_string_buffer_putc(sb, ')'); 00041 } 00042 00043 00044 static void 00045 explain_buffer_errno_wait3_explanation(explain_string_buffer_t *sb, 00046 int errnum, int *status, int options, struct rusage *rusage) 00047 { 00048 explain_buffer_errno_wait4_explanation 00049 ( 00050 sb, 00051 errnum, 00052 "wait3", 00053 -1, 00054 status, 00055 options, 00056 rusage 00057 ); 00058 } 00059 00060 00061 void 00062 explain_buffer_errno_wait3(explain_string_buffer_t *sb, int errnum, 00063 int *status, int options, struct rusage *rusage) 00064 { 00065 explain_explanation_t exp; 00066 00067 explain_explanation_init(&exp, errnum); 00068 explain_buffer_errno_wait3_system_call 00069 ( 00070 &exp.system_call_sb, 00071 errnum, 00072 status, 00073 options, 00074 rusage 00075 ); 00076 explain_buffer_errno_wait3_explanation 00077 ( 00078 &exp.explanation_sb, 00079 errnum, 00080 status, 00081 options, 00082 rusage 00083 ); 00084 explain_explanation_assemble(&exp, sb); 00085 } 00086 00087 00088 /* vim: set ts=8 sw=4 et : */