diff options
author | Alex Richardson <arichardson@FreeBSD.org> | 2021-08-02 08:45:05 +0000 |
---|---|---|
committer | Alex Richardson <arichardson@FreeBSD.org> | 2021-08-02 13:33:23 +0000 |
commit | 5f6c8ce2452da2da233e37bf4c2b6fccde8594b1 (patch) | |
tree | c8244bddbc0cecf2b1f80d0656962b400f63c591 /tools | |
parent | 1b1bb6f178802a4522824e0268634a99cdbda098 (diff) | |
download | src-5f6c8ce2452da2da233e37bf4c2b6fccde8594b1.tar.gz src-5f6c8ce2452da2da233e37bf4c2b6fccde8594b1.zip |
tools/build: Don't redefine open() for the linux bootstrap
This is needed to bootstrap llvm-tblgen on Linux since LLVM calls
`::open(...)` which does not work if open is a statement macro.
Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools
user of those flags to deal with missing definitions.
Reviewed By: jrtc27
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31226
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/cross-build/include/linux/fcntl.h | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h index 94662befddad..4fa169d4ed4c 100644 --- a/tools/build/cross-build/include/linux/fcntl.h +++ b/tools/build/cross-build/include/linux/fcntl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org> + * Copyright 2018-2021 Alex Richardson <arichardson@FreeBSD.org> * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -37,29 +40,9 @@ */ #pragma once - /* <bits/fcntl.h> includes <bits/stat.h> which contains a member __unused */ #include "__unused_workaround_start.h" #include_next <fcntl.h> #include "__unused_workaround_end.h" -#ifdef __unused_undefd -#undef __unused_undefd -#define __unused __attribute__((unused)) -#endif - #include <sys/file.h> - -#ifndef O_EXLOCK -#define O_EXLOCK (1 << 30) -#endif -#ifndef O_SHLOCK -#define O_SHLOCK (1 << 31) -#endif - -#undef open -#define open(path, flags, ...) ({ \ - int __fd = (open)(path, flags, ##__VA_ARGS__); \ - if (flags & O_EXLOCK) flock(__fd, LOCK_EX); \ - if (flags & O_SHLOCK) flock(__fd, LOCK_SH); \ - __fd; }) |