From 179b111a50731ce9887e34eda56ee8b8596bc6f1 Mon Sep 17 00:00:00 2001 From: arvinzzz Date: Sat, 25 Feb 2023 17:40:13 +0800 Subject: [PATCH] feature: liteos_a kernel-libc update Signed-off-by: arvinzzz Change-Id: I0802aad810aa82a0e68553bfc3c563006c0d159f --- .../liteos_a_newlib/kernel/include/limits.h | 41 +++++++++++++++++++ .../kernel/include/netinet/in.h | 5 ++- .../liteos_a_newlib/kernel/include/sched.h | 4 +- .../liteos_a_newlib/kernel/include/sys/mman.h | 2 + .../kernel/include/sys/mount.h | 1 + .../kernel/include/sys/param.h | 37 +++++++++++++++++ .../kernel/include/sys/prctl.h | 19 +++++++++ .../kernel/include/sys/socket.h | 2 + .../kernel/include/sys/syslimits.h | 41 +++++++++++++++++++ .../liteos_a_newlib/kernel/include/sys/uio.h | 2 +- .../liteos_a_newlib/kernel/src/other_adapt.c | 2 +- 11 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 porting/liteos_a_newlib/kernel/include/limits.h create mode 100644 porting/liteos_a_newlib/kernel/include/sys/param.h create mode 100644 porting/liteos_a_newlib/kernel/include/sys/syslimits.h diff --git a/porting/liteos_a_newlib/kernel/include/limits.h b/porting/liteos_a_newlib/kernel/include/limits.h new file mode 100644 index 00000000..12b1bd72 --- /dev/null +++ b/porting/liteos_a_newlib/kernel/include/limits.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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_LIMITS_H +#define _ADAPT_LIMITS_H + +#include +#include_next + +#define SSIZE_MAX LONG_MAX + +#define PTHREAD_KEYS_MAX 128 + +#endif /* !_ADAPT_LIMITS_H */ diff --git a/porting/liteos_a_newlib/kernel/include/netinet/in.h b/porting/liteos_a_newlib/kernel/include/netinet/in.h index a4d056cc..09117ab5 100644 --- a/porting/liteos_a_newlib/kernel/include/netinet/in.h +++ b/porting/liteos_a_newlib/kernel/include/netinet/in.h @@ -103,8 +103,10 @@ uint16_t ntohs(uint16_t); #define IPPROTO_MH 135 #define IPPROTO_UDPLITE 136 #define IPPROTO_MPLS 137 +#define IPPROTO_ETHERNET 143 #define IPPROTO_RAW 255 -#define IPPROTO_MAX 256 +#define IPPROTO_MPTCP 262 +#define IPPROTO_MAX 263 #define IN6_IS_ADDR_UNSPECIFIED(a) \ (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ @@ -202,6 +204,7 @@ uint16_t ntohs(uint16_t); #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 #define IP_RECVFRAGSIZE 25 +#define IP_RECVERR_RFC4884 26 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 diff --git a/porting/liteos_a_newlib/kernel/include/sched.h b/porting/liteos_a_newlib/kernel/include/sched.h index d74cb799..96aa4bf9 100644 --- a/porting/liteos_a_newlib/kernel/include/sched.h +++ b/porting/liteos_a_newlib/kernel/include/sched.h @@ -40,8 +40,8 @@ extern "C" { #define __CPU_BITTYPE unsigned long int /* mandated by the kernel */ #include_next -int sched_getaffinity (pid_t, size_t, cpu_set_t *); -int sched_setaffinity (pid_t, size_t, const cpu_set_t *); +int sched_getaffinity(pid_t, size_t, cpu_set_t *); +int sched_setaffinity(pid_t, size_t, const cpu_set_t *); #ifdef __cplusplus } diff --git a/porting/liteos_a_newlib/kernel/include/sys/mman.h b/porting/liteos_a_newlib/kernel/include/sys/mman.h index a292874f..4c5db05a 100644 --- a/porting/liteos_a_newlib/kernel/include/sys/mman.h +++ b/porting/liteos_a_newlib/kernel/include/sys/mman.h @@ -33,6 +33,7 @@ extern "C" { #define MAP_HUGE_SHIFT 26 #define MAP_HUGE_MASK 0x3f +#define MAP_HUGE_16KB (14 << 26) #define MAP_HUGE_64KB (16 << 26) #define MAP_HUGE_512KB (19 << 26) #define MAP_HUGE_1MB (20 << 26) @@ -95,6 +96,7 @@ extern "C" { #ifdef _GNU_SOURCE #define MREMAP_MAYMOVE 1 #define MREMAP_FIXED 2 +#define MREMAP_DONTUNMAP 4 #define MLOCK_ONFAULT 0x01 diff --git a/porting/liteos_a_newlib/kernel/include/sys/mount.h b/porting/liteos_a_newlib/kernel/include/sys/mount.h index 57a89c09..09bd6e9d 100644 --- a/porting/liteos_a_newlib/kernel/include/sys/mount.h +++ b/porting/liteos_a_newlib/kernel/include/sys/mount.h @@ -31,6 +31,7 @@ extern "C" { #define MS_REMOUNT 32 #define MS_MANDLOCK 64 #define MS_DIRSYNC 128 +#define MS_NOSYMFOLLOW 256 #define MS_NOATIME 1024 #define MS_NODIRATIME 2048 #define MS_BIND 4096 diff --git a/porting/liteos_a_newlib/kernel/include/sys/param.h b/porting/liteos_a_newlib/kernel/include/sys/param.h new file mode 100644 index 00000000..eba43c84 --- /dev/null +++ b/porting/liteos_a_newlib/kernel/include/sys/param.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023-2023 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_SYSPARAM_H +#define _ADAPT_SYSPARAM_H + +#include +#include_next + +#endif /* !_ADAPT_SYSPARAM_H */ \ No newline at end of file diff --git a/porting/liteos_a_newlib/kernel/include/sys/prctl.h b/porting/liteos_a_newlib/kernel/include/sys/prctl.h index d9c846e9..087a75c9 100644 --- a/porting/liteos_a_newlib/kernel/include/sys/prctl.h +++ b/porting/liteos_a_newlib/kernel/include/sys/prctl.h @@ -157,6 +157,25 @@ struct prctl_mm_map { #define PR_SET_TAGGED_ADDR_CTRL 55 #define PR_GET_TAGGED_ADDR_CTRL 56 #define PR_TAGGED_ADDR_ENABLE (1UL << 0) +#define PR_MTE_TCF_SHIFT 1 +#define PR_MTE_TCF_NONE (0UL << 1) +#define PR_MTE_TCF_SYNC (1UL << 1) +#define PR_MTE_TCF_ASYNC (2UL << 1) +#define PR_MTE_TCF_MASK (3UL << 1) +#define PR_MTE_TAG_SHIFT 3 +#define PR_MTE_TAG_MASK (0xffffUL << 3) + +#define PR_SET_IO_FLUSHER 57 +#define PR_GET_IO_FLUSHER 58 + +#define PR_SET_SYSCALL_USER_DISPATCH 59 +#define PR_SYS_DISPATCH_OFF 0 +#define PR_SYS_DISPATCH_ON 1 +#define SYSCALL_DISPATCH_FILTER_ALLOW 0 +#define SYSCALL_DISPATCH_FILTER_BLOCK 1 + +#define PR_PAC_SET_ENABLED_KEYS 60 +#define PR_PAC_GET_ENABLED_KEYS 61 int prctl (int, ...); diff --git a/porting/liteos_a_newlib/kernel/include/sys/socket.h b/porting/liteos_a_newlib/kernel/include/sys/socket.h index 6a16a12e..6a0ffe8f 100644 --- a/porting/liteos_a_newlib/kernel/include/sys/socket.h +++ b/porting/liteos_a_newlib/kernel/include/sys/socket.h @@ -278,6 +278,8 @@ struct linger { #define SCM_TXTIME SO_TXTIME #define SO_BINDTOIFINDEX 62 #define SO_DETACH_REUSEPORT_BPF 68 +#define SO_PREFER_BUSY_POLL 69 +#define SO_BUSY_POLL_BUDGET 70 #ifndef SOL_SOCKET #define SOL_SOCKET 1 diff --git a/porting/liteos_a_newlib/kernel/include/sys/syslimits.h b/porting/liteos_a_newlib/kernel/include/sys/syslimits.h new file mode 100644 index 00000000..d6ba96cc --- /dev/null +++ b/porting/liteos_a_newlib/kernel/include/sys/syslimits.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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_SYSLIMITS_H +#define _ADAPT_SYSLIMITS_H + +#include_next + +#undef PATH_MAX +#undef NAME_MAX +#define PATH_MAX 256 +#define NAME_MAX 256 + +#endif /* !_ADAPT_SYSLIMITS_H */ \ No newline at end of file diff --git a/porting/liteos_a_newlib/kernel/include/sys/uio.h b/porting/liteos_a_newlib/kernel/include/sys/uio.h index 0728987c..949fe0e5 100644 --- a/porting/liteos_a_newlib/kernel/include/sys/uio.h +++ b/porting/liteos_a_newlib/kernel/include/sys/uio.h @@ -17,7 +17,7 @@ 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 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 diff --git a/porting/liteos_a_newlib/kernel/src/other_adapt.c b/porting/liteos_a_newlib/kernel/src/other_adapt.c index f1b1d695..42d84754 100644 --- a/porting/liteos_a_newlib/kernel/src/other_adapt.c +++ b/porting/liteos_a_newlib/kernel/src/other_adapt.c @@ -43,7 +43,7 @@ int _kill(int i, int j) int _getpid(void) { - int pid = (int)OsGetKernelInitProcessID(); + int pid = (int)OsGetKernelInitProcess()->processID; return pid; } -- GitLab