Commit Graph

710 Commits

Author SHA1 Message Date
Xiang Xiao
af53bdb048 libc: Add opterr global variable
defined here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-21 07:01:08 -06:00
YAMAMOTO Takashi
8a70c6bf47 libs/libnx/nxfonts/nxfonts_cache.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
07a67c7b96 libs/libnx/nxmu/nx_eventhandler.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
aa653fef63 libs/libnx/nxglib/nxglib_splitline.c: Fix syslog formats
Note: b16_t is int32_t.
2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
02b92c5ad9 libs/libc/pthread/pthread_attr_setstacksize.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
efe8e24fe7 libs/libnx/nxmu/nx_eventhandler.c: Appease nxstyle 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
6d8ccccbb0 libs/libnx/nxglib/nxglib_splitline.c: Appease nxstyle 2020-11-20 22:22:53 -08:00
Alin Jerpelea
48e6f2051d audio: libsamplerate: add initial audio Sample Rate Converter
Add audio sample rate conversion library from
http://www.mega-nerd.com/SRC/index.html

Source:
https://github.com/libsndfile/libsamplerate

Add needed patches for NuttX OS and embedded boards.

NOTE:
We must use master branch until next stable release
2020-11-19 18:05:47 -08:00
YAMAMOTO Takashi
bc4780b8ba libs/libc/uuid/lib_uuid_from_string.c: Fix scanf format warnings 2020-11-18 00:44:55 -08:00
liuhaitao
fd94a32468 sysconf: add _SC_PAGESIZE sysconf support
Also implement getpagesize() based on sysconf(_SC_PAGESIZE).

Change-Id: I812eb8f34ed602f7bc12c4cafafcebc0d98fd136
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-11-17 02:03:23 -08:00
YAMAMOTO Takashi
1b4f65c7f2 libs/libc/uuid/lib_uuid_to_string.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
9c08c53e81 libs/libc/time/lib_strftime.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
2342b929e7 libs/libc/time/lib_strftime.c: Appease nxstyle 2020-11-16 05:46:53 -08:00
Xiang Xiao
b827565396 [libc++] Move the toolchain's macros undefinition to Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-15 08:28:36 -03:00
Xiang Xiao
8bc4a5b08a [libc++] Cherry pick patches from mainline to fix warnings
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-15 08:28:36 -03:00
Peter Bee
1f5786f5ea libc/stdlib: Fix range check in strtoul(l)
The previous implementation of strtoul(l) is flawed. The range check
assumed that when overflow happens, the truncated value is smaller than
the original value. As a counter example, passing "10000000000" to
strtol will not trigger ERANGE, but return a truncated value. This patch
adds more accurate range checks.

Change-Id: I239e034e390b4974157ed6efa17110f2e74904cf
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2020-11-12 06:01:33 -08:00
Xiang Xiao
84b90e00f0 libc/stdio: Preallocate the stdin, stdout and stderr
to handle the uninitialized stdin/stdout/stderr gracefully
report here:
https://github.com/apache/incubator-nuttx/issues/2203

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-11 09:56:10 -08:00
YAMAMOTO Takashi
f307d999e6 lib_libvsprintf.c: Implement "t" modifier for printf
Introduced by C99 for ptrdiff_t.
2020-11-10 00:03:06 -08:00
Xiang Xiao
b23bca5cb3 libcxx: Update 0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch
All changes come from:
from YAMAMOTO Takashi <yamamoto@midokura.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-08 13:04:43 -03:00
Xiang Xiao
e160bffe28 Remove all fclose with stdin, stdout and stderr
since it is wrong to close the builtin stream and specially note
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html:

Since after the call to fclose() any use of stream results in
undefined behavior, fclose() should not be used on stdin, stdout,
or stderr except immediately before process termination (see XBD
Process Termination), so as to avoid triggering undefined behavior
in other standard interfaces that rely on these streams. If there
are any atexit() handlers registered by the application, such a
call to fclose() should not occur until the last handler is
finishing. Once fclose() has been used to close stdin, stdout, or
stderr, there is no standard way to reopen any of these streams.

and it is also unnecessary because the stream always get flushed.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-29 20:43:50 +09:00
Yoshinori Sugino
c13f869432 Modify SIGSTP to SIGTSTP
Follow the POSIX description.
SIGTSTP should be sent when the Ctrl-Z characters is encountered, not SIGSTP.

Testing:
Built with hifive1-revb:nsh (CONFIG_SERIAL_TERMIOS=y, CONFIG_SIG_DEFAULT=y and CONFIG_TTY_SIGTSTP=y)
2020-10-29 01:12:43 -07:00
YAMAMOTO Takashi
ff3fa805a4 libxx: Use Kconfig "choice" to specify an implemenetation
It doesn't make sense to enable both of LIBCXX and UCLIBCXX.
This commit reflects it to Kconfig.
2020-10-28 14:10:30 -03:00
Yoshinori Sugino
079737dd0c libs/libc/signal/sig_pause.c: Fix a comment 2020-10-28 07:12:46 +01:00
Xiang Xiao
2b9282d5ee libc: Skip close stdin/stdout/stderr in fclose
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-26 22:16:53 -07:00
ligd
b69c587dc9 stdio: remove depends on setbuf setvbuf
N/A

Cause the function realize will handle this

Change-Id: I154c21c7a40667afae423bb0ebb67de8f5fc42fd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-10-26 22:12:02 -07:00
YAMAMOTO Takashi
07fc24ba99 libxx: Suppress -Wmissing-exception-spec on operator new 2020-10-26 22:08:40 -07:00
YAMAMOTO Takashi
4c7bf29e35 libxx: Add exception specifier to operator delete
CXX:  libxx_delete.cxx
libxx_delete.cxx:52:6: error: 'operator delete' is missing exception
      specification 'throw()' [-Werror,-Wmissing-exception-spec]
void operator delete(FAR void *ptr)
     ^
                                    throw()
1 error generated.
2020-10-26 22:08:40 -07:00
YAMAMOTO Takashi
6aef245523 libxx: Stop mentioning libs not integrated with this version of libxx 2020-10-26 22:07:39 -07:00
YAMAMOTO Takashi
caf67c817f libxx: Update README
This doc seems a bit outdated to me.
This commit is my best attempt to update it.
2020-10-26 22:07:39 -07:00
YAMAMOTO Takashi
df812d09a2 math: Make this friendly with libcxx
- Turn some macros into functions

- Implement some type-agnostic functions.
  (Just use __builtin_xxx)

- Add some missing function prototypes
  (Just prototypes, not actually implemented in this commit)
2020-10-25 07:30:14 -07:00
Yoshinori Sugino
7b3cb0a23b libs/libc/string/lib_strsignal.c: Fix a comment 2020-10-25 08:49:44 -03:00
dongjiuzhu
2b5be56bd0 serial/termios: support custom baud rate setting
N/A

Change-Id: I0cc00f6d0fda852533bd4a38ea6fc39e0d0059da
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-10-21 10:11:21 -07:00
Xiang Xiao
eb4121ce38 Change all 'Nuttx' to 'NuttX'
Unify the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Xiang Xiao
9928088868 libc: Don't fclose and fopen file in freopen
to avoid FILE pointer change after this commit:
commit b0797263ca
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Thu Aug 13 18:17:29 2020 +0800

    libc/stdio: Allocate file_struct dynamically

    1.Reduce the default size of task_group_s(~512B each task)
    2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-19 21:31:31 -07:00
Xiang Xiao
c67da1d2b5 libxx: Switch the package downloading from 11.0.0.rc1 to 11.0.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-12 20:33:55 +01:00
Yoshinori Sugino
5a1788822d libs/libc/signal/sig_wait.c: Fix a typo 2020-10-11 13:00:25 +08:00
raiden00pl
33901969fe Fix nxstyle warnings 2020-10-10 12:24:28 -06:00
raiden00pl
24e17910b2 libdsp: Changed headers for apache 2.0 license 2020-10-10 12:24:28 -06:00
Gregory Nutt
32b0562375 Add some comments to inet_ntop()
Endian-ness issues are mind boggling sometimes.  I have been confused by the logic in inet_ntop() a few times so I thought I would add some comments so that I (and others) will understand the endian-ness issues in the future.  No change to logic, only comments changed.
2020-10-05 03:00:22 +08:00
Nathan Hartman
80ce7800a9 Sources and Docs: Fix typos and nxstyle issues
Documentation/contributing/coding_style.rst:

    * Fix repeated words: ("this this").
    * Remove trailing spaces.

boards/z80/z80/z80sim/README.txt:

    * Fix repeated words: ("this this") and rewrap lines.

graphics/Kconfig,
libs/libc/math/Kconfig:

    * Fix repeated words: ("this this").

arch/arm/src/armv7-a/arm_assert.c,
arch/arm/src/armv7-r/arm_assert.c,
arch/arm/src/imxrt/imxrt_enet.c,
arch/arm/src/kinetis/kinetis_enet.c,
arch/arm/src/kinetis/kinetis_flexcan.c,
arch/arm/src/s32k1xx/s32k1xx_enet.c,
arch/arm/src/s32k1xx/s32k1xx_flexcan.c,
arch/arm/src/stm32/stm32_pwm.c,
arch/arm/src/stm32h7/stm32_pwm.c,
arch/arm/src/stm32l4/stm32l4_pwm.c,
arch/renesas/src/rx65n/rx65n_usbdev.c,
binfmt/libnxflat/libnxflat_bind.c,
drivers/pipes/pipe_common.c,
net/igmp/igmp_input.c,
net/tcp/tcp_conn.c,
sched/sched/sched_roundrobin.c:

    * Fix typo in comment ("this this").

arch/arm/src/cxd56xx/cxd56_usbdev.c,
arch/arm/src/lc823450/lc823450_usbdev.c:

    * Fix typo in comment and rewrap lines.

arch/arm/src/imxrt/imxrt_usbdev.c,
arch/arm/src/stm32/stm32_dac.c,
arch/arm/src/stm32f0l0g0/stm32_pwm.c,
arch/arm/src/stm32f7/stm32_pwm.c,
arch/arm/src/tiva/lm/lm4f_gpio.h,
fs/nxffs/nxffs_write.c,
include/nuttx/analog/pga11x.h,
include/nuttx/usb/usbdev.h,
net/mld/mld_join.c:

    * Fix typo in comment ("this this").
    * Fix nxstyle issues.
2020-10-02 04:54:52 +02:00
YAMAMOTO Takashi
3e6561c3cf lib_libvscanf.c: Implement "j" modifier for scanf
It's a part of C99 and commonly used these days.
2020-09-23 03:28:40 -07:00
Gregory Nutt
ebdfd16f0f Move gettid() implementation to /libs/libc/unistd
Move sched/task/task/task_gettid.c to libs/libc/unistd/lib_gettid.c.  gettid() is a dumb wrapper around getpid().  It is wasteful of resources to support TWO systme calls, one for getpid() and one for gettid().  Instead, move gettid() in the C library where it calls the single sysgtem call, getpid().  Much cleaner.
2020-09-22 19:40:56 -07:00
Xiang Xiao
f4794f0b48 libc: Implement access function correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6ae3abf79bd9aa8cfb54b8bbe302d69c4d9cb8ff
2020-09-22 10:30:36 +02:00
spiriou
a1c047fe53 libc/uio: enable writev() for sockets 2020-09-21 19:31:06 -07:00
Xiang Xiao
ba3f12c93f libc: Implement popcount/popcountl/popcountll
specified here:
https://www.unix.com/man-page/netbsd/3/popcountll/

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-21 07:37:04 -07:00
chao.an
216c33a5c7 libs/libc/stdlib: Implement mkdtemp(3) syscall
See the reference here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdtemp.html

Change-Id: I49081ecafc011a843e6067b1118b53bf65d4418b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:16:14 -07:00
chao.an
4067a9f057 libs/libc/stdio: correct the prototype of mktemp(3)
From:   int       mktemp(FAR char *path_template);
To:     FAR char *mktemp(FAR char *path_template);

See the reference here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/mktemp.html

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:16:14 -07:00
chao.an
0826b827ee libs/libc/time: add stub for futimes/ns(2)
Change-Id: I231817d10b9e2071b1f642e8694839b2a64b1c4c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 03:20:09 -07:00
chao.an
0f06c35640 unistd/priority: Implement [s/g]etpriority(2) syscall
See the reference here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/getpriority.html

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 01:06:51 -07:00
chao.an
b8fa1e51d8 time/tm: add "tm_zone" member into tm
base/time/time_exploded_posix.cc:190:14: error: ‘struct tm’ has no member named ‘tm_zone’; did you mean ‘tm_mon’?
  190 |   timestruct.tm_zone = nullptr;  // not a POSIX field, so mktime/timegm ignore
      |              ^~~~~~~
      |              tm_mon

Change-Id: I9f93e63b50c0692a7a2bfc47abd9d07aa2c8e8db
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:03:05 -07:00
chao.an
614ac5b0f2 libs/libc/unistd: Implement pipe2(2) syscall
See the reference here:
https://www.man7.org/linux/man-pages/man2/pipe2.2.html

Change-Id: Ife19b9bdbde73c7421be381a094da67017819e63
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:01:26 -07:00
Matias N
166242c171 use "export" to expose TOPDIR to all child make instead of passing it around every time 2020-09-15 21:11:33 -07:00
ligd
c38c821fc2 libs/libc/time: add gethrtime() support
Change-Id: I8882207d3a7e5062f70c7b4b95205361c71f8744
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-15 10:28:21 -03:00
ligd
b3541ccaf8 libs/libc/unistd: add dummy getrlimit & setrlimit support
Change-Id: Iee826204596c492ace853e49ab7ff26a2ae7fe60
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-15 10:28:21 -03:00
ligd
c11c1dc8fd libs/libc/stdio: replace double_t to double
Modify reason:

When build Nuttx SIM, in x86_64 system:

Compile with gcc option '-m64' (default):
sizeof(double_t) = 8
sizeof(double)   = 8

Compile with gcc option '-mx32':
sizeof(double_t) = 8
sizeof(double)   = 8

Compile with gcc option '-m32':
sizeof(double_t) = 12       // long double
sizeof(double)   = 8

When use '-m32', and print sth. like this:
printf("%f\n", (double)3.0);
SIM will print out: nan

This is because sizeof(double_t) is not equal with double.

Resolve:
replace all double_t to double in libs/libc/stdio.

As a user of '-m32', you should know double_t is one type
long double, and len is 12. And you use use '%lf' to print.
like:
printf("%lf\n", (double_t)3.0);

Currently we don't support '%lf'.

Change-Id: I9b9d11853140d5296dd80416c8ed6a260a9d2d9c
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-15 14:42:36 +08:00
Xiang Xiao
027e2eed28 libc: Implement umask function
Here is the spec:
https://pubs.opengroup.org/onlinepubs/009695399/functions/umask.html
Note: The simple implementaton is enough since
      NuttX doesn't really support the permission

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-14 12:16:58 -03:00
dongjiuzhu
03c7951cbd libc/termios: modify termios setting follow linux and posix
Change-Id: Id323b3169e74f4153fd8d132d20926b7fb8336a3
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-09-14 09:23:46 -03:00
Matias N
34b34e2d45 Fix: ensure archive files do not carry object files from prior builds
In some cases, when NuttX configuration changes and this makes the
object list used to build one of the .a libraries change as well,
since the command used to build it is "ar crs" and this simply appends
the list of object files, the library could still include object
files from prior builds. This commit modifies the ARCHIVE macro to
erase the .a file if it already exists.

Since in some cases this behavior was actually expected (object
files from a subdirectory were appended to a library created one
level above) I added a ARCHIVE_ADD which works as ARCHIVE did.

This change should greatly improve behavior of building after
configuration changes.
2020-09-14 15:54:18 +08:00
Xiang Xiao
b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
ligd
f428160dcc signal: add SIGQUIT & SIGTERM support
SIGQUIT SIGTERM are equal with SIGINT now

Change-Id: Iefc084d58db28003dc40a17f1ff3fbd7a0b716ed
2020-09-11 10:41:24 +08:00
Huang Qi
1025456ffa libs/libc/time: Add stub for utimes
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: Id4b51de943c4119d4d9ede1096475b1831593349
2020-08-29 23:21:47 +08:00
Xiang Xiao
b5f429c88b Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao
6670bc2b27 libc/time: Implement tm::tm_gmtoff field
defined by BSD and GNU library extension:
https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I33113bc322f038a3602880db4fb9cf93001947ac
2020-08-21 07:48:52 -03:00
Xiang Xiao
297c294c0f libc: Change ctype macro to normal function
to avoid the argument evaluation more than once

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib59c9bc8d259731bc6e7ff542379b74ba22d6e33
2020-08-21 16:56:00 +08:00
Xiang Xiao
beb745ef92 sched/pthread: Implement pthread_attr_[get|set]detachstate
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getdetachstate.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I84ec2d14f14cb7118aac3f7f356f83a5f9af4e18
2020-08-20 10:46:14 +01:00
qiaowei
1d97b2ecee stack check: Support Stack Smashing Protector(SSP)
and enable on sim as a demo. Here is the paper:
ftp://gcc.gnu.org/pub/gcc/summit/2003/Stackguard.pdf

Signed-off-by: qiaowei <qiaowei@xiaomi.com>
Change-Id: I1926936328dad54eee16b322dcaad0b42f9c4a62
2020-08-18 09:58:21 -07:00
Xiang Xiao
a7a81b5126 libc: Replace all [nx]sem_xxx with _SEM_XXX
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I34f407ccd52391588ac1b720fce59d24458fe218
2020-08-18 07:59:21 -07:00
chao.an
7ce2b3fa74 libc/pthread: Implement pthread_condattr_[g|s]etclock
Reference:
https: //pubs.opengroup.org/onlinepubs/009695399/functions/pthread_condattr_setclock.html

Change-Id: I19c15d5f219fcf28dbfeb2e5a1e3fc7b38ba2259
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 19:17:08 +01:00
Xiang Xiao
79d476e423 Fix libsupc++.a(vterminate.o): undefined reference to `_impure_ptr'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibbd9d980aa642b5a23016b54de8a7808db7b3b9f
2020-08-17 13:45:56 -03:00
Xiang Xiao
6039fb48ae libxx: Integrate libc++ latest official release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0a5f6dd8504382c49546c05399c2ea6470cd528
2020-08-17 13:45:56 -03:00
Xiang Xiao
4ebaf12b4b libxx: Ensure uClibc++ distclean clear
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-17 13:45:56 -03:00
chao.an
82caa786cc libc/fopen: add open for text (translated) access support
Change-Id: I5bb4e01a91a0f8ea82437cdcba191c484aa1b77f
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-16 00:01:36 +01:00
Huang Qi
57e1211ed6 math: Implement cbrt
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-08-14 07:27:55 -05:00
chao.an
7356b5a2ed libc: Implement strlcpy function
Reference:
http://www.delorie.com/djgpp/doc/libc/libc_763.html

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-14 03:44:26 -07:00
Xiang Xiao
4df42ba9fb libc/ftw: Fix error: cast between incompatible function types from 'ftw_cb_t' nftw_cb_t
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I9e617ac04127e1e9126de2e3d32b35f2c6d636c0
2020-08-11 08:16:58 -07:00
Xiang Xiao
b13f3212ad libc: Implement ftw and nftw function
see the reference here:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/ftw.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3b368106a56b0e9d4c653f3ae16304b0a9d55fbc
2020-08-11 16:44:42 +09:00
Huang Qi
fd78f83e02 drivers/video: Refine the update region notification mechanism
1.Expose the notification through fb_vtable_s::updatearea
2.Incorporate old nx_notify_rectangle into the new updatearea callback
3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea

Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-08-10 08:08:33 +02:00
Xiang Xiao
5c67eac27f libc: Change index/rindex from macro to function
to avoid the confliction with the same name variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-05 04:39:03 -07:00
Gregory Nutt
188d4b0fb4 user-space memalign() must not be called from within the OS.
drivers/net/ftmac100.c, libs/libc/stdlib/lib_aligned_alloc.c

A continuation of PRs #1507, #1510, and #1512.  See Issue #1481 for additional information.
2020-08-04 22:45:47 +01:00
spiriou
a4a9eb2f5a fs/vfs: Add file descriptor based events support 2020-07-31 15:09:35 -06:00
YAMAMOTO Takashi
b6316e9a03 libs/libc/modlib/modlib_sections.c: Remove a redundant assignment
Found by clang-check:

modlib/modlib_sections.c:93:3: warning: Value stored to 'buffer' is never read
  buffer    = loadinfo->iobuffer;
  ^           ~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
39ed1417d8 lib_libfread.c: Replace Gregory Nutt's copyright notice with Apache 2.0
The new license text was copied from sched_getcpu.c.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
15590005d0 lib_libfread.c: nxstyle fixes 2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
d02354c766 libs/libc/stdio/lib_libfread.c: Remove a redundant assignment
Found by clang-check:

stdio/lib_libfread.c:75:7: warning: Value stored to 'bytes_read' is never read
      bytes_read = -1;
      ^            ~~
1 warning generated.
2020-07-30 16:16:21 +02:00
Xiang Xiao
3cff139b85 libc: Make gethostname as syscall instead of uname
simplify and symmetry the implementation in KERNEL/PROTECTED build

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iefdeea5f6ef6348c774b2ca9f7e45fe89c0c22dd
2020-07-30 10:33:08 +09:00
Xiang Xiao
1cb1fb427d libc: Replace all malloc/free to lib_malloc/lib_free
since libc can be built and used in kernel space,
we must call kmm_malloc and kmm_free in this case.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-29 10:14:27 +01:00
SPRESENSE
e249a2f82f Makefile: Fix Make.dep not updated by config changes
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:

 1) Add source files by config symbol
 2) Include header files in #ifdef directive

These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
2020-07-28 03:59:45 -05:00
Masayuki Ishikawa
524f18c4cd libs: termios: Replace license header with Apache License 2.0
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-28 00:47:39 -05:00
Xiang Xiao
33ec242caf Implement proposed POSIX _clockwait variants of existing _timedwait functions
Here is the related glibc patchset:
https://patchwork.ozlabs.org/project/glibc/cover/cover.b0c66849a87ca79889a49f2f1f2563b1a8a15d8b.1551291557.git-series.mac@mcrowe.com/

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0095cb34cef3d0d88a100255053da79266b73ff2
2020-07-27 20:39:59 -03:00
Xiang Xiao
6c03a4e4d5 libc: Add uuid implemenation
specified by OpenGroup here:
https://pubs.opengroup.org/onlinepubs/009629399/toc.htm

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3bc585e7f4d41f6c2ea70e170276ab0d0399b088
2020-07-21 21:48:18 -07:00
Xiang Xiao
7c54f51dc0 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-19 19:35:21 -07:00
Xiang Xiao
e1ecb3e27c libc: Don't define localtime[_r] to macro when CONFIG_LIBC_LOCALTIME not define
since libc++ declare these function in ctime by:
using ::localtime[_r];

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0bb68b44c0cab838ab7cc34baee2aaa3ca8a9b5
2020-07-19 19:35:21 -07:00
Alan C. Assis
871613f271 libc: Typecast to avoid overflow in inet_addr for AVR
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-07-19 15:49:13 -03:00
Xiang Xiao
d6827cab60 arch: up_assert shouldn't call exit directly
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b
2020-07-19 01:21:36 +01:00
Xiang Xiao
ac7e5de5ae libxx: Integrate uClibc++ latest official release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I05377a0a7674f1cbe461ce67960bd3dc62729337
2020-07-17 21:40:34 +01:00
Xiang Xiao
6f6d61eec4 fs/vfs: Implement statvfs and fstatvfs
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-13 20:25:03 +01:00
Xiang Xiao
6abd03d53f libxx: Unify uClibc++ and libc++ config
code just need check CONFIG_CXX_EXCEPTION/CONFIG_CXX_LIBSUPCXX now,
instead uClibc++/libc++ specific config

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3b00a5a6701b8bf1c70de89f2d924592ca3e38b0
2020-07-13 15:08:13 -03:00
Xiang Xiao
aa0d57e8ad libc: Move unwind code to libs/libc/machine/arm
because the logic:
1.only work on arm platform
2.couple with elf format

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I25dc95b5fc7b24196e2e71fdcf82d71d621ee2d3
2020-07-11 10:34:22 -07:00
Xiang Xiao
9dff16e0e4 fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieaf325c899d1c349d64dfa15bddcc32afd1fce42
2020-07-10 21:30:02 +01:00
Xiang Xiao
c3e256e018 libxx: Make __dso_handle weak
since sim arch has to use other instance provided by host glibc
also initialize __dso_handle to self as glibc:
https://github.com/bminor/glibc/blob/master/csu/dso_handle.c#L21

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7531ae58fc4dbe4600bcb2c2c3a6cac021378bc1
2020-07-10 13:51:26 +09:00
Xiang Xiao
5da9cb3ae6 libxx: Eanble HAVE_CXXINITIALIZE automatically if LIBCXX or UCLIBCXX enable
otherwise the user is shocked that using cin/cout/cerr will crash the system

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I453427261f3e2a6e60f7dd2398f7d3bd1043a0d5
2020-07-09 13:19:54 +01:00
Oleg Evseev
9761235408 libs/libc/semaphore/sem_getvalue: correct get_value descriptions
avoid possible confusion and follow the description POSIX.1-2017
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_getvalue.html
2020-07-04 00:36:02 -05:00
Xiang Xiao
60fe0a0f96 libc: Refine the inline handling
1.Remove CONFIG_HAVE_INLINE macro
2.Change the ANSI C function to normal function
3.Other simple non ANSI function to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-04 11:10:29 +09:00
Xiang Xiao
8153e31753 sched: Call c++ global variables constructor inside nxtask_startup
to avoid the similar code spread around each application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8967d647eaf2ecae47f29f83e7fa322ef1b42a02
2020-07-01 07:55:33 -06:00
Xiang Xiao
e9c7df4769 sched: Rename task_startup to nxtask_startup
to follow the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3594d12a65e8cacea99bc295d622628304c3f9f8
2020-07-01 07:55:33 -06:00
Xiang Xiao
a102922e12 libc: Implement realpath
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie52dcd1c5c5faa4b033901eedd7182bbb9473f7a
2020-06-30 13:09:58 -06:00
ligd
0fe2884713 libs/libc/machine/risc-v: add rv32 support
Change-Id: I96a02aacea4e1d034f986f2937fe496da1f486ba
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-06-30 09:31:21 -03:00
Xiang Xiao
b71c491f00 libc/math: Fix warning: dereferencing type-punned pointer will break strict-aliasing rules
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I15aa5d664c20ea7bb95ba60e056134d2ff933db9
2020-06-29 16:25:22 +01:00
Xiang Xiao
43b613877d libc/stdio: Remove sys/types.h inclusion for printf/scanf
since double_t move from sys/types.h to math.h now and remove
math.h inclusion too because lib_dtoa_engine.h already include

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3497a73908301d999cf1cfc4a66552a7ca4868c6
2020-06-29 16:25:22 +01:00
Xiang Xiao
d17b963bca libc: Move double_t typedef from sys/types.h to math.h
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3497a73908301d999cf1cfc4a66552a7ca4868c6
2020-06-29 13:37:41 +01:00
Xiang Xiao
676a2b77f8 stdio.h: Implement fseeko and ftello function
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-29 14:26:19 +09:00
Xiang Xiao
977f04a2b1 libc: sysconf support _SC_NPROCESSORS_CONF/_SC_NPROCESSORS_ONLN
specified here:
https://www.man7.org/linux/man-pages/man3/sysconf.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I87fba8476221797e59c69c1953974bebc8d0d7b3
2020-06-27 22:43:13 +01:00
Masayuki Ishikawa
edd3dd3168 libs: rv64: Fix _calc_imm() in arch_elf.c 2020-06-25 02:21:23 -05:00
YAMAMOTO Takashi
ef5d204fd2 rewind: clear the error indicator
Make rewind() clear the error indicator of the stream
as it's specified by the standards.
2020-06-24 16:56:44 +08:00
Xiang Xiao
d24bd782a9 libc: Implement pathconf and fpathconf
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/fpathconf.html
note: only _PC_PATH_MAX is handled now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd323dc10e8f31f10dd1fc64f467227808c11dbd
2020-06-23 17:34:54 +01:00
Xiang Xiao
1e166f7ecb sysconf: Implement _SC_ATEXIT_MAX query
and remove the incorrect macro ATEXIT_MAX

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia5d7dafc50e942f62f95137313c34741c6dd60ba
2020-06-23 17:34:54 +01:00
YAMAMOTO Takashi
66052f7c4c mkstemp: Only look at the trailing Xs
As it's stated in the standards.

The original code look at the first Xs. It can end up with
an unexpected behavior, if a template contains multiple series of Xs.
E.g. /tmp/XXXXXX/XXXXXX
2020-06-16 19:47:42 +08:00
Peter van der Perk
55d9e5f7af net: Add SocketCAN support 2020-06-15 08:07:19 -06:00
Xiang Xiao
5fbf52788f libc/locale: Add the mininal support for locale_t operation
include duplocale, freelocale, newlocale and uselocale

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I9912003847dec660ae5c62836d4d56ebe0718869
2020-06-15 07:20:19 -06:00
Xiang Xiao
0317eae801 libc: support CONFIG_ARCH_ROMGETC for scanf function series
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieb524fa431ad60eb586a99d68aed4a022fb87ae7
2020-06-10 00:03:53 -07:00
Xiang Xiao
43d7c1e807 libc: Add IPTR for puts/fputs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2a83afb4d934a44ad1b56ec6dd72e654f4e112a3
2020-06-10 00:03:53 -07:00
liuhaitao
ac84a5177d libc/time: call _NX_OPEN/_NX_CLOSE instead of open/close
Change-Id: I1d8a17ae7cac11e445dba25a8699f98186910568
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-06-04 12:10:54 +01:00
Gregory Nutt
4935ab5243 printf() and vprintf() must use C buffered I/O if available.
This backs out a part of PR 1179 which has a very serious error:  If C buffered I/O is available, then printf() and vprintf MUST use it.  Otherwise, the ordering of the I/O will be screwed up.  They must not use direct file descriptor I/O UNLESS C buffered I/O is disabled.
2020-06-03 18:38:19 +01:00
Xiang Xiao
3c4fec80f8 libc: Fix warning: implicit declaration of function ‘strnlen’
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib2094a2ef0c3910e9b30685e73fc7012bf23a35f
2020-06-03 07:46:02 -06:00
Xiang Xiao
c76443f456 libc: Remove CONFIG_LIBC_TMPDIR definition from lib_mkstemp.c
since this file doesn't use this macro at all

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6042316a2568e35ed1b3dd0ab1b974ca5d23f02f
2020-06-03 07:46:02 -06:00
Xiang Xiao
4029706583 libc: tmpfile shouldn't hardcode the folder to /tmp
use P_tmpdir macro instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-03 07:46:02 -06:00
Xiang Xiao
29f9d97420 libc: Call vdprintf in printf/vprintf for CONFIG_NFILE_STREAMS == 0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3c49ec02a9444f039ac7aac7b8ea6de5d1090340
2020-06-03 07:35:08 -06:00
Xiang Xiao
a55f8d24a2 libc: Implement vscanf() function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2421e57b2c848c43afb749b8ebfa79ec457cde26
2020-06-03 07:35:08 -06:00
Xiang Xiao
6b3ac93e78 libc: Fix a typo error in tmpfile
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic6db2c76844a5a9d503fc46bb4b930870afbd9ed
2020-06-02 10:18:55 -06:00
Xiang Xiao
9ff32427bf libc: Implement tmpfile() function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I00bdb42006b40bf1b9bc0bb6865b9b88b4acbb7b
2020-06-02 09:32:25 -06:00
Xiang Xiao
de509004fd libc: Implement mblen, mbstowcs and wcstombs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I682c39fc132a1614b91284670882e331add765a9
2020-06-02 07:13:37 -06:00
Xiang Xiao
7cbcbcde51 libc: Implement wcsrtombs, wcsnrtombs and mbsnrtowcs
and update the related stuff in libs/libc/libc.csv

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id695a7f07bf18a7b4e526297f9131c75ddb79d30
2020-06-02 07:13:37 -06:00
Xiang Xiao
f1433ee8d2 libc: Fix the typo error in wcrtomb
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id8841ca33a47cea3a1b68229979fd607049f766d
2020-06-02 07:13:37 -06:00
Xiang Xiao
57caa4e121 libc: Move MB_LEN_MAX from lib_wctob.c to limits.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3a5addac99adb02f57aba05aa9fe2e6aaf31071d
2020-06-02 07:13:37 -06:00
YAMAMOTO Takashi
86b7c20b7d Implement "j" modifier for printf format
It's a part of C99 and commonly used these days.
2020-06-02 11:18:16 +02:00
YAMAMOTO Takashi
d884dd301f Fix nxstyle complaints
various nxstyle fixed to avoid the CI warnings
2020-06-02 11:18:16 +02:00
Xiang Xiao
b932b653dd arch: Select 64bit elf base on the architecture characteristic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I09eec5a76f255016a910cfec3b3f70cd7577525e
2020-05-31 21:38:32 -07:00
Xiang Xiao
7e5b0f81e9 build: Replace -I with INCDIR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 20:20:12 +01:00
Xiang Xiao
23668a4b9b build: Remove the empty variable assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:24:13 -06:00
Xiang Xiao
dd61d3d9f9 build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 18:00:40 +01:00
Gregory Nutt
154a87993f fs/vfs/fd_open.c: fs_fdopen() must not set errno
Functions within the OS must never set the errno value.  fs_fdopen() was setting the errno value.  Now, after some parameter changes, it reports errors via a negated errno integer return value as do most all other internal OS functions.
2020-05-23 15:22:09 +08:00
Xiang Xiao
1a95cce1a3 build: Move .config check to the top Makefile
remove the workaround to handle the inexistence of .config/Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-20 17:57:34 +01:00
Xiang Xiao
7faf3c0254 build: replace ${TOPDIR} with $(TOPDIR) in Makefile
make the usage consistence

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-19 19:23:18 +01:00
Xiang Xiao
5eae32577e build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:02:55 -06:00
Xiang Xiao
bd656888f2 build: Replace WINTOOL with CYGWIN_WINTOOL Kconfig
so the correct value can be determinated by Kconfig system automatically

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:02:55 -06:00
Gregory Nutt
a569006fd8 sched/: Make more naming consistent
Rename various functions per the quidelines of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    nxsem_setprotocol -> nxsem_set_protocol
    nxsem_getprotocol -> nxsem_get_protocol
    nxsem_getvalue -> nxsem_get_value
2020-05-17 14:01:00 -03:00
YAMAMOTO Takashi
76add63598 Bump the default of CONFIG_NETDB_DNSCLIENT_MAXRESPONSE
It's better to have a default working for many cases.
Usually DNS servers are not optimized for embedded clients.
Users can fine tune for their environment anyway.
2020-05-15 14:23:48 +08:00
YAMAMOTO Takashi
e783a59f9d netdb: Truncate the list of ips instead of bailing out with ERANGE
In many cases, users only care the first address anyway.
2020-05-15 14:23:48 +08:00
YAMAMOTO Takashi
b36420ef32 Bump the default of CONFIG_NETDB_BUFSIZE
The old default didn't work even for moderate cases.
(eg. strlen(name) == 17, two ipv4 addresses, on 64-bit sim)
2020-05-15 14:23:48 +08:00
liuhaitao
78c8b43b9c libs/libxx: add .cpp files build support
libcxx project has .cpp files inside, so add .cpp files build support
here.

Change-Id: Icd3bcb42f4ceafa5e07a9977149cb08d555a9ade
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-05-13 09:15:37 +02:00
Gregory Nutt
2b5ff17a85 setlogmask(): Add comments
In include/syslog.h and libs/libc/syslog/lib_setlogmask.c, add comments indicating tht setlogmask() is not thread-safe.
2020-05-11 11:32:55 -04:00
Nakamura, Yuuichi
46baccb521 Remove unnecessary enter/leave_critical_section() in setlogmask() because it is MT-unsafe. 2020-05-11 08:06:29 -06:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Gregory Nutt
9ce03b1660 Move pthread-specific data into TLS
1. Move pthread-specific data files from sched/pthread/ to libs/libc/pthread.
2. Remove pthread-specific data functions from syscalls.
3. Implement tls_alloc() and tls_free() with system calls.
4. Reimplement pthread_key_create() and pthread_key_free() using tls_alloc() and tls_free().
5. Reimplement pthread_set_specific() and pthread_get_specicif() using tls_set_value() and tls_get_value()
2020-05-08 18:05:04 +01:00
Gregory Nutt
3dca5eba15 Completes the Implementation of the TLS-based errno
- Remove per-thread errno from the TCB structure (pterrno)
- Remove get_errno() and set_errno() as functions.  The macros are still available as stubs and will be needed in the future if we need to access the errno from a different address environment (KERNEL mode).
- Add errno value to the tls_info_s structure definitions
- Move sched/errno to libs/libc/errno.  Replace old TCB access to the errno with TLS access to the errno.
2020-05-07 23:11:34 +01:00
Gregory Nutt
c2244a2382 Remove CONFIG_TLS
A first step in implementing the user-space error is force TLS to be enabled at all times.  It is no longer optional
2020-05-07 12:04:16 -06:00
Xiang Xiao
a2d924eea4 syscall: Fix typo error in cvs and header file
and reoder the entry in cvs file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Gregory Nutt
5c7a0bd9f0 Fix nxstyle complaints from files changed by this PR 2020-05-05 18:56:33 +01:00
Gregory Nutt
bda24f09c2 libs/libc/tls/tls_getinfo.c: Add tls_get_info()
Move the logic to get TLS information from an inline function to a normal function.  For the unaligned case, it is probably too large to be inlined.

Also fixes some minor things from review of previous commits.
2020-05-05 18:56:33 +01:00
Abdelatif Guettouche
b7e7fba732 TLS_UNALIGNED (#2)
* Implement the TLS_UNALIGNED
2020-05-05 18:56:33 +01:00
Gregory Nutt
b1071cca00 libs/libc/tls/Kconfig: Add CONFIG_TLS_ALIGNED
CONFIG_TLS_ALIGNED will select the (legacy) aligned stack implementation of TLS.  If CONFIG_TLS_ALIGNED is not defined, then the new, implementation of TLS using an unaligned stack will be enabled.
2020-05-05 18:56:33 +01:00
Xiang Xiao
d9d2fc0d0a debug: Reduce CONFIG_CPP_HAVE_VARARGS usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
6604cdb3f2 fs: Remove all LIBC_IOCTL_VARIADIC related stuff
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Brennan Ashton
8110ea6a7a x86_64: Make sure to clone ap list in vasprintf
VA_LIST is getting clobbered because it is a pointer to a structure
on the stack and we must traverse it twice.  Clone it like we do
for x86_32
2020-05-04 08:37:22 -06:00
Xiang Xiao
32b79b22ec Rename pipe2/mkfifo2 to nx_pipe/nx_mkfifo
and don't modify errno anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Gregory Nutt
00933cfece sched/sched: Add sched_get_stackinfo()
The new OS interface, sched_get_stackinfo() combines two pthread-specific interfaces into a single generic interface.  The existing pthread_get_stackaddr_np() and pthread_get_stacksize_np() are moved from sched/pthread to libs/libc/pthread.

There are two motivations for this change:  First, it reduces the number of system calls.  Secondly, it adds a common hook that is going to used for a future implementation of TLS.
2020-05-03 23:33:44 +01:00
Xiang Xiao
a2f6dc9b7c errno: Rename get_errno_ptr to __errno
Inrease the compatiblity with the third party library(e.g. newlib)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
patacongo
f09e58fe73 Update libs/libc/misc/lib_ioctl.c 2020-05-03 08:17:38 -06:00
Brennan Ashton
4e7d59f6bc Fix debug assert in ioctl to check if int will fit in
unsigned long not be unsigned long

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-05-03 08:17:38 -06:00
Xiang Xiao
31c60c3b0e syscall: nx_task_spawn should exist in the flat build just like the protected build
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-02 09:56:23 -06:00
Alan Carvalho de Assis
8c0fc09853 Vik memcpy() is already defined on string/Kconfig 2020-05-02 08:41:45 -06:00
Xiang Xiao
a2f657e4cb build: Move KDEFINE to a common place(tools/Config.mk)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 15:56:55 -06:00
Xiang Xiao
f2aba8d9b7 build: Remove 'u' prefix from userspace library
so user needn't link the different library because the build type change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 15:56:55 -06:00
Xiang Xiao
f8a809eb5b Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
eca7059785 Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
fe5cb9529d builtin: Remove HAVE_BUILTIN_CONTEXT macro
it's enough to decide which code should be compiled with CONFIG_BUILTIN and CONFIG_FS_BINFS

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
liuhaitao
6b4cc3011c Remove the residual files in distclean
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-05-01 04:43:15 +01:00
Ouss4
d0bb7c137a Use NuttX's signal set functions inside the OS. 2020-04-29 16:40:27 -06:00
Xiang Xiao
ddda00ea65 Kconfig: Refine BUILD_FLAT, BUILD_PROTECTED and BUILD_KERNEL usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-29 12:16:18 -06:00
liuhaitao
23389215bb libnx/nxfonts: change the generated file nxfonts_tom-thumb-4x6.c to nxfonts_bitmap_tom-thumb-4x6.c
Align the generated files name, so make distclean could also remove all nxfonts_bitmaps_*.c files, no
need to add one more extra DELFILE for nxfonts_tom-thumb-4x6.c.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-28 21:28:15 -07:00
Juha Niskanen
b34d7bf56d libc/netdb: support multiple DNS nameservers when not using resolv.conf
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-27 19:52:24 +08:00
Juha Niskanen
ba0a17ca8c libc/netdb: make getaddrinfo re-entrant also when querying with service name
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-27 19:52:24 +08:00
Alin Jerpelea
76c47f6b21 libc: audio: nxstyle fixes
This change is needed to be able to fix the warnings on the audio core
and includes the propagation of the fix in the audio.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-04-21 17:19:52 -06:00
YAMAMOTO Takashi
33aaefa2d1 modlib: Replace Gregory Nutt's copyright notice with Apache 2.0
While I'm here adding a new file. (modlib_loadshdrs.c)

The licence text was copied from:
    sched/sched/sched_getcpu.c
    tools/zds/Makefile
2020-04-13 09:49:22 -06:00
YAMAMOTO Takashi
7cfcea2938 Move modlib_loadshdrs to a separate file
To avoid pulling otherwise unused modlib_findsection when linking.
2020-04-13 09:49:22 -06:00
YAMAMOTO Takashi
1adc44e059 Enable modlib_findsection
This fixes unused warning on modlib_findsection
2020-04-13 09:49:22 -06:00
YAMAMOTO Takashi
6f3e127094 Appease nxstyle complaints 2020-04-13 09:49:22 -06:00
Gregory Nutt
759d8c1bfa Run nxstyle against files modified in previous commit. 2020-04-13 02:09:34 +08:00
Gregory Nutt
ca2b0a3657 Fix more warnings noted in PR checks
arp/arp_notify.c:132:43: warning: for loop has empty body [-Wempty-body]
           prev = curr, curr = curr->nt_flink);
                                              ^

    sixlowpan/sixlowpan_tcpsend.c:806:31: warning: implicit conversion from 'unsigned int' to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Wconstant-conversion]
                                  _SO_TIMEOUT(psock->s_sndtimeo));
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Numerous warnings like:

    ieee802154_getreq.c:93:3: warning: implicit declaration of function 'memcpy' is invalid in C99 [-Wimplicit-function-declaration]
      IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
      ^

    nxfonts/nxfonts_cache.c:839:35: warning: for loop has empty body [-Wempty-body]
               fcache = fcache->flink);

    bluetooth/bluetooth_finddev.c💯11: warning: implicit declaration of function 'memcmp' is invalid in C99 [-Wimplicit-function-declaration]
          if (BLUETOOTH_ADDRCMP(dev->d_mac.radio.nv_addr, match->bf_addr))
              ^

    rwbuffer.c:559:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      if (rwb->rhmaxblocks > 0 && rwb->rhnblocks > 0)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-04-13 02:09:34 +08:00
Gregory Nutt
2aabf76815 Run nxstyle against modified files in PR 2020-04-13 02:09:34 +08:00
Gregory Nutt
62c1389825 Fix warnings noted in PR build checks:
net/telnet.c:1317:40: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
                      if (priv->td_pending < CONFIG_TELNET_RXBUFFER_SIZE)
                          ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    time/lib_localtime.c:569:32: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [33]' [-Wsizeof-array-decay]
              sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name))
                     ~~~~~~~~~~~~~ ^
2020-04-13 02:09:34 +08:00
chao.an
c3b0848284 misc/Kconfig: enable LIBC_IOCTL_VARIADIC by default
Change-Id: I7bc23a6552af7b443eb433e4d2e3c2c8784b3956
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-04-12 09:27:41 -06:00
Gregory Nutt
72104c182c nxstyle fixes
Run all files modified by PR 766 through nxstyle and fix any resulting complaints.

NOTE:  Numerous "Mixed case identifier" errors in arch/arm/src/cxd56xx/cxd56_gnss.c were not fixed because this problem is of much larger scope than this file.
2020-04-11 21:19:47 +01:00
Gregory Nutt
67ec3d7926 Remove CONFIG_CAN_PASS_STRUCT
This commit resolves issue #620:

Remove CONFIG_CAN_PASS_STRUCTS #620

The configuration option CONFIG_CAN_PASS_STRUCTS was added many years ago to support an old version of the SDCC compiler. That compiler is currently used only with the Z80 and Z180 targets. The limitation of that old compiler was that it could not pass structures or unions as either inputs or outputs. For example:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    struct mallinfo mallinfo(void);
    #else
    int      mallinfo(FAR struct mallinfo *info);
    #endif

And even leads to violation of a few POSIX interfaces like:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    int  sigqueue(int pid, int signo, union sigval value);
    #else
    int  sigqueue(int pid, int signo, FAR void *sival_ptr);
    #endif

This breaks the 1st INVIOLABLES rule:

Strict POSIX compliance
-----------------------

  o Strict conformance to the portable standard OS interface as defined at
    OpenGroup.org.
  o A deeply embedded system requires some special support.  Special
    support must be minimized.
  o The portable interface must never be compromised only for the sake of
    expediency.
  o Expediency or even improved performance are not justifications for
   violation of the strict POSIX interface

Also, it appears that the current SDCC compilers have resolve this issue and so, perhaps, this is no longer a problem: z88dk/z88dk#1132

NOTE:  This commit cannot pass the PR checks because it depends on matching changes to the apps/ directory.
2020-04-11 21:19:47 +01:00
liuhaitao
459ad99373 Use EXTRAFLAGS instead of EXTRADEFINES to be used by make via command line
So call 'make EXTRAFLAGS=-Wno-cpp' could suppress the warnings with pre-processor
directive #warning in GCC.

Change-Id: Iaa618238924c9969bf91db22117b39e6d2fc9bb6
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-11 08:31:08 -06:00
ligd
cbf31bca5c global change: fix tools/checkpatch.sh warnnings
Change-Id: I88cfa979c44bcaf3a8f6e036c6bfccd3402ca85a
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
ligd
231ad202ee global change: repace sched_xfree() to kxmm_free()
Changes:
sched_xfree() => kxmm_free()
remove garbage related APIs
remove ARCH_HAVE_GARBAGE

Cause garbage feature move to mm_heap, then don't need
garbage anymore.

Change-Id: If310790a3208155ca8ab319e8d038cb6ff92c518
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
raiden00pl
abfb074110 libs/libdsp: fix nxstyle issues 2020-04-03 22:51:39 +01:00
YAMAMOTO Takashi
a62aa84448 MODLIB_SYSTEM_SYMTAB: Rename the generated file
To avoid conflict with ./libs/libc/modlib/modlib_symtab.c
2020-04-03 10:48:09 -06:00