mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
util/userfaultfd: Add uffd_open()
Add a helper to create the uffd handle. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
d9df92925e
commit
d5890ea072
4 changed files with 30 additions and 10 deletions
|
@ -13,10 +13,20 @@
|
|||
#ifndef USERFAULTFD_H
|
||||
#define USERFAULTFD_H
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include <linux/userfaultfd.h>
|
||||
|
||||
/**
|
||||
* uffd_open(): Open an userfaultfd handle for current context.
|
||||
*
|
||||
* @flags: The flags we want to pass in when creating the handle.
|
||||
*
|
||||
* Returns: the uffd handle if >=0, or <0 if error happens.
|
||||
*/
|
||||
int uffd_open(int flags);
|
||||
int uffd_query_features(uint64_t *features);
|
||||
int uffd_create_fd(uint64_t features, bool non_blocking);
|
||||
void uffd_close_fd(int uffd_fd);
|
||||
|
@ -32,4 +42,6 @@ int uffd_wakeup(int uffd_fd, void *addr, uint64_t length);
|
|||
int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count);
|
||||
bool uffd_poll_events(int uffd_fd, int tmo);
|
||||
|
||||
#endif /* CONFIG_LINUX */
|
||||
|
||||
#endif /* USERFAULTFD_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue