Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Unified Diff: ui/ozone/platform/drm/gpu/gpu_lock.cc

Issue 1007993007: [Ozone-Drm] Change file locking from Posix to BSD style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/gpu_lock.cc
diff --git a/ui/ozone/platform/drm/gpu/gpu_lock.cc b/ui/ozone/platform/drm/gpu/gpu_lock.cc
index fe3823e9756c5d7383b6410914e0c32fbc571450..bcb287dc9bc28b6e9939530d479f06f9af0e9a3c 100644
--- a/ui/ozone/platform/drm/gpu/gpu_lock.cc
+++ b/ui/ozone/platform/drm/gpu/gpu_lock.cc
@@ -4,7 +4,7 @@
#include "ui/ozone/platform/drm/gpu/gpu_lock.h"
-#include <fcntl.h>
+#include <sys/file.h>
#include <unistd.h>
#include "base/logging.h"
@@ -23,13 +23,8 @@ GpuLock::GpuLock() {
return;
}
- struct flock data;
- memset(&data, 0, sizeof(data));
- data.l_type = F_WRLCK;
- data.l_whence = SEEK_SET;
-
VLOG(1) << "Taking write lock on '" << kGpuLockFile << "'";
- if (HANDLE_EINTR(fcntl(fd_, F_SETLKW, &data)))
+ if (HANDLE_EINTR(flock(fd_, LOCK_EX)))
PLOG(ERROR) << "Error while trying to get lock on '" << kGpuLockFile << "'";
VLOG(1) << "Done trying to take write lock on '" << kGpuLockFile << "'";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698