Commit Graph

4514 Commits

Author SHA1 Message Date
Gregory Nutt
153eee6de2 Make more OS internal names consistent
1. Internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    # clock_systimer -> clock_systime_tick
    # clock_systimespec -> clock_systime_timespec
    sched_oneshot_extclk -> nxsched_oneshot_extclk
    sched_period_extclk -> nxsched_period_extclk
    # nxsem_setprotocol -> nxsem_set_protocol
    # nxsem_getprotocol -> nxsem_get_protocol
    # nxsem_getvalue -> nxsem_get_value
    nxsem_initholders -> nxsem_initialize_holders
    nxsem_addholder -> nxsem_add_holder
    nxsem_addholder_tcb -> nxsem_add_holder_tcb
    nxsem_boostpriority -> nxsem_boost_priority
    nxsem_releaseholder -> nxsem_release_holder
    nxsem_restorebaseprio -> nxsem_restore_baseprio

Some planned name changed were skipped for now because they effect too many files (and would require many hours of coding style fixups).
2020-05-10 22:47:07 +08:00
Gregory Nutt
fbbf1dffaf Fix minor spacing problems from 1017 and 1018 2020-05-09 22:09:12 +01:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Gregory Nutt
4301682fbc Fix up some problems/issues remaining from PR 1007
1. Add missing conditional logic in include/sys/syscall_lookup.h
2. CONFIG_NPTHREAD_KEYS removed from code but was still in sched/Kconfig
3. Refresh all configurations affected by PR 1007
4. syscall/syscall_funclookup.c needs to include nuttx/tls.h
2020-05-08 20:13:40 +01:00
Gregory Nutt
9ce03b1660 Move pthread-specific data into TLS
1. Move pthread-specific data files from sched/pthread/ to libs/libc/pthread.
2. Remove pthread-specific data functions from syscalls.
3. Implement tls_alloc() and tls_free() with system calls.
4. Reimplement pthread_key_create() and pthread_key_free() using tls_alloc() and tls_free().
5. Reimplement pthread_set_specific() and pthread_get_specicif() using tls_set_value() and tls_get_value()
2020-05-08 18:05:04 +01:00
Xiang Xiao
de33f86ae3 fs: Add nx_mount/nx_umount2 function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Xiang Xiao
4a3d28a957 fs: Move inode_checkflags from include/nuttx/fs/fs.h to fs/inode/inode.h
since this function is only used inside fs subsystem

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Gregory Nutt
3dca5eba15 Completes the Implementation of the TLS-based errno
- Remove per-thread errno from the TCB structure (pterrno)
- Remove get_errno() and set_errno() as functions.  The macros are still available as stubs and will be needed in the future if we need to access the errno from a different address environment (KERNEL mode).
- Add errno value to the tls_info_s structure definitions
- Move sched/errno to libs/libc/errno.  Replace old TCB access to the errno with TLS access to the errno.
2020-05-07 23:11:34 +01:00
Gregory Nutt
c2244a2382 Remove CONFIG_TLS
A first step in implementing the user-space error is force TLS to be enabled at all times.  It is no longer optional
2020-05-07 12:04:16 -06:00
Xiang Xiao
1ad03a5a13 syscall: Generate STUB prototype automatically
reduce the maintainance effort

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Xiang Xiao
32cec2a439 syscall: Generate SYS_ number from syscall_lookup.h
to reduce the maintainance effort

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Xiang Xiao
a2d924eea4 syscall: Fix typo error in cvs and header file
and reoder the entry in cvs file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Pelle
b525218b55 Changed headers for apache 2.0 license 2020-05-05 12:20:53 -06:00
Pelle
8a0b2bc14e Added driver for the hdc1008 temperature/humidity sensor. 2020-05-05 12:20:53 -06:00
Gregory Nutt
5c7a0bd9f0 Fix nxstyle complaints from files changed by this PR 2020-05-05 18:56:33 +01:00
Gregory Nutt
bda24f09c2 libs/libc/tls/tls_getinfo.c: Add tls_get_info()
Move the logic to get TLS information from an inline function to a normal function.  For the unaligned case, it is probably too large to be inlined.

Also fixes some minor things from review of previous commits.
2020-05-05 18:56:33 +01:00
Abdelatif Guettouche
b7e7fba732 TLS_UNALIGNED (#2)
* Implement the TLS_UNALIGNED
2020-05-05 18:56:33 +01:00
Xiang Xiao
d9d2fc0d0a debug: Reduce CONFIG_CPP_HAVE_VARARGS usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
6604cdb3f2 fs: Remove all LIBC_IOCTL_VARIADIC related stuff
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
32b79b22ec Rename pipe2/mkfifo2 to nx_pipe/nx_mkfifo
and don't modify errno anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
929292f57b mqueue: Add nxmq_open/nxmq_close/nxmq_unlink function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
de2a9d8a77 sched: add nx_wait, nx_waitid and nx_waitpid
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
390f9a5fb7 fs/vfs: Add nx_dup and nx_dup2 function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
1da8cd6b89 fs/vfs: Add nx_poll function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Gregory Nutt
252f58f6e9 sched/sched/sched_get_stackinfo.c: Add some security.
The sched_get_stackinfo() interface was just added.  However, it occurs to me that it is a dangerous feature and could lead to security problems.  In FLAT and PROTECTED modes, if you get access to any other threads stack, you could do harm.

This commit adds some level of security.  Basically, it implements these rules:

1. Any thread may query its own stack,
2. A kernel thread may query the stack of any other thread
3. Application threads, however, may query only the stacks of threads within the same task group, i.e., the main thread and any of the child pthreads created with the main thread as a parent or grandparent or great-grandpart ...
2020-05-04 01:13:11 +01:00
Gregory Nutt
00933cfece sched/sched: Add sched_get_stackinfo()
The new OS interface, sched_get_stackinfo() combines two pthread-specific interfaces into a single generic interface.  The existing pthread_get_stackaddr_np() and pthread_get_stacksize_np() are moved from sched/pthread to libs/libc/pthread.

There are two motivations for this change:  First, it reduces the number of system calls.  Secondly, it adds a common hook that is going to used for a future implementation of TLS.
2020-05-03 23:33:44 +01:00
Xiang Xiao
a2f6dc9b7c errno: Rename get_errno_ptr to __errno
Inrease the compatiblity with the third party library(e.g. newlib)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
8d1a0c2761 binfmt: exec_spawn as internal function shouldn't modify errno
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
4c680bfadc fs/vfs: Rename fdesc_poll to fs_poll
and reorder the function declaration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
4b5360362e fs/vfs: Add nx_ioctl/nx_fcntl function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
65308eabb4 fs/vfs: Add nx_stat function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
6418d13b92 fs/vfs: Add nx_close function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
7980673b59 fs/vfs: Add nx_seek function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
31c60c3b0e syscall: nx_task_spawn should exist in the flat build just like the protected build
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-02 09:56:23 -06:00
Xiang Xiao
f2aba8d9b7 build: Remove 'u' prefix from userspace library
so user needn't link the different library because the build type change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 15:56:55 -06:00
Xiang Xiao
1c024a6d39 Remove the argument from get_errno
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 12:22:03 -03:00
Xiang Xiao
f8a809eb5b Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
eca7059785 Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
fe5cb9529d builtin: Remove HAVE_BUILTIN_CONTEXT macro
it's enough to decide which code should be compiled with CONFIG_BUILTIN and CONFIG_FS_BINFS

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
YAMAMOTO Takashi
8b054dba98 sim: Update hostfs after the recent struct stat timespec changes
Fix it after the following change:

    commit bb4458b63f
    Author: Ouss4 <abdelatif.guettouche@gmail.com>
    Date:   Thu Apr 30 19:05:12 2020 +0100

        include/sys/stat.h: Per the POSIX standard, the atime, ctime and mtime field
    s
        have changed their type from time_t to struct timespec.
2020-05-01 17:42:46 +08:00
Ouss4
bb4458b63f include/sys/stat.h: Per the POSIX standard, the atime, ctime and mtime fields
have changed their type from time_t to struct timespec.
2020-04-30 12:10:22 -06:00
Marcelo Teider Lopes
40c990f4f3 Add missing Elf_Addr typedef
This fixes a compilation error when exceptions are enabled, as it
depends on the Elf_Addr symbol.
2020-04-30 08:46:21 -06:00
Ouss4
d0bb7c137a Use NuttX's signal set functions inside the OS. 2020-04-29 16:40:27 -06:00
Gregory Nutt
9400cf2cd1 sched/group: On task creation, do not clone uninitialized descriptors.
Sockets are created in two steps:

1. The socket is allocated, then
2. The socket is initialized.

In SMP mode, there is a possibility that a pthread executing one CPU may create a new task while a pthread on another CPU has allocated the socket but not yet initialized it.  This commit updates the socket clone test to assure that the socket is both allocated and initailized.

Without the change, it is possible that uninitialized sockets could be cloned, leading to errors later in the newly started task.
2020-04-28 21:27:05 +01:00
Xiang Xiao
67b10fea09 syslog/rpmsg: Fix warning: ‘syslog_rpmsg_write’ defined but not used
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-27 06:52:50 -06:00
Juha Niskanen
b34d7bf56d libc/netdb: support multiple DNS nameservers when not using resolv.conf
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-27 19:52:24 +08:00
zhongan
927cb00f5e fix nxstyle warning
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-26 19:53:43 -06:00
zhongan
546e35fc98 drivers/rptun: replace 'rxbuf_size' and 'txbuf_size' to 'buf_size' in struct 'rptun_rsc_s'.
Change-Id: I7c9da4bd985712a3fde4c56999901434740b33f7
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-26 19:53:43 -06:00
Masayuki Ishikawa
ad9db974cb mm: Fix heap corruption in protected build
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-04-22 13:45:56 +08:00
Alin Jerpelea
d9d720b296 audio: nxstyle fixes for core and drivers
nxstyle fixes for the audio core and drivers

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-04-21 17:19:52 -06:00