* [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile
@ 2020-11-13 9:42 Stefan Agner
2021-03-16 14:31 ` Roland Hieber
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2020-11-13 9:42 UTC (permalink / raw)
To: oss-tools
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>
---
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);
}
--
2.29.2
_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile
2020-11-13 9:42 [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile Stefan Agner
@ 2021-03-16 14:31 ` Roland Hieber
0 siblings, 0 replies; 5+ messages in thread
From: Roland Hieber @ 2021-03-16 14:31 UTC (permalink / raw)
To: Stefan Agner; +Cc: oss-tools
On Fri, Nov 13, 2020 at 10:42:33AM +0100, 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>
> ---
> src/barebox-state.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Thanks! This one was the only one of the three that git-am would take,
and I also applied Ahmad's Tested-by from the other thread.
- Roland
>
> 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);
> }
> --
> 2.29.2
>
>
> _______________________________________________
> OSS-Tools mailing list
> OSS-Tools@pengutronix.de
>
--
Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de |
Steuerwalder Str. 21 | https://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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile
2020-11-29 21:11 Stefan Agner
@ 2021-02-10 9:41 ` Ahmad Fatoum
0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2021-02-10 9:41 UTC (permalink / raw)
To: Stefan Agner, oss-tools
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile
@ 2020-11-29 21:11 Stefan Agner
2021-02-10 9:41 ` Ahmad Fatoum
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2020-11-29 21:11 UTC (permalink / raw)
To: oss-tools
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>
---
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);
}
--
2.29.2
_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile
@ 2020-11-29 21:10 Stefan Agner
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Agner @ 2020-11-29 21:10 UTC (permalink / raw)
To: oss-tools
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>
---
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);
}
--
2.29.2
_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-16 14:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 9:42 [OSS-Tools] [PATCH dt-utils] state: use /run to store lockfile Stefan Agner
2021-03-16 14:31 ` Roland Hieber
2020-11-29 21:10 Stefan Agner
2020-11-29 21:11 Stefan Agner
2021-02-10 9:41 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox