Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stddef.h>
  2. #include <stdlib.h>
  3. #ifdef __GNUC__
  4. #include <stdint.h>
  5. #include <errno.h>
  6. #include <limits.h>
  7. #include <unistd.h>
  8. #endif
  9.  
  10.  
  11. /* TODO: not thread-safe nor fork-safe */
  12. extern volatile int t_status;
  13.  
  14. #define T_LOC2(l) __FILE__ ":" #l
  15. #define T_LOC1(l) T_LOC2(l)
  16. #define t_error(...) t_printf(T_LOC1(__LINE__) ": " __VA_ARGS__)
  17.  
  18. int t_printf(const char *s, ...);
  19.  
  20. int t_vmfill(void **, size_t *, int);
  21. int t_memfill(void);
  22.  
  23. void t_fdfill(void);
  24.  
  25. void t_randseed(uint64_t s);
  26. uint64_t t_randn(uint64_t n);
  27. uint64_t t_randint(uint64_t a, uint64_t b);
  28. void t_shuffle(uint64_t *p, size_t n);
  29. void t_randrange(uint64_t *p, size_t n);
  30. int t_choose(uint64_t n, size_t k, uint64_t *p);
  31.  
  32. char *t_pathrel(char *buf, size_t n, char *argv0, char *p);
  33.  
  34. int t_setrlim(int r, long lim);
  35.  
  36. #include "print.inc"
  37. #include "rand.inc"
  38.