Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Is util-linux's flock implemented based on flock() in Linux C API?
Can we tell if a command is being run by a process or not, by looking at the lock file alone?
I found that when a command guarded by flock finishes running, there seems no change to the lock file. Here is when it is running and after it finishes running:
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
Thanks.
lock flock
add a comment |Â
up vote
0
down vote
favorite
Is util-linux's flock implemented based on flock() in Linux C API?
Can we tell if a command is being run by a process or not, by looking at the lock file alone?
I found that when a command guarded by flock finishes running, there seems no change to the lock file. Here is when it is running and after it finishes running:
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
Thanks.
lock flock
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is util-linux's flock implemented based on flock() in Linux C API?
Can we tell if a command is being run by a process or not, by looking at the lock file alone?
I found that when a command guarded by flock finishes running, there seems no change to the lock file. Here is when it is running and after it finishes running:
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
Thanks.
lock flock
Is util-linux's flock implemented based on flock() in Linux C API?
Can we tell if a command is being run by a process or not, by looking at the lock file alone?
I found that when a command guarded by flock finishes running, there seems no change to the lock file. Here is when it is running and after it finishes running:
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
$ ls -l ../sleep.flock.file
-rw-rw-r-- 1 t t 0 Oct 30 14:01 ../sleep.flock.file
Thanks.
lock flock
lock flock
edited 19 secs ago
asked 9 mins ago
Tim
24.4k69238426
24.4k69238426
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Yes. It is explicitly stated in man 1 flock that flock command uses flock() and man 2 flock notes section says that flock() is implemented by system call since Linux kernel 2.0.
Thanks. How about the rest of my questions?
â Tim
53 secs ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Yes. It is explicitly stated in man 1 flock that flock command uses flock() and man 2 flock notes section says that flock() is implemented by system call since Linux kernel 2.0.
Thanks. How about the rest of my questions?
â Tim
53 secs ago
add a comment |Â
up vote
1
down vote
Yes. It is explicitly stated in man 1 flock that flock command uses flock() and man 2 flock notes section says that flock() is implemented by system call since Linux kernel 2.0.
Thanks. How about the rest of my questions?
â Tim
53 secs ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Yes. It is explicitly stated in man 1 flock that flock command uses flock() and man 2 flock notes section says that flock() is implemented by system call since Linux kernel 2.0.
Yes. It is explicitly stated in man 1 flock that flock command uses flock() and man 2 flock notes section says that flock() is implemented by system call since Linux kernel 2.0.
answered 2 mins ago
sebasth
7,70331745
7,70331745
Thanks. How about the rest of my questions?
â Tim
53 secs ago
add a comment |Â
Thanks. How about the rest of my questions?
â Tim
53 secs ago
Thanks. How about the rest of my questions?
â Tim
53 secs ago
Thanks. How about the rest of my questions?
â Tim
53 secs ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478712%2fcan-we-tell-if-a-command-is-being-run-by-a-process-or-not-by-looking-at-the-flo%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password