Commit Graph

367 Commits

Author SHA1 Message Date
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
YAMAMOTO Takashi
804c719319 getnameinfo: Rename a variable to avoid shadowing a global 2020-04-02 14:17:15 +08:00
YAMAMOTO Takashi
da48d912e4 gethostbyaddr_r: Fix an unsed variable warning 2020-04-02 13:38:21 +08:00
Xiang Xiao
4addf6c308 libc/netdb: query IPv6 first than IPv4
since some host have multiple IPv4 address, the dns cache may fill in all
Ipv4 address and refuse to accept any IPv6 address if we query IPv4 first

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I229a7a524fb9daa7498c66913a2de61f11d6fb43
2020-04-01 16:09:28 -06:00
Xiang Xiao
0b662d60fc libc/netdb: Add hostent_s to avoid the change of hostent
and let other function call the new internal function gethostentbyname_r

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic6137d6cf03f75d6ed33e23bf04ae74b7264e682
2020-04-01 16:09:28 -06:00
Xiang Xiao
99dc8bf4e9 libc/netdb: Return EAI_FAMILY in getaddrinfo if the final address is empty
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I510d4e8f79d2b4e78c550b35b7b07f2d0943e32d
2020-04-01 16:09:28 -06:00
Xiang Xiao
8d66a316da libc/netdb: Support save the mix of IPv4/IPv6 address into hostent
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I704d38afde14b6d90a7726096fd1f483f96ba237
2020-04-01 16:09:28 -06:00
Xiang Xiao
7f2810f73a libc/netdb: Should query both IPv4 and IPv6 address regardless the server address type
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1ba17b3078837cd5b857a13f104550613050d3e0
2020-04-01 16:09:28 -06:00
Xiang Xiao
2e57583219 libc/netdb: Connect to the server before sending
so we can remove the server check in response

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ddc00807feb92bb6f0851023bb63d38bf3fdac2
2020-04-01 16:09:28 -06:00
YAMAMOTO Takashi
4dffb8c584 Fix a typo in Kconfig help 2020-04-01 10:23:56 +01:00
Xiang Xiao
15fac7743c libc/netdb: Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-03-30 09:47:28 -06:00
Xiang Xiao
d8b5362380 libc/netdb: Fix typo error in the implementation of gethostbyname_r
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6675e800ad5627881ca904e80317df94f5973eb7
2020-03-30 09:47:28 -06:00
Xiang Xiao
dd0aca6822 libc/netdb: Make host and serv optional for getnameinfo
and fix other minor style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I107ee5b141f39e1e08967373b1ead4495bc55aa7
2020-03-30 09:47:28 -06:00
Xiang Xiao
a709c83b2e libc/netdb: Make gethostbyaddr_r callable even without CONFIG_NETDB_HOSTFILE
and fix other minor issue

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1c12440cfb7aef4394539e02a12aeb10088f236b
2020-03-30 09:47:28 -06:00
Xiang Xiao
c85fe67ebc net/loopback: Move g_lo_* global variable to libc/net/
so netdb could reuse these global variable directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iaa26ddbdaf416f64d43c6e8888a14bbe0c3405eb
2020-03-30 09:47:28 -06:00
Xiang Xiao
eaab17b66a libc/netdb: Change the default max number of host IP to 2 if both IPv4 and Ipv6 enable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I02614cb34647eaa03b476a6755d0667dc8392036
2020-03-30 09:47:28 -06:00
Xiang Xiao
bd9fbade05 libc/netdb: Fix the buffer overwrite in lib_parse_hostfile
and other minor issue

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I732f63a312ac5c2ddf61ab8084c404bde1b114d4
2020-03-30 09:47:28 -06:00
Xiang Xiao
9e277c6c50 libc/netdb: Return null alias for getservbyport_r/getservbyname_r
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I82728a8ea9a5136e0154cd67ec8de70a4e0ac6ed
2020-03-30 09:47:28 -06:00
Xiang Xiao
d05de762bc libc/netdb: Don't need call dns_initialize in dns_find_answer
so let remove it

Change-Id: I6b09673caf8cb16d90cbda8b791f1ef0ba59e2a2
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-03-30 09:47:28 -06:00
Xiang Xiao
673a43d5fa libc/netdb: Need skip ':' to get port in dns_foreach_nameserver
Change-Id: Ic9555832c4404a59e1117dce06a5de13f0cc4141
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-03-30 09:47:28 -06:00
Xiang Xiao
35b98f2361 libc/netdb: Change the fopen mode from "rt" to "r"
since the text mode is the default

Change-Id: If4df0c69d998a36df541a968d14fc4d6e159db57
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-03-30 09:47:28 -06:00
Xiang Xiao
64a230df7a libc/netdb: Should use ntohs not htons for the receiving data
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36e508c1ba952d9229790abdb47f4f9dc654d326
2020-03-30 09:47:28 -06:00
Xiang Xiao
07c3b16462 libc/netdb: Replace get_errno with errno
and fix the typo error

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I51e2e4dbdb46fea89f4e18a41d99b943b03cedab
2020-03-30 09:47:28 -06:00
YAMAMOTO Takashi
c62f806581 sim: modlib: Implement some x86_64 relocations
The boilerplate part of the code was copied from:

    libs/libc/machine/risc-v/rv64/arch_elf.c
2020-03-27 00:04:36 -05:00
YAMAMOTO Takashi
bd7829a44d modlib: Don't truncate 64-bit values 2020-03-27 00:04:36 -05:00
YAMAMOTO Takashi
f8077022bd Introduce CONFIG_DEFAULT_TASK_STACKSIZE
* The appropriate size of stack varies among archs.
  E.g. for 64-bit sim, 2048 is way too small, especially when the task
  happens to use host OS functionalities.
  I plan to allow an arch provide its own default.

* I plan to use this to replace hardcoded "STACKSIZE = 2048" in APPDIR.
2020-03-26 22:30:13 -05:00
Gregory Nutt
5c0e8e88b1 Revert "Makefile: move INCDIROPT to common place (#625)"
This reverts commit b9ace36fcc.

This change was added by PR 625 but has a serious logic flaw.  It removes all occurrences of INCDIROPT and replaces it with a definition in tools/Config.mk:

    else ifeq ($(WINTOOL),y)
      DEFINE = "$(TOPDIR)/tools/define.sh"
      INCDIR = "$(TOPDIR)/tools/incdir.sh" -w

This logic flaw is the Config.mk is included in all Make.defs files BEFORE WINTOOL is defined.  As a result, the definition is wrong in many places when building under Cygwin with a Windows native toolchain.
2020-03-26 08:50:29 -07:00
Xiang Xiao
b9ace36fcc
Makefile: move INCDIROPT to common place (#625) 2020-03-26 08:09:59 -06:00
YAMAMOTO Takashi
1ffa009c8b Revert "Don't generate .depend anymore"
This reverts commit 79af7fbf4e.

Because:

* btashton reported some issues in local builds:

  https://github.com/apache/incubator-nuttx/pull/603#issuecomment-602264860

* this might be related to the current CI breakage:

  > /bin/sh: 1: /__w/incubator-nuttx/incubator-nuttx/nuttx/tools/mkdeps: not found
2020-03-22 23:07:29 -05:00
Xiang Xiao
79af7fbf4e
Don't generate .depend anymore 2020-03-22 18:15:29 +00:00
Gregory Nutt
547a3cb3d9 Run all .c and .h files in previous commits through nxstyle. 2020-03-22 08:24:07 -05:00
Gregory Nutt
533528af01 libs/libc: Remove support CONFIG_FS_READABLE 2020-03-22 08:24:07 -05:00
Gregory Nutt
382513e997 libs/libc: Remove support for CONFIG_FS_WRITABLE
The mktemp family of functions are built unconditionally now (but not necessarily included in any  build).
2020-03-22 08:24:07 -05:00
Nathan Hartman
a5e643b0cd Fix typos in comments and documentation. 2020-03-16 20:01:11 -06:00
YAMAMOTO Takashi
df44909b30 xtensa/arch_elf.c: Ignore R_XTENSA_NONE
Now examples/sotest passes on qemu.
2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
061b796d47 Adapt dlfcn/modlib to use the instruction memory allocator 2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
e135c938d2 xtensa: Implement a few relocations 2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
2776a5bbea Replace a few Gregory Nutt's copyright notices with Apache 2.0
The text was copied from sched/sched/sched_getcpu.c.
2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
b2627225bd Update file paths of copy-and-paste'ed files 2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
c7526e551e arch_elf.c: Appease nxstyle errors 2020-03-16 07:54:49 -06:00
YAMAMOTO Takashi
5e1b24f012 xtensa: Add modlib boilerplate
This is a modified copy of armv6-m/armv7-m version.
2020-03-16 07:54:49 -06:00
Gregory Nutt
266849549a libs/libc/netdb/lib_dnsaddserver.c: Fix wrong fopen() mode.
dns_add_nameserver(): As reported by Surya Prakash Verma, call to
fopen() used nonexistent file open mode "at"; changed this to "r"
per Surya's analysis. See Surya's email to dev@ on 12 Mar 2020,
archived here: https://lists.apache.org/thread.html/rbbbee93f79dd8f4224969bb03bf093d8c96421380a1d955167a2f661%40%3Cdev.nuttx.apache.org%3E
2020-03-14 01:19:11 +01:00
Andrey Zabolotnyi
6697603162
inetaddr() more compliant with standards (especially error handling). (#524)
* inetaddr() more compliant with standards (especially error handling).

Co-authored-by: Андрей Заболотный <zapparello@ya.ru>
2020-03-10 08:17:17 -06:00
YAMAMOTO Takashi
b39ce514ea dlfcn, modlib: Appease nxstyle complaints 2020-03-10 01:53:49 -05:00