[CRIU] [PATCH 2/2] service: use setproctitle()
Ruslan Kuprieiev
kupruser at gmail.com
Thu Feb 20 00:55:54 PST 2014
On 20.02.2014 11:52, Andrew Vagin wrote:
> On Thu, Feb 20, 2014 at 01:21:58AM +0400, Ruslan Kuprieiev wrote:
>> Enhance ps output.
> Could you show this output?
Sorry for not giving any real examples.
Start service and let some clients use it. Then:
root at efiop-VirtualBox:~# ps xaf | grep criu
\_ criu service
\_ criu dump
\_ criu dump
\_ criu pre-dump
\_ criu check
Yes, for now, it is not extremely informative=).
I will appreciate any ideas about what is worth to add to the title.
>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>> ---
>> cr-service.c | 8 ++++++++
>> crtools.c | 5 +++++
>> 2 files changed, 13 insertions(+)
>>
>> diff --git a/cr-service.c b/cr-service.c
>> index 9688b76..d08b995 100644
>> --- a/cr-service.c
>> +++ b/cr-service.c
>> @@ -23,6 +23,7 @@
>> #include "sd-daemon.h"
>> #include "page-xfer.h"
>> #include "net.h"
>> +#include "setproctitle.h"
>>
>> unsigned int service_sk_ino = -1;
>>
>> @@ -458,14 +459,19 @@ static int cr_service_work(int sk)
>>
>> switch (msg->type) {
>> case CRIU_REQ_TYPE__DUMP:
>> + setproctitle("dump");
>> return dump_using_req(sk, msg->opts);
>> case CRIU_REQ_TYPE__RESTORE:
>> + setproctitle("restore");
>> return restore_using_req(sk, msg->opts);
>> case CRIU_REQ_TYPE__CHECK:
>> + setproctitle("check");
>> return check(sk);
>> case CRIU_REQ_TYPE__PRE_DUMP:
>> + setproctitle("pre-dump");
>> return pre_dump_loop(sk, msg);
>> case CRIU_REQ_TYPE__PAGE_SERVER:
>> + setproctitle("page-server");
>> return start_page_server_req(sk, msg->opts);
>>
>> default:
>> @@ -548,6 +554,8 @@ int cr_service(bool daemon_mode)
>> struct sockaddr_un client_addr;
>> socklen_t client_addr_len;
>>
>> + setproctitle("service");
>> +
>> n = sd_listen_fds(0);
>> if (n > 1) {
>> pr_err("Too many file descriptors (%d) recieved", n);
>> diff --git a/crtools.c b/crtools.c
>> index b35d752..20478c1 100644
>> --- a/crtools.c
>> +++ b/crtools.c
>> @@ -34,6 +34,7 @@
>> #include "file-lock.h"
>> #include "cr-service.h"
>> #include "plugin.h"
>> +#include "setproctitle.h"
>>
>> struct cr_options opts;
>>
>> @@ -129,6 +130,10 @@ int main(int argc, char *argv[])
>> cr_pb_init();
>> restrict_uid(getuid(), getgid());
>>
>> + argv = setproctitle_init(argc, argv);
>> + if (!argv)
>> + return 1;
>> +
>> if (argc < 2)
>> goto usage;
>>
>> --
>> 1.8.3.2
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list