On 12/2/25 15:51, Daniil Tatianin wrote:
On 2/12/25 5:48 PM, Philippe Mathieu-Daudé wrote:

Hi Daniil,

On 12/2/25 15:39, Daniil Tatianin wrote:
This will be used in the following commits to make it possible to only
lock memory on fault instead of right away.

Signed-off-by: Daniil Tatianin <d-tatia...@yandex-team.ru>
---
  include/system/os-posix.h |  2 +-
  include/system/os-win32.h |  3 ++-
  meson.build               |  6 ++++++
  migration/postcopy-ram.c  |  2 +-
  os-posix.c                | 14 ++++++++++++--
  system/vl.c               |  2 +-
  6 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/include/system/os-posix.h b/include/system/os-posix.h
index b881ac6c6f..ce5b3bccf8 100644
--- a/include/system/os-posix.h
+++ b/include/system/os-posix.h
@@ -53,7 +53,7 @@ bool os_set_runas(const char *user_id);
  void os_set_chroot(const char *path);
  void os_setup_limits(void);
  void os_setup_post(void);
-int os_mlock(void);
+int os_mlock(bool on_fault);

If we need to support more flag, is your plan to add more arguments?
Otherwise, why not use a 'int flags' argument, and have the callers
pass MCL_ONFAULT?

Hi!

I chose this approach because MCL_ONFAULT is a POSIX/linux-specific flag, and this function is called in places that are platform-agnostic, thus a bool flag seemed more fitting.

OK then.

Reply via email to