This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a29d9ea9d fsutils/examples: Include unistd.h explicitly
a29d9ea9d is described below

commit a29d9ea9dac3b31f5ad713cbe0394caff7ad1560
Author: Xiang Xiao <[email protected]>
AuthorDate: Sat Feb 4 21:56:06 2023 +0800

    fsutils/examples: Include unistd.h explicitly
    
    to get the prototypes or macros are defined in it
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 canutils/libobd2/obd_sendrequest.c                 |  2 +
 canutils/libobd2/obd_waitresponse.c                | 10 ++--
 examples/abntcodi/abntcodi_main.c                  | 17 +++---
 examples/ajoystick/ajoy_main.c                     |  1 +
 examples/alarm/alarm_main.c                        |  1 +
 examples/apa102/apa102_main.c                      |  6 +-
 examples/apds9960/apds9960_main.c                  |  1 +
 examples/bmi160/sixaxis_main.c                     |  1 +
 examples/bridge/bridge_main.c                      |  1 +
 examples/buttons/buttons_main.c                    |  1 +
 examples/calib_udelay/calib_udelay_main.c          |  1 +
 examples/camera/camera_main.c                      |  1 +
 examples/can/can_main.c                            |  1 +
 examples/chrono/chrono_main.c                      |  1 +
 examples/djoystick/djoy_main.c                     |  1 +
 examples/esp32_himem/esp32_himem_main.c            |  2 +
 examples/fboverlay/fboverlay_main.c                |  2 +
 examples/foc/foc_device.c                          |  1 +
 examples/foc/foc_fixed16_thr.c                     |  1 +
 examples/foc/foc_float_thr.c                       |  1 +
 examples/foc/foc_intf.c                            |  1 +
 examples/ft80x/ft80x_coprocessor.c                 |  1 +
 examples/fxos8700cq_test/fxos8700cq_main.c         |  4 +-
 examples/gpio/gpio_main.c                          |  1 +
 examples/gps/gps_main.c                            |  1 +
 examples/hdc1008_demo/hdc1008_main.c               |  1 +
 examples/i2schar/i2schar_receiver.c                |  1 +
 examples/i2schar/i2schar_transmitter.c             |  1 +
 examples/i2sloop/i2sloop_main.c                    |  1 +
 examples/ipcfg/ipcfg_main.c                        |  1 +
 examples/isl29023/isl29023_main.c                  |  1 +
 examples/leds/leds_main.c                          |  1 +
 examples/lis3dsh_reader/lis3dsh_reader_main.c      |  2 +-
 examples/lp503x/lp503x_main.c                      |  2 +
 examples/ltr308/ltr308_main.c                      |  1 +
 examples/max31855/max31855_main.c                  |  1 +
 examples/mcuboot/swap_test/set_img_main.c          |  2 +
 examples/media/media_main.c                        |  1 +
 examples/mlx90614/mlx90614_main.c                  |  1 +
 examples/noteprintf/noteprintf_main.c              |  2 +
 examples/nrf24l01_btle/nrf24l01_btle.c             |  2 +
 examples/nrf24l01_term/nrf24l01_term.c             |  1 -
 examples/nunchuck/nunchuck_main.c                  |  1 +
 examples/nxdemo/nxdemo_bkgd.c                      |  1 +
 examples/nxscope/nxscope_main.c                    |  1 +
 examples/oneshot/oneshot_main.c                    |  1 +
 examples/pca9635/pca9635_main.c                    |  1 +
 examples/powermonitor/powermonitor_main.c          |  1 +
 examples/random/random_main.c                      | 12 ++--
 examples/rgbled/rgbled.c                           | 64 ++++++++++----------
 examples/serialrx/serialrx_main.c                  |  2 +
 examples/sht3x/sht3x_main.c                        |  3 +-
 examples/slcd/slcd_main.c                          |  1 +
 examples/stat/stat_main.c                          |  1 +
 examples/sx127x_demo/sx127x_demo.c                 |  1 -
 examples/timer/timer_main.c                        |  2 +
 examples/timer_gpio/timer_gpio_main.c              |  2 +
 examples/udpblaster/udpblaster_target.c            |  1 +
 examples/userfs/userfs_main.c                      |  1 +
 examples/usrsocktest/usrsocktest_basic_connect.c   |  1 +
 .../usrsocktest/usrsocktest_basic_getsockname.c    |  1 +
 .../usrsocktest/usrsocktest_basic_getsockopt.c     |  1 +
 examples/usrsocktest/usrsocktest_basic_send.c      |  1 +
 .../usrsocktest/usrsocktest_basic_setsockopt.c     |  1 +
 examples/usrsocktest/usrsocktest_block_recv.c      |  1 +
 examples/usrsocktest/usrsocktest_block_send.c      |  1 +
 examples/usrsocktest/usrsocktest_chardev.c         |  1 +
 examples/usrsocktest/usrsocktest_daemon.c          |  2 +
 examples/usrsocktest/usrsocktest_multi_thread.c    |  1 +
 examples/usrsocktest/usrsocktest_noblock_connect.c |  2 +
 examples/usrsocktest/usrsocktest_noblock_recv.c    |  1 +
 examples/usrsocktest/usrsocktest_noblock_send.c    |  1 +
 examples/usrsocktest/usrsocktest_nodaemon.c        |  1 +
 examples/usrsocktest/usrsocktest_poll.c            |  1 +
 .../usrsocktest/usrsocktest_remote_disconnect.c    |  1 +
 .../usrsocktest/usrsocktest_wake_with_signal.c     |  1 +
 examples/watched/watched_main.c                    |  2 +
 examples/watcher/task_mn.c                         |  2 +
 examples/watcher/wdt.c                             |  2 +
 examples/zerocross/zerocross_main.c                |  1 +
 fsutils/mkfatfs/mkfatfs.c                          |  1 +
 fsutils/mkfatfs/writefat.c                         |  1 +
 graphics/pdcurs34/nuttx/pdcdisp.c                  |  3 +-
 graphics/pdcurs34/nuttx/pdcscrn.c                  | 68 +++++++++++++---------
 industry/foc/fixed16/foc_ang_hall.c                |  1 +
 industry/foc/fixed16/foc_ang_qenco.c               |  1 +
 industry/foc/fixed16/foc_handler.c                 |  1 +
 industry/foc/float/foc_ang_hall.c                  |  1 +
 industry/foc/float/foc_ang_qenco.c                 |  1 +
 industry/foc/float/foc_handler.c                   |  1 +
 netutils/esp8266/esp8266.c                         |  1 +
 netutils/iperf/iperf.c                             |  2 +
 netutils/netinit/netinit.c                         |  1 +
 netutils/netlib/netlib_iptables.c                  |  1 +
 netutils/netlib/netlib_ipv4adaptor.c               |  1 +
 netutils/netlib/netlib_ipv6adaptor.c               |  1 +
 netutils/ntpclient/ntpclient.c                     |  1 +
 netutils/pppd/pppd.c                               |  1 +
 nshlib/nsh_dbgcmds.c                               |  1 +
 nshlib/nsh_fsutils.c                               |  1 +
 nshlib/nsh_login.c                                 |  1 +
 nshlib/nsh_parse.c                                 |  1 +
 nshlib/nsh_routecmds.c                             |  1 +
 nshlib/nsh_script.c                                |  2 +
 nshlib/nsh_stdlogin.c                              |  1 +
 nshlib/nsh_syscmds.c                               |  1 +
 nshlib/nsh_telnetlogin.c                           |  1 +
 platform/mikroe-stm32f4/mikroe_configdata.c        |  1 +
 system/cfgdata/cfgdata_main.c                      |  1 +
 system/i2c/i2c_dev.c                               |  1 +
 system/i2c/i2c_dump.c                              |  1 +
 system/i2c/i2c_get.c                               |  1 +
 system/i2c/i2c_set.c                               |  1 +
 system/i2c/i2c_verf.c                              |  1 +
 system/lm75/lm75.c                                 |  1 +
 system/nxcamera/nxcamera.c                         |  1 +
 system/nxlooper/nxlooper.c                         |  1 +
 system/nxplayer/nxplayer.c                         |  1 +
 system/nxplayer/nxplayer_common.c                  |  1 +
 system/nxplayer/nxplayer_mp3.c                     |  1 +
 system/nxrecorder/nxrecorder.c                     |  1 +
 system/sched_note/note_main.c                      |  1 +
 system/spi/spi_exch.c                              |  2 +-
 system/ubloxmodem/ubloxmodem_main.c                |  7 ++-
 system/uorb/sensor/topics.c                        |  1 +
 system/uorb/test/unit_test.c                       |  1 +
 testing/crypto/aescbc.c                            |  3 +-
 testing/crypto/hmac.c                              |  3 +-
 testing/mm/mm_main.c                               |  1 +
 testing/ostest/cancel.c                            |  1 +
 testing/ostest/pthread_cleanup.c                   |  1 +
 testing/ostest/pthread_rwlock_cancel.c             |  1 +
 testing/ostest/robust.c                            |  1 +
 testing/ostest/semtimed.c                          |  1 +
 testing/ostest/timedmutex.c                        |  1 +
 testing/ostest/waitpid.c                           |  1 +
 wireless/bluetooth/btsak/btsak_advertise.c         |  1 +
 wireless/bluetooth/btsak/btsak_features.c          |  1 +
 wireless/bluetooth/btsak/btsak_gatt.c              |  1 +
 wireless/bluetooth/btsak/btsak_info.c              |  1 +
 wireless/bluetooth/btsak/btsak_scan.c              |  1 +
 wireless/bluetooth/btsak/btsak_security.c          |  1 +
 wireless/ieee802154/i8sak/i8sak_blaster.c          |  1 +
 wireless/ieee802154/i8sak/i8sak_get.c              |  2 +
 wireless/ieee802154/i8sak/i8sak_main.c             |  1 +
 wireless/ieee802154/i8sak/i8sak_poll.c             |  1 +
 wireless/ieee802154/i8sak/i8sak_regdump.c          |  1 +
 wireless/ieee802154/i8sak/i8sak_reset.c            |  1 +
 wireless/ieee802154/i8sak/i8sak_scan.c             |  1 +
 wireless/ieee802154/i8sak/i8sak_set.c              |  1 +
 wireless/ieee802154/i8sak/i8sak_sniffer.c          |  1 +
 wireless/ieee802154/i8sak/i8sak_startpan.c         |  1 +
 wireless/ieee802154/i8sak/i8sak_tx.c               |  1 +
 153 files changed, 273 insertions(+), 88 deletions(-)

diff --git a/canutils/libobd2/obd_sendrequest.c 
b/canutils/libobd2/obd_sendrequest.c
index 370d93a9a..c1ec8ed7d 100644
--- a/canutils/libobd2/obd_sendrequest.c
+++ b/canutils/libobd2/obd_sendrequest.c
@@ -30,6 +30,8 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
+
 #include <nuttx/can/can.h>
 
 #include "canutils/obd.h"
diff --git a/canutils/libobd2/obd_waitresponse.c 
b/canutils/libobd2/obd_waitresponse.c
index 6319c5f72..bb25638e8 100644
--- a/canutils/libobd2/obd_waitresponse.c
+++ b/canutils/libobd2/obd_waitresponse.c
@@ -31,6 +31,8 @@
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
+
 #include <nuttx/can/can.h>
 
 #include "canutils/obd.h"
@@ -48,8 +50,8 @@
  *   Wait for a message from ECUs with requested PID that was sent using
  *   obd_send_request().
  *
- *   It will return an error case it doesn't receive the msg after the elapsed
- *   "timeout" time.
+ *   It will return an error case it doesn't receive the msg after the
+ *   elapsed "timeout" time.
  *
  ****************************************************************************/
 
@@ -109,10 +111,10 @@ int obd_wait_response(FAR struct obd_dev_s *dev, uint8_t 
opmode, uint8_t pid,
 
       /* Check if we received a Response Message */
 
-      if ((extended && dev->can_rxmsg.cm_hdr.ch_id == OBD_PID_EXT_RESPONSE) || 
\
+      if ((extended &&
+           dev->can_rxmsg.cm_hdr.ch_id == OBD_PID_EXT_RESPONSE) ||
           (!extended && dev->can_rxmsg.cm_hdr.ch_id == OBD_PID_STD_RESPONSE))
         {
-
           /* Check if the Response if for the PID we are interested! */
 
           if (dev->can_rxmsg.cm_data[1] == (opmode + OBD_RESP_BASE) && \
diff --git a/examples/abntcodi/abntcodi_main.c 
b/examples/abntcodi/abntcodi_main.c
index 27faaa684..3a74f445b 100644
--- a/examples/abntcodi/abntcodi_main.c
+++ b/examples/abntcodi/abntcodi_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/hello/abntcodi_main.c
+ * apps/examples/abntcodi/abntcodi_main.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <syslog.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "industry/abnt_codi.h"
 
@@ -45,20 +46,22 @@ void print_abnt_codi(FAR struct abnt_codi_proto_s *proto)
          proto->end_act_dem);
   printf("Current Bill Indicator: %d\n", proto->bill_indicator);
   printf("Reactive Interval Indicator: %d\n", proto->react_interval);
-  printf("Capacitive Reactive Pulses are used to calculate consumption: %s\n",
-         boolstr(proto->react_cap_pulse));
+  printf("Capacitive Reactive Pulses are used to calculate consumption: "
+         "%s\n", boolstr(proto->react_cap_pulse));
   printf("Inductive Reactive Pulses are used to calculate consumption: %s\n",
          boolstr(proto->react_ind_pulse));
   printf("Segment type: %s\n",
          proto->segment_type == SEGMENT_PEEK     ? "PEEK"        :
          proto->segment_type == SEGMENT_OUT_PEEK ? "OUT OF PEEK" :
-         proto->segment_type == SEGMENT_RESERVED ? "RESERVED"    : "UNKNOWN");
+         proto->segment_type == SEGMENT_RESERVED ? "RESERVED"    :
+                                                   "UNKNOWN");
   printf("Charges type: %s\n",
          proto->charge_type == CHARGES_BLUE        ? "BLUE"       :
          proto->charge_type == CHARGES_GREEN       ? "GREEN"      :
-         proto->charge_type == CHARGES_IRRIGATORS  ? "IRRIGATORS" : "OTHERS");
-  printf("Number of Active pulses since the beginning of current demand: %d\n",
-         proto->pulses_act_dem);
+         proto->charge_type == CHARGES_IRRIGATORS  ? "IRRIGATORS" :
+                                                     "OTHERS");
+  printf("Number of Active pulses since the beginning of current demand: "
+         "%d\n", proto->pulses_act_dem);
   printf("Number of Reactive pulses since beginning of current demand: %d\n",
          proto->pulses_react_dem);
 }
diff --git a/examples/ajoystick/ajoy_main.c b/examples/ajoystick/ajoy_main.c
index cf63fe872..2a887d895 100644
--- a/examples/ajoystick/ajoy_main.c
+++ b/examples/ajoystick/ajoy_main.c
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include <fixedmath.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/input/ajoystick.h>
 
diff --git a/examples/alarm/alarm_main.c b/examples/alarm/alarm_main.c
index 05e5face6..74c5e8fc6 100644
--- a/examples/alarm/alarm_main.c
+++ b/examples/alarm/alarm_main.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <sched.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/timers/rtc.h>
 
diff --git a/examples/apa102/apa102_main.c b/examples/apa102/apa102_main.c
index 0d2370688..df41b0168 100644
--- a/examples/apa102/apa102_main.c
+++ b/examples/apa102/apa102_main.c
@@ -30,6 +30,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/leds/apa102.h>
 
@@ -59,7 +60,8 @@ struct apa102_ledstrip_s ledstrip[NUM_LEDS];
  *   Converts a color from HSV to RGB.
  *
  *   Note: This function is based on Pololu example:
- *   
https://github.com/pololu/apa102-arduino/blob/master/examples/Rainbow/Rainbow.ino
+ *   https://github.com/pololu/apa102-arduino/blob/master/examples/Rainbow/
+ *   Rainbow.ino
  *
  * Input Parameters:
  *   h is hue, as a number between 0 and 360.
@@ -79,7 +81,7 @@ static struct apa102_ledstrip_s hsvtorgb(uint16_t h, uint8_t 
s, uint8_t v)
   uint8_t g = 0;
   uint8_t b = 0;
 
-  switch((h / 60) % 6)
+  switch ((h / 60) % 6)
     {
       case 0:
         r = v;
diff --git a/examples/apds9960/apds9960_main.c 
b/examples/apds9960/apds9960_main.c
index 24963fe1c..ec186d5a0 100644
--- a/examples/apds9960/apds9960_main.c
+++ b/examples/apds9960/apds9960_main.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/apds9960.h>
 
diff --git a/examples/bmi160/sixaxis_main.c b/examples/bmi160/sixaxis_main.c
index 93323455f..c1456cefc 100644
--- a/examples/bmi160/sixaxis_main.c
+++ b/examples/bmi160/sixaxis_main.c
@@ -26,6 +26,7 @@
 #include <inttypes.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/bmi160.h>
 
diff --git a/examples/bridge/bridge_main.c b/examples/bridge/bridge_main.c
index 35f35cdce..b03d8386c 100644
--- a/examples/bridge/bridge_main.c
+++ b/examples/bridge/bridge_main.c
@@ -28,6 +28,7 @@
 #include <sched.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <arpa/inet.h>
diff --git a/examples/buttons/buttons_main.c b/examples/buttons/buttons_main.c
index 60fa6fd6a..3fc9b1c9d 100644
--- a/examples/buttons/buttons_main.c
+++ b/examples/buttons/buttons_main.c
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 #include <sched.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/input/buttons.h>
 
diff --git a/examples/calib_udelay/calib_udelay_main.c 
b/examples/calib_udelay/calib_udelay_main.c
index 9fbde1351..9902c4b90 100644
--- a/examples/calib_udelay/calib_udelay_main.c
+++ b/examples/calib_udelay/calib_udelay_main.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/examples/camera/camera_main.c b/examples/camera/camera_main.c
index d41f124e5..b23dc759a 100644
--- a/examples/camera/camera_main.c
+++ b/examples/camera/camera_main.c
@@ -32,6 +32,7 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <time.h>
+#include <unistd.h>
 
 #include <nuttx/video/video.h>
 
diff --git a/examples/can/can_main.c b/examples/can/can_main.c
index 95e414a73..d0e4f8ccb 100644
--- a/examples/can/can_main.c
+++ b/examples/can/can_main.c
@@ -34,6 +34,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/can/can.h>
 
diff --git a/examples/chrono/chrono_main.c b/examples/chrono/chrono_main.c
index dc32c97c4..b909e00b4 100644
--- a/examples/chrono/chrono_main.c
+++ b/examples/chrono/chrono_main.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <time.h>
+#include <unistd.h>
 #include <sys/time.h>
 
 #include <nuttx/input/buttons.h>
diff --git a/examples/djoystick/djoy_main.c b/examples/djoystick/djoy_main.c
index 41f938a7e..2ae89d299 100644
--- a/examples/djoystick/djoy_main.c
+++ b/examples/djoystick/djoy_main.c
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/input/djoystick.h>
 
diff --git a/examples/esp32_himem/esp32_himem_main.c 
b/examples/esp32_himem/esp32_himem_main.c
index 9ad728d08..88e295463 100644
--- a/examples/esp32_himem/esp32_himem_main.c
+++ b/examples/esp32_himem/esp32_himem_main.c
@@ -23,11 +23,13 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include <nuttx/himem/himem.h>
 
diff --git a/examples/fboverlay/fboverlay_main.c 
b/examples/fboverlay/fboverlay_main.c
index 22133b13d..193c4b81d 100644
--- a/examples/fboverlay/fboverlay_main.c
+++ b/examples/fboverlay/fboverlay_main.c
@@ -30,6 +30,8 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <errno.h>
+#include <unistd.h>
+
 #include <nuttx/video/fb.h>
 
 #include <nuttx/config.h>
diff --git a/examples/foc/foc_device.c b/examples/foc/foc_device.c
index 69429da35..2609cf93a 100644
--- a/examples/foc/foc_device.c
+++ b/examples/foc/foc_device.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include "foc_debug.h"
 #include "foc_device.h"
diff --git a/examples/foc/foc_fixed16_thr.c b/examples/foc/foc_fixed16_thr.c
index c2c161433..e507b2a15 100644
--- a/examples/foc/foc_fixed16_thr.c
+++ b/examples/foc/foc_fixed16_thr.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include <dspb16.h>
 
diff --git a/examples/foc/foc_float_thr.c b/examples/foc/foc_float_thr.c
index dcab5de2f..7d26687bb 100644
--- a/examples/foc/foc_float_thr.c
+++ b/examples/foc/foc_float_thr.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include <dsp.h>
 
diff --git a/examples/foc/foc_intf.c b/examples/foc/foc_intf.c
index 13fe1b6e8..04a3493a3 100644
--- a/examples/foc/foc_intf.c
+++ b/examples/foc/foc_intf.c
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <sys/ioctl.h>
 
diff --git a/examples/ft80x/ft80x_coprocessor.c 
b/examples/ft80x/ft80x_coprocessor.c
index 0060f6670..3ca5bb691 100644
--- a/examples/ft80x/ft80x_coprocessor.c
+++ b/examples/ft80x/ft80x_coprocessor.c
@@ -30,6 +30,7 @@
 #include <nuttx/config.h>
 
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/lcd/ft80x.h>
 
diff --git a/examples/fxos8700cq_test/fxos8700cq_main.c 
b/examples/fxos8700cq_test/fxos8700cq_main.c
index b73819773..02bda14f4 100644
--- a/examples/fxos8700cq_test/fxos8700cq_main.c
+++ b/examples/fxos8700cq_test/fxos8700cq_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/fxos8700cq/fxos8700cq_main.c
+ * apps/examples/fxos8700cq_test/fxos8700cq_main.c
  * fxos8700cq motion sensor sample application
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,8 +24,10 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/fxos8700cq.h>
 
diff --git a/examples/gpio/gpio_main.c b/examples/gpio/gpio_main.c
index b24aa1f42..9793fbba4 100644
--- a/examples/gpio/gpio_main.c
+++ b/examples/gpio/gpio_main.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/ioexpander/gpio.h>
 
diff --git a/examples/gps/gps_main.c b/examples/gps/gps_main.c
index 02c12eedf..e55a60e2d 100644
--- a/examples/gps/gps_main.c
+++ b/examples/gps/gps_main.c
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <wchar.h>
 #include <syslog.h>
+#include <unistd.h>
 
 #include "minmea/minmea.h"
 
diff --git a/examples/hdc1008_demo/hdc1008_main.c 
b/examples/hdc1008_demo/hdc1008_main.c
index cf5c558c4..589f7ddd5 100644
--- a/examples/hdc1008_demo/hdc1008_main.c
+++ b/examples/hdc1008_demo/hdc1008_main.c
@@ -31,6 +31,7 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/examples/i2schar/i2schar_receiver.c 
b/examples/i2schar/i2schar_receiver.c
index 8bff12c93..9b6300f67 100644
--- a/examples/i2schar/i2schar_receiver.c
+++ b/examples/i2schar/i2schar_receiver.c
@@ -30,6 +30,7 @@
 #include <pthread.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 
diff --git a/examples/i2schar/i2schar_transmitter.c 
b/examples/i2schar/i2schar_transmitter.c
index 54940a6b5..1396757e2 100644
--- a/examples/i2schar/i2schar_transmitter.c
+++ b/examples/i2schar/i2schar_transmitter.c
@@ -30,6 +30,7 @@
 #include <pthread.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 
diff --git a/examples/i2sloop/i2sloop_main.c b/examples/i2sloop/i2sloop_main.c
index a6279c3dd..f64aa8168 100644
--- a/examples/i2sloop/i2sloop_main.c
+++ b/examples/i2sloop/i2sloop_main.c
@@ -34,6 +34,7 @@
 #include <string.h>
 #include <assert.h>
 #include <signal.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Data
diff --git a/examples/ipcfg/ipcfg_main.c b/examples/ipcfg/ipcfg_main.c
index a1398e128..2caa7d1bd 100644
--- a/examples/ipcfg/ipcfg_main.c
+++ b/examples/ipcfg/ipcfg_main.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <arpa/inet.h>
 
diff --git a/examples/isl29023/isl29023_main.c 
b/examples/isl29023/isl29023_main.c
index a35422542..7ccddda67 100644
--- a/examples/isl29023/isl29023_main.c
+++ b/examples/isl29023/isl29023_main.c
@@ -31,6 +31,7 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/examples/leds/leds_main.c b/examples/leds/leds_main.c
index 47ed05bde..71864dc0c 100644
--- a/examples/leds/leds_main.c
+++ b/examples/leds/leds_main.c
@@ -32,6 +32,7 @@
 #include <sched.h>
 #include <errno.h>
 #include <signal.h>
+#include <unistd.h>
 
 #include <nuttx/leds/userled.h>
 
diff --git a/examples/lis3dsh_reader/lis3dsh_reader_main.c 
b/examples/lis3dsh_reader/lis3dsh_reader_main.c
index da2af927d..7d5816ac2 100644
--- a/examples/lis3dsh_reader/lis3dsh_reader_main.c
+++ b/examples/lis3dsh_reader/lis3dsh_reader_main.c
@@ -46,9 +46,9 @@
 #include <fcntl.h>
 #include <sched.h>
 #include <errno.h>
-
 #include <debug.h>
 #include <time.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/lis3dsh.h>
 
diff --git a/examples/lp503x/lp503x_main.c b/examples/lp503x/lp503x_main.c
old mode 100755
new mode 100644
index 9ad3ea332..d3c5430a4
--- a/examples/lp503x/lp503x_main.c
+++ b/examples/lp503x/lp503x_main.c
@@ -32,6 +32,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
+#include <unistd.h>
+
 #include "system/readline.h"
 
 #include <nuttx/leds/lp503x.h>
diff --git a/examples/ltr308/ltr308_main.c b/examples/ltr308/ltr308_main.c
index 43b9bc153..c951add02 100644
--- a/examples/ltr308/ltr308_main.c
+++ b/examples/ltr308/ltr308_main.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <poll.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Public Functions
diff --git a/examples/max31855/max31855_main.c 
b/examples/max31855/max31855_main.c
index 97e5af843..1c345d12e 100644
--- a/examples/max31855/max31855_main.c
+++ b/examples/max31855/max31855_main.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Public Functions
diff --git a/examples/mcuboot/swap_test/set_img_main.c 
b/examples/mcuboot/swap_test/set_img_main.c
index 7c6d7c20f..b8c538e52 100644
--- a/examples/mcuboot/swap_test/set_img_main.c
+++ b/examples/mcuboot/swap_test/set_img_main.c
@@ -26,6 +26,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+
 #include <sys/boardctl.h>
 
 #include <bootutil/bootutil_public.h>
diff --git a/examples/media/media_main.c b/examples/media/media_main.c
index 31c4b586e..7dee8c90d 100644
--- a/examples/media/media_main.c
+++ b/examples/media/media_main.c
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/fs/fs.h>
 #include <nuttx/mtd/mtd.h>
diff --git a/examples/mlx90614/mlx90614_main.c 
b/examples/mlx90614/mlx90614_main.c
index dfb95602a..7b8d95c6c 100644
--- a/examples/mlx90614/mlx90614_main.c
+++ b/examples/mlx90614/mlx90614_main.c
@@ -47,6 +47,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/ioctl.h>
 #include <nuttx/sensors/mlx90614.h>
diff --git a/examples/noteprintf/noteprintf_main.c 
b/examples/noteprintf/noteprintf_main.c
index c2a00594f..4fafda1fd 100644
--- a/examples/noteprintf/noteprintf_main.c
+++ b/examples/noteprintf/noteprintf_main.c
@@ -23,7 +23,9 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+
 #include <stdio.h>
+#include <unistd.h>
 
 #include "nuttx/sched_note.h"
 
diff --git a/examples/nrf24l01_btle/nrf24l01_btle.c 
b/examples/nrf24l01_btle/nrf24l01_btle.c
index 9616a9a2f..3fe7f7827 100644
--- a/examples/nrf24l01_btle/nrf24l01_btle.c
+++ b/examples/nrf24l01_btle/nrf24l01_btle.c
@@ -26,6 +26,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/signal.h>
 #include <nuttx/sensors/dhtxx.h>
@@ -35,6 +36,7 @@
 #include <stdio.h>
 #include <poll.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "nrf24l01_btle.h"
 
diff --git a/examples/nrf24l01_term/nrf24l01_term.c 
b/examples/nrf24l01_term/nrf24l01_term.c
index badbaef93..35754e110 100644
--- a/examples/nrf24l01_term/nrf24l01_term.c
+++ b/examples/nrf24l01_term/nrf24l01_term.c
@@ -28,7 +28,6 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 
-#include <unistd.h>
 #include <inttypes.h>
 #include <stdint.h>
 #include <stdbool.h>
diff --git a/examples/nunchuck/nunchuck_main.c 
b/examples/nunchuck/nunchuck_main.c
index cbef064a1..f3f7e6e7f 100644
--- a/examples/nunchuck/nunchuck_main.c
+++ b/examples/nunchuck/nunchuck_main.c
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include <fixedmath.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/input/nunchuck.h>
 
diff --git a/examples/nxdemo/nxdemo_bkgd.c b/examples/nxdemo/nxdemo_bkgd.c
index 8693c9832..23ada3a6b 100644
--- a/examples/nxdemo/nxdemo_bkgd.c
+++ b/examples/nxdemo/nxdemo_bkgd.c
@@ -33,6 +33,7 @@
 #include <sys/param.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/nx/nx.h>
 #include <nuttx/nx/nxglib.h>
diff --git a/examples/nxscope/nxscope_main.c b/examples/nxscope/nxscope_main.c
index 4bc15b092..0d1ff0323 100644
--- a/examples/nxscope/nxscope_main.c
+++ b/examples/nxscope/nxscope_main.c
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <pthread.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include "logging/nxscope/nxscope.h"
 
diff --git a/examples/oneshot/oneshot_main.c b/examples/oneshot/oneshot_main.c
index 3a29a2b29..2e0e5fe85 100644
--- a/examples/oneshot/oneshot_main.c
+++ b/examples/oneshot/oneshot_main.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/timers/oneshot.h>
 
diff --git a/examples/pca9635/pca9635_main.c b/examples/pca9635/pca9635_main.c
index bf17c9168..2af21999f 100644
--- a/examples/pca9635/pca9635_main.c
+++ b/examples/pca9635/pca9635_main.c
@@ -30,6 +30,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/leds/pca9635pw.h>
 
diff --git a/examples/powermonitor/powermonitor_main.c 
b/examples/powermonitor/powermonitor_main.c
index ef9c12b43..e45542040 100644
--- a/examples/powermonitor/powermonitor_main.c
+++ b/examples/powermonitor/powermonitor_main.c
@@ -34,6 +34,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/ltc4151.h>
 
diff --git a/examples/random/random_main.c b/examples/random/random_main.c
index d75cb6fa7..e6a13b487 100644
--- a/examples/random/random_main.c
+++ b/examples/random/random_main.c
@@ -30,10 +30,12 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* Configuration ************************************************************/
 
 #ifndef CONFIG_EXAMPLES_MAXSAMPLES
@@ -87,7 +89,9 @@ int main(int argc, FAR char *argv[])
       nsamples = CONFIG_EXAMPLES_MAXSAMPLES;
     }
 
-  /* fill buffer to make it super-clear as to what has and has not been 
written */
+  /* fill buffer to make it super-clear as to what has and has not been
+   * written
+   */
 
   memset(buffer, 0xcc, sizeof(buffer));
 
@@ -116,15 +120,15 @@ int main(int argc, FAR char *argv[])
 
   if (nread != nsamples * sizeof(uint32_t))
     {
-      fprintf(stderr, "ERROR: Read from /dev/random only produced %d bytes\n",
-              (int)nread);
+      fprintf(stderr, "ERROR: Read from /dev/random only produced %zd "
+              "bytes\n", nread);
       close(fd);
       exit(EXIT_FAILURE);
     }
 
   /* Dump the sample buffer */
 
-  lib_dumpbuffer("Random values", (FAR const uint8_t*)buffer, nread);
+  lib_dumpbuffer("Random values", (FAR const uint8_t *)buffer, nread);
   close(fd);
   return EXIT_SUCCESS;
 }
diff --git a/examples/rgbled/rgbled.c b/examples/rgbled/rgbled.c
index c1d5ab5df..405e54beb 100644
--- a/examples/rgbled/rgbled.c
+++ b/examples/rgbled/rgbled.c
@@ -23,10 +23,12 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -63,37 +65,37 @@ int main(int argc, FAR char *argv[])
       return -1;
     }
 
-  while(1)
-  {
-    red   += sred;
-    green += sgreen;
-    blue  += sblue;
-
-    if (green == 255)
-      {
-        sred   = 0;
-        sgreen = -1;
-        sblue  = 1;
-      }
-
-    if (blue == 255)
-      {
-        sred   = 1;
-        sgreen = 0;
-        sblue  = -1;
-      }
-
-    if (red == 255)
-      {
-        sred   = -1;
-        sblue  = 0;
-        sgreen = 1;
-      }
-
-    sprintf(buffer, "#%02X%02X%02X", red, green, blue);
-    write(fd, buffer, 8);
-    usleep(5000);
-  }
+  while (1)
+    {
+      red   += sred;
+      green += sgreen;
+      blue  += sblue;
+
+      if (green == 255)
+        {
+          sred   = 0;
+          sgreen = -1;
+          sblue  = 1;
+        }
+
+      if (blue == 255)
+        {
+          sred   = 1;
+          sgreen = 0;
+          sblue  = -1;
+        }
+
+      if (red == 255)
+        {
+          sred   = -1;
+          sblue  = 0;
+          sgreen = 1;
+        }
+
+      sprintf(buffer, "#%02X%02X%02X", red, green, blue);
+      write(fd, buffer, 8);
+      usleep(5000);
+    }
 
   return 0;
 }
diff --git a/examples/serialrx/serialrx_main.c 
b/examples/serialrx/serialrx_main.c
index bb69963ae..a64515b78 100644
--- a/examples/serialrx/serialrx_main.c
+++ b/examples/serialrx/serialrx_main.c
@@ -30,6 +30,8 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+
 #include <nuttx/arch.h>
 
 /****************************************************************************
diff --git a/examples/sht3x/sht3x_main.c b/examples/sht3x/sht3x_main.c
index 357e15f1a..bd0ef295f 100644
--- a/examples/sht3x/sht3x_main.c
+++ b/examples/sht3x/sht3x_main.c
@@ -23,12 +23,13 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
-#include <stdio.h>
 
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/ioctl.h>
 #include <nuttx/sensors/sht3x.h>
diff --git a/examples/slcd/slcd_main.c b/examples/slcd/slcd_main.c
index ca68c6526..1342ad14b 100644
--- a/examples/slcd/slcd_main.c
+++ b/examples/slcd/slcd_main.c
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/lcd/slcd_ioctl.h>
 #include <nuttx/lcd/slcd_codec.h>
diff --git a/examples/stat/stat_main.c b/examples/stat/stat_main.c
index e3b962dd5..a4c9db4de 100644
--- a/examples/stat/stat_main.c
+++ b/examples/stat/stat_main.c
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Data
diff --git a/examples/sx127x_demo/sx127x_demo.c 
b/examples/sx127x_demo/sx127x_demo.c
index 3c586f4d4..79fc54a4d 100644
--- a/examples/sx127x_demo/sx127x_demo.c
+++ b/examples/sx127x_demo/sx127x_demo.c
@@ -28,7 +28,6 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 
-#include <unistd.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdio.h>
diff --git a/examples/timer/timer_main.c b/examples/timer/timer_main.c
index b44bfa252..ccdfa1481 100644
--- a/examples/timer/timer_main.c
+++ b/examples/timer/timer_main.c
@@ -31,6 +31,8 @@
 #include <signal.h>
 #include <errno.h>
 #include <string.h>
+#include <unistd.h>
+
 #include <nuttx/timers/timer.h>
 
 /****************************************************************************
diff --git a/examples/timer_gpio/timer_gpio_main.c 
b/examples/timer_gpio/timer_gpio_main.c
index 315963aa2..6667d3019 100644
--- a/examples/timer_gpio/timer_gpio_main.c
+++ b/examples/timer_gpio/timer_gpio_main.c
@@ -31,6 +31,8 @@
 #include <signal.h>
 #include <errno.h>
 #include <string.h>
+#include <unistd.h>
+
 #include <nuttx/timers/timer.h>
 #include <nuttx/ioexpander/gpio.h>
 
diff --git a/examples/udpblaster/udpblaster_target.c 
b/examples/udpblaster/udpblaster_target.c
index 01f603c51..1c12f10f0 100644
--- a/examples/udpblaster/udpblaster_target.c
+++ b/examples/udpblaster/udpblaster_target.c
@@ -30,6 +30,7 @@
 #include <poll.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <arpa/inet.h>
diff --git a/examples/userfs/userfs_main.c b/examples/userfs/userfs_main.c
index 1d80addd8..f24b68079 100644
--- a/examples/userfs/userfs_main.c
+++ b/examples/userfs/userfs_main.c
@@ -30,6 +30,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/fs/userfs.h>
 
diff --git a/examples/usrsocktest/usrsocktest_basic_connect.c 
b/examples/usrsocktest/usrsocktest_basic_connect.c
index e442f4290..215cdeef7 100644
--- a/examples/usrsocktest/usrsocktest_basic_connect.c
+++ b/examples/usrsocktest/usrsocktest_basic_connect.c
@@ -29,6 +29,7 @@
 #include <assert.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_basic_getsockname.c 
b/examples/usrsocktest/usrsocktest_basic_getsockname.c
index b32101e1c..c9bbd61f4 100644
--- a/examples/usrsocktest/usrsocktest_basic_getsockname.c
+++ b/examples/usrsocktest/usrsocktest_basic_getsockname.c
@@ -30,6 +30,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_basic_getsockopt.c 
b/examples/usrsocktest/usrsocktest_basic_getsockopt.c
index 287bfce66..b0ddd3c71 100644
--- a/examples/usrsocktest/usrsocktest_basic_getsockopt.c
+++ b/examples/usrsocktest/usrsocktest_basic_getsockopt.c
@@ -27,6 +27,7 @@
 #include <sys/types.h>
 #include <stdbool.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_basic_send.c 
b/examples/usrsocktest/usrsocktest_basic_send.c
index 3e6ec878c..0785708f4 100644
--- a/examples/usrsocktest/usrsocktest_basic_send.c
+++ b/examples/usrsocktest/usrsocktest_basic_send.c
@@ -30,6 +30,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_basic_setsockopt.c 
b/examples/usrsocktest/usrsocktest_basic_setsockopt.c
index 3c15017d6..4c1041581 100644
--- a/examples/usrsocktest/usrsocktest_basic_setsockopt.c
+++ b/examples/usrsocktest/usrsocktest_basic_setsockopt.c
@@ -29,6 +29,7 @@
 #include <assert.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_block_recv.c 
b/examples/usrsocktest/usrsocktest_block_recv.c
index 7382a2465..c54cb8a35 100644
--- a/examples/usrsocktest/usrsocktest_block_recv.c
+++ b/examples/usrsocktest/usrsocktest_block_recv.c
@@ -31,6 +31,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/time.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_block_send.c 
b/examples/usrsocktest/usrsocktest_block_send.c
index 4e6b799a2..8d5eb423d 100644
--- a/examples/usrsocktest/usrsocktest_block_send.c
+++ b/examples/usrsocktest/usrsocktest_block_send.c
@@ -32,6 +32,7 @@
 #include <arpa/inet.h>
 #include <string.h>
 #include <sys/time.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_chardev.c 
b/examples/usrsocktest/usrsocktest_chardev.c
index 3e21c490e..9cbd9f2e2 100644
--- a/examples/usrsocktest/usrsocktest_chardev.c
+++ b/examples/usrsocktest/usrsocktest_chardev.c
@@ -24,6 +24,7 @@
 
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_daemon.c 
b/examples/usrsocktest/usrsocktest_daemon.c
index b62985883..272aa9401 100644
--- a/examples/usrsocktest/usrsocktest_daemon.c
+++ b/examples/usrsocktest/usrsocktest_daemon.c
@@ -34,11 +34,13 @@
 #include <errno.h>
 #include <poll.h>
 #include <pthread.h>
+#include <unistd.h>
 
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+
 #include <nuttx/net/usrsock.h>
 
 #include "defines.h"
diff --git a/examples/usrsocktest/usrsocktest_multi_thread.c 
b/examples/usrsocktest/usrsocktest_multi_thread.c
index 6b6bd11e8..e9f56fbd3 100644
--- a/examples/usrsocktest/usrsocktest_multi_thread.c
+++ b/examples/usrsocktest/usrsocktest_multi_thread.c
@@ -26,6 +26,7 @@
 #include <assert.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_noblock_connect.c 
b/examples/usrsocktest/usrsocktest_noblock_connect.c
index 50a6a1138..ac9ac9179 100644
--- a/examples/usrsocktest/usrsocktest_noblock_connect.c
+++ b/examples/usrsocktest/usrsocktest_noblock_connect.c
@@ -28,8 +28,10 @@
 #include <stdbool.h>
 #include <assert.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_noblock_recv.c 
b/examples/usrsocktest/usrsocktest_noblock_recv.c
index 01995f6d3..a2e4cbf99 100644
--- a/examples/usrsocktest/usrsocktest_noblock_recv.c
+++ b/examples/usrsocktest/usrsocktest_noblock_recv.c
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 #include <assert.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
diff --git a/examples/usrsocktest/usrsocktest_noblock_send.c 
b/examples/usrsocktest/usrsocktest_noblock_send.c
index 9c3d4a40d..7a817d775 100644
--- a/examples/usrsocktest/usrsocktest_noblock_send.c
+++ b/examples/usrsocktest/usrsocktest_noblock_send.c
@@ -31,6 +31,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_nodaemon.c 
b/examples/usrsocktest/usrsocktest_nodaemon.c
index ca10ec6bc..83b8f6c23 100644
--- a/examples/usrsocktest/usrsocktest_nodaemon.c
+++ b/examples/usrsocktest/usrsocktest_nodaemon.c
@@ -24,6 +24,7 @@
 
 #include <sys/socket.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_poll.c 
b/examples/usrsocktest/usrsocktest_poll.c
index 85b1df382..f2e99eebc 100644
--- a/examples/usrsocktest/usrsocktest_poll.c
+++ b/examples/usrsocktest/usrsocktest_poll.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_remote_disconnect.c 
b/examples/usrsocktest/usrsocktest_remote_disconnect.c
index 740096d25..85aaf58d3 100644
--- a/examples/usrsocktest/usrsocktest_remote_disconnect.c
+++ b/examples/usrsocktest/usrsocktest_remote_disconnect.c
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "defines.h"
 
diff --git a/examples/usrsocktest/usrsocktest_wake_with_signal.c 
b/examples/usrsocktest/usrsocktest_wake_with_signal.c
index 8f08210b2..c2d90a2b7 100644
--- a/examples/usrsocktest/usrsocktest_wake_with_signal.c
+++ b/examples/usrsocktest/usrsocktest_wake_with_signal.c
@@ -28,6 +28,7 @@
 #include <arpa/inet.h>
 #include <errno.h>
 #include <poll.h>
+#include <unistd.h>
 
 #include <nuttx/clock.h>
 
diff --git a/examples/watched/watched_main.c b/examples/watched/watched_main.c
index cc44d0372..80994f645 100644
--- a/examples/watched/watched_main.c
+++ b/examples/watched/watched_main.c
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>
+
 #include "watched.h"
 
 /****************************************************************************
diff --git a/examples/watcher/task_mn.c b/examples/watcher/task_mn.c
index 038d26106..9543eef1a 100644
--- a/examples/watcher/task_mn.c
+++ b/examples/watcher/task_mn.c
@@ -31,6 +31,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#include <unistd.h>
+
 #include <nuttx/note/noteram_driver.h>
 #include "task_mn.h"
 
diff --git a/examples/watcher/wdt.c b/examples/watcher/wdt.c
index ea4ff6d8f..6bb3dd5e5 100644
--- a/examples/watcher/wdt.c
+++ b/examples/watcher/wdt.c
@@ -32,6 +32,8 @@
 #include <fcntl.h>
 #include <debug.h>
 #include <sys/ioctl.h>
+#include <unistd.h>
+
 #include "wdt.h"
 #include "task_mn.h"
 
diff --git a/examples/zerocross/zerocross_main.c 
b/examples/zerocross/zerocross_main.c
index 416fa7a99..fd766cec0 100644
--- a/examples/zerocross/zerocross_main.c
+++ b/examples/zerocross/zerocross_main.c
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/zerocross.h>
 
diff --git a/fsutils/mkfatfs/mkfatfs.c b/fsutils/mkfatfs/mkfatfs.c
index 15ba4a63a..1523636a3 100644
--- a/fsutils/mkfatfs/mkfatfs.c
+++ b/fsutils/mkfatfs/mkfatfs.c
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <debug.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/fs/fs.h>
 
diff --git a/fsutils/mkfatfs/writefat.c b/fsutils/mkfatfs/writefat.c
index 213b12965..63bb38210 100644
--- a/fsutils/mkfatfs/writefat.c
+++ b/fsutils/mkfatfs/writefat.c
@@ -30,6 +30,7 @@
 #include <string.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/fs/fat.h>
 
diff --git a/graphics/pdcurs34/nuttx/pdcdisp.c 
b/graphics/pdcurs34/nuttx/pdcdisp.c
index 35ea45dba..d1aaadeb5 100644
--- a/graphics/pdcurs34/nuttx/pdcdisp.c
+++ b/graphics/pdcurs34/nuttx/pdcdisp.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/graphics/nuttx/pdcdisp.c
+ * apps/graphics/pdcurs34/nuttx/pdcdisp.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -25,6 +25,7 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #ifdef CONFIG_SYSTEM_TERMCURSES
 #include <system/termcurses.h>
diff --git a/graphics/pdcurs34/nuttx/pdcscrn.c 
b/graphics/pdcurs34/nuttx/pdcscrn.c
index fccc3f166..0082dca7c 100644
--- a/graphics/pdcurs34/nuttx/pdcscrn.c
+++ b/graphics/pdcurs34/nuttx/pdcscrn.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/graphics/nuttx/pdcscrn.c
+ * apps/graphics/pdcurs34/nuttx/pdcscrn.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -31,6 +31,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <graphics/curses.h>
 #include "pdcnuttx.h"
@@ -61,7 +62,8 @@ bool graphic_screen = false;
 #ifdef CONFIG_SYSTEM_TERMCURSES
 static void PDC_scr_free_term(FAR SCREEN *sp)
 {
-  FAR struct pdc_termscreen_s *termscreen = (FAR struct pdc_termscreen_s *)sp;
+  FAR struct pdc_termscreen_s *termscreen =
+    (FAR struct pdc_termscreen_s *)sp;
   FAR struct pdc_termstate_s  *termstate = &termscreen->termstate;
 
   /* Deinitialize termcurses */
@@ -145,7 +147,8 @@ static int PDC_scr_open_term(int argc, char **argv)
   ret = termcurses_getwinsize(termstate->tcurs, &winsz);
   if (ret != OK)
     {
-      PDC_LOG(("ERROR: Terminal termcurses driver doesn't support size 
reporting\n"));
+      PDC_LOG(("ERROR: Terminal termcurses driver doesn't support size "
+               "reporting\n"));
       free(termscreen);
       return ERR;
     }
@@ -156,8 +159,8 @@ static int PDC_scr_open_term(int argc, char **argv)
   SP->cols                     = winsz.ws_col;
   termscreen->termstate.out_fd = 1;
   termscreen->termstate.in_fd  = 0;
-  termscreen->termstate.fg_red = 0xFFFE;
-  termscreen->termstate.bg_red = 0xFFFE;
+  termscreen->termstate.fg_red = 0xfffe;
+  termscreen->termstate.bg_red = 0xfffe;
   termstate                    = &termscreen->termstate;
 
   /* Setup initial RGB colors */
@@ -172,7 +175,7 @@ static int PDC_scr_open_term(int argc, char **argv)
       greylevel                       += (i & COLOR_BLUE)  ? 0x40 : 0;
 
       termstate->greylevel[i]          = greylevel;
-      termstate->greylevel[i+8]        = greylevel | 0x3f;
+      termstate->greylevel[i + 8]      = greylevel | 0x3f;
 #else
       termstate->rgbcolor[i].red       = (i & COLOR_RED)   ? 0xc0 : 0;
       termstate->rgbcolor[i].green     = (i & COLOR_GREEN) ? 0xc0 : 0;
@@ -207,18 +210,20 @@ static int PDC_scr_open_term(int argc, char **argv)
  * Name: PDC_init_pair_term
  *
  * Description:
- *   The core of init_pair().  This does all the work of that function, except
- *   checking for values out of range.  The values passed to this function
- *   should be returned by a call to PDC_pair_content() with the same pair
- *   number.  PDC_transform_line() should use the specified colors when
- *   rendering a chtype with the given pair number.
+ *   The core of init_pair().  This does all the work of that function,
+ *   except checking for values out of range.  The values passed to this
+ *   function should be returned by a call to PDC_pair_content() with the
+ *   same pair number.  PDC_transform_line() should use the specified colors
+ *   when rendering a chtype with the given pair number.
  *
  ****************************************************************************/
 
 #ifdef CONFIG_SYSTEM_TERMCURSES
-static void PDC_init_pair_term(FAR SCREEN *sp, short pair, short fg, short bg)
+static void PDC_init_pair_term(FAR SCREEN *sp, short pair,
+                               short fg, short bg)
 {
-  FAR struct pdc_termscreen_s *termscreen = (FAR struct pdc_termscreen_s *)sp;
+  FAR struct pdc_termscreen_s *termscreen =
+    (FAR struct pdc_termscreen_s *)sp;
 
   termscreen->termstate.colorpair[pair].fg = fg;
   termscreen->termstate.colorpair[pair].bg = bg;
@@ -238,7 +243,8 @@ static void PDC_init_pair_term(FAR SCREEN *sp, short pair, 
short fg, short bg)
 int PDC_init_color_term(FAR SCREEN *sp, short color, short red, short green,
                         short blue)
 {
-  FAR struct pdc_termscreen_s *termscreen = (FAR struct pdc_termscreen_s *)sp;
+  FAR struct pdc_termscreen_s *termscreen =
+    (FAR struct pdc_termscreen_s *)sp;
   FAR struct pdc_termstate_s  *termstate;
 
   DEBUGASSERT(termscreen != NULL);
@@ -272,7 +278,8 @@ int PDC_init_color_term(FAR SCREEN *sp, short color, short 
red, short green,
 int PDC_color_content_term(FAR SCREEN *sp, short color,
                            FAR short *red, FAR short *green, FAR short *blue)
 {
-  FAR struct pdc_termscreen_s *termscreen = (FAR struct pdc_termscreen_s *)sp;
+  FAR struct pdc_termscreen_s *termscreen =
+    (FAR struct pdc_termscreen_s *)sp;
   FAR struct pdc_termstate_s  *termstate;
 
   DEBUGASSERT(termscreen != NULL);
@@ -303,9 +310,11 @@ int PDC_color_content_term(FAR SCREEN *sp, short color,
  ****************************************************************************/
 
 #ifdef CONFIG_SYSTEM_TERMCURSES
-static int PDC_pair_content_term(FAR SCREEN *sp, short pair, short *fg, short 
*bg)
+static int PDC_pair_content_term(FAR SCREEN *sp, short pair,
+                                 FAR short *fg, FAR short *bg)
 {
-  FAR struct pdc_termscreen_s *termscreen = (FAR struct pdc_termscreen_s *)sp;
+  FAR struct pdc_termscreen_s *termscreen =
+    (FAR struct pdc_termscreen_s *)sp;
 
   *fg = termscreen->termstate.colorpair[pair].fg;
   *bg = termscreen->termstate.colorpair[pair].bg;
@@ -442,7 +451,8 @@ int PDC_scr_open(int argc, char **argv)
 
   /* Allocate the global instance of SP */
 
-  fbscreen = (FAR struct pdc_fbscreen_s *)zalloc(sizeof(struct 
pdc_fbscreen_s));
+  fbscreen =
+    (FAR struct pdc_fbscreen_s *)zalloc(sizeof(struct pdc_fbscreen_s));
   if (fbscreen == NULL)
     {
       PDC_LOG(("ERROR: Failed to allocate SP\n"));
@@ -473,7 +483,7 @@ int PDC_scr_open(int argc, char **argv)
       greylevel                     += (i & COLOR_BLUE)  ? 0x40 : 0;
 
       fbstate->greylevel[i]          = greylevel;
-      fbstate->greylevel[i+8]        = greylevel | 0x3f;
+      fbstate->greylevel[i + 8]      = greylevel | 0x3f;
 #else
       fbstate->rgbcolor[i].red       = (i & COLOR_RED)   ? 0xc0 : 0;
       fbstate->rgbcolor[i].green     = (i & COLOR_GREEN) ? 0xc0 : 0;
@@ -564,8 +574,8 @@ int PDC_scr_open(int argc, char **argv)
    * address mapping to make the memory accessible to the application.
    */
 
-  fbstate->fbmem = mmap(NULL, pinfo.fblen, PROT_READ|PROT_WRITE,
-                        MAP_SHARED|MAP_FILE, fbstate->fbfd, 0);
+  fbstate->fbmem = mmap(NULL, pinfo.fblen, PROT_READ | PROT_WRITE,
+                        MAP_SHARED | MAP_FILE, fbstate->fbfd, 0);
   if (fbstate->fbmem == MAP_FAILED)
     {
       PDC_LOG(("ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n", errno));
@@ -704,9 +714,9 @@ int PDC_resize_screen(int nlines, int ncols)
  *
  * Description:
  *   The non-portable functionality of reset_prog_mode() is handled here --
- *   whatever's not done in _restore_mode().  In current ports:  In OS/2, this
- *   sets the keyboard to binary mode; in Win32, it enables or disables the
- *   mouse pointer to match the saved mode; in others it does nothing.
+ *   whatever's not done in _restore_mode().  In current ports:  In OS/2,
+ *   this sets the keyboard to binary mode; in Win32, it enables or disables
+ *   the mouse pointer to match the saved mode; in others it does nothing.
  *
  ****************************************************************************/
 
@@ -763,11 +773,11 @@ void PDC_save_screen_mode(int i)
  * Name: PDC_init_pair
  *
  * Description:
- *   The core of init_pair().  This does all the work of that function, except
- *   checking for values out of range.  The values passed to this function
- *   should be returned by a call to PDC_pair_content() with the same pair
- *   number.  PDC_transform_line() should use the specified colors when
- *   rendering a chtype with the given pair number.
+ *   The core of init_pair().  This does all the work of that function,
+ *   except checking for values out of range.  The values passed to this
+ *   function should be returned by a call to PDC_pair_content() with the
+ *   same pair number.  PDC_transform_line() should use the specified colors
+ *   when rendering a chtype with the given pair number.
  *
  ****************************************************************************/
 
diff --git a/industry/foc/fixed16/foc_ang_hall.c 
b/industry/foc/fixed16/foc_ang_hall.c
index 905e0f724..27834ff70 100644
--- a/industry/foc/fixed16/foc_ang_hall.c
+++ b/industry/foc/fixed16/foc_ang_hall.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/hall3ph.h>
 
diff --git a/industry/foc/fixed16/foc_ang_qenco.c 
b/industry/foc/fixed16/foc_ang_qenco.c
index af5b9074a..769d242bb 100644
--- a/industry/foc/fixed16/foc_ang_qenco.c
+++ b/industry/foc/fixed16/foc_ang_qenco.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/qencoder.h>
 
diff --git a/industry/foc/fixed16/foc_handler.c 
b/industry/foc/fixed16/foc_handler.c
index 8c77da167..536d4e712 100644
--- a/industry/foc/fixed16/foc_handler.c
+++ b/industry/foc/fixed16/foc_handler.c
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "industry/foc/foc_log.h"
 #include "industry/foc/foc_common.h"
diff --git a/industry/foc/float/foc_ang_hall.c 
b/industry/foc/float/foc_ang_hall.c
index f3c0e7366..b69023a13 100644
--- a/industry/foc/float/foc_ang_hall.c
+++ b/industry/foc/float/foc_ang_hall.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/hall3ph.h>
 
diff --git a/industry/foc/float/foc_ang_qenco.c 
b/industry/foc/float/foc_ang_qenco.c
index aaa36f5a8..9b6b436d2 100644
--- a/industry/foc/float/foc_ang_qenco.c
+++ b/industry/foc/float/foc_ang_qenco.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/qencoder.h>
 
diff --git a/industry/foc/float/foc_handler.c b/industry/foc/float/foc_handler.c
index c767cf1e0..a446537f9 100644
--- a/industry/foc/float/foc_handler.c
+++ b/industry/foc/float/foc_handler.c
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "industry/foc/foc_log.h"
 #include "industry/foc/foc_common.h"
diff --git a/netutils/esp8266/esp8266.c b/netutils/esp8266/esp8266.c
index 617d162a5..817dd705a 100644
--- a/netutils/esp8266/esp8266.c
+++ b/netutils/esp8266/esp8266.c
@@ -38,6 +38,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <netdb.h>
 #include <arpa/inet.h>
diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c
index ccddcc212..e0400d8a9 100644
--- a/netutils/iperf/iperf.c
+++ b/netutils/iperf/iperf.c
@@ -30,6 +30,8 @@
 #include <netinet/in.h>
 #include <assert.h>
 #include <stdbool.h>
+#include <unistd.h>
+
 #include "iperf.h"
 
 /****************************************************************************
diff --git a/netutils/netinit/netinit.c b/netutils/netinit/netinit.c
index a742bbf6f..9cbeb77b3 100644
--- a/netutils/netinit/netinit.c
+++ b/netutils/netinit/netinit.c
@@ -42,6 +42,7 @@
 #include <signal.h>
 #include <assert.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <arpa/inet.h>
diff --git a/netutils/netlib/netlib_iptables.c 
b/netutils/netlib/netlib_iptables.c
index 079ad4dc9..854e9891f 100644
--- a/netutils/netlib/netlib_iptables.c
+++ b/netutils/netlib/netlib_iptables.c
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/socket.h>
+#include <unistd.h>
 
 #include <nuttx/net/netconfig.h>
 #include <nuttx/net/netfilter/ip_tables.h>
diff --git a/netutils/netlib/netlib_ipv4adaptor.c 
b/netutils/netlib/netlib_ipv4adaptor.c
index af76e3c8d..b4b765a86 100644
--- a/netutils/netlib/netlib_ipv4adaptor.c
+++ b/netutils/netlib/netlib_ipv4adaptor.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <nuttx/net/ip.h>
diff --git a/netutils/netlib/netlib_ipv6adaptor.c 
b/netutils/netlib/netlib_ipv6adaptor.c
index 1afa6cd09..7cfdd3308 100644
--- a/netutils/netlib/netlib_ipv6adaptor.c
+++ b/netutils/netlib/netlib_ipv6adaptor.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <nuttx/net/ip.h>
diff --git a/netutils/ntpclient/ntpclient.c b/netutils/ntpclient/ntpclient.c
index 5cb62fc75..ed18be460 100644
--- a/netutils/ntpclient/ntpclient.c
+++ b/netutils/ntpclient/ntpclient.c
@@ -38,6 +38,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <netinet/in.h>
 
diff --git a/netutils/pppd/pppd.c b/netutils/pppd/pppd.c
index 2a1a70809..819906f55 100644
--- a/netutils/pppd/pppd.c
+++ b/netutils/pppd/pppd.c
@@ -52,6 +52,7 @@
 #include <poll.h>
 #include <time.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <netinet/in.h>
 #include <net/if.h>
diff --git a/nshlib/nsh_dbgcmds.c b/nshlib/nsh_dbgcmds.c
index 932087609..52b6a3be4 100644
--- a/nshlib/nsh_dbgcmds.c
+++ b/nshlib/nsh_dbgcmds.c
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "nsh.h"
 #include "nsh_console.h"
diff --git a/nshlib/nsh_fsutils.c b/nshlib/nsh_fsutils.c
index c9b50710c..9d48c79bd 100644
--- a/nshlib/nsh_fsutils.c
+++ b/nshlib/nsh_fsutils.c
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <assert.h>
+#include <unistd.h>
 
 #include "nsh.h"
 #include "nsh_console.h"
diff --git a/nshlib/nsh_login.c b/nshlib/nsh_login.c
index e4fa506c1..4d3976136 100644
--- a/nshlib/nsh_login.c
+++ b/nshlib/nsh_login.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #include "fsutils/passwd.h"
 #ifdef CONFIG_NSH_CLE
diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c
index 7bb54c843..7f86a1702 100644
--- a/nshlib/nsh_parse.c
+++ b/nshlib/nsh_parse.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 
 #ifdef CONFIG_NSH_CMDPARMS
 #  include <sys/stat.h>
diff --git a/nshlib/nsh_routecmds.c b/nshlib/nsh_routecmds.c
index 802100820..13758f960 100644
--- a/nshlib/nsh_routecmds.c
+++ b/nshlib/nsh_routecmds.c
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #include <net/route.h>
 #include <netinet/in.h>
diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c
index 56a821bbd..0174c0fbb 100644
--- a/nshlib/nsh_script.c
+++ b/nshlib/nsh_script.c
@@ -23,7 +23,9 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+
 #include <fcntl.h>
+#include <unistd.h>
 
 #include "nsh.h"
 #include "nsh_console.h"
diff --git a/nshlib/nsh_stdlogin.c b/nshlib/nsh_stdlogin.c
index 85c81a16f..0cadf19cb 100644
--- a/nshlib/nsh_stdlogin.c
+++ b/nshlib/nsh_stdlogin.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #include "fsutils/passwd.h"
 #ifdef CONFIG_NSH_CLE
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index f44593986..583d3ff19 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "nsh.h"
 #include "nsh_console.h"
diff --git a/nshlib/nsh_telnetlogin.c b/nshlib/nsh_telnetlogin.c
index 5c50ea56c..c8e6bdad4 100644
--- a/nshlib/nsh_telnetlogin.c
+++ b/nshlib/nsh_telnetlogin.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #include "fsutils/passwd.h"
 
diff --git a/platform/mikroe-stm32f4/mikroe_configdata.c 
b/platform/mikroe-stm32f4/mikroe_configdata.c
index be54fd0bf..79ebc1987 100644
--- a/platform/mikroe-stm32f4/mikroe_configdata.c
+++ b/platform/mikroe-stm32f4/mikroe_configdata.c
@@ -29,6 +29,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 
 #include "platform/configdata.h"
diff --git a/system/cfgdata/cfgdata_main.c b/system/cfgdata/cfgdata_main.c
index 962fce1ce..c32913e1b 100644
--- a/system/cfgdata/cfgdata_main.c
+++ b/system/cfgdata/cfgdata_main.c
@@ -27,6 +27,7 @@
 #include <nuttx/mtd/configdata.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 #include <stdio.h>
 #include <string.h>
diff --git a/system/i2c/i2c_dev.c b/system/i2c/i2c_dev.c
index 87bd499da..8b5cceb2e 100644
--- a/system/i2c/i2c_dev.c
+++ b/system/i2c/i2c_dev.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/i2c/i2c_master.h>
 
diff --git a/system/i2c/i2c_dump.c b/system/i2c/i2c_dump.c
index d18666e7b..c26c5f333 100644
--- a/system/i2c/i2c_dump.c
+++ b/system/i2c/i2c_dump.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/i2c/i2c_master.h>
 
diff --git a/system/i2c/i2c_get.c b/system/i2c/i2c_get.c
index 07e84b54e..569ac50bf 100644
--- a/system/i2c/i2c_get.c
+++ b/system/i2c/i2c_get.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/i2c/i2c_master.h>
 
diff --git a/system/i2c/i2c_set.c b/system/i2c/i2c_set.c
index c29f49cfb..883b287de 100644
--- a/system/i2c/i2c_set.c
+++ b/system/i2c/i2c_set.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/i2c/i2c_master.h>
 
diff --git a/system/i2c/i2c_verf.c b/system/i2c/i2c_verf.c
index 87fb4aa97..1c2080921 100644
--- a/system/i2c/i2c_verf.c
+++ b/system/i2c/i2c_verf.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/i2c/i2c_master.h>
 
diff --git a/system/lm75/lm75.c b/system/lm75/lm75.c
index 8e925c689..9edb8f2f0 100644
--- a/system/lm75/lm75.c
+++ b/system/lm75/lm75.c
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <fixedmath.h>
+#include <unistd.h>
 
 #include <nuttx/sensors/lm75.h>
 
diff --git a/system/nxcamera/nxcamera.c b/system/nxcamera/nxcamera.c
index 0875d462b..aa419f318 100644
--- a/system/nxcamera/nxcamera.c
+++ b/system/nxcamera/nxcamera.c
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <nuttx/queue.h>
 #include <nuttx/video/video.h>
diff --git a/system/nxlooper/nxlooper.c b/system/nxlooper/nxlooper.c
index f5c695354..b663b5e70 100644
--- a/system/nxlooper/nxlooper.c
+++ b/system/nxlooper/nxlooper.c
@@ -39,6 +39,7 @@
 #include <errno.h>
 #include <dirent.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 
diff --git a/system/nxplayer/nxplayer.c b/system/nxplayer/nxplayer.c
index 0a4d4c580..1e3b979c6 100644
--- a/system/nxplayer/nxplayer.c
+++ b/system/nxplayer/nxplayer.c
@@ -45,6 +45,7 @@
 #include <errno.h>
 #include <dirent.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <netutils/netlib.h>
 #include <nuttx/audio/audio.h>
diff --git a/system/nxplayer/nxplayer_common.c 
b/system/nxplayer/nxplayer_common.c
index 29960fda0..75fe85c28 100644
--- a/system/nxplayer/nxplayer_common.c
+++ b/system/nxplayer/nxplayer_common.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 
diff --git a/system/nxplayer/nxplayer_mp3.c b/system/nxplayer/nxplayer_mp3.c
index a1b94cc1d..dc7f07809 100644
--- a/system/nxplayer/nxplayer_mp3.c
+++ b/system/nxplayer/nxplayer_mp3.c
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 
diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index cc6f3fa20..f85f1b5bb 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -38,6 +38,7 @@
 #include <errno.h>
 #include <dirent.h>
 #include <debug.h>
+#include <unistd.h>
 
 #include <nuttx/audio/audio.h>
 #include "system/nxrecorder.h"
diff --git a/system/sched_note/note_main.c b/system/sched_note/note_main.c
index b754be72a..a443ee366 100644
--- a/system/sched_note/note_main.c
+++ b/system/sched_note/note_main.c
@@ -32,6 +32,7 @@
 #include <syslog.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/sched_note.h>
 
diff --git a/system/spi/spi_exch.c b/system/spi/spi_exch.c
index 768fccfca..4d8d10c8f 100644
--- a/system/spi/spi_exch.c
+++ b/system/spi/spi_exch.c
@@ -25,8 +25,8 @@
 #include <nuttx/config.h>
 
 #include <stdlib.h>
-
 #include <ctype.h>
+#include <unistd.h>
 
 #include <nuttx/spi/spi_transfer.h>
 
diff --git a/system/ubloxmodem/ubloxmodem_main.c 
b/system/ubloxmodem/ubloxmodem_main.c
index 998d88e21..2e03b5840 100644
--- a/system/ubloxmodem/ubloxmodem_main.c
+++ b/system/ubloxmodem/ubloxmodem_main.c
@@ -50,6 +50,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <nuttx/modem/u-blox.h>
 
@@ -303,8 +304,9 @@ static int ubloxmodem_reset(FAR struct ubloxmodem_cxt *cxt)
 
 static int ubloxmodem_status(FAR struct ubloxmodem_cxt *cxt)
 {
-  int ret, i;
   struct ubxmdm_status status;
+  int ret;
+  int i;
 
   /* Allocate name-value pairs */
 
@@ -342,9 +344,10 @@ static int ubloxmodem_status(FAR struct ubloxmodem_cxt 
*cxt)
 
 static int ubloxmodem_at(FAR struct ubloxmodem_cxt *cxt)
 {
-  int fd, ret;
   FAR char *atcmd;
   FAR char *resp;
+  int ret;
+  int fd;
 
   atcmd = cxt->argv[2];
   resp  = cxt->argv[3];
diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c
index 2c1851f55..7b7ec7f18 100644
--- a/system/uorb/sensor/topics.c
+++ b/system/uorb/sensor/topics.c
@@ -24,6 +24,7 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 
 #include <sensor/accel.h>
diff --git a/system/uorb/test/unit_test.c b/system/uorb/test/unit_test.c
index 5e72b8d35..9b1eeb167 100644
--- a/system/uorb/test/unit_test.c
+++ b/system/uorb/test/unit_test.c
@@ -29,6 +29,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "utility.h"
 
diff --git a/testing/crypto/aescbc.c b/testing/crypto/aescbc.c
index 6f5807d12..e21d23548 100644
--- a/testing/crypto/aescbc.c
+++ b/testing/crypto/aescbc.c
@@ -24,9 +24,10 @@
 #include <err.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <crypto/cryptodev.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
+#include <crypto/cryptodev.h>
 #include <crypto/md5.h>
 #include <crypto/sha1.h>
 #include <crypto/sha2.h>
diff --git a/testing/crypto/hmac.c b/testing/crypto/hmac.c
index 3816664a8..fda24dd27 100644
--- a/testing/crypto/hmac.c
+++ b/testing/crypto/hmac.c
@@ -22,9 +22,10 @@
 #include <err.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <crypto/cryptodev.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
+#include <crypto/cryptodev.h>
 #include <crypto/md5.h>
 #include <crypto/sha1.h>
 #include <crypto/sha2.h>
diff --git a/testing/mm/mm_main.c b/testing/mm/mm_main.c
index 6b2839e48..2ee80e027 100644
--- a/testing/mm/mm_main.c
+++ b/testing/mm/mm_main.c
@@ -29,6 +29,7 @@
 #include <malloc.h>
 #include <string.h>
 #include <assert.h>
+#include <unistd.h>
 
 #ifdef CONFIG_TESTING_MM_POWEROFF
 #include <sys/boardctl.h>
diff --git a/testing/ostest/cancel.c b/testing/ostest/cancel.c
index 4104c0368..ebe8cc593 100644
--- a/testing/ostest/cancel.c
+++ b/testing/ostest/cancel.c
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <mqueue.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "ostest.h"
 
diff --git a/testing/ostest/pthread_cleanup.c b/testing/ostest/pthread_cleanup.c
index 61b19743b..1f4dabc3a 100644
--- a/testing/ostest/pthread_cleanup.c
+++ b/testing/ostest/pthread_cleanup.c
@@ -25,6 +25,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Types
diff --git a/testing/ostest/pthread_rwlock_cancel.c 
b/testing/ostest/pthread_rwlock_cancel.c
index c3ff042da..e9c33a3be 100644
--- a/testing/ostest/pthread_rwlock_cancel.c
+++ b/testing/ostest/pthread_rwlock_cancel.c
@@ -25,6 +25,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Types
diff --git a/testing/ostest/robust.c b/testing/ostest/robust.c
index 28a396bd3..14b2cf0da 100644
--- a/testing/ostest/robust.c
+++ b/testing/ostest/robust.c
@@ -28,6 +28,7 @@
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "ostest.h"
 
diff --git a/testing/ostest/semtimed.c b/testing/ostest/semtimed.c
index 633cf70cb..9f33ebb4b 100644
--- a/testing/ostest/semtimed.c
+++ b/testing/ostest/semtimed.c
@@ -28,6 +28,7 @@
 #include <time.h>
 #include <sched.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "ostest.h"
 
diff --git a/testing/ostest/timedmutex.c b/testing/ostest/timedmutex.c
index 0a35362d4..c21ef32a2 100644
--- a/testing/ostest/timedmutex.c
+++ b/testing/ostest/timedmutex.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <pthread.h>
 #include <time.h>
+#include <unistd.h>
 
 #include "ostest.h"
 
diff --git a/testing/ostest/waitpid.c b/testing/ostest/waitpid.c
index 5b9e9b6db..cef6b07d9 100644
--- a/testing/ostest/waitpid.c
+++ b/testing/ostest/waitpid.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <signal.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "ostest.h"
 
diff --git a/wireless/bluetooth/btsak/btsak_advertise.c 
b/wireless/bluetooth/btsak/btsak_advertise.c
index 40f5b1e29..0982ad9b1 100644
--- a/wireless/bluetooth/btsak/btsak_advertise.c
+++ b/wireless/bluetooth/btsak/btsak_advertise.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_core.h>
 #include <nuttx/wireless/bluetooth/bt_hci.h>
diff --git a/wireless/bluetooth/btsak/btsak_features.c 
b/wireless/bluetooth/btsak/btsak_features.c
index ece355f5d..ceb408c72 100644
--- a/wireless/bluetooth/btsak/btsak_features.c
+++ b/wireless/bluetooth/btsak/btsak_features.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_core.h>
 #include <nuttx/wireless/bluetooth/bt_hci.h>
diff --git a/wireless/bluetooth/btsak/btsak_gatt.c 
b/wireless/bluetooth/btsak/btsak_gatt.c
index 6f6209f43..c7485ace9 100644
--- a/wireless/bluetooth/btsak/btsak_gatt.c
+++ b/wireless/bluetooth/btsak/btsak_gatt.c
@@ -31,6 +31,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_core.h>
 #include <nuttx/wireless/bluetooth/bt_gatt.h>
diff --git a/wireless/bluetooth/btsak/btsak_info.c 
b/wireless/bluetooth/btsak/btsak_info.c
index e8b40ae01..b177535db 100644
--- a/wireless/bluetooth/btsak/btsak_info.c
+++ b/wireless/bluetooth/btsak/btsak_info.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_core.h>
 #include <nuttx/wireless/bluetooth/bt_hci.h>
diff --git a/wireless/bluetooth/btsak/btsak_scan.c 
b/wireless/bluetooth/btsak/btsak_scan.c
index 57a1e06f6..5ab76e61f 100644
--- a/wireless/bluetooth/btsak/btsak_scan.c
+++ b/wireless/bluetooth/btsak/btsak_scan.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_ioctl.h>
 
diff --git a/wireless/bluetooth/btsak/btsak_security.c 
b/wireless/bluetooth/btsak/btsak_security.c
index 0a8a1a43d..853fde7cd 100644
--- a/wireless/bluetooth/btsak/btsak_security.c
+++ b/wireless/bluetooth/btsak/btsak_security.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/wireless/bluetooth/bt_core.h>
 #include <nuttx/wireless/bluetooth/bt_hci.h>
diff --git a/wireless/ieee802154/i8sak/i8sak_blaster.c 
b/wireless/ieee802154/i8sak/i8sak_blaster.c
index 2f949fdb0..c5d89cd21 100644
--- a/wireless/ieee802154/i8sak/i8sak_blaster.c
+++ b/wireless/ieee802154/i8sak/i8sak_blaster.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <arpa/inet.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_get.c 
b/wireless/ieee802154/i8sak/i8sak_get.c
index bc1e53e28..5716562ff 100644
--- a/wireless/ieee802154/i8sak/i8sak_get.c
+++ b/wireless/ieee802154/i8sak/i8sak_get.c
@@ -28,7 +28,9 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
+
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/wireless/ieee802154/ieee802154_mac.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_main.c 
b/wireless/ieee802154/i8sak/i8sak_main.c
index eac0172de..f5a4482fe 100644
--- a/wireless/ieee802154/i8sak/i8sak_main.c
+++ b/wireless/ieee802154/i8sak/i8sak_main.c
@@ -42,6 +42,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <arpa/inet.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_poll.c 
b/wireless/ieee802154/i8sak/i8sak_poll.c
index f7cbbb279..052cfc4a7 100644
--- a/wireless/ieee802154/i8sak/i8sak_poll.c
+++ b/wireless/ieee802154/i8sak/i8sak_poll.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_regdump.c 
b/wireless/ieee802154/i8sak/i8sak_regdump.c
index 74ab2cdb0..26f426f6b 100644
--- a/wireless/ieee802154/i8sak/i8sak_regdump.c
+++ b/wireless/ieee802154/i8sak/i8sak_regdump.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_reset.c 
b/wireless/ieee802154/i8sak/i8sak_reset.c
index 7a26a928b..15dfab3b8 100644
--- a/wireless/ieee802154/i8sak/i8sak_reset.c
+++ b/wireless/ieee802154/i8sak/i8sak_reset.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_scan.c 
b/wireless/ieee802154/i8sak/i8sak_scan.c
index 076672f21..e70aef073 100644
--- a/wireless/ieee802154/i8sak/i8sak_scan.c
+++ b/wireless/ieee802154/i8sak/i8sak_scan.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_set.c 
b/wireless/ieee802154/i8sak/i8sak_set.c
index fc58a73bb..d2759dcf4 100644
--- a/wireless/ieee802154/i8sak/i8sak_set.c
+++ b/wireless/ieee802154/i8sak/i8sak_set.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/wireless/ieee802154/ieee802154_mac.h>
diff --git a/wireless/ieee802154/i8sak/i8sak_sniffer.c 
b/wireless/ieee802154/i8sak/i8sak_sniffer.c
index 8f2771f3c..5bca97cd2 100644
--- a/wireless/ieee802154/i8sak/i8sak_sniffer.c
+++ b/wireless/ieee802154/i8sak/i8sak_sniffer.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/net/sixlowpan.h>
diff --git a/wireless/ieee802154/i8sak/i8sak_startpan.c 
b/wireless/ieee802154/i8sak/i8sak_startpan.c
index 7478a79f9..61f271a96 100644
--- a/wireless/ieee802154/i8sak/i8sak_startpan.c
+++ b/wireless/ieee802154/i8sak/i8sak_startpan.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 
diff --git a/wireless/ieee802154/i8sak/i8sak_tx.c 
b/wireless/ieee802154/i8sak/i8sak_tx.c
index 96c1c2c03..59b99f46d 100644
--- a/wireless/ieee802154/i8sak/i8sak_tx.c
+++ b/wireless/ieee802154/i8sak/i8sak_tx.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/wireless/ieee802154/ieee802154_device.h>

Reply via email to