Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_TYPES_H
0003 #define _UAPI_LINUX_TYPES_H
0004 
0005 #include <asm/types.h>
0006 
0007 #ifndef __ASSEMBLY__
0008 #ifndef __KERNEL__
0009 #ifndef __EXPORTED_HEADERS__
0010 #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders"
0011 #endif /* __EXPORTED_HEADERS__ */
0012 #endif
0013 
0014 #include <linux/posix_types.h>
0015 
0016 
0017 /*
0018  * Below are truly Linux-specific types that should never collide with
0019  * any application/library that wants linux/types.h.
0020  */
0021 
0022 /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
0023 #ifdef __CHECKER__
0024 #define __bitwise   __attribute__((bitwise))
0025 #else
0026 #define __bitwise
0027 #endif
0028 
0029 /* The kernel doesn't use this legacy form, but user space does */
0030 #define __bitwise__ __bitwise
0031 
0032 typedef __u16 __bitwise __le16;
0033 typedef __u16 __bitwise __be16;
0034 typedef __u32 __bitwise __le32;
0035 typedef __u32 __bitwise __be32;
0036 typedef __u64 __bitwise __le64;
0037 typedef __u64 __bitwise __be64;
0038 
0039 typedef __u16 __bitwise __sum16;
0040 typedef __u32 __bitwise __wsum;
0041 
0042 /*
0043  * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
0044  * common 32/64-bit compat problems.
0045  * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
0046  * architectures) and to 8-byte boundaries on 64-bit architectures.  The new
0047  * aligned_64 type enforces 8-byte alignment so that structs containing
0048  * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
0049  * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
0050  */
0051 #define __aligned_u64 __u64 __attribute__((aligned(8)))
0052 #define __aligned_be64 __be64 __attribute__((aligned(8)))
0053 #define __aligned_le64 __le64 __attribute__((aligned(8)))
0054 
0055 typedef unsigned __bitwise __poll_t;
0056 
0057 #endif /*  __ASSEMBLY__ */
0058 #endif /* _UAPI_LINUX_TYPES_H */