Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
3a87fdefeb14a8bafe4e9f9dd5ea18dad5dd0751
[simgrid.git] / include / smpi / smpi_helpers.h
1 #ifndef MPI_HELPERS_H
2 #define MPI_HELPERS_H
3
4 #ifndef _GNU_SOURCE
5 #define _GNU_SOURCE
6 #endif
7
8 #include <unistd.h>
9 #include <sys/time.h> /* Load it before the define next line to not mess with the system headers */
10 #if _POSIX_TIMERS
11 #include <time.h>
12 #endif
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 int smpi_usleep(useconds_t usecs);
19 #if _POSIX_TIMERS > 0
20 int smpi_nanosleep(const struct timespec* tp, struct timespec* t);
21 int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp);
22 #endif
23 unsigned int smpi_sleep(unsigned int secs);
24 int smpi_gettimeofday(struct timeval* tv, struct timezone* tz);
25
26 struct option;
27 int smpi_getopt_long_only (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
28 int smpi_getopt_long (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
29 int smpi_getopt (int argc,  char *const *argv,  const char *options);
30
31 #define sleep(x) smpi_sleep(x)
32 #define usleep(x) smpi_usleep(x)
33 #define gettimeofday(x, y) smpi_gettimeofday(x, 0)
34 #if _POSIX_TIMERS > 0
35 #define nanosleep(x, y) smpi_nanosleep(x, y)
36 #define clock_gettime(x, y) smpi_clock_gettime(x, y)
37 #endif
38
39 #define getopt(x,y,z) smpi_getopt(x,y,z)
40 #define getopt_long(x,y,z,a,b) smpi_getopt_long(x,y,z,a,b)
41 #define getopt_long_only(x,y,z,a,b) smpi_getopt_long_only(x,y,z,a,b)
42
43 #ifdef __cplusplus
44 } // extern "C"
45 #endif
46 #endif