IRC bouncer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compat.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Copyright (C) 2019 C. McEnroe <june@causal.agency>
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. #include <stdint.h>
  17. #include <stdlib.h>
  18. // libcrypto defines these functions if libc doesn't.
  19. void explicit_bzero(void *b, size_t len);
  20. #ifndef strlcpy
  21. size_t strlcpy(char *restrict dst, const char *restrict src, size_t dstsize);
  22. size_t strlcat(char *restrict dst, const char *restrict src, size_t dstsize);
  23. #endif
  24. uint32_t arc4random(void);
  25. void arc4random_buf(void *buf, size_t nbytes);
  26. uint32_t arc4random_uniform(uint32_t upper_bound);
  27. // The default value of SO_RCVLOWAT is 1 anyway...
  28. #ifndef SO_NOSIGPIPE
  29. #define SO_NOSIGPIPE SO_RCVLOWAT
  30. #endif
  31. #ifndef SIGINFO
  32. #define SIGINFO SIGUSR2
  33. #endif