Files
linuxkit/projects/ebpf/ebpf.build/error.h
Rolf Neugebauer 5592b58549 projects: Move non-working ebpf bits under projects
The ebpf packages were somewhat neglected during the restructuring of the
the repository and currently do not build. They were also a little awkward
to use. So move them to ./projects for now until it matures.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-03-29 17:36:25 +01:00

30 lines
620 B
C

# include <stdio.h>
# include <stdarg.h>
# include <stdlib.h>
# include <string.h>
static void error_at_line(int status, int errnum, const char *filename,
unsigned int linenum, const char *format, ...)
{
va_list ap;
fflush(stdout);
if (filename != NULL)
fprintf(stderr, "%s:%u: ", filename, linenum);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
if (errnum != 0)
fprintf(stderr, ": %s", strerror(errnum));
fprintf(stderr, "\n");
if (status != 0)
exit(status);
}
#define error(status, errnum, format...) \
error_at_line(status, errnum, NULL, 0, format)