SandboxBrokerUtils.h (1156B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 #ifndef mozilla_SandboxBrokerUtils_h 7 #define mozilla_SandboxBrokerUtils_h 8 9 #include <sys/types.h> 10 #include <sys/stat.h> 11 #include <unistd.h> 12 #include "sandbox/linux/system_headers/linux_syscalls.h" 13 14 // On 32-bit Linux, stat calls are translated by libc into stat64 15 // calls. We'll intercept those and handle them in the stat functions 16 // but must be sure to use the right structure layout. 17 18 #if defined(__NR_stat64) || defined(__NR_fstatat64) 19 typedef struct stat64 statstruct; 20 # define statsyscall stat64 21 # define lstatsyscall lstat64 22 # define fstatsyscall fstat64 23 #elif defined(__NR_stat) || defined(__NR_newfstatat) 24 typedef struct stat statstruct; 25 # define statsyscall stat 26 # define lstatsyscall lstat 27 # define fstatsyscall fstat 28 #else 29 # error Missing stat syscall include. 30 #endif 31 32 #endif // mozilla_SandboxBrokerUtils_h