mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-18 08:04:40 +00:00
151c6e433a
recallocarray() needs getpagesize() so add a tiny replacement for that.
24 lines
440 B
C
24 lines
440 B
C
/* Placed in the public domain */
|
|
|
|
#ifndef HAVE_GETPAGESIZE
|
|
|
|
#include <unistd.h>
|
|
#include <limits.h>
|
|
|
|
int
|
|
getpagesize(void)
|
|
{
|
|
#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
|
|
long r = sysconf(_SC_PAGESIZE);
|
|
if (r > 0 && r < INT_MAX)
|
|
return (int)r;
|
|
#endif
|
|
/*
|
|
* This is at the lower end of common values and appropriate for
|
|
* our current use of getpagesize() in recallocarray().
|
|
*/
|
|
return 4096;
|
|
}
|
|
|
|
#endif /* HAVE_GETPAGESIZE */
|