]> git.ipfire.org Git - people/ms/u-boot.git/blob - arch/riscv/include/asm/posix_types.h
riscv: nx25: include: Add header files to support RISC-V
[people/ms/u-boot.git] / arch / riscv / include / asm / posix_types.h
1 /*
2 * linux/include/asm-arm/posix_types.h
3 *
4 * Copyright (C) 1996-1998 Russell King.
5 *
6 * Copyright (C) 2011 Andes Technology Corporation
7 * Copyright (C) 2010 Shawn Lin (nobuhiro@andestech.com)
8 * Copyright (C) 2011 Macpaul Lin (macpaul@andestech.com)
9 * Copyright (C) 2017 Rick Chen (rick@andestech.com)
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * Changelog:
16 * 27-06-1996 RMK Created
17 * 25-10-2017 Modified for arch RISCV
18 */
19 #ifndef __ARCH_RISCV_POSIX_TYPES_H
20 #define __ARCH_RISCV_POSIX_TYPES_H
21
22 /*
23 * This file is generally used by user-level software, so you need to
24 * be a little careful about namespace pollution etc. Also, we cannot
25 * assume GCC is being used.
26 */
27
28 typedef unsigned short __kernel_dev_t;
29 typedef unsigned long __kernel_ino_t;
30 typedef unsigned short __kernel_mode_t;
31 typedef unsigned short __kernel_nlink_t;
32 typedef long __kernel_off_t;
33 typedef int __kernel_pid_t;
34 typedef unsigned short __kernel_ipc_pid_t;
35 typedef unsigned short __kernel_uid_t;
36 typedef unsigned short __kernel_gid_t;
37 #ifdef __GNUC__
38 typedef __SIZE_TYPE__ __kernel_size_t;
39 #else
40 typedef unsigned int __kernel_size_t;
41 #endif
42 typedef int __kernel_ssize_t;
43 typedef int __kernel_ptrdiff_t;
44 typedef long __kernel_time_t;
45 typedef long __kernel_suseconds_t;
46 typedef long __kernel_clock_t;
47 typedef int __kernel_daddr_t;
48 typedef char *__kernel_caddr_t;
49 typedef unsigned short __kernel_uid16_t;
50 typedef unsigned short __kernel_gid16_t;
51 typedef unsigned int __kernel_uid32_t;
52 typedef unsigned int __kernel_gid32_t;
53
54 typedef unsigned short __kernel_old_uid_t;
55 typedef unsigned short __kernel_old_gid_t;
56
57 #ifdef __GNUC__
58 typedef long long __kernel_loff_t;
59 #endif
60
61 typedef struct {
62 #if defined(__KERNEL__) || defined(__USE_ALL)
63 int val[2];
64 #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
65 int __val[2];
66 #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
67 } __kernel_fsid_t;
68
69 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
70
71 #undef __FD_SET
72 #define __FD_SET(fd, fdsetp) \
73 (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1 << (fd & 31)))
74
75 #undef __FD_CLR
76 #define __FD_CLR(fd, fdsetp) \
77 (((fd_set *)fdsetp)->fds_bits[fd >> 5] &= ~(1 << (fd & 31)))
78
79 #undef __FD_ISSET
80 #define __FD_ISSET(fd, fdsetp) \
81 ((((fd_set *)fdsetp)->fds_bits[fd >> 5] & (1 << (fd & 31))) != 0)
82
83 #undef __FD_ZERO
84 #define __FD_ZERO(fdsetp) \
85 (memset(fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
86
87 #endif
88
89 #endif /* __ARCH_RISCV_POSIX_TYPES_H */