Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>

* locale/error.c, locale/error.h: Files removed.
	* locale/Makefile (distribute): Remove error.h.
	(lib-modules): Remove error.

	* hurd/hurdlookup.c (__hurd_file_name_lookup_retry): For "tty"
	magic, return ENXIO if no ctty.

	* sysdeps/mach/hurd/mmap.c: For MAP_FIXED, deallocate a previous
	mapping if vm_map fails for that reason.

	* posix/glob.c: Implement new options GLOB_ALTDIRFUNC, GLOB_BRACE,
	GLOB_TILDE, GLOB_NOMAGIC.
	(glob): Use stat instead of lstat to determine directoriness.
	* posix/glob.h (GLOB_ALTDIRFUNC, GLOB_BRACE, GLOB_NOMAGIC, GLOB_TILDE):
	New flag bits.
	(__GLOB_FLAGS): Include them.
	(glob_t): New members gl_closedir, gl_readdir, gl_opendir, gl_lstat,
	gl_stat.

	* elf/elf.h (ET_NUM, SHT_NUM, STB_NUM, STT_NUM, PT_NUM): New macros.

	* sysdeps/unix/sysv/linux/sys/mman.h: Include <linux/mman.h> to
	define all the bit values.
	(MAP_*, MCL_*): Macros removed.
This commit is contained in:
Roland McGrath 1995-12-09 10:00:22 +00:00
parent c994299d50
commit 787e4db95c
8 changed files with 191 additions and 89 deletions

View File

@ -1,3 +1,30 @@
Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/error.c, locale/error.h: Files removed.
* locale/Makefile (distribute): Remove error.h.
(lib-modules): Remove error.
* hurd/hurdlookup.c (__hurd_file_name_lookup_retry): For "tty"
magic, return ENXIO if no ctty.
* sysdeps/mach/hurd/mmap.c: For MAP_FIXED, deallocate a previous
mapping if vm_map fails for that reason.
* posix/glob.c: Implement new options GLOB_ALTDIRFUNC, GLOB_BRACE,
GLOB_TILDE, GLOB_NOMAGIC.
(glob): Use stat instead of lstat to determine directoriness.
* posix/glob.h (GLOB_ALTDIRFUNC, GLOB_BRACE, GLOB_NOMAGIC, GLOB_TILDE):
New flag bits.
(__GLOB_FLAGS): Include them.
(glob_t): New members gl_closedir, gl_readdir, gl_opendir, gl_lstat,
gl_stat.
* elf/elf.h (ET_NUM, SHT_NUM, STB_NUM, STT_NUM, PT_NUM): New macros.
* sysdeps/unix/sysv/linux/sys/mman.h: Include <linux/mman.h> to
define all the bit values.
(MAP_*, MCL_*): Macros removed.
Thu Dec 7 02:27:56 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> Thu Dec 7 02:27:56 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* resolv/res_comp.c, resolv/res_debug.c, resolv/res_send.c: * resolv/res_comp.c, resolv/res_debug.c, resolv/res_send.c:

View File

@ -98,6 +98,7 @@ typedef struct
#define ET_EXEC 2 /* Executable file */ #define ET_EXEC 2 /* Executable file */
#define ET_DYN 3 /* Shared object file */ #define ET_DYN 3 /* Shared object file */
#define ET_CORE 4 /* Core file */ #define ET_CORE 4 /* Core file */
#define ET_NUM 5 /* Number of defined types. */
#define ET_LOPROC 0xff00 /* Processor-specific */ #define ET_LOPROC 0xff00 /* Processor-specific */
#define ET_HIPROC 0xffff /* Processor-specific */ #define ET_HIPROC 0xffff /* Processor-specific */
@ -168,6 +169,7 @@ typedef struct
#define SHT_REL 9 /* Relocation entries, no addends */ #define SHT_REL 9 /* Relocation entries, no addends */
#define SHT_SHLIB 10 /* Reserved */ #define SHT_SHLIB 10 /* Reserved */
#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ #define SHT_DYNSYM 11 /* Dynamic linker symbol table */
#define SHT_NUM 12 /* Number of defined types. */
#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ #define SHT_LOPROC 0x70000000 /* Start of processor-specific */
#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ #define SHT_HIPROC 0x7fffffff /* End of processor-specific */
#define SHT_LOUSER 0x80000000 /* Start of application-specific */ #define SHT_LOUSER 0x80000000 /* Start of application-specific */
@ -207,6 +209,7 @@ typedef struct
#define STB_LOCAL 0 /* Local symbol */ #define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */ #define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* Weak symbol */ #define STB_WEAK 2 /* Weak symbol */
#define STB_NUM 3 /* Number of defined types. */
#define STB_LOPROC 13 /* Start of processor-specific */ #define STB_LOPROC 13 /* Start of processor-specific */
#define STB_HIPROC 15 /* End of processor-specific */ #define STB_HIPROC 15 /* End of processor-specific */
@ -217,6 +220,7 @@ typedef struct
#define STT_FUNC 2 /* Symbol is a code object */ #define STT_FUNC 2 /* Symbol is a code object */
#define STT_SECTION 3 /* Symbol associated with a section */ #define STT_SECTION 3 /* Symbol associated with a section */
#define STT_FILE 4 /* Symbol's name is file name */ #define STT_FILE 4 /* Symbol's name is file name */
#define STT_NUM 5 /* Number of defined types. */
#define STT_LOPROC 13 /* Start of processor-specific */ #define STT_LOPROC 13 /* Start of processor-specific */
#define STT_HIPROC 15 /* End of processor-specific */ #define STT_HIPROC 15 /* End of processor-specific */
@ -273,6 +277,7 @@ typedef struct {
#define PT_NOTE 4 /* Auxiliary information */ #define PT_NOTE 4 /* Auxiliary information */
#define PT_SHLIB 5 /* Reserved */ #define PT_SHLIB 5 /* Reserved */
#define PT_PHDR 6 /* Entry for header table itself */ #define PT_PHDR 6 /* Entry for header table itself */
#define PT_NUM 7 /* Number of defined types. */
#define PT_LOPROC 0x70000000 /* Start of processor-specific */ #define PT_LOPROC 0x70000000 /* Start of processor-specific */
#define PT_HIPROC 0x7fffffff /* End of processor-specific */ #define PT_HIPROC 0x7fffffff /* End of processor-specific */

View File

@ -250,6 +250,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
error_t err; error_t err;
error_t ctty_open (file_t port) error_t ctty_open (file_t port)
{ {
if (port == MACH_PORT_NULL)
return ENXIO; /* No controlling terminal. */
return __termctty_open_terminal (port, return __termctty_open_terminal (port,
flags, flags,
result); result);

View File

@ -25,7 +25,7 @@ headers = locale.h
distribute = localeinfo.h categories.def \ distribute = localeinfo.h categories.def \
$(localedef-modules:=.c) $(locale-modules:=.c) \ $(localedef-modules:=.c) $(locale-modules:=.c) \
$(lib-modules:=.c) config.h hash.h iso-4217.def \ $(lib-modules:=.c) config.h hash.h iso-4217.def \
keyword.gperf keyword.h localedef.h token.h error.h keyword.gperf keyword.h localedef.h token.h
routines = setlocale loadlocale localeconv nl_langinfo routines = setlocale loadlocale localeconv nl_langinfo
categories = ctype messages monetary numeric time collate categories = ctype messages monetary numeric time collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc
@ -37,7 +37,7 @@ extra-objs = $(localedef-modules:=.o) $(locale-modules:=.o) \
localedef-modules := charmap locfile-lex locfile-parse locale-ctype \ localedef-modules := charmap locfile-lex locfile-parse locale-ctype \
monetary messages collate numeric monetary messages collate numeric
locale-modules := ctypedump locale-modules := ctypedump
lib-modules := error hash xmalloc lib-modules := hash xmalloc
GPERF = gperf GPERF = gperf

View File

@ -37,8 +37,15 @@ Cambridge, MA 02139, USA. */
program understand `configure --with-gnu-libc' and omit the object files, program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */ it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__) #define GLOB_INTERFACE_VERSION 1
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
#include <gnu-versions.h>
#if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
#ifdef STDC_HEADERS #ifdef STDC_HEADERS
#include <stddef.h> #include <stddef.h>
@ -53,6 +60,8 @@ Cambridge, MA 02139, USA. */
#endif #endif
#endif #endif
#include <pwd.h>
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
extern int errno; extern int errno;
#endif #endif
@ -175,10 +184,7 @@ extern char *alloca ();
#endif #endif
#ifndef __GNU_LIBRARY__ #ifndef __GNU_LIBRARY__
#define __lstat lstat #define __stat stat
#ifndef HAVE_LSTAT
#define lstat stat
#endif
#ifdef STAT_MACROS_BROKEN #ifdef STAT_MACROS_BROKEN
#undef S_ISDIR #undef S_ISDIR
#endif #endif
@ -211,10 +217,6 @@ extern char *alloca ();
#undef GLOB_PERIOD #undef GLOB_PERIOD
#include <glob.h> #include <glob.h>
__ptr_t (*__glob_opendir_hook) __P ((const char *directory));
const char *(*__glob_readdir_hook) __P ((__ptr_t stream));
void (*__glob_closedir_hook) __P ((__ptr_t stream));
static int glob_pattern_p __P ((const char *pattern, int quote)); static int glob_pattern_p __P ((const char *pattern, int quote));
static int glob_in_dir __P ((const char *pattern, const char *directory, static int glob_in_dir __P ((const char *pattern, const char *directory,
int flags, int flags,
@ -250,6 +252,56 @@ glob (pattern, flags, errfunc, pglob)
return -1; return -1;
} }
if (flags & GLOB_BRACE)
{
const char *begin = strchr (pattern, '{');
if (begin != NULL)
{
const char *end = strchr (begin + 1, '}');
if (end != NULL && end != begin + 1)
{
size_t restlen = strlen (end + 1) + 1;
const char *p, *comma;
char *buf;
size_t bufsz = 0;
int firstc;
if (!(flags & GLOB_APPEND))
{
pglob->gl_pathc = 0;
pglob->gl_pathv = NULL;
}
firstc = pglob->gl_pathc;
for (p = begin + 1;; p = comma + 1)
{
int result;
comma = strchr (p, ',');
if (comma == NULL)
comma = strchr (p, '\0');
if ((begin - pattern) + (comma - p) + 1 > bufsz)
{
if (bufsz * 2 < comma - p + 1)
bufsz *= 2;
else
bufsz = comma - p + 1;
buf = __alloca (bufsz);
}
memcpy (buf, pattern, begin - pattern);
memcpy (buf + (begin - pattern), p, comma - p);
memcpy (buf + (begin - pattern) + (comma - p), end, restlen);
result = glob (buf, (flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC) |
GLOB_APPEND), errfunc, pglob);
if (result && result != GLOB_NOMATCH)
return result;
if (*comma == '\0')
break;
}
if (pglob->gl_pathc == firstc &&
!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
return GLOB_NOMATCH;
}
}
}
/* Find the filename. */ /* Find the filename. */
filename = strrchr (pattern, '/'); filename = strrchr (pattern, '/');
if (filename == NULL) if (filename == NULL)
@ -291,6 +343,35 @@ glob (pattern, flags, errfunc, pglob)
oldcount = pglob->gl_pathc; oldcount = pglob->gl_pathc;
if ((flags & GLOB_TILDE) && dirname[0] == '~')
{
if (dirname[1] == '\0')
{
/* Look up home directory. */
dirname = getenv ("HOME");
if (dirname == NULL || dirname[0] == '\0')
{
extern char *getlogin ();
char *name = getlogin ();
if (name != NULL)
{
struct passwd *p = getpwnam (name);
if (p != NULL)
dirname = p->pw_dir;
}
}
if (dirname == NULL || dirname[0] == '\0')
dirname = (char *) "~"; /* No luck. */
}
else
{
/* Look up specific user's home directory. */
struct passwd *p = getpwnam (dirname + 1);
if (p != NULL)
dirname = p->pw_dir;
}
}
if (glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE))) if (glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
{ {
/* The directory name contains metacharacters, so we /* The directory name contains metacharacters, so we
@ -414,7 +495,8 @@ glob (pattern, flags, errfunc, pglob)
int i; int i;
struct stat st; struct stat st;
for (i = oldcount; i < pglob->gl_pathc; ++i) for (i = oldcount; i < pglob->gl_pathc; ++i)
if (__lstat (pglob->gl_pathv[i], &st) == 0 && if (((flags & GLOB_ALTDIRFUNC) ?
*pglob->gl_stat : __stat) (pglob->gl_pathv[i], &st) == 0 &&
S_ISDIR (st.st_mode)) S_ISDIR (st.st_mode))
{ {
size_t len = strlen (pglob->gl_pathv[i]) + 2; size_t len = strlen (pglob->gl_pathv[i]) + 2;
@ -581,8 +663,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{ {
flags |= GLOB_MAGCHAR; flags |= GLOB_MAGCHAR;
stream = (__glob_opendir_hook ? (*__glob_opendir_hook) (directory) stream = ((flags & GLOB_ALTDIRFUNC) ?
: (__ptr_t) opendir (directory)); (*pglob->gl_opendir) (directory) :
opendir (directory));
if (stream == NULL) if (stream == NULL)
{ {
if ((errfunc != NULL && (*errfunc) (directory, errno)) || if ((errfunc != NULL && (*errfunc) (directory, errno)) ||
@ -594,17 +677,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{ {
const char *name; const char *name;
size_t len; size_t len;
struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ?
if (__glob_readdir_hook) (*pglob->gl_readdir) (stream) :
{ readdir (stream));
name = (*__glob_readdir_hook) (stream);
if (name == NULL)
break;
len = 0;
}
else
{
struct dirent *d = readdir ((DIR *) stream);
if (d == NULL) if (d == NULL)
break; break;
if (! REAL_DIR_ENTRY (d)) if (! REAL_DIR_ENTRY (d))
@ -615,7 +690,6 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
#else #else
len = 0; len = 0;
#endif #endif
}
if (fnmatch (pattern, name, if (fnmatch (pattern, name,
(!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
@ -638,6 +712,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
} }
} }
if (nfound == 0 && (flags & GLOB_NOMAGIC) &&
! glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)))
flags |= GLOB_NOCHECK;
if (nfound == 0 && (flags & GLOB_NOCHECK)) if (nfound == 0 && (flags & GLOB_NOCHECK))
{ {
size_t len = strlen (pattern); size_t len = strlen (pattern);
@ -673,10 +751,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
if (stream != NULL) if (stream != NULL)
{ {
int save = errno; int save = errno;
if (__glob_closedir_hook) if (flags & GLOB_ALTDIRFUNC)
(*__glob_closedir_hook) (stream); (*pglob->gl_closedir) (stream);
else else
(void) closedir ((DIR *) stream); closedir (stream);
errno = save; errno = save;
} }
return nfound == 0 ? GLOB_NOMATCH : 0; return nfound == 0 ? GLOB_NOMATCH : 0;
@ -684,10 +762,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
memory_error: memory_error:
{ {
int save = errno; int save = errno;
if (__glob_closedir_hook) if (flags & GLOB_ALTDIRFUNC)
(*__glob_closedir_hook) (stream); (*pglob->gl_closedir) (stream);
else else
(void) closedir ((DIR *) stream); closedir (stream);
errno = save; errno = save;
} }
while (names != NULL) while (names != NULL)
@ -699,4 +777,5 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
return GLOB_NOSPACE; return GLOB_NOSPACE;
} }
#endif /* _LIBC or not __GNU_LIBRARY__. */ #endif /* Not ELIDE_CODE. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
@ -47,10 +47,16 @@ extern "C"
#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
#define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ #define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND|GLOB_PERIOD) GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
GLOB_NOMAGIC|GLOB_TILDE)
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE)
#define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ #define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
#define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
#define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
#define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */
#define GLOB_TILDE (1 <<12)/* Expand ~user and ~ to home directories. */
#endif #endif
/* Error returns from `glob'. */ /* Error returns from `glob'. */
@ -59,12 +65,21 @@ extern "C"
#define GLOB_NOMATCH 3 /* No matches found. */ #define GLOB_NOMATCH 3 /* No matches found. */
/* Structure describing a globbing run. */ /* Structure describing a globbing run. */
struct stat;
typedef struct typedef struct
{ {
int gl_pathc; /* Count of paths matched by the pattern. */ int gl_pathc; /* Count of paths matched by the pattern. */
char **gl_pathv; /* List of matched pathnames. */ char **gl_pathv; /* List of matched pathnames. */
int gl_offs; /* Slots to reserve in `gl_pathv'. */ int gl_offs; /* Slots to reserve in `gl_pathv'. */
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) __P ((void *));
struct dirent *(*gl_readdir) __P ((void *));
__ptr_t (*gl_opendir) __P ((const char *));
int (*gl_lstat) __P ((const char *, struct stat *));
int (*gl_stat) __P ((const char *, struct stat *));
} glob_t; } glob_t;
/* Do glob searching for PATTERN, placing results in PGLOB. /* Do glob searching for PATTERN, placing results in PGLOB.

View File

@ -110,6 +110,21 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
(flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE : (flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE :
(flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY : (flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY :
VM_INHERIT_SHARE); VM_INHERIT_SHARE);
if (err == KERN_NO_SPACE && (flags & MAP_FIXED))
{
/* XXX this is not atomic as it is in unix! */
/* The region is already allocated; deallocate it first. */
err = __vm_deallocate (__mach_task_self (), mapaddr, len);
if (! err)
err = __vm_map (__mach_task_self (),
&mapaddr, (vm_size_t) len, (vm_address_t) 0,
0, memobj, (vm_offset_t) offset,
flags & (MAP_COPY|MAP_PRIVATE),
vmprot, VM_PROT_ALL,
(flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE :
(flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY :
VM_INHERIT_SHARE);
}
if (memobj != MACH_PORT_NULL) if (memobj != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), memobj); __mach_port_deallocate (__mach_task_self (), memobj);

View File

@ -26,52 +26,11 @@ Cambridge, MA 02139, USA. */
#define __need_size_t #define __need_size_t
#include <stddef.h> #include <stddef.h>
/* Protections are chosen from these bits, OR'd together. The
implementation does not necessarily support PROT_EXEC or PROT_WRITE
without PROT_READ. The only guarantees are that no writing will be
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
#define PROT_NONE 0x00 /* No access. */
#define PROT_READ 0x01 /* Pages can be read. */
#define PROT_WRITE 0x02 /* Pages can be written. */
#define PROT_EXEC 0x04 /* Pages can be executed. */
/* Flags contain mapping type, sharing type and options. */
/* Mapping type (must choose one and only one of these). */
#define MAP_FILE 0x0000 /* Mapped from a file or device. */
#define MAP_ANON 0x0020 /* Allocated from anonymous virtual memory. */
#define MAP_TYPE 0x000f /* Mask for type field. */
/* Sharing types (must choose one and only one of these). */
#define MAP_COPY MAP_PRIVATE /* Virtual copy of region at mapping time. */
#define MAP_SHARED 0x0001 /* Share changes. */
#define MAP_PRIVATE 0x0002 /* Changes private; copy pages on write. */
/* Other flags. */
#define MAP_FIXED 0x0010 /* Map address must be exactly as requested. */
#define MAP_NOEXTEND 0x0000 /* For MAP_FILE, don't change file size.
Not available on Linux??? */
#define MAP_HASSEMPHORE 0x0000 /* Region may contain semaphores.
Not available on Linux??? */
#define MAP_INHERIT 0x0000 /* Region is retained after exec.
Not available on Linux??? */
/* Advice to `madvise'. */
#define MADV_NORMAL 0 /* No further special treatment. */
#define MADV_RANDOM 1 /* Expect random page references. */
#define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
#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 <sys/cdefs.h> #include <sys/cdefs.h>
/* Get the bit values from the kernel header file. */
#include <linux/mman.h>
__BEGIN_DECLS __BEGIN_DECLS
/* Map addresses starting near ADDR and extending for LEN bytes. from /* Map addresses starting near ADDR and extending for LEN bytes. from
OFFSET into the file FD describes according to PROT and FLAGS. If ADDR OFFSET into the file FD describes according to PROT and FLAGS. If ADDR