From: Ahmad Fatoum <a.fatoum@pengutronix.de> To: Stefan Agner <stefan@agner.ch>, oss-tools@pengutronix.de Subject: Re: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile Date: Wed, 10 Feb 2021 10:41:13 +0100 [thread overview] Message-ID: <4904b4eb-2ae9-5b73-a7bb-d996522efb08@pengutronix.de> (raw) In-Reply-To: <a0380a59d3ecb3a800c59d9993182798@agner.ch> On 29.11.20 22:11, Stefan Agner wrote: > The current location /var/lock is considered legacy (at least by > systemd). Just use /run to store the lockfile and append the usual .lock > suffix. > > Signed-off-by: Stefan Agner <stefan@agner.ch> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > --- > src/barebox-state.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/barebox-state.c b/src/barebox-state.c > index 946a8db..16a8c9f 100644 > --- a/src/barebox-state.c > +++ b/src/barebox-state.c > @@ -38,6 +38,8 @@ > #include <dt/dt.h> > #include <state.h> > > +#define BAREBOX_STATE_LOCKFILE "/run/barebox-state.lock" > + > struct state_variable; > > static int __state_uint8_set(struct state_variable *var, const char > *val); > @@ -505,15 +507,15 @@ int main(int argc, char *argv[]) > ++nr_states; > } > > - lock_fd = open("/var/lock/barebox-state", O_CREAT | O_RDWR, 0600); > + lock_fd = open(BAREBOX_STATE_LOCKFILE, O_CREAT | O_RDWR, 0600); > if (lock_fd < 0) { > - pr_err("Failed to open lock-file /var/lock/barebox-state\n"); > + pr_err("Failed to open lock-file " BAREBOX_STATE_LOCKFILE "\n"); > exit(1); > } > > ret = flock(lock_fd, LOCK_EX); > if (ret < 0) { > - pr_err("Failed to lock /var/lock/barebox-state: %m\n"); > + pr_err("Failed to lock " BAREBOX_STATE_LOCKFILE ": %m\n"); > close(lock_fd); > exit(1); > } > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ OSS-Tools mailing list OSS-Tools@pengutronix.de
next prev parent reply other threads:[~2021-02-10 9:41 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-29 21:11 Stefan Agner 2021-02-10 9:41 ` Ahmad Fatoum [this message] -- strict thread matches above, loose matches on Subject: below -- 2020-11-29 21:10 Stefan Agner 2020-11-13 9:42 Stefan Agner 2021-03-16 14:31 ` Roland Hieber
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4904b4eb-2ae9-5b73-a7bb-d996522efb08@pengutronix.de \ --to=a.fatoum@pengutronix.de \ --cc=oss-tools@pengutronix.de \ --cc=stefan@agner.ch \ --subject='Re: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox