implement mlock(), munlock()

Change-Id: I2f04b8986d2ed32bb4d30d238d668e21a1505778
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1991
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Adrien Destugues
2020-12-03 07:58:05 +00:00
committed by Adrien Destugues
parent 0dc6805e00
commit a959262cd0
7 changed files with 324 additions and 1 deletions
+3
View File
@@ -61,6 +61,9 @@ int msync(void* address, size_t length, int flags);
int madvise(void* address, size_t length, int advice);
int posix_madvise(void* address, size_t length, int advice);
int mlock(const void* address, size_t length);
int munlock(const void* address, size_t length);
int shm_open(const char* name, int openMode, mode_t permissions);
int shm_unlink(const char* name);
+7
View File
@@ -26,6 +26,8 @@
#include <util/KernelReferenceable.h>
#include <util/list.h>
#include <SupportDefs.h>
enum additional_thread_state {
THREAD_STATE_FREE_ON_RESCHED = 7, // free the thread structure upon reschedule
@@ -64,6 +66,9 @@ struct select_info;
struct user_thread; // defined in libroot/user_thread.h
struct VMAddressSpace;
struct xsi_sem_context; // defined in xsi_semaphore.cpp
struct LockedPages;
typedef DoublyLinkedList<LockedPages> LockedPagesList;
namespace Scheduler {
struct ThreadData;
@@ -237,6 +242,8 @@ struct Team : TeamThreadIteratorEntry<team_id>, KernelReferenceable,
struct team_death_entry *death_entry; // protected by fLock
struct list dead_threads;
LockedPagesList locked_pages_list;
// protected by the team's fLock
team_dead_children dead_children;
team_job_control_children stopped_children;
+3
View File
@@ -175,6 +175,9 @@ status_t _user_memory_advice(void* address, size_t size, uint32 advice);
status_t _user_get_memory_properties(team_id teamID, const void *address,
uint32 *_protected, uint32 *_lock);
status_t _user_mlock(const void* address, size_t size);
status_t _user_munlock(const void* address, size_t size);
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);
+3
View File
@@ -448,6 +448,9 @@ extern status_t _kern_memory_advice(void *address, size_t size,
extern status_t _kern_get_memory_properties(team_id teamID,
const void *address, uint32* _protected, uint32* _lock);
extern status_t _kern_mlock(const void* address, size_t size);
extern status_t _kern_munlock(const void* address, size_t size);
/* kernel port functions */
extern port_id _kern_create_port(int32 queue_length, const char *name);
extern status_t _kern_close_port(port_id id);