Index: lib/libc/db/db/db.c =================================================================== --- lib/libc/db/db/db.c +++ lib/libc/db/db/db.c @@ -49,6 +49,12 @@ #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +#ifndef O_EXLOCK +#define O_EXLOCK 0 +#endif +#ifndef O_SHLOCK +#define O_SHLOCK 0 +#endif DB * dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) @@ -59,16 +65,16 @@ (O_CREAT | O_EXCL | O_EXLOCK | O_NOFOLLOW | O_NONBLOCK | \ O_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC | O_CLOEXEC) - if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0) + if ((flags & ~(use_open_flags | DB_FLAGS)) == 0) switch (type) { case DB_BTREE: - return (__bt_open(fname, flags & USE_OPEN_FLAGS, + return (__bt_open(fname, flags & use_open_flags, mode, openinfo, flags & DB_FLAGS)); case DB_HASH: - return (__hash_open(fname, flags & USE_OPEN_FLAGS, + return (__hash_open(fname, flags & use_open_flags, mode, openinfo, flags & DB_FLAGS)); case DB_RECNO: - return (__rec_open(fname, flags & USE_OPEN_FLAGS, + return (__rec_open(fname, flags & use_open_flags, mode, openinfo, flags & DB_FLAGS)); } errno = EINVAL; Index: tools/build/cross-build/include/linux/fcntl.h =================================================================== --- tools/build/cross-build/include/linux/fcntl.h +++ tools/build/cross-build/include/linux/fcntl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018-2020 Alex Richardson + * Copyright 2018-2021 Alex Richardson * * 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 - /* includes which contains a member __unused */ #include "__unused_workaround_start.h" #include_next #include "__unused_workaround_end.h" -#ifdef __unused_undefd -#undef __unused_undefd -#define __unused __attribute__((unused)) -#endif - #include - -#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; })