Commit Graph

460 Commits

Author SHA1 Message Date
Xiang Xiao
a0f2f6c362 fs: Move umask to task_info_s
and implement the related semantic correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0587341e2c505e41b5e24e55dba039ed200d65f2
2021-07-14 10:35:15 -03:00
chao.an
80b7394a95 sys/poll: add POLLRDHUP definition
Change-Id: I1117279d9a620138789256d699ae32d47eab3a90
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-12 16:13:40 -03:00
Xiang Xiao
ee767021b3 fs: Remove the inernal st_count field from struct stat
it's more simple to reuse the resolve argument as the recursive count

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I826b2fef3af8b12aae230e4766ab09f8de988f8a
2021-07-09 16:38:51 -03:00
Xiang Xiao
bae265274a libc: Move the declaration of futimens from sys/time.h to sys/stat.h
to follow the spec here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id8e418794bd43827c01af772ce704a8d3e7681c5
2021-07-09 15:51:28 -03:00
chao.an
441b03c61c board/ctrl: add BOARDCTL_UNIQUEKEY support
Add unique key to support get trusted data from the trusted field

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-07 08:23:23 -03:00
Huang Qi
50c08bf45b libc: Move pthread_key_destructor to task_info_s
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-04 07:36:44 -05:00
ligd
3cabd49d49 select: fix asan report error
vfs/fs_select.c:116:25: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
vfs/fs_select.c:153:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Change-Id: I2e32bb8a3db8ff5a5955b83b382ac2fa5756122c
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 13:09:52 -05:00
Xiang Xiao
55312052a7 sys/select.h: Should include sys/time.h instead of time.h
because struct timeval is defined in sys/time.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I767347fc3e0a4cdb3280307c7dfcac53fbddd24e
2021-06-23 17:35:53 +01:00
YAMAMOTO Takashi
b3e8535ad6 Revert "tls: Move pthread key destructor to libc"
This reverts commit cc514d7791.

* It introduced a regression.
  https://github.com/apache/incubator-nuttx/issues/3868

* It seems conceptually wrong to have per-process data in
  the main thread's stack.
2021-06-09 07:59:44 -05:00
Huang Qi
cc514d7791 tls: Move pthread key destructor to libc
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-06-06 15:25:56 -06:00
Xiang Xiao
ae216cf9e9 sched/task: Simplify the syscall handling of task_spawn
It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 12:45:10 +09:00
Jukka Laitinen
49409b516c include/sys/syscall_lookup.h: Fix table for nx_mkfifo
Fix compilation when CONFIG_DEV_PIPE_SIZE > 0 && CONFIG_DEV_FIFO_SIZE == 0

In this case the nx_mkfifo doesn't exist.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-05-25 01:37:20 -05:00
Huang Qi
d374d55926 pthread: Implement destructor of pthread_key_create
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I6aafba9680257cba071bf1f72ae2ec2c475f5fb0
2021-05-21 22:46:52 -06:00
Huang Qi
f4a0b7aedd libc: Call pthread_exit in user-space by up_pthread_exit
Drop to user-space in kernel/protected build with up_pthread_exit,
now all pthread_cleanup functions executed in user mode.

* A new syscall SYS_pthread_exit added
* A new tcb flag TCB_FLAG_CANCEL_DOING added
* up_pthread_exit implemented for riscv/arm arch

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Huang Qi
f1a92e9cbb libc: Move pthread_cleanup to user space
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Huang Qi
54eef9f639 libc: Move pthread_exit to userspace
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Gregory Nutt
bb9b58bdde libc: Move pthread_create to user space
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I5c447d94077debc79158686935f288e4c8e51e01
2021-05-21 22:46:52 -06:00
Huang Qi
45dc778865 sys/socket.h: Add "Socket"-level control message types
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I05f8dd29501f6b06cdd278e0e416f210a98aa6b0
2021-04-03 01:02:07 -05:00
Xiang Xiao
c82c7b6685 sys/stat.h: Add S_IREAD, S_IWRITE and S_IEXEC macro
to be more compatible with BSD libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4067f8cac6c465a3f1b06906e2e274a660792d93
2021-03-29 21:40:24 -03:00
Cis van Mierlo
ab38af02e9 boardctl: added pm_checkstate() function to BOARDIOC_PM_CONTROL 2021-03-25 19:14:44 -03:00
Matias N
75b13c8353 documentation: improve boardctl() docs 2021-03-25 19:03:49 -03:00
Cis van Mierlo
dc31b4f1c1 boardctl: added the option to change the pm state 2021-03-23 21:20:05 -07:00
Matheus Castello
85edf0f49d tools/version.sh: Add the remaining cut to VERSION
The idea is to have something like EXTRAVERSION. This is useful for
getting RC tags, development tags and for customizing the version. For
example using the tag `nuttx-10.0.0-RC0` the VERSION will be
`10.0.0-RC0`

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
2021-03-17 19:19:58 -03:00
Jiuzhu Dong
e96c8b9283 fs: allocate file/socket dynamically
Change-Id: I8aea63eaf0275f47f21fc8d5482b51ffecd5c906
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-17 06:46:42 -07:00
buyuer
c0f9c7b48c vfs: Fix epoll cannot work under 64-bit operating system
by switching to the real file handle

Signed-off-by: buyuer <dingddding@163.com>
2021-03-13 10:55:41 -08:00
Xiang Xiao
d2d7b6d24d net: Add sendmsg and recvmsg to syscall list
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-11 03:17:35 -08:00
Gustavo Henrique Nihei
330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
ligd
70442d1f9d net/socket_rpmsg: add net socket rpmsg support
Change-Id: Ie23ee4c0052cf2fc66972ea9bc5f11c070fbcf8a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-07 01:45:51 -08:00
Peter Bee
e223f60c09 net/socket: move si_send/recv into sendmsg/recvmsg
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.

Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-05 04:46:13 -08:00
Xiang Xiao
d9cfeb0bc3 sched: Don't forward gettid to getpid directly
prepare to implement the right semantics:
getpid should return the main thread id
gettid should return the current thread id
2021-03-04 17:17:41 -06:00
Jiuzhu Dong
4d5a964f29 net: unify socket into file descriptor
Change-Id: I9bcd21564e6c97d3edbb38aed1748c114160ea36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 19:01:41 -08:00
Gustavo Henrique Nihei
b9f231cdca include: Fix typos reported by codespell 2021-02-25 11:30:38 -08: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
Alin Jerpelea
861c0071bd include: nuttx: fix nxstyle errors
Fix nxstyle errors to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-04 03:33:58 -08:00
Xiang Xiao
98382dd8db sched: Add include/sys/poll.h
since many libc implementation(e.g. glibc, freebsd) provide this header file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-06 14:23:50 +08:00
danguanghua
7d33f73e27 libs/libc/net: implement socketpair
N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I959b4d661cd436f5d5050baf9e821db84139d482
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2021-01-03 20:56:27 -06: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
chao.an
859e1ce63a crypto/arc4random: rename getrandom to arc4random_buf
Change-Id: I5c9f0c9acf5af71f01beceaf06ebe0a2c87676bc
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-13 08:49:51 -06:00
Yoshinori Sugino
a5e00ac3f0 include/sys/wait.h: Modify P_GID to P_PGID
Summary:
 - Follow the POSIX description.

Impact:
 - No impact as P_GID and P_PGID are not used.

Testing:
 - Built with hifive1-revb:nsh
2020-12-04 11:40:46 -06:00
Xiang Xiao
bb8c4485a2 libc: Change OK/ERROR macro to enum
to avoid the conflict with 3rd party c++ library(e.g. protobuf):
fdc35840b9/src/google/protobuf/stubs/status.h (L47)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie8bb9008a8375c729f8b947c9f10baa80104d157
2020-11-30 09:43:18 +01:00
chao.an
27932faf1a sys/epoll: sync the epoll define with linux
Change-Id: If876e0c0b44de73cf2847a9d3c21ac138dd4f879
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 18:53:48 -08:00
chao.an
54d0c1c296 sys/uio: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:33:52 -08:00
chao.an
176d850445 sys/uio: include-able from C++ files
Change-Id: I4b512851fa96e1d696dbc886b25af4ab043da8dd
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:33:52 -08:00
chao.an
06d93828af sys/resource: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:22:34 -08:00
chao.an
82f1263db9 sys/resource: include-able from C++ files
Change-Id: I914ab40495a25da184d0b7f8f8b1fa0d376c66a4
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:22:34 -08:00
YAMAMOTO Takashi
e99e185712 Don't typedef wchar_t for C++
wchar_t is a builtin type in C++.

clang complains like the following even with -fshort-wchar:

    error: cannot combine with previous 'type-name' declaration specifier

my clang version if it matters:

    spacetanuki% clang++ --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    spacetanuki% clang++ -dM -E - < /dev/null | grep WCHAR
    #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
    #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
    #define __SIZEOF_WCHAR_T__ 4
    #define __WCHAR_MAX__ 2147483647
    #define __WCHAR_TYPE__ int
    #define __WCHAR_WIDTH__ 32
    spacetanuki% clang++ -fshort-wchar -dM -E - < /dev/null | grep WCHAR
    #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
    #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
    #define __SIZEOF_WCHAR_T__ 2
    #define __WCHAR_MAX__ 65535
    #define __WCHAR_TYPE__ unsigned short
    #define __WCHAR_UNSIGNED__ 1
    #define __WCHAR_WIDTH__ 16
    spacetanuki%
2020-11-01 18:19:13 -08:00
Juha Niskanen
1115452061 drivers/pipes: nx_pipe syscall takes three params, also use nx_close on error path
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-10-28 09:11:05 -07:00
Xiang Xiao
eb4121ce38 Change all 'Nuttx' to 'NuttX'
Unify the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Gregory Nutt
ebdfd16f0f Move gettid() implementation to /libs/libc/unistd
Move sched/task/task/task_gettid.c to libs/libc/unistd/lib_gettid.c.  gettid() is a dumb wrapper around getpid().  It is wasteful of resources to support TWO systme calls, one for getpid() and one for gettid().  Instead, move gettid() in the C library where it calls the single sysgtem call, getpid().  Much cleaner.
2020-09-22 19:40:56 -07:00
chao.an
0826b827ee libs/libc/time: add stub for futimes/ns(2)
Change-Id: I231817d10b9e2071b1f642e8694839b2a64b1c4c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 03:20:09 -07:00