diff --git a/ChangeLog b/ChangeLog index ba3080c4283..b7c3f724d20 100755 --- a/ChangeLog +++ b/ChangeLog @@ -2741,7 +2741,7 @@ the worker thread, disabling interrupts does not provide protected; Need to disable pre-emption. (2) Fix handling of touch ID and (2) add some logic to prevent certain kinds of data overrun. - * include/nx/nxtk.h and graphics/nx/nxtk/nxtk_internal.h: Move setting + * include/nx/nxtk.h and graphics/nx/nxtk/nxtk.h: Move setting of configuration defaults from the internal header file to a place where other logic can use the defaults. * graphics/nxtk/nxtk_events.c: Fixed an important but in the logic that @@ -4680,7 +4680,7 @@ * arch/arm/src/kl/kl_gpio.c and .h, configs/freedom-kl25z/src/freedom-kl25z.h, and configs/freedom-kl25z/src/kl_led.c: Fixes LEDs on the Freedom KL25Z board (2013-5-6). - * arch/arm/src/kinetis/kinetis_pin.c and arch/arm/src/kinetis/kinetis_internal.h: + * arch/arm/src/kinetis/kinetis_pin.c and arch/arm/src/kinetis/kinetis.h: The Kinetis GPIO logic had some of the same issues as did the Kinetis L (2013-5-6). * arch/arm/src/stm32/stm32_idle.c: Add an option to conditionally disable @@ -11253,3 +11253,38 @@ (2015-12-23). * arch/arm/src/stm32: Add timer input capture driver. From Pierre-Noel Bouteville (2015-12-24). + * arch/avr: Add support for the Atmega2560. From Dimitry Kloper + (2015-12-19). + * configs/arduino-mega2560: Add support for the Arduino-Mega2560. From + Dimitry Koper (2015-12-29). + * sched/signal, sched/mqueue, sched/timer, include/signal.h, + include/nuttx/signal, fs/aio, libc/aio, and probably other + directories: Add support for the SIGEV_THREAD notification method in + struct sigevent. This initial implementation will only work in the + FLAT build. See the top-level TODO file for additional details + (2015-12-30). + * include/nuttx/compiler.h, include/nuttx/streams.h include/stdio.h + include/syslog.h libc/stdio/, and libc/syslog: ntroduce support for + Atmel toolchain in-flash strings. Atmel toolchain AVR compiler + provides a transparent in-flash object support using __flash and + __memx symbols. The former indicates to compiler that this is a flash- + based object. The later used with pointer indicates that the referenced + object may reside either in flash or in RAM. The compiler automatically + makes 32-bit pointer with flag indicating whether referenced object is + in flash or RAM and generates code to access either in run-time. Thus, + any function that accepts __memx object can transparently work with RAM + and flash objects. + For platforms with a Harvard architecture and a very small RAM like AVR + this allows to move all constant strings used in trace messages to flash + in the instruction address space, releasing resources for other things. + This change introduces IOBJ and IPTR type qualifiers. The 'I' indicates + that the object may lie in instruction space on a Harvard architecture + machine. For platforms that do not have __flash and __memx or similar + symbols IOBJ and IPTR are empty, making the types equivalent to, for + example, 'const char' and 'const char*'. For Atmel compiler these will + become 'const __flash char' and 'const __memx char*'. All printf() + functions and syslog() functions are changed so that the qualifier is + used with the format parameter. From Dimitry Kloper (2016-01-05). + * drivers/net/tun.c: Fix a compile time error in the TUN driver. From + Vladimir Komendantskiy (2016-01-05). + diff --git a/Documentation b/Documentation index fad904fdf95..4217e1a644a 160000 --- a/Documentation +++ b/Documentation @@ -1 +1 @@ -Subproject commit fad904fdf955e20b9c96d51abe10df13eafc645d +Subproject commit 4217e1a644a0dfe8f111ab07f9df38af2ea906d7 diff --git a/README.txt b/README.txt index da9540d0d68..48fcea63963 100644 --- a/README.txt +++ b/README.txt @@ -1256,6 +1256,8 @@ nuttx/ |- configs/ | |- amber/ | | `- README.txt + | |- arduino-mega2560/ + | | `- README.txt | |- arduino-due/ | | `- README.txt | |- avr32dev1/ diff --git a/TODO b/TODO index 3e11ed34b28..84ee69a0661 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated December 23, 2015) +NuttX TODO List (Last updated January 3, 2016) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -19,6 +19,7 @@ nuttx/ (6) Binary loaders (binfmt/) (11) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) + (1) Other drivers (drivers/) (11) Libraries (libc/, libm/) (11) File system/Generic drivers (fs/, drivers/) (8) Graphics subsystem (graphics/) @@ -340,9 +341,17 @@ o Signals (sched/signal, arch/) embedded system. Title: SIGEV_THREAD - Description: sig_notify() logic does not support SIGEV_THREAD; structure - struct sigevent does not provide required members sigev_notify_function - or sigev_notify_attributes. + Description: Implementation of support for support for SIGEV_THREAD is available + only in the FLAT build mode because it uses the OS work queues to + perform the callback. The alternative for the PROTECTED and KERNEL + builds would be to create pthreads in the user space to perform the + callbacks. That is not a very attractive solution due to performance + issues. It would also require some additional logic to specify the + TCB of the parent so that the pthread could be bound to the correct + group. + + There is also some user-space logic in libc/aio/lio_listio.c. That + logic could use the user-space work queue for the callbacks. Status: Low, there are alternative designs. However, these features are required by the POSIX standard. Priority: Low for now @@ -1600,6 +1609,28 @@ o Build system Status: Open Priority: Low. +o Other drivers (drivers/) + ^^^^^^^^^^^^^^^^^^^^^^^^ + + Title: I2C NOT THREAD SAFE + Description: Unlike the SPI interface, the I2C interface has no method to lock + the interface. This is a problem for all non-atomic I2C operations + in a multi-tasking I2C environment: + - I2C_SETFREQUENCY: Frequency setting can be overwritten by other + I2C usage. + - I2C_SETADDRESS used with I2C_READ, I2C_WRITE, and I2C_WRITEREAD: + Similarly, address can and will be changed by other I2C usage. + - I2C_TRANSFER: This is the only interface that is properly self + contained and protected from most mult-tasking issues. But even + this interface can suffer if there are differing frequency settings. + Status: Open + Priority: Medium-High. The fix is easy but effects a lot of software. There + are two ways to fix theses problems: (1) Add a locking method such + as is provided with the SPI interface, or (2) make each interface + self-contained and atomic: Remove the I2C_FREQUENCY and I2C_ADDRESS + methods; Add frequency to all interfaces and add the address to + I2C_READ, I2C_WRITE, and I2C_WRITEREAD. + o Linux/Cywgin simulation (arch/sim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch b/arch index d7d9c92a8fd..ea52a0fb857 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit d7d9c92a8fdf84a14d03b6e1e7c099d4ad623400 +Subproject commit ea52a0fb857e10b4def9c68ef355db1390be213b diff --git a/configs b/configs index 7bd42035e04..d28a8f8d19c 160000 --- a/configs +++ b/configs @@ -1 +1 @@ -Subproject commit 7bd42035e04fcc31e13b1a0e15e643395a591a69 +Subproject commit d28a8f8d19ce051147cf27eb7f85668ea588d33c diff --git a/drivers/mmcsd/mmcsd_internal.h b/drivers/mmcsd/mmcsd.h similarity index 96% rename from drivers/mmcsd/mmcsd_internal.h rename to drivers/mmcsd/mmcsd.h index 36843685d84..06d91348d02 100644 --- a/drivers/mmcsd/mmcsd_internal.h +++ b/drivers/mmcsd/mmcsd.h @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/mmcsd/mmcsd_internal.h + * drivers/mmcsd/mmcsd.h * * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __DRIVERS_MMCSD_MMCSD_INTERNAL_H -#define __DRIVERS_MMCSD_MMCSD_INTERNAL_H +#ifndef __DRIVERS_MMCSD_MMCSD_H +#define __DRIVERS_MMCSD_MMCSD_H /**************************************************************************** * Included Files @@ -102,4 +102,4 @@ EXTERN void mmcsd_dmpcsd(FAR const uint8_t *csd, uint8_t cardtype); #if defined(__cplusplus) } #endif -#endif /* __DRIVERS_MMCSD_MMCSD_INTERNAL_H */ +#endif /* __DRIVERS_MMCSD_MMCSD_H */ diff --git a/drivers/mmcsd/mmcsd_debug.c b/drivers/mmcsd/mmcsd_debug.c index ea3788a29b6..e28b985a025 100644 --- a/drivers/mmcsd/mmcsd_debug.c +++ b/drivers/mmcsd/mmcsd_debug.c @@ -47,7 +47,7 @@ #include #include "mmcsd_csd.h" -#include "mmcsd_internal.h" +#include "mmcsd.h" /**************************************************************************** * Pre-processor Definitions diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 2a1be9595dd..d8ae4561af7 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -65,7 +65,7 @@ #include #include -#include "mmcsd_internal.h" +#include "mmcsd.h" #include "mmcsd_sdio.h" /**************************************************************************** diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index 64f67a797d7..72196488452 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -59,7 +59,7 @@ #include "mmcsd_spi.h" #include "mmcsd_csd.h" -#include "mmcsd_internal.h" +#include "mmcsd.h" /**************************************************************************** * Pre-processor Definitions diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 088e063ab19..97a4fd7d266 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -425,75 +425,54 @@ static void tun_receive(FAR struct tun_device_s *priv) /* We only accept IP packets of the configured type and ARP packets */ -#ifdef CONFIG_NET_IPv4 +#if defined(CONFIG_NET_IPv4) + nllvdbg("IPv4 frame\n"); + NETDEV_RXIPV4(&priv->dev); + + /* Give the IPv4 packet to the network layer */ + + ipv4_input(&priv->dev); + + /* If the above function invocation resulted in data that should be + * sent out on the network, the field d_len will set to a value > 0. + */ + + if (priv->dev.d_len > 0) { - nllvdbg("IPv4 frame\n"); - NETDEV_RXIPV4(&priv->dev); - - /* Give the IPv4 packet to the network layer */ - - ipv4_input(&priv->dev); - - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ - - if (priv->dev.d_len > 0) - { - priv->write_d_len = priv->dev.d_len; - tun_transmit(priv); - } - else - { - priv->write_d_len = 0; - tun_pollnotify(priv, POLLOUT); - } + priv->write_d_len = priv->dev.d_len; + tun_transmit(priv); } else -#endif - -#if 0 -#ifdef CONFIG_NET_IPv6 - if (BUF->type == HTONS(ETHTYPE_IP6)) { - nllvdbg("Iv6 frame\n"); - NETDEV_RXIPV6(&priv->dev); + priv->write_d_len = 0; + tun_pollnotify(priv, POLLOUT); + } - /* Give the IPv6 packet to the network layer */ +#elif defined(CONFIG_NET_IPv6) + nllvdbg("Iv6 frame\n"); + NETDEV_RXIPV6(&priv->dev); - ipv6_input(&priv->dev); + /* Give the IPv6 packet to the network layer */ - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ + ipv6_input(&priv->dev); - if (priv->dev.d_len > 0) - { - /* Update the Ethernet header with the correct MAC address */ + /* If the above function invocation resulted in data that should be + * sent out on the network, the field d_len will set to a value > 0. + */ -#ifdef CONFIG_NET_IPv4 - if (IFF_IS_IPv4(priv->dev.d_flags)) - { - arp_out(&priv->dev); - } - else -#endif -#ifdef CONFIG_NET_IPv6 - { - neighbor_out(&priv->dev); - } -#endif - - /* And send the packet */ - - tun_transmit(priv); - } + if (priv->dev.d_len > 0) + { + priv->write_d_len = priv->dev.d_len; + tun_transmit(priv); } else -#endif { - NETDEV_RXDROPPED(&priv->dev); + priv->write_d_len = 0; + tun_pollnotify(priv, POLLOUT); } + +#else + NETDEV_RXDROPPED(&priv->dev); #endif } diff --git a/drivers/power/pm_internal.h b/drivers/power/pm.h similarity index 97% rename from drivers/power/pm_internal.h rename to drivers/power/pm.h index 6499c65eaf6..8ed66d3d301 100644 --- a/drivers/power/pm_internal.h +++ b/drivers/power/pm.h @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/power/pm_internal.h + * drivers/power/pm * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __DRIVERS_POWER_PM_INTERNAL_H -#define __DRIVERS_POWER_PM_INTERNAL_H +#ifndef __DRIVERS_POWER_PM_H +#define __DRIVERS_POWER_PM_H /**************************************************************************** * Included Files @@ -207,4 +207,4 @@ EXTERN void pm_update(int16_t accum); #endif #endif /* CONFIG_PM */ -#endif /* #define __DRIVERS_POWER_PM_INTERNAL_H */ +#endif /* #define __DRIVERS_POWER_PM_H */ diff --git a/drivers/power/pm_activity.c b/drivers/power/pm_activity.c index f6dceeea373..e15cc78b1ec 100644 --- a/drivers/power/pm_activity.c +++ b/drivers/power/pm_activity.c @@ -43,7 +43,7 @@ #include #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM @@ -163,4 +163,5 @@ void pm_activity(int priority) } } -#endif /* CONFIG_PM */ \ No newline at end of file +#endif /* CONFIG_PM */ + diff --git a/drivers/power/pm_changestate.c b/drivers/power/pm_changestate.c index f64760f55bf..50aa8a07d55 100644 --- a/drivers/power/pm_changestate.c +++ b/drivers/power/pm_changestate.c @@ -42,7 +42,7 @@ #include #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM diff --git a/drivers/power/pm_checkstate.c b/drivers/power/pm_checkstate.c index 13adc5d5ce0..85f44153233 100644 --- a/drivers/power/pm_checkstate.c +++ b/drivers/power/pm_checkstate.c @@ -43,7 +43,7 @@ #include #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM diff --git a/drivers/power/pm_initialize.c b/drivers/power/pm_initialize.c index b4f74587790..298448974f6 100644 --- a/drivers/power/pm_initialize.c +++ b/drivers/power/pm_initialize.c @@ -43,7 +43,7 @@ #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM @@ -109,4 +109,5 @@ void pm_initialize(void) sem_init(&g_pmglobals.regsem, 0, 1); } -#endif /* CONFIG_PM */ \ No newline at end of file +#endif /* CONFIG_PM */ + diff --git a/drivers/power/pm_register.c b/drivers/power/pm_register.c index 19f94cb0263..f8776acee2b 100644 --- a/drivers/power/pm_register.c +++ b/drivers/power/pm_register.c @@ -44,7 +44,7 @@ #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM @@ -109,4 +109,5 @@ int pm_register(FAR struct pm_callback_s *callbacks) return ret; } -#endif /* CONFIG_PM */ \ No newline at end of file +#endif /* CONFIG_PM */ + diff --git a/drivers/power/pm_update.c b/drivers/power/pm_update.c index 73920299351..1d5a64bfff3 100644 --- a/drivers/power/pm_update.c +++ b/drivers/power/pm_update.c @@ -44,7 +44,7 @@ #include #include -#include "pm_internal.h" +#include "pm.h" #ifdef CONFIG_PM diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 378a696b4c4..32d2a073ad5 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -900,7 +900,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) irqrestore(state); - *(int *)arg = count; + *(FAR int *)((uintptr_t)arg) = count; ret = 0; } break; @@ -923,7 +923,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) irqrestore(state); - *(int *)arg = count; + *(FAR int *)((uintptr_t)arg) = count; ret = 0; } break; diff --git a/fs/aio/aio_signal.c b/fs/aio/aio_signal.c index 9545a86227e..5a279044c87 100644 --- a/fs/aio/aio_signal.c +++ b/fs/aio/aio_signal.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/aio/aio_signal.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,29 +51,10 @@ #ifdef CONFIG_FS_AIO -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: aio_signal * @@ -126,6 +107,19 @@ int aio_signal(pid_t pid, FAR struct aiocb *aiocbp) } } +#ifdef CONFIG_SIG_EVTHREAD + /* Notify the client via a function call */ + + else if (aiocbp->aio_sigevent.sigev_notify == SIGEV_THREAD) + { + ret = sig_notification(pid, &aiocbp->aio_sigevent); + if (ret < 0) + { + fdbg("ERROR: sig_notification failed: %d\n", ret); + } + } +#endif + /* Send the poll signal in any event in case the caller is waiting * on sig_suspend(); */ diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h index 6c4aa846fd4..5b13b0a6c2a 100644 --- a/fs/fat/fs_fat32.h +++ b/fs/fat/fs_fat32.h @@ -495,7 +495,7 @@ # define LDIR_GETWCHAR6(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11)) # define LDIR_GETWCHAR7(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+2)) # define LDIR_GETWCHAR8(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+4)) -# define LDIR_GETWCHAR8(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6)) +# define LDIR_GETWCHAR9(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6)) # define LDIR_GETWCHAR10(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+8)) # define LDIR_GETWCHAR11(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+10)) # define LDIR_GETWCHAR12(p) fat_getuint16(UBYTE_PTR(p,LDIR_WCHAR12_13)) @@ -550,7 +550,7 @@ # define LDIR_PUTWCHAR6(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11),v) # define LDIR_PUTWCHAR7(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+2),v) # define LDIR_PUTWCHAR8(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+4),v) -# define LDIR_PUTWCHAR8(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6),v) +# define LDIR_PUTWCHAR9(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+6),v) # define LDIR_PUTWCHAR10(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+8),v) # define LDIR_PUTWCHAR11(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR6_11+10),v) # define LDIR_PUTWCHAR12(p) fat_putuint16(UBYTE_PTR(p,LDIR_WCHAR12_13),v) diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h index c091300dbb1..49659f04cb0 100644 --- a/include/nuttx/clock.h +++ b/include/nuttx/clock.h @@ -98,16 +98,16 @@ /* Timing constants *********************************************************/ -#define NSEC_PER_SEC 1000000000 -#define USEC_PER_SEC 1000000 -#define MSEC_PER_SEC 1000 -#define DSEC_PER_SEC 10 -#define NSEC_PER_DSEC 100000000 -#define USEC_PER_DSEC 100000 -#define MSEC_PER_DSEC 100 -#define NSEC_PER_MSEC 1000000 -#define USEC_PER_MSEC 1000 -#define NSEC_PER_USEC 1000 +#define NSEC_PER_SEC 1000000000L +#define USEC_PER_SEC 1000000L +#define MSEC_PER_SEC 1000L +#define DSEC_PER_SEC 10L +#define NSEC_PER_DSEC 100000000L +#define USEC_PER_DSEC 100000L +#define MSEC_PER_DSEC 100L +#define NSEC_PER_MSEC 1000000L +#define USEC_PER_MSEC 1000L +#define NSEC_PER_USEC 1000L /* If CONFIG_SCHED_TICKLESS is not defined, then the interrupt interval of * the system timer is given by USEC_PER_TICK. This is the expected number diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index f43de0b6715..858902f696f 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -40,6 +40,8 @@ * Included Files ****************************************************************************/ +#include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -127,26 +129,44 @@ */ #if defined(__m32c__) +/* No I-space access qualifiers */ + +# define IOBJ +# define IPTR + /* Select the small, 16-bit addressing model */ -# define CONFIG_SMALL_MEMORY 1 +# define CONFIG_SMALL_MEMORY 1 /* Long and int are not the same size */ -# define CONFIG_LONG_IS_NOT_INT 1 +# define CONFIG_LONG_IS_NOT_INT 1 /* Pointers and int are the same size */ # undef CONFIG_PTR_IS_NOT_INT #elif defined(__AVR__) -/* Select the small, 16-bit addressing model */ +# if defined(CONFIG_AVR_HAS_MEMX_PTR) + /* I-space access qualifiers needed by Harvard architecture */ -# define CONFIG_SMALL_MEMORY 1 +# define IOBJ __flash +# define IPTR __memx + +# else +/* No I-space access qualifiers */ + +# define IOBJ +# define IPTR +# endif + +/* Select the small, 16-bit addressing model (for D-Space) */ + +# define CONFIG_SMALL_MEMORY 1 /* Long and int are not the same size */ -# define CONFIG_LONG_IS_NOT_INT 1 +# define CONFIG_LONG_IS_NOT_INT 1 /* Pointers and int are the same size */ @@ -159,9 +179,14 @@ # define CONFIG_HAVE_FARPOINTER 1 #elif defined(__mc68hc1x__) +/* No I-space access qualifiers */ + +# define IOBJ +# define IPTR + /* Select the small, 16-bit addressing model */ -# define CONFIG_SMALL_MEMORY 1 +# define CONFIG_SMALL_MEMORY 1 /* Normally, mc68hc1x code is compiled with the -mshort option * which results in a 16-bit integer. If -mnoshort is defined @@ -171,22 +196,28 @@ # if __INT__ == 16 /* int is 16-bits, long is 32-bits */ -# define CONFIG_LONG_IS_NOT_INT 1 +# define CONFIG_LONG_IS_NOT_INT 1 -/* Pointers and int are the same size (16-bits) */ +/* Pointers and int are the same size (16-bits) */ # undef CONFIG_PTR_IS_NOT_INT -#else +# else /* int and long are both 32-bits */ # undef CONFIG_LONG_IS_NOT_INT -/* Pointers and int are NOT the same size */ +/* Pointers and int are NOT the same size */ -# define CONFIG_PTR_IS_NOT_INT 1 -#endif +# define CONFIG_PTR_IS_NOT_INT 1 +# endif #else + +/* No I-space access qualifiers */ + +# define IOBJ +# define IPTR + /* Select the large, 32-bit addressing model */ # undef CONFIG_SMALL_MEMORY @@ -491,7 +522,6 @@ extern "C" #define EXTERN extern #endif - #undef EXTERN #ifdef __cplusplus } diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h index 68f7b1b2bf3..53fa3af9f8e 100644 --- a/include/nuttx/mqueue.h +++ b/include/nuttx/mqueue.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/mqueue.h * - * Copyright (C) 2007, 2009, 2011, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -80,8 +80,7 @@ struct mqueue_inode_s #ifndef CONFIG_DISABLE_SIGNALS FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */ pid_t ntpid; /* Notification: Receiving Task's PID */ - int ntsigno; /* Notification: Signal number */ - union sigval ntvalue; /* Notification: Signal value */ + struct sigevent ntevent; /* Notification description */ #endif }; diff --git a/include/nuttx/pthread.h b/include/nuttx/pthread.h index 7528bbda853..eff079be74e 100644 --- a/include/nuttx/pthread.h +++ b/include/nuttx/pthread.h @@ -2,7 +2,7 @@ * include/nuttx/pthread.h * Non-standard, NuttX-specific pthread-related declarations. * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,11 +51,17 @@ /* Default pthread attribute initializer */ +#if CONFIG_RR_INTERVAL == 0 +# define PTHREAD_DEFAULT_POLICY SCHED_FIFO +#else +# define PTHREAD_DEFAULT_POLICY SCHED_RR +#endif + #ifdef CONFIG_SCHED_SPORADIC # define PTHREAD_ATTR_INITIALIZER \ { \ PTHREAD_DEFAULT_PRIORITY, /* priority */ \ - SCHED_RR, /* policy */ \ + PTHREAD_DEFAULT_POLICY, /* policy */ \ PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \ 0, /* low_priority */ \ 0, /* max_repl */ \ @@ -67,7 +73,7 @@ # define PTHREAD_ATTR_INITIALIZER \ { \ PTHREAD_DEFAULT_PRIORITY, /* priority */ \ - SCHED_RR, /* policy */ \ + PTHREAD_DEFAULT_POLICY, /* policy */ \ PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \ PTHREAD_STACK_DEFAULT, /* stacksize */ \ } diff --git a/include/nuttx/signal.h b/include/nuttx/signal.h new file mode 100644 index 00000000000..3f4adb50216 --- /dev/null +++ b/include/nuttx/signal.h @@ -0,0 +1,76 @@ +/**************************************************************************** + * include/nuttx/signal.h + * + * Copyright (C) 2015 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. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SIGNAL_H +#define __INCLUDE_NUTTX_SIGNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#if defined(CONFIG_SIG_EVTHREAD) && defined(CONFIG_BUILD_FLAT) + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: sig_notification + * + * Description: + * Notify a client a signal event via a function call. This function is + * an internal OS interface that implements the common logic for signal + * event notification for the case of SIGEV_THREAD. + * + * Input Parameters: + * pid - The task/thread ID a the client thread to be signaled. + * event - The instance of struct sigevent that describes how to signal + * the client. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * on failure. + * + ****************************************************************************/ + +int sig_notification(pid_t pid, FAR struct sigevent *event); + +#endif /* CONFIG_SIG_EVTHREAD && CONFIG_BUILD_FLAT */ +#endif /* __INCLUDE_NUTTX_SIGNAL_H */ diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index 3358765bed3..ab57b33b35d 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/streams.h * - * Copyright (C) 2009, 2011-2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2012, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -413,9 +413,10 @@ int lib_snoflush(FAR struct lib_sostream_s *this); * ****************************************************************************/ -int lib_sprintf(FAR struct lib_outstream_s *obj, FAR const char *fmt, ...); +int lib_sprintf(FAR struct lib_outstream_s *obj, + FAR const IPTR char *fmt, ...); int lib_vsprintf(FAR struct lib_outstream_s *obj, - FAR const char *src, va_list ap); + FAR const IPTR char *src, va_list ap); #undef EXTERN #if defined(__cplusplus) diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h index a5e6945d5b1..beb13880933 100644 --- a/include/nuttx/wdog.h +++ b/include/nuttx/wdog.h @@ -167,7 +167,7 @@ extern "C" WDOG_ID wd_create(void); int wd_delete(WDOG_ID wdog); -int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...); +int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...); int wd_cancel(WDOG_ID wdog); int wd_gettime(WDOG_ID wdog); diff --git a/include/pthread.h b/include/pthread.h index 4de07d62a22..00cd95772da 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -50,7 +50,7 @@ #include /* C99 boolean types */ #include /* For getpid */ #include /* Needed for sem_t */ -#include /* Needed for sigset_t */ +#include /* Needed for sigset_t, includes this file */ #include /* Needed for struct timespec */ /******************************************************************************** @@ -158,8 +158,11 @@ extern "C" /* pthread-specific types */ -typedef int pthread_key_t; -typedef FAR void *pthread_addr_t; +typedef int pthread_key_t; +#define __PTHREAD_KEY_T_DEFINED 1 + +typedef FAR void *pthread_addr_t; +#define __PTHREAD_ADDR_T_DEFINED 1 typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t); typedef pthread_startroutine_t pthread_func_t; @@ -182,17 +185,24 @@ struct pthread_attr_s struct timespec budget; /* Initial budget */ #endif }; + typedef struct pthread_attr_s pthread_attr_t; +#define __PTHREAD_ATTR_T_DEFINED 1 typedef pid_t pthread_t; +#define __PTHREAD_T_DEFINED 1 typedef int pthread_condattr_t; +#define __PTHREAD_CONDATTR_T_DEFINED 1 struct pthread_cond_s { sem_t sem; }; + typedef struct pthread_cond_s pthread_cond_t; +#define __PTHREAD_COND_T_DEFINED 1 + #define PTHREAD_COND_INITIALIZER {SEM_INITIALIZER(0)} struct pthread_mutexattr_s @@ -202,7 +212,9 @@ struct pthread_mutexattr_s uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */ #endif }; + typedef struct pthread_mutexattr_s pthread_mutexattr_t; +#define __PTHREAD_MUTEXATTR_T_DEFINED 1 struct pthread_mutex_s { @@ -213,7 +225,9 @@ struct pthread_mutex_s int nlocks; /* The number of recursive locks held */ #endif }; + typedef struct pthread_mutex_s pthread_mutex_t; +#define __PTHREAD_MUTEX_T_DEFINED 1 #ifdef CONFIG_MUTEX_TYPES # define PTHREAD_MUTEX_INITIALIZER {-1, SEM_INITIALIZER(1), PTHREAD_MUTEX_DEFAULT, 0} @@ -225,16 +239,21 @@ struct pthread_barrierattr_s { int pshared; }; + typedef struct pthread_barrierattr_s pthread_barrierattr_t; +#define __PTHREAD_BARRIERATTR_T_DEFINED 1 struct pthread_barrier_s { sem_t sem; unsigned int count; }; + typedef struct pthread_barrier_s pthread_barrier_t; +#define __PTHREAD_BARRIER_T_DEFINED 1 typedef bool pthread_once_t; +#define __PTHREAD_ONCE_T_DEFINED 1 /* Forware references */ @@ -413,4 +432,78 @@ int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); } #endif +/******************************************************************************** + * Minimal Type Definitions + ********************************************************************************/ + +#else /* __INCLUDE_PTHREAD_H */ + +#include +#include + +/* Avoid circular dependencies by assuring that simple type definitions are + * available in any inclusion ordering. + */ + +#ifndef __PTHREAD_KEY_T_DEFINED +typedef int pthread_key_t; +# define __PTHREAD_KEY_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_ADDR_T_DEFINED +typedef FAR void *pthread_addr_t; +# define __PTHREAD_ADDR_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_ATTR_T_DEFINED +struct pthread_attr_s; +typedef struct pthread_attr_s pthread_attr_t; +# define __PTHREAD_ATTR_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_T_DEFINED +typedef pid_t pthread_t; +# define __PTHREAD_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_CONDATTR_T_DEFINED +typedef int pthread_condattr_t; +# define __PTHREAD_CONDATTR_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_COND_T_DEFINED +struct pthread_cond_s; +typedef struct pthread_cond_s pthread_cond_t; +# define __PTHREAD_COND_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_MUTEXATTR_T_DEFINED +struct pthread_mutexattr_s; +typedef struct pthread_mutexattr_s pthread_mutexattr_t; +# define __PTHREAD_MUTEXATTR_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_MUTEX_T_DEFINED +struct pthread_mutex_s; +typedef struct pthread_mutex_s pthread_mutex_t; +# define __PTHREAD_MUTEX_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_BARRIERATTR_T_DEFINED +struct pthread_barrierattr_s; +typedef struct pthread_barrierattr_s pthread_barrierattr_t; +# define __PTHREAD_BARRIERATTR_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_BARRIER_T_DEFINED +struct pthread_barrier_s; +typedef struct pthread_barrier_s pthread_barrier_t; +# define __PTHREAD_BARRIER_T_DEFINED 1 +#endif + +#ifndef __PTHREAD_ONCE_T_DEFINED +typedef bool pthread_once_t; +# define __PTHREAD_ONCE_T_DEFINED 1 +#endif + #endif /* __INCLUDE_PTHREAD_H */ diff --git a/include/signal.h b/include/signal.h index 18ab6b85c12..57c5742d838 100644 --- a/include/signal.h +++ b/include/signal.h @@ -46,6 +46,10 @@ #include #include +#ifdef CONFIG_SIG_EVTHREAD +# include /* Needed for pthread_attr_t, includes this file */ +#endif + /******************************************************************************** * Pre-processor Definitions ********************************************************************************/ @@ -162,8 +166,11 @@ /* Values for the sigev_notify field of struct sigevent */ -#define SIGEV_NONE 0 /* No notification desired */ -#define SIGEV_SIGNAL 1 /* Notify via signal */ +#define SIGEV_NONE 0 /* No asynchronous notification is delivered */ +#define SIGEV_SIGNAL 1 /* Notify via signal,with an application-defined value */ +#ifdef CONFIG_SIG_EVTHREAD +# define SIGEV_THREAD 3 /* A notification function is called */ +#endif /* Special values of of sa_handler used by sigaction and sigset. They are all * treated like NULL for now. This is okay for SIG_DFL and SIG_IGN because @@ -189,6 +196,7 @@ /* This defines a set of 32 signals (numbered 0 through 31). */ typedef uint32_t sigset_t; /* Bit set of 32 signals */ +#define __SIGSET_T_DEFINED 1 /* This defines the type of the siginfo si_value field */ @@ -203,11 +211,22 @@ union sigval * available on a queue */ +#ifdef CONFIG_CAN_PASS_STRUCTS +typedef CODE void (*sigev_notify_function_t)(union sigval value); +#else +typedef CODE void (*sigev_notify_function_t)(FAR void *sival_ptr); +#endif + struct sigevent { - uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL or SIGEV_NONE */ + uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL, SIGEV_NONE, or SIGEV_THREAD */ uint8_t sigev_signo; /* Notification signal */ union sigval sigev_value; /* Data passed with notification */ + +#ifdef CONFIG_SIG_EVTHREAD + sigev_notify_function_t sigev_notify_function; /* Notification function */ + FAR pthread_attr_t *sigev_notify_attributes; /* Notification attributes (not used) */ +#endif }; /* The following types is used to pass parameters to/from signal handlers */ @@ -225,6 +244,7 @@ struct siginfo }; typedef struct siginfo siginfo_t; +#define __SIGINFO_T_DEFINED 1 /* Non-standard convenience definition of signal handling function types. * These should be used only internally within the NuttX signal logic. @@ -251,10 +271,6 @@ struct sigaction #define sa_handler sa_u._sa_handler #define sa_sigaction sa_u._sa_sigaction -/******************************************************************************** - * Public Data - ********************************************************************************/ - /******************************************************************************** * Public Function Prototypes ********************************************************************************/ @@ -297,4 +313,27 @@ int sigqueue(int pid, int signo, FAR void *sival_ptr); } #endif +/******************************************************************************** + * Minimal Type Definitions + ********************************************************************************/ + +#else /* __INCLUDE_SIGNAL_H */ + +#include + +/* Avoid circular dependencies by assuring that simple type definitions are + * available in any inclusion ordering. + */ + +#ifndef __SIGSET_T_DEFINED +typedef uint32_t sigset_t; +# define __SIGSET_T_DEFINED 1 +#endif + +#ifndef __SIGINFO_T_DEFINED +struct siginfo; +typedef struct siginfo siginfo_t; +# define __SIGINFO_T_DEFINED 1 +#endif + #endif /* __INCLUDE_SIGNAL_H */ diff --git a/include/stdio.h b/include/stdio.h index d8f0c3479ae..20994e22ffd 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -143,35 +143,40 @@ int fgetc(FAR FILE *stream); int fgetpos(FAR FILE *stream, FAR fpos_t *pos); char *fgets(FAR char *s, int n, FAR FILE *stream); FAR FILE *fopen(FAR const char *path, FAR const char *type); -int fprintf(FAR FILE *stream, FAR const char *format, ...); +int fprintf(FAR FILE *stream, FAR const IPTR char *format, ...); int fputc(int c, FAR FILE *stream); int fputs(FAR const char *s, FAR FILE *stream); size_t fread(FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream); -FAR FILE *freopen(FAR const char *path, FAR const char *mode, FAR FILE *stream); +FAR FILE *freopen(FAR const char *path, FAR const char *mode, + FAR FILE *stream); int fseek(FAR FILE *stream, long int offset, int whence); int fsetpos(FAR FILE *stream, FAR fpos_t *pos); long ftell(FAR FILE *stream); -size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream); +size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, + FAR FILE *stream); FAR char *gets(FAR char *s); FAR char *gets_s(FAR char *s, rsize_t n); int ungetc(int c, FAR FILE *stream); /* Operations on the stdout stream, buffers, paths, and the whole printf-family */ -int printf(FAR const char *format, ...); +int printf(FAR const IPTR char *format, ...); int puts(FAR const char *s); int rename(FAR const char *oldpath, FAR const char *newpath); -int sprintf(FAR char *buf, FAR const char *format, ...); -int asprintf (FAR char **ptr, FAR const char *fmt, ...); -int snprintf(FAR char *buf, size_t size, FAR const char *format, ...); +int sprintf(FAR char *buf, FAR const IPTR char *format, ...); +int asprintf (FAR char **ptr, FAR const IPTR char *fmt, ...); +int snprintf(FAR char *buf, size_t size, + FAR const IPTR char *format, ...); int sscanf(FAR const char *buf, FAR const char *fmt, ...); void perror(FAR const char *s); -int vprintf(FAR const char *format, va_list ap); -int vfprintf(FAR FILE *stream, const char *format, va_list ap); -int vsprintf(FAR char *buf, const char *format, va_list ap); -int vasprintf(FAR char **ptr, const char *fmt, va_list ap); -int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap); +int vprintf(FAR const IPTR FAR char *format, va_list ap); +int vfprintf(FAR FILE *stream, FAR const IPTR char *format, + va_list ap); +int vsprintf(FAR char *buf, FAR const IPTR char *format, va_list ap); +int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap); +int vsnprintf(FAR char *buf, size_t size, FAR const IPTR char *format, + va_list ap); int vsscanf(FAR const char *buf, FAR const char *s, va_list ap); /* Operations on file descriptors including: @@ -182,8 +187,8 @@ int vsscanf(FAR const char *buf, FAR const char *s, va_list ap); */ FAR FILE *fdopen(int fd, FAR const char *type); -int dprintf(int fd, FAR const char *fmt, ...); -int vdprintf(int fd, FAR const char *fmt, va_list ap); +int dprintf(int fd, FAR const IPTR char *fmt, ...); +int vdprintf(int fd, FAR const IPTR char *fmt, va_list ap); /* Operations on paths */ diff --git a/include/sys/time.h b/include/sys/time.h index ecc2fc8401b..b36e30fca9a 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -78,12 +78,12 @@ do \ { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ - (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ - if ((vvp)->tv_usec < 0) \ + if ((uvp)->tv_usec > (tvp)->tv_usec) \ { \ (vvp)->tv_sec--; \ - (vvp)->tv_usec += 1000000; \ + (tvp)->tv_usec += 1000000; \ } \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ } \ while (0) diff --git a/include/syslog.h b/include/syslog.h index 2dfef54b24a..6c1316a7e61 100644 --- a/include/syslog.h +++ b/include/syslog.h @@ -41,6 +41,7 @@ ****************************************************************************/ #include +#include #include #include @@ -167,8 +168,8 @@ void closelog(void); * ****************************************************************************/ -int syslog(int priority, FAR const char *format, ...); -int vsyslog(int priority, FAR const char *src, va_list ap); +int syslog(int priority, FAR const IPTR char *format, ...); +int vsyslog(int priority, FAR const IPTR char *src, va_list ap); /**************************************************************************** * Name: lowsyslog and lowvsyslog @@ -198,8 +199,8 @@ int vsyslog(int priority, FAR const char *src, va_list ap); #ifdef CONFIG_ARCH_LOWPUTC -int lowsyslog(int priority, FAR const char *format, ...); -int lowvsyslog(int priority, FAR const char *format, va_list ap); +int lowsyslog(int priority, FAR const IPTR char *format, ...); +int lowvsyslog(int priority, FAR const IPTR char *format, va_list ap); #else diff --git a/libc/aio/lio_listio.c b/libc/aio/lio_listio.c index 0889fd9b147..b123a4e7357 100644 --- a/libc/aio/lio_listio.c +++ b/libc/aio/lio_listio.c @@ -45,16 +45,13 @@ #include #include -#include "lib_internal.h" +#include + +#include "libc.h" #include "aio/aio.h" #ifdef CONFIG_FS_AIO -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - /**************************************************************************** * Private Types ****************************************************************************/ @@ -69,14 +66,6 @@ struct lio_sighand_s struct sigaction oact; /* Signal handler to restore */ }; -/**************************************************************************** - * Private Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -205,14 +194,23 @@ static void lio_sighandler(int signo, siginfo_t *info, void *ucontext) if (sighand->sig->sigev_notify == SIGEV_SIGNAL) { #ifdef CONFIG_CAN_PASS_STRUCTS - (void)sigqueue(sighand->pid, sighand->sig->sigev_signo, - sighand->sig->sigev_value); + DEBUGASSERT(sigqueue(sighand->pid, sighand->sig->sigev_signo, + sighand->sig->sigev_value)); #else - (void)sigqueue(sighand->pid, sighand->sig->sigev_signo, - sighand->sig->sigev_value.sival_ptr); + DEBUGASSERT(sigqueue(sighand->pid, sighand->sig->sigev_signo, + sighand->sig->sigev_value.sival_ptr)); #endif } +#ifdef CONFIG_SIG_EVTHREAD + /* Notify the client via a function call */ + + else if (ighand->sig->sigev_notify == SIGEV_THREAD) + { + DEBUGASSERT(sig_notification(sighand->pid, &sighand->sig)); + } +#endif + /* And free the container */ lib_free(sighand); @@ -651,7 +649,7 @@ int lio_listio(int mode, FAR struct aiocb *const list[], int nent, */ status = lio_waitall(list, nent); - if (status < 0 && ret != OK) + if (status < 0 && ret == OK) { /* Something bad happened while waiting and this is the first * error to be reported. @@ -679,7 +677,7 @@ int lio_listio(int mode, FAR struct aiocb *const list[], int nent, /* Setup a signal handler to detect when until all I/O completes. */ status = lio_sigsetup(list, nent, sig); - if (status < 0 && ret != OK) + if (status < 0 && ret == OK) { /* Something bad happened while setting up the signal and this * is the first error to be reported. @@ -698,8 +696,7 @@ int lio_listio(int mode, FAR struct aiocb *const list[], int nent, status = sigqueue(getpid(), sig->sigev_signo, sig->sigev_value.sival_ptr); #endif - - if (status < 0 && ret != OK) + if (status < 0 && ret == OK) { /* Something bad happened while signalling ourself and this is * the first error to be reported. @@ -711,6 +708,24 @@ int lio_listio(int mode, FAR struct aiocb *const list[], int nent, } } +#ifdef CONFIG_SIG_EVTHREAD + /* Notify the client via a function call */ + + else if (sig && sig->sigev_notify == SIGEV_THREAD) + { + status = sig_notification(sighand->pid, &sighand->sig); + if (status < 0 && ret == OK) + { + /* Something bad happened while performing the notification + * and this is the first error to be reported. + */ + + retcode = -status; + ret = ERROR; + } + } +#endif + /* Case 3: mode == LIO_NOWAIT and sig == NULL * * Just return now. diff --git a/libc/audio/lib_buffer.c b/libc/audio/lib_buffer.c index f69a2066ed2..f7e29dd033b 100644 --- a/libc/audio/lib_buffer.c +++ b/libc/audio/lib_buffer.c @@ -52,7 +52,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if defined(CONFIG_AUDIO) diff --git a/libc/lib_internal.h b/libc/libc.h similarity index 98% rename from libc/lib_internal.h rename to libc/libc.h index 29bbd136f5c..9cb1974fa93 100644 --- a/libc/lib_internal.h +++ b/libc/libc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/lib_internal.h + * libc/libc.h * * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __LIBC_LIB_INTERNAL_H -#define __LIBC_LIB_INTERNAL_H +#ifndef __LIBC_LIBC_H +#define __LIBC_LIBC_H /**************************************************************************** * Included Files @@ -233,4 +233,4 @@ ssize_t lib_parse_hostfile(FAR FILE *stream, FAR struct hostent *host, } #endif -#endif /* __LIBC_LIB_INTERNAL_H */ +#endif /* __LIBC_LIBC_H */ diff --git a/libc/math/lib_exp.c b/libc/math/lib_exp.c index 738bd3f76bc..211b23bf952 100644 --- a/libc/math/lib_exp.c +++ b/libc/math/lib_exp.c @@ -35,7 +35,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_HAVE_DOUBLE diff --git a/libc/math/lib_expf.c b/libc/math/lib_expf.c index 36788b60add..4ce5208607b 100644 --- a/libc/math/lib_expf.c +++ b/libc/math/lib_expf.c @@ -32,7 +32,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Data diff --git a/libc/math/lib_expl.c b/libc/math/lib_expl.c index 29f30ecd137..1021017ca32 100644 --- a/libc/math/lib_expl.c +++ b/libc/math/lib_expl.c @@ -35,7 +35,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_HAVE_LONG_DOUBLE diff --git a/libc/math/lib_sqrt.c b/libc/math/lib_sqrt.c index 7a3af561c66..8540744d21d 100644 --- a/libc/math/lib_sqrt.c +++ b/libc/math/lib_sqrt.c @@ -35,7 +35,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/math/lib_sqrtf.c b/libc/math/lib_sqrtf.c index 0e9a55ac24f..e1a107eb8b9 100644 --- a/libc/math/lib_sqrtf.c +++ b/libc/math/lib_sqrtf.c @@ -35,7 +35,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/math/lib_sqrtl.c b/libc/math/lib_sqrtl.c index 15280a83f9c..03a564f72d9 100644 --- a/libc/math/lib_sqrtl.c +++ b/libc/math/lib_sqrtl.c @@ -35,7 +35,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/misc/lib_dbg.c b/libc/misc/lib_dbg.c index aa0b857bb18..14044175b79 100644 --- a/libc/misc/lib_dbg.c +++ b/libc/misc/lib_dbg.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #ifndef CONFIG_CPP_HAVE_VARARGS diff --git a/libc/misc/lib_filesem.c b/libc/misc/lib_filesem.c index da52b5ae367..2fd5d1c9ebf 100644 --- a/libc/misc/lib_filesem.c +++ b/libc/misc/lib_filesem.c @@ -45,7 +45,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if CONFIG_STDIO_BUFFER_SIZE > 0 diff --git a/libc/misc/lib_ioctl.c b/libc/misc/lib_ioctl.c index fa0d908042f..0e7ca015d33 100644 --- a/libc/misc/lib_ioctl.c +++ b/libc/misc/lib_ioctl.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" #if defined(CONFIG_LIBC_IOCTL_VARIADIC) && CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/libc/misc/lib_sendfile.c b/libc/misc/lib_sendfile.c index 4fa19b66a73..2313833dc77 100644 --- a/libc/misc/lib_sendfile.c +++ b/libc/misc/lib_sendfile.c @@ -45,7 +45,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/libc/misc/lib_stream.c b/libc/misc/lib_stream.c index 2ad3cd740e6..f42b040cbbe 100644 --- a/libc/misc/lib_stream.c +++ b/libc/misc/lib_stream.c @@ -48,7 +48,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ defined(__KERNEL__) diff --git a/libc/misc/lib_streamsem.c b/libc/misc/lib_streamsem.c index a403b710287..9f26d96a722 100644 --- a/libc/misc/lib_streamsem.c +++ b/libc/misc/lib_streamsem.c @@ -46,7 +46,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private types diff --git a/libc/netdb/lib_gethostbyaddr.c b/libc/netdb/lib_gethostbyaddr.c index 46c4d6dd56c..c06f1654047 100644 --- a/libc/netdb/lib_gethostbyaddr.c +++ b/libc/netdb/lib_gethostbyaddr.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #include "netdb/lib_netdb.h" #ifdef CONFIG_NETDB_HOSTFILE diff --git a/libc/netdb/lib_gethostbyaddrr.c b/libc/netdb/lib_gethostbyaddrr.c index 812b1fedb9e..6dcb8e8ab1d 100644 --- a/libc/netdb/lib_gethostbyaddrr.c +++ b/libc/netdb/lib_gethostbyaddrr.c @@ -48,7 +48,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #include "netdb/lib_netdb.h" #ifdef CONFIG_NETDB_HOSTFILE diff --git a/libc/netdb/lib_gethostbyname.c b/libc/netdb/lib_gethostbyname.c index 4aae74a204e..aa492db7792 100644 --- a/libc/netdb/lib_gethostbyname.c +++ b/libc/netdb/lib_gethostbyname.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #include "netdb/lib_netdb.h" #ifdef CONFIG_LIBC_NETDB diff --git a/libc/netdb/lib_gethostbynamer.c b/libc/netdb/lib_gethostbynamer.c index 6b005743cfc..747cf6a0c58 100644 --- a/libc/netdb/lib_gethostbynamer.c +++ b/libc/netdb/lib_gethostbynamer.c @@ -53,7 +53,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #include "netdb/lib_dns.h" #ifdef CONFIG_LIBC_NETDB diff --git a/libc/netdb/lib_parsehostfile.c b/libc/netdb/lib_parsehostfile.c index 177c00a3f39..0e2c5bdeff3 100644 --- a/libc/netdb/lib_parsehostfile.c +++ b/libc/netdb/lib_parsehostfile.c @@ -50,7 +50,7 @@ #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_NETDB_HOSTFILE diff --git a/libc/spawn/lib_psfa_addclose.c b/libc/spawn/lib_psfa_addclose.c index eaf3e088923..3ee6f19083a 100644 --- a/libc/spawn/lib_psfa_addclose.c +++ b/libc/spawn/lib_psfa_addclose.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/spawn/lib_psfa_adddup2.c b/libc/spawn/lib_psfa_adddup2.c index 5b4833c5b04..6473476275c 100644 --- a/libc/spawn/lib_psfa_adddup2.c +++ b/libc/spawn/lib_psfa_adddup2.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/spawn/lib_psfa_addopen.c b/libc/spawn/lib_psfa_addopen.c index 4bb096efb76..7f22c06af8d 100644 --- a/libc/spawn/lib_psfa_addopen.c +++ b/libc/spawn/lib_psfa_addopen.c @@ -47,7 +47,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/spawn/lib_psfa_destroy.c b/libc/spawn/lib_psfa_destroy.c index e4020304b1e..73a5ea25f5b 100644 --- a/libc/spawn/lib_psfa_destroy.c +++ b/libc/spawn/lib_psfa_destroy.c @@ -45,7 +45,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/stdio/lib_asprintf.c b/libc/stdio/lib_asprintf.c index 09e6f42e93e..4c3f85760a6 100644 --- a/libc/stdio/lib_asprintf.c +++ b/libc/stdio/lib_asprintf.c @@ -40,7 +40,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -92,7 +92,7 @@ * ****************************************************************************/ -int asprintf (FAR char **ptr, const char *fmt, ...) +int asprintf (FAR char **ptr, FAR const IPTR char *fmt, ...) { va_list ap; int ret; diff --git a/libc/stdio/lib_dprintf.c b/libc/stdio/lib_dprintf.c index f3f9de8ee54..0b8f676145e 100644 --- a/libc/stdio/lib_dprintf.c +++ b/libc/stdio/lib_dprintf.c @@ -47,7 +47,7 @@ * Name: dprintf ****************************************************************************/ -int dprintf(int fd, FAR const char *fmt, ...) +int dprintf(int fd, FAR const IPTR char *fmt, ...) { va_list ap; int ret; diff --git a/libc/stdio/lib_dtoa.c b/libc/stdio/lib_dtoa.c index 68ae7b2098a..e3452126d86 100644 --- a/libc/stdio/lib_dtoa.c +++ b/libc/stdio/lib_dtoa.c @@ -48,7 +48,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fclose.c b/libc/stdio/lib_fclose.c index ff54efba4c1..35301fc6bb4 100644 --- a/libc/stdio/lib_fclose.c +++ b/libc/stdio/lib_fclose.c @@ -45,7 +45,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/stdio/lib_fflush.c b/libc/stdio/lib_fflush.c index bb3d0313cdb..d56f8fb75c6 100644 --- a/libc/stdio/lib_fflush.c +++ b/libc/stdio/lib_fflush.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fgetc.c b/libc/stdio/lib_fgetc.c index 022aed1dcca..15ccb893dd9 100644 --- a/libc/stdio/lib_fgetc.c +++ b/libc/stdio/lib_fgetc.c @@ -42,7 +42,7 @@ ****************************************************************************/ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fgetpos.c b/libc/stdio/lib_fgetpos.c index e2c4d0c6966..ea49abb2ce4 100644 --- a/libc/stdio/lib_fgetpos.c +++ b/libc/stdio/lib_fgetpos.c @@ -47,7 +47,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fgets.c b/libc/stdio/lib_fgets.c index 88dfca3ad1a..bce8261e6e4 100644 --- a/libc/stdio/lib_fgets.c +++ b/libc/stdio/lib_fgets.c @@ -41,7 +41,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fopen.c b/libc/stdio/lib_fopen.c index 957e439b191..b7208dba5fb 100644 --- a/libc/stdio/lib_fopen.c +++ b/libc/stdio/lib_fopen.c @@ -47,7 +47,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fprintf.c b/libc/stdio/lib_fprintf.c index d4420ada23c..a0169972ebd 100644 --- a/libc/stdio/lib_fprintf.c +++ b/libc/stdio/lib_fprintf.c @@ -79,7 +79,7 @@ * Name: fprintf ****************************************************************************/ -int fprintf(FAR FILE *stream, FAR const char *fmt, ...) +int fprintf(FAR FILE *stream, FAR const IPTR char *fmt, ...) { va_list ap; int n; diff --git a/libc/stdio/lib_fputc.c b/libc/stdio/lib_fputc.c index f434d442e26..9ba40a6e7da 100644 --- a/libc/stdio/lib_fputc.c +++ b/libc/stdio/lib_fputc.c @@ -42,7 +42,7 @@ ****************************************************************************/ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fputs.c b/libc/stdio/lib_fputs.c index a1bcd89c3d5..033ff3b9b3f 100644 --- a/libc/stdio/lib_fputs.c +++ b/libc/stdio/lib_fputs.c @@ -49,7 +49,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fread.c b/libc/stdio/lib_fread.c index 9c8b2d378a3..6acb9d7e771 100644 --- a/libc/stdio/lib_fread.c +++ b/libc/stdio/lib_fread.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_freopen.c b/libc/stdio/lib_freopen.c index f90546067e5..830ea9a78f5 100644 --- a/libc/stdio/lib_freopen.c +++ b/libc/stdio/lib_freopen.c @@ -43,7 +43,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/stdio/lib_fseek.c b/libc/stdio/lib_fseek.c index f09155dc0ab..1016d8b37f9 100644 --- a/libc/stdio/lib_fseek.c +++ b/libc/stdio/lib_fseek.c @@ -49,7 +49,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fsetpos.c b/libc/stdio/lib_fsetpos.c index 71093d4ce86..681aa514f9a 100644 --- a/libc/stdio/lib_fsetpos.c +++ b/libc/stdio/lib_fsetpos.c @@ -49,7 +49,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_ftell.c b/libc/stdio/lib_ftell.c index c72e4e1b85b..c13e64c9aef 100644 --- a/libc/stdio/lib_ftell.c +++ b/libc/stdio/lib_ftell.c @@ -49,7 +49,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_fwrite.c b/libc/stdio/lib_fwrite.c index ed2dce16d8a..941120ae6d2 100644 --- a/libc/stdio/lib_fwrite.c +++ b/libc/stdio/lib_fwrite.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_gets.c b/libc/stdio/lib_gets.c index f793fbc4452..e8573edca90 100644 --- a/libc/stdio/lib_gets.c +++ b/libc/stdio/lib_gets.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_gets_s.c b/libc/stdio/lib_gets_s.c index a5a4c50059b..d811bdfcfcb 100644 --- a/libc/stdio/lib_gets_s.c +++ b/libc/stdio/lib_gets_s.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libdtoa.c b/libc/stdio/lib_libdtoa.c index 95a5dcc70bd..995b0d72c41 100644 --- a/libc/stdio/lib_libdtoa.c +++ b/libc/stdio/lib_libdtoa.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libfflush.c b/libc/stdio/lib_libfflush.c index ff9aaece4b4..4eebac409df 100644 --- a/libc/stdio/lib_libfflush.c +++ b/libc/stdio/lib_libfflush.c @@ -47,7 +47,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libfgets.c b/libc/stdio/lib_libfgets.c index 884cc1f535f..4c3c41db059 100644 --- a/libc/stdio/lib_libfgets.c +++ b/libc/stdio/lib_libfgets.c @@ -47,7 +47,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libflushall.c b/libc/stdio/lib_libflushall.c index 85e807a9eaf..e040d2deb60 100644 --- a/libc/stdio/lib_libflushall.c +++ b/libc/stdio/lib_libflushall.c @@ -45,7 +45,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libfread.c b/libc/stdio/lib_libfread.c index 48ab4ad4cf5..e4ad730e265 100644 --- a/libc/stdio/lib_libfread.c +++ b/libc/stdio/lib_libfread.c @@ -46,7 +46,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libfwrite.c b/libc/stdio/lib_libfwrite.c index 76c8d72797f..12bfd033c87 100644 --- a/libc/stdio/lib_libfwrite.c +++ b/libc/stdio/lib_libfwrite.c @@ -46,7 +46,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_libnoflush.c b/libc/stdio/lib_libnoflush.c index 63e4d529500..6ad372a6537 100644 --- a/libc/stdio/lib_libnoflush.c +++ b/libc/stdio/lib_libnoflush.c @@ -47,7 +47,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_STDIO_LINEBUFFER diff --git a/libc/stdio/lib_libsnoflush.c b/libc/stdio/lib_libsnoflush.c index 1e5af1474b2..809356f1447 100644 --- a/libc/stdio/lib_libsnoflush.c +++ b/libc/stdio/lib_libsnoflush.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_STDIO_LINEBUFFER diff --git a/libc/stdio/lib_libsprintf.c b/libc/stdio/lib_libsprintf.c index 1d8abbced70..8668a54674b 100644 --- a/libc/stdio/lib_libsprintf.c +++ b/libc/stdio/lib_libsprintf.c @@ -38,7 +38,7 @@ ****************************************************************************/ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -76,7 +76,8 @@ * Name: lib_sprintf ****************************************************************************/ -int lib_sprintf(FAR struct lib_outstream_s *obj, const char *fmt, ...) +int lib_sprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *fmt, + ...) { va_list ap; int n; diff --git a/libc/stdio/lib_libvsprintf.c b/libc/stdio/lib_libvsprintf.c index 634b172ad00..c81e55617f7 100644 --- a/libc/stdio/lib_libvsprintf.c +++ b/libc/stdio/lib_libvsprintf.c @@ -46,7 +46,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -145,7 +145,8 @@ enum /* Pointer to ASCII conversion */ #ifdef CONFIG_PTR_IS_NOT_INT -static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, FAR void *p); +static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, + FAR void *p); #ifndef CONFIG_NOPRINTF_FIELDWIDTH static int getsizesize(uint8_t fmt, uint8_t flags, FAR void *p) #endif /* CONFIG_NOPRINTF_FIELDWIDTH */ @@ -154,7 +155,8 @@ static int getsizesize(uint8_t fmt, uint8_t flags, FAR void *p) /* Unsigned int to ASCII conversion */ static void utodec(FAR struct lib_outstream_s *obj, unsigned int n); -static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, uint8_t a); +static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, + uint8_t a); static void utooct(FAR struct lib_outstream_s *obj, unsigned int n); static void utobin(FAR struct lib_outstream_s *obj, unsigned int n); static void utoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, @@ -169,7 +171,8 @@ static int getusize(uint8_t fmt, uint8_t flags, unsigned int lln); #ifdef CONFIG_LONG_IS_NOT_INT static void lutodec(FAR struct lib_outstream_s *obj, unsigned long ln); -static void lutohex(FAR struct lib_outstream_s *obj, unsigned long ln, uint8_t a); +static void lutohex(FAR struct lib_outstream_s *obj, unsigned long ln, + uint8_t a); static void lutooct(FAR struct lib_outstream_s *obj, unsigned long ln); static void lutobin(FAR struct lib_outstream_s *obj, unsigned long ln); static void lutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, @@ -184,14 +187,16 @@ static int getlusize(uint8_t fmt, FAR uint8_t flags, unsigned long ln); #if defined(CONFIG_HAVE_LONG_LONG) && defined(CONFIG_LIBC_LONG_LONG) static void llutodec(FAR struct lib_outstream_s *obj, unsigned long long lln); -static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long lln, uint8_t a); +static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long lln, + uint8_t a); static void llutooct(FAR struct lib_outstream_s *obj, unsigned long long lln); static void llutobin(FAR struct lib_outstream_s *obj, unsigned long long lln); static void llutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned long long lln); #ifndef CONFIG_NOPRINTF_FIELDWIDTH static void llfixup(uint8_t fmt, FAR uint8_t *flags, FAR long long *lln); -static int getllusize(uint8_t fmt, FAR uint8_t flags, FAR unsigned long long lln); +static int getllusize(uint8_t fmt, FAR uint8_t flags, + FAR unsigned long long lln); #endif #endif @@ -235,7 +240,8 @@ static const char g_nullstring[] = "(null)"; ****************************************************************************/ #ifdef CONFIG_PTR_IS_NOT_INT -static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, FAR void *p) +static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, + FAR void *p) { union { @@ -309,7 +315,8 @@ static void utodec(FAR struct lib_outstream_s *obj, unsigned int n) * Name: utohex ****************************************************************************/ -static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, uint8_t a) +static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, + uint8_t a) { bool nonzero = false; uint8_t bits; @@ -376,7 +383,8 @@ static void utobin(FAR struct lib_outstream_s *obj, unsigned int n) * Name: utoascii ****************************************************************************/ -static void utoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned int n) +static void utoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, + uint8_t flags, unsigned int n) { /* Perform the integer conversion according to the format specifier */ @@ -577,7 +585,8 @@ static void lutodec(FAR struct lib_outstream_s *obj, unsigned long n) * Name: lutohex ****************************************************************************/ -static void lutohex(FAR struct lib_outstream_s *obj, unsigned long n, uint8_t a) +static void lutohex(FAR struct lib_outstream_s *obj, unsigned long n, + uint8_t a) { bool nonzero = false; uint8_t bits; @@ -644,7 +653,8 @@ static void lutobin(FAR struct lib_outstream_s *obj, unsigned long n) * Name: lutoascii ****************************************************************************/ -static void lutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned long ln) +static void lutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, + uint8_t flags, unsigned long ln) { /* Perform the integer conversion according to the format specifier */ @@ -827,7 +837,8 @@ static void llutodec(FAR struct lib_outstream_s *obj, unsigned long long n) * Name: llutohex ****************************************************************************/ -static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long n, uint8_t a) +static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long n, + uint8_t a) { bool nonzero = false; uint8_t bits; @@ -894,7 +905,8 @@ static void llutobin(FAR struct lib_outstream_s *obj, unsigned long long n) * Name: llutoascii ****************************************************************************/ -static void llutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned long long lln) +static void llutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, + uint8_t flags, unsigned long long lln) { /* Perform the integer conversion according to the format specifier */ @@ -1164,7 +1176,8 @@ static void postjustify(FAR struct lib_outstream_s *obj, uint8_t fmt, * libc/stdio/lib_vsprintf ****************************************************************************/ -int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list ap) +int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src, + va_list ap) { FAR char *ptmp; #ifndef CONFIG_NOPRINTF_FIELDWIDTH @@ -1616,5 +1629,3 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a return obj->nput; } - - diff --git a/libc/stdio/lib_lowinstream.c b/libc/stdio/lib_lowinstream.c index 8c11fee9072..8964b56749d 100644 --- a/libc/stdio/lib_lowinstream.c +++ b/libc/stdio/lib_lowinstream.c @@ -45,7 +45,7 @@ #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_ARCH_LOWGETC diff --git a/libc/stdio/lib_lowoutstream.c b/libc/stdio/lib_lowoutstream.c index f600bc614a0..91604c90c49 100644 --- a/libc/stdio/lib_lowoutstream.c +++ b/libc/stdio/lib_lowoutstream.c @@ -46,7 +46,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_meminstream.c b/libc/stdio/lib_meminstream.c index 195b294e4d7..c975419499e 100644 --- a/libc/stdio/lib_meminstream.c +++ b/libc/stdio/lib_meminstream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_memoutstream.c b/libc/stdio/lib_memoutstream.c index 492661e68aa..1c658512ea9 100644 --- a/libc/stdio/lib_memoutstream.c +++ b/libc/stdio/lib_memoutstream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_memsistream.c b/libc/stdio/lib_memsistream.c index d258c7fde17..af241b4c2ed 100644 --- a/libc/stdio/lib_memsistream.c +++ b/libc/stdio/lib_memsistream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_memsostream.c b/libc/stdio/lib_memsostream.c index 8726ea187ea..6570ef8942b 100644 --- a/libc/stdio/lib_memsostream.c +++ b/libc/stdio/lib_memsostream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_nullinstream.c b/libc/stdio/lib_nullinstream.c index aeb0af3790f..9ca50d6379b 100644 --- a/libc/stdio/lib_nullinstream.c +++ b/libc/stdio/lib_nullinstream.c @@ -40,7 +40,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_nulloutstream.c b/libc/stdio/lib_nulloutstream.c index 57429534489..89a5a2524df 100644 --- a/libc/stdio/lib_nulloutstream.c +++ b/libc/stdio/lib_nulloutstream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_printf.c b/libc/stdio/lib_printf.c index b38257f2304..70884523936 100644 --- a/libc/stdio/lib_printf.c +++ b/libc/stdio/lib_printf.c @@ -44,7 +44,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -86,7 +86,7 @@ * Name: printf ****************************************************************************/ -int printf(FAR const char *fmt, ...) +int printf(FAR const IPTR char *fmt, ...) { va_list ap; int ret; diff --git a/libc/stdio/lib_puts.c b/libc/stdio/lib_puts.c index 4d2ab4c4ede..c30c92aaf42 100644 --- a/libc/stdio/lib_puts.c +++ b/libc/stdio/lib_puts.c @@ -42,7 +42,7 @@ ****************************************************************************/ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_rawinstream.c b/libc/stdio/lib_rawinstream.c index 19a980787d8..913a413bff4 100644 --- a/libc/stdio/lib_rawinstream.c +++ b/libc/stdio/lib_rawinstream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_rawoutstream.c b/libc/stdio/lib_rawoutstream.c index 7f2c5224746..aed1fc5272e 100644 --- a/libc/stdio/lib_rawoutstream.c +++ b/libc/stdio/lib_rawoutstream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_rawsistream.c b/libc/stdio/lib_rawsistream.c index b013e43a80f..d52fad1daf6 100644 --- a/libc/stdio/lib_rawsistream.c +++ b/libc/stdio/lib_rawsistream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_rawsostream.c b/libc/stdio/lib_rawsostream.c index 82db850f787..3c0b96dfa8d 100644 --- a/libc/stdio/lib_rawsostream.c +++ b/libc/stdio/lib_rawsostream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_rdflush.c b/libc/stdio/lib_rdflush.c index 65d37ac3568..27bd25f6fd1 100644 --- a/libc/stdio/lib_rdflush.c +++ b/libc/stdio/lib_rdflush.c @@ -48,7 +48,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_snprintf.c b/libc/stdio/lib_snprintf.c index 63d0b2a5dfd..ca27bb0b467 100644 --- a/libc/stdio/lib_snprintf.c +++ b/libc/stdio/lib_snprintf.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -80,7 +80,7 @@ * sprintf ****************************************************************************/ -int snprintf(FAR char *buf, size_t size, const char *format, ...) +int snprintf(FAR char *buf, size_t size, FAR const IPTR char *format, ...) { union { diff --git a/libc/stdio/lib_sprintf.c b/libc/stdio/lib_sprintf.c index a0b3321bb1b..e857c79cab7 100644 --- a/libc/stdio/lib_sprintf.c +++ b/libc/stdio/lib_sprintf.c @@ -38,7 +38,7 @@ ****************************************************************************/ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -76,7 +76,7 @@ * sprintf ****************************************************************************/ -int sprintf (FAR char *buf, const char *fmt, ...) +int sprintf (FAR char *buf, FAR const IPTR char *fmt, ...) { struct lib_memoutstream_s memoutstream; va_list ap; diff --git a/libc/stdio/lib_stdinstream.c b/libc/stdio/lib_stdinstream.c index 240763613fc..f1b5f3da998 100644 --- a/libc/stdio/lib_stdinstream.c +++ b/libc/stdio/lib_stdinstream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_stdoutstream.c b/libc/stdio/lib_stdoutstream.c index 73321c7fdb3..b30e8151608 100644 --- a/libc/stdio/lib_stdoutstream.c +++ b/libc/stdio/lib_stdoutstream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_stdsistream.c b/libc/stdio/lib_stdsistream.c index 0999f851324..b569bb41222 100644 --- a/libc/stdio/lib_stdsistream.c +++ b/libc/stdio/lib_stdsistream.c @@ -39,7 +39,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_stdsostream.c b/libc/stdio/lib_stdsostream.c index ade6369c51c..4e196b1a22b 100644 --- a/libc/stdio/lib_stdsostream.c +++ b/libc/stdio/lib_stdsostream.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdio/lib_ungetc.c b/libc/stdio/lib_ungetc.c index c8baf9a2660..4ae4bc69b12 100644 --- a/libc/stdio/lib_ungetc.c +++ b/libc/stdio/lib_ungetc.c @@ -46,7 +46,7 @@ #include #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_vasprintf.c b/libc/stdio/lib_vasprintf.c index f7b24027123..e74cce46cc1 100644 --- a/libc/stdio/lib_vasprintf.c +++ b/libc/stdio/lib_vasprintf.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -112,7 +112,7 @@ * ****************************************************************************/ -int vasprintf(FAR char **ptr, FAR const char *fmt, va_list ap) +int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap) { struct lib_outstream_s nulloutstream; struct lib_memoutstream_s memoutstream; diff --git a/libc/stdio/lib_vdprintf.c b/libc/stdio/lib_vdprintf.c index d96ca40f88f..9c76078d6eb 100644 --- a/libc/stdio/lib_vdprintf.c +++ b/libc/stdio/lib_vdprintf.c @@ -42,13 +42,13 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions ****************************************************************************/ -int vdprintf(int fd, FAR const char *fmt, va_list ap) +int vdprintf(int fd, FAR const IPTR char *fmt, va_list ap) { struct lib_rawoutstream_s rawoutstream; diff --git a/libc/stdio/lib_vfprintf.c b/libc/stdio/lib_vfprintf.c index 8681b2151d1..783dc8b916a 100644 --- a/libc/stdio/lib_vfprintf.c +++ b/libc/stdio/lib_vfprintf.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -76,7 +76,7 @@ * Public Functions ****************************************************************************/ -int vfprintf(FAR FILE *stream, FAR const char *fmt, va_list ap) +int vfprintf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap) { struct lib_stdoutstream_s stdoutstream; int n = ERROR; diff --git a/libc/stdio/lib_vprintf.c b/libc/stdio/lib_vprintf.c index 52e6fc91074..ee9a227c019 100644 --- a/libc/stdio/lib_vprintf.c +++ b/libc/stdio/lib_vprintf.c @@ -83,7 +83,7 @@ * Name: vprintf ****************************************************************************/ -int vprintf(FAR const char *fmt, va_list ap) +int vprintf(FAR const IPTR char *fmt, va_list ap) { /* vfprintf into stdout */ diff --git a/libc/stdio/lib_vsnprintf.c b/libc/stdio/lib_vsnprintf.c index 5fd300f7fe3..6952ed5ad6e 100644 --- a/libc/stdio/lib_vsnprintf.c +++ b/libc/stdio/lib_vsnprintf.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -80,7 +80,8 @@ * Name: vsnprintf ****************************************************************************/ -int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap) +int vsnprintf(FAR char *buf, size_t size, FAR const IPTR char *format, + va_list ap) { struct lib_memoutstream_s memoutstream; int n; diff --git a/libc/stdio/lib_vsprintf.c b/libc/stdio/lib_vsprintf.c index 57589cef565..f919de08877 100644 --- a/libc/stdio/lib_vsprintf.c +++ b/libc/stdio/lib_vsprintf.c @@ -41,7 +41,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions @@ -79,7 +79,7 @@ * Name: vsprintf ****************************************************************************/ -int vsprintf(FAR char *dest, const char *src, va_list ap) +int vsprintf(FAR char *dest, FAR const IPTR char *src, va_list ap) { struct lib_memoutstream_s memoutstream; diff --git a/libc/stdio/lib_wrflush.c b/libc/stdio/lib_wrflush.c index 0587e417ebc..0ccd007c6b5 100644 --- a/libc/stdio/lib_wrflush.c +++ b/libc/stdio/lib_wrflush.c @@ -43,7 +43,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libc/stdio/lib_zeroinstream.c b/libc/stdio/lib_zeroinstream.c index a52ecc1d069..506d0058717 100644 --- a/libc/stdio/lib_zeroinstream.c +++ b/libc/stdio/lib_zeroinstream.c @@ -39,7 +39,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdlib/lib_checkbase.c b/libc/stdlib/lib_checkbase.c index 83199bcfaed..05abe7b8968 100644 --- a/libc/stdlib/lib_checkbase.c +++ b/libc/stdlib/lib_checkbase.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdlib/lib_strtol.c b/libc/stdlib/lib_strtol.c index 55181729491..8c7f639901c 100644 --- a/libc/stdlib/lib_strtol.c +++ b/libc/stdlib/lib_strtol.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdlib/lib_strtoll.c b/libc/stdlib/lib_strtoll.c index 7ed5ecab20b..bc8cc2eb6f4 100644 --- a/libc/stdlib/lib_strtoll.c +++ b/libc/stdlib/lib_strtoll.c @@ -42,7 +42,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_HAVE_LONG_LONG diff --git a/libc/stdlib/lib_strtoul.c b/libc/stdlib/lib_strtoul.c index 712a658e267..3dfe5a5e60b 100644 --- a/libc/stdlib/lib_strtoul.c +++ b/libc/stdlib/lib_strtoul.c @@ -41,7 +41,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/stdlib/lib_strtoull.c b/libc/stdlib/lib_strtoull.c index 169058128ab..82adc0450ac 100644 --- a/libc/stdlib/lib_strtoull.c +++ b/libc/stdlib/lib_strtoull.c @@ -42,7 +42,7 @@ #include -#include "lib_internal.h" +#include "libc.h" #ifdef CONFIG_HAVE_LONG_LONG diff --git a/libc/string/lib_isbasedigit.c b/libc/string/lib_isbasedigit.c index dff81388113..e72e33de5cf 100644 --- a/libc/string/lib_isbasedigit.c +++ b/libc/string/lib_isbasedigit.c @@ -43,7 +43,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/string/lib_skipspace.c b/libc/string/lib_skipspace.c index 4b72b1ec378..602c03a2742 100644 --- a/libc/string/lib_skipspace.c +++ b/libc/string/lib_skipspace.c @@ -41,7 +41,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Private Functions diff --git a/libc/string/lib_strdup.c b/libc/string/lib_strdup.c index ab5c620a121..4da233d1637 100644 --- a/libc/string/lib_strdup.c +++ b/libc/string/lib_strdup.c @@ -41,7 +41,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/string/lib_strndup.c b/libc/string/lib_strndup.c index 984b363944f..1c097de81a0 100644 --- a/libc/string/lib_strndup.c +++ b/libc/string/lib_strndup.c @@ -41,7 +41,7 @@ #include -#include "lib_internal.h" +#include "libc.h" /**************************************************************************** * Public Functions diff --git a/libc/syslog/lib_lowsyslog.c b/libc/syslog/lib_lowsyslog.c index 7cbc59180bf..1ea85407811 100644 --- a/libc/syslog/lib_lowsyslog.c +++ b/libc/syslog/lib_lowsyslog.c @@ -93,7 +93,7 @@ * ****************************************************************************/ -static inline int lowvsyslog_internal(FAR const char *fmt, va_list ap) +static inline int lowvsyslog_internal(FAR const IPTR char *fmt, va_list ap) { struct lib_outstream_s stream; @@ -121,7 +121,7 @@ static inline int lowvsyslog_internal(FAR const char *fmt, va_list ap) * ****************************************************************************/ -int lowvsyslog(int priority, FAR const char *fmt, va_list ap) +int lowvsyslog(int priority, FAR const IPTR char *fmt, va_list ap) { int ret = 0; @@ -154,7 +154,7 @@ int lowvsyslog(int priority, FAR const char *fmt, va_list ap) * ****************************************************************************/ -int lowsyslog(int priority, FAR const char *fmt, ...) +int lowsyslog(int priority, FAR const IPTR char *fmt, ...) { va_list ap; int ret; diff --git a/libc/syslog/lib_syslog.c b/libc/syslog/lib_syslog.c index 533f61bec5b..ca9ee014fc9 100644 --- a/libc/syslog/lib_syslog.c +++ b/libc/syslog/lib_syslog.c @@ -92,7 +92,7 @@ * ****************************************************************************/ -static inline int vsyslog_internal(FAR const char *fmt, va_list ap) +static inline int vsyslog_internal(FAR const IPTR char *fmt, va_list ap) { #if defined(CONFIG_SYSLOG) struct lib_outstream_s stream; @@ -190,7 +190,7 @@ static inline int vsyslog_internal(FAR const char *fmt, va_list ap) * ****************************************************************************/ -int vsyslog(int priority, FAR const char *fmt, va_list ap) +int vsyslog(int priority, FAR const IPTR char *fmt, va_list ap) { int ret = 0; @@ -220,7 +220,7 @@ int vsyslog(int priority, FAR const char *fmt, va_list ap) * ****************************************************************************/ -int syslog(int priority, FAR const char *fmt, ...) +int syslog(int priority, FAR const IPTR char *fmt, ...) { va_list ap; int ret; diff --git a/libc/time/lib_strftime.c b/libc/time/lib_strftime.c index fafdedc6b47..6af92202976 100644 --- a/libc/time/lib_strftime.c +++ b/libc/time/lib_strftime.c @@ -70,7 +70,7 @@ * Private Data ****************************************************************************/ -#ifdef CONFIG_TIME_EXTENDED +#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED) static const char * const g_abbrev_wdayname[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" diff --git a/libc/unistd/lib_chdir.c b/libc/unistd/lib_chdir.c index 87353b546d4..4780a6b72e9 100644 --- a/libc/unistd/lib_chdir.c +++ b/libc/unistd/lib_chdir.c @@ -45,7 +45,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) diff --git a/libc/unistd/lib_getcwd.c b/libc/unistd/lib_getcwd.c index 9a25399996c..851d380fb6c 100644 --- a/libc/unistd/lib_getcwd.c +++ b/libc/unistd/lib_getcwd.c @@ -45,7 +45,7 @@ #include #include -#include "lib_internal.h" +#include "libc.h" #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) diff --git a/libnx/nxfonts/nxfonts_internal.h b/libnx/nxfonts/nxfonts.h similarity index 94% rename from libnx/nxfonts/nxfonts_internal.h rename to libnx/nxfonts/nxfonts.h index 7fccd5ab4e1..1e3fa18bb3f 100644 --- a/libnx/nxfonts/nxfonts_internal.h +++ b/libnx/nxfonts/nxfonts.h @@ -1,5 +1,5 @@ /**************************************************************************** - * libnx/nxfonts/nxfonts_internal.h + * libnx/nxfonts/nxfonts.h * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __LIBNX_NXFONTS_NXFONTS_INTERNAL_H -#define __LIBNX_NXFONTS_NXFONTS_INTERNAL_H +#ifndef __LIBNX_NXFONTS_NXFONTS_H +#define __LIBNX_NXFONTS_NXFONTS_H /**************************************************************************** * Included Files @@ -85,4 +85,4 @@ EXTERN struct nx_font_s g_fonts; } #endif -#endif /* __LIBNX_NXFONTS_NXFONTS_INTERNAL_H */ +#endif /* __LIBNX_NXFONTS_NXFONTS_H */ diff --git a/libnx/nxfonts/nxfonts_bitmaps.c b/libnx/nxfonts/nxfonts_bitmaps.c index 0a71faacfed..28e6aa18dcc 100644 --- a/libnx/nxfonts/nxfonts_bitmaps.c +++ b/libnx/nxfonts/nxfonts_bitmaps.c @@ -42,7 +42,7 @@ #include #include -#include "nxfonts_internal.h" +#include "nxfonts.h" /* Pick the fontset */ diff --git a/libnx/nxfonts/nxfonts_convert.c b/libnx/nxfonts/nxfonts_convert.c index a223c7f0a99..6d3b5a71e2c 100644 --- a/libnx/nxfonts/nxfonts_convert.c +++ b/libnx/nxfonts/nxfonts_convert.c @@ -46,7 +46,7 @@ #include #include -#include "nxfonts_internal.h" +#include "nxfonts.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxfonts/nxfonts_getfont.c b/libnx/nxfonts/nxfonts_getfont.c index fe443138df1..c52c082281c 100644 --- a/libnx/nxfonts/nxfonts_getfont.c +++ b/libnx/nxfonts/nxfonts_getfont.c @@ -46,7 +46,7 @@ #include #include -#include "nxfonts_internal.h" +#include "nxfonts.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_internal.h b/libnx/nxtk/nxtk.h similarity index 98% rename from libnx/nxtk/nxtk_internal.h rename to libnx/nxtk/nxtk.h index 7a62293413b..44d507ee015 100644 --- a/libnx/nxtk/nxtk_internal.h +++ b/libnx/nxtk/nxtk.h @@ -1,5 +1,5 @@ /**************************************************************************** - * libnx/nxtk/nxtk_internal.h + * libnx/nxtk/nxtk.h * * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __LIBNX_NXTK_NXTK_INTERNAL_H -#define __LIBNX_NXTK_NXTK_INTERNAL_H +#ifndef __LIBNX_NXTK_NXTK_H +#define __LIBNX_NXTK_NXTK_H /**************************************************************************** * Included Files @@ -222,4 +222,4 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, } #endif -#endif /* __LIBNX_NXTK_NXTK_INTERNAL_H */ +#endif /* __LIBNX_NXTK_NXTK_H */ diff --git a/libnx/nxtk/nxtk_bitmaptoolbar.c b/libnx/nxtk/nxtk_bitmaptoolbar.c index abeb14d184f..abc1815b8f7 100644 --- a/libnx/nxtk/nxtk_bitmaptoolbar.c +++ b/libnx/nxtk/nxtk_bitmaptoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_bitmapwindow.c b/libnx/nxtk/nxtk_bitmapwindow.c index da814fe10ae..59a8776b626 100644 --- a/libnx/nxtk/nxtk_bitmapwindow.c +++ b/libnx/nxtk/nxtk_bitmapwindow.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_closetoolbar.c b/libnx/nxtk/nxtk_closetoolbar.c index 8f65a75a841..7be217d18de 100644 --- a/libnx/nxtk/nxtk_closetoolbar.c +++ b/libnx/nxtk/nxtk_closetoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_closewindow.c b/libnx/nxtk/nxtk_closewindow.c index 7bda3ff06b8..54857521305 100644 --- a/libnx/nxtk/nxtk_closewindow.c +++ b/libnx/nxtk/nxtk_closewindow.c @@ -47,7 +47,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_containerclip.c b/libnx/nxtk/nxtk_containerclip.c index 12dc4987b3f..67ed6cb17b1 100644 --- a/libnx/nxtk/nxtk_containerclip.c +++ b/libnx/nxtk/nxtk_containerclip.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_drawframe.c b/libnx/nxtk/nxtk_drawframe.c index ae0be64425f..adafccc5744 100644 --- a/libnx/nxtk/nxtk_drawframe.c +++ b/libnx/nxtk/nxtk_drawframe.c @@ -47,7 +47,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_events.c b/libnx/nxtk/nxtk_events.c index 33d496e19a5..d7f33e6ebed 100644 --- a/libnx/nxtk/nxtk_events.c +++ b/libnx/nxtk/nxtk_events.c @@ -48,7 +48,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libnx/nxtk/nxtk_filltoolbar.c b/libnx/nxtk/nxtk_filltoolbar.c index 13de3724982..0d62eaaf84e 100644 --- a/libnx/nxtk/nxtk_filltoolbar.c +++ b/libnx/nxtk/nxtk_filltoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_filltraptoolbar.c b/libnx/nxtk/nxtk_filltraptoolbar.c index a55d05e7e97..1b7ae272770 100644 --- a/libnx/nxtk/nxtk_filltraptoolbar.c +++ b/libnx/nxtk/nxtk_filltraptoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_filltrapwindow.c b/libnx/nxtk/nxtk_filltrapwindow.c index 66aef4184f1..bbfba26599e 100644 --- a/libnx/nxtk/nxtk_filltrapwindow.c +++ b/libnx/nxtk/nxtk_filltrapwindow.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_fillwindow.c b/libnx/nxtk/nxtk_fillwindow.c index 77f043391c8..fa0fd8d8f24 100644 --- a/libnx/nxtk/nxtk_fillwindow.c +++ b/libnx/nxtk/nxtk_fillwindow.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_getposition.c b/libnx/nxtk/nxtk_getposition.c index a0b21bedba6..1f0bdceeef7 100644 --- a/libnx/nxtk/nxtk_getposition.c +++ b/libnx/nxtk/nxtk_getposition.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_gettoolbar.c b/libnx/nxtk/nxtk_gettoolbar.c index a83a1aa3e62..593fcb09a63 100644 --- a/libnx/nxtk/nxtk_gettoolbar.c +++ b/libnx/nxtk/nxtk_gettoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_getwindow.c b/libnx/nxtk/nxtk_getwindow.c index a91ad05fc6b..b2294599737 100644 --- a/libnx/nxtk/nxtk_getwindow.c +++ b/libnx/nxtk/nxtk_getwindow.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_lower.c b/libnx/nxtk/nxtk_lower.c index de26ac509b6..08a588897d9 100644 --- a/libnx/nxtk/nxtk_lower.c +++ b/libnx/nxtk/nxtk_lower.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_movetoolbar.c b/libnx/nxtk/nxtk_movetoolbar.c index 275bb46e660..62d14e7bf85 100644 --- a/libnx/nxtk/nxtk_movetoolbar.c +++ b/libnx/nxtk/nxtk_movetoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_movewindow.c b/libnx/nxtk/nxtk_movewindow.c index 66aed9d16a7..2b34f44a8b6 100644 --- a/libnx/nxtk/nxtk_movewindow.c +++ b/libnx/nxtk/nxtk_movewindow.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_opentoolbar.c b/libnx/nxtk/nxtk_opentoolbar.c index ffdf629013f..26aa4c504f7 100644 --- a/libnx/nxtk/nxtk_opentoolbar.c +++ b/libnx/nxtk/nxtk_opentoolbar.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_openwindow.c b/libnx/nxtk/nxtk_openwindow.c index c7c050b8dad..796a57d3b70 100644 --- a/libnx/nxtk/nxtk_openwindow.c +++ b/libnx/nxtk/nxtk_openwindow.c @@ -46,7 +46,7 @@ #include #include "nxcontext.h" -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_raise.c b/libnx/nxtk/nxtk_raise.c index 2b54f81cb6f..d0273fe7048 100644 --- a/libnx/nxtk/nxtk_raise.c +++ b/libnx/nxtk/nxtk_raise.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_setposition.c b/libnx/nxtk/nxtk_setposition.c index f3ba1187269..ed856252720 100644 --- a/libnx/nxtk/nxtk_setposition.c +++ b/libnx/nxtk/nxtk_setposition.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_setsize.c b/libnx/nxtk/nxtk_setsize.c index 671aa805406..8848c717200 100644 --- a/libnx/nxtk/nxtk_setsize.c +++ b/libnx/nxtk/nxtk_setsize.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_setsubwindows.c b/libnx/nxtk/nxtk_setsubwindows.c index 5ebd5f2be74..943825a8b01 100644 --- a/libnx/nxtk/nxtk_setsubwindows.c +++ b/libnx/nxtk/nxtk_setsubwindows.c @@ -45,7 +45,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-processor Definitions diff --git a/libnx/nxtk/nxtk_subwindowclip.c b/libnx/nxtk/nxtk_subwindowclip.c index b2688a543d2..b1b4024ee7e 100644 --- a/libnx/nxtk/nxtk_subwindowclip.c +++ b/libnx/nxtk/nxtk_subwindowclip.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_subwindowmove.c b/libnx/nxtk/nxtk_subwindowmove.c index 6ae737b5804..6b80609d3da 100644 --- a/libnx/nxtk/nxtk_subwindowmove.c +++ b/libnx/nxtk/nxtk_subwindowmove.c @@ -46,7 +46,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libnx/nxtk/nxtk_toolbarbounds.c b/libnx/nxtk/nxtk_toolbarbounds.c index 6303b4d20de..eacaf905731 100644 --- a/libnx/nxtk/nxtk_toolbarbounds.c +++ b/libnx/nxtk/nxtk_toolbarbounds.c @@ -45,7 +45,7 @@ #include #include -#include "nxtk_internal.h" +#include "nxtk.h" /**************************************************************************** * Pre-Processor Definitions diff --git a/libxx/libxx_internal.hxx b/libxx/libxx.hxx similarity index 96% rename from libxx/libxx_internal.hxx rename to libxx/libxx.hxx index 6669e90052d..f8c1eada4a9 100644 --- a/libxx/libxx_internal.hxx +++ b/libxx/libxx.hxx @@ -1,5 +1,5 @@ //*************************************************************************** -// lib/libxx_internal.h +// lib/libxx.hxx // // Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. // Author: Gregory Nutt @@ -33,8 +33,8 @@ // //*************************************************************************** -#ifndef __LIBXX_LIBXX_INTERNAL_HXX -#define __LIBXX_LIBXX_INTERNAL_HXX +#ifndef __LIBXX_LIBXX_HXX +#define __LIBXX_LIBXX__HXX //*************************************************************************** // Included Files @@ -85,4 +85,4 @@ extern "C" FAR void *__dso_handle; extern "C" int __cxa_atexit(__cxa_exitfunc_t func, void *arg, void *dso_handle); -#endif // __LIBXX_LIBXX_INTERNAL_HXX +#endif // __LIBXX_LIBXX_HXX diff --git a/libxx/libxx_cxa_atexit.cxx b/libxx/libxx_cxa_atexit.cxx index 5e01f99f278..cb60e1c7e2d 100644 --- a/libxx/libxx_cxa_atexit.cxx +++ b/libxx/libxx_cxa_atexit.cxx @@ -41,7 +41,7 @@ #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/libxx/libxx_delete.cxx b/libxx/libxx_delete.cxx index 9eb46a0100f..dec28a85c24 100644 --- a/libxx/libxx_delete.cxx +++ b/libxx/libxx_delete.cxx @@ -39,7 +39,7 @@ #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/libxx/libxx_deletea.cxx b/libxx/libxx_deletea.cxx index c99c18dfde2..174049efc2f 100644 --- a/libxx/libxx_deletea.cxx +++ b/libxx/libxx_deletea.cxx @@ -39,7 +39,7 @@ #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/libxx/libxx_eabi_atexit.cxx b/libxx/libxx_eabi_atexit.cxx index 25f8306a847..eea296c696d 100644 --- a/libxx/libxx_eabi_atexit.cxx +++ b/libxx/libxx_eabi_atexit.cxx @@ -40,7 +40,7 @@ #include #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/libxx/libxx_new.cxx b/libxx/libxx_new.cxx index 710528abe35..a4575519ab4 100644 --- a/libxx/libxx_new.cxx +++ b/libxx/libxx_new.cxx @@ -41,7 +41,7 @@ #include #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/libxx/libxx_newa.cxx b/libxx/libxx_newa.cxx index 8d42c628c79..c1e4dfa95d9 100644 --- a/libxx/libxx_newa.cxx +++ b/libxx/libxx_newa.cxx @@ -41,7 +41,7 @@ #include #include -#include "libxx_internal.hxx" +#include "libxx.hxx" //*************************************************************************** // Pre-processor Definitions diff --git a/mm/README.txt b/mm/README.txt index 0e9a4e7d228..f33cf49c80e 100644 --- a/mm/README.txt +++ b/mm/README.txt @@ -15,7 +15,7 @@ This directory contains the NuttX memory management logic. This include: mm_memalign.c, mm_free.c o Less-Standard Interfaces: mm_zalloc.c, mm_mallinfo.c o Internal Implementation: mm_initialize.c mm_sem.c mm_addfreechunk.c - mm_size2ndx.c mm_shrinkchunk.c, mm_internal.h + mm_size2ndx.c mm_shrinkchunk.c o Build and Configuration files: Kconfig, Makefile Memory Models: diff --git a/sched/Kconfig b/sched/Kconfig index 5aefa848c00..d1e72a30e86 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -775,6 +775,18 @@ config SCHED_ONEXIT_MAX endmenu # RTOS hooks +config SIG_EVTHREAD + bool "Support SIGEV_THHREAD" + default n + depends on BUILD_FLAT && SCHED_WORKQUEUE + ---help--- + Built in support for the SIGEV_THREAD signal deliver method. + + NOTE: The current implementation uses a work queue to notify the + client. This, however, would only work in the FLAT build. A + different mechanism would need to be development to support this + feature on the PROTECTED or KERNEL build. + menu "Signal Numbers" depends on !DISABLE_SIGNALS diff --git a/sched/mqueue/mq_desclose.c b/sched/mqueue/mq_desclose.c index ca7bfc5b8a4..812059e0ff4 100644 --- a/sched/mqueue/mq_desclose.c +++ b/sched/mqueue/mq_desclose.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/mqueue/mq_desclose.c * - * Copyright (C) 2007, 2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -128,9 +129,8 @@ void mq_desclose(mqd_t mqdes) #ifndef CONFIG_DISABLE_SIGNALS if (msgq->ntmqdes == mqdes) { + memset(&msgq->ntevent, 0, sizeof(struct sigevent)); msgq->ntpid = INVALID_PROCESS_ID; - msgq->ntsigno = 0; - msgq->ntvalue.sival_int = 0; msgq->ntmqdes = NULL; } #endif diff --git a/sched/mqueue/mq_notify.c b/sched/mqueue/mq_notify.c index c9836715fe7..cb7a3aaffc5 100644 --- a/sched/mqueue/mq_notify.c +++ b/sched/mqueue/mq_notify.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/mqueue/mq_notify.c * - * Copyright (C) 2007, 2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,7 @@ * Parameters: * mqdes - Message queue descriptor * notification - Real-time signal structure containing: - * sigev_notify - Should be SIGEV_SIGNAL (but actually ignored) + * sigev_notify - Should be SIGEV_SIGNAL or SIGEV_THREAD * sigev_signo - The signo to use for the notification * sigev_value - Value associated with the signal * @@ -171,10 +172,11 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification) /* Yes... Assign it to the current task. */ - msgq->ntvalue.sival_ptr = notification->sigev_value.sival_ptr; - msgq->ntsigno = notification->sigev_signo; - msgq->ntpid = rtcb->pid; - msgq->ntmqdes = mqdes; + memcpy(&msgq->ntevent, ¬ification->sigev_value, + sizeof(struct sigevent)); + + msgq->ntpid = rtcb->pid; + msgq->ntmqdes = mqdes; } } @@ -197,10 +199,9 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification) * thread to detach the notification. */ - msgq->ntpid = INVALID_PROCESS_ID; - msgq->ntsigno = 0; - msgq->ntvalue.sival_ptr = NULL; - msgq->ntmqdes = NULL; + memset(&msgq->ntevent, 0, sizeof(struct sigevent)); + msgq->ntpid = INVALID_PROCESS_ID; + msgq->ntmqdes = NULL; } sched_unlock(); diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index f2a312f8ef8..b6580d25bb1 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/mqueue/mq_send.c * - * Copyright (C) 2007, 2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,6 +51,8 @@ #include #include #include +#include + #include "sched/sched.h" #ifndef CONFIG_DISABLE_SIGNALS # include "signal/signal.h" @@ -384,30 +386,44 @@ int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg, #ifndef CONFIG_DISABLE_SIGNALS if (msgq->ntmqdes) { + struct sigevent event; + pid_t pid; + /* Remove the message notification data from the message queue. */ -#ifdef CONFIG_CAN_PASS_STRUCTS - union sigval value = msgq->ntvalue; -#else - void *sival_ptr = msgq->ntvalue.sival_ptr; -#endif - int signo = msgq->ntsigno; - int pid = msgq->ntpid; + memcpy(&event, &msgq->ntevent, sizeof(struct sigevent)); + pid = msgq->ntpid; /* Detach the notification */ - msgq->ntpid = INVALID_PROCESS_ID; - msgq->ntsigno = 0; - msgq->ntvalue.sival_int = 0; - msgq->ntmqdes = NULL; + memset(&msgq->ntevent, 0, sizeof(struct sigevent)); + msgq->ntpid = INVALID_PROCESS_ID; + msgq->ntmqdes = NULL; - /* Queue the signal -- What if this returns an error? */ + /* Notification the client via signal? */ + + if (event.sigev_notify == SIGEV_SIGNAL) + { + /* Yes... Queue the signal -- What if this returns an error? */ #ifdef CONFIG_CAN_PASS_STRUCTS - sig_mqnotempty(pid, signo, value); + DEBUGVERIFY(sig_mqnotempty(pid, event.sigev_signo, + event.sigev_value)); #else - sig_mqnotempty(pid, signo, sival_ptr); + DEBUGVERIFY(sig_mqnotempty(pid, event.sigev_signo, + event.sigev_value.sival_ptr)); #endif + } + +#ifdef CONFIG_SIG_EVTHREAD + /* Notify the client via a function call */ + + else if (event.sigev_notify == SIGEV_THREAD) + { + DEBUGVERIFY(sig_notification(pid, &event)); + } +#endif + } #endif diff --git a/sched/signal/Make.defs b/sched/signal/Make.defs index 8521b644aa6..9d6ddda3a67 100644 --- a/sched/signal/Make.defs +++ b/sched/signal/Make.defs @@ -44,6 +44,10 @@ CSRCS += sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c CSRCS += sig_mqnotempty.c sig_cleanup.c sig_dispatch.c sig_deliver.c CSRCS += sig_pause.c sig_nanosleep.c +ifeq ($(CONFIG_SIG_EVTHREAD),y) +CSRCS += sig_notification.c +endif + # Include signal build support DEPPATH += --dep-path signal diff --git a/sched/signal/sig_notification.c b/sched/signal/sig_notification.c new file mode 100644 index 00000000000..f9a0710fbea --- /dev/null +++ b/sched/signal/sig_notification.c @@ -0,0 +1,172 @@ +/**************************************************************************** + * sched/signal/sig_notification.c + * + * Copyright (C) 2015 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 +#include +#include +#include + +#include +#include + +#ifdef CONFIG_SIG_EVTHREAD + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Use the low-prioriry work queue is it is available */ + +#if defined(CONFIG_SCHED_LPWORK) +# define NTWORK LPWORK +#elif defined(CONFIG_SCHED_HPWORK) +# define NTWORK HPWORK +#else +# error Work queue is not enabled +#endif + +/**************************************************************************** + * Private Type Definitions + ****************************************************************************/ + +/* This structure retains all that is necessary to perform the notification */ + +struct sig_notify_s +{ + struct work_s nt_work; /* Work queue structure */ + union sigval nt_value; /* Data passed with notification */ + sigev_notify_function_t nt_func; /* Notification function */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sig_ntworker + * + * Description: + * Perform the callback from the context of the worker thread. + * + * Input Parameters: + * arg - Work argument. + * + * Returned Value: + * None. + * + ****************************************************************************/ + +static void sig_ntworker(FAR void *arg) +{ + FAR struct sig_notify_s *notify = (FAR struct sig_notify_s *)arg; + + DEBUGASSERT(notify != NULL); + + /* Perform the callback */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + notify->nt_func(notify->nt_value); +#else + notify->nt_func(notify->nt_value.sival_ptr); +#endif + + /* Free the alloated notification parameters */ + + kmm_free(notify); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sig_notification + * + * Description: + * Notify a client a signal event via a function call. This function is + * an internal OS interface that implements the common logic for signal + * event notification for the case of SIGEV_THREAD. + * + * Input Parameters: + * pid - The task/thread ID a the client thread to be signaled. + * event - The instance of struct sigevent that describes how to signal + * the client. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * on failure. + * + ****************************************************************************/ + +int sig_notification(pid_t pid, FAR struct sigevent *event) +{ + FAR struct sig_notify_s *notify; + DEBUGASSERT(event != NULL && event->sigev_notify_function != NULL); + int ret; + + /* Allocate a structure to hold the notification information */ + + notify = kmm_zalloc(sizeof(struct sig_notify_s)); + if (notify == NULL) + { + return -ENOMEM; + } + + /* Initialize the notification information */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + notify->nt_value = event->sigev_value; +#else + notify->nt_value.sival_ptr = event->sigev_value.sival_ptr; +#endif + notify->nt_func = event->sigev_notify_function; + + /* Then queue the work */ + + ret = work_queue(NTWORK, ¬ify->nt_work, sig_ntworker, notify, 0); + if (ret < 0) + { + kmm_free(notify); + } + + return ret; +} + +#endif /* CONFIG_SIG_EVTHREAD */ diff --git a/sched/timer/timer.h b/sched/timer/timer.h index 1f139a1f426..6165d9e847b 100644 --- a/sched/timer/timer.h +++ b/sched/timer/timer.h @@ -1,7 +1,7 @@ /******************************************************************************** * sched/timer/timer.h * - * Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -67,12 +67,11 @@ struct posix_timer_s uint8_t pt_flags; /* See PT_FLAGS_* definitions */ uint8_t pt_crefs; /* Reference count */ - uint8_t pt_signo; /* Notification signal */ pid_t pt_owner; /* Creator of timer */ int pt_delay; /* If non-zero, used to reset repetitive timers */ int pt_last; /* Last value used to set watchdog */ WDOG_ID pt_wdog; /* The watchdog that provides the timing */ - union sigval pt_value; /* Data passed with notification */ + struct sigevent pt_event; /* Notification information */ }; /******************************************************************************** diff --git a/sched/timer/timer_create.c b/sched/timer/timer_create.c index bf6429e3bcb..0d5ce1b1e14 100644 --- a/sched/timer/timer_create.c +++ b/sched/timer/timer_create.c @@ -1,7 +1,7 @@ /******************************************************************************** * sched/timer/timer_create.c * - * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -215,17 +215,11 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer if (evp) { - ret->pt_signo = evp->sigev_signo; -#ifdef CONFIG_CAN_PASS_STRUCTS - ret->pt_value = evp->sigev_value; -#else - ret->pt_value.sival_ptr = evp->sigev_value.sival_ptr; -#endif + memcpy(&ret->pt_event, evp, sizeof(struct sigevent)); } else { - ret->pt_signo = SIGALRM; - ret->pt_value.sival_ptr = ret; + memset(&ret->pt_event, 0, sizeof(struct sigevent)); } /* Return the timer */ diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index 4df42217eeb..de8eda47e8a 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -44,6 +44,8 @@ #include #include +#include + #include "clock/clock.h" #include "signal/signal.h" #include "timer/timer.h" @@ -66,7 +68,7 @@ * Private Function Prototypes ********************************************************************************/ -static inline void timer_sigqueue(FAR struct posix_timer_s *timer); +static inline void timer_signotify(FAR struct posix_timer_s *timer); static inline void timer_restart(FAR struct posix_timer_s *timer, wdparm_t itimer); static void timer_timeout(int argc, wdparm_t itimer); @@ -75,7 +77,7 @@ static void timer_timeout(int argc, wdparm_t itimer); ********************************************************************************/ /******************************************************************************** - * Name: timer_sigqueue + * Name: timer_signotify * * Description: * This function basically reimplements sigqueue() so that the si_code can @@ -92,28 +94,42 @@ static void timer_timeout(int argc, wdparm_t itimer); * ********************************************************************************/ -static inline void timer_sigqueue(FAR struct posix_timer_s *timer) +static inline void timer_signotify(FAR struct posix_timer_s *timer) { siginfo_t info; - /* Create the siginfo structure */ + /* Notify client via a signal? */ - info.si_signo = timer->pt_signo; - info.si_code = SI_TIMER; - info.si_errno = OK; + if (timer->pt_event.sigev_notify == SIGEV_SIGNAL) + { + /* Yes.. Create the siginfo structure */ + + info.si_signo = timer->pt_event.sigev_signo; + info.si_code = SI_TIMER; + info.si_errno = OK; #ifdef CONFIG_CAN_PASS_STRUCTS - info.si_value = timer->pt_value; + info.si_value = timer->pt_event.sigev_value; #else - info.si_value.sival_ptr = timer->pt_value.sival_ptr; + info.si_value.sival_ptr = timer->pt_event.sigev_value.sival_ptr; #endif #ifdef CONFIG_SCHED_HAVE_PARENT - info.si_pid = 0; /* Not applicable */ - info.si_status = OK; + info.si_pid = 0; /* Not applicable */ + info.si_status = OK; #endif - /* Send the signal */ + /* Send the signal */ - (void)sig_dispatch(timer->pt_owner, &info); + DEBUGVERIFY(sig_dispatch(timer->pt_owner, &info)); + } + +#ifdef CONFIG_SIG_EVTHREAD + /* Notify the client via a function call */ + + else if (timer->pt_event.sigev_notify == SIGEV_THREAD) + { + DEBUGVERIFY(sig_notification(timer->pt_owner, &timer->pt_event)); + } +#endif } /******************************************************************************** @@ -187,7 +203,7 @@ static void timer_timeout(int argc, wdparm_t itimer) */ u.timer->pt_crefs++; - timer_sigqueue(u.timer); + timer_signotify(u.timer); /* Release the reference. timer_release will return nonzero if the timer * was not deleted. @@ -208,7 +224,7 @@ static void timer_timeout(int argc, wdparm_t itimer) */ timer->pt_crefs++; - timer_sigqueue(timer); + timer_signotify(timer); /* Release the reference. timer_release will return nonzero if the timer * was not deleted. diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c index de3b05603eb..f69a4d649c3 100644 --- a/sched/wdog/wd_start.c +++ b/sched/wdog/wd_start.c @@ -225,7 +225,7 @@ static inline void wd_expiration(void) * ****************************************************************************/ -int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) +int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...) { va_list ap; FAR struct wdog_s *curr;