X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Flockfile.c;h=e0f6328710bd6ab52e4cd0e7a81428f923d8a720;hb=d58c5bc2d854ce601338d0785c8086d619a16135;hp=f056502de81e7cc0cc29725c00a6c90af861f77d;hpb=d98e60075528c3065ad453f7add4b30f22edcde3;p=openvswitch diff --git a/lib/lockfile.c b/lib/lockfile.c index f056502d..e0f63287 100644 --- a/lib/lockfile.c +++ b/lib/lockfile.c @@ -1,4 +1,4 @@ - /* Copyright (c) 2008, 2009, 2010 Nicira Networks + /* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,11 @@ VLOG_DEFINE_THIS_MODULE(lockfile); +COVERAGE_DEFINE(lockfile_lock); +COVERAGE_DEFINE(lockfile_timeout); +COVERAGE_DEFINE(lockfile_error); +COVERAGE_DEFINE(lockfile_unlock); + struct lockfile { struct hmap_node hmap_node; char *name; @@ -106,17 +111,12 @@ lockfile_lock(const char *file, int timeout, struct lockfile **lockfilep) } } while (error == EINTR && (timeout == INT_MAX || elapsed < timeout)); - if (!error) { - if (elapsed) { - VLOG_WARN("%s: waited %lld ms for lock file", - lock_name, elapsed); - } - } else if (error == EINTR) { + if (error == EINTR) { COVERAGE_INC(lockfile_timeout); VLOG_WARN("%s: giving up on lock file after %lld ms", lock_name, elapsed); error = ETIMEDOUT; - } else { + } else if (error) { COVERAGE_INC(lockfile_error); if (error == EACCES) { error = EAGAIN;