[CRIU] [PATCH 8/9] parasite: use only one command for executing parasite in a daemon mode

Andrey Wagin avagin at gmail.com
Mon Jun 24 00:35:22 EDT 2013


2013/6/23 Cyrill Gorcunov <gorcunov at gmail.com>:
> On Fri, Jun 21, 2013 at 11:01:14AM +0400, Andrey Vagin wrote:
>>
>> +static noinline __used int parasite_init_daemon(void *data)
>> +{
>> +     struct parasite_init_args *args = data;
>> +     int ret;
>> +
>> +     sigframe = args->sigframe;
>> +
>> +     tsock = sys_socket(PF_UNIX, SOCK_STREAM, 0);
>> +     if (tsock < 0) {
>> +             pr_err("Can't create socket: %d\n", tsock);
>> +             goto err;
>> +     }
>> +
>> +     ret = sys_connect(tsock, (struct sockaddr *)&args->h_addr, args->h_addr_len);
>> +     if (ret < 0) {
>> +             pr_err("Can't connect the control socket\n");
>> +             goto err;
>> +     }
>> +
>> +     ret = recv_fd(tsock);
>> +     if (ret >= 0) {
>> +             log_set_fd(ret);
>> +             log_set_loglevel(args->log_level);
>> +             ret = 0;
>> +     } else
>> +             goto err;
>> +
>> +     parasite_daemon(data);
>> +
>> +err:
>> +     fini();
>> +     BUG();
>
> Could you please elaborate, why BUG here? Do we really need it
> even if failed on say sys_connect?

fini calls sigreturn, so it should not return back

>
>> +
>> +     return -1;
>> +}


More information about the CRIU mailing list