-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmimpi_common.c
46 lines (35 loc) · 915 Bytes
/
mimpi_common.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* This file is for implementation of common interfaces used in both
* MIMPI library (mimpi.c) and mimpirun program (mimpirun.c).
* */
#include "mimpi_common.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
_Noreturn void syserr(const char* fmt, ...)
{
va_list fmt_args;
fprintf(stderr, "ERROR: ");
va_start(fmt_args, fmt);
vfprintf(stderr, fmt, fmt_args);
va_end(fmt_args);
fprintf(stderr, " (%d; %s)\n", errno, strerror(errno));
exit(1);
}
_Noreturn void fatal(const char* fmt, ...)
{
va_list fmt_args;
fprintf(stderr, "ERROR: ");
va_start(fmt_args, fmt);
vfprintf(stderr, fmt, fmt_args);
va_end(fmt_args);
fprintf(stderr, "\n");
exit(1);
}
/////////////////////////////////////////////////
// Put your implementation here