diff options
author | Peter Xu <peterx@redhat.com> | 2023-02-01 16:10:54 -0500 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-02-06 19:22:56 +0100 |
commit | d5890ea0722831eea76a0efd23a496b3e8815fe8 (patch) | |
tree | c9d365c7db03036f2928100155bb8d77ccad6bee /include/qemu | |
parent | d9df92925ef2b7ca8774ef44b0e1f859a91d4cd6 (diff) | |
download | qemu-d5890ea0722831eea76a0efd23a496b3e8815fe8.zip qemu-d5890ea0722831eea76a0efd23a496b3e8815fe8.tar.gz qemu-d5890ea0722831eea76a0efd23a496b3e8815fe8.tar.bz2 |
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>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/userfaultfd.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h index 6b74f92..d764496 100644 --- a/include/qemu/userfaultfd.h +++ b/include/qemu/userfaultfd.h @@ -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 */ |