1 /* portable -- header loading to write portable code */
2 /* loads much more stuff than sysdep.h since the latter is in public interface*/
4 /* Copyright (c) 2004-2010, 2012-2015. The SimGrid Team.
5 * All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #ifndef SIMGRID_PORTABLE_H
11 #define SIMGRID_PORTABLE_H
13 #include "internal_config.h"
31 #ifdef HAVE_SYS_PARAM_H
32 # include <sys/param.h>
34 #ifdef HAVE_SYS_SYSCTL_H
35 # include <sys/sysctl.h>
46 #define EWOULDBLOCK WSAEWOULDBLOCK
50 #define EINPROGRESS WSAEINPROGRESS
54 #define ETIMEDOUT WSAETIMEDOUT
68 #ifdef HAVE_SYS_STAT_H
69 # include <sys/stat.h>
80 #ifdef TIME_WITH_SYS_TIME
81 # include <sys/time.h>
85 # include <sys/time.h>
99 **** string handling (parts from http://www.ijs.si/software/snprintf/)
102 /* prototype of C99 functions */
103 #if defined(HAVE_SNPRINTF)
106 XBT_PUBLIC(int) snprintf(char *, size_t, const char *, /*args */ ...);
107 XBT_PUBLIC(int) vsnprintf(char *, size_t, const char *, va_list);
111 /* use internal functions when OS provided ones are borken */
112 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
113 XBT_PRIVATE int portable_snprintf(char *str, size_t str_m, const char *fmt,
115 XBT_PRIVATE int portable_vsnprintf(char *str, size_t str_m, const char *fmt,
117 #define snprintf portable_snprintf
118 #define vsnprintf portable_vsnprintf
121 /* prototype of GNU functions */
122 #if (defined(__GNUC__) && !defined(__cplusplus))
123 XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt, /*args */ ...);
124 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
127 extern int asnprintf(char **ptr, size_t str_m, const char *fmt, /*args */
129 extern int vasnprintf(char **ptr, size_t str_m, const char *fmt,
133 * What we need to extract the backtrace in exception handling code
135 #ifdef HAVE_EXECINFO_H
136 # include <execinfo.h>
139 #endif /* SIMGRID_PORTABLE_H */