summaryrefslogtreecommitdiff
path: root/util/lock
Commit message (Collapse)AuthorAgeFilesLines
* util: Add constTom Hughes2021-05-031-1/+1
| | | | | | | | | | | | BRANCH=none BUG=b:144959033 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I60f5f9211fb48391c1595a6a796596fa4471025f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2864515 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* file_lock: Add fallback directoryDavid Hendricks2016-06-021-16/+27
| | | | | | | | | | | | | | | | | | This adds a fallback directory in case SYSTEM_LOCKFILE_DIR is unavailable. Since this is a band-aid meant to help older systems auto-update, the fallback path is hardcoded to "/tmp" as to avoid polluting the overall lockfile API. BUG=chromium:616620 BRANCH=none TEST=Tested on veyron_jaq by removing /run/lock and seeing mosys, flashrom, and ectool run successfully with firmware_utility_lock in /tmp. Change-Id: Idbe63a574474ec35a5c3b6fe2b0fb3b672941492 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/348850 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* locks: Update lockfile dir to be FHS 3.0 compliantDavid Hendricks2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | The Filesystem Hierarchy Standard version 3.0* specifies that /run should be used for runtime variables such as locks. The rationale for switching to use /run instead of /var/run was because /var might not be available at early boot. Since /run is implemented as a tmpfs and doesn't require /var to be mounted first it can be made available earlier. *http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html BUG=chromium:591366 BRANCH=none TEST=none Change-Id: Ic0b5ff336c1c258db8891c0a17c836497d9793c5 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/330123 Reviewed-by: Shawn N <shawnn@chromium.org>
* Replace SysV semaphore lock with file lockDavid Hendricks2016-03-018-557/+263
| | | | | | | | | | | | | | | | | | | | | 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>
* Add library for working with AndroidDavid Hendricks2016-02-293-0/+106
| | | | | | | | | | | | | | | | | | | | | | This adds a couple of helper functions for working within Android: - in_android(): Crude test that uses getenv() to see if an Android- specific environment variable is defined. - android_tmpdir_path(): Android doesn't have the usual locations for temporary file storage such as /tmp or even /var/run/locks. And to make matters worse, there isn't even a standard location for temporary files so it must be determined at run time. This will be used in a follow-up patch. BUG=chrome-os-partner:49527 BRANCH=none TEST=tested on smaug Change-Id: Ifb5fb4067fffb7c8cb2d4350ca4a223e884d3aa5 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/329299 Reviewed-by: Shawn N <shawnn@chromium.org>
* Add bionic compatibilityAnatol Pomazau2016-02-101-1/+1
| | | | | | | | | | | | | | TEST=Build ectool for Android and run it BUG=None BRANCH=master Signed-off-by: Anatol Pomazau <anatol@google.com> Change-Id: I5f148adfc24591523a7d8c50817c8095072071c3 Reviewed-on: https://chromium-review.googlesource.com/327220 Commit-Ready: Anatol Pomazau <anatol@google.com> Tested-by: Anatol Pomazau <anatol@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cleanup: fix all the header guardsBill Richardson2015-06-184-12/+12
| | | | | | | | | | | | | | | This unifies all the EC header files to use __CROS_EC_FILENAME_H as the include guard. Well, except for test/ util/ and extra/ which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively. BUG=chromium:496895 BRANCH=none TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029 Reviewed-on: https://chromium-review.googlesource.com/278121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: Remove checkpatch warningsRandall Spangler2013-12-192-26/+21
| | | | | | | | | | | | | | | | This make minor syntactic changes and renames some camel-cased symbols to keep checkpatch from complaining. The goal is to reduce the temptation to use 'repo upload --no-verify'. This is a big furball of find/replace, but no functional changes. BUG=chromium:322144 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/180495
* util: declare all host utils source dependencies in build.mkVincent Palatin2013-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of hardcoding the common files for host utils in the generic rules, let's declare them in the build.mk file using the same system as the Linux kernel build. if a binary "foo" declared in "host-util-bin" or "build-util-bin" has a matching "foo-objs" variable, it will be build from all objects declared in "foo-objs" else it uses directly "foo.o" (single source file). This is preparatory to add new "build" tools sharing common sources. note: the dependencies on the utils are a bit less fine-grained as a result of this change, but given the low number of tools, that should be acceptable. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=./util/make_all.sh Change-Id: Ieffce7ca6f5b685ffb7d1f4626b99aff07b61443 Reviewed-on: https://chromium-review.googlesource.com/176174 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Add GEC lock mechanism.Louis Yung-Chieh Lo2012-08-108-0/+762
Basically re-use the gec lock code from flashrom package. BUG=chrome-os-partner:12319 TEST=Build and run on link. Only build on snow. while true; do ectool hello; done & ; run 10 instances. ; expect all instances runs okay. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Change-Id: I11d5824f46810c6f5a04a564a81387cdea081697 Reviewed-on: https://gerrit.chromium.org/gerrit/29763 Reviewed-by: Randall Spangler <rspangler@chromium.org>