Commit ad432deb authored by dnicoara's avatar dnicoara Committed by Commit bot

[Ozone-Drm] Change file locking from Posix to BSD style

Frecon requires BSD style file locks since the lock needs to be held
past forking. So we also need to change the Ozone side since Posix and
BSD locks don't mix.

BUG=463665

Review URL: https://codereview.chromium.org/1007993007

Cr-Commit-Position: refs/heads/master@{#321400}
parent adb2fe2a
......@@ -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 << "'";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment