[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mode of pidfile - solved

From: Kai Peter
Subject: Re: mode of pidfile - solved
Date: Fri, 03 Jul 2020 11:15:52 +0200
User-agent: Roundcube Webmail/1.3.2

On 2020-07-01 17:45, Kai Peter wrote:

I'm curious why the option -pidfile creates a file with mode 0600.
Usually I drop root privileges with the -runas parameter. The pidfile
is then owned by root:root and there is no chance to read it with the
new uid. Running a post command to change the mode is a bit annoying.
And in comparison with other pid files - most of them are mode 0644
(owned by root:root). Is there any reason why qemu works this way? Any
chance to change this upstream?

There seems to be no valid reason, thus it must be a decision. Fortunately Gentoo allows me to create user patches. Maybe it is useful to others:

--- a/util/oslib-posix.c.orig   2020-04-28 18:49:25.000000000 +0200
+++ b/util/oslib-posix.c        2020-07-02 10:59:33.501518610 +0200
@@ -107,7 +107,7 @@
             .l_len = 0,

-        fd = qemu_open(path, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+ fd = qemu_open(path, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
         if (fd == -1) {
             error_setg_errno(errp, errno, "Cannot open pid file");
             return false;

S_IRGRP is enough for my use case, otherwise S_IROTH could be added. I prefer to write "... O_CREAT,0660 | O_WRONLY), but kept the existing syntax.

In an older thread I mention that the monitor command 'q|quit' isn't an optimal wording. Thus I renamed it to kill:

--- a/hmp-commands.hx.orig      2020-04-28 18:49:24.000000000 +0200
+++ b/hmp-commands.hx   2020-07-02 12:20:07.552838549 +0200
@@ -40,7 +40,7 @@

-        .name       = "q|quit",
+        .name       = "kill",
         .args_type  = "",
         .params     = "",
         .help       = "quit the emulator",

The patches are for qemu-5.0. For license question: this is public domain.


Sent with eQmail-1.10.3 beta - a fork of djb's famous qmail

reply via email to

[Prev in Thread] Current Thread [Next in Thread]