github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/util/platform_util.h (about) 1 // Copyright 2020 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef GVISOR_TEST_UTIL_PLATFORM_UTIL_H_ 16 #define GVISOR_TEST_UTIL_PLATFORM_UTIL_H_ 17 18 namespace gvisor { 19 namespace testing { 20 21 // PlatformSupport is a generic enumeration of classes of support. 22 // 23 // It is up to the individual functions and callers to agree on the precise 24 // definition for each case. The document here generally refers to 32-bit 25 // as an example. Many cases will use only NotSupported and Allowed. 26 enum class PlatformSupport { 27 // The feature is not supported on the current platform. 28 // 29 // In the case of 32-bit, this means that calls will generally be interpreted 30 // as 64-bit calls, and there is no support for 32-bit binaries, long calls, 31 // etc. This usually means that the underlying implementation just pretends 32 // that 32-bit doesn't exist. 33 NotSupported, 34 35 // Calls will be ignored by the kernel with a fixed error. 36 Ignored, 37 38 // Calls will result in a SIGSEGV or similar fault. 39 Segfault, 40 41 // The feature is supported as expected. 42 // 43 // In the case of 32-bit, this means that the system call or far call will be 44 // handled properly. 45 Allowed, 46 }; 47 48 PlatformSupport PlatformSupport32Bit(); 49 PlatformSupport PlatformSupportAlignmentCheck(); 50 PlatformSupport PlatformSupportMultiProcess(); 51 PlatformSupport PlatformSupportInt3(); 52 53 } // namespace testing 54 } // namespace gvisor 55 56 #endif // GVISOR_TEST_UTIL_PLATFORM_UTL_H_