Commit Graph

54 Commits

Author SHA1 Message Date
Pelle Windestam 7dd5356055 nxstyle: fixed various nxstyle warnings 2020-03-09 08:56:59 -06: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 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
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
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -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
Xiang Xiao 964f0ab304 aio_cancel need signal caller after the succeed and fix minor issue in the error handler 2019-01-27 09:39:33 -06:00
Xiang Xiao fb63c0a293 sched/signal and related changes to other OS subsystems. 2019-01-27 09:28:59 -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
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 859d032938 This commit adds support for the MAX3421E to the viewtool-stm32107 board support
Squashed commit of the following:

    configs/viewtool-stm32f107:  Clean up some compilation errors.  Now all builds correctly and is ready for test.

    arch/arm/src/stm32:  Do not condition building STM32 USB host logic on CONFIG_USBHOST.  That then precludes building STM32 platforms with external USB host chips like the MAX3421E.  Add an new, STM32-internal variable CONFIG_STM32_USBHOST that does the same job without such side-effects.

    configs/viewtool-stm32f107:  Add support for MAX3421E USB host.
2018-07-13 10:45:08 -06:00
Gregory Nutt a959d7fefa fs/aio: Fix one additional place where the errno variable is being accessed inappropriately. 2018-01-31 09:19:19 -06:00
Gregory Nutt 170a50c690 Squashed commit of the following:
sched/sched:  Correct some build issues introduced by last set of changes.
    sched/sched:  Add new internal OS function nxsched_setaffinity() that is identical to sched_isetaffinity() except that it does not modify the errno value.  All usage of sched_setaffinity() within the OS is replaced with nxsched_setaffinity().
    sched/sched:  Internal functions sched_reprioritize() and sched_setpriority() no longer movidify the errno value.  Also renamed to nxsched_reprioritize() and sched_setpriority().
    sched/sched:  Add new internal OS function nxsched_getscheduler() that is identical to sched_getscheduler() except that it does not modify the errno value.  All usage of sched_getscheduler() within the OS is replaced with nxsched_getscheduler().
    sched/sched:  Add new internal OS function nxsched_setparam() that is identical to sched_setparam() except that it does not modify the errno value.  All usage of sched_setparam() within the OS is replaced with nxsched_setparam().
    sched/sched:  Add new internal OS function nxsched_getparam() that is identical to sched_getparam() except that it does not modify the errno value (actually, the previous value erroneously neglected to set the errno value to begin with, but this fixes both issues).  All usage of sched_getparam() within the OS is replaced with nxsched_getparam().
2018-01-30 11:08:18 -06:00
Gregory Nutt 536e4d7fa6 fs/vfs: Change the return value of internal function fs_getfilep(). It no longer sets the errno variable but, rather, returns errors in the same manner as other internal OS functions. 2017-10-11 08:39:19 -06:00
Gregory Nutt 4810499d3a Squashed commit of the following:
Replace all calls to sigqueue() in the OS proper with calls to nxsig_queue() to avoid accessing the errno variable.

    sched/signal:  Add nxsig_queue() which is functionally equivalent to sigqueue() except that it does not modify the errno variable.
2017-10-07 10:57:09 -06:00
Gregory Nutt 8198ba6a6d This change renames all internal, private NuttX signal-related functions to use the prefix nxsig_ so that they cannot be confused with application interfaces that begin, primarily, with sig_
This is analogous to similar renaming that was done previously for semaphores.

Squashed commit of the following:

    sched/signal:  Fix a few compile warnings introduced by naming changes.

    sched/signal:  Rename all private, internal signl functions to use the nxsig_ prefix.

    sched/signal:  Rename sig_removependingsignal, sig_unmaskpendingsignal, and sig_mqnotempty to nxsig_remove_pendingsignal, nxsig_unmask_pendingsignal, and nxsig_mqnotempty to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_findaction and sig_lowest to nxsig_find_action and nxsig_lowest to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_allocatepingsigaction and sig_deliver to nxsig_alloc_pendingsigaction and nxsig_deliver to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_cleanup, sig_release, sig_releasependingaction, and sig_releasependingsignal to nxsig_cleanup, nxsig_release, nxsig_release_pendingaction, and nxsig_release_pendingsignal to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_tcbdispatch and sig_dispatch to nxsig_tcbdispatch and nxsig_dispatch to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_releaseaction and sig_pendingset to nxsig_release_action and nxsig_pendingset to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_initialize and sig_allocateactionblock to nxsig_initialize and nxsig_alloc_actionblock to make it clear that these are OS internal interfaces.
2017-10-05 13:25:25 -06:00
Gregory Nutt 9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt 42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt 83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt e4dd33280d Squashed commit of the following:
psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
2017-09-30 10:41:21 -06:00
Gregory Nutt 44736b721c net/sockets: psock_send() is an internal OS interface an should not set the errno variable. 2017-09-29 17:48:15 -06:00
Gregory Nutt 7b7ca87941 fs/vfs: file_write() and file_pwrite() are internal OS interfaces and should not report errors via the errno 2017-09-28 14:49:05 -06:00
Gregory Nutt a0f567f4a3 Update TODO, cosmetic changes, spelling -- US English spells it canceled and canceling vs cancelled and cancelling. No idea why. 2016-12-09 18:39:40 -06:00
Gregory Nutt b0dffdc2ca Fix a number of header files with mismatched 'extern C {' and '}' 2016-11-05 07:25:05 -06:00
Gregory Nutt 986c568d34 Correct file header comments 2016-08-07 10:04:02 -06:00
Gregory Nutt a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00
Gregory Nutt 9008308b64 Remove some block comments before empty code sections 2016-04-11 18:16:04 -06:00
Gregory Nutt 849df03d22 Update dates on files modified for SIGEV_THREAD support 2015-12-30 13:28:39 -06:00
Gregory Nutt 9835eeb181 signals: Basic framework to support SIGEV_THREAD 2015-12-30 13:20:31 -06:00
Gregory Nutt 342f5fe33d Fix references to the no-longer-existent misc/ directory in comments, README files, and documentation 2015-06-28 08:08:57 -06:00
Gregory Nutt 9ab0d4c56f fs/aio: Corrrect some backward tests in aio_read() and aio_write(): Socket descriptors have higher numbers than file descriptors. In aio_contain(), Copy u.ptr (void *) when initializing aioc and not the case specific u.aioc_filep. From Michal Ulianko. 2015-02-24 07:29:47 -06:00
Gregory Nutt 9ac09db800 More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs. 2014-11-25 13:46:14 -06:00
Gregory Nutt f8f6a8fbce AIO: Several fixes for socket transfers, mostly from Victor Mayoral Vilches 2014-10-27 15:54:35 -06:00
Gregory Nutt d2424ac65c Fix a couple of problems introduced in the last commmits 2014-10-11 08:29:26 -06:00
Gregory Nutt ae3cc327c7 AIO now also supports socket transfers 2014-10-11 08:15:23 -06:00
Gregory Nutt 91f5ecc347 fs/aio/aio.h needs to disable itself is CONFIG_FS_AIO is not defined 2014-10-09 10:45:43 -06:00
Gregory Nutt 974f884ddc Fix typos that cause compile error when file system debug is enabled 2014-10-07 13:49:49 -06:00
Gregory Nutt e5f34875ff AIO signal related fixes; extensino to AIO test 2014-10-07 09:57:20 -06:00
Gregory Nutt f575567f55 Fix a compilation error in last commits that occure if CONFIG_PRIORITY_INHERITANCE is not selected 2014-10-07 09:07:54 -06:00
Gregory Nutt 4c7b988525 Update some comments 2014-10-07 08:34:10 -06:00
Gregory Nutt 98a4b6fb79 The Asynch I/O implementation now satisfies POSIX priority requirements; it uses the new low priority worker thread interfaces to adjust the priority of the worker thread according to the priority of the client thread 2014-10-07 08:24:50 -06:00
Gregory Nutt e38640ecd8 Eliminate a warning 2014-10-06 16:15:24 -06:00
Gregory Nutt 9e102bc458 Fix some cornercase locking issues; make AIO lock re-entrant 2014-10-06 15:54:00 -06:00
Gregory Nutt 67030f9049 Add test for aio_cancel() and fix some bugs found by the test 2014-10-06 15:06:01 -06:00
Gregory Nutt b447c413d0 Fix some errors and spec compliance issues with aio_cancel() 2014-10-06 14:28:40 -06:00
Gregory Nutt 7cbe29e7db Fix compile problems with debug on 2014-10-06 12:28:37 -06:00
Gregory Nutt cd0c493657 Basic fixes for a clean simulator build with last big fs changes 2014-10-06 11:02:58 -06:00
Gregory Nutt d914f3ceec Major structure of file system functions to better support asynchronous I/O. Respository should not be trusted until I have a chance to verify everything 2014-10-06 10:53:25 -06:00
Gregory Nutt a5b4a4161b Modify logic to use AIO control block container 2014-10-06 08:10:32 -06:00