diff options
Diffstat (limited to 'erts/include/internal')
-rw-r--r-- | erts/include/internal/erl_misc_utils.h | 29 | ||||
-rw-r--r-- | erts/include/internal/erl_printf.h | 7 | ||||
-rw-r--r-- | erts/include/internal/erl_printf_format.h | 3 |
3 files changed, 37 insertions, 2 deletions
diff --git a/erts/include/internal/erl_misc_utils.h b/erts/include/internal/erl_misc_utils.h index a4a5d1d510..55566ddf74 100644 --- a/erts/include/internal/erl_misc_utils.h +++ b/erts/include/internal/erl_misc_utils.h @@ -56,4 +56,33 @@ int erts_map_win_error_to_errno(DWORD win_error); int erts_get_last_win_errno(void); #endif +#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) +#define __DARWIN__ 1 +#endif + +/* + * ERTS_PREMATURE_TIMEOUT() expects time units + * 1000 (millisec), 1000000 (microsec), or + * 1000000000 (nanosec). Might not work properly + * otherwise. + */ +#undef ERTS_USE_PREMATURE_TIMEOUT +#undef ERTS_PREMATURE_TIMEOUT + +#if defined(__DARWIN__) +#define ERTS_USE_PREMATURE_TIMEOUT 1 +#define ERTS_PREMATURE_TIMEOUT(TMO, TU) \ + ((TMO) >= 1 * ((TU) / 1000) \ + ? ((TMO) >= 20 * ((TU) / 1000) \ + ? 15 * ((TU) / 1000) \ + : ((TMO) >= 5 * ((TU) / 1000) \ + ? 3 * ((TU) / 1000) \ + : 5 * ((TU) / 10000))) \ + : 0) + +#else +#define ERTS_USE_PREMATURE_TIMEOUT 0 +#define ERTS_PREMATURE_TIMEOUT(TMO, TU) (0) +#endif + #endif /* #ifndef ERL_MISC_UTILS_H_ */ diff --git a/erts/include/internal/erl_printf.h b/erts/include/internal/erl_printf.h index c4565dfafc..f180a53f18 100644 --- a/erts/include/internal/erl_printf.h +++ b/erts/include/internal/erl_printf.h @@ -41,12 +41,18 @@ struct erts_dsprintf_buf_t_ { #define ERTS_DSPRINTF_BUF_INITER(GFUNC) {NULL, 0, 0, (GFUNC)} +typedef int (*fmtfn_t)(void*, char*, size_t); + +int erts_write_fd(void *vfdp, char* buf, size_t len); +int erts_write_ds(void *vdsbufp, char* buf, size_t len); + int erts_printf(const char *, ...); int erts_fprintf(FILE *, const char *, ...); int erts_fdprintf(int, const char *, ...); int erts_sprintf(char *, const char *, ...); int erts_snprintf(char *, size_t, const char *, ...); int erts_dsprintf(erts_dsprintf_buf_t *, const char *, ...); +int erts_cbprintf(fmtfn_t, void*, const char*, ...); int erts_vprintf(const char *, va_list); int erts_vfprintf(FILE *, const char *, va_list); @@ -54,5 +60,6 @@ int erts_vfdprintf(int, const char *, va_list); int erts_vsprintf(char *, const char *, va_list); int erts_vsnprintf(char *, size_t, const char *, va_list); int erts_vdsprintf(erts_dsprintf_buf_t *, const char *, va_list); +int erts_vcbprintf(fmtfn_t, void*, const char*, va_list); #endif /* #ifndef ERL_PRINTF_H_ */ diff --git a/erts/include/internal/erl_printf_format.h b/erts/include/internal/erl_printf_format.h index 4f969bdbcb..56ec032bd1 100644 --- a/erts/include/internal/erl_printf_format.h +++ b/erts/include/internal/erl_printf_format.h @@ -30,6 +30,7 @@ #include <stdlib.h> #include "erl_int_sizes_config.h" +#include "erl_printf.h" #if SIZEOF_VOID_P == SIZEOF_LONG typedef unsigned long ErlPfUWord; @@ -44,8 +45,6 @@ typedef long long ErlPfSWord; #error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint' #endif -typedef int (*fmtfn_t)(void*, char*, size_t); - extern int erts_printf_format(fmtfn_t, void*, char*, va_list); extern int erts_printf_char(fmtfn_t, void*, char); |