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
Gregory Nutt
44d88abb83
This commit adds support for routing tables in files in a file system. This might be useful for customized, per-unit routing tables.
...
There are two issues with it however:
1. Reading from file system on a per packet basis could be slow. I think it probably should have a small, in-memory cache of most frequently used routes for good problem.
2. Currently the delroute logic is disabled due to a problem with the design. NuttX does not currently support truncate(). Therefore, it is not possible to delete entries from the routing table file.
In this current implementation, that leaves the last entry intact at the end of the file. An alternative design might include a tag on each record to indicate if the record is valid or not. That would work but would add complexity to the other routing table functions.
The existing implementation is available for testing purposes only if CONFIG_EXPERIMENTAL=y.
Squashed commit of the following:
net/route: The current delroute design depends on file truncation. However, NuttX does not currently support truncate. Alternative, more complex designs are possible but not implemented. At present the file routing table are otherwise functional but the delroute logic is disabled via CONFIG_EXPERIMENTAL. Enable it only if you plan to fix it.
net/route: Fix some issues with locking routing table files.
net/route: Add partial implementation of delroute for the case where the routing table is in a file.
net/route: Add support for seeking to positions in the routing table.
net/route: Add net_addroute_ipv4/6() using a file-based routing table.
net/route: Add net_foreach_ipv4/4() using a file-based routing table.
net/route: Initial build, configuration, and fs utilies to support routing tables in a file.
2017-09-29 08:33:36 -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
e761b80ea7
fs/vfs: file_read() is an internal OS interface and should not errors via the errno
2017-09-28 14:14:32 -06:00
Gregory Nutt
9043b9cb6a
fs/vfs: file_seek() is an internal OS interface and should not errors via the errno
2017-09-28 13:55:36 -06:00
Gregory Nutt
12c4c4c8a6
In some cases, packets are still not sent behind the router. I found that NuttX sends the ARP requests not to the router but to the target. Mistake in file net/route/netdev_router.c. From Aleksandr Kazantsev
2017-09-20 13:19:05 -06:00
Jussi Kivilinna
027a446158
poll: fix poll for regular files and block devices. Open Group documentation tells that poll (and select) support regular files and that 'Regular files shall always poll TRUE for reading and writing'.
2017-08-03 09:58:20 -06:00
Simon Piriou
643f5782aa
epoll: fix epoll_wait function
2017-07-22 09:01:24 -06:00
Julien Lecoeur
f26e83d0a1
Fix -Werror=implicit-fallthrough on gcc7
2017-06-28 17:48:04 +02:00
Jim Paris
db80696d21
vfs/poll: fix timeout calculation
2017-06-09 11:37:30 -06:00
Harri Luhtala
b8b9309d2b
vfs: fdopen: add missing file stream flags clearing. Clear file stream structure regardless of config options. Structure clearing is needed as previous use of stream list entry might leave fs_flags set.
2017-05-31 06:20:18 -06:00
Gregory Nutt
41680d376d
Replace 'the the' with 'the'
2017-05-11 13:15:13 -06:00
Gregory Nutt
e3d865f6c2
In last changed to poll(),cConverted timeout to unsigned to eliminate the possibility of overflow of signed overflow.
2017-04-28 11:02:54 -06:00
Jussi Kivilinna
37ca797d1c
vfs/poll: round timeout up to next full tick. Calling poll() with timeout less than half tick (thus MSEC2TICK(timeout) => 0) caused returning error with EAGAIN. Instead of rounding timeout down, value should be rounded up. Open Group spec for poll says: "Implementations may place limitations on the granularity of timeout intervals. If the requested timeout interval requires a finer granularity than the implementation supports, the actual timeout interval will be rounded up to the next supported value."
2017-04-28 08:42:37 -06:00
Gregory Nutt
d5207efb5a
Be consistent... Use Name: consistent in function headers vs Function:
2017-04-21 16:33:14 -06:00
Gregory Nutt
7457875447
VFS poll(): Add some error handling logic
2017-04-20 19:15:17 -06:00
Gregory Nutt
d3408809e4
sendfile(): Fix error introduced with commit ff73be870e
. Noted by Maciej Wójcik
2017-03-05 11:50:34 -06:00
Gregory Nutt
ee8abb8160
FS: Don't build block driver proxy if PSEUDOFS_OPERATIONS are disabled.
2017-03-04 08:25:20 -06:00
Gregory Nutt
0a192361de
Revert "FS: Fix backward conditional logic that prevent unlink() from building in some configurations."
...
Oops. It was not backward. Enable == !Disable. Negative logic is confusing.
This reverts commit 1fcf353e89
.
2017-03-04 08:16:46 -06:00
Gregory Nutt
1fcf353e89
FS: Fix backward conditional logic that prevent unlink() from building in some configurations.
2017-03-04 07:48:56 -06:00
Masayuki Ishikawa
e239961be8
Fix open() a block device with CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
2017-03-01 13:43:12 +09:00
Gregory Nutt
4fa389898a
Fix a warning when STDIO buffering is disabled
2017-02-27 11:06:13 -06:00
Gregory Nutt
a78593d66d
fstatfs: Rethink last commit. Add verification that the file descriptor refers to an open file. This also should eliminate the warning while doing something useful.
2017-02-22 14:17:14 -06:00
Gregory Nutt
8c7ec7419a
Eliminate a warning
2017-02-22 14:04:06 -06:00
Gregory Nutt
656935ed7e
C library: Add fstatfs(); fix a reference counting error in fstat().
2017-02-17 08:35:59 -06:00
Gregory Nutt
2325ea4a45
statfs() should not fail on path '/'
2017-02-14 06:30:35 -06:00
Gregory Nutt
10378bb10b
fstat: Add fstat() support to nfs.
2017-02-13 10:07:43 -06:00
Gregory Nutt
4748e9352d
fstat: Add fstat() support to romfs
2017-02-12 16:25:12 -06:00
Gregory Nutt
c5a8e96dbc
Add basic fstat() support. Now all that is needed is to modify ALL of the file systems.
2017-02-12 12:48:24 -06:00
Gregory Nutt
3055025e00
rename(): Correct more issues. (1) Move to the root directory in the pseudo file system, (2) Fix path naming calculation when the path is the root directory of a mounted file system, and (3) dont't do the rename if the source and destination of the rename are the same.
2017-02-12 08:37:28 -06:00
Gregory Nutt
e20e9f0fe4
Update a comment
2017-02-11 18:55:13 -06:00
Gregory Nutt
2d11d8f1a4
rename: An inode with no operations should be treated like a directory for the purposes of rename
2017-02-11 12:02:50 -06:00
Gregory Nutt
bd7d3a92f5
Add logic to VFS rename: If target of rename exists and is a directory, then the source file should be moved 'under' the target directory. POSIX also requires that if the target is a file, then that old file must be deleted.
2017-02-11 11:18:30 -06:00
Gregory Nutt
af5a8e73d3
VFS rename: Fix issues with rename to subdirectories and some softlink issues.
2017-02-11 10:08:23 -06:00
Gregory Nutt
1d290c2b37
setvbuf: Add support for disabling I/O buffering. Initially cut; untested.
2017-02-09 09:24:44 -06:00
Gregory Nutt
a92887c63d
setvbuf: Correct some errors detected by code review.
2017-02-08 14:06:29 -06:00
Gregory Nutt
9f859774a1
setvbuf: Add support for configuration of line buffering.
2017-02-08 11:28:24 -06:00
Gregory Nutt
51a14c9b2f
C Library: Add a very limited, first step implementation of setvbuf(). This is a collaborative effort. Alan Carvalho de Assis did the initial prototype.
2017-02-08 10:33:18 -06:00
Gregory Nutt
2d2fe301cb
Update some comments; link counter can be uint8_t; Add a debug assertion.
2017-02-07 15:50:54 -06:00
Gregory Nutt
b758176963
stat(): Add logic to avoid infinite recursive in circular paths containing soft links.
2017-02-07 12:32:45 -06:00
Gregory Nutt
aefe32d33f
soft links: Fix a memory leak by correcting a reference counting problem.
2017-02-05 15:14:16 -06:00
Gregory Nutt
45fd98da88
Add macros support that will eventually allow dynamic allocation of strings need to support soft links.
2017-02-05 14:25:45 -06:00
Gregory Nutt
8f2c7198ed
inode_find: Now takes struct inode_desc_s type as input. This was necessary before that structure includes some data storage. It was used within inode_find(), but that means that the life of the data was the life of inode_find(). That data must persist longer. It is now provided by the caller so that the life of the data persists for the entire life of the caller.
2017-02-05 09:51:42 -06:00
Gregory Nutt
0c9935f8ac
FS: Remove inode_find_nofollow. Instead provide a bool nofollow argument to inode_find.
2017-02-04 11:46:54 -06:00
Gregory Nutt
36704b7d9c
FS: Argument is now a structure describing the search.
2017-02-04 11:21:44 -06:00
Gregory Nutt
70dcec7df7
readlink: Fix bugs from initial testing
2017-02-03 14:12:24 -06:00
Gregory Nutt
4417e74977
Soft links: Add an (untested) implementation of readlink()
2017-02-03 13:57:12 -06:00
Gregory Nutt
60ba5a5261
Soft links: Fix logic and remove kludge of last commit. Rename inode_dereference() as inode_linktarget() and make global.
2017-02-03 13:22:33 -06:00
Gregory Nutt
7c59e05305
FS: Separate inode_search() and inode_free() from fs_inode.c and put in separate files. Flesh out symbolic link logic in stat() and readdir(). There are still some issues with stat().
2017-02-03 11:23:57 -06:00
Gregory Nutt
372e399bbc
Fix a typo
2017-02-03 07:36:25 -06:00
Gregory Nutt
b39d962021
Soft links: Update Documentation, rename file, add system calls
2017-02-02 17:11:08 -06:00
Gregory Nutt
35d738d85f
Soft links: Fix compile problems on first build with soft links enabled.
2017-02-02 15:24:39 -06:00
Gregory Nutt
bdc002fadc
Finish implementation of soft links.
2017-02-02 13:01:21 -06:00
Gregory Nutt
92305e400a
Soft links: Initial, incompete implementation
2017-02-02 10:39:41 -06:00
Gregory Nutt
b52e4e5ecd
Move cancellation point definitions to their own header file.
2016-12-10 09:08:26 -06:00
Gregory Nutt
bc3ca25cc7
Cancellation points: Close up some logic to eliminte some race conditions.
2016-12-10 08:36:58 -06:00
Gregory Nutt
03a58b2ebc
write(): Fix a misplaced #endif
2016-12-09 18:12:42 -06:00
Gregory Nutt
05f61def6a
Fix warning and link error due to missing header file.
2016-12-09 17:02:27 -06:00
Gregory Nutt
3eba0acb1c
More cancellation points.
2016-12-09 13:49:36 -06:00
Gregory Nutt
c9ca97b4b5
cancellation points are basically function. More tested is needed and additional cancellation points must be implemented before this can be merged back to master.
2016-12-09 12:01:18 -06:00
Gregory Nutt
dbbe46a2bc
fs: Disable priority inheritance on all semaphores used for signaling
2016-11-03 12:23:31 -06:00
Alan Carvalho de Assis
8fa14b8fed
Fix poll-related compile issues introduced with recent PTY changes
2016-07-16 07:03:38 -06:00
Gregory Nutt
11fe9378df
Fix some warnings
2016-07-16 07:02:06 -06:00
Gregory Nutt
bcb6095f1f
Add an assertion
2016-07-15 17:47:00 -06:00
Gregory Nutt
6a75f2df89
PTY: Add some encode to reduce the likely of misinterpreting the return value of the file open() method
2016-07-15 17:13:21 -06:00
Gregory Nutt
4b1553d3ad
PTY: Fix some tricky issues. Now seems to be working. A lot more testing is needed
2016-07-15 14:29:32 -06:00
Gregory Nutt
9ecd558002
Add the correct implementation of the file_poll() function
2016-07-15 11:34:08 -06:00
Gregory Nutt
6e6c04f778
Rename file_poll as fdesc_poll. The file_ namespace is used for other things.
2016-07-15 11:21:11 -06:00
Gregory Nutt
2689645b97
VFS ioctl() again. Per comments from David Sidrane, file_ioctl() should not return success if the ioctl method is not supported. It probably should return ENOTTY in that case.
2016-07-09 07:23:12 -06:00
Sagitta Li
1925df8faa
Fix some recently introduced errors
2016-07-09 06:51:07 -06:00
Gregory Nutt
02b91d9880
Add a SYSLOG character device that can be used to re-direct output to the SYSLOG
2016-07-05 12:58:18 -06:00
Gregory Nutt
a39ce80add
SYSLOG logic should use existing file interfaces, not re-invent them.
2016-07-05 12:12:44 -06:00
Gregory Nutt
ad2f7b0119
fs/: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.
2016-06-11 17:14: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
86b79b33cf
Reserver the name 'err' for other purposes
2016-06-11 14:40:07 -06:00
Gregory Nutt
fc3540cffe
Replace all occurrences of vdbg with vinfo
2016-06-11 11:59:51 -06:00
Gregory Nutt
001715d57b
FS: Add logic to detach a file structure from a file descriptor. This is for use only within the OS. It permits an open file or driver to be used across multiple threads.
2016-05-26 09:41:50 -06:00
Gregory Nutt
aa7a981674
Update some comments
2016-05-26 08:37:40 -06:00
Gregory Nutt
3f731241cb
fs/inode/, fs/vfs/, and sched/task/: File and socket descriptors are no longer allocated for kernel threads. They must use SYSLOG for output and the low-level psock interfaces for network I/O. This saves a little memory which might be important for small footprint configurations.
2016-04-14 10:14:38 -06:00
Gregory Nutt
9008308b64
Remove some block comments before empty code sections
2016-04-11 18:16:04 -06:00
Gregory Nutt
0fb035f76b
Standardize some naming in code section comments
2016-02-21 18:09:04 -06:00
Gregory Nutt
4a59ff34e9
Update submodules
2016-01-28 09:53:47 -06:00
Gregory Nutt
7d6c2d150d
fs/vfs/fs_poll.c: Fix handling of sem_tickwait() return value sem_tickwait() does not return an -1+errno, it returns a negated errno value. Noted by Freddie Chopin.
2016-01-27 13:42:39 -06:00
Gregory Nutt
f348e68069
Update to use 64-bit timer when available
2016-01-21 11:54:26 -06:00
Gregory Nutt
08213f830d
poll() and select() should not be built if poll() is disabled
2015-12-02 05:30:52 -06:00
Gregory Nutt
006528b144
Add support for freopen()
2015-11-22 08:39:17 -06:00
Gregory Nutt
84a5f846c9
open() has been extended. You can now open block drivers and access them just as you can character drivers. For example, you can hexdump a block device.
2015-11-21 11:24:55 -06:00
Gregory Nutt
c70987e551
nuttx/fs: Fix some spacing and alignment issues
2015-10-11 11:39:29 -06:00
Gregory Nutt
0b12dbf95d
Fix some spacing problems
2015-10-04 15:04:00 -06:00
Gregory Nutt
5b51a9fcdd
Standardize the width of all comment boxes in C files
2015-10-02 17:43:18 -06:00
Gregory Nutt
cb9e27c3b0
Standardize naming used for public data and function groupings
2015-10-02 16:30:35 -06:00
Gregory Nutt
cc7130b836
Correct a reference counting error in mq_open()
2015-09-23 10:34:08 -06:00
Anton D. Kachalov
8d57be2b6f
Eliminate compilation warnings
...
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
2015-08-26 00:14:50 +03:00
Gregory Nutt
dd7ffa481c
Fix a spelling error in a comment
2015-08-14 08:22:03 -06:00
Gregory Nutt
48107bf073
poll() now returns POLLERR for any file descriptor that returns a failure during the poll setup
2015-08-13 14:58:52 -06:00
- Max Neklyudov
3f8a084d01
fs/vfs/fs_poll.c: use sem_tickwait instead of sem_timedwait
2015-08-13 14:28:31 -06:00
Gregory Nutt
422ea4f673
Another epoll() change: Should not call printf from inside the OS
2015-08-10 10:41:58 -06:00
Gregory Nutt
c74dc5f83f
Changes from review epoll() implementation for consistency with NuttX naming and coding style
2015-08-10 10:38:41 -06:00
Anton D. Kachalov
fd07043180
Add simple epoll' wrapper around
poll'
...
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
2015-08-10 18:15:24 +03:00