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=1683306983; x=1685898983; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=KvQFWNF7RzTT38CLllulKeT5h1Fj5HU/1IykPRdCREA=; b=J6mwUgKAWNgl/FTW8KI9/9fdeg4fnXbIbNGZHBe0//KOSsvHTvC/AUMzkpOz4QL+Yg K/zrrZ6MvBNoeYMqOYckL5DQCDq1/Ti3N064FhqNOIeLhKOOZrUe98YjF7SBUVGTvdvz C/uYJM4lWIRPexf5g8fDEwqxo6KJef/VBsdlBSfSlH87bgm6jsXQaCzxi9Cy80KklkiJ S+idVhv+PM6bIFgQWxJz/YwbWMDwXpzB1tlQrT0injlyyve2wskvPhHl73Fnv0FwN0JW +sXl5zhGtmB8dUqh+2HiuOC3oki04hD63WMYa4ma1FI7h6hw9UV0E6idITMdQ2NK+kEc pIqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683306983; x=1685898983; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KvQFWNF7RzTT38CLllulKeT5h1Fj5HU/1IykPRdCREA=; b=PMsD/ZrS9EC7XVTL8ZXmrvzJ11yq2/B+sdC6vQWSKs4k8sPgFNGnSiPTiCTvzKahJM jeFEK7uIB3hkOL7Pz753FOf8sTpIJ7ia9DmfcvFGytS8mKoEo1CdaX04r8jz+Rxrk3ll pYYsNec2GCz56lt3q0KzvZ18tOlQvDqaN+ejLX+QDbzjuAHMB3l2FrxAzgN0cyVHvxbA +c66klYQEa19CFcQryoH9VkzrPTRSWjYU0Kf7+eBQaOpDOs2AtrAifEyAprxoE6A/0RQ BRVnzQ6IQk/A9bXZy7DVNvS17f9v+/g52I0QKkl3oG7aS424nsU/6MZ97QnBAiIipkEC Gs+g== X-Gm-Message-State: AC+VfDxLFpS3VvrxXc6B/+mOn8vzI8mgeayTyr/Kw96FVjsOYQBrMyOu 6uXOXdzgk3m6C8IKrLj0glZJZmu3gkQ= X-Google-Smtp-Source: ACHHUZ4oUcRvKReJLQp4yGpkprdp389sxfzhMRHWC1I1rUlz1gcmnNZlRUKOAiEtlAqnZUdCs6R8ZA== X-Received: by 2002:a1c:ed03:0:b0:3f1:6fba:b69a with SMTP id l3-20020a1ced03000000b003f16fbab69amr1704948wmh.11.1683306982641; Fri, 05 May 2023 10:16:22 -0700 (PDT) Date: Fri, 5 May 2023 19:16:18 +0200 From: Alexey Gladkov To: make-initrd@lists.altlinux.org Message-ID: References: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> <42632f4d-b66e-a7f5-1610-74f54891e304@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <42632f4d-b66e-a7f5-1610-74f54891e304@gmail.com> 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 17:16:26 -0000 Archived-At: List-Archive: On Fri, May 05, 2023 at 07:03:16AM +0300, Leonid Krivoshein wrote: > > 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('. Да, ты прав. Название неудачное. Сначала сделал со стандартными, но потом пришлось делать свои так как ни err.h, ни syslog не умеют время выводить. > > + > > + } 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. > _______________________________________________ > Make-initrd mailing list > Make-initrd@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/make-initrd -- Rgrds, legion