X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=os-posix.c;h=d39261d84949243cfc407d93603eb4d66a0d0586;hb=d15de15ca01fa990544b015fb972f2d04ab4d2d0;hp=eabccb8fe051c79bfd8764d4e514d22520d744e5;hpb=3988475b9b7fa251b00a29b076761d8c1c7e64dc;p=mirror_qemu.git diff --git a/os-posix.c b/os-posix.c index eabccb8fe0..d39261d849 100644 --- a/os-posix.c +++ b/os-posix.c @@ -36,7 +36,7 @@ /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" @@ -148,8 +148,7 @@ void os_set_proc_name(const char *s) char name[16]; if (!s) return; - name[sizeof(name) - 1] = 0; - strncpy(name, s, sizeof(name)); + pstrcpy(name, sizeof(name), s); /* Could rewrite argv[0] too, but that's a bit more complicated. This simple way is enough for `top'. */ if (prctl(PR_SET_NAME, name)) { @@ -194,7 +193,6 @@ void os_parse_cmd_args(int index, const char *optarg) break; #endif } - return; } static void change_process_uid(void) @@ -365,3 +363,15 @@ bool is_daemonized(void) { return daemonize; } + +int os_mlock(void) +{ + int ret = 0; + + ret = mlockall(MCL_CURRENT | MCL_FUTURE); + if (ret < 0) { + perror("mlockall"); + } + + return ret; +}