logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: d2c378b1e5a09ff97aaae36c3846db6309934588
parent e8e83b222ec147ea0a4672030b2ed8d02d84c8da
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 15 Nov 2024 17:41:01 +0100

cmd/yes: fallback to 4096 when PAGESIZE is undefined

Diffstat:

Mcmd/yes.c8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/cmd/yes.c b/cmd/yes.c @@ -10,6 +10,14 @@ #include <string.h> // strlen #include <unistd.h> // write +#ifndef PAGESIZE +// When undefined (allowed by POSIX), assume a somewhat modern system but not too modern +#define PAGESIZE 4096 +// If getting a true pagesize is important then sysconf(_SC_PAGESIZE) +// should be used as it is more runtime than ABI. +// (for example AArch64 allows different pagesizes) +#endif + int main(int argc, char *argv[]) {