fuchsia: Add flock() stub to get test binaries linking again

Because the SDK isn't pinned, this broke recently:
https://build.chromium.org/p/client.crashpad/builders/crashpad_fuchsia_x64_dbg/builds/59/steps/compile%20with%20ninja/logs/stdio
due to changes in limiting exported symbols, flock() being one of the
casualties:
https://fuchsia.googlesource.com/zircon/+log/HEAD/third_party/ulib/musl/exported.map

Temporarily add a stub local definition here, as excluding
LoggingLockFile() is needed by Settings, which is used downstream by a
bunch of things, and so requires a lot of build file gymnastics to
exclude. Once there's a Fuchsia implementation of Settings, this can be
deleted and LoggingLock/UnlockFile can be #if'd out for Fuchsia.

Bug: crashpad:196
Change-Id: I0971736572b940c8bc2364c01dafc6844f9303d7
Reviewed-on: https://chromium-review.googlesource.com/917083
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Scott Graham 2018-02-13 12:36:18 -08:00 committed by Commit Bot
parent b83f4c731d
commit f878f15517

View File

@ -157,6 +157,19 @@ FileHandle LoggingOpenFileForReadAndWrite(const base::FilePath& path,
return fd;
}
#if defined(OS_FUCHSIA)
int flock(int, int) {
// TODO(scottmg): https://crashpad.chromium.org/bug/196:
// This was removed from the libc of Fuchsia recently. A new implementation of
// Settings is being worked on that doesn't require flock(), but until then,
// it's more useful to have it link, but fail at runtime than it is to exclude
// a lot of code (Settings, which requires excludes the CrashReportDatabase,
// which requires excluding a variety of tests, the handler, and so on.).
NOTREACHED();
return ENOSYS;
}
#endif // OS_FUCHSIA
bool LoggingLockFile(FileHandle file, FileLocking locking) {
int operation = (locking == FileLocking::kShared) ? LOCK_SH : LOCK_EX;
int rv = HANDLE_EINTR(flock(file, operation));