diff --git a/README.txt b/README.txt index 3db07e882a..59648d01f4 100644 --- a/README.txt +++ b/README.txt @@ -197,6 +197,9 @@ Ubuntu Bash under Windows 10 C:\Users\Username\AppData\Local\lxss\rootfs + However, I am unable to see my files under the rootfs/home directory + so this is not very useful. + Install Linux Software. ----------------------- Use "sudo apt-get install ". As examples, this is how diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c index ad107f1ff4..4729481a57 100644 --- a/drivers/lcd/pcf8574_lcd_backpack.c +++ b/drivers/lcd/pcf8574_lcd_backpack.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/lcd/pcf8574_lcd_backpack.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: dev@ziggurat29.com * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include +#include #include #include #include diff --git a/include/cxx/cwchar b/include/cxx/cwchar index 3ca4c6c1d8..167f5982ef 100755 --- a/include/cxx/cwchar +++ b/include/cxx/cwchar @@ -91,6 +91,7 @@ namespace std using ::vfwprintf; using ::vwprintf; using ::vswprintf; + using ::wcstold; using ::wcrtomb; using ::wcscat; using ::wcschr; diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index 6a529fb368..72bddc067c 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -418,6 +418,10 @@ int ipv4_input(FAR struct net_driver_s *dev); int ipv6_input(FAR struct net_driver_s *dev); #endif +#ifdef CONFIG_NET_6LOWPAN +int sixlowpan_input(FAR struct net_driver_s *dev); +#endif + /**************************************************************************** * Polling of connections * diff --git a/include/nuttx/net/sixlowpan.h b/include/nuttx/net/sixlowpan.h new file mode 100644 index 0000000000..4b956db8aa --- /dev/null +++ b/include/nuttx/net/sixlowpan.h @@ -0,0 +1,358 @@ +/**************************************************************************** + * include/nuttx/net/sixlowpan.h + * Header file for the 6lowpan implementation (RFC4944 and draft-hui-6lowpan-hc-01) + * + * Copyright (C) 2017, Gregory Nutt, all rights reserved + * Author: Gregory Nutt + * + * Derives from Contiki: + * + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * Authors: Adam Dunkels + * Nicolas Tsiftes + * Niclas Finne + * Mathilde Durvy + * Julien Abeille + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_SIXLOWOAN_H +#define __INCLUDE_NUTTX_NET_SIXLOWOAN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Min and Max compressible UDP ports - HC06 */ + +#define SIXLOWPAN_UDP_4_BIT_PORT_MIN 0xf0b0 +#define SIXLOWPAN_UDP_4_BIT_PORT_MAX 0xf0bf /* F0B0 + 15 */ +#define SIXLOWPAN_UDP_8_BIT_PORT_MIN 0xF000 +#define SIXLOWPAN_UDP_8_BIT_PORT_MAX 0xf0ff /* F000 + 255 */ + +/* 6lowpan compressions */ + +#define SIXLOWPAN_COMPRESSION_IPV6 0 +#define SIXLOWPAN_COMPRESSION_HC1 1 +#define SIXLOWPAN_COMPRESSION_HC06 2 + +/* 6lowpan dispatches */ + +#define SIXLOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ +#define SIXLOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */ +#define SIXLOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ +#define SIXLOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */ +#define SIXLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */ + +/* HC1 encoding */ + +#define SIXLOWPAN_HC1_NH_UDP 0x02 +#define SIXLOWPAN_HC1_NH_TCP 0x06 +#define SIXLOWPAN_HC1_NH_ICMP6 0x04 + +/* HC_UDP encoding (works together with HC1) */ + +#define SIXLOWPAN_HC_UDP_ALL_C 0xe0 + +/* IPHC encoding + * + * Values of fields within the IPHC encoding first byte (C stands for + * compressed and I for inline) + */ + +#define SIXLOWPAN_IPHC_FL_C 0x10 +#define SIXLOWPAN_IPHC_TC_C 0x08 +#define SIXLOWPAN_IPHC_NH_C 0x04 +#define SIXLOWPAN_IPHC_TTL_1 0x01 +#define SIXLOWPAN_IPHC_TTL_64 0x02 +#define SIXLOWPAN_IPHC_TTL_255 0x03 +#define SIXLOWPAN_IPHC_TTL_I 0x00 + + +/* Values of fields within the IPHC encoding second byte */ + +#define SIXLOWPAN_IPHC_CID 0x80 + +#define SIXLOWPAN_IPHC_SAC 0x40 +#define SIXLOWPAN_IPHC_SAM_00 0x00 +#define SIXLOWPAN_IPHC_SAM_01 0x10 +#define SIXLOWPAN_IPHC_SAM_10 0x20 +#define SIXLOWPAN_IPHC_SAM_11 0x30 + +#define SIXLOWPAN_IPHC_SAM_BIT 4 + +#define SIXLOWPAN_IPHC_M 0x08 +#define SIXLOWPAN_IPHC_DAC 0x04 +#define SIXLOWPAN_IPHC_DAM_00 0x00 +#define SIXLOWPAN_IPHC_DAM_01 0x01 +#define SIXLOWPAN_IPHC_DAM_10 0x02 +#define SIXLOWPAN_IPHC_DAM_11 0x03 + +#define SIXLOWPAN_IPHC_DAM_BIT 0 + +/* Link local context number */ + +#define SIXLOWPAN_IPHC_ADDR_CONTEXT_LL 0 + +/* 16-bit multicast addresses compression */ + +#define SIXLOWPAN_IPHC_MCAST_RANGE 0xa0 + +/* NHC_EXT_HDR */ + +#define SIXLOWPAN_NHC_MASK 0xf0 +#define SIXLOWPAN_NHC_EXT_HDR 0xe0 + +/* LOWPAN_UDP encoding (works together with IPHC) */ + +#define SIXLOWPAN_NHC_UDP_MASK 0xf8 +#define SIXLOWPAN_NHC_UDP_ID 0xf0 +#define SIXLOWPAN_NHC_UDP_CHECKSUMC 0x04 +#define SIXLOWPAN_NHC_UDP_CHECKSUMI 0x00 + +/* Values for port compression, _with checksum_ ie bit 5 set to 0 */ + +#define SIXLOWPAN_NHC_UDP_CS_P_00 0xf0 /* All inline */ +#define SIXLOWPAN_NHC_UDP_CS_P_01 0xf1 /* Source 16bit inline, dest = 0xf0 + 8 bit inline */ +#define SIXLOWPAN_NHC_UDP_CS_P_10 0xf2 /* Source = 0xf0 + 8bit inline, dest = 16 bit inline */ +#define SIXLOWPAN_NHC_UDP_CS_P_11 0xf3 /* Source & dest = 0xf0b + 4bit inline */ + +/* The 6lowpan "headers" length */ + +#define SIXLOWPAN_IPV6_HDR_LEN 1 /* One byte */ +#define SIXLOWPAN_HC1_HDR_LEN 3 +#define SIXLOWPAN_HC1_HC_UDP_HDR_LEN 7 +#define SIXLOWPAN_FRAG1_HDR_LEN 4 +#define SIXLOWPAN_FRAGN_HDR_LEN 5 + +/* Address compressibility test macros */ + +/* Check whether we can compress the IID in address 'a' to 16 bits. This is + * used for unicast addresses only, and is true if the address is on the + * format ::0000:00ff:fe00:XXXX + * + * NOTE: we currently assume 64-bits prefixes + */ + +#define SIXLOWPAN_IS_IID_16BIT_COMPRESSABLE(a) \ + ((((a)->u16[4]) == 0) && \ + // (((a)->u8[10]) == 0)&& \ + (((a)->u8[11]) == 0xff)&& \ + (((a)->u8[12]) == 0xfe)&& \ + (((a)->u8[13]) == 0)) + +/* Check whether the 9-bit group-id of the compressed multicast address is + * known. It is true if the 9-bit group is the all nodes or all routers + * group. Parameter 'a' is typed uint8_t * + */ + +#define SIXLOWPAN_IS_MCASTADDR_DECOMPRESSABLE(a) \ + (((*a & 0x01) == 0) && \ + ((*(a + 1) == 0x01) || (*(a + 1) == 0x02))) + +/* Check whether the 112-bit group-id of the multicast address is mappable + * to a 9-bit group-id. It is true if the group is the all nodes or all + * routers group. + */ + +#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE(a) \ + ((((a)->u16[1]) == 0) && \ + (((a)->u16[2]) == 0) && \ + (((a)->u16[3]) == 0) && \ + (((a)->u16[4]) == 0) && \ + (((a)->u16[5]) == 0) && \ + (((a)->u16[6]) == 0) && \ + (((a)->u8[14]) == 0) && \ + ((((a)->u8[15]) == 1) || (((a)->u8[15]) == 2))) + +/* FFXX::00XX:XXXX:XXXX */ + +#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE48(a) \ + ((((a)->u16[1]) == 0) && \ + (((a)->u16[2]) == 0) && \ + (((a)->u16[3]) == 0) && \ + (((a)->u16[4]) == 0) && \ + (((a)->u8[10]) == 0)) + +/* FFXX::00XX:XXXX */ + +#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE32(a) \ + ((((a)->u16[1]) == 0) && \ + (((a)->u16[2]) == 0) && \ + (((a)->u16[3]) == 0) && \ + (((a)->u16[4]) == 0) && \ + (((a)->u16[5]) == 0) && \ + (((a)->u8[12]) == 0)) + +/* FF02::00XX */ + +#define SIXLOWPAN_IS_MCASTADDR_COMPRESSABLE8(a) \ + ((((a)->u8[1]) == 2) && \ + (((a)->u16[1]) == 0) && \ + (((a)->u16[2]) == 0) && \ + (((a)->u16[3]) == 0) && \ + (((a)->u16[4]) == 0) && \ + (((a)->u16[5]) == 0) && \ + (((a)->u16[6]) == 0) && \ + (((a)->u8[14]) == 0)) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* The header for fragments + * + * NOTE: We do not define different structures for FRAG1 and FRAGN headers, + * which are different. For FRAG1, the offset field is just not used + */ + +struct sixlowpan_frag_hdr +{ + uint16_t dispatch_size; + uint16_t tag; + uint8_t offset; +}; + +/* The HC1 header when HC_UDP is not used + * + * When all fields are compressed and HC_UDP is not used, we use this + * structure. If HC_UDP is used, the ttl is in another spot, and we use the + * sixlowpan_hc1_hc_udp structure + */ + +struct sixlowpan_hc1_hdr +{ + uint8_t dispatch; + uint8_t encoding; + uint8_t ttl; +}; + +/* HC1 followed by HC_UDP */ + +struct sixlowpan_hc1_hc_udp_hdr +{ + uint8_t dispatch; + uint8_t hc1_encoding; + uint8_t hc_udp_encoding; + uint8_t ttl; + uint8_t ports; + uint16_t udpchksum; +}; + +/* An address context for IPHC address compression each context can have up + * to 8 bytes + */ + +struct sixlowpan_addr_context +{ + uint8_t used; /* Possibly use as prefix-length */ + uint8_t number; + uint8_t prefix[8]; +}; + + +/* The structure of a next header compressor. This compressor is provided + * by architecture-specific logic outside of the network stack. + * + * TODO: needs more parameters when compressing extension headers, etc. + */ + +struct sixlowpan_nhcompressor_s +{ + CODE int (*is_compressable)(uint8_t next_header); + + /* Compress next header (TCP/UDP, etc) - ptr points to next header to + * compress. + */ + + CODE int (*compress)(FAR uint8_t *compressed, FAR uint8_t *uncompressed_len); + + /* Uncompress next header (TCP/UDP, etc) - ptr points to next header to + * uncompress. + */ + + CODE int (*uncompress)(FAR uint8_t *compressed, FAR uint8_t *lowpanbuf, + FAR uint8_t *uncompressed_len); +}; + +/* RIME sniffer callbacks */ + +struct sixlowpan_rime_sniffer_s +{ + CODE void (*input)(void); + CODE void (*output)(int mac_status); +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Function: sixlowpan_set_compressor + * + * Description: + * Configure to use the architecture-specific compressor. + * + * Input parameters: + * compressor - A reference to the new compressor to be used. This may + * be a NULL value to disable the compressor. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor); + +/**************************************************************************** + * Function: sixlowpan_set_sniffer + * + * Description: + * Configure to use an architecture-specific sniffer to enable tracing of + * IP. + * + * Input parameters: + * sniffer - A reference to the new sniffer to be used. This may + * be a NULL value to disable the sniffer. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_set_sniffer(FAR struct sixlowpan_rime_sniffer_s *sniffer); + +#endif /* __INCLUDE_NUTTX_NET_SIXLOWOAN_H */ diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 101816d7ff..56319b772d 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -418,12 +418,20 @@ # define SYS_pthread_mutex_lock (__SYS_pthread+19) # define SYS_pthread_mutex_trylock (__SYS_pthread+20) # define SYS_pthread_mutex_unlock (__SYS_pthread+21) -# define SYS_pthread_once (__SYS_pthread+22) -# define SYS_pthread_setschedparam (__SYS_pthread+23) -# define SYS_pthread_setschedprio (__SYS_pthread+24) -# define SYS_pthread_setspecific (__SYS_pthread+25) -# define SYS_pthread_yield (__SYS_pthread+26) -# define __SYS_pthread_smp (__SYS_pthread+27) + +#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE +# define SYS_pthread_mutex_consistent (__SYS_pthread+22) +# define __SYS_pthread_once (__SYS_pthread+23) +#else +# define __SYS_pthread_once (__SYS_pthread+22) +#endif + +# define SYS_pthread_once (__SYS_pthread_once+0) +# define SYS_pthread_setschedparam (__SYS_pthread_once+1) +# define SYS_pthread_setschedprio (__SYS_pthread_once+2) +# define SYS_pthread_setspecific (__SYS_pthread_once+3) +# define SYS_pthread_yield (__SYS_pthread_once+4) +# define __SYS_pthread_smp (__SYS_pthread_once+5) # ifdef CONFIG_SMP # define SYS_pthread_setaffinity_np (__SYS_pthread_smp+0) diff --git a/include/sys/time.h b/include/sys/time.h index 3d7139e754..ece75bc10f 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -77,13 +77,13 @@ #define timersub(tvp, uvp, vvp) \ do \ { \ -    (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ -    (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ -    if ((vvp)->tv_usec < 0) \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) \ { \ -      (vvp)->tv_sec--; \ -      (vvp)->tv_usec += 1000000; \ -    } \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ } \ while (0) diff --git a/net/Kconfig b/net/Kconfig index 2fea54f86f..2741c67816 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -255,7 +255,7 @@ menuconfig NET_IPv6 Build in support for IPv6. source "net/neighbor/Kconfig" -source "net/6lowpan/Kconfig" +source "net/sixlowpan/Kconfig" endmenu # Internet Protocol Selection diff --git a/net/Makefile b/net/Makefile index 2487ce9609..6898bad40e 100644 --- a/net/Makefile +++ b/net/Makefile @@ -67,7 +67,7 @@ include pkt/Make.defs include local/Make.defs include tcp/Make.defs include udp/Make.defs -include 6lowpan/Make.defs +include sixlowpan/Make.defs include devif/Make.defs include loopback/Make.defs include route/Make.defs diff --git a/net/6lowpan/Kconfig b/net/sixlowpan/Kconfig similarity index 100% rename from net/6lowpan/Kconfig rename to net/sixlowpan/Kconfig diff --git a/net/6lowpan/Make.defs b/net/sixlowpan/Make.defs similarity index 91% rename from net/6lowpan/Make.defs rename to net/sixlowpan/Make.defs index e52060673a..150cb6ec88 100644 --- a/net/6lowpan/Make.defs +++ b/net/sixlowpan/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# net/6lowpan/Make.defs +# net/sixlowpan/Make.defs # # Copyright (C) 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -39,11 +39,11 @@ ifeq ($(CONFIG_NET_6LOWPAN),y) # Include IEEE 802.15.4 file in the build -# NET_CSRCS += +NET_CSRCS += sixlowpan_compressor.c sixlowpan_sniffer.c -# Include the 6lowpan directory in the build +# Include the sixlowpan directory in the build -DEPPATH += --dep-path 6lowpan -VPATH += :6lowpan +DEPPATH += --dep-path sixlowpan +VPATH += :sixlowpan endif # CONFIG_NET_6LOWPAN diff --git a/net/6lowpan/6lowpan.h b/net/sixlowpan/sixlowpan.h similarity index 78% rename from net/6lowpan/6lowpan.h rename to net/sixlowpan/sixlowpan.h index 657b04c75b..e85135e0cf 100644 --- a/net/6lowpan/6lowpan.h +++ b/net/sixlowpan/sixlowpan.h @@ -1,5 +1,5 @@ /**************************************************************************** - * net/6lowpan/6lowpan.h + * net/sixlowpan/sixlowpan.h * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __NET_6LOWPAN_6LOWPAN_H -#define __NET_6LOWPAN_6LOWPAN_H +#ifndef _NET_SIXLOWPAN_SIXLOWPAN_H +#define _NET_SIXLOWPAN_SIXLOWPAN_H /**************************************************************************** * Included Files @@ -44,6 +44,19 @@ #ifdef CONFIG_NET_6LOWPAN +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* A pointer to the optional, architecture-specific compressor */ + +struct sixlowpan_nhcompressor_s; /* Foward reference */ +extern FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor; + +/* Rime Sniffer support for one single listener to enable trace of IP */ + +extern struct sixlowpan_rime_sniffer_s *g_sixlopan_sniffer; + /**************************************************************************** * Public Types ****************************************************************************/ @@ -53,4 +66,4 @@ ****************************************************************************/ #endif /* CONFIG_NET_6LOWPAN */ -#endif /* __NET_6LOWPAN_6LOWPAN_H */ +#endif /* _NET_SIXLOWPAN_SIXLOWPAN_H */ diff --git a/net/sixlowpan/sixlowpan_compressor.c b/net/sixlowpan/sixlowpan_compressor.c new file mode 100644 index 0000000000..0f78113802 --- /dev/null +++ b/net/sixlowpan/sixlowpan_compressor.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * net/sixlowpan/sixlowpan_compressor.c + * + * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "nuttx/net/net.h" +#include "nuttx/net/sixlowpan.h" + +#include "sixlowpan/sixlopan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* A pointer to the optional, architecture-specific compressor */ + +FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: sixlowpan_set_compressor + * + * Description: + * Configure to use the architecture-specific compressor. + * + * Input parameters: + * compressor - A reference to the new compressor to be used. This may + * be a NULL value to disable the compressor. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor) +{ + /* Make sure that the compressor is not in use */ + + net_lock(); + + /* Then instantiate the new compressor */ + + g_sixlowpan_compressor = compressor; + net_unlock(); +} + +#endif /* CONFIG_NET_6LOWPAN */ diff --git a/net/sixlowpan/sixlowpan_sniffer.c b/net/sixlowpan/sixlowpan_sniffer.c new file mode 100644 index 0000000000..9f00efe62a --- /dev/null +++ b/net/sixlowpan/sixlowpan_sniffer.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * net/sixlowpan/sixlowpan_sniffer.c + * + * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "nuttx/net/net.h" +#include "nuttx/net/sixlowpan.h" + +#include "sixlowpan/sixlopan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* A pointer to the optional, architecture-specific sniffer */ + +FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: sixlowpan_set_sniffer + * + * Description: + * Configure to use an architecture-specific sniffer to enable tracing of + * IP. + * + * Input parameters: + * sniffer - A reference to the new sniffer to be used. This may + * be a NULL value to disable the sniffer. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_set_sniffer(FAR struct sixlowpan_rime_sniffer_s *sniffer) +{ + /* Make sure that the sniffer is not in use */ + + net_lock(); + + /* Then instantiate the new sniffer */ + + g_sixlowpan_sniffer = sniffer; + net_unlock(); +} + +#endif /* CONFIG_NET_6LOWPAN */ diff --git a/sched/Kconfig b/sched/Kconfig index 0a09c524fe..50613fb44d 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -536,12 +536,12 @@ choice default PTHREAD_MUTEX_ROBUST if !DEFAULT_SMALL default PTHREAD_UNSAFE if DEFAULT_SMALL - config PTHREAD_MUTEX_ROBUST +config PTHREAD_MUTEX_ROBUST bool "Robust mutexes" ---help--- Support only the robust form of the NORMAL mutex. - config PTHREAD_MUTEX_UNSAFE +config PTHREAD_MUTEX_UNSAFE bool "Traditional unsafe mutexes" ---help--- Support only the traditional non-robust form of the NORMAL mutex. @@ -549,7 +549,7 @@ choice software you may be porting or, perhaps, if you are trying to minimize footprint. - config PTHREAD_MUTEX_BOTH +config PTHREAD_MUTEX_BOTH bool "Both robust and unsafe mutexes" ---help--- Support both forms of NORMAL mutexes. @@ -561,12 +561,12 @@ choice default PTHREAD_MUTEX_DEFAULT_ROBUST depends on PTHREAD_MUTEX_BOTH - config PTHREAD_MUTEX_DEFAULT_ROBUST +config PTHREAD_MUTEX_DEFAULT_ROBUST bool "Robust default" ---help--- The default is robust NORMAL mutexes (non-standard) - config PTHREAD_MUTEX_DEFAULT_UNSAFE +config PTHREAD_MUTEX_DEFAULT_UNSAFE bool "Unsafe default" ---help--- The default is traditional unsafe NORMAL mutexes (standard) diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 18ff94fdc7..66babafb5e 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -91,6 +91,7 @@ "pthread_mutex_lock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" "pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" "pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" +"pthread_mutex_consistent","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)","int","FAR pthread_mutex_t*" "pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)" "pthread_setaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR const cpu_set_t*" "pthread_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","FAR const struct sched_param*" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index f7f87487c6..6ed2e54e78 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -43,76 +43,76 @@ * configuration */ -SYSCALL_LOOKUP1(_exit, 1, STUB__exit) -SYSCALL_LOOKUP(exit, 1, STUB_exit) -SYSCALL_LOOKUP(get_errno, 0, STUB_get_errno) -SYSCALL_LOOKUP(getpid, 0, STUB_getpid) -SYSCALL_LOOKUP(sched_getparam, 2, STUB_sched_getparam) -SYSCALL_LOOKUP(sched_getscheduler, 1, STUB_sched_getscheduler) -SYSCALL_LOOKUP(sched_lock, 0, STUB_sched_lock) -SYSCALL_LOOKUP(sched_lockcount, 0, STUB_sched_lockcount) -SYSCALL_LOOKUP(sched_rr_get_interval, 2, STUB_sched_rr_get_interval) -SYSCALL_LOOKUP(sched_setparam, 2, STUB_sched_setparam) -SYSCALL_LOOKUP(sched_setscheduler, 3, STUB_sched_setscheduler) -SYSCALL_LOOKUP(sched_unlock, 0, STUB_sched_unlock) -SYSCALL_LOOKUP(sched_yield, 0, STUB_sched_yield) -SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno) -SYSCALL_LOOKUP(uname, 1, STUB_uname) +SYSCALL_LOOKUP1(_exit, 1, STUB__exit) +SYSCALL_LOOKUP(exit, 1, STUB_exit) +SYSCALL_LOOKUP(get_errno, 0, STUB_get_errno) +SYSCALL_LOOKUP(getpid, 0, STUB_getpid) +SYSCALL_LOOKUP(sched_getparam, 2, STUB_sched_getparam) +SYSCALL_LOOKUP(sched_getscheduler, 1, STUB_sched_getscheduler) +SYSCALL_LOOKUP(sched_lock, 0, STUB_sched_lock) +SYSCALL_LOOKUP(sched_lockcount, 0, STUB_sched_lockcount) +SYSCALL_LOOKUP(sched_rr_get_interval, 2, STUB_sched_rr_get_interval) +SYSCALL_LOOKUP(sched_setparam, 2, STUB_sched_setparam) +SYSCALL_LOOKUP(sched_setscheduler, 3, STUB_sched_setscheduler) +SYSCALL_LOOKUP(sched_unlock, 0, STUB_sched_unlock) +SYSCALL_LOOKUP(sched_yield, 0, STUB_sched_yield) +SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno) +SYSCALL_LOOKUP(uname, 1, STUB_uname) /* Semaphores */ -SYSCALL_LOOKUP(sem_destroy, 1, STUB_sem_destroy) -SYSCALL_LOOKUP(sem_post, 1, STUB_sem_post) -SYSCALL_LOOKUP(sem_timedwait, 2, STUB_sem_timedwait) -SYSCALL_LOOKUP(sem_trywait, 1, STUB_sem_trywait) -SYSCALL_LOOKUP(sem_wait, 1, STUB_sem_wait) +SYSCALL_LOOKUP(sem_destroy, 1, STUB_sem_destroy) +SYSCALL_LOOKUP(sem_post, 1, STUB_sem_post) +SYSCALL_LOOKUP(sem_timedwait, 2, STUB_sem_timedwait) +SYSCALL_LOOKUP(sem_trywait, 1, STUB_sem_trywait) +SYSCALL_LOOKUP(sem_wait, 1, STUB_sem_wait) #ifdef CONFIG_PRIORITY_INHERITANCE -SYSCALL_LOOKUP(sem_setprotocol, 2, STUB_sem_setprotocol) +SYSCALL_LOOKUP(sem_setprotocol, 2, STUB_sem_setprotocol) #endif /* Named semaphores */ #ifdef CONFIG_FS_NAMED_SEMAPHORES -SYSCALL_LOOKUP(sem_open, 6, STUB_sem_open) -SYSCALL_LOOKUP(sem_close, 1, STUB_sem_close) -SYSCALL_LOOKUP(sem_unlink, 1, STUB_sem_unlink) +SYSCALL_LOOKUP(sem_open, 6, STUB_sem_open) +SYSCALL_LOOKUP(sem_close, 1, STUB_sem_close) +SYSCALL_LOOKUP(sem_unlink, 1, STUB_sem_unlink) #endif #ifndef CONFIG_BUILD_KERNEL -SYSCALL_LOOKUP(task_create, 5, STUB_task_create) +SYSCALL_LOOKUP(task_create, 5, STUB_task_create) #else -SYSCALL_LOOKUP(pgalloc, 2, STUB_pgalloc) +SYSCALL_LOOKUP(pgalloc, 2, STUB_pgalloc) #endif -SYSCALL_LOOKUP(task_delete, 1, STUB_task_delete) -SYSCALL_LOOKUP(task_restart, 1, STUB_task_restart) -SYSCALL_LOOKUP(task_setcancelstate, 2, STUB_task_setcancelstate) -SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) +SYSCALL_LOOKUP(task_delete, 1, STUB_task_delete) +SYSCALL_LOOKUP(task_restart, 1, STUB_task_restart) +SYSCALL_LOOKUP(task_setcancelstate, 2, STUB_task_setcancelstate) +SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) # ifdef CONFIG_CANCELLATION_POINTS - SYSCALL_LOOKUP(task_setcanceltype, 2, STUB_task_setcanceltype) - SYSCALL_LOOKUP(task_testcancel, 0, STUB_task_testcancel) + SYSCALL_LOOKUP(task_setcanceltype, 2, STUB_task_setcanceltype) + SYSCALL_LOOKUP(task_testcancel, 0, STUB_task_testcancel) # endif /* The following can be individually enabled */ #ifdef CONFIG_ARCH_HAVE_VFORK - SYSCALL_LOOKUP(vfork, 0, STUB_vfork) + SYSCALL_LOOKUP(vfork, 0, STUB_vfork) #endif #ifdef CONFIG_SCHED_ATEXIT - SYSCALL_LOOKUP(atexit, 1, STUB_atexit) + SYSCALL_LOOKUP(atexit, 1, STUB_atexit) #endif #ifdef CONFIG_SCHED_ONEXIT - SYSCALL_LOOKUP(on_exit, 2, STUB_on_exit) + SYSCALL_LOOKUP(on_exit, 2, STUB_on_exit) #endif #ifdef CONFIG_SCHED_WAITPID - SYSCALL_LOOKUP(waitpid, 3, STUB_waitpid) + SYSCALL_LOOKUP(waitpid, 3, STUB_waitpid) # ifdef CONFIG_SCHED_HAVE_PARENT - SYSCALL_LOOKUP(wait, 1, STUB_wait) - SYSCALL_LOOKUP(waitid, 4, STUB_waitid) + SYSCALL_LOOKUP(wait, 1, STUB_wait) + SYSCALL_LOOKUP(waitid, 4, STUB_waitid) # endif #endif @@ -121,9 +121,9 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) */ #ifdef CONFIG_MODULE - SYSCALL_LOOKUP(insmod, 2, STUB_insmod) - SYSCALL_LOOKUP(rmmod, 1, STUB_rmmod) - SYSCALL_LOOKUP(modhandle, 1, STUB_modhandle) + SYSCALL_LOOKUP(insmod, 2, STUB_insmod) + SYSCALL_LOOKUP(rmmod, 1, STUB_rmmod) + SYSCALL_LOOKUP(modhandle, 1, STUB_modhandle) #endif /* The following can only be defined if we are configured to execute @@ -132,11 +132,11 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) #if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) # ifdef CONFIG_BINFMT_EXEPATH - SYSCALL_LOOKUP(posix_spawnp, 6, STUB_posix_spawnp) + SYSCALL_LOOKUP(posix_spawnp, 6, STUB_posix_spawnp) # else - SYSCALL_LOOKUP(posix_spawn, 6, STUB_posix_spawn) + SYSCALL_LOOKUP(posix_spawn, 6, STUB_posix_spawn) # endif - SYSCALL_LOOKUP(execv, 2, STUB_execv) + SYSCALL_LOOKUP(execv, 2, STUB_execv) #endif /* The following are only defined is signals are supported in the NuttX @@ -144,236 +144,239 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) */ #ifndef CONFIG_DISABLE_SIGNALS - SYSCALL_LOOKUP(kill, 2, STUB_kill) - SYSCALL_LOOKUP(sigaction, 3, STUB_sigaction) - SYSCALL_LOOKUP(sigpending, 1, STUB_sigpending) - SYSCALL_LOOKUP(sigprocmask, 3, STUB_sigprocmask) - SYSCALL_LOOKUP(sigqueue, 3, STUB_sigqueue) - SYSCALL_LOOKUP(sigsuspend, 1, STUB_sigsuspend) - SYSCALL_LOOKUP(sigtimedwait, 3, STUB_sigtimedwait) - SYSCALL_LOOKUP(sigwaitinfo, 2, STUB_sigwaitinfo) - SYSCALL_LOOKUP(nanosleep, 2, STUB_nanosleep) + SYSCALL_LOOKUP(kill, 2, STUB_kill) + SYSCALL_LOOKUP(sigaction, 3, STUB_sigaction) + SYSCALL_LOOKUP(sigpending, 1, STUB_sigpending) + SYSCALL_LOOKUP(sigprocmask, 3, STUB_sigprocmask) + SYSCALL_LOOKUP(sigqueue, 3, STUB_sigqueue) + SYSCALL_LOOKUP(sigsuspend, 1, STUB_sigsuspend) + SYSCALL_LOOKUP(sigtimedwait, 3, STUB_sigtimedwait) + SYSCALL_LOOKUP(sigwaitinfo, 2, STUB_sigwaitinfo) + SYSCALL_LOOKUP(nanosleep, 2, STUB_nanosleep) #endif /* The following are only defined if the system clock is enabled in the * NuttX configuration. */ - SYSCALL_LOOKUP(syscall_clock_systimer, 0, STUB_clock_systimer) - SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres) - SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime) - SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime) + SYSCALL_LOOKUP(syscall_clock_systimer, 0, STUB_clock_systimer) + SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres) + SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime) + SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime) #ifdef CONFIG_CLOCK_TIMEKEEPING - SYSCALL_LOOKUP(adjtime, 2, STUB_adjtime) + SYSCALL_LOOKUP(adjtime, 2, STUB_adjtime) #endif /* The following are defined only if POSIX timers are supported */ #ifndef CONFIG_DISABLE_POSIX_TIMERS - SYSCALL_LOOKUP(timer_create, 3, STUB_timer_create) - SYSCALL_LOOKUP(timer_delete, 1, STUB_timer_delete) - SYSCALL_LOOKUP(timer_getoverrun, 1, STUB_timer_getoverrun) - SYSCALL_LOOKUP(timer_gettime, 2, STUB_timer_gettime) - SYSCALL_LOOKUP(timer_settime, 4, STUB_timer_settime) + SYSCALL_LOOKUP(timer_create, 3, STUB_timer_create) + SYSCALL_LOOKUP(timer_delete, 1, STUB_timer_delete) + SYSCALL_LOOKUP(timer_getoverrun, 1, STUB_timer_getoverrun) + SYSCALL_LOOKUP(timer_gettime, 2, STUB_timer_gettime) + SYSCALL_LOOKUP(timer_settime, 4, STUB_timer_settime) #endif /* System logging */ - SYSCALL_LOOKUP(_vsyslog, 3, STUB__vsyslog) + SYSCALL_LOOKUP(_vsyslog, 3, STUB__vsyslog) /* The following are defined if either file or socket descriptor are * enabled. */ #if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 - SYSCALL_LOOKUP(close, 1, STUB_close) + SYSCALL_LOOKUP(close, 1, STUB_close) # ifdef CONFIG_LIBC_IOCTL_VARIADIC - SYSCALL_LOOKUP(fs_ioctl, 3, STUB_fs_ioctl) + SYSCALL_LOOKUP(fs_ioctl, 3, STUB_fs_ioctl) # else - SYSCALL_LOOKUP(ioctl, 3, STUB_ioctl) + SYSCALL_LOOKUP(ioctl, 3, STUB_ioctl) # endif - SYSCALL_LOOKUP(read, 3, STUB_read) - SYSCALL_LOOKUP(write, 3, STUB_write) - SYSCALL_LOOKUP(pread, 4, STUB_pread) - SYSCALL_LOOKUP(pwrite, 4, STUB_pwrite) + SYSCALL_LOOKUP(read, 3, STUB_read) + SYSCALL_LOOKUP(write, 3, STUB_write) + SYSCALL_LOOKUP(pread, 4, STUB_pread) + SYSCALL_LOOKUP(pwrite, 4, STUB_pwrite) # ifdef CONFIG_FS_AIO - SYSCALL_LOOKUP(aio_read, 1, STUB_aio_read) - SYSCALL_LOOKUP(aio_write, 1, STUB_aio_write) - SYSCALL_LOOKUP(aio_fsync, 2, STUB_aio_fsync) - SYSCALL_LOOKUP(aio_cancel, 2, STUB_aio_cancel) + SYSCALL_LOOKUP(aio_read, 1, STUB_aio_read) + SYSCALL_LOOKUP(aio_write, 1, STUB_aio_write) + SYSCALL_LOOKUP(aio_fsync, 2, STUB_aio_fsync) + SYSCALL_LOOKUP(aio_cancel, 2, STUB_aio_cancel) # endif # ifndef CONFIG_DISABLE_POLL - SYSCALL_LOOKUP(poll, 3, STUB_poll) - SYSCALL_LOOKUP(select, 5, STUB_select) + SYSCALL_LOOKUP(poll, 3, STUB_poll) + SYSCALL_LOOKUP(select, 5, STUB_select) # endif #endif /* Board support */ #ifdef CONFIG_LIB_BOARDCTL - SYSCALL_LOOKUP(boardctl, 2, STUB_boardctl) + SYSCALL_LOOKUP(boardctl, 2, STUB_boardctl) #endif /* The following are defined if file descriptors are enabled */ #if CONFIG_NFILE_DESCRIPTORS > 0 - SYSCALL_LOOKUP(closedir, 1, STUB_closedir) - SYSCALL_LOOKUP(dup, 1, STUB_dup) - SYSCALL_LOOKUP(dup2, 2, STUB_dup2) - SYSCALL_LOOKUP(fcntl, 6, STUB_fcntl) - SYSCALL_LOOKUP(lseek, 3, STUB_lseek) - SYSCALL_LOOKUP(mmap, 6, STUB_mmap) - SYSCALL_LOOKUP(open, 6, STUB_open) - SYSCALL_LOOKUP(opendir, 1, STUB_opendir) - SYSCALL_LOOKUP(readdir, 1, STUB_readdir) - SYSCALL_LOOKUP(rewinddir, 1, STUB_rewinddir) - SYSCALL_LOOKUP(seekdir, 2, STUB_seekdir) - SYSCALL_LOOKUP(stat, 2, STUB_stat) - SYSCALL_LOOKUP(fstat, 2, STUB_fstat) - SYSCALL_LOOKUP(statfs, 2, STUB_statfs) - SYSCALL_LOOKUP(fstatfs, 2, STUB_fstatfs) - SYSCALL_LOOKUP(telldir, 1, STUB_telldir) + SYSCALL_LOOKUP(closedir, 1, STUB_closedir) + SYSCALL_LOOKUP(dup, 1, STUB_dup) + SYSCALL_LOOKUP(dup2, 2, STUB_dup2) + SYSCALL_LOOKUP(fcntl, 6, STUB_fcntl) + SYSCALL_LOOKUP(lseek, 3, STUB_lseek) + SYSCALL_LOOKUP(mmap, 6, STUB_mmap) + SYSCALL_LOOKUP(open, 6, STUB_open) + SYSCALL_LOOKUP(opendir, 1, STUB_opendir) + SYSCALL_LOOKUP(readdir, 1, STUB_readdir) + SYSCALL_LOOKUP(rewinddir, 1, STUB_rewinddir) + SYSCALL_LOOKUP(seekdir, 2, STUB_seekdir) + SYSCALL_LOOKUP(stat, 2, STUB_stat) + SYSCALL_LOOKUP(fstat, 2, STUB_fstat) + SYSCALL_LOOKUP(statfs, 2, STUB_statfs) + SYSCALL_LOOKUP(fstatfs, 2, STUB_fstatfs) + SYSCALL_LOOKUP(telldir, 1, STUB_telldir) # if defined(CONFIG_PSEUDOFS_SOFTLINKS) - SYSCALL_LOOKUP(link, 2, STUB_link) - SYSCALL_LOOKUP(readlink, 3, STUB_readlink) + SYSCALL_LOOKUP(link, 2, STUB_link) + SYSCALL_LOOKUP(readlink, 3, STUB_readlink) # endif # if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 - SYSCALL_LOOKUP(pipe2, 2, STUB_pipe2) + SYSCALL_LOOKUP(pipe2, 2, STUB_pipe2) # endif # if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 - SYSCALL_LOOKUP(mkfifo2, 3, STUB_mkfifo2) + SYSCALL_LOOKUP(mkfifo2, 3, STUB_mkfifo2) # endif # if CONFIG_NFILE_STREAMS > 0 - SYSCALL_LOOKUP(fdopen, 3, STUB_fs_fdopen) - SYSCALL_LOOKUP(sched_getstreams, 0, STUB_sched_getstreams) + SYSCALL_LOOKUP(fdopen, 3, STUB_fs_fdopen) + SYSCALL_LOOKUP(sched_getstreams, 0, STUB_sched_getstreams) # endif # if defined(CONFIG_NET_SENDFILE) - SYSCALL_LOOKUP(sendfile, 4, STUB_fs_sendifile) + SYSCALL_LOOKUP(sendfile, 4, STUB_fs_sendifile) # endif # if !defined(CONFIG_DISABLE_MOUNTPOINT) # if defined(CONFIG_FS_READABLE) - SYSCALL_LOOKUP(mount, 5, STUB_mount) + SYSCALL_LOOKUP(mount, 5, STUB_mount) # endif - SYSCALL_LOOKUP(fsync, 1, STUB_fsync) - SYSCALL_LOOKUP(mkdir, 2, STUB_mkdir) - SYSCALL_LOOKUP(rename, 2, STUB_rename) - SYSCALL_LOOKUP(rmdir, 1, STUB_rmdir) - SYSCALL_LOOKUP(umount2, 2, STUB_umount2) - SYSCALL_LOOKUP(unlink, 1, STUB_unlink) + SYSCALL_LOOKUP(fsync, 1, STUB_fsync) + SYSCALL_LOOKUP(mkdir, 2, STUB_mkdir) + SYSCALL_LOOKUP(rename, 2, STUB_rename) + SYSCALL_LOOKUP(rmdir, 1, STUB_rmdir) + SYSCALL_LOOKUP(umount2, 2, STUB_umount2) + SYSCALL_LOOKUP(unlink, 1, STUB_unlink) # endif #endif /* Shared memory interfaces */ #ifdef CONFIG_MM_SHM - SYSCALL_LOOKUP(shmget, 3, STUB_shmget) - SYSCALL_LOOKUP(shmat, 3, STUB_shmat) - SYSCALL_LOOKUP(shmctl, 3, STUB_shmctl) - SYSCALL_LOOKUP(shmdt, 1, STUB_shmdt) + SYSCALL_LOOKUP(shmget, 3, STUB_shmget) + SYSCALL_LOOKUP(shmat, 3, STUB_shmat) + SYSCALL_LOOKUP(shmctl, 3, STUB_shmctl) + SYSCALL_LOOKUP(shmdt, 1, STUB_shmdt) #endif /* The following are defined if pthreads are enabled */ #ifndef CONFIG_DISABLE_PTHREAD - SYSCALL_LOOKUP(pthread_barrier_destroy, 1, STUB_pthread_barrier_destroy) - SYSCALL_LOOKUP(pthread_barrier_init, 3, STUB_pthread_barrier_init) - SYSCALL_LOOKUP(pthread_barrier_wait, 1, STUB_pthread_barrier_wait) - SYSCALL_LOOKUP(pthread_cancel, 1, STUB_pthread_cancel) - SYSCALL_LOOKUP(pthread_cond_broadcast, 1, STUB_pthread_cond_broadcast) - SYSCALL_LOOKUP(pthread_cond_destroy, 1, STUB_pthread_cond_destroy) - SYSCALL_LOOKUP(pthread_cond_init, 2, STUB_pthread_cond_init) - SYSCALL_LOOKUP(pthread_cond_signal, 1, STUB_pthread_cond_signal) - SYSCALL_LOOKUP(pthread_cond_wait, 2, STUB_pthread_cond_wait) - SYSCALL_LOOKUP(pthread_create, 4, STUB_pthread_create) - SYSCALL_LOOKUP(pthread_detach, 1, STUB_pthread_detach) - SYSCALL_LOOKUP(pthread_exit, 1, STUB_pthread_exit) - SYSCALL_LOOKUP(pthread_getschedparam, 3, STUB_pthread_getschedparam) - SYSCALL_LOOKUP(pthread_getspecific, 1, STUB_pthread_getspecific) - SYSCALL_LOOKUP(pthread_join, 2, STUB_pthread_join) - SYSCALL_LOOKUP(pthread_key_create, 2, STUB_pthread_key_create) - SYSCALL_LOOKUP(pthread_key_delete, 1, STUB_pthread_key_delete) - SYSCALL_LOOKUP(pthread_mutex_destroy, 1, STUB_pthread_mutex_destroy) - SYSCALL_LOOKUP(pthread_mutex_init, 2, STUB_pthread_mutex_init) - SYSCALL_LOOKUP(pthread_mutex_lock, 1, STUB_pthread_mutex_lock) - SYSCALL_LOOKUP(pthread_mutex_trylock, 1, STUB_pthread_mutex_trylock) - SYSCALL_LOOKUP(pthread_mutex_unlock, 1, STUB_pthread_mutex_unlock) - SYSCALL_LOOKUP(pthread_once, 2, STUB_pthread_once) - SYSCALL_LOOKUP(pthread_setschedparam, 3, STUB_pthread_setschedparam) - SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio) - SYSCALL_LOOKUP(pthread_setspecific, 2, STUB_pthread_setspecific) - SYSCALL_LOOKUP(pthread_yield, 0, STUB_pthread_yield) + SYSCALL_LOOKUP(pthread_barrier_destroy, 1, STUB_pthread_barrier_destroy) + SYSCALL_LOOKUP(pthread_barrier_init, 3, STUB_pthread_barrier_init) + SYSCALL_LOOKUP(pthread_barrier_wait, 1, STUB_pthread_barrier_wait) + SYSCALL_LOOKUP(pthread_cancel, 1, STUB_pthread_cancel) + SYSCALL_LOOKUP(pthread_cond_broadcast, 1, STUB_pthread_cond_broadcast) + SYSCALL_LOOKUP(pthread_cond_destroy, 1, STUB_pthread_cond_destroy) + SYSCALL_LOOKUP(pthread_cond_init, 2, STUB_pthread_cond_init) + SYSCALL_LOOKUP(pthread_cond_signal, 1, STUB_pthread_cond_signal) + SYSCALL_LOOKUP(pthread_cond_wait, 2, STUB_pthread_cond_wait) + SYSCALL_LOOKUP(pthread_create, 4, STUB_pthread_create) + SYSCALL_LOOKUP(pthread_detach, 1, STUB_pthread_detach) + SYSCALL_LOOKUP(pthread_exit, 1, STUB_pthread_exit) + SYSCALL_LOOKUP(pthread_getschedparam, 3, STUB_pthread_getschedparam) + SYSCALL_LOOKUP(pthread_getspecific, 1, STUB_pthread_getspecific) + SYSCALL_LOOKUP(pthread_join, 2, STUB_pthread_join) + SYSCALL_LOOKUP(pthread_key_create, 2, STUB_pthread_key_create) + SYSCALL_LOOKUP(pthread_key_delete, 1, STUB_pthread_key_delete) + SYSCALL_LOOKUP(pthread_mutex_destroy, 1, STUB_pthread_mutex_destroy) + SYSCALL_LOOKUP(pthread_mutex_init, 2, STUB_pthread_mutex_init) + SYSCALL_LOOKUP(pthread_mutex_lock, 1, STUB_pthread_mutex_lock) + SYSCALL_LOOKUP(pthread_mutex_trylock, 1, STUB_pthread_mutex_trylock) + SYSCALL_LOOKUP(pthread_mutex_unlock, 1, STUB_pthread_mutex_unlock) +#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE + SYSCALL_LOOKUP(pthread_mutex_consistent, 1, STUB_pthread_mutex_consistent) +#endif + SYSCALL_LOOKUP(pthread_once, 2, STUB_pthread_once) + SYSCALL_LOOKUP(pthread_setschedparam, 3, STUB_pthread_setschedparam) + SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio) + SYSCALL_LOOKUP(pthread_setspecific, 2, STUB_pthread_setspecific) + SYSCALL_LOOKUP(pthread_yield, 0, STUB_pthread_yield) # ifdef CONFIG_SMP - SYSCALL_LOOKUP(pthread_setaffinity, 3, STUB_pthread_setaffinity) - SYSCALL_LOOKUP(pthread_getaffinity, 3, STUB_pthread_getaffinity) + SYSCALL_LOOKUP(pthread_setaffinity, 3, STUB_pthread_setaffinity) + SYSCALL_LOOKUP(pthread_getaffinity, 3, STUB_pthread_getaffinity) # endif # ifndef CONFIG_DISABLE_SIGNALS - SYSCALL_LOOKUP(pthread_cond_timedwait, 3, STUB_pthread_cond_timedwait) - SYSCALL_LOOKUP(pthread_kill, 2, STUB_pthread_kill) - SYSCALL_LOOKUP(pthread_sigmask, 3, STUB_pthread_sigmask) + SYSCALL_LOOKUP(pthread_cond_timedwait, 3, STUB_pthread_cond_timedwait) + SYSCALL_LOOKUP(pthread_kill, 2, STUB_pthread_kill) + SYSCALL_LOOKUP(pthread_sigmask, 3, STUB_pthread_sigmask) # endif # ifdef CONFIG_PTHREAD_CLEANUP - SYSCALL_LOOKUP(pthread_cleanup_push, 2, STUB_pthread_cleanup_push) - SYSCALL_LOOKUP(pthread_cleanup_pop, 1, STUB_pthread_cleanup_pop) + SYSCALL_LOOKUP(pthread_cleanup_push, 2, STUB_pthread_cleanup_push) + SYSCALL_LOOKUP(pthread_cleanup_pop, 1, STUB_pthread_cleanup_pop) # endif #endif /* The following are defined only if message queues are enabled */ #ifndef CONFIG_DISABLE_MQUEUE - SYSCALL_LOOKUP(mq_close, 1, STUB_mq_close) - SYSCALL_LOOKUP(mq_getattr, 2, STUB_mq_getattr) - SYSCALL_LOOKUP(mq_notify, 2, STUB_mq_notify) - SYSCALL_LOOKUP(mq_open, 6, STUB_mq_open) - SYSCALL_LOOKUP(mq_receive, 4, STUB_mq_receive) - SYSCALL_LOOKUP(mq_send, 4, STUB_mq_send) - SYSCALL_LOOKUP(mq_setattr, 3, STUB_mq_setattr) - SYSCALL_LOOKUP(mq_timedreceive, 5, STUB_mq_timedreceive) - SYSCALL_LOOKUP(mq_timedsend, 5, STUB_mq_timedsend) - SYSCALL_LOOKUP(mq_unlink, 1, STUB_mq_unlink) + SYSCALL_LOOKUP(mq_close, 1, STUB_mq_close) + SYSCALL_LOOKUP(mq_getattr, 2, STUB_mq_getattr) + SYSCALL_LOOKUP(mq_notify, 2, STUB_mq_notify) + SYSCALL_LOOKUP(mq_open, 6, STUB_mq_open) + SYSCALL_LOOKUP(mq_receive, 4, STUB_mq_receive) + SYSCALL_LOOKUP(mq_send, 4, STUB_mq_send) + SYSCALL_LOOKUP(mq_setattr, 3, STUB_mq_setattr) + SYSCALL_LOOKUP(mq_timedreceive, 5, STUB_mq_timedreceive) + SYSCALL_LOOKUP(mq_timedsend, 5, STUB_mq_timedsend) + SYSCALL_LOOKUP(mq_unlink, 1, STUB_mq_unlink) #endif /* The following are defined only if environment variables are supported */ #ifndef CONFIG_DISABLE_ENVIRON - SYSCALL_LOOKUP(clearenv, 0, STUB_clearenv) - SYSCALL_LOOKUP(getenv, 1, STUB_getenv) - SYSCALL_LOOKUP(putenv, 1, STUB_putenv) - SYSCALL_LOOKUP(setenv, 3, STUB_setenv) - SYSCALL_LOOKUP(unsetenv, 1, STUB_unsetenv) + SYSCALL_LOOKUP(clearenv, 0, STUB_clearenv) + SYSCALL_LOOKUP(getenv, 1, STUB_getenv) + SYSCALL_LOOKUP(putenv, 1, STUB_putenv) + SYSCALL_LOOKUP(setenv, 3, STUB_setenv) + SYSCALL_LOOKUP(unsetenv, 1, STUB_unsetenv) #endif /* The following are defined only if netdb is supported */ #ifdef CONFIG_LIBC_NETDB - SYSCALL_LOOKUP(sethostname, 2, STUB_sethostname) + SYSCALL_LOOKUP(sethostname, 2, STUB_sethostname) #endif /* The following are defined only if networking AND sockets are supported */ #if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) - SYSCALL_LOOKUP(accept, 3, STUB_accept) - SYSCALL_LOOKUP(bind, 3, STUB_bind) - SYSCALL_LOOKUP(connect, 3, STUB_connect) - SYSCALL_LOOKUP(getsockopt, 5, STUB_getsockopt) - SYSCALL_LOOKUP(listen, 2, STUB_listen) - SYSCALL_LOOKUP(recv, 4, STUB_recv) - SYSCALL_LOOKUP(recvfrom, 6, STUB_recvfrom) - SYSCALL_LOOKUP(send, 4, STUB_send) - SYSCALL_LOOKUP(sendto, 6, STUB_sendto) - SYSCALL_LOOKUP(setsockopt, 5, STUB_setsockopt) - SYSCALL_LOOKUP(socket, 3, STUB_socket) + SYSCALL_LOOKUP(accept, 3, STUB_accept) + SYSCALL_LOOKUP(bind, 3, STUB_bind) + SYSCALL_LOOKUP(connect, 3, STUB_connect) + SYSCALL_LOOKUP(getsockopt, 5, STUB_getsockopt) + SYSCALL_LOOKUP(listen, 2, STUB_listen) + SYSCALL_LOOKUP(recv, 4, STUB_recv) + SYSCALL_LOOKUP(recvfrom, 6, STUB_recvfrom) + SYSCALL_LOOKUP(send, 4, STUB_send) + SYSCALL_LOOKUP(sendto, 6, STUB_sendto) + SYSCALL_LOOKUP(setsockopt, 5, STUB_setsockopt) + SYSCALL_LOOKUP(socket, 3, STUB_socket) #endif /* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */ #if CONFIG_TASK_NAME_SIZE > 0 - SYSCALL_LOOKUP(prctl, 5, STUB_prctl) + SYSCALL_LOOKUP(prctl, 5, STUB_prctl) #endif /**************************************************************************** diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index ab18f82878..ddcffd5506 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -302,6 +302,7 @@ uintptr_t STUB_pthread_mutex_init(int nbr, uintptr_t parm1, uintptr_t STUB_pthread_mutex_lock(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_mutex_trylock(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_mutex_unlock(int nbr, uintptr_t parm1); +uintptr_t STUB_pthread_mutex_consistent(int nbr, uintptr_t parm1); uintptr_t STUB_pthread_once(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_pthread_setschedparam(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);