compat.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*****************************************************************************
  2. * __________________ _________ _____ _____ .__ ._.
  3. * \______ \______ \ / _____/ / \ / _ \ |__| ____ | |
  4. * | | _/| | \ \_____ \ / \ / \ / /_\ \| _/ __ \ | |
  5. * | | \| ` \/ / Y \ / | | \ ___/ \|
  6. * |______ /_______ /_______ \____|__ / /\ \____|__ |__|\___ | __
  7. * \/ \/ \/ \/ )/ \/ \/ \/
  8. *
  9. * This file is part of liBDSM. Copyright © 2014-2015 VideoLabs SAS
  10. *
  11. * Author: Julien 'Lta' BALLET <contact@lta.io>
  12. *
  13. * liBDSM is released under LGPLv2.1 (or later) and is also available
  14. * under a commercial license.
  15. *****************************************************************************
  16. * This program is free software; you can redistribute it and/or modify it
  17. * under the terms of the GNU Lesser General Public License as published by
  18. * the Free Software Foundation; either version 2.1 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Lesser General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Lesser General Public License
  27. * along with this program; if not, write to the Free Software Foundation,
  28. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  29. *****************************************************************************/
  30. #include "config.h"
  31. #include <stdlib.h>
  32. #if !defined HAVE_STRLCPY && !defined HAVE_LIBBSD
  33. size_t strlcpy(char *dst, const char *src, size_t siz);
  34. #endif
  35. #ifndef HAVE_CLOCKID_T
  36. typedef int clockid_t;
  37. #endif
  38. #if !HAVE_DECL_CLOCK_MONOTONIC
  39. enum {
  40. CLOCK_REALTIME,
  41. CLOCK_MONOTONIC,
  42. CLOCK_PROCESS_CPUTIME_ID,
  43. CLOCK_THREAD_CPUTIME_ID
  44. };
  45. #endif
  46. #if !defined HAVE_CLOCK_GETTIME
  47. int clock_gettime(clockid_t clk_id, struct timespec *tp);
  48. #endif
  49. #if !defined HAVE_STRNDUP
  50. char *strndup(const char *str, size_t n);
  51. #endif
  52. #ifndef O_NONBLOCK
  53. # define O_NONBLOCK 0
  54. #endif
  55. #if !defined HAVE_SYS_QUEUE_H
  56. # include "queue.h"
  57. #endif
  58. #if !defined(HAVE_PIPE) && defined(HAVE__PIPE)
  59. #define HAVE_PIPE
  60. int pipe(int fds[2]);
  61. #endif