Commit Graph

1325 Commits

Author SHA1 Message Date
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