Commit Graph

176 Commits

Author SHA1 Message Date
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
Xinhe Zhou 25b788a9ed fs/vfs/fs_open.c: Fix error in nx_vopen() function. 'va_start' is used in function with fixed args. 'va_start'/'va_end' should not be used in nx_vopen function, because it has fixed arguments. 2019-12-14 07:38:36 -06:00
Junmin Kim e06329f5e7 fs/vfs/fs_open.c: Fix description of nx_open and nx_vopen comments indicate that they return zero on success when, in fact, they return the new file descriptor. 2019-12-12 08:24:14 -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
Juha Niskanen a085a0a70b fs/smartfs/smartfs_smart.c: Honor O_APPEND on writes. Also document pwrite() bug/limitation. 2019-11-05 07:32:23 -06:00
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -06:00
Nathan Hartman 46aaec7ba0 Fix minor typos in docs and comments. 2019-09-29 12:52:20 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Dave Marples 5179fa9a64 drivers/serial/serial.c: Limit the number of times that the poll semaphore is incrmented. 2019-06-13 16:23:04 -06:00
Gregory Nutt ee9e8c6bc2 udp\udp_callback.c: Fix another C89 compatibility problem. Empty initializers are not permitted. Caused ez80 build failure. 2019-06-03 09:23:19 -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 be3dd0bac6 fs/: Fix various coding standard issues found while testing tools/nxstyle.c 2019-03-01 15:01:04 -06:00
Gregory Nutt b5e6af60ac tools/nxstyle.c: Add check for multiple definitions of local variables on a line. 2019-02-14 18:33:23 -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
David Sidrane ffd37a0175 fs/vfs/fs_open.c: Fix not returning failure for block_proxy() call. 2019-01-25 06:23:34 -06:00
Gregory Nutt 0cd5a232ea Fix a few typos. 2018-12-27 08:45:26 -06:00
David Sidrane 010d5da4e6 fs/vfs: dup() and dup2() were broken some time back. fs_dupfd() was return returing OK on success, not fit the file descriptor of the duplicated fd. 2018-12-10 13:25:52 -06:00
Xiang Xiao d2cfd398ba Fix compiler error and warning when CONFIG_NET_SENDFILE=y 2018-11-09 11:17:43 -06:00
Xiang Xiao e674edfa19 fd/dirent, fs/driver/, and fs/vfs: Make MTD device accessible via a character driver proxy like block devices 2018-11-08 09:59:18 -06:00
Gregory Nutt 706b20a49f fs/vfs/fs_read.c: Elimnate a warning noted by Anonymouns in Issue 124. 2018-10-12 14:58:21 -06:00
Gregory Nutt 913d013d8f Revert last change to the TODO list. There is no issue. 2018-09-19 12:15: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 d88cb93d95 fs/vfs and fs/inode: Trivial typo fixes gleaned from the fileopen branch. 2018-08-29 16:01:56 -06:00
Gregory Nutt 05faba2514 include/nuttx/fs/fs.h: ... conflicting types for file_fstat(). 2018-08-26 16:13:09 -06:00
dongjianli 56883eef3b fs/vfs/fs_poll.c: Add poll use in kernel space. 2018-08-26 13:44:07 -06:00
Xiang Xiao 3f50451046 fs/vfs/fs_fcntl.c, net/socket/net_dupsd.c, and net/socket/net_vfcntl.c: Add file_fcntl, psock_fcntl, and psock_dupsd for use within the kernel. 2018-08-26 13:31:18 -06:00
ligd aa52c457cc fs/vfs/fs_fstat.c: Add file_fstat() function for internal OS use. 2018-08-26 13:26:37 -06:00
anchao 6361f93fda fs/vfs/fs_select.c: Make select be more consistent with Linux man page: 'The timeout
... Some code calls select() with all three sets empty, nfds zero, and a non-NULL timeout as a fairly portable way to sleep with subsecond precision.'
2018-08-26 13:19:28 -06:00
Gregory Nutt 8fdbb1e0a4 Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
Squashed commit of the following:

    sched:  Rename all use of system_t to clock_t.
    syscall:  Rename all use of system_t to clock_t.
    net:  Rename all use of system_t to clock_t.
    libs:  Rename all use of system_t to clock_t.
    fs:  Rename all use of system_t to clock_t.
    drivers:  Rename all use of system_t to clock_t.
    arch:  Rename all use of system_t to clock_t.
    include:  Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Gregory Nutt f5d0fc7447 fs/vfs and net/udp: Repartition logic of commit 0c963449d6, moving into net/udp. Add support to handle connected UDP sockets. The correct 'optimal blksize' to return is the MSS. The MTU is always too big. 2018-04-27 08:36:25 -06:00
Pelle Windestam 0c963449d6 fs/vfs: Added support for checking if a descriptor is a socket in fstat(). 2018-04-26 06:49:13 -06:00
Michał Łyszczek 94b4a86aa6 fs/vfs: Fix negative errno set in fs_open.c 2018-04-20 17:05:42 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt 885ab75045 drivers/lcd: Add support for creating display lists incrementally. 2018-02-17 14:48:18 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 39fe6a0dff Squashed commit of the following:
fs/nxffs:  Add partial implementation of the truncate method:  It extend files, but cannot yet shrink them.
    fs/smartfs:  Add partial implementation of the truncate method:  It extend files, but cannot yet shrink them.
    fs/fat:  Add partial implementation of the truncate method:  It extend files, but no yet shrink them.
    fs/nfs:  Add support for the truncate method to the NFS file system.
2018-01-04 10:54:54 -06:00
Gregory Nutt e4652bd3dc Squashed commit of the following:
fs: Add truncate() support for userfs
    fs/unionfs:  Add truncate() support to the unionfs
    fs/tmpfs:  Add ftruncate() support to tmpfs
    syscall/: Add system call support for ftruncate()
    net/route:  Adding ftruncate() support eliminates an issue in file-based routing table management.
    fs:  Add basic framework to support truncate() and ftruncate().  The infrastructure is complete.  Now, however, the actual implementation of ftruncate() will have to be done for each file system.
2018-01-03 16:03:56 -06:00
Gregory Nutt cc09e77a94 fs/vfs: Fix after recent changes. write() was return negative values in errno. Noted by Jussi Kivilinna. 2017-10-18 10:17:55 -06:00
Gregory Nutt 181875f3ba fs/vfs: Add new internal OS interface nx_read(). nx_read() is functionally equivalent to read() except that it does not modify the errno variable and it is not a cancellation point. Changed all references to read() in the OS to nx_read(). 2017-10-11 12:13:41 -06:00
Gregory Nutt a00d8e16a1 Adds OS internal function nx_write() which is functionally equivalent to write() except that it does not set the errno variable and do not cause cancellation points. 2017-10-11 10:18:30 -06:00
Gregory Nutt af072d52bc Adds OS internal functions nx_send(), ns_recv(), and nx_recvfrom() which are functionally equivalent to send(), recv(), and recvfrom() except that they do not set the errno variable and do not cause cancellation points. 2017-10-11 09:25:43 -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 aeb3944f0a fs/vfs and net/socket: fcntl() is not return success fail for F_SETFL. Reported by Jussi Kivilinna. 2017-10-06 08:27:38 -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 9232da4af8 fs/vfs: Remove warning generated by fcntl() 2017-10-02 14:04:50 -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
Xiao Qin e5c79ba1a6 Merged in x_qin/nuttx/null_check_for_open_and_write (pull request #498)
fs/vfs:null check for path on open and buf on write

Null path check is depend on CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_ASSERTIONS, added null checking so it's always performed
Added null checking on buf for write()

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-09-29 18:15:33 +00:00