Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
8f2897e2
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
接近 2 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8f2897e2
编写于
5月 05, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
!288 feat: musl support newlib
Merge pull request !288 from Harylee/qemu
上级
0657ea0f
efb942bb
变更
54
隐藏空白更改
内联
并排
Showing
54 changed file
with
3968 addition
and
0 deletion
+3968
-0
porting/liteos_a_newlib/kernel/include/arpa/inet.h
porting/liteos_a_newlib/kernel/include/arpa/inet.h
+36
-0
porting/liteos_a_newlib/kernel/include/assert.h
porting/liteos_a_newlib/kernel/include/assert.h
+44
-0
porting/liteos_a_newlib/kernel/include/bits/ioctl.h
porting/liteos_a_newlib/kernel/include/bits/ioctl.h
+132
-0
porting/liteos_a_newlib/kernel/include/bits/ioctl_fix.h
porting/liteos_a_newlib/kernel/include/bits/ioctl_fix.h
+2
-0
porting/liteos_a_newlib/kernel/include/bits/ipc.h
porting/liteos_a_newlib/kernel/include/bits/ipc.h
+11
-0
porting/liteos_a_newlib/kernel/include/bits/ipcstat.h
porting/liteos_a_newlib/kernel/include/bits/ipcstat.h
+1
-0
porting/liteos_a_newlib/kernel/include/bits/mman.h
porting/liteos_a_newlib/kernel/include/bits/mman.h
+0
-0
porting/liteos_a_newlib/kernel/include/bits/poll.h
porting/liteos_a_newlib/kernel/include/bits/poll.h
+0
-0
porting/liteos_a_newlib/kernel/include/bits/shm.h
porting/liteos_a_newlib/kernel/include/bits/shm.h
+33
-0
porting/liteos_a_newlib/kernel/include/bits/socket.h
porting/liteos_a_newlib/kernel/include/bits/socket.h
+0
-0
porting/liteos_a_newlib/kernel/include/bits/statfs.h
porting/liteos_a_newlib/kernel/include/bits/statfs.h
+7
-0
porting/liteos_a_newlib/kernel/include/bits/syscall.h
porting/liteos_a_newlib/kernel/include/bits/syscall.h
+421
-0
porting/liteos_a_newlib/kernel/include/bits/termios.h
porting/liteos_a_newlib/kernel/include/bits/termios.h
+166
-0
porting/liteos_a_newlib/kernel/include/dirent.h
porting/liteos_a_newlib/kernel/include/dirent.h
+76
-0
porting/liteos_a_newlib/kernel/include/errno.h
porting/liteos_a_newlib/kernel/include/errno.h
+52
-0
porting/liteos_a_newlib/kernel/include/fcntl.h
porting/liteos_a_newlib/kernel/include/fcntl.h
+47
-0
porting/liteos_a_newlib/kernel/include/malloc.h
porting/liteos_a_newlib/kernel/include/malloc.h
+52
-0
porting/liteos_a_newlib/kernel/include/netinet/in.h
porting/liteos_a_newlib/kernel/include/netinet/in.h
+415
-0
porting/liteos_a_newlib/kernel/include/poll.h
porting/liteos_a_newlib/kernel/include/poll.h
+73
-0
porting/liteos_a_newlib/kernel/include/pthread.h
porting/liteos_a_newlib/kernel/include/pthread.h
+112
-0
porting/liteos_a_newlib/kernel/include/sched.h
porting/liteos_a_newlib/kernel/include/sched.h
+49
-0
porting/liteos_a_newlib/kernel/include/semaphore.h
porting/liteos_a_newlib/kernel/include/semaphore.h
+38
-0
porting/liteos_a_newlib/kernel/include/signal.h
porting/liteos_a_newlib/kernel/include/signal.h
+66
-0
porting/liteos_a_newlib/kernel/include/string.h
porting/liteos_a_newlib/kernel/include/string.h
+45
-0
porting/liteos_a_newlib/kernel/include/sys/_pthreadtypes.h
porting/liteos_a_newlib/kernel/include/sys/_pthreadtypes.h
+84
-0
porting/liteos_a_newlib/kernel/include/sys/features.h
porting/liteos_a_newlib/kernel/include/sys/features.h
+63
-0
porting/liteos_a_newlib/kernel/include/sys/ioctl.h
porting/liteos_a_newlib/kernel/include/sys/ioctl.h
+125
-0
porting/liteos_a_newlib/kernel/include/sys/ipc.h
porting/liteos_a_newlib/kernel/include/sys/ipc.h
+38
-0
porting/liteos_a_newlib/kernel/include/sys/kstat.h
porting/liteos_a_newlib/kernel/include/sys/kstat.h
+21
-0
porting/liteos_a_newlib/kernel/include/sys/mman.h
porting/liteos_a_newlib/kernel/include/sys/mman.h
+143
-0
porting/liteos_a_newlib/kernel/include/sys/mount.h
porting/liteos_a_newlib/kernel/include/sys/mount.h
+74
-0
porting/liteos_a_newlib/kernel/include/sys/poll.h
porting/liteos_a_newlib/kernel/include/sys/poll.h
+2
-0
porting/liteos_a_newlib/kernel/include/sys/prctl.h
porting/liteos_a_newlib/kernel/include/sys/prctl.h
+167
-0
porting/liteos_a_newlib/kernel/include/sys/resource.h
porting/liteos_a_newlib/kernel/include/sys/resource.h
+77
-0
porting/liteos_a_newlib/kernel/include/sys/select.h
porting/liteos_a_newlib/kernel/include/sys/select.h
+46
-0
porting/liteos_a_newlib/kernel/include/sys/shm.h
porting/liteos_a_newlib/kernel/include/sys/shm.h
+64
-0
porting/liteos_a_newlib/kernel/include/sys/socket.h
porting/liteos_a_newlib/kernel/include/sys/socket.h
+402
-0
porting/liteos_a_newlib/kernel/include/sys/statfs.h
porting/liteos_a_newlib/kernel/include/sys/statfs.h
+38
-0
porting/liteos_a_newlib/kernel/include/sys/statvfs.h
porting/liteos_a_newlib/kernel/include/sys/statvfs.h
+53
-0
porting/liteos_a_newlib/kernel/include/sys/syscall.h
porting/liteos_a_newlib/kernel/include/sys/syscall.h
+6
-0
porting/liteos_a_newlib/kernel/include/sys/termios.h
porting/liteos_a_newlib/kernel/include/sys/termios.h
+43
-0
porting/liteos_a_newlib/kernel/include/sys/types.h
porting/liteos_a_newlib/kernel/include/sys/types.h
+68
-0
porting/liteos_a_newlib/kernel/include/sys/uio.h
porting/liteos_a_newlib/kernel/include/sys/uio.h
+37
-0
porting/liteos_a_newlib/kernel/include/sys/unistd.h
porting/liteos_a_newlib/kernel/include/sys/unistd.h
+38
-0
porting/liteos_a_newlib/kernel/include/sys/utsname.h
porting/liteos_a_newlib/kernel/include/sys/utsname.h
+30
-0
porting/liteos_a_newlib/kernel/include/sys/wait.h
porting/liteos_a_newlib/kernel/include/sys/wait.h
+20
-0
porting/liteos_a_newlib/kernel/include/syscall.h
porting/liteos_a_newlib/kernel/include/syscall.h
+1
-0
porting/liteos_a_newlib/kernel/include/sysinfo.h
porting/liteos_a_newlib/kernel/include/sysinfo.h
+30
-0
porting/liteos_a_newlib/kernel/include/time.h
porting/liteos_a_newlib/kernel/include/time.h
+61
-0
porting/liteos_a_newlib/kernel/newlib.gni
porting/liteos_a_newlib/kernel/newlib.gni
+38
-0
porting/liteos_a_newlib/kernel/src/assert.c
porting/liteos_a_newlib/kernel/src/assert.c
+40
-0
porting/liteos_a_newlib/kernel/src/fs.c
porting/liteos_a_newlib/kernel/src/fs.c
+129
-0
porting/liteos_a_newlib/kernel/src/malloc.c
porting/liteos_a_newlib/kernel/src/malloc.c
+103
-0
porting/liteos_a_newlib/kernel/src/other_adapt.c
porting/liteos_a_newlib/kernel/src/other_adapt.c
+49
-0
未找到文件。
porting/liteos_a_newlib/kernel/include/arpa/inet.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _ARPA_INET_H
#define _ARPA_INET_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <netinet/in.h>
uint32_t
htonl
(
uint32_t
);
uint16_t
htons
(
uint16_t
);
uint32_t
ntohl
(
uint32_t
);
uint16_t
ntohs
(
uint16_t
);
in_addr_t
inet_addr
(
const
char
*
);
in_addr_t
inet_network
(
const
char
*
);
char
*
inet_ntoa
(
struct
in_addr
);
int
inet_pton
(
int
,
const
char
*
__restrict
,
void
*
__restrict
);
const
char
*
inet_ntop
(
int
,
const
void
*
__restrict
,
char
*
__restrict
,
socklen_t
);
int
inet_aton
(
const
char
*
,
struct
in_addr
*
);
struct
in_addr
inet_makeaddr
(
in_addr_t
,
in_addr_t
);
in_addr_t
inet_lnaof
(
struct
in_addr
);
in_addr_t
inet_netof
(
struct
in_addr
);
#undef INET_ADDRSTRLEN
#undef INET6_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/assert.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_ASSERT_H
#define _ADAPT_ASSERT_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include_next <assert.h>
#define DEBUGASSERT(x) assert(x)
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/bits/ioctl.h
0 → 100644
浏览文件 @
8f2897e2
#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
#define _IOC_NONE 0U
#define _IOC_WRITE 1U
#define _IOC_READ 2U
#define _IOC_DIRBITS 2
#define _IOC_NRBITS 8
#define _IOC_TYPEBITS 8
#define _IOC_SIZEBITS 14
#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
#define _IOC_NRMASK ((1 << _IOC_NRBITS) - 1)
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS) - 1)
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS) - 1)
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS) - 1)
#define _IOC_NRSHIFT 0
#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
#define TCGETS 0x5401
#define TCSETS 0x5402
#define TCSETSW 0x5403
#define TCSETSF 0x5404
#define TCGETA 0x5405
#define TCSETA 0x5406
#define TCSETAW 0x5407
#define TCSETAF 0x5408
#define TCSBRK 0x5409
#define TCXONC 0x540A
#define TCFLSH 0x540B
#define TIOCEXCL 0x540C
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E
#define TIOCGPGRP 0x540F
#define TIOCSPGRP 0x5410
#define TIOCOUTQ 0x5411
#define TIOCSTI 0x5412
#define TIOCGWINSZ 0x5413
#define TIOCSWINSZ 0x5414
#define TIOCMGET 0x5415
#define TIOCMBIS 0x5416
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
#define FIONREAD 0x541B
#define TIOCINQ FIONREAD
#define TIOCLINUX 0x541C
#define TIOCCONS 0x541D
#define TIOCGSERIAL 0x541E
#define TIOCSSERIAL 0x541F
#define TIOCPKT 0x5420
#define FIONBIO 0x5421
#define TIOCNOTTY 0x5422
#define TIOCSETD 0x5423
#define TIOCGETD 0x5424
#define TCSBRKP 0x5425
#define TIOCSBRK 0x5427
#define TIOCCBRK 0x5428
#define TIOCGSID 0x5429
#define TIOCGRS485 0x542E
#define TIOCSRS485 0x542F
#define TIOCGPTN 0x80045430
#define TIOCSPTLCK 0x40045431
#define TIOCGDEV 0x80045432
#define TCGETX 0x5432
#define TCSETX 0x5433
#define TCSETXF 0x5434
#define TCSETXW 0x5435
#define TIOCSIG 0x40045436
#define TIOCVHANGUP 0x5437
#define TIOCGPKT 0x80045438
#define TIOCGPTLCK 0x80045439
#define TIOCGEXCL 0x80045440
#define TIOCGPTPEER 0x5441
#define TIOCGISO7816 0x80285442
#define TIOCSISO7816 0xc0285443
#define FIONCLEX 0x5450
#define FIOCLEX 0x5451
#define FIOASYNC 0x5452
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT 0x5458
#define TIOCSERGETLSR 0x5459
#define TIOCSERGETMULTI 0x545A
#define TIOCSERSETMULTI 0x545B
#define TIOCMIWAIT 0x545C
#define TIOCGICOUNT 0x545D
#define FIOQSIZE 0x5460
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
#define TIOCM_RTS 0x004
#define TIOCM_ST 0x008
#define TIOCM_SR 0x010
#define TIOCM_CTS 0x020
#define TIOCM_CAR 0x040
#define TIOCM_RNG 0x080
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
#define FIOSETOWN 0x8901
#define SIOCSPGRP 0x8902
#define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905
#if __LONG_MAX == 0x7fffffff
#define SIOCGSTAMP _IOR(0x89, 6, char[16])
#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
#else
#define SIOCGSTAMP 0x8906
#define SIOCGSTAMPNS 0x8907
#endif
#include <bits/ioctl_fix.h>
porting/liteos_a_newlib/kernel/include/bits/ioctl_fix.h
0 → 100644
浏览文件 @
8f2897e2
#undef FIOQSIZE
#define FIOQSIZE 0x545e
porting/liteos_a_newlib/kernel/include/bits/ipc.h
0 → 100644
浏览文件 @
8f2897e2
struct
ipc_perm
{
key_t
__ipc_perm_key
;
uid_t
uid
;
gid_t
gid
;
uid_t
cuid
;
gid_t
cgid
;
mode_t
mode
;
int
__ipc_perm_seq
;
long
__pad1
;
long
__pad2
;
};
porting/liteos_a_newlib/kernel/include/bits/ipcstat.h
0 → 100644
浏览文件 @
8f2897e2
#define IPC_STAT 2
porting/liteos_a_newlib/kernel/include/bits/mman.h
0 → 100644
浏览文件 @
8f2897e2
porting/liteos_a_newlib/kernel/include/bits/poll.h
0 → 100644
浏览文件 @
8f2897e2
porting/liteos_a_newlib/kernel/include/bits/shm.h
0 → 100644
浏览文件 @
8f2897e2
#define SHMLBA 4096
#define shmid_ds shmid64_ds
struct
shmid_ds
{
struct
ipc_perm
shm_perm
;
size_t
shm_segsz
;
unsigned
long
__shm_atime_lo
;
unsigned
long
__shm_atime_hi
;
unsigned
long
__shm_dtime_lo
;
unsigned
long
__shm_dtime_hi
;
unsigned
long
__shm_ctime_lo
;
unsigned
long
__shm_ctime_hi
;
pid_t
shm_cpid
;
pid_t
shm_lpid
;
unsigned
long
shm_nattch
;
unsigned
long
__pad1
;
unsigned
long
__pad2
;
unsigned
long
__pad3
;
time_t
shm_atime
;
time_t
shm_dtime
;
time_t
shm_ctime
;
};
struct
shminfo
{
unsigned
long
shmmax
,
shmmin
,
shmmni
,
shmseg
,
shmall
;
};
struct
shm_info
{
int
used_ids
;
unsigned
long
shm_tot
,
shm_rss
,
shm_swp
;
unsigned
long
swap_attempts
,
swap_successes
;
};
porting/liteos_a_newlib/kernel/include/bits/socket.h
0 → 100644
浏览文件 @
8f2897e2
porting/liteos_a_newlib/kernel/include/bits/statfs.h
0 → 100644
浏览文件 @
8f2897e2
struct
statfs
{
unsigned
long
f_type
,
f_bsize
;
fsblkcnt_t
f_blocks
,
f_bfree
,
f_bavail
;
fsfilcnt_t
f_files
,
f_ffree
;
fsid_t
f_fsid
;
unsigned
long
f_namelen
,
f_frsize
,
f_flags
,
f_spare
[
4
];
};
porting/liteos_a_newlib/kernel/include/bits/syscall.h
0 → 100644
浏览文件 @
8f2897e2
/**
* @defgroup syscall syscall
* @defgroup syscall system call ID definitions
* @ingroup syscall
*/
#ifndef _SYSCALL_SYSCALL_H
#define _SYSCALL_SYSCALL_H
#define ARG_NUM_0 0
#define ARG_NUM_1 1
#define ARG_NUM_2 2
#define ARG_NUM_3 3
#define ARG_NUM_4 4
#define ARG_NUM_5 5
#define ARG_NUM_6 6
#define ARG_NUM_7 7
#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
#define __NR_write 4
#define __NR_open 5
#define __NR_close 6
#define __NR_creat 8
#define __NR_link 9
#define __NR_unlink 10
#define __NR_execve 11
#define __NR_chdir 12
#define __NR_mknod 14
#define __NR_chmod 15
#define __NR_lchown 16
#define __NR_lseek 19
#define __NR_getpid 20
#define __NR_mount 21
#define __NR_umount 22
#define __NR_setuid 23
#define __NR_getuid 24
#define __NR_ptrace 26
#define __NR_pause 29
#define __NR_access 33
#define __NR_nice 34
#define __NR_sync 36
#define __NR_kill 37
#define __NR_rename 38
#define __NR_mkdir 39
#define __NR_rmdir 40
#define __NR_dup 41
#define __NR_pipe 42
#define __NR_times 43
#define __NR_brk 45
#define __NR_setgid 46
#define __NR_getgid 47
#define __NR_geteuid 49
#define __NR_getegid 50
#define __NR_acct 51
#define __NR_umount2 52
#define __NR_ioctl 54
#define __NR_fcntl 55
#define __NR_setpgid 57
#define __NR_umask 60
#define __NR_chroot 61
#define __NR_ustat 62
#define __NR_dup2 63
#define __NR_getppid 64
#define __NR_getpgrp 65
#define __NR_setsid 66
#define __NR_sigaction 67
#define __NR_setreuid 70
#define __NR_setregid 71
#define __NR_sigsuspend 72
#define __NR_sigpending 73
#define __NR_sethostname 74
#define __NR_setrlimit 75
#define __NR_getrusage 77
#define __NR_gettimeofday_time32 78
#define __NR_settimeofday_time32 79
#define __NR_getgroups 80
#define __NR_setgroups 81
#define __NR_symlink 83
#define __NR_readlink 85
#define __NR_uselib 86
#define __NR_swapon 87
#define __NR_reboot 88
#define __NR_munmap 91
#define __NR_truncate 92
#define __NR_ftruncate 93
#define __NR_fchmod 94
#define __NR_fchown 95
#define __NR_getpriority 96
#define __NR_setpriority 97
#define __NR_statfs 99
#define __NR_fstatfs 100
#define __NR_syslog 103
#define __NR_setitimer 104
#define __NR_getitimer 105
#define __NR_stat 106
#define __NR_lstat 107
#define __NR_fstat 108
#define __NR_vhangup 111
#define __NR_wait4 114
#define __NR_swapoff 115
#define __NR_sysinfo 116
#define __NR_fsync 118
#define __NR_sigreturn 119
#define __NR_clone 120
#define __NR_setdomainname 121
#define __NR_uname 122
#define __NR_adjtimex 124
#define __NR_mprotect 125
#define __NR_sigprocmask 126
#define __NR_init_module 128
#define __NR_delete_module 129
#define __NR_quotactl 131
#define __NR_getpgid 132
#define __NR_fchdir 133
#define __NR_bdflush 134
#define __NR_sysfs 135
#define __NR_personality 136
#define __NR_setfsuid 138
#define __NR_setfsgid 139
#define __NR__llseek 140
#define __NR_getdents 141
#define __NR__newselect 142
#define __NR_flock 143
#define __NR_msync 144
#define __NR_readv 145
#define __NR_writev 146
#define __NR_getsid 147
#define __NR_fdatasync 148
#define __NR__sysctl 149
#define __NR_mlock 150
#define __NR_munlock 151
#define __NR_mlockall 152
#define __NR_munlockall 153
#define __NR_sched_setparam 154
#define __NR_sched_getparam 155
#define __NR_sched_setscheduler 156
#define __NR_sched_getscheduler 157
#define __NR_sched_yield 158
#define __NR_sched_get_priority_max 159
#define __NR_sched_get_priority_min 160
#define __NR_sched_rr_get_interval 161
#define __NR_nanosleep 162
#define __NR_mremap 163
#define __NR_setresuid 164
#define __NR_getresuid 165
#define __NR_poll 168
#define __NR_nfsservctl 169
#define __NR_setresgid 170
#define __NR_getresgid 171
#define __NR_prctl 172
#define __NR_rt_sigreturn 173
#define __NR_rt_sigaction 174
#define __NR_rt_sigprocmask 175
#define __NR_rt_sigpending 176
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread64 180
#define __NR_pwrite64 181
#define __NR_chown 182
#define __NR_getcwd 183
#define __NR_capget 184
#define __NR_capset 185
#define __NR_sigaltstack 186
#define __NR_sendfile 187
#define __NR_vfork 190
#define __NR_ugetrlimit 191
#define __NR_mmap2 192
#define __NR_truncate64 193
#define __NR_ftruncate64 194
#define __NR_stat64 195
#define __NR_lstat64 196
#define __NR_fstat64 197
#define __NR_lchown32 198
#define __NR_getuid32 199
#define __NR_getgid32 200
#define __NR_geteuid32 201
#define __NR_getegid32 202
#define __NR_setreuid32 203
#define __NR_setregid32 204
#define __NR_getgroups32 205
#define __NR_setgroups32 206
#define __NR_fchown32 207
#define __NR_setresuid32 208
#define __NR_getresuid32 209
#define __NR_setresgid32 210
#define __NR_getresgid32 211
#define __NR_chown32 212
#define __NR_setuid32 213
#define __NR_setgid32 214
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
#define __NR_getdents64 217
#define __NR_pivot_root 218
#define __NR_mincore 219
#define __NR_madvise 220
#define __NR_fcntl64 221
#define __NR_gettid 224
#define __NR_readahead 225
#define __NR_setxattr 226
#define __NR_lsetxattr 227
#define __NR_fsetxattr 228
#define __NR_getxattr 229
#define __NR_lgetxattr 230
#define __NR_fgetxattr 231
#define __NR_listxattr 232
#define __NR_llistxattr 233
#define __NR_flistxattr 234
#define __NR_removexattr 235
#define __NR_lremovexattr 236
#define __NR_fremovexattr 237
#define __NR_tkill 238
#define __NR_sendfile64 239
#define __NR_futex 240
#define __NR_sched_setaffinity 241
#define __NR_sched_getaffinity 242
#define __NR_io_setup 243
#define __NR_io_destroy 244
#define __NR_io_getevents 245
#define __NR_io_submit 246
#define __NR_io_cancel 247
#define __NR_exit_group 248
#define __NR_lookup_dcookie 249
#define __NR_epoll_create 250
#define __NR_epoll_ctl 251
#define __NR_epoll_wait 252
#define __NR_remap_file_pages 253
#define __NR_set_thread_area 254
#define __NR_get_thread_area 255
#define __NR_set_tid_address 256
#define __NR_timer_create 257
#define __NR_timer_settime32 258
#define __NR_timer_gettime32 259
#define __NR_timer_getoverrun 260
#define __NR_timer_delete 261
#define __NR_clock_settime32 262
#define __NR_clock_gettime32 263
#define __NR_clock_getres_time32 264
#define __NR_clock_nanosleep_time32 265
#define __NR_statfs64 266
#define __NR_fstatfs64 267
#define __NR_tgkill 268
#define __NR_utimes 269
#define __NR_fadvise64_64 270
#define __NR_arm_fadvise64_64 270
#define __NR_pciconfig_iobase 271
#define __NR_pciconfig_read 272
#define __NR_pciconfig_write 273
#define __NR_mq_open 274
#define __NR_mq_unlink 275
#define __NR_mq_timedsend 276
#define __NR_mq_timedreceive 277
#define __NR_mq_notify 278
#define __NR_mq_getsetattr 279
#define __NR_waitid 280
#define __NR_socket 281
#define __NR_bind 282
#define __NR_connect 283
#define __NR_listen 284
#define __NR_accept 285
#define __NR_getsockname 286
#define __NR_getpeername 287
#define __NR_socketpair 288
#define __NR_send 289
#define __NR_sendto 290
#define __NR_recv 291
#define __NR_recvfrom 292
#define __NR_shutdown 293
#define __NR_setsockopt 294
#define __NR_getsockopt 295
#define __NR_sendmsg 296
#define __NR_recvmsg 297
#define __NR_semop 298
#define __NR_semget 299
#define __NR_semctl 300
#define __NR_msgsnd 301
#define __NR_msgrcv 302
#define __NR_msgget 303
#define __NR_msgctl 304
#define __NR_shmat 305
#define __NR_shmdt 306
#define __NR_shmget 307
#define __NR_shmctl 308
#define __NR_add_key 309
#define __NR_request_key 310
#define __NR_keyctl 311
#define __NR_semtimedop 312
#define __NR_vserver 313
#define __NR_ioprio_set 314
#define __NR_ioprio_get 315
#define __NR_inotify_init 316
#define __NR_inotify_add_watch 317
#define __NR_inotify_rm_watch 318
#define __NR_mbind 319
#define __NR_get_mempolicy 320
#define __NR_set_mempolicy 321
#define __NR_openat 322
#define __NR_mkdirat 323
#define __NR_mknodat 324
#define __NR_fchownat 325
#define __NR_futimesat 326
#define __NR_fstatat64 327
#define __NR_unlinkat 328
#define __NR_renameat 329
#define __NR_linkat 330
#define __NR_symlinkat 331
#define __NR_readlinkat 332
#define __NR_fchmodat 333
#define __NR_faccessat 334
#define __NR_pselect6 335
#define __NR_ppoll 336
#define __NR_unshare 337
#define __NR_set_robust_list 338
#define __NR_get_robust_list 339
#define __NR_splice 340
#define __NR_sync_file_range2 341
#define __NR_arm_sync_file_range 341
#define __NR_tee 342
#define __NR_vmsplice 343
#define __NR_move_pages 344
#define __NR_getcpu 345
#define __NR_epoll_pwait 346
#define __NR_kexec_load 347
#define __NR_utimensat 348
#define __NR_signalfd 349
#define __NR_timerfd_create 350
#define __NR_eventfd 351
#define __NR_fallocate 352
#define __NR_timerfd_settime32 353
#define __NR_timerfd_gettime32 354
#define __NR_signalfd4 355
#define __NR_eventfd2 356
#define __NR_epoll_create1 357
#define __NR_dup3 358
#define __NR_pipe2 359
#define __NR_inotify_init1 360
#define __NR_preadv 361
#define __NR_pwritev 362
#define __NR_rt_tgsigqueueinfo 363
#define __NR_perf_event_open 364
#define __NR_recvmmsg 365
#define __NR_accept4 366
#define __NR_fanotify_init 367
#define __NR_fanotify_mark 368
#define __NR_prlimit64 369
#define __NR_name_to_handle_at 370
#define __NR_open_by_handle_at 371
#define __NR_clock_adjtime 372
#define __NR_syncfs 373
#define __NR_sendmmsg 374
#define __NR_setns 375
#define __NR_process_vm_readv 376
#define __NR_process_vm_writev 377
#define __NR_kcmp 378
#define __NR_finit_module 379
#define __NR_sched_setattr 380
#define __NR_sched_getattr 381
#define __NR_renameat2 382
#define __NR_seccomp 383
#define __NR_getrandom 384
#define __NR_memfd_create 385
#define __NR_bpf 386
#define __NR_execveat 387
#define __NR_userfaultfd 388
#define __NR_membarrier 389
#define __NR_mlock2 390
#define __NR_copy_file_range 391
#define __NR_preadv2 392
#define __NR_pwritev2 393
#define __NR_pkey_mprotect 394
#define __NR_pkey_alloc 395
#define __NR_pkey_free 396
#define __NR_statx 397
#define __NR_rseq 398
#define __NR_io_pgetevents 399
#define __NR_migrate_pages 400
#define __NR_kexec_file_load 401
#define __NR_pidfd_send_signal 424
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define __NR_pidfd_open 434
#define __NR_clone3 435
/* OHOS customized syscalls, not compatible with ARM EABI */
#define __NR_OHOS_BEGIN 500
#define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0)
#define __NR_pthread_join (__NR_OHOS_BEGIN + 1)
#define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2)
#define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3)
#define __NR_processcreat (__NR_OHOS_BEGIN + 4)
#define __NR_processtart (__NR_OHOS_BEGIN + 5)
#define __NR_printf (__NR_OHOS_BEGIN + 6)
#define __NR_dumpmemory (__NR_OHOS_BEGIN + 13)
#define __NR_mkfifo (__NR_OHOS_BEGIN + 14)
#define __NR_mqclose (__NR_OHOS_BEGIN + 15)
#define __NR_realpath (__NR_OHOS_BEGIN + 16)
#define __NR_format (__NR_OHOS_BEGIN + 17)
#define __NR_shellexec (__NR_OHOS_BEGIN + 18)
#define __NR_ohoscapget (__NR_OHOS_BEGIN + 19)
#define __NR_ohoscapset (__NR_OHOS_BEGIN + 20)
#define __NR_sysconf (__NR_OHOS_BEGIN + 21)
#define __NR_syscallend (__NR_OHOS_BEGIN + 22)
#define __ARM_NR_breakpoint 0x0f0001
#define __ARM_NR_cacheflush 0x0f0002
#define __ARM_NR_usr26 0x0f0003
#define __ARM_NR_usr32 0x0f0004
#define __ARM_NR_set_tls 0x0f0005
#define __ARM_NR_get_tls 0x0f0006
#endif // _SYSCALL_SYSCALL_H
porting/liteos_a_newlib/kernel/include/bits/termios.h
0 → 100644
浏览文件 @
8f2897e2
struct
termios
{
tcflag_t
c_iflag
;
tcflag_t
c_oflag
;
tcflag_t
c_cflag
;
tcflag_t
c_lflag
;
cc_t
c_line
;
cc_t
c_cc
[
NCCS
];
speed_t
__c_ispeed
;
speed_t
__c_ospeed
;
};
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VTIME 5
#define VMIN 6
#define VSWTC 7
#define VSTART 8
#define VSTOP 9
#define VSUSP 10
#define VEOL 11
#define VREPRINT 12
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
#define IGNBRK 0000001
#define BRKINT 0000002
#define IGNPAR 0000004
#define PARMRK 0000010
#define INPCK 0000020
#define ISTRIP 0000040
#define INLCR 0000100
#define IGNCR 0000200
#define ICRNL 0000400
#define IUCLC 0001000
#define IXON 0002000
#define IXANY 0004000
#define IXOFF 0010000
#define IMAXBEL 0020000
#define IUTF8 0040000
#define OPOST 0000001
#define OLCUC 0000002
#define ONLCR 0000004
#define OCRNL 0000010
#define ONOCR 0000020
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
#define CRDLY 0003000
#define CR0 0000000
#define CR1 0001000
#define CR2 0002000
#define CR3 0003000
#define TABDLY 0014000
#define TAB0 0000000
#define TAB1 0004000
#define TAB2 0010000
#define TAB3 0014000
#define BSDLY 0020000
#define BS0 0000000
#define BS1 0020000
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000
#define VT1 0040000
#define B0 0000000
#define B50 0000001
#define B75 0000002
#define B110 0000003
#define B134 0000004
#define B150 0000005
#define B200 0000006
#define B300 0000007
#define B600 0000010
#define B1200 0000011
#define B1800 0000012
#define B2400 0000013
#define B4800 0000014
#define B9600 0000015
#define B19200 0000016
#define B38400 0000017
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
#define B460800 0010004
#define B500000 0010005
#define B576000 0010006
#define B921600 0010007
#define B1000000 0010010
#define B1152000 0010011
#define B1500000 0010012
#define B2000000 0010013
#define B2500000 0010014
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
#define CSIZE 0000060
#define CS5 0000000
#define CS6 0000020
#define CS7 0000040
#define CS8 0000060
#define CSTOPB 0000100
#define CREAD 0000200
#define PARENB 0000400
#define PARODD 0001000
#define HUPCL 0002000
#define CLOCAL 0004000
#define ISIG 0000001
#define ICANON 0000002
#define ECHO 0000010
#define ECHOE 0000020
#define ECHOK 0000040
#define ECHONL 0000100
#define NOFLSH 0000200
#define TOSTOP 0000400
#define IEXTEN 0100000
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define EXTA 0000016
#define EXTB 0000017
#define CBAUD 0010017
#define CBAUDEX 0010000
#define CIBAUD 002003600000
#define CMSPAR 010000000000
#define CRTSCTS 020000000000
#define XCASE 0000004
#define ECHOCTL 0001000
#define ECHOPRT 0002000
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
#define EXTPROC 0200000
#define XTABS 0014000
#endif
porting/liteos_a_newlib/kernel/include/dirent.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_DIRENT_H
#define _ADAPT_DIRENT_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <limits.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#define d_fileno d_ino
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
#define IFTODT(x) ((x) >> 12 & 017)
#define DTTOIF(x) ((x) << 12)
#endif
typedef
struct
__dirstream
DIR
;
struct
dirent
{
ino_t
d_ino
;
off_t
d_off
;
unsigned
short
d_reclen
;
unsigned
char
d_type
;
char
d_name
[
NAME_MAX
];
};
int
closedir
(
DIR
*
dir
);
DIR
*
opendir
(
const
char
*
dirName
);
struct
dirent
*
readdir
(
DIR
*
dir
);
#ifdef __cplusplus
}
#endif
#endif
/* !_ADAPT_DIRENT_H */
porting/liteos_a_newlib/kernel/include/errno.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_ERRNO_H
#define _ADAPT_ERRNO_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#define ENOERR 0
#include_next <errno.h>
#define set_errno(err) do { if (err) { errno = (err); } } while(0)
#define get_errno() errno
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/fcntl.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_FCNTL_H
#define _ADAPT_FCNTL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define O_LARGEFILE 0400000
#define O_EXECVE 040000000
#define O_NDELAY O_NONBLOCK
#include_next <fcntl.h>
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/malloc.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_MALLOC_H
#define _ADAPT_MALLOC_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/types.h>
size_t
__wrap__malloc_usable_size_r
(
struct
_reent
*
reent
,
void
*
aptr
);
void
__wrap__free_r
(
struct
_reent
*
reent
,
void
*
aptr
);
void
*
__wrap__malloc_r
(
struct
_reent
*
reent
,
size_t
nbytes
);
void
*
__wrap__memalign_r
(
struct
_reent
*
reent
,
size_t
align
,
size_t
nbytes
);
void
*
__wrap__realloc_r
(
struct
_reent
*
reent
,
void
*
aptr
,
size_t
nbytes
);
void
*
zalloc
(
size_t
size
);
#include_next <malloc.h>
#ifdef __cplusplus
}
#endif
#endif
/* !_ADAPT_MALLOC_H */
porting/liteos_a_newlib/kernel/include/netinet/in.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <inttypes.h>
#include <sys/socket.h>
typedef
uint16_t
in_port_t
;
typedef
uint32_t
in_addr_t
;
struct
in_addr
{
in_addr_t
s_addr
;
};
struct
sockaddr_in
{
sa_family_t
sin_family
;
in_port_t
sin_port
;
struct
in_addr
sin_addr
;
uint8_t
sin_zero
[
8
];
};
struct
in6_addr
{
union
{
uint8_t
__s6_addr
[
16
];
uint16_t
__s6_addr16
[
8
];
uint32_t
__s6_addr32
[
4
];
}
__in6_union
;
};
#define s6_addr __in6_union.__s6_addr
#define s6_addr16 __in6_union.__s6_addr16
#define s6_addr32 __in6_union.__s6_addr32
struct
sockaddr_in6
{
sa_family_t
sin6_family
;
in_port_t
sin6_port
;
uint32_t
sin6_flowinfo
;
struct
in6_addr
sin6_addr
;
uint32_t
sin6_scope_id
;
};
struct
ipv6_mreq
{
struct
in6_addr
ipv6mr_multiaddr
;
unsigned
ipv6mr_interface
;
};
#define INADDR_ANY ((in_addr_t) 0x00000000)
#define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
#define INADDR_NONE ((in_addr_t) 0xffffffff)
#define INADDR_LOOPBACK ((in_addr_t) 0x7f000001)
#define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000)
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001)
#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002)
#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a)
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff)
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
extern
const
struct
in6_addr
in6addr_any
,
in6addr_loopback
;
#undef INET_ADDRSTRLEN
#undef INET6_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
uint32_t
htonl
(
uint32_t
);
uint16_t
htons
(
uint16_t
);
uint32_t
ntohl
(
uint32_t
);
uint16_t
ntohs
(
uint16_t
);
#define IPPORT_RESERVED 1024
#define IPPROTO_IP 0
#define IPPROTO_HOPOPTS 0
#define IPPROTO_ICMP 1
#define IPPROTO_IGMP 2
#define IPPROTO_IPIP 4
#define IPPROTO_TCP 6
#define IPPROTO_EGP 8
#define IPPROTO_PUP 12
#define IPPROTO_UDP 17
#define IPPROTO_IDP 22
#define IPPROTO_TP 29
#define IPPROTO_DCCP 33
#define IPPROTO_IPV6 41
#define IPPROTO_ROUTING 43
#define IPPROTO_FRAGMENT 44
#define IPPROTO_RSVP 46
#define IPPROTO_GRE 47
#define IPPROTO_ESP 50
#define IPPROTO_AH 51
#define IPPROTO_ICMPV6 58
#define IPPROTO_NONE 59
#define IPPROTO_DSTOPTS 60
#define IPPROTO_MTP 92
#define IPPROTO_BEETPH 94
#define IPPROTO_ENCAP 98
#define IPPROTO_PIM 103
#define IPPROTO_COMP 108
#define IPPROTO_SCTP 132
#define IPPROTO_MH 135
#define IPPROTO_UDPLITE 136
#define IPPROTO_MPLS 137
#define IPPROTO_RAW 255
#define IPPROTO_MAX 256
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && \
((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_LINKLOCAL(a) \
((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
#define IN6_IS_ADDR_SITELOCAL(a) \
((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
#define IN6_IS_ADDR_V4MAPPED(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
#define IN6_IS_ADDR_V4COMPAT(a) \
(((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
#define __ARE_4_EQUAL(a,b) \
(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
#define IN6_ARE_ADDR_EQUAL(a,b) \
__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX 128
#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
#define IN_LOOPBACKNET 127
#define IP_TOS 1
#define IP_TTL 2
#define IP_HDRINCL 3
#define IP_OPTIONS 4
#define IP_ROUTER_ALERT 5
#define IP_RECVOPTS 6
#define IP_RETOPTS 7
#define IP_PKTINFO 8
#define IP_PKTOPTIONS 9
#define IP_PMTUDISC 10
#define IP_MTU_DISCOVER 10
#define IP_RECVERR 11
#define IP_RECVTTL 12
#define IP_RECVTOS 13
#define IP_MTU 14
#define IP_FREEBIND 15
#define IP_IPSEC_POLICY 16
#define IP_XFRM_POLICY 17
#define IP_PASSSEC 18
#define IP_TRANSPARENT 19
#define IP_ORIGDSTADDR 20
#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
#define IP_MINTTL 21
#define IP_NODEFRAG 22
#define IP_CHECKSUM 23
#define IP_BIND_ADDRESS_NO_PORT 24
#define IP_RECVFRAGSIZE 25
#define IP_MULTICAST_IF 32
#define IP_MULTICAST_TTL 33
#define IP_MULTICAST_LOOP 34
#define IP_ADD_MEMBERSHIP 35
#define IP_DROP_MEMBERSHIP 36
#define IP_UNBLOCK_SOURCE 37
#define IP_BLOCK_SOURCE 38
#define IP_ADD_SOURCE_MEMBERSHIP 39
#define IP_DROP_SOURCE_MEMBERSHIP 40
#define IP_MSFILTER 41
#define IP_MULTICAST_ALL 49
#define IP_UNICAST_IF 50
#define IP_RECVRETOPTS IP_RETOPTS
#define IP_PMTUDISC_DONT 0
#define IP_PMTUDISC_WANT 1
#define IP_PMTUDISC_DO 2
#define IP_PMTUDISC_PROBE 3
#define IP_PMTUDISC_INTERFACE 4
#define IP_PMTUDISC_OMIT 5
#define IP_DEFAULT_MULTICAST_TTL 1
#define IP_DEFAULT_MULTICAST_LOOP 1
#define IP_MAX_MEMBERSHIPS 20
struct
ip_opts
{
struct
in_addr
ip_dst
;
char
ip_opts
[
40
];
};
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MCAST_JOIN_GROUP 42
#define MCAST_BLOCK_SOURCE 43
#define MCAST_UNBLOCK_SOURCE 44
#define MCAST_LEAVE_GROUP 45
#define MCAST_JOIN_SOURCE_GROUP 46
#define MCAST_LEAVE_SOURCE_GROUP 47
#define MCAST_MSFILTER 48
#define MCAST_EXCLUDE 0
#define MCAST_INCLUDE 1
struct
ip_mreq
{
struct
in_addr
imr_multiaddr
;
struct
in_addr
imr_interface
;
};
struct
ip_mreqn
{
struct
in_addr
imr_multiaddr
;
struct
in_addr
imr_address
;
int
imr_ifindex
;
};
struct
ip_mreq_source
{
struct
in_addr
imr_multiaddr
;
struct
in_addr
imr_interface
;
struct
in_addr
imr_sourceaddr
;
};
struct
ip_msfilter
{
struct
in_addr
imsf_multiaddr
;
struct
in_addr
imsf_interface
;
uint32_t
imsf_fmode
;
uint32_t
imsf_numsrc
;
struct
in_addr
imsf_slist
[
1
];
};
#define IP_MSFILTER_SIZE(numsrc) \
(sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
+ (numsrc) * sizeof(struct in_addr))
struct
group_req
{
uint32_t
gr_interface
;
struct
sockaddr_storage
gr_group
;
};
struct
group_source_req
{
uint32_t
gsr_interface
;
struct
sockaddr_storage
gsr_group
;
struct
sockaddr_storage
gsr_source
;
};
struct
group_filter
{
uint32_t
gf_interface
;
struct
sockaddr_storage
gf_group
;
uint32_t
gf_fmode
;
uint32_t
gf_numsrc
;
struct
sockaddr_storage
gf_slist
[
1
];
};
#define GROUP_FILTER_SIZE(numsrc) \
(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+ (numsrc) * sizeof(struct sockaddr_storage))
struct
in_pktinfo
{
int
ipi_ifindex
;
struct
in_addr
ipi_spec_dst
;
struct
in_addr
ipi_addr
;
};
struct
in6_pktinfo
{
struct
in6_addr
ipi6_addr
;
unsigned
ipi6_ifindex
;
};
struct
ip6_mtuinfo
{
struct
sockaddr_in6
ip6m_addr
;
uint32_t
ip6m_mtu
;
};
#endif
#define IPV6_ADDRFORM 1
#define IPV6_2292PKTINFO 2
#define IPV6_2292HOPOPTS 3
#define IPV6_2292DSTOPTS 4
#define IPV6_2292RTHDR 5
#define IPV6_2292PKTOPTIONS 6
#define IPV6_CHECKSUM 7
#define IPV6_2292HOPLIMIT 8
#define IPV6_NEXTHOP 9
#define IPV6_AUTHHDR 10
#define IPV6_UNICAST_HOPS 16
#define IPV6_MULTICAST_IF 17
#define IPV6_MULTICAST_HOPS 18
#define IPV6_MULTICAST_LOOP 19
#define IPV6_JOIN_GROUP 20
#define IPV6_LEAVE_GROUP 21
#define IPV6_ROUTER_ALERT 22
#define IPV6_MTU_DISCOVER 23
#define IPV6_MTU 24
#define IPV6_RECVERR 25
#define IPV6_V6ONLY 26
#define IPV6_JOIN_ANYCAST 27
#define IPV6_LEAVE_ANYCAST 28
#define IPV6_MULTICAST_ALL 29
#define IPV6_ROUTER_ALERT_ISOLATE 30
#define IPV6_IPSEC_POLICY 34
#define IPV6_XFRM_POLICY 35
#define IPV6_HDRINCL 36
#define IPV6_RECVPKTINFO 49
#define IPV6_PKTINFO 50
#define IPV6_RECVHOPLIMIT 51
#define IPV6_HOPLIMIT 52
#define IPV6_RECVHOPOPTS 53
#define IPV6_HOPOPTS 54
#define IPV6_RTHDRDSTOPTS 55
#define IPV6_RECVRTHDR 56
#define IPV6_RTHDR 57
#define IPV6_RECVDSTOPTS 58
#define IPV6_DSTOPTS 59
#define IPV6_RECVPATHMTU 60
#define IPV6_PATHMTU 61
#define IPV6_DONTFRAG 62
#define IPV6_RECVTCLASS 66
#define IPV6_TCLASS 67
#define IPV6_AUTOFLOWLABEL 70
#define IPV6_ADDR_PREFERENCES 72
#define IPV6_MINHOPCOUNT 73
#define IPV6_ORIGDSTADDR 74
#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
#define IPV6_TRANSPARENT 75
#define IPV6_UNICAST_IF 76
#define IPV6_RECVFRAGSIZE 77
#define IPV6_FREEBIND 78
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
#define IPV6_RXHOPOPTS IPV6_HOPOPTS
#define IPV6_RXDSTOPTS IPV6_DSTOPTS
#define IPV6_PMTUDISC_DONT 0
#define IPV6_PMTUDISC_WANT 1
#define IPV6_PMTUDISC_DO 2
#define IPV6_PMTUDISC_PROBE 3
#define IPV6_PMTUDISC_INTERFACE 4
#define IPV6_PMTUDISC_OMIT 5
#define IPV6_PREFER_SRC_TMP 0x0001
#define IPV6_PREFER_SRC_PUBLIC 0x0002
#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
#define IPV6_PREFER_SRC_COA 0x0004
#define IPV6_PREFER_SRC_HOME 0x0400
#define IPV6_PREFER_SRC_CGA 0x0008
#define IPV6_PREFER_SRC_NONCGA 0x0800
#define IPV6_RTHDR_LOOSE 0
#define IPV6_RTHDR_STRICT 1
#define IPV6_RTHDR_TYPE_0 0
#define __UAPI_DEF_IN_ADDR 0
#define __UAPI_DEF_IN_IPPROTO 0
#define __UAPI_DEF_IN_PKTINFO 0
#define __UAPI_DEF_IP_MREQ 0
#define __UAPI_DEF_SOCKADDR_IN 0
#define __UAPI_DEF_IN_CLASS 0
#define __UAPI_DEF_IN6_ADDR 0
#define __UAPI_DEF_IN6_ADDR_ALT 0
#define __UAPI_DEF_SOCKADDR_IN6 0
#define __UAPI_DEF_IPV6_MREQ 0
#define __UAPI_DEF_IPPROTO_V6 0
#define __UAPI_DEF_IPV6_OPTIONS 0
#define __UAPI_DEF_IN6_PKTINFO 0
#define __UAPI_DEF_IP6_MTUINFO 0
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/poll.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _POLL_H
#define _POLL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <bits/poll.h>
#define POLLIN 0x001
#define POLLPRI 0x002
#define POLLOUT 0x004
#define POLLERR 0x008
#define POLLHUP 0x010
#define POLLNVAL 0x020
#define POLLRDNORM 0x040
#define POLLRDBAND 0x080
#ifndef POLLWRNORM
#define POLLWRNORM 0x100
#define POLLWRBAND 0x200
#endif
#ifndef POLLMSG
#define POLLMSG 0x400
#define POLLRDHUP 0x2000
#endif
#define MAX_POLL_NFDS 0x1000
typedef
unsigned
int
pollevent_t
;
typedef
unsigned
long
nfds_t
;
struct
pollfd
{
int
fd
;
short
events
;
short
revents
;
};
int
poll
(
struct
pollfd
*
,
nfds_t
,
int
);
#ifdef _GNU_SOURCE
#include <sys/types.h>
int
ppoll
(
struct
pollfd
*
,
nfds_t
,
const
struct
timespec
*
,
const
sigset_t
*
);
#endif
#include "semaphore.h"
#include "linux/wait.h"
struct
tag_poll_wait_entry
;
typedef
struct
tag_poll_wait_entry
*
poll_wait_head
;
typedef
struct
tag_poll_table
{
poll_wait_head
wait
;
pollevent_t
key
;
}
poll_table
;
extern
void
notify_poll
(
wait_queue_head_t
*
wait_address
);
extern
void
notify_poll_with_key
(
wait_queue_head_t
*
wait_address
,
pollevent_t
key
);
#if _REDIR_TIME64
#ifdef _GNU_SOURCE
__REDIR
(
ppoll
,
__ppoll_time64
);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/pthread.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_PTHREAD_H
#define _ADAPT_PTHREAD_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "los_mux_pri.h"
#ifndef POSIX_MUTEX_DEFAULT_INHERIT
#define POSIX_MUTEX_DEFAULT_INHERIT 1
#endif
typedef
LosMuxAttr
pthread_mutexattr_t
;
typedef
LosMux
pthread_mutex_t
;
#define pthread_mutex OsMux
typedef
struct
pthread_cond
{
volatile
int
count
;
/**< The number of tasks blocked by condition */
EVENT_CB_S
event
;
/**< Event object*/
pthread_mutex_t
*
mutex
;
/**< Mutex locker for condition variable protection */
volatile
int
value
;
/**< Condition variable state value*/
}
pthread_cond_t
;
#define pthread_exit __pthread_exit_discard
#include_next <pthread.h>
#undef pthread_exit
#undef PTHREAD_MUTEX_INITIALIZER
void
pthread_exit
(
void
*
retVal
);
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#define PTHREAD_PRIO_NONE LOS_MUX_PRIO_NONE
#define PTHREAD_PRIO_INHERIT LOS_MUX_PRIO_INHERIT
#define PTHREAD_PRIO_PROTECT LOS_MUX_PRIO_PROTECT
#if defined POSIX_MUTEX_DEFAULT_INHERIT
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_INHERIT, OS_TASK_PRIORITY_LOWEST, PTHREAD_MUTEX_RECURSIVE_NP, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#define PTHREAD_MUTEX_INITIALIZER \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_INHERIT, OS_TASK_PRIORITY_LOWEST, 0, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#elif defined POSIX_MUTEX_DEFAULT_PROTECT
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_PROTECT, OS_TASK_PRIORITY_LOWEST, PTHREAD_MUTEX_RECURSIVE_NP, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#define PTHREAD_MUTEX_INITIALIZER \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_PROTECT, OS_TASK_PRIORITY_LOWEST, 0, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#else
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_NONE, OS_TASK_PRIORITY_LOWEST, PTHREAD_MUTEX_RECURSIVE_NP, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#define PTHREAD_MUTEX_INITIALIZER \
{ OS_MUX_MAGIC, { PTHREAD_PRIO_NONE, OS_TASK_PRIORITY_LOWEST, 0, 0 }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
{ (struct LOS_DL_LIST *)NULL, (struct LOS_DL_LIST *)NULL }, \
(VOID *)NULL, 0 }
#endif
int
pthread_attr_setaffinity_np
(
pthread_attr_t
*
,
size_t
,
const
cpu_set_t
*
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sched.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SCHED_H
#define _ADAPT_SCHED_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/types.h>
#include <sys/_pthreadtypes.h>
#define __CPU_BITTYPE unsigned long int
/* mandated by the kernel */
#include_next <sched.h>
int
sched_getaffinity
(
pid_t
,
size_t
,
cpu_set_t
*
);
int
sched_setaffinity
(
pid_t
,
size_t
,
const
cpu_set_t
*
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/semaphore.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SEMAPHORE_H
#define _SEMAPHORE_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#include <time.h>
#include <fcntl.h>
#include "los_sem_pri.h"
#define SEM_FAILED ((sem_t *)0)
typedef
struct
posix_sem
{
LosSemCB
*
sem
;
}
sem_t
;
int
sem_close
(
sem_t
*
);
int
sem_destroy
(
sem_t
*
);
int
sem_getvalue
(
sem_t
*
__restrict
,
int
*
__restrict
);
int
sem_init
(
sem_t
*
,
int
,
unsigned
);
sem_t
*
sem_open
(
const
char
*
,
int
,
...);
int
sem_post
(
sem_t
*
);
int
sem_timedwait
(
sem_t
*
__restrict
,
const
struct
timespec
*
__restrict
);
int
sem_trywait
(
sem_t
*
);
int
sem_unlink
(
const
char
*
);
int
sem_wait
(
sem_t
*
);
#if _REDIR_TIME64
__REDIR
(
sem_timedwait
,
__sem_timedwait_time64
);
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/signal.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _ADAPT_SIGNAL_H
#define _ADAPT_SIGNAL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#define siginfo_t __siginfo_t_discard
#include <sys/signal.h>
#undef siginfo_t
#include_next <signal.h>
#define CLD_EXITED 1
#define CLD_KILLED 2
#define CLD_DUMPED 3
#define CLD_TRAPPED 4
#define CLD_STOPPED 5
#define CLD_CONTINUED 6
typedef
struct
{
int
si_signo
,
si_errno
,
si_code
;
union
{
char
__pad
[
128
-
2
*
sizeof
(
int
)
-
sizeof
(
long
)];
struct
{
union
{
struct
{
pid_t
si_pid
;
uid_t
si_uid
;
}
__piduid
;
struct
{
int
si_timerid
;
int
si_overrun
;
}
__timer
;
}
__first
;
union
{
union
sigval
si_value
;
struct
{
int
si_status
;
clock_t
si_utime
,
si_stime
;
}
__sigchld
;
}
__second
;
}
__si_common
;
}
__si_fields
;
}
siginfo_t
;
#define si_pid __si_fields.__si_common.__first.__piduid.si_pid
#define si_uid __si_fields.__si_common.__first.__piduid.si_uid
#define si_status __si_fields.__si_common.__second.__sigchld.si_status
#define si_utime __si_fields.__si_common.__second.__sigchld.si_utime
#define si_stime __si_fields.__si_common.__second.__sigchld.si_stime
#define si_value __si_fields.__si_common.__second.si_value
#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
#define _NSIG 65
#define SIGRTMIN 35
#define SIGRTMAX (_NSIG - 1)
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/string.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_STRING_H
#define _ADAPT_STRING_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define basename __basename__discard
#include_next <string.h>
#undef basename
char
*
basename
(
const
char
*
path
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/_pthreadtypes.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SYS_PTHREADTYPES_H
#define _ADAPT_SYS_PTHREADTYPES_H
#define pthread_attr_t __pthread_attr_t_discard
#define pthread_mutex_t __pthread_mutex_t_discard
#define pthread_mutexattr_t __pthread_mutexattr_t_discard
#define pthread_cond_t __pthread_cond_t_discard
#define pthread_condattr_t __pthread_condattr_t_discard
#define pthread_once_t __pthread_once_t_discard
#define pthread_barrierattr_t __pthread_barrierattr_t_discard
#include_next <sys/_pthreadtypes.h>
#undef pthread_attr_t
#undef pthread_mutex_t
#undef pthread_mutexattr_t
#undef pthread_cond_t
#undef pthread_condattr_t
#undef pthread_once_t
#undef pthread_barrierattr_t
#include "los_config.h"
#define CPU_SETSIZE 32
typedef
struct
cpu_set_t
{
unsigned
long
__bits
[
CPU_SETSIZE
/
(
8
*
sizeof
(
unsigned
long
int
))];
}
cpu_set_t
;
typedef
struct
{
unsigned
int
detachstate
;
unsigned
int
schedpolicy
;
struct
sched_param
schedparam
;
unsigned
int
inheritsched
;
unsigned
int
scope
;
unsigned
int
stackaddr_set
;
void
*
stackaddr
;
unsigned
int
stacksize_set
;
size_t
stacksize
;
#ifdef LOSCFG_KERNEL_SMP
cpu_set_t
cpuset
;
#endif
}
pthread_attr_t
;
typedef
int
pthread_once_t
;
typedef
struct
{
int
clock
;
}
pthread_condattr_t
;
typedef
struct
{
unsigned
__attr
;
}
pthread_barrierattr_t
;
#define PTHREAD_KEYS_MAX 128
#define PTHREAD_STACK_MIN LOS_TASK_MIN_STACK_SIZE
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
#define PTHREAD_ATTR_STACKSIZE LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE
#define PTHREAD_PRIORITY_SCHEDULING SCHED_OTHER
#define PTHREAD_THREADS_MAX (LOSCFG_BASE_CORE_TSK_LIMIT + 1)
#define PTHREAD_MUTEXATTR_INITIALIZER { PTHREAD_MUTEX_RECURSIVE }
#endif
/* !_ADAPT_SYS_PTHREADTYPES_H */
porting/liteos_a_newlib/kernel/include/sys/features.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SYS_FEATURES_H
#define _ADAPT_SYS_FEATURES_H
#define _GNU_SOURCE
#define __USE_NEWLIB__
/* adapt time.h */
#define _POSIX_TIMERS 1
#define _POSIX_CPUTIME 1
#define _POSIX_THREAD_CPUTIME 1
#define _POSIX_MONOTONIC_CLOCK 1
#define _POSIX_CLOCK_SELECTION 1
#define _POSIX_GETGR_R_SIZE_MAX 0
#define _POSIX_GETPW_R_SIZE_MAX 0
#define _POSIX_CLK_TICK time((time_t *)NULL)
#define _POSIX_TIMER_MAX 32
#define _POSIX_VERSION 199309L
#define POSIX_VERSION _POSIX_VERSION
/* adapt sys/signal.h */
#define _POSIX_REALTIME_SIGNALS 1
/* adapt pthread */
#define _POSIX_THREADS 1
#define _POSIX_TIMEOUTS
#define _POSIX_THREAD_PRIORITY_SCHEDULING
#define _UNIX98_THREAD_MUTEX_ATTRIBUTES
#define _POSIX_THREAD_PROCESS_SHARED
#define __LINUX_ERRNO_EXTENSIONS__
#include_next <sys/features.h>
#endif
/* !_ADAPT_SYS_FEATURES_H */
porting/liteos_a_newlib/kernel/include/sys/ioctl.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/types.h>
#include <bits/ioctl.h>
#define N_TTY 0
#define N_SLIP 1
#define N_MOUSE 2
#define N_PPP 3
#define N_STRIP 4
#define N_AX25 5
#define N_X25 6
#define N_6PACK 7
#define N_MASC 8
#define N_R3964 9
#define N_PROFIBUS_FDL 10
#define N_IRDA 11
#define N_SMSBLOCK 12
#define N_HDLC 13
#define N_SYNC_PPP 14
#define N_HCI 15
#define N_GIGASET_M101 16
#define N_SLCAN 17
#define N_PPS 18
#define N_V253 19
#define N_CAIF 20
#define N_GSM0710 21
#define N_TI_WL 22
#define N_TRACESINK 23
#define N_TRACEROUTER 24
#define N_NCI 25
#define N_SPEAKUP 26
#define N_NULL 27
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32
#define TIOCPKT_IOCTL 64
#define TIOCSER_TEMT 1
struct
winsize
{
unsigned
short
ws_row
;
unsigned
short
ws_col
;
unsigned
short
ws_xpixel
;
unsigned
short
ws_ypixel
;
};
#define SIOCADDRT 0x890B
#define SIOCDELRT 0x890C
#define SIOCRTMSG 0x890D
#define SIOCGIFNAME 0x8910
#define SIOCSIFLINK 0x8911
#define SIOCGIFCONF 0x8912
#define SIOCGIFFLAGS 0x8913
#define SIOCSIFFLAGS 0x8914
#define SIOCGIFADDR 0x8915
#define SIOCSIFADDR 0x8916
#define SIOCGIFDSTADDR 0x8917
#define SIOCSIFDSTADDR 0x8918
#define SIOCGIFBRDADDR 0x8919
#define SIOCSIFBRDADDR 0x891a
#define SIOCGIFNETMASK 0x891b
#define SIOCSIFNETMASK 0x891c
#define SIOCGIFMETRIC 0x891d
#define SIOCSIFMETRIC 0x891e
#define SIOCGIFMEM 0x891f
#define SIOCSIFMEM 0x8920
#define SIOCGIFMTU 0x8921
#define SIOCSIFMTU 0x8922
#define SIOCSIFNAME 0x8923
#define SIOCSIFHWADDR 0x8924
#define SIOCGIFENCAP 0x8925
#define SIOCSIFENCAP 0x8926
#define SIOCGIFHWADDR 0x8927
#define SIOCGIFSLAVE 0x8929
#define SIOCSIFSLAVE 0x8930
#define SIOCADDMULTI 0x8931
#define SIOCDELMULTI 0x8932
#define SIOCGIFINDEX 0x8933
#define SIOGIFINDEX SIOCGIFINDEX
#define SIOCSIFPFLAGS 0x8934
#define SIOCGIFPFLAGS 0x8935
#define SIOCDIFADDR 0x8936
#define SIOCSIFHWBROADCAST 0x8937
#define SIOCGIFCOUNT 0x8938
#define SIOCGIFBR 0x8940
#define SIOCSIFBR 0x8941
#define SIOCGIFTXQLEN 0x8942
#define SIOCSIFTXQLEN 0x8943
#define SIOCDARP 0x8953
#define SIOCGARP 0x8954
#define SIOCSARP 0x8955
#define SIOCDRARP 0x8960
#define SIOCGRARP 0x8961
#define SIOCSRARP 0x8962
#define SIOCGIFMAP 0x8970
#define SIOCSIFMAP 0x8971
#define SIOCADDDLCI 0x8980
#define SIOCDELDLCI 0x8981
#define SIOCDEVPRIVATE 0x89F0
#define SIOCPROTOPRIVATE 0x89E0
int
ioctl
(
int
,
int
,
...);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/ipc.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_IPC_H
#define _SYS_IPC_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#define __ipc_perm_key __key
#define __ipc_perm_seq __seq
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __key key
#define __seq seq
#endif
#include <bits/ipc.h>
#include <bits/ipcstat.h>
#define IPC_CREAT 01000
#define IPC_EXCL 02000
#define IPC_NOWAIT 04000
#define IPC_RMID 0
#define IPC_SET 1
#define IPC_INFO 3
#define IPC_64 0x0100
#define IPC_PRIVATE ((key_t) 0)
key_t
ftok
(
const
char
*
,
int
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/kstat.h
0 → 100644
浏览文件 @
8f2897e2
struct
kstat
{
dev_t
st_dev
;
int
__st_dev_padding
;
long
__st_ino_truncated
;
mode_t
st_mode
;
nlink_t
st_nlink
;
uid_t
st_uid
;
gid_t
st_gid
;
dev_t
st_rdev
;
int
__st_rdev_padding
;
off_t
st_size
;
blksize_t
st_blksize
;
blkcnt_t
st_blocks
;
long
st_atime_sec
;
long
st_atime_nsec
;
long
st_mtime_sec
;
long
st_mtime_nsec
;
long
st_ctime_sec
;
long
st_ctime_nsec
;
ino_t
st_ino
;
};
porting/liteos_a_newlib/kernel/include/sys/mman.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_MMAN_H
#define _SYS_MMAN_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#define MAP_FAILED ((void *) -1)
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_SHARED_VALIDATE 0x03
#define MAP_SHARED_PRIVATE 0x03
#define MAP_TYPE 0x0f
#define MAP_FIXED 0x10
#define MAP_ANON 0x20
#define MAP_ANONYMOUS MAP_ANON
#define MAP_SUPPORT_MASK 0x23
#define MAP_NORESERVE 0x4000
#define MAP_GROWSDOWN 0x0100
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
#define MAP_POPULATE 0x8000
#define MAP_NONBLOCK 0x10000
#define MAP_STACK 0x20000
#define MAP_HUGETLB 0x40000
#define MAP_SYNC 0x80000
#define MAP_FIXED_NOREPLACE 0x100000
#define MAP_FILE 0
#define MAP_HUGE_SHIFT 26
#define MAP_HUGE_MASK 0x3f
#define MAP_HUGE_64KB (16 << 26)
#define MAP_HUGE_512KB (19 << 26)
#define MAP_HUGE_1MB (20 << 26)
#define MAP_HUGE_2MB (21 << 26)
#define MAP_HUGE_8MB (23 << 26)
#define MAP_HUGE_16MB (24 << 26)
#define MAP_HUGE_32MB (25 << 26)
#define MAP_HUGE_256MB (28 << 26)
#define MAP_HUGE_512MB (29 << 26)
#define MAP_HUGE_1GB (30 << 26)
#define MAP_HUGE_2GB (31 << 26)
#define MAP_HUGE_16GB (34U << 26)
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
#define PROT_EXEC 4
#define PROT_SUPPORT_MASK 7
#define PROT_GROWSDOWN 0x01000000
#define PROT_GROWSUP 0x02000000
#define MS_ASYNC 1
#define MS_INVALIDATE 2
#define MS_SYNC 4
#define MCL_CURRENT 1
#define MCL_FUTURE 2
#define MCL_ONFAULT 4
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define POSIX_MADV_SEQUENTIAL 2
#define POSIX_MADV_WILLNEED 3
#define POSIX_MADV_DONTNEED 4
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MADV_NORMAL 0
#define MADV_RANDOM 1
#define MADV_SEQUENTIAL 2
#define MADV_WILLNEED 3
#define MADV_DONTNEED 4
#define MADV_FREE 8
#define MADV_REMOVE 9
#define MADV_DONTFORK 10
#define MADV_DOFORK 11
#define MADV_MERGEABLE 12
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
#define MADV_DONTDUMP 16
#define MADV_DODUMP 17
#define MADV_WIPEONFORK 18
#define MADV_KEEPONFORK 19
#define MADV_COLD 20
#define MADV_PAGEOUT 21
#define MADV_HWPOISON 100
#define MADV_SOFT_OFFLINE 101
#endif
#ifdef _GNU_SOURCE
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define MLOCK_ONFAULT 0x01
#define MFD_CLOEXEC 0x0001U
#define MFD_ALLOW_SEALING 0x0002U
#define MFD_HUGETLB 0x0004U
#endif
#include <bits/mman.h>
void
*
mmap
(
void
*
,
size_t
,
int
,
int
,
int
,
off_t
);
int
munmap
(
void
*
,
size_t
);
int
mprotect
(
void
*
,
size_t
,
int
);
int
msync
(
void
*
,
size_t
,
int
);
int
posix_madvise
(
void
*
,
size_t
,
int
);
int
mlock
(
const
void
*
,
size_t
);
int
munlock
(
const
void
*
,
size_t
);
int
mlockall
(
int
);
int
munlockall
(
void
);
#ifdef _GNU_SOURCE
void
*
mremap
(
void
*
,
size_t
,
size_t
,
int
,
...);
int
remap_file_pages
(
void
*
,
size_t
,
int
,
size_t
,
int
);
int
memfd_create
(
const
char
*
,
unsigned
);
int
mlock2
(
const
void
*
,
size_t
,
unsigned
);
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int
madvise
(
void
*
,
size_t
,
int
);
int
mincore
(
void
*
,
size_t
,
unsigned
char
*
);
#endif
int
shm_open
(
const
char
*
,
int
,
mode_t
);
int
shm_unlink
(
const
char
*
);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define mmap64 mmap
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/mount.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_MOUNT_H
#define _SYS_MOUNT_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/ioctl.h>
#define BLKROSET _IO(0x12, 93)
#define BLKROGET _IO(0x12, 94)
#define BLKRRPART _IO(0x12, 95)
#define BLKGETSIZE _IO(0x12, 96)
#define BLKFLSBUF _IO(0x12, 97)
#define BLKRASET _IO(0x12, 98)
#define BLKRAGET _IO(0x12, 99)
#define BLKFRASET _IO(0x12,100)
#define BLKFRAGET _IO(0x12,101)
#define BLKSECTSET _IO(0x12,102)
#define BLKSECTGET _IO(0x12,103)
#define BLKSSZGET _IO(0x12,104)
#define BLKBSZGET _IOR(0x12,112,size_t)
#define BLKBSZSET _IOW(0x12,113,size_t)
#define BLKGETSIZE64 _IOR(0x12,114,size_t)
#define MS_RDONLY 1
#define MS_NOSUID 2
#define MS_NODEV 4
#define MS_NOEXEC 8
#define MS_SYNCHRONOUS 16
#define MS_REMOUNT 32
#define MS_MANDLOCK 64
#define MS_DIRSYNC 128
#define MS_NOATIME 1024
#define MS_NODIRATIME 2048
#define MS_BIND 4096
#define MS_MOVE 8192
#define MS_REC 16384
#define MS_SILENT 32768
#define MS_POSIXACL (1<<16)
#define MS_UNBINDABLE (1<<17)
#define MS_PRIVATE (1<<18)
#define MS_SLAVE (1<<19)
#define MS_SHARED (1<<20)
#define MS_RELATIME (1<<21)
#define MS_KERNMOUNT (1<<22)
#define MS_I_VERSION (1<<23)
#define MS_STRICTATIME (1<<24)
#define MS_LAZYTIME (1<<25)
#define MS_NOREMOTELOCK (1<<27)
#define MS_NOSEC (1<<28)
#define MS_BORN (1<<29)
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1U<<31)
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
#define MS_MGC_VAL 0xc0ed0000
#define MS_MGC_MSK 0xffff0000
#define MNT_FORCE 1
#define MNT_DETACH 2
#define MNT_EXPIRE 4
#define UMOUNT_NOFOLLOW 8
int
mount
(
const
char
*
,
const
char
*
,
const
char
*
,
unsigned
long
,
const
void
*
);
int
umount
(
const
char
*
);
int
umount2
(
const
char
*
,
int
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/poll.h
0 → 100644
浏览文件 @
8f2897e2
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
#include <poll.h>
porting/liteos_a_newlib/kernel/include/sys/prctl.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_PRCTL_H
#define _SYS_PRCTL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdint.h>
#define PR_SET_PDEATHSIG 1
#define PR_GET_PDEATHSIG 2
#define PR_GET_DUMPABLE 3
#define PR_SET_DUMPABLE 4
#define PR_GET_UNALIGN 5
#define PR_SET_UNALIGN 6
#define PR_UNALIGN_NOPRINT 1
#define PR_UNALIGN_SIGBUS 2
#define PR_GET_KEEPCAPS 7
#define PR_SET_KEEPCAPS 8
#define PR_GET_FPEMU 9
#define PR_SET_FPEMU 10
#define PR_FPEMU_NOPRINT 1
#define PR_FPEMU_SIGFPE 2
#define PR_GET_FPEXC 11
#define PR_SET_FPEXC 12
#define PR_FP_EXC_SW_ENABLE 0x80
#define PR_FP_EXC_DIV 0x010000
#define PR_FP_EXC_OVF 0x020000
#define PR_FP_EXC_UND 0x040000
#define PR_FP_EXC_RES 0x080000
#define PR_FP_EXC_INV 0x100000
#define PR_FP_EXC_DISABLED 0
#define PR_FP_EXC_NONRECOV 1
#define PR_FP_EXC_ASYNC 2
#define PR_FP_EXC_PRECISE 3
#define PR_GET_TIMING 13
#define PR_SET_TIMING 14
#define PR_TIMING_STATISTICAL 0
#define PR_TIMING_TIMESTAMP 1
#define PR_SET_NAME 15
#define PR_GET_NAME 16
#define PR_GET_ENDIAN 19
#define PR_SET_ENDIAN 20
#define PR_ENDIAN_BIG 0
#define PR_ENDIAN_LITTLE 1
#define PR_ENDIAN_PPC_LITTLE 2
#define PR_GET_SECCOMP 21
#define PR_SET_SECCOMP 22
#define PR_CAPBSET_READ 23
#define PR_CAPBSET_DROP 24
#define PR_GET_TSC 25
#define PR_SET_TSC 26
#define PR_TSC_ENABLE 1
#define PR_TSC_SIGSEGV 2
#define PR_GET_SECUREBITS 27
#define PR_SET_SECUREBITS 28
#define PR_SET_TIMERSLACK 29
#define PR_GET_TIMERSLACK 30
#define PR_TASK_PERF_EVENTS_DISABLE 31
#define PR_TASK_PERF_EVENTS_ENABLE 32
#define PR_MCE_KILL 33
#define PR_MCE_KILL_CLEAR 0
#define PR_MCE_KILL_SET 1
#define PR_MCE_KILL_LATE 0
#define PR_MCE_KILL_EARLY 1
#define PR_MCE_KILL_DEFAULT 2
#define PR_MCE_KILL_GET 34
#define PR_SET_MM 35
#define PR_SET_MM_START_CODE 1
#define PR_SET_MM_END_CODE 2
#define PR_SET_MM_START_DATA 3
#define PR_SET_MM_END_DATA 4
#define PR_SET_MM_START_STACK 5
#define PR_SET_MM_START_BRK 6
#define PR_SET_MM_BRK 7
#define PR_SET_MM_ARG_START 8
#define PR_SET_MM_ARG_END 9
#define PR_SET_MM_ENV_START 10
#define PR_SET_MM_ENV_END 11
#define PR_SET_MM_AUXV 12
#define PR_SET_MM_EXE_FILE 13
#define PR_SET_MM_MAP 14
#define PR_SET_MM_MAP_SIZE 15
struct
prctl_mm_map
{
uint64_t
start_code
;
uint64_t
end_code
;
uint64_t
start_data
;
uint64_t
end_data
;
uint64_t
start_brk
;
uint64_t
brk
;
uint64_t
start_stack
;
uint64_t
arg_start
;
uint64_t
arg_end
;
uint64_t
env_start
;
uint64_t
env_end
;
uint64_t
*
auxv
;
uint32_t
auxv_size
;
uint32_t
exe_fd
;
};
#define PR_SET_PTRACER 0x59616d61
#define PR_SET_PTRACER_ANY (-1UL)
#define PR_SET_CHILD_SUBREAPER 36
#define PR_GET_CHILD_SUBREAPER 37
#define PR_SET_NO_NEW_PRIVS 38
#define PR_GET_NO_NEW_PRIVS 39
#define PR_GET_TID_ADDRESS 40
#define PR_SET_THP_DISABLE 41
#define PR_GET_THP_DISABLE 42
#define PR_MPX_ENABLE_MANAGEMENT 43
#define PR_MPX_DISABLE_MANAGEMENT 44
#define PR_SET_FP_MODE 45
#define PR_GET_FP_MODE 46
#define PR_FP_MODE_FR (1 << 0)
#define PR_FP_MODE_FRE (1 << 1)
#define PR_CAP_AMBIENT 47
#define PR_CAP_AMBIENT_IS_SET 1
#define PR_CAP_AMBIENT_RAISE 2
#define PR_CAP_AMBIENT_LOWER 3
#define PR_CAP_AMBIENT_CLEAR_ALL 4
#define PR_SVE_SET_VL 50
#define PR_SVE_SET_VL_ONEXEC (1 << 18)
#define PR_SVE_GET_VL 51
#define PR_SVE_VL_LEN_MASK 0xffff
#define PR_SVE_VL_INHERIT (1 << 17)
#define PR_GET_SPECULATION_CTRL 52
#define PR_SET_SPECULATION_CTRL 53
#define PR_SPEC_STORE_BYPASS 0
#define PR_SPEC_INDIRECT_BRANCH 1
#define PR_SPEC_NOT_AFFECTED 0
#define PR_SPEC_PRCTL (1UL << 0)
#define PR_SPEC_ENABLE (1UL << 1)
#define PR_SPEC_DISABLE (1UL << 2)
#define PR_SPEC_FORCE_DISABLE (1UL << 3)
#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
#define PR_PAC_RESET_KEYS 54
#define PR_PAC_APIAKEY (1UL << 0)
#define PR_PAC_APIBKEY (1UL << 1)
#define PR_PAC_APDAKEY (1UL << 2)
#define PR_PAC_APDBKEY (1UL << 3)
#define PR_PAC_APGAKEY (1UL << 4)
#define PR_SET_TAGGED_ADDR_CTRL 55
#define PR_GET_TAGGED_ADDR_CTRL 56
#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
int
prctl
(
int
,
...);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/resource.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SYS_RESOURCE_H
#define _ADAPT_SYS_RESOURCE_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/time.h>
#include <sys/types.h>
#include_next <sys/resource.h>
typedef
unsigned
long
long
rlim_t
;
struct
rlimit
{
rlim_t
rlim_cur
;
rlim_t
rlim_max
;
};
#define RLIMIT_CPU 0
#define RLIMIT_FSIZE 1
#define RLIMIT_DATA 2
#define RLIMIT_STACK 3
#define RLIMIT_CORE 4
#ifndef RLIMIT_RSS
#define RLIMIT_RSS 5
#define RLIMIT_NPROC 6
#define RLIMIT_NOFILE 7
#define RLIMIT_MEMLOCK 8
#define RLIMIT_AS 9
#endif
#define RLIMIT_LOCKS 10
#define RLIMIT_SIGPENDING 11
#define RLIMIT_MSGQUEUE 12
#define RLIMIT_NICE 13
#define RLIMIT_RTPRIO 14
#define RLIMIT_RTTIME 15
#define RLIMIT_NLIMITS 16
#define RLIM_NLIMITS RLIMIT_NLIMITS
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/select.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SYS_SELECT_H
#define _ADAPT_SYS_SELECT_H
#ifdef LOSCFG_FS_VFS
#include "vfs_config.h"
#else
#undef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include_next <sys/select.h>
#endif //_ADAPT_SYS_SELECT_H
porting/liteos_a_newlib/kernel/include/sys/shm.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_SHM_H
#define _SYS_SHM_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#include <sys/ipc.h>
#ifdef _GNU_SOURCE
#define __used_ids used_ids
#define __swap_attempts swap_attempts
#define __swap_successes swap_successes
#endif
#include <bits/shm.h>
#define SHM_R 0400
#define SHM_W 0200
#define SHM_RDONLY 010000
#define SHM_RND 020000
#define SHM_REMAP 040000
#define SHM_EXEC 0100000
#define SHM_LOCK 11
#define SHM_UNLOCK 12
#define SHM_STAT (13 | (IPC_STAT & 0x100))
#define SHM_INFO 14
#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
#define SHM_DEST 01000
#define SHM_LOCKED 02000
#define SHM_HUGETLB 04000
#define SHM_NORESERVE 010000
#define SHM_HUGE_SHIFT 26
#define SHM_HUGE_MASK 0x3f
#define SHM_HUGE_64KB (16 << 26)
#define SHM_HUGE_512KB (19 << 26)
#define SHM_HUGE_1MB (20 << 26)
#define SHM_HUGE_2MB (21 << 26)
#define SHM_HUGE_8MB (23 << 26)
#define SHM_HUGE_16MB (24 << 26)
#define SHM_HUGE_32MB (25 << 26)
#define SHM_HUGE_256MB (28 << 26)
#define SHM_HUGE_512MB (29 << 26)
#define SHM_HUGE_1GB (30 << 26)
#define SHM_HUGE_2GB (31 << 26)
#define SHM_HUGE_16GB (34U << 26)
typedef
unsigned
long
shmatt_t
;
void
*
shmat
(
int
,
const
void
*
,
int
);
int
shmctl
(
int
,
int
,
struct
shmid_ds
*
);
int
shmdt
(
const
void
*
);
int
shmget
(
key_t
,
size_t
,
int
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/socket.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#include <bits/socket.h>
struct
msghdr
{
void
*
msg_name
;
socklen_t
msg_namelen
;
struct
iovec
*
msg_iov
;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int
__pad1
;
#endif
int
msg_iovlen
;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int
__pad1
;
#endif
void
*
msg_control
;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int
__pad2
;
#endif
socklen_t
msg_controllen
;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int
__pad2
;
#endif
int
msg_flags
;
};
struct
cmsghdr
{
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int
__pad1
;
#endif
socklen_t
cmsg_len
;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int
__pad1
;
#endif
int
cmsg_level
;
int
cmsg_type
;
};
#ifdef _GNU_SOURCE
struct
ucred
{
pid_t
pid
;
uid_t
uid
;
gid_t
gid
;
};
struct
mmsghdr
{
struct
msghdr
msg_hdr
;
unsigned
int
msg_len
;
};
struct
timespec
;
int
sendmmsg
(
int
,
struct
mmsghdr
*
,
unsigned
int
,
unsigned
int
);
int
recvmmsg
(
int
,
struct
mmsghdr
*
,
unsigned
int
,
unsigned
int
,
struct
timespec
*
);
#endif
struct
linger
{
int
l_onoff
;
int
l_linger
;
};
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#ifndef SOCK_STREAM
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#endif
#define SOCK_RAW 3
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
#define SOCK_DCCP 6
#define SOCK_PACKET 10
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 02000000
#define SOCK_NONBLOCK 04000
#endif
#define PF_UNSPEC 0
#define PF_LOCAL 1
#define PF_UNIX PF_LOCAL
#define PF_FILE PF_LOCAL
#define PF_INET 2
#define PF_AX25 3
#define PF_IPX 4
#define PF_APPLETALK 5
#define PF_NETROM 6
#define PF_BRIDGE 7
#define PF_ATMPVC 8
#define PF_X25 9
#define PF_INET6 10
#define PF_ROSE 11
#define PF_DECnet 12
#define PF_NETBEUI 13
#define PF_SECURITY 14
#define PF_KEY 15
#define PF_NETLINK 16
#define PF_ROUTE PF_NETLINK
#define PF_PACKET 17
#define PF_ASH 18
#define PF_ECONET 19
#define PF_ATMSVC 20
#define PF_RDS 21
#define PF_SNA 22
#define PF_IRDA 23
#define PF_PPPOX 24
#define PF_WANPIPE 25
#define PF_LLC 26
#define PF_IB 27
#define PF_MPLS 28
#define PF_CAN 29
#define PF_TIPC 30
#define PF_BLUETOOTH 31
#define PF_IUCV 32
#define PF_RXRPC 33
#define PF_ISDN 34
#define PF_PHONET 35
#define PF_IEEE802154 36
#define PF_CAIF 37
#define PF_ALG 38
#define PF_NFC 39
#define PF_VSOCK 40
#define PF_KCM 41
#define PF_QIPCRTR 42
#define PF_SMC 43
#define PF_XDP 44
#define PF_MAX 45
#define AF_UNSPEC PF_UNSPEC
#define AF_LOCAL PF_LOCAL
#define AF_UNIX AF_LOCAL
#define AF_FILE AF_LOCAL
#define AF_INET PF_INET
#define AF_AX25 PF_AX25
#define AF_IPX PF_IPX
#define AF_APPLETALK PF_APPLETALK
#define AF_NETROM PF_NETROM
#define AF_BRIDGE PF_BRIDGE
#define AF_ATMPVC PF_ATMPVC
#define AF_X25 PF_X25
#define AF_INET6 PF_INET6
#define AF_ROSE PF_ROSE
#define AF_DECnet PF_DECnet
#define AF_NETBEUI PF_NETBEUI
#define AF_SECURITY PF_SECURITY
#define AF_KEY PF_KEY
#define AF_NETLINK PF_NETLINK
#define AF_ROUTE PF_ROUTE
#define AF_PACKET PF_PACKET
#define AF_ASH PF_ASH
#define AF_ECONET PF_ECONET
#define AF_ATMSVC PF_ATMSVC
#define AF_RDS PF_RDS
#define AF_SNA PF_SNA
#define AF_IRDA PF_IRDA
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
#define AF_LLC PF_LLC
#define AF_IB PF_IB
#define AF_MPLS PF_MPLS
#define AF_CAN PF_CAN
#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
#define AF_ISDN PF_ISDN
#define AF_PHONET PF_PHONET
#define AF_IEEE802154 PF_IEEE802154
#define AF_CAIF PF_CAIF
#define AF_ALG PF_ALG
#define AF_NFC PF_NFC
#define AF_VSOCK PF_VSOCK
#define AF_KCM PF_KCM
#define AF_QIPCRTR PF_QIPCRTR
#define AF_SMC PF_SMC
#define AF_XDP PF_XDP
#define AF_MAX PF_MAX
#ifndef SO_DEBUG
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
#define SO_REUSEPORT 15
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_PROTOCOL 38
#define SO_DOMAIN 39
#endif
#ifndef SO_RCVTIMEO
#if __LONG_MAX == 0x7fffffff
#define SO_RCVTIMEO 66
#define SO_SNDTIMEO 67
#else
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
#endif
#endif
#ifndef SO_TIMESTAMP
#if __LONG_MAX == 0x7fffffff
#define SO_TIMESTAMP 63
#define SO_TIMESTAMPNS 64
#define SO_TIMESTAMPING 65
#else
#define SO_TIMESTAMP 29
#define SO_TIMESTAMPNS 35
#define SO_TIMESTAMPING 37
#endif
#endif
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
#define SO_GET_FILTER SO_ATTACH_FILTER
#define SO_PEERNAME 28
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PASSSEC 34
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
#define SO_MARK 36
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 40
#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS
#define SO_PEEK_OFF 42
#define SO_NOFCS 43
#define SO_LOCK_FILTER 44
#define SO_SELECT_ERR_QUEUE 45
#define SO_BUSY_POLL 46
#define SO_MAX_PACING_RATE 47
#define SO_BPF_EXTENSIONS 48
#define SO_INCOMING_CPU 49
#define SO_ATTACH_BPF 50
#define SO_DETACH_BPF SO_DETACH_FILTER
#define SO_ATTACH_REUSEPORT_CBPF 51
#define SO_ATTACH_REUSEPORT_EBPF 52
#define SO_CNX_ADVICE 53
#define SCM_TIMESTAMPING_OPT_STATS 54
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#define SO_COOKIE 57
#define SCM_TIMESTAMPING_PKTINFO 58
#define SO_PEERGROUPS 59
#define SO_ZEROCOPY 60
#define SO_TXTIME 61
#define SCM_TXTIME SO_TXTIME
#define SO_BINDTOIFINDEX 62
#define SO_DETACH_REUSEPORT_BPF 68
#ifndef SOL_SOCKET
#define SOL_SOCKET 1
#endif
#define SOL_IP 0
#define SOL_IPV6 41
#define SOL_ICMPV6 58
#define SOL_RAW 255
#define SOL_DECNET 261
#define SOL_X25 262
#define SOL_PACKET 263
#define SOL_ATM 264
#define SOL_AAL 265
#define SOL_IRDA 266
#define SOL_NETBEUI 267
#define SOL_LLC 268
#define SOL_DCCP 269
#define SOL_NETLINK 270
#define SOL_TIPC 271
#define SOL_RXRPC 272
#define SOL_PPPOL2TP 273
#define SOL_BLUETOOTH 274
#define SOL_PNPIPE 275
#define SOL_RDS 276
#define SOL_IUCV 277
#define SOL_CAIF 278
#define SOL_ALG 279
#define SOL_NFC 280
#define SOL_KCM 281
#define SOL_TLS 282
#define SOL_XDP 283
#define SOMAXCONN 128
#define MSG_OOB 0x0001
#define MSG_PEEK 0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_CTRUNC 0x0008
#define MSG_PROXY 0x0010
#define MSG_TRUNC 0x0020
#define MSG_DONTWAIT 0x0040
#define MSG_EOR 0x0080
#define MSG_WAITALL 0x0100
#define MSG_FIN 0x0200
#define MSG_SYN 0x0400
#define MSG_CONFIRM 0x0800
#define MSG_RST 0x1000
#define MSG_ERRQUEUE 0x2000
#define MSG_NOSIGNAL 0x4000
#define MSG_MORE 0x8000
#define MSG_WAITFORONE 0x10000
#define MSG_BATCH 0x40000
#define MSG_ZEROCOPY 0x4000000
#define MSG_FASTOPEN 0x20000000
#define MSG_CMSG_CLOEXEC 0x40000000
#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
#define SCM_RIGHTS 0x01
#define SCM_CREDENTIALS 0x02
struct
sockaddr
{
sa_family_t
sa_family
;
char
sa_data
[
14
];
};
struct
sockaddr_storage
{
sa_family_t
ss_family
;
char
__ss_padding
[
128
-
sizeof
(
long
)
-
sizeof
(
sa_family_t
)];
unsigned
long
__ss_align
;
};
int
socket
(
int
,
int
,
int
);
int
socketpair
(
int
,
int
,
int
,
int
[
2
]);
int
shutdown
(
int
,
int
);
int
bind
(
int
,
const
struct
sockaddr
*
,
socklen_t
);
int
connect
(
int
,
const
struct
sockaddr
*
,
socklen_t
);
int
listen
(
int
,
int
);
int
accept
(
int
,
struct
sockaddr
*
__restrict
,
socklen_t
*
__restrict
);
int
accept4
(
int
,
struct
sockaddr
*
__restrict
,
socklen_t
*
__restrict
,
int
);
int
getsockname
(
int
,
struct
sockaddr
*
__restrict
,
socklen_t
*
__restrict
);
int
getpeername
(
int
,
struct
sockaddr
*
__restrict
,
socklen_t
*
__restrict
);
ssize_t
send
(
int
,
const
void
*
,
size_t
,
int
);
ssize_t
recv
(
int
,
void
*
,
size_t
,
int
);
ssize_t
sendto
(
int
,
const
void
*
,
size_t
,
int
,
const
struct
sockaddr
*
,
socklen_t
);
ssize_t
recvfrom
(
int
,
void
*
__restrict
,
size_t
,
int
,
struct
sockaddr
*
__restrict
,
socklen_t
*
__restrict
);
ssize_t
sendmsg
(
int
,
const
struct
msghdr
*
,
int
);
ssize_t
recvmsg
(
int
,
struct
msghdr
*
,
int
);
int
getsockopt
(
int
,
int
,
int
,
void
*
__restrict
,
socklen_t
*
__restrict
);
int
setsockopt
(
int
,
int
,
int
,
const
void
*
,
socklen_t
);
int
sockatmark
(
int
);
#if _REDIR_TIME64
#ifdef _GNU_SOURCE
__REDIR
(
recvmmsg
,
__recvmmsg_time64
);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/statfs.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_STATFS_H
#define _SYS_STATFS_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/statvfs.h>
typedef
struct
__fsid_t
{
int
__val
[
2
];
}
fsid_t
;
#include <bits/statfs.h>
int
statfs
(
const
char
*
,
struct
statfs
*
);
int
fstatfs
(
int
,
struct
statfs
*
);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define statfs64 statfs
#define fstatfs64 fstatfs
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#endif
#define TMPFS_MAGIC 0x01021994
#define MSDOS_SUPER_MAGIC 0x4d44
#define NFS_SUPER_MAGIC 0x6969
#define PROCFS_MAGIC 0x434f5250
#define JFFS2_SUPER_MAGIC 0x72b6
#define ZPFS_MAGIC 0xa000e93
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/statvfs.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_STATVFS_H
#define _SYS_STATVFS_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
struct
statvfs
{
unsigned
long
f_bsize
,
f_frsize
;
fsblkcnt_t
f_blocks
,
f_bfree
,
f_bavail
;
fsfilcnt_t
f_files
,
f_ffree
,
f_favail
;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned
long
f_fsid
;
unsigned
:
8
*
(
2
*
sizeof
(
int
)
-
sizeof
(
long
));
#else
unsigned
:
8
*
(
2
*
sizeof
(
int
)
-
sizeof
(
long
));
unsigned
long
f_fsid
;
#endif
unsigned
long
f_flag
,
f_namemax
;
int
__reserved
[
6
];
};
int
statvfs
(
const
char
*
__restrict
,
struct
statvfs
*
__restrict
);
int
fstatvfs
(
int
,
struct
statvfs
*
);
#define ST_RDONLY 1
#define ST_NOSUID 2
#define ST_NODEV 4
#define ST_NOEXEC 8
#define ST_SYNCHRONOUS 16
#define ST_MANDLOCK 64
#define ST_WRITE 128
#define ST_APPEND 256
#define ST_IMMUTABLE 512
#define ST_NOATIME 1024
#define ST_NODIRATIME 2048
#define ST_RELATIME 4096
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define statvfs64 statvfs
#define fstatvfs64 fstatvfs
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/syscall.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H
#include <bits/syscall.h>
#endif
porting/liteos_a_newlib/kernel/include/sys/termios.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _TERMIOS_H
#define _TERMIOS_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
typedef
unsigned
char
cc_t
;
typedef
unsigned
int
speed_t
;
typedef
unsigned
int
tcflag_t
;
#define NCCS 32
#include <bits/termios.h>
speed_t
cfgetospeed
(
const
struct
termios
*
);
speed_t
cfgetispeed
(
const
struct
termios
*
);
int
cfsetospeed
(
struct
termios
*
,
speed_t
);
int
cfsetispeed
(
struct
termios
*
,
speed_t
);
int
tcgetattr
(
int
,
struct
termios
*
);
int
tcsetattr
(
int
,
int
,
const
struct
termios
*
);
int
tcsendbreak
(
int
,
int
);
int
tcdrain
(
int
);
int
tcflush
(
int
,
int
);
int
tcflow
(
int
,
int
);
pid_t
tcgetsid
(
int
);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
void
cfmakeraw
(
struct
termios
*
);
int
cfsetspeed
(
struct
termios
*
,
speed_t
);
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/types.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_SYS_TYPES_H
#define _ADAPT_SYS_TYPES_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "los_config.h"
#include_next <sys/types.h>
#define LOGIN_NAME_MAX 256
#define DELAYTIMER_MAX 32
#define SYS_CLK_TCK _POSIX_CLK_TICK
#define SIGQUEUE_MAX 32
#define SSIZE_MAX LONG_MAX
#define STREAM_MAX 8
#define SEM_NSEMS_MAX LOSCFG_BASE_IPC_SEM_LIMIT
#define SEM_VALUE_MAX OS_SEM_COUNT_MAX
#define RTSIG_MAX 8
#define TIMERS LOSCFG_BASE_CORE_SWTMR
#define MQ_OPEN_MAX _LITEOS_MQ_OPEN_MAX
#define TTY_NAME_MAX 32
#define TZNAME_MAX 6
#define TIMER_MAX _POSIX_TIMER_MAX
#define GETPW_R_SIZE_MAX _POSIX_GETPW_R_SIZE_MAX
#define GETGR_R_SIZE_MAX _POSIX_GETGR_R_SIZE_MAX
#define _LITEOS_MQ_OPEN_MAX LOSCFG_BASE_IPC_QUEUE_LIMIT
#define roundup(n,d) (howmany(n,d)*(d))
typedef
off_t
off64_t
;
typedef
unsigned
short
sa_family_t
;
typedef
unsigned
socklen_t
;
struct
iovec
{
void
*
iov_base
;
size_t
iov_len
;
};
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/uio.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_UIO_H
#define _SYS_UIO_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include <sys/types.h>
#define UIO_MAXIOV 1024
ssize_t
vfs_readv
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
off_t
*
offset
);
ssize_t
vfs_writev
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
off_t
*
offset
);
ssize_t
readv
(
int
,
const
struct
iovec
*
,
int
);
ssize_t
writev
(
int
,
const
struct
iovec
*
,
int
);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
ssize_t
preadv
(
int
,
const
struct
iovec
*
,
int
,
off_t
);
ssize_t
pwritev
(
int
,
const
struct
iovec
*
,
int
,
off_t
);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define preadv64 preadv
#define pwritev64 pwritev
#endif
#endif
#ifdef _GNU_SOURCE
ssize_t
process_vm_writev
(
pid_t
,
const
struct
iovec
*
,
unsigned
long
,
const
struct
iovec
*
,
unsigned
long
,
unsigned
long
);
ssize_t
process_vm_readv
(
pid_t
,
const
struct
iovec
*
,
unsigned
long
,
const
struct
iovec
*
,
unsigned
long
,
unsigned
long
);
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/unistd.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_UNISTD_H
#define _ADAPT_UNISTD_H
#define pause __pause_discard
#include_next <sys/unistd.h>
#undef pause
#endif
porting/liteos_a_newlib/kernel/include/sys/utsname.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define _GNU_SOURCE
#include <sys/features.h>
struct
utsname
{
char
sysname
[
65
];
char
nodename
[
65
];
char
release
[
65
];
char
version
[
65
];
char
machine
[
65
];
#ifdef _GNU_SOURCE
char
domainname
[
65
];
#else
char
__domainname
[
65
];
#endif
};
int
uname
(
struct
utsname
*
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/sys/wait.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _ADAPT_SYS_WAIT_H
#define _ADAPT_SYS_WAIT_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include_next <sys/wait.h>
typedef
enum
{
P_ALL
=
0
,
P_PID
=
1
,
P_PGID
=
2
,
P_PIDFD
=
3
}
idtype_t
;
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/syscall.h
0 → 100644
浏览文件 @
8f2897e2
#include <sys/syscall.h>
porting/liteos_a_newlib/kernel/include/sysinfo.h
0 → 100644
浏览文件 @
8f2897e2
#ifndef _SYS_SYSINFO_H
#define _SYS_SYSINFO_H
#ifdef __cplusplus
extern
"C"
{
#endif
struct
sysinfo
{
unsigned
long
uptime
;
unsigned
long
loads
[
3
];
unsigned
long
totalram
;
unsigned
long
freeram
;
unsigned
long
sharedram
;
unsigned
long
bufferram
;
unsigned
long
totalswap
;
unsigned
long
freeswap
;
unsigned
short
procs
,
pad
;
unsigned
long
totalhigh
;
unsigned
long
freehigh
;
unsigned
mem_unit
;
char
__reserved
[
256
];
};
int
sysinfo
(
struct
sysinfo
*
);
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/include/time.h
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ADAPT_TIME_H
#define _ADAPT_TIME_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <sys/features.h>
#include_next <time.h>
struct
timespec64
{
int64_t
tv_sec
;
int64_t
tv_nsec
;
};
struct
timeval64
{
int64_t
tv_sec
;
int64_t
tv_usec
;
};
#if !defined(__LP64__)
struct
itimerspec64
{
struct
timespec64
it_interval
;
struct
timespec64
it_value
;
};
#else
#define itimerspec64 itimerspec
#endif
#define CLOCK_SGI_CYCLE 10
#define CLOCK_TAI 11
#define MAX_CLOCKS 16
#ifdef __cplusplus
}
#endif
#endif
porting/liteos_a_newlib/kernel/newlib.gni
0 → 100644
浏览文件 @
8f2897e2
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MUSLPORTINGDIR = get_path_info(".", "abspath")
NEWLIB_ADAPT_INCLUDE_DIRS = [ "$MUSLPORTINGDIR/include" ]
NEWLIB_ADAPT_SRC_COMMON = [
"$MUSLPORTINGDIR/src/assert.c",
"$MUSLPORTINGDIR/src/malloc.c",
"$MUSLPORTINGDIR/src/fs.c",
"$MUSLPORTINGDIR/src/other_adapt.c",
]
porting/liteos_a_newlib/kernel/src/assert.c
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "assert.h"
#include "los_printf.h"
#include "los_exc.h"
void
__assert_fail
(
const
char
*
expr
,
const
char
*
file
,
int
line
,
const
char
*
func
)
{
PRINT_ERR
(
"%s:%d: %s: assertion
\"
%s
\"
failed"
,
file
,
line
,
func
,
expr
);
LOS_Panic
(
"__assert error:
\n
"
);
while
(
1
);
}
porting/liteos_a_newlib/kernel/src/fs.c
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_config.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#ifdef LOSCFG_FS_VFS
int
_open
(
const
char
*
path
,
int
oflag
,
...)
{
return
open
(
path
,
oflag
);
}
int
_close
(
int
fd
)
{
return
close
(
fd
);
}
ssize_t
_read
(
int
fd
,
void
*
buf
,
size_t
nbyte
)
{
return
read
(
fd
,
buf
,
nbyte
);
}
ssize_t
_write
(
int
fd
,
const
void
*
buf
,
size_t
nbyte
)
{
return
write
(
fd
,
buf
,
nbyte
);
}
int
_unlink
(
const
char
*
path
)
{
return
unlink
(
path
);
}
int
_fstat
(
int
fd
,
struct
stat
*
buf
)
{
return
fstat
(
fd
,
buf
);
}
int
_stat
(
const
char
*
path
,
struct
stat
*
buf
)
{
return
stat
(
path
,
buf
);
}
off_t
_lseek
(
int
fd
,
off_t
offset
,
int
whence
)
{
return
lseek
(
fd
,
offset
,
whence
);
}
int
__wrap__fseeko_r
(
struct
_reent
*
ptr
,
register
FILE
*
fp
,
_off_t
offset
,
int
whence
)
{
return
_lseek
(
fp
,
offset
,
whence
);
}
#else
/* #ifdef LOSCFG_FS_VFS */
int
_open
(
const
char
*
path
,
int
oflag
,
...)
{
return
-
1
;
}
int
_close
(
int
fd
)
{
return
-
1
;
}
ssize_t
_read
(
int
fd
,
void
*
buf
,
size_t
nbyte
)
{
return
-
1
;
}
ssize_t
_write
(
int
fd
,
const
void
*
buf
,
size_t
nbyte
)
{
return
-
1
;
}
int
_unlink
(
const
char
*
path
)
{
return
-
1
;
}
int
_fstat
(
int
fd
,
struct
stat
*
buf
)
{
return
-
1
;
}
int
_stat
(
const
char
*
path
,
struct
stat
*
buf
)
{
return
-
1
;
}
off_t
_lseek
(
int
fd
,
off_t
offset
,
int
whence
)
{
return
-
1
;
}
int
__wrap__fseeko_r
(
struct
_reent
*
ptr
,
register
FILE
*
fp
,
_off_t
offset
,
int
whence
)
{
return
-
1
;
}
#endif
porting/liteos_a_newlib/kernel/src/malloc.c
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "securec.h"
#include "los_config.h"
#include "los_memory.h"
#include <malloc.h>
void
__wrap__free_r
(
struct
_reent
*
reent
,
void
*
aptr
)
{
if
(
aptr
==
NULL
)
{
return
;
}
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
aptr
);
}
size_t
__wrap__malloc_usable_size_r
(
struct
_reent
*
reent
,
void
*
aptr
)
{
return
0
;
}
void
*
__wrap__malloc_r
(
struct
_reent
*
reent
,
size_t
nbytes
)
{
if
(
nbytes
==
0
)
{
return
NULL
;
}
return
LOS_MemAlloc
(
OS_SYS_MEM_ADDR
,
nbytes
);
}
void
*
__wrap__memalign_r
(
struct
_reent
*
reent
,
size_t
align
,
size_t
nbytes
)
{
if
(
nbytes
==
0
)
{
return
NULL
;
}
return
LOS_MemAllocAlign
(
OS_SYS_MEM_ADDR
,
nbytes
,
align
);
}
void
*
__wrap__realloc_r
(
struct
_reent
*
reent
,
void
*
aptr
,
size_t
nbytes
)
{
if
(
aptr
==
NULL
)
{
return
malloc
(
nbytes
);
}
if
(
nbytes
==
0
)
{
free
(
aptr
);
return
NULL
;
}
return
LOS_MemRealloc
(
OS_SYS_MEM_ADDR
,
aptr
,
nbytes
);
}
void
*
__wrap__calloc_r
(
struct
_reent
*
reent
,
size_t
nitems
,
size_t
size
)
{
size_t
real_size
;
void
*
ptr
=
NULL
;
if
(
nitems
==
0
||
size
==
0
)
{
return
NULL
;
}
real_size
=
(
size_t
)(
nitems
*
size
);
ptr
=
LOS_MemAlloc
(
OS_SYS_MEM_ADDR
,
real_size
);
if
(
ptr
!=
NULL
)
{
(
void
)
memset_s
(
ptr
,
real_size
,
0
,
real_size
);
}
return
ptr
;
}
void
*
_sbrk
(
intptr_t
__incr
)
{
return
NULL
;
}
porting/liteos_a_newlib/kernel/src/other_adapt.c
0 → 100644
浏览文件 @
8f2897e2
/*
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "los_config.h"
#include "los_process_pri.h"
int
_isatty
(
int
file
)
{
return
file
<=
2
;
}
int
_kill
(
int
i
,
int
j
)
{
return
0
;
}
int
_getpid
(
void
)
{
int
pid
=
(
int
)
OsGetKernelInitProcessID
();
return
pid
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录