diff options
author | David Hendricks <dhendrix@chromium.org> | 2016-02-25 16:30:41 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-03-01 14:53:50 -0800 |
commit | d89301b0360365306ea7b24751490847858e3646 (patch) | |
tree | b83165c2305ec593a7f8bed71800efd16b181863 /util/lock/gec_lock.c | |
parent | afc76f1adf97d3a4039663e13afc457139d200fc (diff) | |
download | chrome-ec-d89301b0360365306ea7b24751490847858e3646.tar.gz |
Replace SysV semaphore lock with file lock
Some systems, such as Android, do not support SysV semaphore locks.
This implements an alternative file lock mechanism using flock().
flock() was chosen because it's pretty straight forward. It's known to
be broken when using NFS, but I doubt we'll ever store our lock on an
NFS volume.
CQ-DEPEND=CL:327407,CL:325609
BUG=chrome-os-partner:49527
BRANCH=none
TEST=tested on Smaug by running mosys and ectool while reading
firmware ROM with flashrom, all three utilities eventually
ran successfully.
Change-Id: Ic73fe0281fbc1dfaae1bb03e5683774a0c04ae5b
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329430
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'util/lock/gec_lock.c')
-rw-r--r-- | util/lock/gec_lock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/lock/gec_lock.c b/util/lock/gec_lock.c index 4df231af3e..d354ea08f3 100644 --- a/util/lock/gec_lock.c +++ b/util/lock/gec_lock.c @@ -32,7 +32,7 @@ #include "ipc_lock.h" #include "locks.h" -static struct ipc_lock gec_lock = IPC_LOCK_INIT(GECLOCK); +static struct ipc_lock gec_lock = LOCKFILE_INIT(CROS_EC_LOCKFILE_NAME); int acquire_gec_lock(int timeout_secs) { |