Commit Graph

1725 Commits

Author SHA1 Message Date
David Sidrane
9b4f238548 task_init.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
b001f12560 task_exithook.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
c1839a07aa task_exit.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
ffc7cfe59b task_execv.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
9bbf86a961 task_delete.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
39917b21bd task_cancelpt.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
c109610fe7 task_atexit.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
96e11e65b0 task_activate.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
a865e5ff7d task.h:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
dd92faafe9 exit.c:Fix style errors. 2020-03-08 07:28:04 -06:00
David Sidrane
b82ebdcd70 task_spawn:Fix style errors 2020-03-08 07:28:04 -06:00
David Sidrane
a3f99feed1 mqueue.h:Fix style errors 2020-03-08 07:28:04 -06:00
Gregory Nutt
23b8b39799 sched/group/group_setuptaskfiles.c: Fix bad file inclusion.
Also remove the horrible violation of the architectural rules by adding an include path into net in sched/group/Make.defs.  Folks, if you are going to participate in this project, you MUST respect the odule architecture and never, never, never do these things.

commit d07afc934e, "fcntl: add O_CLOEXEC/FD_CLOEXEC support" introduce a compilation error .. a bad file inclusion.  That commit added an unnecessary inclusion of "socket/socket.h" which is NOT available in the sched sub-directory. It is only available under the net/ sub-directory.

There is no include path for such and inclusion and there must NEVER be such a include path.  Module design forbids including header files between diffent "silos" in the design.  Nothing under net/ can ever be available to logic under sched/.
2020-03-05 00:49:12 +01:00
Gregory Nutt
3b53cd1e57 include/nuttx: Fix improper use of inline
I finally figured out why the ez80 code has gotten so big.  It is because people have been put putting big inline functions in header files.  That is a violation of the coding standard, since only c89 compatibility is required in all common code. But we have been tolerating inline function it because include/nuttx/compiler.h defines 'inline' to be nothing for C89 compilers.

As a result, static inline functions declared within a C file not so bad; the inline qualifier is ignored, if not supported, but otherwise all is well.

But it is catastrophic in header files.  Those static inline functions are included as static functions and implemented in EVERY file that includes those header files, even if the functions are never called.  That makes the code base huge!So there is another PR coming to fix some of the worst offenders.

This commit fixes two of the worst offenders I have encountered so far:  include/nuttx/sempahore.h and cache.h.  But there may be a few other changes needed.  Under include/nuttx there are still inline functions thread.h, inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h with no protection for compilers that do not handler the inline qualifier.  Otherwise we are clean.

With the changes to these two header files, the size of the z20x build is reduced by about 40%.  And incredible size savings.
2020-03-02 22:06:04 +01:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
chao.an
c06adf06b8 binfmt/exec: Make the spawn attribute take effect 2020-02-20 08:55:14 -06:00
chao.an
d07afc934e fcntl: add O_CLOEXEC/FD_CLOEXEC support 2020-02-20 08:20:38 -06:00
Ouss4
f8801e1bd8 libs/libc/unistd/lib_alarm.c,sched/timer/timer_getitimer.c: Silence a
warning with struct initialization.
2020-02-19 18:02:25 -06:00
Gregory Nutt
2ec59121fb Fix non C89 noncompliant code that was causing the ZDS-II compile to fail. 2020-02-19 23:09:10 +01:00
chao.an
52484b1b8c sched/Kconfig: add PATH_MAX config 2020-02-19 12:43:34 -06:00
Xiang Xiao
51a2171c71 ramlog: Remove g_ramlog_syslog_channel since it's same as g_default_channel
And remove syslog_init_e because all initialization is later now and we don't
distinguish the initialition phase anymore after ramlog don't need special
initialize.
2020-02-18 13:04:45 -06:00
Xiang Xiao
6b77f73583 arch: Move iob_initialize into nx_start just after heap initialization
it doesn't make sense that iob initialization is in up_initialize
but other memory components initialization is called in nx_start

Change-Id: Id43aeaa995f340c5943f59a0067a483ff3ac34a2
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-18 10:26:19 -03:00
Xiang Xiao
20a9a62fdf Make compare_timespec public so timer driver could reuse it 2020-02-15 07:17:07 -06:00
Juha Niskanen
15b78abccf Fix typos in comments 2020-02-14 08:50:45 -06:00
Xiang Xiao
2b5538d0e8 sched/init: Remove the duplicated tcb flag/cpu setting in nx_smp_start
The same thing is already done in nx_start
2020-02-09 07:41:02 -06:00
Xiang Xiao
6d69439f58 Call xxx_timer_initialize from clock subsystem
Call xxx_timer_initialize from clock subsystem to make timer ready for use as soon as possiblei and revert the workaround:

commit 0863e771a9
Author: Gregory Nutt <gnutt@nuttx.org>
Date:   Fri Apr 26 07:24:57 2019 -0600

    Revert "sched/clock/clock_initialize.c:  clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet."

    This reverts commit 2bc709d4b9.

    Commit 2bc709d4b9 was intended to handle the case where up_timer_gettime may not start from zero case.  However, this change has the side-effect of breaking every implementation of tickless mode:  After this change the tickless timer structures are used before they are initialized in clock_inittime().  Initialization happens later when up_initialize is called() when arm_timer_initialize().

    Since the tickless mode timer is very special, one solution might be to

    1. Rename xxx_timer_initialize to up_timer_initialize
    2  Move up_timer_initialize to include/nuttx/arch.h
    3.  Call it from clock subsystem instead up_initialize

    Basically, this change make timer initialization almost same as rtc initialization(up_rtc_initialize).

    For now, however, we just need to revert the change.
2020-02-08 07:40:06 -06:00
Xiang Xiao
76bbed07a4 Call up_irqinitialize from irq subsystem
Call up_irqinitialize from irq subsystem to make the irq ready for use as soon as possible
2020-02-08 07:39:22 -06:00
Masayuki Ishikawa
81f1133174 ELF64 support (#220)
* include: Introduce elf64.h and elf.h

    Added elf64.h for 64bit ELF support and moved common definitions
    from elf32.h to elf.h. Also introduced Elf_xxx to be used in
    common libraries such as binfmt.

  * binfmt, include, modlib, module: Add support for ELF64

    Elf_xxx must be used instead of Elf32_xxx to support ELF64.
    To use ELF64, CONFIG_ELF_64BIT must be enabled.

  * binfmt, modlib: Add support for relocate address

  * arch: risc-v: Add include/elf.h

  * libs: machine: Add risc-v related files.

    NOTE: Currently only supports ELF64

  * boards: maix-bit: Add elf and posix_spawn configurations

  * boards: maix-bit: Add support for module configuration
2020-02-07 17:10:23 -06:00
Gregory Nutt
7a5f92ec0c sched/sched/sched_getcpu.c: All new files should have Apache 2.0 headers. 2020-02-02 07:36:34 -08:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao
9f9566c0eb Rename net_clone/net_dupsd[2] to psock_dup2/net_dup[2] like vfs 2020-01-31 13:45:14 -06:00
Gregory Nutt
2def8035db sched/sched/sched_getcpu.c: Implement non-standard interface.
If SMP is enabled this function will return the number of the CPU that the thread is running on.  This is non-standard but follows GLIBC if __GNU_SOURCE is enabled.  The returned CPU number is, however, worthless since it returns the CPU number of the CPU that was executing the task when the function was called.  The application can never know the true CPU number of the CPU tht it is running on since that value is volatile and change change at any time.
2020-01-31 20:25:15 +00:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
YAMAMOTO Takashi
83354983c3 Fix "with with" typos
In many cases, remove one of them.
In a few places, it looks like a typo of "width" actually.
2020-01-27 08:46:46 +01:00
chao.an
5a53ed6e9c kwork/notifier: initialize the work handler
kworker dqueue corruption if the garbage in work->worker handler

Change-Id: Ice5e66e8ed080a7539d5fe02f946a66794cbda7d
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-22 10:05:28 +01:00
Juha Niskanen
a762c06ed9 Fix typos and some incorrect comments
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle against .c and .h files and fix it

Author: Juha Niskanen <juha.niskanen@haltian.com>

    Fix typos and some incorrect comments
2020-01-20 09:32:36 -03:00
raiden00pl
02f619a8be sched/signal/sig_default.c: fix compilation error when CONFIG_SIG_SIGPIPE_ACTION undefined 2020-01-15 08:04:37 -06:00
Gregory Nutt
cf5d17f795 tools/nxstyle: Added logic to parse section headers (#90)
* tools/nxstyle:  Added logic to parse section headers (like Included files, Pre-processor Definitions, etc.) and to assure that the section headers are correct for the file type.  Also (1) verify that #include appears only in the 'Included Files' section and that (2) #define only occurs in the Pre-processor definition section.

    Right now, there are several places where that rule is not followed.  I think most of these are acceptable so these failures only generate warnings, not errors.  The warning means that we need to go look at the offending #define or #include and decide if it is a acceptable usage or not.
2020-01-13 18:08:45 +00:00
Gregory Nutt
6309165fe0 tools/nxstyle.c: Add automatic detection of line width based on examining
the width of all block comments. Includes a check to assure that all block
comments use the same line width.

Verified against all .c files under /sched.  There were a few cosmetic changes to the coding style under /sched to account to new, correctly detected problems in the /sched files.
2020-01-12 13:07:54 -03:00
Masayuki Ishikawa
3f37dddea7 sched: timer: Fix inappropriate cast in timer_settime() 2020-01-08 09:06:55 -06:00
Alin Jerpelea
a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
patacongo
7136215930 sched_mergepending.c: Correct some errors in comments. (#38)
* Documentation/NuttXCCodingStandard.html:  Remove requirement to decorate ignored returned values with (void).

* sched_mergepending.c:  Correct some errors in comments.

Co-authored-by: Gregory Nutt <gnutt@nuttx.org>
2020-01-04 14:06:44 -03:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Xiang Xiao
90c52e6f8f Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>

    Run all .h and .c files modified in last PR through nxstyle.

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    Net cleanup (#17)

    * Fix the semaphore usage issue found in tcp/udp

    1. The count semaphore need disable priority inheritance
    2. Loop again if net_lockedwait return -EINTR
    3. Call nxsem_trywait to avoid the race condition
    4. Call nxsem_post instead of sem_post

    * Put the work notifier into free list to avoid the heap fragment in the long run.  Since the allocation strategy is encapsulated internally, we can even refine the implementation later.

    * Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include:

    1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer
    2. Remove the net lock since xxx_callback_free already do the same thing
    3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all

    * Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention

    * Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
2019-12-31 09:26:14 -06:00
Nathan Hartman
9655730ef8 Fix various typos and spelling errors. 2019-12-12 07:41:51 -06:00
Gregory Nutt
d2af57169b tools/nxstyle.c: Fix a rare false alarm that could occur if a variable or function name begins with the sub-string 'union' or 'struct'. misc fixes under fs/ and sched/ from application of current version of nxstyle. 2019-12-01 13:01:16 -06:00
Guillherme Amaral
d022b56b84 arch/arm/src/stm32f0l0g0/Kconfig: Select STM32F0L0G0_PWM when TIM{14-17}_PWM enabled. 2019-11-30 15:34:00 -06:00
Gregory Nutt
80a56e9f3d sched/signal/sig_dispatch.c: Extend some comments. 2019-11-30 14:08:47 -06:00
Gregory Nutt
4e277a7f62 sched/signal/sig_dispatch.c: Trivial update to a comment. 2019-11-29 10:01:42 -06:00
Gregory Nutt
81790f2ca8 sched/signal/sig_dispatch.c: Clarify some logic. It is not necessary to test the TCB's TCB_FLAG_SYSCALL if syscalls are not enabled. 2019-11-29 08:11:55 -06:00
Gregory Nutt
c4d10de565 Fix a warning found in build testing. 2019-11-28 14:53:17 -06:00
Gregory Nutt
69318b1024 Re-implements reverted commit 344f7bc9f6 in a way that should not have the undesired side-effect. include/nuttx/sched.h: Add a bit to the TCB flags to indicat the thread is a user thread in a syscall. sched/nuttx/nxsig_dispatch.c: Delay dispatching to signal handlers if within a system call. In all syscall implementations: Process delayed signal handling when exiting system call. 2019-11-28 12:47:36 -06:00
Gregory Nutt
ac1b96ba1e Update ReleaseNotes in preparation for the nuttx-8.2 release. 2019-11-16 08:23:09 -06:00
Juha Niskanen
99a501b668 drivers/syslog/ramlog.c: Fix ramlog readers never woken up when using ramlog as syslog or console.
We also make an attempt to avoid the thundering herd problem if there are multiple readers/pollers.

Patch also removes forcing CONFIG_RAMLOG_CRLF in nuttx/syslog/ramlog.h as there is no point of wasting precious RAM for useless characters.
2019-11-14 07:40:35 -06:00
liuhaitao
9b75ef06ea include/sys/time.h, libs/libc/unistd, sched/timer: Implement alarm(), setitimer() and getitimer() APIs. 2019-11-13 08:10:16 -06:00
Gregory Nutt
2ab4d635b4 tools/nxstyle.c: Correct detection of missing blank line following a block comment. 2019-11-09 08:15:12 -06:00
David Alessio
1c3d6ea24b sched/sched/sched_waitpid.c: Fix null pointer derefence on race without DEBUG_ASSERT. 2019-11-05 08:59:01 -06:00
Xiang Xiao
c397692532 sched/semaphore/spinlock.c: spin_trylock handle memory barrier and instrumentation correctly. 2019-11-03 19:40:58 -06:00
Xiang Xiao
e1a89d29ee sched/semaphore/spinlock.c: Remove support for re-entrant spinlocks. They seem like a good idea, but they are never used. 2019-11-03 19:38:39 -06:00
Gregory Nutt
b5111d2c38 tools/nxstyle.c: Add logic to detect if there is a blank line following the final right brace. sched/: Applied the modified nxstyle to all C file as a test. 2019-10-24 11:02:42 -06:00
Jens Gräf
7042ec883e Merged in jgraef-linetco/nuttx/fix-32bit-timer-overflow (pull request #1055)
fix early timespec overflow if using 32 bit system timer

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-10-21 12:23:02 +00:00
Gregory Nutt
f063d7f386 sched/clock/clock.c: Correct a comment as noted in Issue 175. 2019-10-17 12:24:19 -06:00
liuhaitao
b2f8a79c3b sched/signal: Add support for SIGPIPE. SIGPIPE uses SIG_SIGPIPE_ACTION which terminates process by default. It also could be ignored. 2019-10-17 11:29:39 -06:00
Juha Niskanen
fd462d5ce2 sched/pthread, Documentation: fix pthread_key_delete, pthread_self and pthread_yield documentation and some comments. 2019-10-17 11:04:17 -06:00
Gregory Nutt
bcb4409756 sched/wdog/wd_start.c: Back out a kludge-workaround for an SDCC compiler problem fix back in Feb 2017 by commit b8f3bd857b. That workaround now appears to conflict with newer GCC versions using unsupport warning options. 2019-10-04 09:10:15 -06:00
raiden00pl
7715ee71d2 Merged in raiden00/nuttx_sim (pull request #1044)
sched/signal/sig_default.c: fix undefined reference to sched_suspend if CONFIG_SIG_SIGSTOP_ACTIO not defined and eliminate compilation warnings

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-10-04 11:51:14 +00:00
Nathan Hartman
46aaec7ba0 Fix minor typos in docs and comments. 2019-09-29 12:52:20 -06:00
Gregory Nutt
5141d9f53c sched/signal/sig_initialize.c: Add some checks for allocation failures. 2019-09-23 07:49:21 -06:00
Juha Niskanen
e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Juha Niskanen
ebc6f51641 Fix some typos 2019-09-17 10:46:23 -06:00
Gregory Nutt
63c9c0c935 sched/semaphore/spinlock.c: Fix build failure caused by a missing semicolon. 2019-09-16 07:44:01 -06:00
Nathan Hartman
366053e464 Fix typos, 1 in a #define, others in comments. This changes one definition: _MQ_TIMEDRECIEVE is changed to _MQ_TIMEDRECEIVE. It appears this symbol is not used anywhere. 2019-09-11 08:56:56 -06:00
Gregory Nutt
061dcaa226 Fix typos in preceding commit. 2019-09-10 10:06:36 -06:00
Gregory Nutt
af685dfe81 sched/sched_rrgetinterval.c: sched_get_rr_interval() should return {0,0} if round-robin scheduling is not selected for the task. 2019-09-10 10:04:36 -06:00
Gregory Nutt
46d435fc65 Various cosmetic changes. 2019-09-09 14:47:47 -06:00
Nathan Hartman
91ef2ec394 Fix a few minor typos 2019-09-08 15:59:14 -06:00
zhangyuan7
b33fc302f0 net/inet and net/tcp: Fix tcp close flow; free the connection after all tcp close process finished. 2019-08-30 06:44:43 -06:00
Gregory Nutt
53d5e44d89 Cosmetic updates. 2019-08-28 15:14:27 -06:00
Gregory Nutt
b912c6fbff sched/clock/clock_timekeeping.c: fix cases in time conversion that must be >= NSEC_PER_SEC, not >NSEC_PER_SEC. Similar to fix of f9e80c4a1e. 2019-08-27 18:18:10 -06:00
Gregory Nutt
5f02b0335f syscall/ and related: Fix an error found in build testing. Inconsistent conditional compilation led to link errors in certain configurations. 2019-08-27 16:41:07 -06:00
igd
32bac84548 sched/Kconfig, sched/signal/sig_notification.c: Add configuration option to decide select either the high-priority or low-priority work queue for SIG_EVTHREAD notifications. 2019-08-26 10:54:49 -06:00
Gregory Nutt
fb50a65756 boards/: Move more drivers directories at were placed too high in the hieararchy. 2019-08-24 14:42:14 -06:00
Gregory Nutt
3c30cf1f05 Squashed commit of the following:
task_spawn() and posix_spawn() are NuttX OS interfaces.  In PROTECTED and KERNEL build modes, then can be reached from applications only via a system call.  Currently, the number of parameters in a system call is limited to six; these spawn function have seven parameters.  Rather than extend the maximum number of parameters across all architectures, I opted instead to marshal the seven parameters into a structure.
     *

In order to support builtin in function in protected mode, a task_spawn() system call must be supported.  Unfortunately this is overly complex because there is a (soft) limit of 6 parameters in a system call; task_spawn has seven paramters.  This is a soft limit but still difficult to extend because it involves assembly language changes to numerous architectures.  Better to get more creative.
2019-08-23 13:20:52 -06:00
Gregory Nutt
bff30ff9bc Fix minor typo / copy-paste. 'cancellaction point'->'cancellation point' 2019-08-23 11:57:35 -06:00
Nathan Hartman
248f75fda4 sched/Kconfig: Fix minor typos. 2019-08-18 18:04:08 -06:00
Gregory Nutt
a276942f59 Fix minor typos in comments 2019-08-15 14:06:11 -06:00
Gregory Nutt
e6da85deb3 sched/group/group_setuid.c and group_setguid.c: Verify that the UID/GID is within range. 2019-08-10 10:42:53 -06:00
Gregory Nutt
ec5120f69e sched/group and syscall/: Implement 'real' setuid, getuid, setgid, and getgid interfaces. These will be inheritance by all child task groups. 2019-08-06 14:13:43 -06:00
김정찬
a12f80fb90 sched/mqueue/mq_desclose.c: Add a test to verify that message queue is closed by the same task group that opened it. If not, then list corruption would result. This test is only performed if CONFIG_DEBUG_FEATURES is enabled since it should not normally be an issue: It would be a strange programming practice to open a message queue in open task group, then close it in another. 2019-08-05 18:30:07 -06:00
Nathan Hartman
68d43d3679 Fix typos. 2019-08-04 14:50:28 -06:00
Gregory Nutt
0050172108 sched/group/group_create.c: Update some comments. 2019-08-03 08:18:58 -06:00
Gregory Nutt
8e321aba84 sched/: Correct some naming. The NuttX task groups have been using the acroynum 'gid' and also the type 'gid_t' for the the task group ID. That is incorrect. Than naming is reserved for use with group permissions. So these were all named to grpid and grpid_t so that it is clearer that these refer to NuttX task group IDs, and not to group permissions. 2019-08-02 10:01:30 -06:00
Gregory Nutt
4c800ca372 sched/task/task_exithook.c: Update some commits. include/nuttx/sched.h: Fix some complaints from nxstyle. 2019-08-02 08:49:26 -06:00
Gregory Nutt
eda7f5f379 sched/task/task_exithook.c: nxtask_signalparent() in task_exithook.c may invalidate the group's parent task ID (tg_ppid) too soon. The tg_ppid field is use only to remember the parent tasks ID so that it can send the SIGCHLD signal to it. So it must stay valid until SIGCHLD has been sent. In nxtask_signalparent(), it calls nxtask_sigchild() to send SIGCHLD to the parent, then invalidates tg_ppid. That would be okay, except that the SIGCHLD is only sent when the last member of the group terminates. That is incorrect; tg_ppid can be invalidated too soon and, as a consequence, SIGCHLD would never be sent.
Noted by Jeongchan Kim in the Google group:  https://groups.google.com/forum/#!topic/nuttx/SXd8fVwVKBk
2019-08-01 08:14:11 -06:00
Nathan Hartman
32e9ba7604 Documenation/, configs/: ix typos and one HTML syntax error. Fix HTML syntax error in Documentation/NfsHowto.html: <coce> -> <code> html tag. 2019-07-30 16:10:15 -06:00
Gregory Nutt
9f24fb5b4b sched/: Add some missing FAR. Update some comments. 2019-07-29 15:04:39 -06:00
David S. Alessio
7a151016c2 sched/semaphore/sem_holder.c: Fix a race in telnet with PRIORITY_INHERITANCE and SCHED_HPWORK. Sometimes causes an assertion to fire incorrectly. 2019-07-29 08:14:30 -06:00
Gregory Nutt
3252e35280 Add comments; minor spelling fix in comments. 2019-07-20 09:21:28 -06:00
Yang ChungFan
8181a92a1d ched/sched/sched_waitpid.c: In waitpid, remember to grab the exited child ptr. After being unblocked in waitpid, the child pointer might be NULL. Modify to use group_exitchild to get the pointer of recent exited child. 2019-07-20 07:20:21 -06:00
Gregory Nutt
bde0509cae tools/nxstyle.c: Fix error in conditional logic that was preventing detection bad brace alignment. Add logic to handle alignment of braces in data initializators which following slightly different indentation rules. 2019-06-30 10:35:10 -06:00
Gregory Nutt
df3ea977bf sched/semaphore/sem_holder.c: Fix a bad assertion. The comments state correctly that we cannot make any assumptions about the number of holders of the semaphore, yet the code asserts if there are any holders. This makes the code behave closer to what the comments say. 2019-06-28 21:47:32 -06:00
Gregory Nutt
d7c4cca84d Trivial typo fix to a comment. 2019-06-25 12:27:26 -06:00
Juha Niskanen
abc49a6a13 arch/arm/src/stm32l4: if SRAM3 is used as heap, do not power it off in stop 2 mode. 2019-06-13 05:52:40 -06:00
Gregory Nutt
7ab149d8e9 Various fixes to get a clean compile with the SDCC compiler. Compile is 'almost' clean. 2019-06-03 16:53:11 -06:00
Gregory Nutt
84a57f8fa0 Fix several ZNeo compile issues. There are more. Pthreads: Fix a could of places where FAR was added when it is not appropriate. This matters to ZNeo which depends on definitions of NEAR and FAR points. 2019-06-03 13:06:58 -06:00
Gregory Nutt
7a0481d2a9 drivers/net/telnet.c: Fix a C89 non-compliance that was breaking the ez80 build. 2019-06-03 08:20:21 -06:00
Gregory Nutt
e4069ebe5e include/nuttx/signal.h: Fix a C89 compliance problem that cause the ez80 build to fail. Empty structure and unions are not accepted by the compiler. 2019-06-03 08:12:20 -06:00
Gregory Nutt
2767e80459 Squashed commit of the following:
ez80:  Fixing a few more compile problems.  I am afraid that the 5.3.0 compiler it too buggy to use.
    ez80:  Additional build-related fixed.
    eZ80:  Updating to use the newest ZDSII 5.3.0 toolchain.
2019-06-02 11:05:31 -06:00
Gregory Nutt
b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -06:00
Gregory Nutt
c2136fda6d sched/signal/sig_default.c: The abnormal termination handler was just calling exit() conditionally when, for example, Ctrl-C is sent to a task. The abnormal termination handler must obey the rules of cancellation points: If cancelation is disabled, then the abnormal termintion logic must wait for cancelation to be re-enabled; If cancellation is deffered then the abnormal termination logic may have to wait for the victim task to enter or exit a cancellation point. 2019-05-17 07:39:04 -06:00
Gregory Nutt
abf6965c24 Squashed commit of the following:
libs/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    syscall/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    wireless/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    Documentation/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    include/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    drivers/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    sched/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    configs:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/xtensa:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/z80:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/x86:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/renesas and arch/risc-v:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/or1k:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/misoc:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/mips:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/avr:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/arm:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
2019-04-29 14:52:05 -06:00
Gregory Nutt
0863e771a9 Revert "sched/clock/clock_initialize.c: clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet."
This reverts commit 2bc709d4b9.

Commit 2bc709d4b9 was intended to handle the case where up_timer_gettime may not start from zero case.  However, this change has the side-effect of breaking every implementation of tickless mode:  After this change the tickless timer structures are used before they are initialized in clock_inittime().  Initialization happens later when up_initialize is called() when arm_timer_initialize().

Since the tickless mode timer is very special, one solution might be to

1. Rename xxx_timer_initialize to up_timer_initialize
2  Move up_timer_initialize to include/nuttx/arch.h
3.  Call it from clock subsystem instead up_initialize

Basically, this change make timer initialization almost same as rtc initialization(up_rtc_initialize).

For now, however, we just need to revert the change.
2019-04-26 07:24:57 -06:00
Matous Pokorny
1e54a14c9f Fix some typos in comments. 2019-04-15 07:56:53 -06:00
Joao Matos
08ff68edec sched/pthread: Added non-standard pthread_get_stackaddr_np() and pthread_get_stacksize_np(). 2019-04-04 10:30:46 -06:00
Gregory Nutt
842d3dc4e5 Rename sched_alarm_expiration to nxsched_alarm_expiration. That is the appropriate name for an internal sched/ function (still many named incorrectly). 2019-03-20 19:34:23 -06:00
Gregory Nutt
9acb652e29 Rename sched_timer_expiration to nxsched_timer_expiration. That is the appropriate name for an internal sched/ function (still many named incorrectly). 2019-03-20 19:31:43 -06:00
Gregory Nutt
b290160b3b Rename sched_process_timer to nxsched_process_timer. That is the appropriate name for an internal sched/ function (still many named incorrectly). 2019-03-20 19:27:40 -06:00
Gregory Nutt
f6ac82e246 Backs out part of commit d7a602e9b2. When CONFIG_SCHED_CPULOAD_EXTCLK is defined, the prototype must still be available in nuttx/arch.h 2019-03-20 19:17:30 -06:00
Valmantas Paliksa
d7a602e9b2 sched/sched and include/nuttx/arch.h: Rename sched_process_cpuload to nxsched_process_cpuload. All internal sched_ functions should be prefixed with nx. Remove duplicate prototype from nuttx/arch.h. 2019-03-20 08:01:27 -06:00
Gregory Nutt
622202da20 binfmt/nxflat.c: Update to last NxFLAT change: The logic must respect the reference count before freeing the dspace memory region. 2019-03-12 09:44:18 -06:00
Gregory Nutt
f6b9fe5b14 tools/nxstyle.c: Add logic to detect a blank line following a left brace or a blank line preceding a right brace. 2019-03-10 09:53:33 -06:00
Gregory Nutt
c8004c7e00 tools/nxstyle.c: Add capability to detect CamelCase identifiers. 2019-03-05 13:08:57 -06:00
Gregory Nutt
5fe6981c9a Squashed commit of the following:
libs/libc/pthread/pthread_spinlock.c:  Resolve several TODO issues by accessing up_testset() via the boardctl() interface rather than attempting to call it directly.

    configs/boardctl.c, include/sys/boardctl.h:  Add access to architecture-specific up_testset() via boardctl().

    arch/Kconfig's, sched/Kconfig, and include/nuttx/spinlock.h:  Spinlocks are not available unless the architecture supports the up_testset() operation.
2019-03-04 14:22:50 -06:00
Gregory Nutt
f914ec6e2b tools/nxstyle.c: Fix logic that detects if an operator is correctly delimited with spaces. sched/: Various changes because sched/ C files were used as Guinea Pigs to test nstyle.c. 2019-03-01 10:50:02 -06:00
Gregory Nutt
3c0f6f4876 arch/xtensa/src/esp32/esp32_serial.c: Fix some backward arguments. Correct 2-stop bit setting.
sched/sched/sched_waitid.c:  Could exit without leaving critical section on some error conditions.
sched/signal/sig_deliver.c: Update some comments.
2019-02-28 11:32:31 -06:00
Gregory Nutt
0951151c33 libs/libc/pthread, syscall/, and include/sys/syscall.h: Support for pthread_mutex_timedlock() was added recently, however no new system call was added for the API make is usable only in the FLAT build. With a pthread_mutex_timedlock() system call, there is no reason for a pthread_mutex_lock() system call since it is now nothing more than an wrapper around pthread_mutex_timedlock(), passing NULL for the time value. The pthread_mutex_lock() syscall was removed and the pthread_mutex_lock() implemented was moved from /sched/pthread to where it now belows in libs/libc/pthread. 2019-02-25 18:19:13 -06:00
Gregory Nutt
9a5134acac sched/pthread/pthread_mutexlock.c: Fix an error in last PR. The abs_timeout value as not being passed from pthread_mutex_timedlock() to pthread_mutex_take(). 2019-02-24 16:04:48 -06:00
Gregory Nutt
c7cc6bab96 included/pthreads, sched/pthreads, and Documetions: Updates after review of last PR. 2019-02-24 14:40:11 -06:00
Leif Jakob
58e387fc6f Merged in leif_jakob/nuttx/pthread_mutex_timedlock (pull request #830)
support for pthread_mutex_timedlock

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-02-24 20:04:24 +00:00
Gregory Nutt
11eb7ef4f8 Minor fixed to documents and C comments. 2019-02-23 17:46:43 -06:00
Gregory Nutt
2fbec4cdf6 Doumentation/NuttxPortingGuide.html: Add description of board_early_initialize() and board_late_initialize(). 2019-02-18 17:36:11 -06:00
Gregory Nutt
32a300806e Let's rename board_driver_initialize() to board_early_initialize() to emphasize its relationship to board_late_initialize(). 2019-02-18 16:25:08 -06:00
Gregory Nutt
a76e137ce2 Squashed commit of the following:
sched/init/nx_start.c:  Add support for CONFIG_BOARD_DRIVER_INITIALIZE.  If this option is selected then nx_start() will call a board-provided function board_driver_initialize() immediately after calling up_initialize().

    Rename CONFIG_BOARD_INITIALIZE to CONFIG_BOARD_LATE_INITIALIZE.

    Raname board_initialize() to board_late_initialize()
2019-02-18 15:32:00 -06:00
Gregory Nutt
bc5908d9fd tools/nxstyle.c: Beef up logic that detects multiple variable definitions per line. 2019-02-17 10:57:28 -06:00
Michał Łyszczek
626afb015b nuttx/sched/mqueue: Change 'int prio' to 'unsigned int prio'. According to open group specification, priority field in mq_* functions should have unsigned type: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html 2019-02-15 19:18:55 -06:00
Gregory Nutt
fa1e151b12 sched/: Removed too much conditional compilation in commit 967dc523bb 2019-02-12 21:01:22 -06:00
Gregory Nutt
967dc523bb sched/: Remove the option CONFIG_BOARD_INITTHREAD. Now, if CONFIG_BOARD_INITIALIZE is selected, then the board_initialize() logic will ALWAYS run on an internal kernel thread. This will prevent the problems people have had doing inappropriate board_initialization on the IDLE thread. 2019-02-12 19:13:22 -06:00
Gregory Nutt
efe65749ce Fix condition logic: The setup seems to support a network without sockets. That is not the case.
Squashed commit of the following:

    sched/sched/sched_getsockets.c:  Fix an error in conditional compilation.
    fs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NSOCKET_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    syscall/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    tools/:  Fixups for CONFIG_NSOCKET_DESCRIPTORS no longer used to disable sockets.
2019-02-11 15:47:25 -06:00
Gregory Nutt
a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt
a2e62f557d Squashed commit of the following:
sched/init/nx_bringup.c:  Fix a naming collision.
    sched/init:  Rename os_start() to nx_start()
    sched/init:  Rename os_smp* to nx_smp*
    sched/init:  Rename os_bringup to nx_bringup
    sched/init:  rename all internal static functions to begin with nx_ vs os_
2019-02-04 16:20:35 -06:00
Gregory Nutt
bb623d1e04 This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().
Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
2019-02-04 13:42:51 -06:00
Gregory Nutt
90e4cf4349 mm/umm_heap: sbrk() is only available in the KERNEL build. 2019-02-04 10:32:31 -06:00
Gregory Nutt
641a98a434 arch/: The saved return register state is available on the user stack. Thic commit reorders some logic so that certain, critical registers are preserved in the TCB. This does not make the logic 100% secure, but does prevent some obvious things. sched/signal/sig_delivery: Add a flag to the TCB to indicate that we are in a signal handler. Use this flag to assure that a there a never attempts to nest signal handling operations on a thread. This was guaranteed before but when locking of pre-emption during signal delivering was eliminated in a previous commit, there was a remote possibility of an attempt to do nested signal handling. This flag assures that there is only one signal handled at a time. 2019-02-03 15:29:47 -06:00
Gregory Nutt
71e6793702 sched/sched: Rename all internal, static functions from sched_* to nxsched_* to indicate that they are NuttX internal functions. This is only a start. Eventually, need to rename all sched_ functions prototyped in sched/sched/sched.h and in include/nuttx with nxsched_. 2019-02-03 14:18:39 -06:00
Gregory Nutt
1b1be1f327 sched/signal/sig_deliver.c: Restructure nxsig_deliver() so that the signal handler is not called with the pre-emption disabled (or, at least no with pre-emption disabled by nxsig_deliver() itself). 2019-02-03 10:39:41 -06:00
Gregory Nutt
40b74d1f1c sched/wqueue/kwork_notifier.c: Fix broken assertion introduced in recent commit. Breaks non-error path. Suggested by Jussi Kivilinna in Butbucket commit comment. 2019-02-01 08:53:18 -06:00
Gregory Nutt
8dd17362e3 sched/sched/sched_processtimer.c: Should include board if CONFIG_SYSTEMTICK_HOOK=y. 2019-01-30 08:21:09 -06:00
Gregory Nutt
6408857f6d sched/sched/sched_processtimer.c: Add a configurable call out to a user-provided function, 'timer hook', on each timer interrupt. 2019-01-30 07:22:44 -06:00
Gregory Nutt
78c8485b0d Fix some warnings found in build testing. 2019-01-27 17:23:01 -06:00
Xiang Xiao
d6b0b0d94b sched/mqueue/mq_desclose.c: Fix warning: variable 'msgq' set but not used 2019-01-27 11:08:28 -06:00
ligd
14573202bc sched/sched/sched_timerexpiration.c: Fix macro SEC2TICK() 32-bits overflow by using uint64_t in calculation. 2019-01-27 11:07:09 -06:00
Gregory Nutt
cc8878f08a sched/Kconfig: Change SCHED_NOTE_GET type from int to bool~ 2019-01-27 11:04:54 -06:00
Xiang Xiao
fe421022e2 sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix. 2019-01-27 11:02:56 -06:00
Xiang Xiao
e57f7cf6ae Critical Section Monitor (sched/ and fs/procfs: Remove SCHED_IRQMONITOR_GETTIME to simplify the clock source selection: (1) Use up_critmon_gettime if SCHED_IRQMONITOR, (2) Call clock_systimespec if SCHED_TICKLESS, (3) Don't collect timing info for all other cases and move up_critmon_* to arch.h avoid the duplicated declaration. 2019-01-27 10:13:28 -06:00
Xiang Xiao
fb63c0a293 sched/signal and related changes to other OS subsystems. 2019-01-27 09:28:59 -06:00
Xiang Xiao
c43e4673ab sched/Kconfig, libs/libc/dllfcn/Kconfig, libs/libc/modlib/Kconfig: Refine ELF related configurations. 2019-01-26 11:50:09 -06:00
anchao
88efb84847 libs/libc/dllfcn, sched/init: Add LD_LIBRARY_PATH environment variable support. 2019-01-26 11:47:14 -06:00
Xiang Xiao
9e2238f6cd libs/libc/dllfcn: Implement dlerror using strerror. 2019-01-26 11:39:05 -06:00
Xiang Xiao
095e28d45e binfmt/, binfmt/libelf/, include/nuttx, libs/libc/machine, libs/libc/modlib, and others: Move elf related arch function to include/nuttx/elf.h because the implementation is located in libs/libc/machine and in order to avoid the conflict with the 3rd party libraries and clean up the file inclusion: (1) Remove redundant elf32.h, (2) Remove nuttx/binfmt/elf.h in libs/libc/machine, (2) Remove nuttx/binfmt/elf.h in modlib, and (4) Rmove nuttx/module.h in modlib. 2019-01-26 11:18:45 -06:00
Gregory Nutt
bdd02a6aed Some cosmetic updates, mostly to spacing and comments. 2018-12-30 11:58:19 -06:00
Gregory Nutt
40cdc187bb mm/mm_heap/mm_sem.c and sched/task/task_getpid.c: Commits 43d37c866b and f37202cbc0 resolved some problems with the original fix of 91aa26774b. However, Those changes used an internal OS interface (sched_self()) which is not available when the the user-space memory manager is built in the PROTECTED or KERNEL builds and resulted in build failures.
This commit repartitions the logic by moving some of the changes from mm_sem.c into task_getpid.c.  The logic is equivalent for the case of mm_trysemaphore(), but no has wider impact since it potentially affects all callers of getpid().  Hence, this change may also introduce some other issues that will need to be addressed.
2018-12-30 08:41:06 -06:00
David Sidrane
24db683368 arch/arm/src/imxrt/chip/imxrt106x_pinmux.h: Add FLEXCAN3 to pinmux 2018-12-28 15:08:20 -06:00
Gregory Nutt
8b21960ba3 sched/pthread: Implement pthread_key_delete(). This involves some minor changes to the group data structure. 2018-12-28 14:21:19 -06:00
David Sidrane
bf6f44dec8 sched/Kconfig and sched/init/os_bringup.c: Allow the init task priority to be set. 2018-12-20 10:49:10 -06:00
Gregory Nutt
9d1c845dcc Revert "This patch prevent heap corruption as in below case."
This solution to the problem noted by EunBong Song results in major memory fragmentation and and out-of-memory conditions on the PX4 platform.  On that platform the lower priority work queue is very low priority and essentially never runs when the system is busy.  As a result, the systems gets slowly starved of memory until failures and bad behaviors begin to occur.

This is an addition patch coming later to result the original problem in a different way that does not have cause memory starvation.

This reverts commit 91aa26774b.
2018-12-20 10:11:36 -06:00
Gregory Nutt
00b5ba0cf0 sched/task/task_spawn.c: Correct description of input parameters to task_spawn_exec(). Noted by: JeongchanKim 2018-12-18 07:37:07 -06:00
David Sidrane
5433ec589b fs/driver/fs_blockpartition.c: Fix void pointer warning.
libs/libc/unistd/lib_daemon.c:  Fix compiler error is streams disabled.
sched/irq/irq_procfs.c:  Fix warning
sched/task/task_vfork.c: Fix void * math warning
2018-12-03 17:54:21 -06:00
Gregory Nutt
3b22d13493 sched/: Add debug assertions before each call to up_block_task() to assure that there is no attempt to block an IDLE task. 2018-11-30 06:54:15 -06:00
Xiang Xiao
af96756995 sched/sched/sched_gettcb.c: Fix break in building introduced in a recent commit. 2018-11-30 06:40:51 -06:00
Gregory Nutt
454d59b049 sched/sched_foreach.c: sched_foreach() should not have to hold the critical section over the entire traversal. It should be acceptable to simply only the critical section while one entry is being processed (the caller can always call sched_foreach within a critical section is greater stability is needed. sched/sched_gettcb.c: Recent changes removed critical sections around calls to sched_gettcb.c. However, there is a very should sequence of instructions that actually does require the critical section. That short sequence no manages its own critical section. 2018-11-29 13:09:56 -06:00
Gregory Nutt
d8cf3bfe25 Rethink some of the conditional logic of commit 1ac9558460: If the Critical Section Monitor enabled, that that platform-specific timer should be used to measure interrupt processing time, no matter what. 2018-11-26 12:18:58 -06:00
Gregory Nutt
553c566650 sched/irq: Include a few ProcFS-related changes missed in commit 1ac9558460 2018-11-26 12:01:36 -06:00
Gregory Nutt
1ac9558460 sched/irq and sched/sched: Measurement of interrupt handler duration used to be available only in Tickless mode since it used the high resolution Tickless timer to measure interrupt time. This commit adds CONFIG_SCHED_IRQMONITOR_GETTIME which, if enabled, will force the interrupt duration caculation to use the same high-resolution, platform-specific timer as is used with the Critical Section Monitor. This leads to two improvements: (1) You can now measure interrupt duration in non-Tickless mode, and (2) in either mode, the interrupt duration and the critical section measures will use the same high-resulotion timer and should, therefore, never be any descripancy due to different clock sources. 2018-11-26 11:29:20 -06:00
Gregory Nutt
80e7107c9f sched/irq/Make.defs: Fix warning about irq_csection.o appearing multiple times in the same rule. 2018-11-25 17:22:33 -06:00
Gregory Nutt
4ca7b72a98 sched/Kconfig: Simplify some configurations. This adds configuration settings that control individual features, rather than long complex OR expressions that determines if an individual feature is required. 2018-11-25 11:50:15 -06:00
Gregory Nutt
865cc85dfd sched/sched/sched_critmonitor.c: A correct a logic error. arch/sim/src/up_critmon.c: Use higher resolution timer. 2018-11-25 09:49:21 -06:00
Gregory Nutt
491ef22b63 sched/sched/sched_critmon.c: Design simplication. Now that irqcount is always available, there is no need for the flags that were used to retain IRQ state. 2018-11-25 07:41:52 -06:00
Gregory Nutt
095b597d34 sched/sched and fs/procfs: Fix some bus in critical section monitor found in testing 2018-11-24 17:58:35 -06:00
Gregory Nutt
807d5bb4ae Critical Section Monitor: Add low level timer support for simulation. Fix serial bugs and logic errors in initial implementation. Still does not work; takes assertions. 2018-11-24 15:07:12 -06:00
Gregory Nutt
85c31fd4a2 fs/procfs/fs_procfscritmon.c and sched/sched/sched_critmonitor.c: Add support for global pre-emption and global critical sections to monitor as suggested by Xiang Xaio. 2018-11-24 13:33:37 -06:00
Gregory Nutt
a1cb270478 configs/stm32f4discovery: Add timing support for the critical section monitor using the DWT CYCNT register. 2018-11-24 11:06:34 -06:00
Gregory Nutt
fc6084f311 Squashed commit of the following:
fs/procfs/fs_procfsproc:  Extended the process ID ProcFS output to show per-thread maximum time for pre-emption disabled and maximum time within a critical section.

    sched/sched/sched_critmonitor.c:  Adds data collection logic in support of monitoring critical sections and pre-emption state.
2018-11-24 10:32:45 -06:00
Gregory Nutt
d2a11cdea5 sched/signal/sig_timedwait.c: Remove unnecessary disble of pre-emption. 2018-11-23 06:59:48 -06:00
Xiang Xiao
dbf01d12b7 Assertions: Identify the running task correctly when dumping task state information. It takes time to switch to the target task after g_readytorun has been modified. If panic/assert happen during this period, the dump will contain the incorrect and confusing information due to the difference between the real running task and the return value of this_task(). This change resolve this problem by adding g_running_task to track the real running task through the context switch. 2018-11-15 07:11:51 -06:00
Xiang Xiao
f337cc1380 sched/clock/ timekeeping: Use clock_basetime() to initialize g_clock_wall_time to get the best initial RTC value and initialize g_clock_last_counter too since the hardware may not start counting from zero. 2018-11-12 07:00:41 -06:00
Xiang Xiao
2bc709d4b9 sched/clock/clock_initialize.c: clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet. 2018-11-12 06:55:53 -06:00
Xiang Xiao
f0c5c75042 sched/clock/: Don't call up_timer_gettime in clock_gettime and clock_systimer to ensure the return value from them consistent with clock_systimespec 2018-11-12 06:52:56 -06:00
Xiang Xiao
46bd8798c5 ched/clock/: Remove g_monotonic_basetime and g_clock_monotonic_time since we don't need ensure monotonic time start from zero as state here: http://pubs.opengroup.org/onlinepubs/009696899/functions/clock_getres.html 2018-11-12 06:50:37 -06:00
Xiang Xiao
1ef2602933 sched/clock/clock_getres.c: Support CLOCK_MONOTONIC 2018-11-12 06:42:38 -06:00
Xiang Xiao
43706cd797 net/arp: Redesign ARP table aging to simplify the net initialization 2018-11-09 13:54:55 -06:00
ligd
712540b6a0 sched/wdog: improve accuracy of wd_gettime() in tickless mode 2018-11-09 09:27:40 -06:00
ligd
441cf6c207 sched/wdog: improve accuracy of wd_gettime() in tickless mode 2018-11-09 09:26:34 -06:00
Xiang Xiao
d32d9d4b24 fs/partition: Try MTDIOC_GEOMETRY IOCTL before bops's geometry
fs/driver/fs_blockpartition.c:  Support MTD IOCTL
2018-11-08 09:41:54 -06:00
Xiang Xiao
a9ff43d93c fs/aio, libs/libc/aio, sched/mqueue, sched/timer, and sched/signal: Remove the code duplication for SIGEV_THREAD. 2018-11-08 08:19:17 -06:00
dongjianli
057d555129 sched/signal and syscall/: Add support for pselect() and ppoll() functions 2018-11-08 07:45:23 -06:00
Xiang Xiao
27c7974cb1 sched/signal/sig_suspend.c: sigsuspend() shouldn't eat the pending signal but dispatch all instead 2018-11-08 07:39:37 -06:00
nchao
6509a0c0ca binfmt/ and libs/libc: Make exepath_*() more common:
1. Move exepath_*() related code to libc/misc
  1. Rename exepath_ to envpath_
  2. Rename BINFMT_EXEPATH to LIB_ENVPATH

libs/libc/modlib:  Add pre module library symbol table support
2018-11-08 07:27:14 -06:00
zhangyuan7
da737f3167 sched/group/group_foreachchild.c: group_foreachchild iterate by reverse order since the callback(e.g. group_killchildren) may remove the tcb from list
sched Kconfig and sched/task/exit.c:  Add SCHED_EXIT_KILL_CHILDREN option to kill all child threads when the main thread of a task exits.
2018-11-08 07:03:30 -06:00
Gregory Nutt
4eeba49507 Documentation/NuttShell.html: Add a little more information for the NSH set command. 2018-10-02 11:57:39 -06:00
Gregory Nutt
af50ab0088 sched/environ/env_unsetenv.c: Fix a memory leak introduced by the previous commit. 2018-09-30 11:45:59 -06:00
Gregory Nutt
d3c2373940 sched/environ/env_unsetenv.c: Fix and error in unsetenv() when unsetting the last of the environment variables. 2018-09-30 11:40:10 -06:00
Gregory Nutt
7769bd490c sched/signal/sig_nanosleep.c: Fix an error introduced with recent commit. Noted by Jussi Kivilinna. 2018-09-17 06:21:25 -06:00
Gregory Nutt
abc0e58799 sched/task/task_restart.c: Fix a compile error if CONFIG_DISABLE_SIGNALS defined. 2018-09-15 14:51:04 -06:00
Gregory Nutt
a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
Gregory Nutt
dc48263a6a libs/libc/wqueue/work_usrthread.c: Revise commit 49e725625a. Use sigprocmask() so tht we do not lose a signal, not sched_lock() which will not do the job in SMP mode. 2018-09-14 09:02:03 -06:00
Gregory Nutt
9546481054 Fix some typographical errors. 2018-09-14 06:55:45 -06:00
Gregory Nutt
c9187c2928 task/task_restart.c: Restarted was had sigprocmask set. Noted by Jeongchan Kim 2018-09-14 06:51:38 -06:00
Gregory Nutt
a04d2eeb10 tools/Directories.mk: Correct the path to the installed libcxx directory. 2018-09-13 14:03:09 -06:00
Gregory Nutt
b3f0aab00a Squashed commit of the following:
sched/wqueue/kwork_notifier.c:  Redesign some data structures.  struct works_s must appear at the beginning of the notifier entry structure.  That is because it contains the work queue indices.  This solves a harfault issue.

    net/tcp/tcp_netpoll.c:  tcp_iob_work() needs to free the allocated argument when it is finished.

    net/tcp/tcp_send_buffered.c:  Extend psock_tcp_cansend() so that it also requires that at least on IOB is also avaialble.

    mm/iob:  iob_navail() was returning the number of free IOB chain queue entries, not the number of free IOBs.  Completely misnamed.

    net/tcp/tcp_netpoll.c:  Add logic to receive notifications when IOBs are freed (Needs CONFIG_NET_TCP_WRITE_BUFFERS and CONFIG_IOB_NOTIFIER).  At present, does nothing because the logic in in psock_tcp_cansend() does not check for the availability of IOBs.  That will change.
2018-09-12 08:57:06 -06:00
Gregory Nutt
a680553f35 net/tcp/tcp_netpoll.c: Add logic to receive notifications when IOBs are freed (Needs CONFIG_NET_TCP_WRITE_BUFFERS and CONFIG_IOB_NOTIFIER). At present, does nothing because the logic in in psock_tcp_cansend() does not check for the availability of IOBs. That will change. 2018-09-12 06:40:18 -06:00
Gregory Nutt
11a635dcb3 mm/iob: IOB free notifier should accept the work queue ID as a paramter. The notification may need to run on either the high- or low- priority work queue. sched/work: Change the default priority of the low-priority work queue to 100. 2018-09-11 08:49:39 -06:00
EunBong Song
91aa26774b This patch prevent heap corruption as in below case.
TASK A                        TASK B
                              malloc()
                              mm_takesemaphore()
                              heap holder is set to TASK B
                         <--- preempt
...
task_exit()
Set to current task to
  TASK B
Try to release tcb, and
  stack memory
free()
mm_takesemaphore()
  - Successfully obtain
    semaphore because current
    task and heap holder is
    same.
Free memory....
Heap corrupt.

This change forces all de-allocations via sched_kfree() and sched_ufree()
to be delayed.  Eliminating the immediate de-allocation prevents the
above problem with the the re-entrant semaphore because the deallocation
always occurs on the worker thread, never on TASK B.

There could be consequences in the timing of memory availability.  We
will see.
2018-09-11 08:17:33 -06:00
Gregory Nutt
af0ee3c8f7 sched/wqueue: Add an option to work queue notifier so that the notification can occur on different work queues. 2018-09-11 07:22:23 -06:00
Gregory Nutt
39df7ed0c0 mm/iob and sched/semaphore: Work around some issues with the IOB throttle semaphore. It has some odd behaviors that can cause assertions in sem_post(). Also, it seems to get outside of its range occasionally. Need to REVISIT this. 2018-09-10 11:32:09 -06:00
Gregory Nutt
53930763f4 sched/sched/sched_waitpid.c: Remove a bad error check. I though Juha already removed this problem. Did I lose his change? 2018-09-10 06:57:12 -06:00
Gregory Nutt
4cb61bd8c2 sched/wqueue: Notifier design cleanup. The original concept used pre-allocated notification data structures. However, the notification dat must persist for an indeterminate amount of time. So the design was modified to use dynamically allocted data structures. This commit simplifies the design by removed some residual 'machinery' that is no longer needed. 2018-09-10 06:29:51 -06:00
Gregory Nutt
09d5d05b95 net/TCP: Extend the TCP notification logic logic so that it will also report loss of connection events. 2018-09-09 17:32:10 -06:00
Gregory Nutt
9d3148406c Signals were not a good choice of IPC to implement the poll function for several reasons: In order to handle the asynchrnous poll-related event, a substantial amount of state information is needed. Signals are only capable of passing minimal amounts of data. There are also complexities with performing kernel space signal handlers in kernel space code that is better to avoid. So, instead of signals, the equivalent logic was converted to run via a callback that executes on the high-priority work queue.
Squashed commit of the following:

    Fix up some final compile isses.

    net/netdev:  Convert the network down notification logic to use the new wqueue-based notification factility.

    net/udp:  Convert the UDP readahead notification logic to use the new wqueue-based notification factility.

    net/tcp:  Convert the TCP readahead notification logic to use the new wqueue-based notification factility.

    mm/iob:  Convert the IOB notification logic to use the new wqueue-based notification factility.

    sched/wqueue:  Signals are not good IPCs to support the target poll functionality for several reasons including the amount of data that can be passed with a signal and in the fact that in protected and kernel modes, user threads executing signal handlers in protected, kernel memory is problematic.  Instead, convert the same logic to perform the notifications via function callback on the high priority work queue.
2018-09-09 15:01:44 -06:00
Gregory Nutt
20814acad2 sched/signal: In signal notification facility, use sigqueue() to notify vs. kill(). With sigqueue, we can pass more info (but still not enough). 2018-09-09 11:57:25 -06:00
Gregory Nutt
32e3e51678 net/netdev: Add signal notification for the case where the network goes down. 2018-09-09 10:39:25 -06:00
Gregory Nutt
fc127fd297 sched/signal: Add a generic signal notification facility. Modify the custom IOB available notifier so that it is now just a wrapper around this generic signal notification. This generic signal notification faility will, eventually, be used to support network polling.
Squashed commit of the following:

    mm/iob:  The IOB available notifier is now just a wrapper around the common signal notifier.

    sched/signal:  Add a generic signal notification facility.

    sched/signal/sig_evthread.c:  More trivial naming changes.

    sched/signal:  Rename nxsig_notification() to nxsig_evthread() to make forthcoming naming additions more consistent.
2018-09-09 08:32:37 -06:00
Gregory Nutt
b7d1f13a54 b/sched/sched/sched_waitpid.c: Remove options check in DEBUG_FEATURES 2018-09-05 06:45:49 -06:00
Gregory Nutt
993321dda6 drivers/serial: Add support for Ctrl-Z. This works just like the recently added Ctrl-C support except that SIGSTP is sent when the Ctrl-Z characters is encountered vs. SIGINT. 2018-09-02 15:36:25 -06:00
Gregory Nutt
093348030e sched/: Update signal default STOP action. If waitpid was called with the WUNTRACED then wake up waitpid. Also fix some compile problems.. How did this work before? 2018-09-02 13:51:52 -06:00
Gregory Nutt
a7265d71c6 This commit adds support for default signal actions for SIGSTOP, SIGSTP, and SIGCONT.
Squashed commit of the following:

    Add procfs support to show stopped tasks.  Add nxsig_action() to solve a chicken and egg problem:  We needed to use sigaction to set default actions, but sigaction() would refuse to set actions if the default actions could not be caught or ignored.

    sched/signal:  Add configuration option to selectively enabled/disable default signal actions for SIGSTOP/SIGSTP/SIGCONT and SIGKILL/SIGINT.  Fix some compilation issues.

    sched/sched:  Okay.. I figured out a way to handle state changes that may occur while they were stopped. If a task/thread was already blocked when SIGSTOP/SIGSTP was received, it will restart in the running state.  I will appear that to the task/thread that the blocked condition was interrupt by a signal and returns the EINTR error.

    sched/group and sched/sched:  Finish framework for continue/resume logic.

    sched/signal:  Roughing out basic structure to support task suspend/resume
2018-08-30 10:27:18 -06:00
Gregory Nutt
aaa660bae6 sched/group and sched/signal: Some good but trivial stuff harvested from the suspend branch. 2018-08-29 15:50:01 -06:00
Gregory Nutt
1d04ef2f93 sched/signal/sig_default.c: Lock the scheduler while while killing the children so that we do not lose priority and let the task group continue to run in an indeterminate state. 2018-08-29 14:55:45 -06:00
Gregory Nutt
94910d2925 sched/: Cosmetic reordering of conditional compilation. Style is that comments related to the conditionally compiled logic are included within the conditional compipilation so that its scope and belongingness is clear. 2018-08-29 13:09:00 -06:00
Gregory Nutt
d24f58c790 sched/group/group_killchildren.c: In some circumstances, group_killchildren() could have called pthread_cancel() to kill a task. Also, the behavior would not be as expected if a pthread had cancellation disabled. sched/signal/sig_default.c: Correct signal handling in the multiple threaded case. The SIGKILL signal may actually be processed on a pthread, not the main thread of the task. 2018-08-29 07:33:28 -06:00
Gregory Nutt
73c73af777 sched/irq/irq_dispatch.c: Fix my typo that was added while reviewing Xiang's changne. 2018-08-29 07:13:26 -06:00
Xiang Xiao
19bde835e2 sched/signal/sig_default.c: Fix warnings about implicit declaration of 'this_task' and 'group_killchildren' 2018-08-29 06:10:52 -06:00
Xiang Xiao
347d10497c sched/irq/irq_dispatch.c: Fix error 'ndx undeclared' 2018-08-29 06:10:52 -06:00
Gregory Nutt
dcb3d4b050 sched/signal: Add logic and an interface to determin if a signal can be caught or ignored. sigaction now correctly returns EINVAL on any attempt to catch or ignore such signals (only SIGKILL for now and only if CONFIG_SIG_DEFAULT=y). 2018-08-28 12:39:03 -06:00
Gregory Nutt
0756cf66ed sched/signal: Add support for SIGINT in addition to SIGKILL. drivers/serial: Use SIGINT instead of SIGKILL when control-C is pressed. 2018-08-28 12:15:31 -06:00
Gregory Nutt
5a51702ef2 sched/signal/sig_default.c: Correct an error in signal number usage. Add critical sections (not sure if that is necessary). Update some comments. 2018-08-27 22:32:57 -06:00
Gregory Nutt
499b89feed sched/signal: Default Signal Actions. Change some types to superficially simplify. Add configuration options to enabled default signal behaviors on a per-signal basis. I don't think users are prepared for SIGALRM to terminate the task (which is the correct default behavior if you don't change it). Extend the implementation of default signals so that it is totally table driven and extensible by simply mondifying the content of const tables. 2018-08-27 15:37:43 -06:00
Gregory Nutt
6d094e4b33 sched/signals: Update the signal default action logic to support sigaction(). signaction() must be able to handle and input action of SIG_DFL to setup the default signal action; it mast also return SIG_DFL it is replacing the default action. 2018-08-27 13:13:23 -06:00
Gregory Nutt
c0d234a474 Squashed commit of the following:
drivers/serial/Kconfig:  It is no longer necessary to restrict Ctrl-C handling to the FLAT build

    sched/signal:  Add a new configuration option to select signal default actions, separate handling of signal default actions from both task startup logic and from the serial TTY Ctrl-C logic.  Add a signal set in the group structure to keep track of what signals have been set to the default action.  In dispatching signals in PROTECTED or KERNEL mode, use this signal set to determine if the default signal handler is attached and dispatch the signal in kernel mode for the default actions.
2018-08-27 11:40:09 -06:00
Xiang Xiao
71ad1993f2 Move clock_timespec_[add|subtract] to include/nuttx/clock.h 2018-08-27 06:04:04 -06:00
ligd
11f8dc735c Squashed commit of the following:
drivers/serial:  Add Ctrl-C/Ctrl-X support.  This is an initial working implementation that still requires that several details be resolved.

    sched/task/task_start.c: Add default signal action to SIGKILL.
2018-08-26 08:49:08 -06:00
xuanlin
7e63b0b288 sched/wqueue, libs/libc/wqueue, configs: Remove work queue polling delay to simplify the code logic and save the power. 2018-08-25 14:58:07 -06:00
ligd
631071cded Squashed commit of the following:
sched/wqueue:  Modify high priority work queue to support multiple threads.

    sched/wqueue and libs/libc/wqueue:  workqueues don't need set global data to zero since .bss is cleared automatically.  Removing this unnecessary initialization also avoids the loss the work items queued before initialization.
2018-08-25 14:52:13 -06:00
Xiang Xiao
c9b24615a6 sched/irq: Monitor the irq execution time. This is very useful for measuring the interrupt latency. 2018-08-25 07:12:21 -06:00
Gregory Nutt
3931eaf015 sched/Kconfig: Fix a warning found in build testing. 2018-08-24 16:14:21 -06:00
Gregory Nutt
38452007a3 sched/irq/irq_dispatch.c: Fix an error found in build testing. 2018-08-24 16:12:31 -06:00
Xiang Xiao
2aa208ccf0 sched/irq/irq_procfs.c: Fix occasional computation error when fracpart >= 1000 2018-08-24 15:16:11 -06:00
zhuguangqing
d38be46655 sched/irq: Add support interrupt chains in NuttX. IRQ chain is very useful in these cases: (1) Multiple hardware connect to the same request line(e.g. PCI), (2) Need multiple driver to support one hardware block (like Linux MFD) 2018-08-24 15:10:23 -06:00
Xiang Xiao
6cb606d42b sched/irq/irq_dispatch.c: Ensure vector never points to NULL since interrupt may happen before irq_initialize() 2018-08-24 15:01:32 -06:00