DRAFT lib: Add getpagesize stub.

* include/limits.h (PAGE_SIZE): New define.
* lib/stub/getpagesize.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it.
* include/unistd.h (getpagesize): Add prototype.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-10-26 17:10:18 +02:00
parent 719a93482d
commit a376b6a524
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
4 changed files with 36 additions and 1 deletions

View File

@ -375,6 +375,7 @@ lib/stub/frexp.c
lib/stub/getgrgid.c
lib/stub/getgrnam.c
lib/stub/getlogin.c
lib/stub/getpagesize.c
lib/stub/getpgid.c
lib/stub/getpgrp.c
lib/stub/getpwnam.c

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -33,6 +33,7 @@
#define MB_CUR_MAX 1
#define NAME_MAX 255
#define PAGE_SIZE 4096
#define PATH_MAX 512
#define _POSIX_OPEN_MAX 16

View File

@ -74,6 +74,7 @@ int setgid (gid_t newgid);
int setuid (uid_t newuid);
uid_t geteuid (void);
gid_t getegid (void);
int getpagesize (void);
pid_t getpgrp (void);
pid_t getpid (void);
pid_t getppid (void);

32
lib/stub/getpagesize.c Normal file
View File

@ -0,0 +1,32 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <limits.h>
int
getpagesize (void)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("getpagesize stub\n");
stub = 1;
return PAGE_SIZE;
}