2014-06-22 11:54:40 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
|
|
|
/*
|
|
|
|
* Various system configuration helpers.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Bartosz Golaszewski <bartekgola@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
|
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
|
2014-11-26 14:17:59 +00:00
|
|
|
#if !defined(bb_arg_max)
|
2014-06-22 11:54:40 +00:00
|
|
|
unsigned FAST_FUNC bb_arg_max(void)
|
|
|
|
{
|
2014-12-24 00:46:29 +00:00
|
|
|
long r = sysconf(_SC_ARG_MAX);
|
|
|
|
|
|
|
|
/* I've seen a version of uclibc which returned -1.
|
|
|
|
* Guard about it, and also avoid insanely large values
|
|
|
|
*/
|
|
|
|
if ((unsigned long)r > 64*1024*1024)
|
|
|
|
r = 64*1024*1024;
|
|
|
|
|
|
|
|
return r;
|
2014-06-22 11:54:40 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-06-22 12:01:13 +00:00
|
|
|
|
|
|
|
/* Return the number of clock ticks per second. */
|
|
|
|
unsigned FAST_FUNC bb_clk_tck(void)
|
|
|
|
{
|
|
|
|
return sysconf(_SC_CLK_TCK);
|
|
|
|
}
|