Commit Graph

784 Commits

Author SHA1 Message Date
Masayuki Ishikawa d393f43caa Merged in masayuki2009/nuttx.nuttx/network_test (pull request #617)
Fix some bugs in networking

* netdb: Fix boundary conditions in dns_recv_response()

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* Fix typos in include/nuttx/net/dns.h

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-03-27 01:31:06 +00:00
Gregory Nutt 8b4b61f140 fs/cromfs: Fix a error in reading partial compressed blocks. The LZF decompressor does not support that operation. Instead we have to decompress full block into a temporary buffer and copy out the parts that we need. To compensate for the performance hit, a caching mechanism was added so that we do not have to read the same block repeatedly. Unrelated: Also updates some README files. 2018-03-24 11:30:35 -06:00
Masayuki Ishikawa 1d958980bd Merged in masayuki2009/nuttx.nuttx/fix_smp_bugs (pull request #615)
Fix SMP related bugs

* sched/sched: Fix a deadlock in SMP mode

    Two months ago, I introduced sched_tasklist_lock() and
    sched_tasklist_unlock() to protect tasklists in SMP mode.
    Actually, this change works pretty well for HTTP audio
    streaming aging test with lc823450-xgevk.

    However, I found a deadlock in the scheduler when I tried
    similar aging tests with DVFS autonomous mode where CPU
    clock speed changed based on cpu load. In this case, call
    sequences were as follows;

    cpu1: sched_unlock()->sched_mergepending()->sched_addreadytorun()->up_cpu_pause()
    cpu0: sched_lock()->sched_mergepending()

    To avoid this deadlock, I added sched_tasklist_unlock() when calling
    up_cpu_pause() and sched_addreadytorun(). Also, added
    sched_tasklist_lock() after the call.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* libc: Add critical section in lib_filesem.c for SMP

    To set my_pid into fs_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* mm: Add critical section in mm_sem.c for SMP

    To set my_pid into mm_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* net: Add critical section in net_lock.c for SMP

    To set my pid (me) into fs_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-03-20 12:34:38 +00:00
Gregory Nutt 278cc6f70a libc/lzf: Fix some typos in code that was in conditional logic that was not building. Change a literal use of 13 to HLOG which used to be 13. 2018-03-19 16:50:45 -06:00
Gregory Nutt af8b291482 libc/zxf: Fix more coding standard issues. 2018-03-19 14:43:50 -06:00
Gregory Nutt ed59157a4b libc/lzf: Define structures to represent LZF headers. 2018-03-18 12:31:50 -06:00
Boris Astardzhiev 6cd607c298 libc/lzf: Refactor so that the user is no longer required to generate the LZF header 2018-03-16 09:54:55 -06:00
Gregory Nutt 90c6d71503 Update some comments. 2018-03-16 09:34:09 -06:00
Gregory Nutt 8f914ef9ca libc/lzf/Kconfig: Remove some kruft left in the file. 2018-03-15 17:29:12 -06:00
Gregory Nutt eb4539c305 libc/lzf: Update Kconfig comments 2018-03-15 14:21:07 -06:00
Gregory Nutt 5fc6178201 libc/lzf: Another trivial coding standard fix. 2018-03-15 10:47:00 -06:00
Gregory Nutt 43ba19025d Update some function headers. 2018-03-15 09:19:26 -06:00
Gregory Nutt 0ab037e6b4 libc/lzf: lzf_compress() now expects the hash table as user allocated input parmeter rather than declaring the huge array on the stack. 2018-03-15 08:51:32 -06:00
Gregory Nutt 9acfbd2163 libc/lzf: Make HLOG configurable
(cherry picked from commit ea77dfafe1afe7d399e47871d2ec81fea99626cc)
2018-03-15 08:32:24 -06:00
Gregory Nutt d3cf5de5f4 libc/lzf: Fix an error introduced in coding standard conversion.
(cherry picked from commit 8879116fe85558520c4811dc4ab780b28e66810d)
2018-03-15 08:32:04 -06:00
Boris Astardzhiev 25eb417c12 libc/lzf: Add Marc Alexander Lehmann's LIBLZF3.6 librrary 2018-03-14 14:48:53 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt 1a990f99d1 libc/time: Add an implementationof clock() 2018-03-13 08:07:29 -06:00
Juha Niskanen 628821fdf4 arch/srm/src/stm32f7: Add CONFIG_RTC_PERIODIC support. Also makes the RTC lowerhalf more like in STM32L4. 2018-03-05 07:46:58 -06:00
Gregory Nutt de6b13b3ab Per OpenGroup.org, syslog -- and, hence, nonstandard vsyslog, and debug wrappers -- does not return a value. Rename _vsyslog to nx_vsyslog. Use internal nx_vsyslog in the few cases where a return value is required. 2018-03-04 08:07:07 -06:00
Gregory Nutt b901f08d90 Trivial changes from review of last PR. 2018-02-26 11:48:57 -06:00
Dmitriy Linikov 39ef04353c Merged in hardlulz/modem-3.0-nuttx/fix-parsing-dns-response (pull request #605)
Fixed parsing of DNS response packets having compressed names ending with pointer.

There were troubles parsing response packets which have compression of
QNAME/NAME field when only trailing part of the name (not the whole name)
is replaced with pointer to another part of the packet.
This commit fixes parsing of such packets.

Also I added checks to keep parsing only in bounds of the read part
of DNS response packet.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-02-26 17:43:37 +00:00
Dmitriy Linikov a8c58607e9 Merged in hardlulz/modem-3.0-nuttx/fix-sem-EINTR (pull request #603)
Added ECANCELED condition to DEBUGASSERT-s checking sem_wait result

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-02-20 18:24:53 +00:00
Alan Carvalho de Assis fb50c44d08 Fix various issues noted by Coverity 2018-02-06 09:13:16 -06:00
Masayuki Ishikawa c8a372702a sched/sched: SMP: Fix this_task() to be an atomic operation. In the previous implementation, this_task() was defined in sched.h by using just a macro current_task(this_cpu()). However, I found that this is not atomic and actually sometimes switching CPU happened in executing the macro when we tested audio steaming plus executing commands via telnet. This change resolves this issue by implementing atomic this_task()in sched_thistask.c which is newly introduced. 2018-02-04 16:59:09 -06:00
Gregory Nutt 2683f713ab Make sure that labeling is used consistently in all function headers (part 3). 2018-02-01 12:17:03 -06:00
Gregory Nutt 1567b82429 Make sure that labeling is used consistently in all function headers (part 2). 2018-02-01 12:03:55 -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 e93cb86903 libc/stdio: in dtoa(), up_interrupt_context() is used in a debug assertion. up_interrupt_context() is not available in the user-mode phase of the PROTECTED or KERNEL build configurations. In those configurations, enabling libc floating point support and debug assertions will result in an undefined reference to up_interrupt_context(). 2018-02-01 07:37:16 -06:00
Gregory Nutt 3521aaf944 Squashed commit of the following:
binfmt/, configs/, grahics/, libc/, mm/, net/, sched/:  OS references to the errno variable should always use the set_errno(), get_errno() macros
    arch/arm/src/stm32 and stm32f7:  Architecture-specific code is not permitted to modify the errno variable.  drivers/ and libc/:  OS references to the errno variable should always use the set_errno(), get_errno() macros
2018-01-30 17:57:36 -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 7a2e300890 Documentation: Update NSH manual to include truncate command. 2018-01-04 12:51:01 -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 30dbae2dbe reopen should return NULL when oflags is less than 0, not equal to 0.
Because negative value is returned on failure of lib_mode2offlags which converts the mode string into file open mode flag.
2017-12-21 12:04:17 -06:00
Oleg Evseev d55e44b2ea Fix sscanf character conversion (%c): do not add '\0' at the end as for strings, cause, for example, parsing one character will fill two bytes: character itself and zero one '\0' after it, so will overflow one byte variable argument and corrupt memory for variables allocated after it. 2017-11-19 13:33:46 -06:00
Gregory Nutt ef89207c8d Build system: Fix CONFIG_BUILD_KERNEL logic directories that have ubin and kbin subdirectories. Conditional logic was fine for CONFIG_BUILD_FLAT and CONFIG_BUILD_PROTECTED but generated useless dependencies if CONFIG_BUILD_KERNEL. 2017-11-15 07:54:09 -06:00
Gregory Nutt 35ee844590 sched/signal/sig_nanosleep.c and libc/time/lib_nanosleep.c: Implement clock_nanosleep(). nanosleep() is now reduced to a libc wrapper around clock_nanosleep(). 2017-11-11 17:44:59 -06:00
Gregory Nutt bf7839d0f0 libc/signal: Add support for sigwait(). 2017-11-11 12:37:47 -06:00
Gregory Nutt 5004e8b3ea libc: Add support for readv() and write(). Also includes some cosmetic changes to some unrelated files. 2017-11-11 11:44:14 -06:00
Masayuki Ishikawa 51b19d5f38 Merged in masayuki2009/nuttx.nuttx/lc823450 (pull request #531)
lc823450-xgevk audio support

* arch/arm/src/lc823450: Add IPL2 support

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* configs/lc823450-xgevk: Add IPL2 support

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* libc/audio: Fix compilation error in lib_buffer.c

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* drivers/audio: Add WM8774 support

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* arch/arm/src/lc823450: Add I2S support

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* configs/lc823450-xgevk: Add WM8774 support

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-11-08 12:25:13 +00:00
Gregory Nutt 7deb24484c This comment converts the underlying IPC used by the UserFS from Unix domain local sockets to UDP LocalHost loopback sockets. The problem with the local sockets is that they do require operations on the top level psuedo-file system inode tree. That tree must be locked during certain traversals such as enumerate mountpoints or enumerating directory entries.
This conversion is unfortunate in the sense that Unix local domain sockets are relatively lightweight.  LocalHost UDP sockets are much heavier weight since they rely on the full UDP stack.  If anyone is up for a complete redesign, then using some shared memory and a POSIX message queue would be lightweight again.

This commit also fixes several bugs that were not testable before the inode tree deadlock.  I cannot say that the logic is 100% stable but it does not have basic functionality.

Squashed commit of the following:

    fs/userfs:  Order locking so that access to the shared I/O buffer is also locked.
    fs/userfs:  Converts to use LocalHost UDP loopback for IPC.
2017-11-05 12:25:58 -06:00
Gregory Nutt de5b36c198 Update TODO for broken local socket feature; Add work around to UserFS for broken local socket feature. 2017-11-01 09:16:10 -06:00
Gregory Nutt 19f8933f76 libc/userfs: Correct return value from dispatchers. Should return zero on success, not the number of bytes sent. 2017-11-01 09:16:10 -06:00
Gregory Nutt 0614f9673b fs/userfs: Some fixes from initial testing. 2017-10-31 15:26:58 -06:00
Gregory Nutt 6e9039bb08 Squashed commit of the following:
fs/userfs:  This completes coding of the UserFS client and of the UserFS feature in general.  This feature is being merged to main now because I believe it is innocuous.  It is, however, untesed.  The next step will be to develop a test case to verify the feature.
    fs/userfs:  Completes the request logic for the UserFS client.  Still need the logic that receives the responses.
    fs/userfs:  Completes coding for most of the server side of the user filesystem logic.
    fs/userfs:  Big design changes, simplications. Use Unix domain local sockets instead of message queues.  Easier to transfer big data in local sockets than message queues.  Remove character drvier 'factory' it is not necessary.
    fs/userfs:  Minor reparitioning; volume private info does not need to be held on the OS client side.
    libc/userfs:  Add some of the server side logic.
    fs/userfs:  Add some UserFS initialization logic.
    fs/userfs:  Add frame work for the UserFS proxy.  Remove all references to a block driver.  There is no block dricer... what was I thinking?
    fs/userfs: Add some initialization of the character driver, 'factory' device.
    fs/userfs:  Rename from fusefs to userfs to that we don't stomp on someone else's cool name.
    Add a header file describing the fusefs interface.
2017-10-30 18:07:42 -06:00
Alan Carvalho de Assis 0ef127e273 libc/match: Use of exp() vs expf() in logf() caused function to be slow. 2017-10-19 09:14:34 -06:00
Gregory Nutt d0102bdd4c Fix a warning found in build testing. 2017-10-11 14:41:16 -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