mirror of
https://review.haiku-os.org/haiku
synced 2025-02-02 03:36:14 +01:00
3cf7ecd1e4
and defines the macros needed by them. * Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the path to an FD parameter. Changed vm_map_file() accordingly and adjusted the kernel ELF loader and the runtime loader. * Added syscall _kern_unmap_memory(). * Added bool unmapAddressRange parameter to vm_create_anonymous_area() and map_backing_store(). If true and the address specification is B_EXACT_ADDRESS, all areas in the specified address range will be deleted (unless an area is covered only partially). * Introduced B_SHARED_AREA flag, which is set on areas that have been created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When fork()ing those areas won't be copied CoW, but rather be cloned. This is needed for mmap() MAP_SHARED. * {vm,_user}_map_file() also accept an FD argument < 0, in which case an anonymous area is created. * Implemented mmap() and munmap(). Currently there's the restriction that we can't partially unmap areas. Otherwise the functions should be rather compliant. We also support the non-POSIX extension MAP_ANONYMOUS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
43 lines
922 B
C
43 lines
922 B
C
/*
|
|
* Copyright 2008, Haiku Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _SYS_MMAN_H
|
|
#define _SYS_MMAN_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
// memory protection for mmap() and others
|
|
#define PROT_READ 0x01
|
|
#define PROT_WRITE 0x02
|
|
#define PROT_EXEC 0x04
|
|
#define PROT_NONE 0x00
|
|
|
|
// mmap() flags
|
|
#define MAP_SHARED 0x01 /* changes are seen by others */
|
|
#define MAP_PRIVATE 0x02 /* changes are only seen by caller */
|
|
#define MAP_FIXED 0x04 /* require mapping to specified addr */
|
|
#define MAP_ANONYMOUS 0x08 /* no underlying object */
|
|
#define MAP_ANON MAP_ANONYMOUS
|
|
|
|
// mmap() error return code
|
|
#define MAP_FAILED ((void*)-1)
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
extern void* mmap(void* address, size_t length, int protection, int flags,
|
|
int fd, off_t offset);
|
|
extern int munmap(void* address, size_t length);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif // _SYS_MMAN_H
|