X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=os-posix.c;h=3ba7df8d7537512ab9157135e012ed1c7cdcb6a6;hb=aa5b969287125d1924d74648b378d4abba544465;hp=8f39447dd4fb7b0333804478720c51324c22935e;hpb=7c823bc581621a73c4d6c49f1d528d44a9ffc183;p=mirror_qemu.git diff --git a/os-posix.c b/os-posix.c index 8f39447dd4..3ba7df8d75 100644 --- a/os-posix.c +++ b/os-posix.c @@ -29,6 +29,7 @@ #include #include +#include "qemu-common.h" /* Needed early for CONFIG_BSD etc. */ #include "sysemu/sysemu.h" #include "net/slirp.h" @@ -344,30 +345,6 @@ void os_set_line_buffering(void) setvbuf(stdout, NULL, _IOLBF, 0); } -int qemu_create_pidfile(const char *filename) -{ - char buffer[128]; - int len; - int fd; - - fd = qemu_open(filename, O_RDWR | O_CREAT, 0600); - if (fd == -1) { - return -1; - } - if (lockf(fd, F_TLOCK, 0) == -1) { - close(fd); - return -1; - } - len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid()); - if (write(fd, buffer, len) != len) { - close(fd); - return -1; - } - - /* keep pidfile open & locked forever */ - return 0; -} - bool is_daemonized(void) { return daemonize;