3
0

sysconf.c 648 B

123456789101112131415161718192021222324252627282930
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Various system configuration helpers.
  4. *
  5. * Copyright (C) 2014 Bartosz Golaszewski <bartekgola@gmail.com>
  6. *
  7. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  8. */
  9. #include "libbb.h"
  10. #if !defined(bb_arg_max)
  11. unsigned FAST_FUNC bb_arg_max(void)
  12. {
  13. long r = sysconf(_SC_ARG_MAX);
  14. /* I've seen a version of uclibc which returned -1.
  15. * Guard about it, and also avoid insanely large values
  16. */
  17. if ((unsigned long)r > 64*1024*1024)
  18. r = 64*1024*1024;
  19. return r;
  20. }
  21. #endif
  22. /* Return the number of clock ticks per second. */
  23. unsigned FAST_FUNC bb_clk_tck(void)
  24. {
  25. return sysconf(_SC_CLK_TCK);
  26. }