You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/17 10:03:33 UTC
[incubator-nuttx] branch master updated: sysconf: add _SC_PAGESIZE
sysconf support
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fd94a32 sysconf: add _SC_PAGESIZE sysconf support
fd94a32 is described below
commit fd94a32468ea7652382d5717b18118fcab08dba3
Author: liuhaitao <li...@xiaomi.com>
AuthorDate: Mon Aug 31 16:58:26 2020 +0800
sysconf: add _SC_PAGESIZE sysconf support
Also implement getpagesize() based on sysconf(_SC_PAGESIZE).
Change-Id: I812eb8f34ed602f7bc12c4cafafcebc0d98fd136
Signed-off-by: liuhaitao <li...@xiaomi.com>
---
include/unistd.h | 1 +
libs/libc/unistd/lib_sysconf.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/unistd.h b/include/unistd.h
index 0f132f4..c4460eb 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -274,6 +274,7 @@
#define link(p1, p2) symlink((p1), (p2))
#define fdatasync(f) fsync(f)
#define getdtablesize(f) ((int)sysconf(_SC_OPEN_MAX))
+#define getpagesize(f) ((int)sysconf(_SC_PAGESIZE))
/****************************************************************************
* Public Data
diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c
index 6da2394..0c3b613 100644
--- a/libs/libc/unistd/lib_sysconf.c
+++ b/libs/libc/unistd/lib_sysconf.c
@@ -241,6 +241,13 @@ long sysconf(int name)
return 1;
#endif
+ case _SC_PAGESIZE:
+#ifdef CONFIG_MM_PGSIZE
+ return CONFIG_MM_PGSIZE;
+#else
+ return 1;
+#endif
+
default:
#if 0 /* Assume valid but not implemented for the time being */
errcode = EINVAL;