chenzhijia
1086a05e50
libc/sysconf: add _SC_GETPW_R_SIZE_MAX
...
pass tlpi example: https://man7.org/tlpi/code/online/dist/users_groups/t_getpwnam_r.c.html
Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 09:05:45 +08:00
zhanghongyu
dab55ef6e2
unistd.h: Adds some posix supported definitions.
...
resolve compilation and functional errors caused by posix definitions
check of third-party libraries.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-19 20:47:49 +08:00
chenrun1
5c6bd833ed
fs_lock:Implementing file locks
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
dongjiuzhu1
73dc8f84cc
fs/dup3: impletement dup3/nx_dup3_from_tcb function
...
refs: https://man7.org/linux/man-pages/man2/dup.2.html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-27 21:15:07 +08:00
guohao15
2bce0f404c
fs:add syncfs api for sync whole fs data
...
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2023-09-23 15:58:00 +08:00
guoshichao
6683699c70
unistd: add _POSIX_SEMAPHORES definition
...
add _POSIX_SEMAPHORES definition can make the ltp testcase:
ltp_functional_semaphores_sem_conpro,
ltp_functional_semaphores_sem_philosopher,
ltp_functional_semaphores_sem_lock,
ltp_stress_semaphores_multi_con_pro,
ltp_functional_semaphores_sem_readerwriter,
ltp_functional_semaphores_sem_sleepingbarber
passed
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-19 09:37:49 +08:00
fangxinyong
2bf434214e
libc/sysconf: add _SC_REALTIME_SIGNALS
...
pass ltp case: open_posix_testsuite/conformance/interfaces/sigwait/7-1.c
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
yangyalei
3721af647a
Add _POSIX_THREAD_PRIORITY_SCHEDULING define
...
fix ltp_pthread_rwlock_rdlock_2_2 testcase error:
nsh> ltp_pthread_rwlock_rdlock_2_2
Posix Thread Execution Scheduling not supported
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
guoshichao
79af1cdfe6
libs/libc/getpgid: add getpgid implementation
...
1. the getpgid function can help to pass the
ltp/open_posix_testsuite/killpg related testcases
2. NuttX do not support process group, so we use the process id as
process group id
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-13 19:37:35 +08:00
guoshichao
c33d1c9c97
sched/task/fork: add fork implementation
...
1. as we can use fork to implement vfork, so we rename the vfork to
fork, and use the fork method as the base to implement vfork method
2. create the vfork function as a libc function based on fork
function
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-12 02:27:37 +08:00
guoshichao
42f8308423
sched/clock/clock_getres: add two CPUTIME_ID res support
...
1. make the clock_getres can pass the
ltp/open_posix_testsuite/clock_getres 7-1, 8-1 two cases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 23:11:00 +03:00
guoshichao
d5f45dc33b
libs/libc/aio: fix aio_cancel compatible issue
...
1. make the aio_cancel implementation can pass the
ltp/open_posix_testsuite/aio_cancel testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_cancel.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 23:25:33 +08:00
guoshichao
3821ad514d
libs/libc/unistd: add getpgrp function
...
1. the getpgrp function can help to pass the ltp/open_posix_teststuite/killpg related testcases
2. Nuttx do not support process group, so we use getpid to implement this
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-26 01:03:36 +08:00
anjiahao
d5981375a6
Support gcc FORTIFY_SOURCE features for nuttx libc
...
This function will use gcc's function
__builtin_dynamic_object_size and __builtin_object_size
Its function is to obtain the size of the object through compilation,
so as to judge whether there are out-of-bounds operations in commonly used functions.
It should be noted that the option -O2 and above is required to enable this function
Signed-off-by: anjiahao <1090959677@qq.com>
2023-06-22 20:38:45 +08:00
Xiang Xiao
92b2f1bd3d
fs: Undefine CONFIG_FS_LARGEFILE if compiler doesn't support long long
...
to simplify the large file check in many place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-02 09:37:58 +01:00
Xiang Xiao
97e994a1f9
Move SEEK_xxx from unistd.h to sys/types.h
...
so fcntl.h, stdio.h and unistd.h could get these definiton:
https://en.cppreference.com/w/c/io/fseek
https://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.html
https://pubs.opengroup.org/onlinepubs/007904975/functions/lseek.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-07 12:16:22 +02:00
dongjiuzhu1
63e6f80fb0
sync: add sync api
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 12:15:05 +02:00
dongjiuzhu1
14f8a6c2dd
fs: support openat/fchmodat/mkfifoat/fstatat/...at api
...
Refs to:
https://linux.die.net/man/2/openat
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 03:45:38 +08:00
Stuart Ianna
a2a542562f
fs: Implment link as a normal function instead macro
...
so "using ::link;" can pass the compiling. This change also
simplify the implementation of the hard link in the future.
2023-02-04 18:31:23 -03:00
Xiang Xiao
9ae3f4cf17
fs: Map syncfs to fsync
...
https://linux.die.net/man/2/syncfs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 09:28:04 -03:00
Xiang Xiao
19bded4738
fs: Remove the unused nx_pipe to prefer file_pipe for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Jiuzhu Dong
4dbf4555eb
fs/dir: support fchdir and dirfd
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Xiang Xiao
49eb2bd415
libc: Implement execvp, execlp and execvpe as macro
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-22 10:40:31 +03:00
Xiang Xiao
55b5561fdb
sched/task: Implement execle and execve
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-22 10:40:31 +03:00
Xiang Xiao
de0dd2f569
libc: implement getentropy function
...
specify here:
https://man7.org/linux/man-pages/man3/getentropy.3.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-25 13:48:33 +02:00
Xiang Xiao
eea014efb7
Fix error: conflicting types for built-in function 'execl'; expected 'int(const char *, const char *, ...)
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-18 16:38:01 +02:00
Norman Rasmussen
df956b08f2
Ensure that sethostname null terminates the hostname correctly
...
commit e1c306f2dd
added sethostname using
strncpy. This replaces it with strlcpy and uses sizeof() instead of
re-calculating the buffer size.
Rename size argument for get/sethostname to match the implementation
2021-12-30 01:13:22 +08:00
Xiang Xiao
965f7641fd
sched: Remove the condition guard from getppid prototype
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 08:11:08 -03:00
Xiang Xiao
4262b09cbf
libc: Implement terminal api regardless of CONFIG_SERIAL_TERMIOS setting
...
since many functions aren't related to termios directly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 08:11:08 -03:00
anjiahao
624b8d0776
add MAXHOSTNAMELEN in headfile
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-11-24 22:49:09 -06:00
Xiang Xiao
319474b1b1
fs: Change off_t and related types to int64_t if long long is supported
...
since it is very popular that the storage capcacity is large than 4GB
even in the embedded system:
https://www.opengroup.org/platform/lfs.html
https://en.wikipedia.org/wiki/Large-file_support
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I019dc08aff02f9ea01eb6d750033bbc358994da5
2021-08-04 06:48:30 -07:00
Xiang Xiao
307cc61893
fs: Add fchstat and chstat callback into mountpt_operations
...
and implement all status related change function. the individual
file system change will provide in other upcoming patchset.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4
2021-07-29 06:33:49 -03:00
Xiang Xiao
2fa1e55628
libc: Implement ttyname and ttyname_r
...
Note: this patch can get file path from root pseudo file handle,
but a general infrastructure is setup for other file system too.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86cd79ebb741f2f43fdd398bb7498c40687d949b
2021-07-09 18:23:34 -03:00
Xiang Xiao
9cc41f44f0
libc/sched: Implement nice API
...
Specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/nice.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib25be28c8dc1c9288e8c78ad756c91ec6ef325a7
2021-06-24 08:50:48 -03:00
Brennan Ashton
e945f2da86
Add define for _POSIX_TIMEOUTS
2021-04-11 01:50:34 -05:00
Gregory Nutt
2ccc0da0c7
Move getopt() variables into TLS
...
getopt() in the FLAT build environment is not thread safe. This is because global variables that are process-specific in Unix are truly global in the FLAT build. Moving the getopt() variables into TLS resolves this issue.
No side-effects are expected other than to getopt()
Tested with sim:nsh
2021-03-31 21:13:01 -05:00
Alin Jerpelea
9b9be7e1f0
include: Author: Gregory Nutt: update licenses to Apache 2.0
...
Update files from Gregory Nutt to Apache 2.0 license.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-04 03:33:58 -08:00
Xiang Xiao
085619d395
libc: Implement getppid
...
as specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/getppid.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-20 16:40:14 -03:00
Xiang Xiao
af53bdb048
libc: Add opterr global variable
...
defined here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-21 07:01:08 -06:00
liuhaitao
fd94a32468
sysconf: add _SC_PAGESIZE sysconf support
...
Also implement getpagesize() based on sysconf(_SC_PAGESIZE).
Change-Id: I812eb8f34ed602f7bc12c4cafafcebc0d98fd136
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-11-17 02:03:23 -08:00
chao.an
8604e98196
unistd/sched_sporadic: correct the disable value
...
Reference here:
https://github.com/openbsd/src/blob/master/include/unistd.h
Change-Id: Ifb08a69c9a2a2b68179bcfd716fb180ec3577e54
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 09:11:51 -03:00
chao.an
9db2e9e393
libs/unistd: add system variables of physical pages
...
Change-Id: If739b25d358c35de90115ae51e0c1bfbe7bd7a88
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 01:08:39 -07:00
chao.an
bf8446e235
sched/task: Implement gettid(2) syscall
...
See the reference here:
https://man7.org/linux/man-pages/man2/gettid.2.html
Change-Id: Ia814d0ccc3b20d8dfc36c809682ddf6e21811d20
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:07:00 -07:00
chao.an
614ac5b0f2
libs/libc/unistd: Implement pipe2(2) syscall
...
See the reference here:
https://www.man7.org/linux/man-pages/man2/pipe2.2.html
Change-Id: Ife19b9bdbde73c7421be381a094da67017819e63
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:01:26 -07:00
ligd
57dfb98713
include: add dependence to setvbuf & isatty, undefine symbols when !CONFIG_SERIAL_TERMIOS
...
Change-Id: I053504fcfc90d926e6f529bfd7badedc71596313
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-15 10:28:21 -03:00
Xiang Xiao
1bca457b28
libc: Always declare getenv, link/symlink and atexit/on_exit
...
since many c++ library implementation reference these symbols by using ::xxx but never
really use them, the declaration avoid the unused code is pulled into the final binary
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd7bf9a1e09b77a6b21f900cd3ede08a1cc82d86
2020-07-08 12:07:22 +01:00
Xiang Xiao
651eefc8f7
fs: Rename link to symlink
...
since the current implementation is really a symoblic link not hard link
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I59d30d0a620b0b5714fe91bbe90d4405cf53d187
2020-07-01 11:58:12 +02:00
Xiang Xiao
0b891d60f9
vfs: Define symlink as link
...
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/symlink.html
yes, symlink is different from link:
1.symlink create the soft(symbolic) link
2.link create the hard link
but it is suitable to make them same now since vfs doesn't support the
hard link and the soft link in file system level yet.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3b6e311cc1c826542165c9d93cbe5e078f113684
2020-06-30 13:09:58 -06:00
Xiang Xiao
977f04a2b1
libc: sysconf support _SC_NPROCESSORS_CONF/_SC_NPROCESSORS_ONLN
...
specified here:
https://www.man7.org/linux/man-pages/man3/sysconf.3.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I87fba8476221797e59c69c1953974bebc8d0d7b3
2020-06-27 22:43:13 +01:00
Xiang Xiao
d24bd782a9
libc: Implement pathconf and fpathconf
...
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/fpathconf.html
note: only _PC_PATH_MAX is handled now
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd323dc10e8f31f10dd1fc64f467227808c11dbd
2020-06-23 17:34:54 +01:00