Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
a1c90519
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
1 年多 前同步成功
通知
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看板
提交
a1c90519
编写于
8月 19, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 19, 2021
浏览文件
操作
浏览文件
下载
差异文件
!91 减少对musl代码的侵入式修改
Merge pull request !91 from Caoruihong/update_musl
上级
53a0d8a1
8b75c667
变更
70
隐藏空白更改
内联
并排
Showing
70 changed file
with
181 addition
and
891 deletion
+181
-891
porting/liteos_a/kernel/include/assert.h
porting/liteos_a/kernel/include/assert.h
+2
-9
porting/liteos_a/kernel/include/bits/alltypes.h
porting/liteos_a/kernel/include/bits/alltypes.h
+1
-26
porting/liteos_a/kernel/include/bits/errno.h
porting/liteos_a/kernel/include/bits/errno.h
+0
-2
porting/liteos_a/kernel/include/bits/stat.h
porting/liteos_a/kernel/include/bits/stat.h
+6
-0
porting/liteos_a/kernel/include/byteswap.h
porting/liteos_a/kernel/include/byteswap.h
+2
-2
porting/liteos_a/kernel/include/endian.h
porting/liteos_a/kernel/include/endian.h
+2
-2
porting/liteos_a/kernel/include/errno.h
porting/liteos_a/kernel/include/errno.h
+5
-6
porting/liteos_a/kernel/include/features.h
porting/liteos_a/kernel/include/features.h
+1
-5
porting/liteos_a/kernel/include/langinfo.h
porting/liteos_a/kernel/include/langinfo.h
+0
-2
porting/liteos_a/kernel/include/net/ethernet.h
porting/liteos_a/kernel/include/net/ethernet.h
+1
-1
porting/liteos_a/kernel/include/netinet/in.h
porting/liteos_a/kernel/include/netinet/in.h
+0
-1
porting/liteos_a/kernel/include/netinet/ip_icmp.h
porting/liteos_a/kernel/include/netinet/ip_icmp.h
+0
-5
porting/liteos_a/kernel/include/netinet/tcp.h
porting/liteos_a/kernel/include/netinet/tcp.h
+0
-7
porting/liteos_a/kernel/include/poll.h
porting/liteos_a/kernel/include/poll.h
+2
-2
porting/liteos_a/kernel/include/signal.h
porting/liteos_a/kernel/include/signal.h
+36
-36
porting/liteos_a/kernel/include/stdalign.h
porting/liteos_a/kernel/include/stdalign.h
+0
-2
porting/liteos_a/kernel/include/stdio.h
porting/liteos_a/kernel/include/stdio.h
+0
-1
porting/liteos_a/kernel/include/string.h
porting/liteos_a/kernel/include/string.h
+0
-2
porting/liteos_a/kernel/include/sys/mman.h
porting/liteos_a/kernel/include/sys/mman.h
+0
-2
porting/liteos_a/kernel/include/sys/reboot.h
porting/liteos_a/kernel/include/sys/reboot.h
+8
-0
porting/liteos_a/kernel/include/sys/select.h
porting/liteos_a/kernel/include/sys/select.h
+1
-1
porting/liteos_a/kernel/include/sys/stat.h
porting/liteos_a/kernel/include/sys/stat.h
+1
-7
porting/liteos_a/kernel/include/time.h
porting/liteos_a/kernel/include/time.h
+0
-2
porting/liteos_a/kernel/include/unistd.h
porting/liteos_a/kernel/include/unistd.h
+3
-25
porting/liteos_a/kernel/include/wchar.h
porting/liteos_a/kernel/include/wchar.h
+0
-1
porting/liteos_a/kernel/musl.gni
porting/liteos_a/kernel/musl.gni
+0
-8
porting/liteos_a/kernel/src/env/getenv.c
porting/liteos_a/kernel/src/env/getenv.c
+0
-56
porting/liteos_a/kernel/src/errno/__strerror.h
porting/liteos_a/kernel/src/errno/__strerror.h
+0
-2
porting/liteos_a/kernel/src/errno/errno.c
porting/liteos_a/kernel/src/errno/errno.c
+0
-89
porting/liteos_a/kernel/src/errno/strerror.c
porting/liteos_a/kernel/src/errno/strerror.c
+0
-8
porting/liteos_a/kernel/src/exit/abort.c
porting/liteos_a/kernel/src/exit/abort.c
+0
-39
porting/liteos_a/kernel/src/exit/assert.c
porting/liteos_a/kernel/src/exit/assert.c
+5
-56
porting/liteos_a/kernel/src/exit/exit.c
porting/liteos_a/kernel/src/exit/exit.c
+0
-45
porting/liteos_a/kernel/src/include/features.h
porting/liteos_a/kernel/src/include/features.h
+2
-7
porting/liteos_a/kernel/src/internal/floatscan.c
porting/liteos_a/kernel/src/internal/floatscan.c
+21
-21
porting/liteos_a/kernel/src/internal/intscan.c
porting/liteos_a/kernel/src/internal/intscan.c
+1
-1
porting/liteos_a/kernel/src/internal/shgetc.c
porting/liteos_a/kernel/src/internal/shgetc.c
+1
-1
porting/liteos_a/kernel/src/internal/stdio_impl.h
porting/liteos_a/kernel/src/internal/stdio_impl.h
+26
-0
porting/liteos_a/kernel/src/locale/__mo_lookup.c
porting/liteos_a/kernel/src/locale/__mo_lookup.c
+1
-1
porting/liteos_a/kernel/src/malloc/malloc.c
porting/liteos_a/kernel/src/malloc/malloc.c
+0
-139
porting/liteos_a/kernel/src/math/acos.c
porting/liteos_a/kernel/src/math/acos.c
+1
-1
porting/liteos_a/kernel/src/math/asin.c
porting/liteos_a/kernel/src/math/asin.c
+1
-1
porting/liteos_a/kernel/src/math/atan2.c
porting/liteos_a/kernel/src/math/atan2.c
+1
-1
porting/liteos_a/kernel/src/math/fma.c
porting/liteos_a/kernel/src/math/fma.c
+5
-5
porting/liteos_a/kernel/src/math/lgammaf_r.c
porting/liteos_a/kernel/src/math/lgammaf_r.c
+1
-2
porting/liteos_a/kernel/src/multibyte/mbtowc.c
porting/liteos_a/kernel/src/multibyte/mbtowc.c
+3
-3
porting/liteos_a/kernel/src/prng/rand.c
porting/liteos_a/kernel/src/prng/rand.c
+0
-43
porting/liteos_a/kernel/src/sched/sched_yield.c
porting/liteos_a/kernel/src/sched/sched_yield.c
+0
-39
porting/liteos_a/kernel/src/stdio/__stdio_close.c
porting/liteos_a/kernel/src/stdio/__stdio_close.c
+0
-3
porting/liteos_a/kernel/src/stdio/__stdio_seek.c
porting/liteos_a/kernel/src/stdio/__stdio_seek.c
+1
-55
porting/liteos_a/kernel/src/stdio/__stdio_write.c
porting/liteos_a/kernel/src/stdio/__stdio_write.c
+0
-4
porting/liteos_a/kernel/src/stdio/__stdout_write.c
porting/liteos_a/kernel/src/stdio/__stdout_write.c
+5
-13
porting/liteos_a/kernel/src/stdio/__toread.c
porting/liteos_a/kernel/src/stdio/__toread.c
+6
-1
porting/liteos_a/kernel/src/stdio/__towrite.c
porting/liteos_a/kernel/src/stdio/__towrite.c
+5
-0
porting/liteos_a/kernel/src/stdio/fclose.c
porting/liteos_a/kernel/src/stdio/fclose.c
+0
-6
porting/liteos_a/kernel/src/stdio/fopen.c
porting/liteos_a/kernel/src/stdio/fopen.c
+0
-6
porting/liteos_a/kernel/src/stdio/fread.c
porting/liteos_a/kernel/src/stdio/fread.c
+1
-6
porting/liteos_a/kernel/src/stdio/fwrite.c
porting/liteos_a/kernel/src/stdio/fwrite.c
+0
-6
porting/liteos_a/kernel/src/stdio/ungetc.c
porting/liteos_a/kernel/src/stdio/ungetc.c
+1
-1
porting/liteos_a/kernel/src/stdio/vfprintf.c
porting/liteos_a/kernel/src/stdio/vfprintf.c
+10
-11
porting/liteos_a/kernel/src/stdlib/strtol.c
porting/liteos_a/kernel/src/stdlib/strtol.c
+1
-1
porting/liteos_a/kernel/src/string/memchr.c
porting/liteos_a/kernel/src/string/memchr.c
+2
-2
porting/liteos_a/kernel/src/string/stpcpy.c
porting/liteos_a/kernel/src/string/stpcpy.c
+1
-1
porting/liteos_a/kernel/src/string/stpncpy.c
porting/liteos_a/kernel/src/string/stpncpy.c
+3
-2
porting/liteos_a/kernel/src/string/strchrnul.c
porting/liteos_a/kernel/src/string/strchrnul.c
+1
-1
porting/liteos_a/kernel/src/string/strlcpy.c
porting/liteos_a/kernel/src/string/strlcpy.c
+1
-1
porting/liteos_a/kernel/src/string/strlen.c
porting/liteos_a/kernel/src/string/strlen.c
+1
-1
porting/liteos_a/kernel/src/time/__tz.c
porting/liteos_a/kernel/src/time/__tz.c
+1
-1
porting/liteos_a/kernel/src/time/strftime.c
porting/liteos_a/kernel/src/time/strftime.c
+1
-1
porting/liteos_a/kernel/src/time/time.c
porting/liteos_a/kernel/src/time/time.c
+0
-51
未找到文件。
porting/liteos_a/kernel/include/assert.h
浏览文件 @
a1c90519
...
...
@@ -8,23 +8,16 @@
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
#endif
#ifdef CONFIG_DEBUG
#define DEBUGASSERT(f) \
{ if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
#else
#define DEBUGASSERT(f)
#endif
#define DEBUGASSERT(x) assert(x)
#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
#undef static_assert
#define static_assert _Static_assert
#endif
#ifdef __cplusplus
extern
"C"
{
#endif
_Noreturn
void
__assert
(
const
char
*
,
int
,
const
char
*
);
_Noreturn
void
__assert2
(
const
char
*
,
int
,
const
char
*
,
const
char
*
);
_Noreturn
void
__assert_fail
(
const
char
*
,
const
char
*
,
int
,
const
char
*
);
#ifdef __cplusplus
...
...
porting/liteos_a/kernel/include/bits/alltypes.h
浏览文件 @
a1c90519
...
...
@@ -347,32 +347,7 @@ typedef struct __locale_struct *locale_t;
#endif
#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
struct
_IO_FILE
{
unsigned
flags
;
unsigned
char
*
rpos
,
*
rend
;
int
(
*
close
)(
struct
_IO_FILE
*
);
unsigned
char
*
wend
,
*
wpos
;
unsigned
char
*
mustbezero_1
;
unsigned
char
*
wbase
;
size_t
(
*
read
)(
struct
_IO_FILE
*
,
unsigned
char
*
,
size_t
);
size_t
(
*
write
)(
struct
_IO_FILE
*
,
const
unsigned
char
*
,
size_t
);
off_t
(
*
seek
)(
struct
_IO_FILE
*
,
off_t
,
int
);
unsigned
char
*
buf
;
size_t
buf_size
;
struct
_IO_FILE
*
prev
,
*
next
;
int
fd
;
int
pipe_pid
;
int
mode
;
void
*
lock
;
int
lbf
;
void
*
cookie
;
off_t
off
;
char
*
getln_buf
;
void
*
mustbezero_2
;
unsigned
char
*
shend
;
off_t
shlim
,
shcnt
;
struct
__locale_struct
*
locale
;
};
struct
_IO_FILE
{
char
__x
;
};
#define __DEFINED_struct__IO_FILE
#endif
...
...
porting/liteos_a/kernel/include/bits/errno.h
浏览文件 @
a1c90519
...
...
@@ -133,5 +133,3 @@
#define ENOTRECOVERABLE 131
#define ERFKILL 132
#define EHWPOISON 133
#define ENOSUPP 201
porting/liteos_a/kernel/include/bits/stat.h
浏览文件 @
a1c90519
...
...
@@ -24,6 +24,12 @@ struct stat {
struct
timespec
st_ctim
;
};
#define __NEED_uint16_t
#define __NEED_uint32_t
#define __NEED_uint64_t
#define __NEED_int32_t
#define __NEED_int64_t
#include <bits/alltypes.h>
struct
statx
{
uint32_t
stx_mask
;
uint32_t
stx_blksize
;
...
...
porting/liteos_a/kernel/include/byteswap.h
浏览文件 @
a1c90519
...
...
@@ -11,12 +11,12 @@ static __inline uint16_t __bswap_16(uint16_t __x)
static
__inline
uint32_t
__bswap_32
(
uint32_t
__x
)
{
return
(
__x
>>
24
)
|
(
__x
>>
8
&
0xff00
)
|
(
__x
<<
8
&
0xff0000
)
|
(
__x
<<
24
)
;
return
__x
>>
24
|
__x
>>
8
&
0xff00
|
__x
<<
8
&
0xff0000
|
__x
<<
24
;
}
static
__inline
uint64_t
__bswap_64
(
uint64_t
__x
)
{
return
(
__bswap_32
(
__x
)
+
0ULL
)
<<
32
|
__bswap_32
(
__x
>>
32
);
return
__bswap_32
(
__x
)
+
0ULL
<<
32
|
__bswap_32
(
__x
>>
32
);
}
#define bswap_16(x) __bswap_16(x)
...
...
porting/liteos_a/kernel/include/endian.h
浏览文件 @
a1c90519
...
...
@@ -27,12 +27,12 @@ static __inline uint16_t __bswap16(uint16_t __x)
static
__inline
uint32_t
__bswap32
(
uint32_t
__x
)
{
return
(
__x
>>
24
)
|
((
__x
>>
8
)
&
(
0xff00
))
|
((
__x
<<
8
)
&
(
0xff0000
))
|
((
__x
<<
24
))
;
return
__x
>>
24
|
__x
>>
8
&
0xff00
|
__x
<<
8
&
0xff0000
|
__x
<<
24
;
}
static
__inline
uint64_t
__bswap64
(
uint64_t
__x
)
{
return
(
__bswap32
(
__x
)
+
0ULL
)
<<
32
|
__bswap32
(
__x
>>
32
);
return
__bswap32
(
__x
)
+
0ULL
<<
32
|
__bswap32
(
__x
>>
32
);
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
...
...
porting/liteos_a/kernel/include/errno.h
浏览文件 @
a1c90519
...
...
@@ -9,15 +9,14 @@ extern "C" {
#include <bits/errno.h>
void
set_errno
(
int
err_code
);
int
get_errno
(
void
);
int
*
__errno_location
(
void
);
#ifdef __GNUC__
__attribute__
((
const
))
#endif
extern
volatile
int
*
__errno
(
void
);
#define errno (*__errno())
int
*
__errno_location
(
void
);
#define errno (*__errno_location())
#define set_errno(err) do { if (err) { errno = (err); } } while(0)
#define get_errno() errno
#ifdef _GNU_SOURCE
extern
char
*
program_invocation_short_name
,
*
program_invocation_name
;
...
...
porting/liteos_a/kernel/include/features.h
浏览文件 @
a1c90519
#ifndef _FEATURES_H
#define _FEATURES_H
#define _DEFAULT_SOURCE
#define _LARGEFILE64_SOURCE
#define _GNU_SOURCE
#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
...
...
@@ -41,6 +39,4 @@
#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
#include "../src/include/features.h"
#endif
\ No newline at end of file
#endif
porting/liteos_a/kernel/include/langinfo.h
浏览文件 @
a1c90519
...
...
@@ -91,8 +91,6 @@ extern "C" {
char
*
nl_langinfo
(
nl_item
);
char
*
nl_langinfo_l
(
nl_item
,
locale_t
);
#include "../src/include/langinfo.h"
#ifdef __cplusplus
}
#endif
...
...
porting/liteos_a/kernel/include/net/ethernet.h
浏览文件 @
a1c90519
...
...
@@ -32,7 +32,7 @@ struct ether_header {
#define ETHERTYPE_LOOPBACK 0x9000
#define ETHER_ADDR_LEN
6
#define ETHER_ADDR_LEN
ETH_ALEN
#define ETHER_TYPE_LEN 2
#define ETHER_CRC_LEN 4
#define ETHER_HDR_LEN ETH_HLEN
...
...
porting/liteos_a/kernel/include/netinet/in.h
浏览文件 @
a1c90519
...
...
@@ -311,7 +311,6 @@ struct ip6_mtuinfo {
struct
sockaddr_in6
ip6m_addr
;
uint32_t
ip6m_mtu
;
};
#endif
#define IPV6_ADDRFORM 1
...
...
porting/liteos_a/kernel/include/netinet/ip_icmp.h
浏览文件 @
a1c90519
...
...
@@ -69,7 +69,6 @@ struct icmphdr {
#define ICMP_EXC_TTL 0
#define ICMP_EXC_FRAGTIME 1
#define ICMP_FILTER 1
struct
icmp_ra_addr
{
uint32_t
ira_addr
;
...
...
@@ -115,10 +114,6 @@ struct icmp {
}
icmp_dun
;
};
struct
icmp_filter
{
uint32_t
data
;
};
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
...
...
porting/liteos_a/kernel/include/netinet/tcp.h
浏览文件 @
a1c90519
...
...
@@ -54,13 +54,6 @@
#define TCP_LISTEN 10
#define TCP_CLOSING 11
enum
{
TCP_NO_QUEUE
,
TCP_RECV_QUEUE
,
TCP_SEND_QUEUE
,
TCP_QUEUES_NR
,
};
enum
{
TCP_NLA_PAD
,
TCP_NLA_BUSY
,
...
...
porting/liteos_a/kernel/include/poll.h
浏览文件 @
a1c90519
#ifndef _
SYS_
POLL_H
#define _
SYS_
POLL_H
#ifndef _POLL_H
#define _POLL_H
#ifdef __cplusplus
extern
"C"
{
...
...
porting/liteos_a/kernel/include/signal.h
浏览文件 @
a1c90519
...
...
@@ -94,34 +94,34 @@ typedef struct sigaltstack stack_t;
#define CLD_CONTINUED 6
union
sigval
{
int
sival_int
;
void
*
sival_ptr
;
int
sival_int
;
void
*
sival_ptr
;
};
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
;
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
...
...
@@ -133,22 +133,22 @@ typedef struct {
#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
struct
sigaction
{
union
{
void
(
*
sa_handler
)(
int
);
void
(
*
sa_sigaction
)(
int
,
siginfo_t
*
,
void
*
);
}
sa_sigactionhandler
;
sigset_t
sa_mask
;
int
sa_flags
;
void
(
*
sa_restorer
)(
void
);
union
{
void
(
*
sa_handler
)(
int
);
void
(
*
sa_sigaction
)(
int
,
siginfo_t
*
,
void
*
);
}
sa_sigactionhandler
;
sigset_t
sa_mask
;
int
sa_flags
;
void
(
*
sa_restorer
)(
void
);
};
#define sa_handler sa_sigactionhandler.sa_handler
#define sa_sigaction sa_sigactionhandler.sa_sigaction
struct
sigevent
{
union
sigval
sigev_value
;
int
sigev_signo
;
int
sigev_notify
;
void
(
*
sigev_notify_function
)(
union
sigval
);
union
sigval
sigev_value
;
int
sigev_signo
;
int
sigev_notify
;
void
(
*
sigev_notify_function
)(
union
sigval
);
void
*
sigev_notify_attributes
;
};
...
...
porting/liteos_a/kernel/include/stdalign.h
浏览文件 @
a1c90519
...
...
@@ -5,9 +5,7 @@
/* this whole header only works in C11 or with compiler extensions */
#if __STDC_VERSION__ < 201112L && defined( __GNUC__)
#undef _Alignas
#define _Alignas(t) __attribute__((__aligned__(t)))
#undef _Alignof
#define _Alignof(t) __alignof__(t)
#endif
...
...
porting/liteos_a/kernel/include/stdio.h
浏览文件 @
a1c90519
...
...
@@ -12,7 +12,6 @@ extern "C" {
#define __NEED_size_t
#if __STDC_VERSION__ < 201112L
#define __NEED_off_t
#define __NEED_struct__IO_FILE
#endif
...
...
porting/liteos_a/kernel/include/string.h
浏览文件 @
a1c90519
...
...
@@ -98,8 +98,6 @@ char *basename(const char *);
#endif
#endif
#include "../src/include/string.h"
#ifdef __cplusplus
}
#endif
...
...
porting/liteos_a/kernel/include/sys/mman.h
浏览文件 @
a1c90519
...
...
@@ -146,8 +146,6 @@ int shm_unlink (const char *);
#define mmap64 mmap
#endif
#include "../src/include/sys/mman.h"
#ifdef __cplusplus
}
#endif
...
...
porting/liteos_a/kernel/include/sys/reboot.h
浏览文件 @
a1c90519
...
...
@@ -5,6 +5,14 @@ extern "C" {
#endif
#define RB_AUTOBOOT 0x01234567
#define RB_HALT_SYSTEM 0xcdef0123
#define RB_ENABLE_CAD 0x89abcdef
#define RB_DISABLE_CAD 0
#define RB_POWER_OFF 0x4321fedc
#define RB_SW_SUSPEND 0xd000fce2
#define RB_KEXEC 0x45584543
int
reboot
(
int
);
#ifdef __cplusplus
}
...
...
porting/liteos_a/kernel/include/sys/select.h
浏览文件 @
a1c90519
...
...
@@ -20,7 +20,7 @@ extern "C" {
/* FD_SETSIZE is defined in "vfs_config.h" */
#else
#define FD_SETSIZE
512
#define FD_SETSIZE
1024
#define FD_SET_TOTAL_SIZE FD_SETSIZE
#endif
...
...
porting/liteos_a/kernel/include/sys/stat.h
浏览文件 @
a1c90519
...
...
@@ -6,11 +6,6 @@ extern "C" {
#include <features.h>
#define __NEED_uint16_t
#define __NEED_uint32_t
#define __NEED_uint64_t
#define __NEED_int32_t
#define __NEED_int64_t
#define __NEED_dev_t
#define __NEED_ino_t
#define __NEED_mode_t
...
...
@@ -19,7 +14,6 @@ extern "C" {
#define __NEED_gid_t
#define __NEED_off_t
#define __NEED_time_t
#define __NEED_suseconds_t
#define __NEED_blksize_t
#define __NEED_blkcnt_t
#define __NEED_struct_timespec
...
...
@@ -106,13 +100,13 @@ int lchmod(const char *, mode_t);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define stat64 stat
int
fstat64
(
int
,
struct
stat64
*
);
#define lstat64 lstat
#define fstatat64 fstatat
#define blkcnt64_t blkcnt_t
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#define ino64_t ino_t
int
fstat64
(
int
,
struct
stat64
*
);
#endif
#if _REDIR_TIME64
...
...
porting/liteos_a/kernel/include/time.h
浏览文件 @
a1c90519
...
...
@@ -172,8 +172,6 @@ __REDIR(timegm, __timegm_time64);
#endif
#endif
#include "../src/include/time.h"
#ifdef __cplusplus
}
#endif
...
...
porting/liteos_a/kernel/include/unistd.h
浏览文件 @
a1c90519
...
...
@@ -73,30 +73,6 @@ int ftruncate(int, off_t);
int
access
(
const
char
*
,
int
);
int
faccessat
(
int
,
const
char
*
,
int
,
int
);
/* Format options */
#define FMT_FAT 0x01
#define FMT_FAT32 0x02
#define FMT_ANY 0x07
#define FMT_ERASE 0x08
/**
* @brief format FAT device (SD card, U disk, and MMC card), this function is OHOS-specific
* @param dev device name.
* @param sectors sectors per cluster, can be 0 OR power of 2. The sector size for standard FAT volumes is 512 bytes.
* -- sector number is 0 OR >128: automatically choose the appropriate cluster size.
* -- sector number is 1 ~ 128: cluster size = sectors per cluster * 512B.
* @param option file system type.
* -- FMT_FAT
* -- FMT_FAT32
* -- FMT_ANY
* -- FMT_ERASE (USB not supported)
* @return format result
* @retval -1 format error
* @retval 0 format successful
*/
int
format
(
const
char
*
dev
,
int
sectors
,
int
option
);
int
chdir
(
const
char
*
);
int
fchdir
(
int
);
char
*
getcwd
(
char
*
,
size_t
);
...
...
@@ -216,12 +192,14 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define lockf64 lockf
off64_t
lseek64
(
int
,
off64_t
,
int
);
ssize_t
pread64
(
int
,
void
*
,
size_t
,
off64_t
);
ssize_t
pwrite64
(
int
,
const
void
*
,
size_t
,
off64_t
);
int
truncate64
(
const
char
*
,
off64_t
);
int
ftruncate64
(
int
,
off64_t
);
off_t
_lseek
(
int
fd
,
off_t
offset
,
int
whence
);
off64_t
_lseek64
(
int
fd
,
int
offsetHigh
,
int
offsetLow
,
off64_t
*
result
,
int
whence
);
#define lockf64 lockf
#endif
#define POSIX_CLOSE_RESTART 0
...
...
porting/liteos_a/kernel/include/wchar.h
浏览文件 @
a1c90519
...
...
@@ -15,7 +15,6 @@ extern "C" {
#define __NEED_mbstate_t
#if __STDC_VERSION__ < 201112L
#define __NEED_off_t
#define __NEED_struct__IO_FILE
#endif
...
...
porting/liteos_a/kernel/musl.gni
浏览文件 @
a1c90519
...
...
@@ -39,12 +39,8 @@ MUSL_SRC_COMMON = [
"$MUSLPORTINGDIR/src/ctype/isxdigit.c",
"$MUSLPORTINGDIR/src/ctype/tolower.c",
"$MUSLPORTINGDIR/src/ctype/toupper.c",
"$MUSLPORTINGDIR/src/env/getenv.c",
"$MUSLPORTINGDIR/src/errno/errno.c",
"$MUSLPORTINGDIR/src/errno/strerror.c",
"$MUSLPORTINGDIR/src/exit/abort.c",
"$MUSLPORTINGDIR/src/exit/assert.c",
"$MUSLPORTINGDIR/src/exit/exit.c",
"$MUSLPORTINGDIR/src/fenv/fenv.c",
"$MUSLPORTINGDIR/src/internal/floatscan.c",
"$MUSLPORTINGDIR/src/internal/intscan.c",
...
...
@@ -55,7 +51,6 @@ MUSL_SRC_COMMON = [
"$MUSLPORTINGDIR/src/locale/c_locale.c",
"$MUSLPORTINGDIR/src/locale/langinfo.c",
"$MUSLPORTINGDIR/src/locale/locale_map.c",
"$MUSLPORTINGDIR/src/malloc/malloc.c",
"$MUSLPORTINGDIR/src/math/__cos.c",
"$MUSLPORTINGDIR/src/math/__cosdf.c",
"$MUSLPORTINGDIR/src/math/__cosl.c",
...
...
@@ -294,9 +289,7 @@ MUSL_SRC_COMMON = [
"$MUSLPORTINGDIR/src/network/htons.c",
"$MUSLPORTINGDIR/src/network/ntohl.c",
"$MUSLPORTINGDIR/src/network/ntohs.c",
"$MUSLPORTINGDIR/src/prng/rand.c",
"$MUSLPORTINGDIR/src/prng/random.c",
"$MUSLPORTINGDIR/src/sched/sched_yield.c",
"$MUSLPORTINGDIR/src/stdio/__fdopen.c",
"$MUSLPORTINGDIR/src/stdio/__fmodeflags.c",
"$MUSLPORTINGDIR/src/stdio/__lockfile.c",
...
...
@@ -390,7 +383,6 @@ MUSL_SRC_COMMON = [
"$MUSLPORTINGDIR/src/time/mktime.c",
"$MUSLPORTINGDIR/src/time/strftime.c",
"$MUSLPORTINGDIR/src/time/strptime.c",
"$MUSLPORTINGDIR/src/time/time.c",
]
MUSL_SRC_ARM = [
...
...
porting/liteos_a/kernel/src/env/getenv.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "stdlib.h"
#include "string.h"
#include "los_exc.h"
/*
* getenv --
* Returns ptr to value associated with name, if any, else NULL.
*/
char
*
getenv
(
const
char
*
name
)
{
#ifdef LOSCFG_LLTREPORT
if
(
strncmp
(
name
,
"GCOV_PREFIX"
,
sizeof
(
"GCOV_PREFIX"
))
==
0
)
{
#ifdef LOSCFG_LLTSER
extern
const
char
*
gcov_dir
;
return
(
char
*
)
gcov_dir
;
#else
return
"/bin/vs/sd"
;
#endif
}
if
(
strncmp
(
name
,
"GCOV_PREFIX_STRIP"
,
sizeof
(
"GCOV_PREFIX_STRIP"
))
==
0
)
return
"6"
;
#endif
return
(
NULL
);
}
porting/liteos_a/kernel/src/errno/__strerror.h
浏览文件 @
a1c90519
...
...
@@ -103,5 +103,3 @@ E(EMEDIUMTYPE, "Wrong medium type")
E
(
EMULTIHOP
,
"Multihop attempted"
)
E
(
0
,
"No error information"
)
E
(
ENOSUPP
,
"Operation not supported"
)
porting/liteos_a/kernel/src/errno/errno.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "errno.h"
#include "los_errno.h"
#include "los_task_pri.h"
/* the specific errno get or set in interrupt service routine */
static
int
errno_isr
;
void
set_errno
(
int
err_code
)
{
LosTaskCB
*
runTask
=
NULL
;
/* errno can not be set to 0 as posix standard */
if
(
err_code
==
0
)
return
;
if
(
OS_INT_INACTIVE
)
{
runTask
=
OsCurrTaskGet
();
runTask
->
errorNo
=
err_code
;
}
else
{
errno_isr
=
err_code
;
}
}
int
get_errno
(
void
)
{
LosTaskCB
*
runTask
=
NULL
;
if
(
OS_INT_INACTIVE
)
{
runTask
=
OsCurrTaskGet
();
return
runTask
->
errorNo
;
}
else
{
return
errno_isr
;
}
}
int
*
__errno_location
(
void
)
{
LosTaskCB
*
runTask
=
NULL
;
if
(
OS_INT_INACTIVE
)
{
runTask
=
OsCurrTaskGet
();
return
&
runTask
->
errorNo
;
}
else
{
return
&
errno_isr
;
}
}
volatile
int
*
__errno
(
void
)
{
LosTaskCB
*
runTask
=
NULL
;
if
(
OS_INT_INACTIVE
)
{
runTask
=
OsCurrTaskGet
();
return
(
volatile
int
*
)(
&
runTask
->
errorNo
);
}
else
{
return
(
volatile
int
*
)(
&
errno_isr
);
}
}
porting/liteos_a/kernel/src/errno/strerror.c
浏览文件 @
a1c90519
...
...
@@ -2,10 +2,6 @@
#include <string.h>
#include "locale_impl.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define E(a,b) ((unsigned char)a),
static
const
unsigned
char
errid
[]
=
{
#include "__strerror.h"
...
...
@@ -33,7 +29,3 @@ char *strerror(int e)
}
weak_alias
(
__strerror_l
,
strerror_l
);
#ifdef __cplusplus
}
#endif
porting/liteos_a/kernel/src/exit/abort.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "stdlib.h"
#include "string.h"
#include "los_exc.h"
void
abort
(
void
)
{
LOS_Panic
(
"System was being aborted
\n
"
);
while
(
1
);
}
\ No newline at end of file
porting/liteos_a/kernel/src/exit/assert.c
浏览文件 @
a1c90519
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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_hwi.h"
#include "los_printf.h"
#include "los_exc.h"
#ifdef __cplusplus
extern
"C"
{
#endif
/* __cplusplus */
void
__assert
(
const
char
*
file
,
int
line
,
const
char
*
expr
)
{
PRINT_ERR
(
"__assert error: %s, %d, %s
\n
"
,
file
,
line
,
expr
);
LOS_Panic
(
"__assert error:
\n
"
);
while
(
1
);
}
void
__assert2
(
const
char
*
file
,
int
line
,
const
char
*
func
,
const
char
*
expr
)
{
PRINT_ERR
(
"%s:%d: %s: assertion
\"
%s
\"
failed"
,
file
,
line
,
func
,
expr
);
LOS_Panic
(
"__assert error:
\n
"
);
while
(
1
);
}
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
);
}
#ifdef __cplusplus
_Noreturn
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
);
}
#endif
/* __cplusplus */
\ No newline at end of file
porting/liteos_a/kernel/src/exit/exit.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 <errno.h>
#include "los_printf.h"
void
_exit
(
int
status
)
{
PRINT_ERR
(
"%s NOT SUPPORT
\n
"
,
__FUNCTION__
);
errno
=
ENOSYS
;
while
(
1
);
}
void
exit
(
int
status
)
{
PRINT_ERR
(
"%s NOT SUPPORT
\n
"
,
__FUNCTION__
);
errno
=
ENOSYS
;
while
(
1
);
}
porting/liteos_a/kernel/src/include/features.h
浏览文件 @
a1c90519
...
...
@@ -4,12 +4,7 @@
#include "../../include/features.h"
#define hidden __attribute__((__visibility__("hidden")))
#ifndef weak_alias
#define weak_alias(old, new) \
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
#endif
#ifndef strong_alias
#define strong_alias(old, new) \
extern __typeof(old) new __attribute__((__alias__(#old)))
#endif
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
#endif
porting/liteos_a/kernel/src/internal/floatscan.c
浏览文件 @
a1c90519
...
...
@@ -185,7 +185,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
x
[
k
]
=
x
[
k
]
/
p10
+
carry
;
carry
=
1000000000
/
p10
*
tmp
;
if
(
k
==
a
&&
!
x
[
k
])
{
a
=
(
(
a
+
1
)
&
MASK
);
a
=
(
a
+
1
&
MASK
);
rp
-=
9
;
}
}
...
...
@@ -197,7 +197,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
while
(
rp
<
9
*
LD_B1B_DIG
||
(
rp
==
9
*
LD_B1B_DIG
&&
x
[
a
]
<
th
[
0
]))
{
uint32_t
carry
=
0
;
e2
-=
29
;
for
(
k
=
(
(
z
-
1
)
&
MASK
);
;
k
=
((
k
-
1
)
&
MASK
))
{
for
(
k
=
(
z
-
1
&
MASK
);
;
k
=
(
k
-
1
&
MASK
))
{
uint64_t
tmp
=
((
uint64_t
)
x
[
k
]
<<
29
)
+
carry
;
if
(
tmp
>
1000000000
)
{
carry
=
tmp
/
1000000000
;
...
...
@@ -206,15 +206,15 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
carry
=
0
;
x
[
k
]
=
tmp
;
}
if
(
k
==
(
(
z
-
1
)
&
MASK
)
&&
k
!=
a
&&
!
x
[
k
])
z
=
k
;
if
(
k
==
(
z
-
1
&
MASK
)
&&
k
!=
a
&&
!
x
[
k
])
z
=
k
;
if
(
k
==
a
)
break
;
}
if
(
carry
)
{
rp
+=
9
;
a
=
(
(
a
-
1
)
&
MASK
);
a
=
(
a
-
1
&
MASK
);
if
(
a
==
z
)
{
z
=
(
(
z
-
1
)
&
MASK
);
x
[
(
z
-
1
)
&
MASK
]
|=
x
[
z
];
z
=
(
z
-
1
&
MASK
);
x
[
z
-
1
&
MASK
]
|=
x
[
z
];
}
x
[
a
]
=
carry
;
}
...
...
@@ -225,39 +225,39 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
uint32_t
carry
=
0
;
int
sh
=
1
;
for
(
i
=
0
;
i
<
LD_B1B_DIG
;
i
++
)
{
k
=
(
(
a
+
i
)
&
MASK
);
k
=
(
a
+
i
&
MASK
);
if
(
k
==
z
||
x
[
k
]
<
th
[
i
])
{
i
=
LD_B1B_DIG
;
break
;
}
if
(
x
[
(
a
+
i
)
&
MASK
]
>
th
[
i
])
break
;
if
(
x
[
a
+
i
&
MASK
]
>
th
[
i
])
break
;
}
if
(
i
==
LD_B1B_DIG
&&
rp
==
9
*
LD_B1B_DIG
)
break
;
/* FIXME: find a way to compute optimal sh */
if
(
rp
>
9
+
9
*
LD_B1B_DIG
)
sh
=
9
;
e2
+=
sh
;
for
(
k
=
a
;
k
!=
z
;
k
=
(
(
k
+
1
)
&
MASK
))
{
uint32_t
tmp
=
x
[
k
]
&
(
(
1
<<
sh
)
-
1
)
;
for
(
k
=
a
;
k
!=
z
;
k
=
(
k
+
1
&
MASK
))
{
uint32_t
tmp
=
x
[
k
]
&
(
1
<<
sh
)
-
1
;
x
[
k
]
=
(
x
[
k
]
>>
sh
)
+
carry
;
carry
=
(
1000000000
>>
sh
)
*
tmp
;
if
(
k
==
a
&&
!
x
[
k
])
{
a
=
(
(
a
+
1
)
&
MASK
);
a
=
(
a
+
1
&
MASK
);
i
--
;
rp
-=
9
;
}
}
if
(
carry
)
{
if
((
(
z
+
1
)
&
MASK
)
!=
a
)
{
if
((
z
+
1
&
MASK
)
!=
a
)
{
x
[
z
]
=
carry
;
z
=
(
(
z
+
1
)
&
MASK
);
}
else
x
[
(
z
-
1
)
&
MASK
]
|=
1
;
z
=
(
z
+
1
&
MASK
);
}
else
x
[
z
-
1
&
MASK
]
|=
1
;
}
}
/* Assemble desired bits into floating point variable */
for
(
y
=
i
=
0
;
i
<
LD_B1B_DIG
;
i
++
)
{
if
((
(
a
+
i
)
&
MASK
)
==
z
)
x
[(
z
=
((
z
+
1
)
&
MASK
))
-
1
]
=
0
;
y
=
1000000000
.
0L
*
y
+
x
[
(
a
+
i
)
&
MASK
];
if
((
a
+
i
&
MASK
)
==
z
)
x
[(
z
=
(
z
+
1
&
MASK
))
-
1
]
=
0
;
y
=
1000000000
.
0L
*
y
+
x
[
a
+
i
&
MASK
];
}
y
*=
sign
;
...
...
@@ -278,14 +278,14 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
}
/* Process tail of decimal input so it can affect rounding */
if
((
(
a
+
i
)
&
MASK
)
!=
z
)
{
uint32_t
t
=
x
[
(
a
+
i
)
&
MASK
];
if
(
t
<
500000000
&&
(
t
||
(
(
a
+
i
+
1
)
&
MASK
)
!=
z
))
if
((
a
+
i
&
MASK
)
!=
z
)
{
uint32_t
t
=
x
[
a
+
i
&
MASK
];
if
(
t
<
500000000
&&
(
t
||
(
a
+
i
+
1
&
MASK
)
!=
z
))
frac
+=
0
.
25
*
sign
;
else
if
(
t
>
500000000
)
frac
+=
0
.
75
*
sign
;
else
if
(
t
==
500000000
)
{
if
((
(
a
+
i
+
1
)
&
MASK
)
==
z
)
if
((
a
+
i
+
1
&
MASK
)
==
z
)
frac
+=
0
.
5
*
sign
;
else
frac
+=
0
.
75
*
sign
;
...
...
@@ -297,7 +297,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
y
+=
frac
;
y
-=
bias
;
if
((
(
e2
+
LDBL_MANT_DIG
)
&
INT_MAX
)
>
emax
-
5
)
{
if
((
e2
+
LDBL_MANT_DIG
&
INT_MAX
)
>
emax
-
5
)
{
if
(
fabsl
(
y
)
>=
2
/
LDBL_EPSILON
)
{
if
(
denormal
&&
bits
==
LDBL_MANT_DIG
+
e2
-
emin
)
denormal
=
0
;
...
...
porting/liteos_a/kernel/src/internal/intscan.c
浏览文件 @
a1c90519
...
...
@@ -67,7 +67,7 @@ unsigned long long __intscan(FILE *f, unsigned base, int pok, unsigned long long
for
(
y
=
x
;
c
-
'0'
<
10U
&&
y
<=
ULLONG_MAX
/
10
&&
10
*
y
<=
ULLONG_MAX
-
(
c
-
'0'
);
c
=
shgetc
(
f
))
y
=
y
*
10
+
(
c
-
'0'
);
if
(
c
-
'0'
>=
10U
)
goto
done
;
}
else
if
(
!
(
base
&
(
base
-
1
)
))
{
}
else
if
(
!
(
base
&
base
-
1
))
{
int
bs
=
"
\0\1\2\4\7\3\6\5
"
[(
0x17
*
base
)
>>
5
&
7
];
for
(
x
=
0
;
val
[
c
]
<
base
&&
x
<=
UINT_MAX
/
32
;
c
=
shgetc
(
f
))
x
=
x
<<
bs
|
val
[
c
];
...
...
porting/liteos_a/kernel/src/internal/shgetc.c
浏览文件 @
a1c90519
...
...
@@ -20,7 +20,7 @@ int __shgetc(FILE *f)
{
int
c
;
off_t
cnt
=
shcnt
(
f
);
if
(
((
f
->
shlim
)
&&
(
cnt
>=
f
->
shlim
))
||
((
c
=
__uflow
(
f
))
<
0
)
)
{
if
(
f
->
shlim
&&
cnt
>=
f
->
shlim
||
(
c
=
__uflow
(
f
))
<
0
)
{
f
->
shcnt
=
f
->
buf
-
f
->
rpos
+
cnt
;
f
->
shend
=
f
->
rpos
;
f
->
shlim
=
-
1
;
...
...
porting/liteos_a/kernel/src/internal/stdio_impl.h
浏览文件 @
a1c90519
...
...
@@ -16,6 +16,32 @@
#define F_SVB 64
#define F_APP 128
struct
_IO_FILE
{
unsigned
flags
;
unsigned
char
*
rpos
,
*
rend
;
int
(
*
close
)(
struct
_IO_FILE
*
);
unsigned
char
*
wend
,
*
wpos
;
unsigned
char
*
mustbezero_1
;
unsigned
char
*
wbase
;
size_t
(
*
read
)(
struct
_IO_FILE
*
,
unsigned
char
*
,
size_t
);
size_t
(
*
write
)(
struct
_IO_FILE
*
,
const
unsigned
char
*
,
size_t
);
off_t
(
*
seek
)(
struct
_IO_FILE
*
,
off_t
,
int
);
unsigned
char
*
buf
;
size_t
buf_size
;
struct
_IO_FILE
*
prev
,
*
next
;
int
fd
;
int
pipe_pid
;
int
mode
;
void
*
lock
;
int
lbf
;
void
*
cookie
;
off_t
off
;
char
*
getln_buf
;
void
*
mustbezero_2
;
unsigned
char
*
shend
;
off_t
shlim
,
shcnt
;
struct
__locale_struct
*
locale
;
};
extern
hidden
FILE
*
volatile
__stdin_used
;
extern
hidden
FILE
*
volatile
__stdout_used
;
...
...
porting/liteos_a/kernel/src/locale/__mo_lookup.c
浏览文件 @
a1c90519
...
...
@@ -3,7 +3,7 @@
static
inline
uint32_t
swapc
(
uint32_t
x
,
int
c
)
{
return
c
?
(
x
>>
24
)
|
((
x
>>
8
)
&
(
0xff00
))
|
((
x
<<
8
)
&
(
0xff0000
))
|
(
x
<<
24
)
:
x
;
return
c
?
x
>>
24
|
x
>>
8
&
0xff00
|
x
<<
8
&
0xff0000
|
x
<<
24
:
x
;
}
const
char
*
__mo_lookup
(
const
void
*
p
,
size_t
size
,
const
char
*
s
)
...
...
porting/liteos_a/kernel/src/malloc/malloc.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 "stdlib.h"
#include "string.h"
#include "los_vm_map.h"
/*
* Allocates the requested memory and returns a pointer to it. The requested
* size is nitems each size bytes long (total memory requested is nitems*size).
* The space is initialized to all zero bits.
*/
void
*
calloc
(
size_t
nitems
,
size_t
size
)
{
/*lint !e578*/
size_t
real_size
;
void
*
ptr
=
NULL
;
if
(
nitems
==
0
||
size
==
0
)
{
return
NULL
;
}
real_size
=
(
size_t
)(
nitems
*
size
);
ptr
=
LOS_KernelMalloc
((
UINT32
)
real_size
);
if
(
ptr
!=
NULL
)
{
(
void
)
memset_s
((
void
*
)
ptr
,
real_size
,
0
,
real_size
);
}
return
ptr
;
}
/*
* Deallocates the memory previously allocated by a call to calloc, malloc, or
* realloc. The argument ptr points to the space that was previously allocated.
* If ptr points to a memory block that was not allocated with calloc, malloc,
* or realloc, or is a space that has been deallocated, then the result is undefined.
*/
void
free
(
void
*
ptr
)
{
if
(
ptr
==
NULL
)
{
return
;
}
LOS_KernelFree
(
ptr
);
}
/*
* Allocates the requested memory and returns a pointer to it. The requested
* size is size bytes. The value of the space is indeterminate.
*/
void
*
malloc
(
size_t
size
)
{
/*lint !e31 !e10*/
if
(
size
==
0
)
{
return
NULL
;
}
return
LOS_KernelMalloc
((
UINT32
)
size
);
}
void
*
zalloc
(
size_t
size
)
{
/*lint !e10*/
void
*
ptr
=
NULL
;
if
(
size
==
0
)
{
return
NULL
;
}
ptr
=
LOS_KernelMalloc
((
UINT32
)
size
);
if
(
ptr
!=
NULL
)
{
(
void
)
memset_s
(
ptr
,
size
,
0
,
size
);
}
return
ptr
;
}
/*
* allocates a block of size bytes whose address is a multiple of boundary.
* The boundary must be a power of two!
*/
void
*
memalign
(
size_t
boundary
,
size_t
size
)
{
if
(
size
==
0
)
{
return
NULL
;
}
return
LOS_KernelMallocAlign
((
UINT32
)
size
,
(
UINT32
)
boundary
);
}
/*
* Attempts to resize the memory block pointed to by ptr that was previously
* allocated with a call to malloc or calloc. The contents pointed to by ptr are
* unchanged. If the value of size is greater than the previous size of the
* block, then the additional bytes have an undeterminate value. If the value
* of size is less than the previous size of the block, then the difference of
* bytes at the end of the block are freed. If ptr is null, then it behaves like
* malloc. If ptr points to a memory block that was not allocated with calloc
* or malloc, or is a space that has been deallocated, then the result is
* undefined. If the new space cannot be allocated, then the contents pointed
* to by ptr are unchanged. If size is zero, then the memory block is completely
* freed.
*/
void
*
realloc
(
void
*
ptr
,
size_t
size
)
{
if
(
ptr
==
NULL
)
{
ptr
=
malloc
(
size
);
return
ptr
;
}
if
(
size
==
0
)
{
free
(
ptr
);
return
NULL
;
}
return
LOS_KernelRealloc
(
ptr
,
(
UINT32
)
size
);
}
\ No newline at end of file
porting/liteos_a/kernel/src/math/acos.c
浏览文件 @
a1c90519
...
...
@@ -69,7 +69,7 @@ double acos(double x)
uint32_t
lx
;
GET_LOW_WORD
(
lx
,
x
);
if
((
(
ix
-
0x3ff00000
)
|
lx
)
==
0
)
{
if
((
ix
-
0x3ff00000
|
lx
)
==
0
)
{
/* acos(1)=0, acos(-1)=pi */
if
(
hx
>>
31
)
return
2
*
pio2_hi
+
0x1
p
-
120
f
;
...
...
porting/liteos_a/kernel/src/math/asin.c
浏览文件 @
a1c90519
...
...
@@ -75,7 +75,7 @@ double asin(double x)
if
(
ix
>=
0x3ff00000
)
{
uint32_t
lx
;
GET_LOW_WORD
(
lx
,
x
);
if
((
(
ix
-
0x3ff00000
)
|
lx
)
==
0
)
if
((
ix
-
0x3ff00000
|
lx
)
==
0
)
/* asin(1) = +-pi/2 with inexact */
return
x
*
pio2_hi
+
0x1
p
-
120
f
;
return
0
/
(
x
-
x
);
...
...
porting/liteos_a/kernel/src/math/atan2.c
浏览文件 @
a1c90519
...
...
@@ -52,7 +52,7 @@ double atan2(double y, double x)
return
x
+
y
;
EXTRACT_WORDS
(
ix
,
lx
,
x
);
EXTRACT_WORDS
(
iy
,
ly
,
y
);
if
((
(
ix
-
0x3ff00000
)
|
lx
)
==
0
)
/* x = 1.0 */
if
((
ix
-
0x3ff00000
|
lx
)
==
0
)
/* x = 1.0 */
return
atan
(
y
);
m
=
((
iy
>>
31
)
&
1
)
|
((
ix
>>
30
)
&
2
);
/* 2*sign(x)+sign(y) */
ix
=
ix
&
0x7fffffff
;
...
...
porting/liteos_a/kernel/src/math/fma.c
浏览文件 @
a1c90519
...
...
@@ -69,7 +69,7 @@ double fma(double x, double y, double z)
if
(
d
>
0
)
{
if
(
d
<
64
)
{
zlo
=
nz
.
m
<<
d
;
zhi
=
nz
.
m
>>
(
64
-
d
)
;
zhi
=
nz
.
m
>>
64
-
d
;
}
else
{
zlo
=
0
;
zhi
=
nz
.
m
;
...
...
@@ -77,7 +77,7 @@ double fma(double x, double y, double z)
d
-=
64
;
if
(
d
==
0
)
{
}
else
if
(
d
<
64
)
{
rlo
=
rhi
<<
(
64
-
d
)
|
rlo
>>
d
|
!!
(
rlo
<<
(
64
-
d
)
);
rlo
=
rhi
<<
64
-
d
|
rlo
>>
d
|
!!
(
rlo
<<
64
-
d
);
rhi
=
rhi
>>
d
;
}
else
{
rlo
=
1
;
...
...
@@ -90,7 +90,7 @@ double fma(double x, double y, double z)
if
(
d
==
0
)
{
zlo
=
nz
.
m
;
}
else
if
(
d
<
64
)
{
zlo
=
nz
.
m
>>
d
|
!!
(
nz
.
m
<<
(
64
-
d
)
);
zlo
=
nz
.
m
>>
d
|
!!
(
nz
.
m
<<
64
-
d
);
}
else
{
zlo
=
1
;
}
...
...
@@ -122,7 +122,7 @@ double fma(double x, double y, double z)
e
+=
64
;
d
=
a_clz_64
(
rhi
)
-
1
;
/* note: d > 0 */
rhi
=
rhi
<<
d
|
rlo
>>
(
64
-
d
)
|
!!
(
rlo
<<
d
);
rhi
=
rhi
<<
d
|
rlo
>>
64
-
d
|
!!
(
rlo
<<
d
);
}
else
if
(
rlo
)
{
d
=
a_clz_64
(
rlo
)
-
1
;
if
(
d
<
0
)
...
...
@@ -173,7 +173,7 @@ double fma(double x, double y, double z)
}
else
{
/* only round once when scaled */
d
=
10
;
i
=
(
rhi
>>
d
|
!!
(
rhi
<<
(
64
-
d
)
)
)
<<
d
;
i
=
(
rhi
>>
d
|
!!
(
rhi
<<
64
-
d
)
)
<<
d
;
if
(
sign
)
i
=
-
i
;
r
=
i
;
...
...
porting/liteos_a/kernel/src/math/lgammaf_r.c
浏览文件 @
a1c90519
...
...
@@ -105,8 +105,7 @@ static float sin_pi(float x)
float
__lgammaf_r
(
float
x
,
int
*
signgamp
)
{
union
{
float
f
;
uint32_t
i
;}
u
=
{
x
};
float
nadj
=
0
;
float
t
,
y
,
z
,
p
,
p1
,
p2
,
p3
,
q
,
r
,
w
;
float
t
,
y
,
z
,
nadj
,
p
,
p1
,
p2
,
p3
,
q
,
r
,
w
;
uint32_t
ix
;
int
i
,
sign
;
...
...
porting/liteos_a/kernel/src/multibyte/mbtowc.c
浏览文件 @
a1c90519
...
...
@@ -24,21 +24,21 @@ int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n)
if
(
n
<
4
&&
((
c
<<
(
6
*
n
-
6
))
&
(
1U
<<
31
)))
goto
ilseq
;
if
(
OOB
(
c
,
*
s
))
goto
ilseq
;
c
=
(
c
<<
6
)
|
(
*
s
++-
0x80
)
;
c
=
c
<<
6
|
*
s
++-
0x80
;
if
(
!
(
c
&
(
1U
<<
31
)))
{
*
wc
=
c
;
return
2
;
}
if
(
*
s
-
0x80u
>=
0x40
)
goto
ilseq
;
c
=
(
c
<<
6
)
|
(
*
s
++-
0x80
)
;
c
=
c
<<
6
|
*
s
++-
0x80
;
if
(
!
(
c
&
(
1U
<<
31
)))
{
*
wc
=
c
;
return
3
;
}
if
(
*
s
-
0x80u
>=
0x40
)
goto
ilseq
;
*
wc
=
(
c
<<
6
)
|
(
*
s
++-
0x80
)
;
*
wc
=
c
<<
6
|
*
s
++-
0x80
;
return
4
;
ilseq:
...
...
porting/liteos_a/kernel/src/prng/rand.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 <stdlib.h>
#include <stdint.h>
void
srand
(
unsigned
s
)
{
return
srandom
(
s
);
}
int
rand
(
void
)
{
return
random
();
}
porting/liteos_a/kernel/src/sched/sched_yield.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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 <sched.h>
#include "los_process.h"
int
sched_yield
()
{
(
void
)
LOS_TaskYield
();
return
0
;
}
porting/liteos_a/kernel/src/stdio/__stdio_close.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <unistd.h>
#ifndef LOSCFG_FS_VFS
#define close(...) (-1)
#endif
int
__stdio_close
(
FILE
*
f
)
{
...
...
porting/liteos_a/kernel/src/stdio/__stdio_seek.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#ifdef LOSCFG_FS_VFS
#include <fs/fs.h>
static
off64_t
__stdio_lseek64
(
int
fd
,
int
offsetHigh
,
int
offsetLow
,
off64_t
*
result
,
int
whence
)
{
off64_t
ret
;
struct
file
*
filep
=
NULL
;
off64_t
offset
=
((
off64_t
)
offsetHigh
<<
32
)
+
(
uint
)
offsetLow
;
/* 32: offsetHigh is high 32 bits */
/* Get the file structure corresponding to the file descriptor. */
ret
=
fs_getfilep
(
fd
,
&
filep
);
if
(
ret
<
0
)
{
/* The errno value has already been set */
return
(
off64_t
)
-
get_errno
();
}
/* libc seekdir function should set the whence to SEEK_SET, so we can discard
* the whence argument here */
if
(
filep
->
f_oflags
&
O_DIRECTORY
)
{
/* defensive coding */
if
(
filep
->
f_dir
==
NULL
)
{
return
(
off64_t
)
-
EINVAL
;
}
if
(
offsetLow
==
0
)
{
rewinddir
(
filep
->
f_dir
);
}
else
{
seekdir
(
filep
->
f_dir
,
offsetLow
);
}
ret
=
telldir
(
filep
->
f_dir
);
if
(
ret
<
0
)
{
return
(
off64_t
)
-
get_errno
();
}
goto
out
;
}
/* Then let file_seek do the real work */
ret
=
file_seek64
(
filep
,
offset
,
whence
);
if
(
ret
<
0
)
{
return
(
off64_t
)
-
get_errno
();
}
out:
*
result
=
ret
;
return
0
;
}
off_t
__stdio_seek
(
FILE
*
f
,
off_t
off
,
int
whence
)
{
off_t
result
=
0
;
return
__stdio_lseek64
(
f
->
fd
,
off
>>
32
,
off
,
&
result
,
whence
)
?
-
1
:
result
;
}
#else
off_t
__stdio_seek
(
FILE
*
f
,
off_t
off
,
int
whence
)
{
return
0
;
return
_lseek64
(
f
->
fd
,
off
>>
32
,
off
,
&
result
,
whence
)
?
-
1
:
result
;
}
#endif
porting/liteos_a/kernel/src/stdio/__stdio_write.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <sys/uio.h>
#ifndef LOSCFG_FS_VFS
#define writev(...) (-1)
#endif
size_t
__stdio_write
(
FILE
*
f
,
const
unsigned
char
*
buf
,
size_t
len
)
{
struct
iovec
iovs
[
2
]
=
{
...
...
porting/liteos_a/kernel/src/stdio/__stdout_write.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <sys/ioctl.h>
#ifndef LOSCFG_FS_VFS
static
int
_ioctl
(
int
fd
,
int
cmd
,
...)
{
return
-
1
;
}
#define ioctl _ioctl
#endif
size_t
__stdout_write
(
FILE
*
f
,
const
unsigned
char
*
buf
,
size_t
len
)
{
struct
winsize
wsz
;
if
(
!
(
f
->
flags
&
F_SVB
)
&&
ioctl
(
f
->
fd
,
TIOCGWINSZ
,
&
wsz
))
{
f
->
lbf
=
EOF
;
}
return
__stdio_write
(
f
,
buf
,
len
);
struct
winsize
wsz
;
f
->
write
=
__stdio_write
;
if
(
!
(
f
->
flags
&
F_SVB
)
&&
ioctl
(
f
->
fd
,
TIOCGWINSZ
,
&
wsz
))
f
->
lbf
=
EOF
;
return
__stdio_write
(
f
,
buf
,
len
);
}
porting/liteos_a/kernel/src/stdio/__toread.c
浏览文件 @
a1c90519
...
...
@@ -11,4 +11,9 @@ int __toread(FILE *f)
}
f
->
rpos
=
f
->
rend
=
f
->
buf
+
f
->
buf_size
;
return
(
f
->
flags
&
F_EOF
)
?
EOF
:
0
;
}
\ No newline at end of file
}
hidden
void
__toread_needs_stdio_exit
()
{
__stdio_exit_needed
();
}
porting/liteos_a/kernel/src/stdio/__towrite.c
浏览文件 @
a1c90519
...
...
@@ -16,3 +16,8 @@ int __towrite(FILE *f)
return
0
;
}
hidden
void
__towrite_needs_stdio_exit
()
{
__stdio_exit_needed
();
}
porting/liteos_a/kernel/src/stdio/fclose.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <stdlib.h>
#ifdef LOSCFG_LLTSER
#include "gcov_ser.h"
#endif
static
void
dummy
(
FILE
*
f
)
{
}
weak_alias
(
dummy
,
__unlist_locked_file
);
int
fclose
(
FILE
*
f
)
{
#ifdef LOSCFG_LLTSER
GCOV_FCLOSE
(
fp
);
#endif
int
r
;
FLOCK
(
f
);
...
...
porting/liteos_a/kernel/src/stdio/fopen.c
浏览文件 @
a1c90519
...
...
@@ -4,15 +4,9 @@
#include <string.h>
#include <errno.h>
#include <limits.h>
#ifdef LOSCFG_LLTSER
#include "gcov_ser.h"
#endif
FILE
*
fopen
(
const
char
*
restrict
filename
,
const
char
*
restrict
mode
)
{
#ifdef LOSCFG_LLTSER
GCOV_FOPEN
(
filename
);
#endif
FILE
*
f
;
int
fd
;
int
flags
;
...
...
porting/liteos_a/kernel/src/stdio/fread.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <string.h>
#ifdef LOSCFG_LLTSER
#include "gcov_ser.h"
#endif
#define MIN(a,b) ((a)<(b) ? (a) : (b))
...
...
@@ -13,9 +10,7 @@ size_t fread(void *restrict destv, size_t size, size_t nmemb, FILE *restrict f)
if
(
!
size
)
nmemb
=
0
;
FLOCK
(
f
);
#ifdef LOSCFG_LLTSER
GCOV_FREAD
(
f
,
destv
,
size
,
nmemb
);
#endif
f
->
mode
|=
f
->
mode
-
1
;
if
(
f
->
rpos
!=
f
->
rend
)
{
...
...
porting/liteos_a/kernel/src/stdio/fwrite.c
浏览文件 @
a1c90519
#include "stdio_impl.h"
#include <string.h>
#ifdef LOSCFG_LLTSER
#include "gcov_ser.h"
#endif
size_t
__fwritex
(
const
unsigned
char
*
restrict
s
,
size_t
l
,
FILE
*
restrict
f
)
{
...
...
@@ -30,9 +27,6 @@ size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
size_t
fwrite
(
const
void
*
restrict
src
,
size_t
size
,
size_t
nmemb
,
FILE
*
restrict
f
)
{
#ifdef LOSCFG_LLTSER
GCOV_FWRITE
(
f
,
src
,
size
,
nmemb
);
#endif
size_t
k
,
l
=
size
*
nmemb
;
if
(
!
size
)
nmemb
=
0
;
FLOCK
(
f
);
...
...
porting/liteos_a/kernel/src/stdio/ungetc.c
浏览文件 @
a1c90519
...
...
@@ -16,5 +16,5 @@ int ungetc(int c, FILE *f)
f
->
flags
&=
~
F_EOF
;
FUNLOCK
(
f
);
return
c
;
return
(
unsigned
char
)
c
;
}
porting/liteos_a/kernel/src/stdio/vfprintf.c
浏览文件 @
a1c90519
...
...
@@ -20,12 +20,12 @@
/* Convenient bit representation for modifier flags, which all fall
* within 31 codepoints of the space character. */
#define ALT_FORM (1U<<
('#'-' ')
)
#define ZERO_PAD (1U<<
('0'-' ')
)
#define LEFT_ADJ (1U<<
('-'-' ')
)
#define PAD_POS (1U<<
(' '-' ')
)
#define MARK_POS (1U<<
('+'-' ')
)
#define GROUPED (1U<<
('\''-' ')
)
#define ALT_FORM (1U<<
'#'-' '
)
#define ZERO_PAD (1U<<
'0'-' '
)
#define LEFT_ADJ (1U<<
'-'-' '
)
#define PAD_POS (1U<<
' '-' '
)
#define MARK_POS (1U<<
'+'-' '
)
#define GROUPED (1U<<
'\''-' '
)
#define FLAGMASK (ALT_FORM|ZERO_PAD|LEFT_ADJ|PAD_POS|MARK_POS|GROUPED)
...
...
@@ -191,8 +191,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
char
buf
[
9
+
LDBL_MANT_DIG
/
4
],
*
s
;
const
char
*
prefix
=
"-0X+0X 0X-0x+0x 0x"
;
int
pl
;
char
ebuf0
[
3
*
sizeof
(
int
)],
*
ebuf
=&
ebuf0
[
3
*
sizeof
(
int
)];
char
*
estr
=
NULL
;
char
ebuf0
[
3
*
sizeof
(
int
)],
*
ebuf
=&
ebuf0
[
3
*
sizeof
(
int
)],
*
estr
;
pl
=
1
;
if
(
signbit
(
y
))
{
...
...
@@ -297,7 +296,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
uint32_t
carry
=
0
,
*
b
;
int
sh
=
MIN
(
9
,
-
e2
),
need
=
1
+
(
p
+
LDBL_MANT_DIG
/
3U
+
8
)
/
9
;
for
(
d
=
a
;
d
<
z
;
d
++
)
{
uint32_t
rm
=
*
d
&
(
(
1
<<
sh
)
-
1
)
;
uint32_t
rm
=
*
d
&
(
1
<<
sh
)
-
1
;
*
d
=
(
*
d
>>
sh
)
+
carry
;
carry
=
(
1000000000
>>
sh
)
*
rm
;
}
...
...
@@ -486,8 +485,8 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
}
/* Read modifier flags */
for
(
fl
=
0
;
(
unsigned
)
*
s
-
' '
<
32
&&
(
FLAGMASK
&
(
1U
<<
(
*
s
-
' '
)
));
s
++
)
fl
|=
1U
<<
(
*
s
-
' '
)
;
for
(
fl
=
0
;
(
unsigned
)
*
s
-
' '
<
32
&&
(
FLAGMASK
&
(
1U
<<
*
s
-
' '
));
s
++
)
fl
|=
1U
<<
*
s
-
' '
;
/* Read field width */
if
(
*
s
==
'*'
)
{
...
...
porting/liteos_a/kernel/src/stdlib/strtol.c
浏览文件 @
a1c90519
...
...
@@ -53,4 +53,4 @@ weak_alias(strtoul, __strtoul_internal);
weak_alias
(
strtoll
,
__strtoll_internal
);
weak_alias
(
strtoull
,
__strtoull_internal
);
weak_alias
(
strtoimax
,
__strtoimax_internal
);
weak_alias
(
strtoumax
,
__strtoumax_internal
);
\ No newline at end of file
weak_alias
(
strtoumax
,
__strtoumax_internal
);
porting/liteos_a/kernel/src/string/memchr.c
浏览文件 @
a1c90519
...
...
@@ -6,7 +6,7 @@
#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
void
*
memchr
(
const
void
*
src
,
int
c
,
size_t
n
)
{
...
...
@@ -18,7 +18,7 @@ void *memchr(const void *src, int c, size_t n)
typedef
size_t
__attribute__
((
__may_alias__
))
word
;
const
word
*
w
;
size_t
k
=
ONES
*
c
;
for
(
w
=
(
const
void
*
)
s
;
(
n
>=
SS
)
&&
!
HASZERO
(
*
w
^
k
);
w
++
,
n
-=
SS
);
for
(
w
=
(
const
void
*
)
s
;
n
>=
SS
&&
!
HASZERO
(
*
w
^
k
);
w
++
,
n
-=
SS
);
s
=
(
const
void
*
)
w
;
}
#endif
...
...
porting/liteos_a/kernel/src/string/stpcpy.c
浏览文件 @
a1c90519
...
...
@@ -5,7 +5,7 @@
#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
char
*
__stpcpy
(
char
*
restrict
d
,
const
char
*
restrict
s
)
{
...
...
porting/liteos_a/kernel/src/string/stpncpy.c
浏览文件 @
a1c90519
...
...
@@ -5,7 +5,7 @@
#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
char
*
__stpncpy
(
char
*
restrict
d
,
const
char
*
restrict
s
,
size_t
n
)
{
...
...
@@ -17,7 +17,7 @@ char *__stpncpy(char *restrict d, const char *restrict s, size_t n)
for
(;
((
uintptr_t
)
s
&
ALIGN
)
&&
n
&&
(
*
d
=*
s
);
n
--
,
s
++
,
d
++
);
if
(
!
n
||
!*
s
)
goto
tail
;
wd
=
(
void
*
)
d
;
ws
=
(
const
void
*
)
s
;
for
(;
(
n
>=
sizeof
(
size_t
)
)
&&
!
HASZERO
(
*
ws
);
for
(;
n
>=
sizeof
(
size_t
)
&&
!
HASZERO
(
*
ws
);
n
-=
sizeof
(
size_t
),
ws
++
,
wd
++
)
*
wd
=
*
ws
;
d
=
(
void
*
)
wd
;
s
=
(
const
void
*
)
ws
;
}
...
...
@@ -29,3 +29,4 @@ tail:
}
weak_alias
(
__stpncpy
,
stpncpy
);
porting/liteos_a/kernel/src/string/strchrnul.c
浏览文件 @
a1c90519
...
...
@@ -5,7 +5,7 @@
#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
char
*
__strchrnul
(
const
char
*
s
,
int
c
)
{
...
...
porting/liteos_a/kernel/src/string/strlcpy.c
浏览文件 @
a1c90519
...
...
@@ -6,7 +6,7 @@
#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
size_t
strlcpy
(
char
*
d
,
const
char
*
s
,
size_t
n
)
{
...
...
porting/liteos_a/kernel/src/string/strlen.c
浏览文件 @
a1c90519
...
...
@@ -5,7 +5,7 @@
#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((
(x)-ONES)
& ~(x) & HIGHS)
#define HASZERO(x) ((
x)-ONES
& ~(x) & HIGHS)
size_t
strlen
(
const
char
*
s
)
{
...
...
porting/liteos_a/kernel/src/time/__tz.c
浏览文件 @
a1c90519
...
...
@@ -219,7 +219,7 @@ weak_alias(__tzset, tzset);
const
char
*
__tm_to_tzname
(
const
struct
tm
*
tm
)
{
const
void
*
p
=
tm
->
tm_zone
;
const
void
*
p
=
tm
->
__
tm_zone
;
LOCK
();
do_tzset
();
if
(
p
!=
__utc
&&
p
!=
__tzname
[
0
]
&&
p
!=
__tzname
[
1
]
&&
...
...
porting/liteos_a/kernel/src/time/strftime.c
浏览文件 @
a1c90519
...
...
@@ -278,4 +278,4 @@ size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct
return
__strftime_l
(
s
,
n
,
f
,
tm
,
CURRENT_LOCALE
);
}
weak_alias
(
__strftime_l
,
strftime_l
);
\ No newline at end of file
weak_alias
(
__strftime_l
,
strftime_l
);
porting/liteos_a/kernel/src/time/time.c
已删除
100644 → 0
浏览文件 @
53a0d8a1
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 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_typedef.h"
#include <time.h>
#include <sys/time.h>
time_t
time
(
time_t
*
t
)
{
struct
timeval
tp
;
int
ret
;
/* Get the current time from the system */
ret
=
gettimeofday
(
&
tp
,
(
struct
timezone
*
)
NULL
);
if
(
ret
==
LOS_OK
)
{
/* Return the seconds since the epoch */
if
(
t
)
{
*
t
=
tp
.
tv_sec
;
}
return
tp
.
tv_sec
;
}
return
(
time_t
)
OS_ERROR
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录