From fbaad1494f7fa9e52c391a926d1c3a015604eb58 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 26 Nov 1995 17:32:10 +0000 Subject: Sun Nov 26 02:00:02 1995 Ulrich Drepper * misc/syslog.c (vsyslog) [USE_IN_LIBIO]: Adapted for libio. Thu Nov 23 02:21:55 1995 Ulrich Drepper * sysdeps/unix/sysv/linux/{mlock,munlock,mlockall,munlockall}.S: New files. * sysdeps/unix/sysv/linux/mman.h: Add prototypes for new functions mlock, munlock, mlockall, and munlockall. --- sysdeps/unix/sysv/linux/mlock.S | 24 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/mlockall.S | 24 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/munlock.S | 24 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/munlockall.S | 24 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/sys/mman.h | 24 ++++++++++++++++++++---- 5 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mlock.S create mode 100644 sysdeps/unix/sysv/linux/mlockall.S create mode 100644 sysdeps/unix/sysv/linux/munlock.S create mode 100644 sysdeps/unix/sysv/linux/munlockall.S (limited to 'sysdeps') diff --git a/sysdeps/unix/sysv/linux/mlock.S b/sysdeps/unix/sysv/linux/mlock.S new file mode 100644 index 0000000000..b14f51deba --- /dev/null +++ b/sysdeps/unix/sysv/linux/mlock.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (mlock, 2) + ret + +weak_alias (__mlock, mlock) diff --git a/sysdeps/unix/sysv/linux/mlockall.S b/sysdeps/unix/sysv/linux/mlockall.S new file mode 100644 index 0000000000..939ec01f0b --- /dev/null +++ b/sysdeps/unix/sysv/linux/mlockall.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (mlockall, 1) + ret + +weak_alias (__mlockall, mlockall) diff --git a/sysdeps/unix/sysv/linux/munlock.S b/sysdeps/unix/sysv/linux/munlock.S new file mode 100644 index 0000000000..50fe9332ee --- /dev/null +++ b/sysdeps/unix/sysv/linux/munlock.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (munlock, 2) + ret + +weak_alias (__munlock, munlock) diff --git a/sysdeps/unix/sysv/linux/munlockall.S b/sysdeps/unix/sysv/linux/munlockall.S new file mode 100644 index 0000000000..7d8aeb4683 --- /dev/null +++ b/sysdeps/unix/sysv/linux/munlockall.S @@ -0,0 +1,24 @@ +/* Copyright (C) 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (munlockall, 0) + ret + +weak_alias (__munlockall, munlockall) diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h index b05738d8e4..9f0ef72100 100644 --- a/sysdeps/unix/sysv/linux/sys/mman.h +++ b/sysdeps/unix/sysv/linux/sys/mman.h @@ -17,10 +17,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* These are the bits used by 4.4 BSD and its derivatives. On systems - (such as GNU) where these facilities are not system services but can be - emulated in the C library, these are the definitions we emulate. */ - #ifndef _SYS_MMAN_H #define _SYS_MMAN_H 1 @@ -70,6 +66,10 @@ Cambridge, MA 02139, USA. */ #define MADV_WILLNEED 3 /* Will need these pages. */ #define MADV_DONTNEED 4 /* Don't need these pages. */ +/* Flags to `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all current mappings. */ +#define MCL_FUTURE 2 /* Lock all future mappings. */ + #include __BEGIN_DECLS @@ -106,6 +106,22 @@ int msync __P ((__caddr_t __addr, size_t __len)); for the region starting at ADDR and extending LEN bytes. */ int madvise __P ((__caddr_t __addr, size_t __len, int __advice)); +/* Cause all currently mapped pages of the process to be memory resident + until unlocked by a call to the `munlockall', until the process exits, + or until the process calls `execve'. */ +int mlockall __P ((int __flags)); + +/* All currently mapped pages of the process' address space become + unlocked. */ +int munlockall __P ((void)); + +/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to + be memory resident. */ +int mlock __P ((__caddr_t __addr, size_t __len)); + +/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ +int munlock __P ((__caddr_t __addr, size_t __len)); + __END_DECLS -- cgit 1.4.1