From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from imap.gmail.com [173.194.76.109] by localhost with POP3 (fetchmail-6.3.26) for (single-drop); Wed, 22 May 2024 23:00:09 +0200 (CEST) Received: by 2002:a05:6a11:2489:b0:55f:c3c0:ed08 with SMTP id sg9csp910675pxb; Wed, 22 May 2024 13:59:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXM2GsedXptsAWhxgFba7bxFhNnAsmmzLQ8C4nhp5jXDygmHhjedGOZUOVHmD9Ym0kjoa33sz/SsGbiv45OlM6IhV68SNoTFgo= X-Google-Smtp-Source: AGHT+IG4NqfOHAQQynEXAlhoHUp7iwwHlVgfXGJPrfjoi5xk9T4GnPvzKMqDVyxreCZA0aus8VrF X-Received: by 2002:a05:6214:54c7:b0:6aa:765b:c8d3 with SMTP id 6a1803df08f44-6ab7f36daa1mr34333826d6.36.1716411570440; Wed, 22 May 2024 13:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716411570; cv=none; d=google.com; s=arc-20160816; b=RDyMSJG7lEv77l6i5Gikt7eDR3sFCYQdBzGgUvnlEpog8/zsy7/lzBDFe5IKqxKLcy IqjiLeDjrieqWo5gj1P6bEVIRbe75Uf9UrkSkBqaSuIJJOmPvbYs4sfYJcAD0/spnWw2 v1B+IvQ0eEBxCBlqMdpYMbbyOsRGZjL6rzfUQM6flMyqzmCqgx2AKo36XI3xTr5gooh/ 0J1+ghb9qR4jmV+OvY50LmtVo5wmQsh/3cxltiMcPFkPLz0w21EzvFN9+Or04UW6y02/ KzymW/DDHOMYFO8AMA0xv6u+TLCVjCs6REROUFuYsefx+qvoicbHuYZI9zJA2+zltwOL C+uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:list-unsubscribe:list-subscribe:list-post :list-owner:list-help:list-archive:list-archive:archived-at :archived-at:list-id:precedence:cc:message-id-hash:mime-version :references:in-reply-to:message-id:date:subject:to:from:delivered-to; bh=V+Jbjp4C3O+dVv0GGYKVXmiQVCut4BWFF94Lwk1VrlU=; fh=Sda5+ix8pPMDNzAK4mfqRvxwOV3J+P0OHYKuDzXzUCA=; b=QQB85wp6H6cRq3hqXrdHw2diDUryn7X50J6Ma7rcbhFndq/OXbr/LteBshpK7uJs+b w8SgPHTSatc6oO0Wxq+3rfAnP3RtK39GoCBQf+P0AK0VpYCjUiodePkXIpvofJeUZ1PZ aYCqgeqEtRohL0wa04NQqc7JNNtsF13lGa4btJOiBtyybQfVzus68qbyT0VLDTX9Eorv Ob7FoQw0J5OARoCz+nConk7SwulVU7UV+CQTIJoLlEqSY8952UhQp0mtNzBDfLn7QPCG AqPBJH08RQwNBIynKYW5f9AWhe8djxGzpqdkfZhAieuTtcXmrH3KyogBeQZmdx3kaW1X UbmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) smtp.mailfrom=passt-dev-bounces@passt.top Return-Path: Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com. [170.10.128.131]) by mx.google.com with ESMTPS id 6a1803df08f44-6ab77c8f480si41163006d6.494.2024.05.22.13.59.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 13:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) client-ip=88.198.0.164; Authentication-Results: mx.google.com; spf=pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) smtp.mailfrom=passt-dev-bounces@passt.top Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-YMz0akPIP4eqRjDWkgQoKg-1; Wed, 22 May 2024 16:59:28 -0400 X-MC-Unique: YMz0akPIP4eqRjDWkgQoKg-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E16301955F2F for ; Wed, 22 May 2024 20:59:27 +0000 (UTC) Received: by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) id CE6211955D97; Wed, 22 May 2024 20:59:27 +0000 (UTC) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.33]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CBB021955D94 for ; Wed, 22 May 2024 20:59:27 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A5FE11944CE7 for ; Wed, 22 May 2024 20:59:25 +0000 (UTC) Received: from passt.top (passt.top [88.198.0.164]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-T85c5bLpO1KfanF0ztFD2g-1; Wed, 22 May 2024 16:59:20 -0400 X-MC-Unique: T85c5bLpO1KfanF0ztFD2g-1 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by passt.top (Postfix) with ESMTP id E19295A0317; Wed, 22 May 2024 22:59:14 +0200 (CEST) Received: by passt.top (Postfix, from userid 1000) id BE9F95A030A; Wed, 22 May 2024 22:59:11 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 5/8] util: Rename write_pidfile() to pidfile_write() Date: Wed, 22 May 2024 22:59:08 +0200 Message-ID: <20240522205911.261325-6-sbrivio@redhat.com> In-Reply-To: <20240522205911.261325-1-sbrivio@redhat.com> References: <20240522205911.261325-1-sbrivio@redhat.com> MIME-Version: 1.0 Message-ID-Hash: ENSLZ2UGORNFUG5CXO6N5FORGVZIVTYD X-Message-ID-Hash: ENSLZ2UGORNFUG5CXO6N5FORGVZIVTYD X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson , "'Richard W . M . Jones'" , Minxi Hou X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored External Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User Name=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat Dictionary=false;Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII"; x-default=true As I'm adding pidfile_open() in the next patch. The function comment didn't match, by the way. Signed-off-by: Stefano Brivio --- passt.c | 2 +- util.c | 6 +++--- util.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/passt.c b/passt.c index 1df1dc4..fb9773d 100644 --- a/passt.c +++ b/passt.c @@ -317,7 +317,7 @@ int main(int argc, char **argv) =09if (!c.foreground) =09=09__daemon(pidfile_fd, devnull_fd); =09else -=09=09write_pidfile(pidfile_fd, getpid()); +=09=09pidfile_write(pidfile_fd, getpid()); =20 =09if (pasta_child_pid) =09=09kill(pasta_child_pid, SIGUSR1); diff --git a/util.c b/util.c index 849fa7f..18c04ba 100644 --- a/util.c +++ b/util.c @@ -380,11 +380,11 @@ int open_in_ns(const struct ctx *c, const char *path,= int flags) } =20 /** - * pid_file() - Write PID to file, if requested to do so, and close it + * pidfile_write() - Write PID to file, if requested to do so, and close i= t * @fd:=09=09Open PID file descriptor, closed on exit, -1 to skip writing = it * @pid:=09PID value to write */ -void write_pidfile(int fd, pid_t pid) +void pidfile_write(int fd, pid_t pid) { =09char pid_buf[12]; =09int n; @@ -419,7 +419,7 @@ int __daemon(int pidfile_fd, int devnull_fd) =09} =20 =09if (pid) { -=09=09write_pidfile(pidfile_fd, pid); +=09=09pidfile_write(pidfile_fd, pid); =09=09exit(EXIT_SUCCESS); =09} =20 diff --git a/util.h b/util.h index 264423b..f811975 100644 --- a/util.h +++ b/util.h @@ -156,7 +156,7 @@ char *line_read(char *buf, size_t len, int fd); void ns_enter(const struct ctx *c); bool ns_is_init(void); int open_in_ns(const struct ctx *c, const char *path, int flags); -void write_pidfile(int fd, pid_t pid); +void pidfile_write(int fd, pid_t pid); int __daemon(int pidfile_fd, int devnull_fd); int fls(unsigned long x); int write_file(const char *path, const char *buf); --=20 2.43.0