summaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/mman.h12
-rw-r--r--include/sys/syscall.h14
2 files changed, 22 insertions, 4 deletions
diff --git a/include/sys/mman.h b/include/sys/mman.h
index aeeea7d0e..10f4afe24 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -100,6 +100,7 @@ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
#endif
#ifdef __ARCH_USE_MMU__
+
/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
be memory resident. */
extern int mlock (__const void *__addr, size_t __len) __THROW;
@@ -115,6 +116,17 @@ extern int mlockall (int __flags) __THROW;
/* All currently mapped pages of the process' address space become
unlocked. */
extern int munlockall (void) __THROW;
+
+#else
+
+/* On no-mmu systems, memory cannot be swapped out, so
+ * these functions will always succeed.
+ */
+static inline int mlock (__const void *__addr, size_t __len) { return 0; }
+static inline int munlock (__const void *__addr, size_t __len) { return 0; }
+static inline int mlockall (int __flags) { return 0; }
+static inline int munlockall (void) { return 0; }
+
#endif
#ifdef __USE_MISC
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index aef1f998f..4c8ede843 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -19,13 +19,19 @@
#ifndef _SYSCALL_H
#define _SYSCALL_H 1
-/* This file provides us with the nicely useful _syscall[0-5] macros. */
+/* The _syscall#() macros are for uClibc internal use only.
+ * User application code should use syscall() instead.
+ *
+ * The kernel provided _syscall[0-6] macros from asm/unistd.h are not suitable
+ * for use in uClibc as they lack PIC support etc, so for uClibc we use our own
+ * local _syscall# macros to be certain all such variations are handled
+ * properly.
+ */
+
#include <features.h>
+#include <bits/sysnum.h>
#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
# include <bits/syscalls.h>
-#else
-# include <asm/unistd.h>
-# include <bits/sysnum.h>
#endif
#endif