#ifndef RUBY_MISSING_H /*-*-C++-*-vi:se ft=cpp:*/
* @date Sat May 11 23:46:03 JST 2002
* @copyright This file is a part of the programming language Ruby.
* Permission is hereby granted, to either redistribute and/or
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
* @brief Prototype for *.c in ./missing, and for missing timeval struct.
#include "ruby/internal/config.h"
# include <math.h> /* for INFINITY and NAN */
#ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
# include RUBY_ALTERNATIVE_MALLOC_HEADER
#if defined(HAVE_SYS_TIME_H)
#include "ruby/internal/dllexport.h"
#include "ruby/internal/attr/format.h"
# define M_PI 3.14159265358979323846
#if !defined(HAVE_STRUCT_TIMEVAL)
time_t tv_sec; /* seconds */
long tv_usec; /* microseconds */
#endif /* HAVE_STRUCT_TIMEVAL */
#if !defined(HAVE_STRUCT_TIMESPEC)
/* :BEWARE: @shyouhei warns that IT IS A WRONG IDEA to define our own version
* of struct timespec here. `clock_gettime` is a system call, and your kernel
* could expect something other than just `long` (results stack smashing if
* that happens). See also https://ewontfix.com/19/ */
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
#if !defined(HAVE_STRUCT_TIMEZONE)
RBIMPL_SYMBOL_EXPORT_BEGIN()
RUBY_EXTERN double acosh(double);
RUBY_EXTERN double asinh(double);
RUBY_EXTERN double atanh(double);
RUBY_EXTERN char *crypt(const char *, const char *);
RUBY_EXTERN int eaccess(const char*, int);
RUBY_EXTERN double round(double); /* numeric.c */
RUBY_EXTERN int flock(int, int);
RUBY_EXTERN double frexp(double, int *);
RUBY_EXTERN double hypot(double, double);
RUBY_EXTERN double erf(double);
RUBY_EXTERN double erfc(double);
RUBY_EXTERN double tgamma(double);
RUBY_EXTERN double lgamma_r(double, int *);
RUBY_EXTERN double cbrt(double);
#if !defined(INFINITY) || !defined(NAN)
union bytesequence4_or_float {
unsigned char bytesequence[4];
RUBY_EXTERN const union bytesequence4_or_float rb_infinity;
# define INFINITY (rb_infinity.float_value)
# define USE_RB_INFINITY 1
RUBY_EXTERN const union bytesequence4_or_float rb_nan;
# define NAN (rb_nan.float_value)
# define HUGE_VAL ((double)INFINITY)
# define finite(x) isfinite(x)
RUBY_EXTERN double nan(const char *);
RUBY_EXTERN double nextafter(double x, double y);
RUBY_EXTERN int memcmp(const void *, const void *, size_t);
RUBY_EXTERN void *memmove(void *, const void *, size_t);
RUBY_EXTERN double modf(double, double *);
RUBY_EXTERN char *strchr(const char *, int);
RUBY_EXTERN char *strrchr(const char *, int);
RUBY_EXTERN char *strerror(int);
RUBY_EXTERN char *strstr(const char *, const char *);
RUBY_EXTERN size_t strlcpy(char *, const char*, size_t);
RUBY_EXTERN size_t strlcat(char *, const char*, size_t);
RUBY_EXTERN int ffs(int);
RUBY_EXTERN int ruby_getpeername(int, struct sockaddr *, socklen_t *);
RUBY_EXTERN int ruby_getsockname(int, struct sockaddr *, socklen_t *);
RUBY_EXTERN int ruby_shutdown(int, int);
RUBY_EXTERN int ruby_close(int);
#ifndef HAVE_SETPROCTITLE
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 1, 2)
RUBY_EXTERN void setproctitle(const char *fmt, ...);
#ifdef HAVE_EXPLICIT_BZERO
#elif defined(SecureZeroMemory)
# define explicit_bzero(b, len) SecureZeroMemory(b, len)
RUBY_EXTERN void explicit_bzero(void *b, size_t len);
RUBY_EXTERN void tzset(void);
#ifndef HAVE_POSIX_MADVISE
RUBY_EXTERN int posix_madvise(void *, size_t, int);
RUBY_EXTERN rb_uid_t geteuid(void);
RUBY_EXTERN rb_uid_t getuid(void);
RUBY_EXTERN rb_gid_t getegid(void);
RUBY_EXTERN rb_gid_t getgid(void);
RUBY_EXTERN char *getlogin(void);
RUBY_EXTERN rb_pid_t getppid(void);
RUBY_EXTERN rb_mode_t umask(rb_mode_t);
RUBY_EXTERN int chmod(const char *, rb_mode_t);
RUBY_EXTERN int chown(const char *, rb_uid_t, rb_gid_t);
RUBY_EXTERN int pclose(FILE *);
RUBY_EXTERN FILE *popen(const char *, const char *);
RUBY_EXTERN int pipe(int [2]);
RUBY_EXTERN int dup(int);
RUBY_EXTERN int dup2(int, int);
RUBY_EXTERN int kill(rb_pid_t, int);
RUBY_EXTERN int execl(const char *, const char *, ...);
RUBY_EXTERN int execle(const char *, const char *, ...);
RUBY_EXTERN int execv(const char *, char *const []);
RUBY_EXTERN int execve(const char *, char *const [], char *const []);
RUBY_EXTERN int shutdown(int, int);
RUBY_EXTERN int system(const char *);
RUBY_EXTERN rb_pid_t waitpid(rb_pid_t, int *, int);
RBIMPL_SYMBOL_EXPORT_END()
#endif /* RUBY_MISSING_H */