* Implemented mprotect(). A vm_area does now have an optional array
specifying the protection of each page (4 bits per page). * Added no-op implementation of posix_madvise(). * Replaced a few "addr_t size" parameters by "size_t size". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26871 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* memory protection for mmap() and others */
|
||||
/* memory protection for mmap() and others; assignment compatible with
|
||||
B_{READ,WRITE,EXECUTE}_AREA */
|
||||
#define PROT_READ 0x01
|
||||
#define PROT_WRITE 0x02
|
||||
#define PROT_EXEC 0x04
|
||||
@@ -30,6 +31,13 @@
|
||||
#define MS_SYNC 0x02
|
||||
#define MS_INVALIDATE 0x04
|
||||
|
||||
/* posix_madvise() values */
|
||||
#define POSIX_MADV_NORMAL 1
|
||||
#define POSIX_MADV_SEQUENTIAL 2
|
||||
#define POSIX_MADV_RANDOM 3
|
||||
#define POSIX_MADV_WILLNEED 4
|
||||
#define POSIX_MADV_DONTNEED 5
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -37,8 +45,11 @@ void* mmap(void* address, size_t length, int protection, int flags,
|
||||
int fd, off_t offset);
|
||||
int munmap(void* address, size_t length);
|
||||
|
||||
int mprotect(void* address, size_t length, int protection);
|
||||
int msync(void* address, size_t length, int flags);
|
||||
|
||||
int posix_madvise(void* address, size_t length, int advice);
|
||||
|
||||
int shm_open(const char* name, int openMode, mode_t permissions);
|
||||
int shm_unlink(const char* name);
|
||||
|
||||
|
||||
@@ -93,10 +93,15 @@ off_t vm_available_not_needed_memory(void);
|
||||
area_id _user_create_area(const char *name, void **address, uint32 addressSpec,
|
||||
size_t size, uint32 lock, uint32 protection);
|
||||
status_t _user_delete_area(area_id area);
|
||||
|
||||
area_id _user_map_file(const char *uname, void **uaddress, int addressSpec,
|
||||
addr_t size, int protection, int mapping, int fd, off_t offset);
|
||||
status_t _user_unmap_memory(void *address, addr_t size);
|
||||
status_t _user_sync_memory(void *address, addr_t size, int flags);
|
||||
size_t size, int protection, int mapping, int fd, off_t offset);
|
||||
status_t _user_unmap_memory(void *address, size_t size);
|
||||
status_t _user_set_memory_protection(void* address, size_t size,
|
||||
int protection);
|
||||
status_t _user_sync_memory(void *address, size_t size, int flags);
|
||||
status_t _user_memory_advice(void* address, size_t size, int advice);
|
||||
|
||||
area_id _user_area_for(void *address);
|
||||
area_id _user_find_area(const char *name);
|
||||
status_t _user_get_area_info(area_id area, area_info *info);
|
||||
|
||||
@@ -301,6 +301,7 @@ struct vm_area {
|
||||
off_t cache_offset;
|
||||
uint32 cache_type;
|
||||
vm_area_mappings mappings;
|
||||
uint8 *page_protections;
|
||||
|
||||
struct vm_address_space *address_space;
|
||||
struct vm_area *address_space_next;
|
||||
|
||||
@@ -327,10 +327,14 @@ extern status_t _kern_reserve_heap_address_range(addr_t* _address, uint32 addre
|
||||
addr_t size);
|
||||
|
||||
extern area_id _kern_map_file(const char *name, void **address,
|
||||
int addressSpec, addr_t size, int protection,
|
||||
int addressSpec, size_t size, int protection,
|
||||
int mapping, int fd, off_t offset);
|
||||
extern status_t _kern_unmap_memory(void *address, addr_t size);
|
||||
extern status_t _kern_sync_memory(void *address, addr_t size, int flags);
|
||||
extern status_t _kern_unmap_memory(void *address, size_t size);
|
||||
extern status_t _kern_set_memory_protection(void *address, size_t size,
|
||||
int protection);
|
||||
extern status_t _kern_sync_memory(void *address, size_t size, int flags);
|
||||
extern status_t _kern_memory_advice(void *address, size_t size,
|
||||
int advice);
|
||||
|
||||
/* kernel port functions */
|
||||
extern port_id _kern_create_port(int32 queue_length, const char *name);
|
||||
|
||||
Reference in New Issue
Block a user