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); Thu, 23 May 2024 12:06:37 +0200 (CEST) Received: by 2002:a05:6a11:2489:b0:55f:c3c0:ed08 with SMTP id sg9csp1203356pxb; Thu, 23 May 2024 03:06:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVC+SZLLVIamMXzEjpjK65nPKT9esJT4TvQ5TrBzaQCnZqTTVtQxwHkUDX9xjhQexNchp+cDAUkffVO4Muo0JicUvGlOK6xMmg= X-Google-Smtp-Source: AGHT+IFNG1zrL8hTEYzyt0C8Gm7MF3u8mS1m7KJrLzbZ/1OvAK3fFxbhyK0UGRJn5fD5t9k9WKfw X-Received: by 2002:a05:620a:4e5:b0:790:f36b:5360 with SMTP id af79cd13be357-7949941b961mr388220685a.15.1716458778996; Thu, 23 May 2024 03:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716458778; cv=none; d=google.com; s=arc-20160816; b=Ptq5QqxnrSYidNn02ul7HAK9JOiCmL1BRAHqSqKvLI+RYS3hqm4tW8RY4i3EI+iAoT 6/fEaRFvGrW1CDn9TLCaNfnLGHnMyYpWu+LvkbN5khDvdhNVv8uvhHEj2Z67sPVjSInR SVFhW3WyCnELMiDrTxXpKgUUEymWSNiVWMeUaVb9csQ0lRdd8KohXb02eXsc3zwT4l5W MWkthbZeLX2m49U7+MO8eBSG4fDgM7j5xgyOd9DNcgCkfGLD+CoPtpi6Hp5ChAqTKCNy i+HXlbajt8+kBQJr/Hmpmdqn98f2VpIh6T6hWrMD7GUjj/QBaGQgPVO1yD8jtGaJLa+z xYAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:user-agent:in-reply-to:mime-version:references :message-id:subject:cc:to:from:date:delivered-to; bh=z7THXsX51XPLiF0vFgqaPLvA5CbJ3F2VHmakdOpsUdI=; fh=sa22/YzBg7gBlP1vWMAMO0ID50cEEzmrnuJNDeV9zT4=; b=cKz85xp1o2M0+eAqMcA/AT1vFmyLOsy95f22Sg3nmcN94HP2UuXKXyMqu/RKp9VkpF G3/+qsEJpoW45iIUSg3WKDtpBG1dd/+gZmhJSGNNCyYjgJd2QfbCbKhWbeMe/W6Vwo0E QyCnfBO5pGuAWxps5MQk3ZTHi3/XekIriM8dqFFkmzJ7RnQWVjLH6uERv8D/kaE4Zsyw e+meN1pbuPE4LjX648CtRey3IqnSqMDJeTT6D5f4TJkc9I2ew0OO1YDwv+2THCNJ2DHi wwhPWduHD7zHbZmOhJcRFRBraF55VyWxn+Au7CI3DrnWB3e9uiILRYytK5GjXHO9jUO/ D24Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; gateway.spf=pass (google.com: domain gapps.redhat.com configured 170.10.128.131 as internal address) smtp.mailfrom=rjones@redhat.com smtp.remote-ip=170.10.128.131 policy.d=gapps.redhat.com 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 af79cd13be357-792bf278a1asi551845685a.1.2024.05.23.03.06.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 03:06:18 -0700 (PDT) Received-SPF: pass (google.com: domain gapps.redhat.com configured 170.10.128.131 as internal address) Authentication-Results: mx.google.com; gateway.spf=pass (google.com: domain gapps.redhat.com configured 170.10.128.131 as internal address) smtp.mailfrom=rjones@redhat.com smtp.remote-ip=170.10.128.131 policy.d=gapps.redhat.com Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-l4ir6Lh4P8S5h2vgkW-m6w-1; Thu, 23 May 2024 06:06:17 -0400 X-MC-Unique: l4ir6Lh4P8S5h2vgkW-m6w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 191C83C025B9 for ; Thu, 23 May 2024 10:06:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 15F5C1C0654B; Thu, 23 May 2024 10:06:17 +0000 (UTC) Received: from localhost (unknown [10.42.28.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92BC11C09480; Thu, 23 May 2024 10:06:16 +0000 (UTC) Date: Thu, 23 May 2024 11:06:15 +0100 From: "Richard W.M. Jones" To: Stefano Brivio Cc: passt-dev@passt.top, David Gibson , Minxi Hou Subject: Re: [PATCH 5/8] util: Rename write_pidfile() to pidfile_write() Message-ID: <20240523100615.GU4345@redhat.com> References: <20240522205911.261325-1-sbrivio@redhat.com> <20240522205911.261325-6-sbrivio@redhat.com> MIME-Version: 1.0 In-Reply-To: <20240522205911.261325-6-sbrivio@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: On Wed, May 22, 2024 at 10:59:08PM +0200, Stefano Brivio wrote: > 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) > if (!c.foreground) > __daemon(pidfile_fd, devnull_fd); > else > - write_pidfile(pidfile_fd, getpid()); > + pidfile_write(pidfile_fd, getpid()); > > if (pasta_child_pid) > kill(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) > } > > /** > - * 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 it > * @fd: Open PID file descriptor, closed on exit, -1 to skip writing it > * @pid: PID value to write > */ > -void write_pidfile(int fd, pid_t pid) > +void pidfile_write(int fd, pid_t pid) > { > char pid_buf[12]; > int n; > @@ -419,7 +419,7 @@ int __daemon(int pidfile_fd, int devnull_fd) > } > > if (pid) { > - write_pidfile(pidfile_fd, pid); > + pidfile_write(pidfile_fd, pid); > exit(EXIT_SUCCESS); > } > > 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); Neutral refactoring, so: Reviewed-by: Richard W.M. Jones However the same function name appears (just as a comment) in contrib/apparmor/usr.bin.passt so I don't know if you would want to update that? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top