From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683259397; x=1685851397; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7STZHxzhWqh5bzMicA9hxfUroSzLADYyz5MVP4VPMZo=; b=biva7HMfqC9JkBVCVszHxqmeyUrKzl38CnuP0oIrBN0tkn8FXEog4k9W4rJnHji3b+ gangdYnjGKclsn9MyoCA47BWl4/O0JfJrzAvFr3moC8q2aWO3Lg1qulGAKTrn1bpXAKv KV6WDIa7ZEMCdbH3AnpISeSvyAqsNGLkt2VndHT/dEqlCMavIuypfRdeB5vXtfuNSwsB 3LTrgIyMVeHLxUhTL7W7+Xo0O3ffa9Qsm+BGNTOudbxyKX9RPpoYn66/V1kAKkcYiXRN y8A4i4ngbHY9Mgl+no7EuhGE9Uao1tQ8iRSoyQDagDOgmt1kXAKZLiSPB0OC3Ghb95eg MPiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683259397; x=1685851397; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7STZHxzhWqh5bzMicA9hxfUroSzLADYyz5MVP4VPMZo=; b=SeaergpZFQxJ+hc3jpiOiWqnkWzCsAwMz/ByVE1OJHA8wrVBMUd8S8jsp8uLgd9nqp J0mPEN3X3NPq5y78MA+GhiI9jcKVOtkLMeqdLFN4gpkkrSXVXQT+fovmDQlC4iICP7I4 1EUWdlhFabvzwzr4licYbM7dKm25mV03Glw9sJaWJrm8e3xCrIRrfa5murHiDadLalJs j8d1iE1mf1mgX55sl6S78wrtKLyi2zqZKiFyuIcxzJwhPHvDPv5amYiceltLDmIyf5C6 tHJWaAgwMaDfBhiMCw8ooDlTce4PHt8xCkN0ruCM7Tzxa0L5JJhkXOxWcnor7HmiclUL jq5g== X-Gm-Message-State: AC+VfDzQUPAF3vsErXwWnRnT9g6CSxena9YL1lVU+ctp7ejbNDDZJmVn rPlkgqDnurqRia9U3a4oEH/4X7midYA= X-Google-Smtp-Source: ACHHUZ551FCv7w/NHroIBVfW0S0a0yEtQB6T+d01R4D3enslwOlGyrOEslfqBpqffUW5PcHaqOKrOQ== X-Received: by 2002:a05:6870:d88b:b0:187:9783:a20e with SMTP id dv11-20020a056870d88b00b001879783a20emr222223oab.37.1683259397345; Thu, 04 May 2023 21:03:17 -0700 (PDT) Message-ID: <42632f4d-b66e-a7f5-1610-74f54891e304@gmail.com> Date: Fri, 5 May 2023 07:03:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.10.0 Content-Language: ru, en-US To: make-initrd@lists.altlinux.org References: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> From: Leonid Krivoshein In-Reply-To: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [make-initrd] [PATCH 1/3] Reimplement ueventd X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2023 04:03:21 -0000 Archived-At: List-Archive: On 5/4/23 16:42, Alexey Gladkov wrote: > [...] > diff --git a/datasrc/ueventd/queue-processor.c b/datasrc/ueventd/queue-processor.c > new file mode 100644 > index 00000000..ab5e03e4 > --- /dev/null > +++ b/datasrc/ueventd/queue-processor.c > @@ -0,0 +1,116 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ueventd.h" > + > +static void event_handler(struct watch *queue, char *path) __attribute__((nonnull(1, 2))); > +static void move_files(char *srcdir, char *dstdir) __attribute__((nonnull(1, 2))); > +static void signal_unhandled_events(struct watch *queue) __attribute__((nonnull(1))); > + > +void event_handler(struct watch *queue, char *path) > +{ > + char *argv[] = { handler_file, path, NULL }; > + pid_t pid = vfork(); > + > + if (pid < 0) { > + err("fork: %m"); Сначала я подумал, что тут пропущен первый аргумент и таких мест оказалось много. err() -- и твой макрос из ueventd.h, и стандартный вызов из с отличающейся семантикой. В новом коде ueventd используется твой макрос, но в остальном коде make-initrd используется стандартный вызов. Так недолго самому запутаться, см.: git grep 'err('. > + > + } else if (!pid) { > + execve(argv[0], argv, environ); > + fatal("exec: %s: %m", argv[0]); > + } else { > + int status = 0; > + > + if (waitpid_retry(pid, &status, 0) != pid || !WIFEXITED(status)) > + info("%s: session=%lu: %s failed", > + queue->q_name, session, handler_file); > + else > + info("%s: session=%lu: %s finished with return code %d", > + queue->q_name, session, handler_file, WEXITSTATUS(status)); > + } > +} > [...] -- WBR, Leonid Krivoshein.