The C standard library (libc) provides standard header files and common library implementations (such as input/output processing and string handling) in C language programming.
OpenHarmony uses musl as the libc. musl is a lightweight, fast, simple, and free open-source libc. For details, see musl libc Reference Manual.
For details about the differences between musl and glibc, see Functional differences from glibc.
C11 is implemented by libc, libm, and libdl.
libc: provides thread-related interfaces and a majority of standard interfaces.
libm: provides mathematical library interfaces. Currently, OpenHarmony provides a link to libm, and the interfaces are defined in libc.
libdl: provides dynamic linker interfaces such as dlopen. Currently, OpenHarmony provides a link to libdl, and the interfaces are defined in libc.
1.2.0
1.2.3 since OpenHarmony 4.0
1.2.5 since OpenHarmony 5.0
OpenHarmony provides header files and library interfaces that align with C99, C11, and POSIX standards, though not fully compliant. It supports Armv7-A, Arm64, and x86_64 architectures.
To better accommodate the basic features of OpenHarmony devices, such as high performance, low memory usage, high security, lightweight design, and multi-device adaptability, the musl library has been optimized and enhanced, with interfaces unsuitable for embedded devices removed according.
The libc provides dynamic enabling of debug logging (disabled by default). The debug logs help you learn about exceptions of the libc. With this function, you only need to set param, which eliminates the need for rebuilding the libc. However, you are advised not to enable debug logging in official versions because it affects the running performance.
Set musl.log.enable to true to enable printing of musl debug logs. You need to enable musl.log before printing other logs.
param set musl.log.enable true
The loader starts applications and invokes dlopen and dlclose in the libc. To view exceptions during the loading process, you need to enable the loader logging function. The following describes common operations.
param set musl.log.ld.app true
param set musl.log.ld.all false
param set musl.log.ld.app.{app_name} true
param set musl.log.ld.all true
param set musl.log.ld.app.{app_name} false
API | Description |
---|---|
epoll_create | In OpenHarmony 5.0, this API uses the same logic as in musl 1.2.3. Specifically, the API does not verify input parameters or process them if the input parameter value is less than or equal to 0. In the next version, this API will adopt the logic from musl 1.2.5, which includes input parameter verification. If the input parameter value is less than or equal to 0, the error code EINVAL will be returned. |
The following lists the character encoding formats and aliases supported by musl.
NOTE
The character conversion can be successful only when the source character encoding format is correct and the target character encoding format is supported. musl does not support the following target encoding formats: gb18030, gbk, gb2312, big5, and euckr.
Encoding Format | Alias | Supported by musl |
---|---|---|
utf8 | Yes | |
wchart | Yes | |
ucs2be | Yes | |
ucs2le | Yes | |
utf16be | Yes | |
utf16le | Yes | |
ucs4be | utf32be | Yes |
ucs4le | utf32le | Yes |
ascii | usascii, iso646, iso646us | Yes |
utf16 | Yes | |
ucs4 | utf32 | Yes |
ucs2 | Yes | |
eucjp | Yes | |
shiftjis | sjis, cp932 | Yes |
iso2022jp | Yes | |
gb18030 | Yes | |
gbk | Yes | |
gb2312 | Yes | |
big5 | bigfive, cp950, big5hkscs | Yes |
euckr | ksc5601, ksx1001, cp949 | Yes |
iso88591 | latin1 | Yes |
iso88592 | Yes | |
iso88593 | Yes | |
iso88594 | Yes | |
iso88595 | Yes | |
iso88596 | Yes | |
iso88597 | Yes | |
iso88598 | Yes | |
iso88599 | Yes | |
iso885910 | Yes | |
iso885911 | tis620 | Yes |
iso885913 | Yes | |
iso885914 | Yes | |
iso885915 | latin9 | Yes |
iso885916 | Yes | |
cp1250 | windows1250 | Yes |
cp1251 | windows1251 | Yes |
cp1252 | windows1252 | Yes |
cp1253 | windows1253 | Yes |
cp1254 | windows1254 | Yes |
cp1255 | windows1255 | Yes |
cp1256 | windows1256 | Yes |
cp1257 | windows1257 | Yes |
cp1258 | windows1258 | Yes |
koi8r | Yes | |
koi8u | Yes | |
cp437 | Yes | |
cp850 | Yes | |
cp866 | Yes | |
cp1047 | ibm1047 | Yes |
Native API Symbols Not Exported
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。