You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/10/14 01:10:44 UTC

(nuttx-apps) branch master updated (779bd1713 -> c56e79394)

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

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


    from 779bd1713 system/brctl: Add Ethernet bridge configuration command.
     new 4cf2c8181 apps: Fix the nxstyle errors in the files that the next commit changes.
     new c56e79394 apps: Include the headers that are used.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .codespell-ignore-lines                         |   1 +
 boot/nxboot/loader/boot.c                       |   7 +-
 boot/nxboot/loader/flash.c                      |   1 +
 examples/adjtime/adjtime_main.c                 |   1 +
 examples/ads7046/ads7046_main.c                 |   1 +
 examples/audio_rttl/audio_rttl_main.c           |  28 ++--
 examples/baromonitor/baromonitor_main.c         |   1 +
 examples/ble/ble_main.c                         |   1 +
 examples/bmp280/bmp280_main.c                   |   1 +
 examples/calib_udelay/calib_udelay_main.c       |   1 +
 examples/camera/camera_bkgd.c                   |   1 +
 examples/fbcon/fbcon_main.c                     |  81 ++++++-----
 examples/hx711/hx711_main.c                     |  71 +++++-----
 examples/mqttc/mqttc_pub.c                      |   5 +-
 examples/netpkt/netpkt_ethercat.c               |   2 +
 examples/nimble_blecent/nimble_blecent_main.c   |   6 +-
 examples/nimble_blecent/peer.c                  |   1 +
 examples/nimble_bleprph/gatt_svr.c              |   1 +
 examples/nimble_bleprph/nimble_bleprph_main.c   |   2 +
 examples/nxterm/nxterm_main.c                   |   3 +-
 examples/pty_test/pty_test.c                    |   1 +
 examples/pwfb/pwfb_events.c                     |   1 +
 examples/pwlines/pwlines_events.c               |   1 +
 examples/shv-test/shv_test.c                    |   2 +
 examples/stepper/stepper.c                      |   2 +
 examples/tmp112/tmp112_main.c                   |   1 +
 examples/watched/watched.c                      |   5 +
 fsutils/passwd/passwd_delete.c                  |  12 +-
 games/NXDoom/src/i_timer.h                      |   6 +
 interpreters/wamr/CMakeLists.txt                |   5 +
 interpreters/wamr/Makefile                      |   5 +
 lte/lapi/src/lapi_other.c                       |   1 +
 netutils/dhcpd/dhcpd.c                          |   1 +
 netutils/netlib/netlib_ip6tables.c              |   5 +
 netutils/netlib/netlib_iptables.c               |   5 +
 netutils/plcatool/plcatool.c                    |  21 ++-
 system/adcscope/adcscope_main.c                 |   1 +
 system/iptables/ip6tables.c                     |   3 +
 system/iptables/iptables.c                      |   2 +
 system/nxdiag/nxdiag.c                          |   2 +
 system/ofloader/ofloader.c                      |   4 +
 system/sensorscope/sensorscope_main.c           |   3 +
 system/ymodem/rb_main.c                         |   6 +-
 system/ymodem/sb_main.c                         |   7 +-
 system/zlib/CMakeLists.txt                      |   8 ++
 system/zlib/Makefile                            |   5 +
 testing/cmocka/cmocka_platform.h                |   1 +
 testing/drivers/drivertest/drivertest_block.c   |   4 +
 testing/drivers/drivertest/drivertest_i2c_spi.c |   3 +
 testing/drivers/drivertest/drivertest_pm_smp.c  |   8 ++
 testing/drivers/drivertest/drivertest_relay.c   |   1 +
 testing/drivers/nand_sim/nand_sim_main.c        |   3 +
 testing/drivers/pcitest/pcitest.c               | 172 ++++++++++++------------
 testing/drivers/ser/ser.c                       |   3 +-
 testing/drivers/setest/setest.c                 |  31 +++--
 testing/fs/epoll/epoll.c                        |   2 +
 testing/fs/fdsantest/fdsantest_simple.c         |   3 +
 testing/fs/memfd/memfd_test.c                   |   2 +
 testing/libc/atomic/atomic_main.c               |   1 +
 testing/mm/cachetest/cachetest_main.c           |   3 +
 testing/ostest/sched_thread_local.c             |   1 +
 wireless/ieee802154/i8sak/i8sak.h               |   1 +
 wireless/ieee802154/i8sak/i8sak_acceptassoc.c   |   3 +-
 63 files changed, 375 insertions(+), 198 deletions(-)


(nuttx-apps) 01/02: apps: Fix the nxstyle errors in the files that the next commit changes.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4cf2c81817f150a475d27787ecb20f222376f5bc
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Mon Oct 12 08:44:17 2026 +0200

    apps: Fix the nxstyle errors in the files that the next commit changes.
    
    The next commit adds includes to these files, and checkpatch checks each
    changed file as a whole.  So fix their old nxstyle errors first: the
    indentation of case labels and other lines, blank lines after
    declarations, a long comment, and a long string (split in two, with the
    same output).  Only the layout changes.
    
    codespell also checks the whole files: fix "Types" and "transfer" in
    sb_main.c, "corresponds" in hx711_main.c and "primitive" in
    i8sak_acceptassoc.c, and add the path line of testing/drivers/ser/ser.c
    to .codespell-ignore-lines ("ser" is not a typo there).
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 .codespell-ignore-lines                         |   1 +
 boot/nxboot/loader/boot.c                       |   5 +-
 examples/audio_rttl/audio_rttl_main.c           |  27 ++--
 examples/fbcon/fbcon_main.c                     |  80 ++++++-----
 examples/hx711/hx711_main.c                     |  70 +++++-----
 examples/mqttc/mqttc_pub.c                      |   4 +-
 examples/nimble_blecent/nimble_blecent_main.c   |   4 +-
 examples/nxterm/nxterm_main.c                   |   2 +-
 examples/watched/watched.c                      |   4 +
 fsutils/passwd/passwd_delete.c                  |  11 +-
 netutils/netlib/netlib_ip6tables.c              |   4 +
 netutils/netlib/netlib_iptables.c               |   4 +
 netutils/plcatool/plcatool.c                    |  20 ++-
 system/iptables/ip6tables.c                     |   2 +
 system/iptables/iptables.c                      |   1 +
 system/nxdiag/nxdiag.c                          |   1 +
 system/ofloader/ofloader.c                      |   2 +
 system/sensorscope/sensorscope_main.c           |   2 +
 system/ymodem/rb_main.c                         |   5 +-
 system/ymodem/sb_main.c                         |   6 +-
 testing/drivers/drivertest/drivertest_block.c   |   2 +
 testing/drivers/drivertest/drivertest_i2c_spi.c |   2 +
 testing/drivers/drivertest/drivertest_pm_smp.c  |   7 +
 testing/drivers/pcitest/pcitest.c               | 171 ++++++++++++------------
 testing/drivers/ser/ser.c                       |   2 +-
 testing/drivers/setest/setest.c                 |  30 +++--
 testing/fs/fdsantest/fdsantest_simple.c         |   2 +
 testing/mm/cachetest/cachetest_main.c           |   2 +
 wireless/ieee802154/i8sak/i8sak_acceptassoc.c   |   2 +-
 29 files changed, 277 insertions(+), 198 deletions(-)

diff --git a/.codespell-ignore-lines b/.codespell-ignore-lines
index 5902decae..11d7d038b 100644
--- a/.codespell-ignore-lines
+++ b/.codespell-ignore-lines
@@ -14,3 +14,4 @@
   MUSIC("messag"), MUSIC("count2"), MUSIC("ddtbl3"), MUSIC("ampie"),
   MUSIC("tense"),  MUSIC("shawn3"), MUSIC("openin"), MUSIC("evil"),
 /* ANS service */
+ * apps/testing/drivers/ser/ser.c
diff --git a/boot/nxboot/loader/boot.c b/boot/nxboot/loader/boot.c
index c4f936d23..54ac92678 100644
--- a/boot/nxboot/loader/boot.c
+++ b/boot/nxboot/loader/boot.c
@@ -55,6 +55,7 @@
 static inline void get_image_header(int fd, struct nxboot_img_header *header)
 {
   int ret;
+
   ret = flash_partition_read(fd, header, sizeof *header, 0);
   if (ret < 0)
     {
@@ -257,6 +258,7 @@ static bool compare_versions(struct nxboot_img_version *v1,
 {
 #ifndef CONFIG_NXBOOT_PREVENT_DOWNGRADE
   int i;
+
   if (v1->major != v2->major ||
       v1->minor != v2->minor ||
       v1->patch != v2->patch)
@@ -301,6 +303,7 @@ static enum nxboot_update_type
 {
   nxboot_progress(nxboot_progress_start, validate_primary);
   bool primary_valid = validate_image(primary);
+
   nxboot_progress(nxboot_progress_end);
 
   nxboot_progress(nxboot_progress_start, validate_update);
@@ -314,7 +317,7 @@ static enum nxboot_update_type
           return NXBOOT_UPDATE_TYPE_UPDATE;
         }
 
-        flash_partition_erase_first_sector(update);
+      flash_partition_erase_first_sector(update);
     }
 
   nxboot_progress(nxboot_progress_end);
diff --git a/examples/audio_rttl/audio_rttl_main.c b/examples/audio_rttl/audio_rttl_main.c
index 5e9e7e960..4c0389bd7 100644
--- a/examples/audio_rttl/audio_rttl_main.c
+++ b/examples/audio_rttl/audio_rttl_main.c
@@ -171,6 +171,7 @@ static void play_pwm(struct rtttl_tone sound)
 static void teardown_pwm(void)
 {
   int fd = *((int *)g_player.arg);
+
   close(fd);
 }
 #endif /* CONFIG_PWM */
@@ -215,19 +216,19 @@ int main(int argc, FAR char *argv[])
     {
       switch (c)
         {
-        case 'h':
-          print_usage(stdout);
-          break;
-        case 's':
-          song = optarg;
-          break;
-        case 'f':
-          file = optarg;
-          break;
-        case '?':
-          fprintf(stderr, "Unknown option -%c\n", optopt);
-          print_usage(stderr);
-          return EXIT_FAILURE;
+          case 'h':
+            print_usage(stdout);
+            break;
+          case 's':
+            song = optarg;
+            break;
+          case 'f':
+            file = optarg;
+            break;
+          case '?':
+            fprintf(stderr, "Unknown option -%c\n", optopt);
+            print_usage(stderr);
+            return EXIT_FAILURE;
         }
     }
 
diff --git a/examples/fbcon/fbcon_main.c b/examples/fbcon/fbcon_main.c
index 7736d36e6..40edc91f8 100644
--- a/examples/fbcon/fbcon_main.c
+++ b/examples/fbcon/fbcon_main.c
@@ -828,7 +828,7 @@ static void fbcon_freeglyph(FAR struct fbcon_glyph_s *glyph)
       free(glyph->bitmap);
     }
 
-    memset(glyph, 0, sizeof(struct fbcon_glyph_s));
+  memset(glyph, 0, sizeof(struct fbcon_glyph_s));
 }
 
 /****************************************************************************
@@ -937,13 +937,14 @@ static FAR struct fbcon_glyph_s *
   for (i = 0; i < st->maxglyphs; i++)
     {
       FAR struct fbcon_glyph_s *glyph = &st->glyph[i];
+
       if (glyph->usecnt > 0 && glyph->code == ch)
         {
           /* Increment the use count (unless it is already at the max) */
 
           if (glyph->usecnt < MAX_USECNT)
             {
-               glyph->usecnt++;
+              glyph->usecnt++;
             }
 
           /* And return the glyph that we found */
@@ -1929,56 +1930,56 @@ static void fbcon_write(FAR struct fbcon_state_s *st,
 
                   fbcon_putc(st, (uint8_t)ch);
                 }
-              break;
+                break;
 
-            /* The full VT100 escape sequence was processed (and the new
-             * character was consumed)
-             */
+              /* The full VT100 escape sequence was processed (and the new
+               * character was consumed)
+               */
 
-            case VT100_PROCESSED:
+              case VT100_PROCESSED:
 
-            /* Character was consumed as part of the VT100 escape processing
-             * (but the escape sequence is still incomplete.
-             */
+              /* Character was consumed as part of the VT100 escape
+               * processing (but the escape sequence is still incomplete.
+               */
 
-            case VT100_CONSUMED:
-              {
-                /* Do nothing... the VT100 logic owns the character */
-              }
-              break;
+              case VT100_CONSUMED:
+                {
+                  /* Do nothing... the VT100 logic owns the character */
+                }
+                break;
 
-            /* Invalid/unsupported character in escape sequence */
+              /* Invalid/unsupported character in escape sequence */
 
-            case VT100_ABORT:
-              {
-                int i;
+              case VT100_ABORT:
+                {
+                  int i;
 
-                /* Add the first unhandled character to the window */
+                  /* Add the first unhandled character to the window */
 
-                fbcon_putc(st, (uint8_t)st->seq[0]);
+                  fbcon_putc(st, (uint8_t)st->seq[0]);
 
-                /* Move all buffer characters down one */
+                  /* Move all buffer characters down one */
 
-                for (i = 1; i < st->nseq; i++)
-                  {
-                    st->seq[i - 1] = st->seq[i];
-                  }
+                  for (i = 1; i < st->nseq; i++)
+                    {
+                      st->seq[i - 1] = st->seq[i];
+                    }
 
-                st->nseq--;
+                  st->nseq--;
 
-                /* Then loop again and check if what remains is part of a
-                 * VT100 escape sequence.  We could speed this up by
-                 * checking if st->seq[0] == ASCII_ESC.
-                 */
-              }
-              break;
+                  /* Then loop again and check if what remains is part of a
+                   * VT100 escape sequence.  We could speed this up by
+                   * checking if st->seq[0] == ASCII_ESC.
+                   */
+                }
+                break;
             }
         }
       while (state == VT100_ABORT);
 #else
-    /* Just output the character */
+      /* Just output the character */
 
-    fbcon_putc(st, ch);
+      fbcon_putc(st, ch);
 #endif /* CONFIG_EXAMPLES_FBCON_VT100_DECODE */
     }
 
@@ -2006,6 +2007,7 @@ static int fbdev_get_pinfo(int fd, FAR struct fb_planeinfo_s *pinfo)
   if (ioctl(fd, FBIOGET_PLANEINFO, (unsigned long)((uintptr_t)pinfo)) < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n", errcode);
       return EXIT_FAILURE;
     }
@@ -2223,6 +2225,7 @@ static bool has_input(int fd)
   /* Poll the File Descriptor for input */
 
   struct pollfd fdp;
+
   fdp.fd = fd;
   fdp.events = POLLIN;
   ret = poll(&fdp,  /* File Descriptors                                     */
@@ -2330,6 +2333,7 @@ static void poll_std_streams(FAR struct fbcon_state_s *st)
 
       ssize_t num = 0;
       char ch;
+
       num_ch = read(STDIN_FILENO, &ch, 1);
 
       if (num_ch != 1)
@@ -2427,6 +2431,7 @@ int main(int argc, FAR char *argv[])
   if (st->fd_fb < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: Failed to open %s: %d\n", fbdev, errcode);
       return FBCON_EXIT_FD;
     }
@@ -2438,6 +2443,7 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       int errcode = errno;
+
       fprintf(stderr, "ERROR: ioctl(FBIOGET_VIDEOINFO) failed: %d\n",
                        errcode);
       exitcode = FBCON_EXIT_GETVINFO;
@@ -2453,6 +2459,7 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: ioctl(FBIO_SELECT_OVERLAY) failed: %d\n", errcode);
       ret = FBCON_EXIT_FBIO_SELECT_OVERLAY
       goto errout;
@@ -2466,6 +2473,7 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: ioctl(FBIOGET_OVERLAYINFO) failed: %d\n", errcode);
       ret = FBCON_EXIT_FBIO_OVERLAY_INFO
       goto errout;
@@ -2477,6 +2485,7 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: ioctl(FBIO_SELECT_OVERLAY) failed: %d\n", errcode);
       ret = FBCON_EXIT_FBIO_SELECT_OVERLAY
       goto errout;
@@ -2641,6 +2650,7 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       int errcode = errno;
+
       gerr("ERROR: posix_spawn failed: %d\n", errcode);
       exitcode = FBCON_EXIT_POSIX_SPAWN_FAILED;
     }
diff --git a/examples/hx711/hx711_main.c b/examples/hx711/hx711_main.c
index 3e9f1755c..28258dc5d 100644
--- a/examples/hx711/hx711_main.c
+++ b/examples/hx711/hx711_main.c
@@ -74,7 +74,7 @@ static void hx711_print_help(const char *progname)
          "\t         If you set value per unit, precision is in units, "
          "otherwise it's raw values.\n"
          "\t         If units are used, float can be passed like 0.1\n"
-         "\t-v<val>  value read that coresponds to one unit. This value "
+         "\t-v<val>  value read that corresponds to one unit. This value "
          "has to be\n"
          "\t         calibrated first before it's known\n"
          "\t-s       reverse sign, if values decreses when mass increases, "
@@ -113,49 +113,49 @@ static int hx711_parse_args(int argc, FAR char *argv[])
     {
       switch (opt)
         {
-        case 'h':
-          hx711_print_help(argv[0]);
-          return 1;
+          case 'h':
+            hx711_print_help(argv[0]);
+            return 1;
 
-        case 'd':
-          strcpy(g_hx711_config.dev, optarg);
-          break;
+          case 'd':
+            strcpy(g_hx711_config.dev, optarg);
+            break;
 
-        case 't':
-          g_hx711_config.precision = atof(optarg);
-          break;
+          case 't':
+            g_hx711_config.precision = atof(optarg);
+            break;
 
-        case 'D':
-          g_hx711_config.dump = 1;
-          break;
+          case 'D':
+            g_hx711_config.dump = 1;
+            break;
 
-        case 'a':
-          g_hx711_config.average = atoi(optarg);
-          break;
+          case 'a':
+            g_hx711_config.average = atoi(optarg);
+            break;
 
-        case 'c':
-          g_hx711_config.channel = optarg[0];
-          break;
+          case 'c':
+            g_hx711_config.channel = optarg[0];
+            break;
 
-        case 'g':
-          g_hx711_config.gain = atoi(optarg);
-          break;
+          case 'g':
+            g_hx711_config.gain = atoi(optarg);
+            break;
 
-        case 'r':
-          g_hx711_config.loops = atoi(optarg);
-          break;
+          case 'r':
+            g_hx711_config.loops = atoi(optarg);
+            break;
 
-        case 's':
-          g_hx711_config.sign = -1;
-          break;
+          case 's':
+            g_hx711_config.sign = -1;
+            break;
 
-        case 'v':
-          g_hx711_config.val_per_unit = atoi(optarg);
-          break;
+          case 'v':
+            g_hx711_config.val_per_unit = atoi(optarg);
+            break;
 
-        default:
-          fprintf(stderr, "Invalid option, run with -h for help\n");
-          return 1;
+          default:
+            fprintf(stderr, "Invalid option, run with -h for help\n");
+            return 1;
         }
     }
 
@@ -230,7 +230,7 @@ int hx711_set_options(int fd)
         }
     }
 
-  /* Set what value coresponds to 1 unit */
+  /* Set what value corresponds to 1 unit */
 
   if (g_hx711_config.val_per_unit > 0)
     {
diff --git a/examples/mqttc/mqttc_pub.c b/examples/mqttc/mqttc_pub.c
index d979fb24a..0e5999599 100644
--- a/examples/mqttc/mqttc_pub.c
+++ b/examples/mqttc/mqttc_pub.c
@@ -175,7 +175,7 @@ static void parsearg(int argc, FAR char *argv[],
                 case 2L:
                   cfg->qos = MQTT_PUBLISH_QOS_2;
                   break;
-                }
+              }
             break;
 
 #ifdef MQTT_USE_MBEDTLS
@@ -304,6 +304,7 @@ static int init_conn(FAR const struct mqttc_cfg_s *cfg,
   for (; ; )
     {
       uint32_t want = 0;
+
       ret = mbedtls_ssl_handshake(ssl_ctx);
       if (ret == MBEDTLS_ERR_SSL_WANT_READ)
         {
@@ -346,6 +347,7 @@ static int init_conn(FAR const struct mqttc_cfg_s *cfg,
           const char *buf = "";
 #else
           char buf[512];
+
           mbedtls_x509_crt_verify_info(buf, sizeof(buf), "\t", result);
 #endif
           printf("Certificate verification failed (%0" PRIx32 ")\n%s\n",
diff --git a/examples/nimble_blecent/nimble_blecent_main.c b/examples/nimble_blecent/nimble_blecent_main.c
index 5af9d2b03..1d78e6d11 100644
--- a/examples/nimble_blecent/nimble_blecent_main.c
+++ b/examples/nimble_blecent/nimble_blecent_main.c
@@ -511,9 +511,11 @@ static int blecent_gap_event(FAR struct ble_gap_event *event, FAR void *arg)
                OS_MBUF_PKTLEN(event->notify_rx.om));
 
         uint8_t notif_data[100]; /* Size depending on the actual size of the
-                                    notification data you have */
+                                  * notification data you have
+                                  */
         uint16_t notif_len;
         int offset = 0;
+
         notif_len  = OS_MBUF_PKTLEN(event->notify_rx.om);
         os_mbuf_copydata(event->notify_rx.om, offset, notif_len, notif_data);
 
diff --git a/examples/nxterm/nxterm_main.c b/examples/nxterm/nxterm_main.c
index a2250eb4e..afe6f34ba 100644
--- a/examples/nxterm/nxterm_main.c
+++ b/examples/nxterm/nxterm_main.c
@@ -108,7 +108,7 @@ static int nxterm_initialize(void)
   g_nxterm_vars.hnx = nx_connect();
   if (g_nxterm_vars.hnx)
     {
-       pthread_attr_t attr;
+      pthread_attr_t attr;
 
 #ifdef CONFIG_VNCSERVER
       /* Setup the VNC server to support keyboard/mouse inputs */
diff --git a/examples/watched/watched.c b/examples/watched/watched.c
index cad7095c0..9013590a0 100644
--- a/examples/watched/watched.c
+++ b/examples/watched/watched.c
@@ -89,6 +89,7 @@ int watched_read_watcher_info(struct watched_info_s *info)
       if (fp == NULL)
         {
           int errcode = errno;
+
           fprintf(stderr, "ERROR: Failed to open %s: %d\n",
                   g_watcher_info.info_file_name, errcode);
           ret = errcode;
@@ -132,6 +133,7 @@ int watched_subscribe(struct watched_info_s *info)
   if (ret == ERROR)
     {
       int errcode = errno;
+
       fprintf(stderr, "subscribe: error %d\n", errcode);
       ret = errcode;
     }
@@ -151,6 +153,7 @@ int watched_unsubscribe(struct watched_info_s *info)
   if (ret == ERROR)
     {
       int errcode = errno;
+
       fprintf(stderr, "unsubscribe: error %d\n", errcode);
       ret = errcode;
     }
@@ -170,6 +173,7 @@ int watched_feed_dog(struct watched_info_s *info)
   if (ret == ERROR)
     {
       int errcode = errno;
+
       fprintf(stderr, "watched_feed_dog: error %d\n", errcode);
       ret = errcode;
     }
diff --git a/fsutils/passwd/passwd_delete.c b/fsutils/passwd/passwd_delete.c
index cb9562c4e..3dbc49fdd 100644
--- a/fsutils/passwd/passwd_delete.c
+++ b/fsutils/passwd/passwd_delete.c
@@ -98,6 +98,7 @@ static int passwd_copyfile(FAR char *iobuffer, FILE *instream,
                   /* Read error */
 
                   int errcode = errno;
+
                   DEBUGASSERT(errcode > 0);
 
                   if (errcode != EINTR)
@@ -109,10 +110,10 @@ static int passwd_copyfile(FAR char *iobuffer, FILE *instream,
                 {
                   /* End of file encountered.
                    *
-                   * This occurs normally when copying to the end-of-the file.
-                   * In that case, the caller just sticks a huge number in for
-                   * copysize and lets the end-of-file indication terminate the
-                   * copy.
+                   * This occurs normally when copying to the end-of-the
+                   * file.  In that case, the caller just sticks a huge
+                   * number in for copysize and lets the end-of-file
+                   * indication terminate the copy.
                    */
 
                   eof = true;
@@ -154,6 +155,7 @@ static int passwd_copyfile(FAR char *iobuffer, FILE *instream,
               /* Write error */
 
               int errcode = errno;
+
               DEBUGASSERT(errcode > 0);
 
               if (errcode != EINTR)
@@ -257,6 +259,7 @@ int passwd_delete(off_t offset)
   for (; ; )
     {
       int ch = fgetc(instream);
+
       if (ch == EOF)
         {
           if (feof(instream))
diff --git a/netutils/netlib/netlib_ip6tables.c b/netutils/netlib/netlib_ip6tables.c
index d966e432d..564de741b 100644
--- a/netutils/netlib/netlib_ip6tables.c
+++ b/netutils/netlib/netlib_ip6tables.c
@@ -695,6 +695,7 @@ FAR struct ip6t_entry *netlib_ip6t_filter_entry(FAR const char *target,
       case 0:
         {
           FAR struct ip6t_filter_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -708,6 +709,7 @@ FAR struct ip6t_entry *netlib_ip6t_filter_entry(FAR const char *target,
       case IPPROTO_TCP:
         {
           FAR struct ip6t_filter_tcp_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -722,6 +724,7 @@ FAR struct ip6t_entry *netlib_ip6t_filter_entry(FAR const char *target,
       case IPPROTO_UDP:
         {
           FAR struct ip6t_filter_udp_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -737,6 +740,7 @@ FAR struct ip6t_entry *netlib_ip6t_filter_entry(FAR const char *target,
         {
           FAR struct ip6t_filter_icmp_entry_s *entry =
                                                       zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
diff --git a/netutils/netlib/netlib_iptables.c b/netutils/netlib/netlib_iptables.c
index e27576a33..887c45f36 100644
--- a/netutils/netlib/netlib_iptables.c
+++ b/netutils/netlib/netlib_iptables.c
@@ -747,6 +747,7 @@ FAR struct ipt_entry *netlib_ipt_filter_entry(FAR const char *target,
       case 0:
         {
           FAR struct ipt_filter_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -760,6 +761,7 @@ FAR struct ipt_entry *netlib_ipt_filter_entry(FAR const char *target,
       case IPPROTO_TCP:
         {
           FAR struct ipt_filter_tcp_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -774,6 +776,7 @@ FAR struct ipt_entry *netlib_ipt_filter_entry(FAR const char *target,
       case IPPROTO_UDP:
         {
           FAR struct ipt_filter_udp_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
@@ -788,6 +791,7 @@ FAR struct ipt_entry *netlib_ipt_filter_entry(FAR const char *target,
       case IPPROTO_ICMP:
         {
           FAR struct ipt_filter_icmp_entry_s *entry = zalloc(sizeof(*entry));
+
           if (entry == NULL)
             {
               return NULL;
diff --git a/netutils/plcatool/plcatool.c b/netutils/plcatool/plcatool.c
index 9d170968b..90edf2b57 100644
--- a/netutils/plcatool/plcatool.c
+++ b/netutils/plcatool/plcatool.c
@@ -123,6 +123,7 @@ static void plcatool_usage(bool err);
 static int get_num(FAR const char *str, FAR int *result)
 {
   FAR char *endptr;
+
   *result = (int)strtol(str, &endptr, 0);
 
   if (*endptr != '\0')
@@ -447,6 +448,7 @@ static int verify_support(FAR struct plcatool_cfg_s *cfg,
                           FAR bool *supported)
 {
   uint16_t reg;
+
   if (read_plca_mmd(cfg->ifname, cfg->phy, OA_TC14_IDVER_ADDR, &reg))
     {
       return ERROR;
@@ -487,6 +489,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
       if (cfg->node_cnt)
         {
           int val = PLCATOOL_CFG_VAL(cfg, node_cnt);
+
           reg &= ~OA_TC14_CTRL1_NCNT_MASK;
           reg |= oa_tc14_field(val, CTRL1_NCNT);
         }
@@ -494,6 +497,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
       if (cfg->node_id)
         {
           int val = PLCATOOL_CFG_VAL(cfg, node_id);
+
           reg &= ~OA_TC14_CTRL1_ID_MASK;
           reg |= oa_tc14_field(val, CTRL1_ID);
         }
@@ -509,6 +513,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
   if (cfg->to_tmr)
     {
       int val = PLCATOOL_CFG_VAL(cfg, to_tmr);
+
       reg = oa_tc14_field(val, TOTMR_TOT);
 
       if (write_plca_mmd(cfg->ifname, cfg->phy, OA_TC14_TOTMR_ADDR, reg))
@@ -529,6 +534,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
       if (cfg->burst_cnt)
         {
           int val = PLCATOOL_CFG_VAL(cfg, burst_cnt);
+
           reg &= ~OA_TC14_BURST_MAXBC_MASK;
           reg |= oa_tc14_field(val, BURST_MAXBC);
         }
@@ -536,6 +542,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
       if (cfg->burst_tmr)
         {
           int val = PLCATOOL_CFG_VAL(cfg, burst_tmr);
+
           reg &= ~OA_TC14_BURST_BTMR_MASK;
           reg |= oa_tc14_field(val, BURST_BTMR);
         }
@@ -551,6 +558,7 @@ static int plcatool_set(FAR struct plcatool_cfg_s *cfg)
   if (cfg->enable)
     {
       int val;
+
       if (read_plca_mmd(cfg->ifname, cfg->phy, OA_TC14_CTRL0_ADDR, &reg))
         {
           return EIO;
@@ -684,9 +692,11 @@ static void plcatool_usage(bool err)
 int main(int argc, FAR char *argv[])
 {
   struct plcatool_cfg_s cfg;
+
   memset(&cfg, 0, sizeof(cfg));
 
   int err = parse_args(argc, argv, &cfg);
+
   if (err)
     {
       plcatool_usage(err);
@@ -696,17 +706,17 @@ int main(int argc, FAR char *argv[])
   switch (cfg.cmd)
     {
       case PLCA_CMD_SET:
-          return plcatool_set(&cfg);
+        return plcatool_set(&cfg);
 
       case PLCA_CMD_GET:
-          return plcatool_get(&cfg);
+        return plcatool_get(&cfg);
 
       case PLCA_CMD_STATUS:
-          return plcatool_status(&cfg);
+        return plcatool_status(&cfg);
 
       case PLCA_CMD_HELP:
-          plcatool_usage(false);
-          break;
+        plcatool_usage(false);
+        break;
     }
 
   return OK;
diff --git a/system/iptables/ip6tables.c b/system/iptables/ip6tables.c
index e29d92301..e15e26685 100644
--- a/system/iptables/ip6tables.c
+++ b/system/iptables/ip6tables.c
@@ -57,9 +57,11 @@ static FAR char *ip6tables_addr2str(net_ipv6addr_t addr, net_ipv6addr_t msk,
                                     FAR char *buf, size_t bufflen)
 {
   unsigned int preflen = netlib_ipv6netmask2prefix(msk);
+
   if (preflen != 0)
     {
       char ipbuf[INET6_ADDRSTRLEN];
+
       inet_ntop(AF_INET6, addr, ipbuf, INET6_ADDRSTRLEN);
       snprintf(buf, bufflen, "%s/%d", ipbuf, preflen);
     }
diff --git a/system/iptables/iptables.c b/system/iptables/iptables.c
index 367519a34..ad0eec099 100644
--- a/system/iptables/iptables.c
+++ b/system/iptables/iptables.c
@@ -102,6 +102,7 @@ static FAR char *iptables_addr2str(struct in_addr addr, struct in_addr msk,
                                    FAR char *buf, size_t bufflen)
 {
   unsigned int preflen = popcount(msk.s_addr);
+
   if (preflen != 0)
     {
       snprintf(buf, bufflen, "%s/%d", inet_ntoa(addr), preflen);
diff --git a/system/nxdiag/nxdiag.c b/system/nxdiag/nxdiag.c
index c10ebeca3..062cc8f56 100644
--- a/system/nxdiag/nxdiag.c
+++ b/system/nxdiag/nxdiag.c
@@ -256,6 +256,7 @@ int main(int argc, char *argv[])
       search_str_in_arr(argc, argv, "--all"))
     {
       char hostname[HOST_NAME_MAX];
+
       gethostname(hostname, HOST_NAME_MAX);
       hostname[HOST_NAME_MAX - 1] = '\0';
 
diff --git a/system/ofloader/ofloader.c b/system/ofloader/ofloader.c
index 6648a66b0..fe6ca12e3 100644
--- a/system/ofloader/ofloader.c
+++ b/system/ofloader/ofloader.c
@@ -163,6 +163,7 @@ static ssize_t read_safe(int fd, FAR uint8_t *buff, size_t size)
   while (i < size)
     {
       ssize_t ret = read(fd, buff + i, size - i);
+
       if (ret < 0)
         {
           return -errno;
@@ -181,6 +182,7 @@ static ssize_t write_safe(int fd, FAR uint8_t *buff, size_t size)
   while (i < size)
     {
       ssize_t ret = write(fd, buff + i, size - i);
+
       if (ret < 0)
         {
           return -errno;
diff --git a/system/sensorscope/sensorscope_main.c b/system/sensorscope/sensorscope_main.c
index 9430ab08c..ddccf1d87 100644
--- a/system/sensorscope/sensorscope_main.c
+++ b/system/sensorscope/sensorscope_main.c
@@ -132,9 +132,11 @@ static void nxscope_samples_put(FAR struct nxscope_thr_env_s *envp,
 {
 #ifdef CONFIG_SENSORS_USE_B16
   FAR b16_t *data = (b16_t *)&tmp->data[offset];
+
   nxscope_put_vb16(&envp->nxs, tmp->chanid, data, tmp->info->dim);
 #else
   FAR float *data = (float *)&tmp->data[offset];
+
   nxscope_put_vfloat(&envp->nxs, tmp->chanid, data, tmp->info->dim);
 #endif
 }
diff --git a/system/ymodem/rb_main.c b/system/ymodem/rb_main.c
index 983cc84b4..b282aa341 100644
--- a/system/ymodem/rb_main.c
+++ b/system/ymodem/rb_main.c
@@ -74,6 +74,7 @@ static int flush_data(FAR struct ymodem_priv_s *priv)
       while (i < size)
         {
           ssize_t ret = write(priv->fd, buffer + i, size - i);
+
           if (ret < 0)
             {
               return -errno;
@@ -124,6 +125,7 @@ static int write_data(FAR struct ymodem_priv_s *priv,
       while (i < size)
         {
           ssize_t ret = circbuf_write(&priv->circ, data + i, size - i);
+
           if (ret < 0)
             {
               pthread_mutex_unlock(&priv->mutex);
@@ -156,6 +158,7 @@ static int write_data(FAR struct ymodem_priv_s *priv,
       while (i < size)
         {
           ssize_t ret = write(priv->fd, data + i, size - i);
+
           if (ret < 0)
             {
               return -errno;
@@ -477,7 +480,7 @@ int main(int argc, FAR char *argv[])
           goto out;
         }
 
-        ctx.sendfd = ctx.recvfd;
+      ctx.sendfd = ctx.recvfd;
     }
   else
     {
diff --git a/system/ymodem/sb_main.c b/system/ymodem/sb_main.c
index 7a5c447e4..971dac4ac 100644
--- a/system/ymodem/sb_main.c
+++ b/system/ymodem/sb_main.c
@@ -36,7 +36,7 @@
 #include "ymodem.h"
 
 /****************************************************************************
- * Private Typess
+ * Private Types
  ****************************************************************************/
 
 struct ymodem_priv_s
@@ -284,7 +284,7 @@ static void show_usage(FAR const char *progname)
           "\t-r|--retry <retry>: Number of retries."
           "Will try <retry> times to transmitting, Default:100\n");
   fprintf(stderr,
-          "\t-k <size>: Use a custom size to tansfer, Default: 1kB\n");
+          "\t-k <size>: Use a custom size to transfer, Default: 1kB\n");
 
   exit(EXIT_FAILURE);
 }
@@ -359,7 +359,7 @@ int main(int argc, FAR char *argv[])
           return -errno;
         }
 
-        ctx.sendfd = ctx.recvfd;
+      ctx.sendfd = ctx.recvfd;
     }
   else
     {
diff --git a/testing/drivers/drivertest/drivertest_block.c b/testing/drivers/drivertest/drivertest_block.c
index cc88a9d09..2a111ce93 100644
--- a/testing/drivers/drivertest/drivertest_block.c
+++ b/testing/drivers/drivertest/drivertest_block.c
@@ -127,6 +127,7 @@ static void parse_commandline(int argc, FAR char **argv,
 static inline char blktest_randchar(void)
 {
   int value = rand() % 63;
+
   if (value == 0)
     {
       return '0';
@@ -155,6 +156,7 @@ static void blktest_randcontext(uint32_t size, FAR void *input)
 
   int i;
   FAR char *tmp;
+
   tmp = input;
   for (i = 0; i < size - 1; i++)
     {
diff --git a/testing/drivers/drivertest/drivertest_i2c_spi.c b/testing/drivers/drivertest/drivertest_i2c_spi.c
index 870304325..7fc8a63d8 100644
--- a/testing/drivers/drivertest/drivertest_i2c_spi.c
+++ b/testing/drivers/drivertest/drivertest_i2c_spi.c
@@ -80,6 +80,7 @@ static void show_usage(FAR const char *progname,
 static int setup(FAR void **state)
 {
   FAR struct test_state_s *test_state;
+
   test_state = (FAR struct test_state_s *)*state;
   test_state->fd = open(test_state->dev_path, O_RDONLY);
   assert_true(test_state->fd > 0);
@@ -94,6 +95,7 @@ static int setup(FAR void **state)
 static int teardown(FAR void **state)
 {
   FAR struct test_state_s *test_state;
+
   test_state = (FAR struct test_state_s *)*state;
   assert_int_equal(close(test_state->fd), 0);
   return 0;
diff --git a/testing/drivers/drivertest/drivertest_pm_smp.c b/testing/drivers/drivertest/drivertest_pm_smp.c
index 41115d18f..0373301ca 100644
--- a/testing/drivers/drivertest/drivertest_pm_smp.c
+++ b/testing/drivers/drivertest/drivertest_pm_smp.c
@@ -117,6 +117,7 @@ static int test_pm_fake_driver_init(void)
   for (int i = 0; i < CONFIG_SMP_NCPUS; i++)
     {
       struct test_pm_entry_s *entry = &g_test_pm_smp.entry[i];
+
       entry->cpu                    = i;
       CPU_ZERO(&entry->cpuset);
       CPU_SET(i, &entry->cpuset);
@@ -127,6 +128,7 @@ static int test_pm_fake_driver_init(void)
       for (int state = 0; state < PM_COUNT; state++)
         {
           char name[32];
+
           snprintf(name, sizeof(name), "cpu%d-%s", i, test_pm_name[state]);
           pm_wakelock_init(
               &entry->wakelock[state], name, entry->domain, state);
@@ -141,6 +143,7 @@ static int test_pm_callback_prepare(FAR struct pm_callback_s *cb,
                                     enum pm_state_e pmstate)
 {
   struct test_pm_entry_s *entry;
+
   entry = container_of(cb, struct test_pm_entry_s, cb);
   if (entry->fail_request)
     {
@@ -155,6 +158,7 @@ static void test_pm_callback_notify(FAR struct pm_callback_s *cb,
                                     enum pm_state_e pmstate)
 {
   struct test_pm_entry_s *entry;
+
   entry = container_of(cb, struct test_pm_entry_s, cb);
   switch (pmstate)
     {
@@ -187,6 +191,7 @@ static void test_pm_smp_yield(void)
 static void test_pm_smp_naps(void)
 {
   int r = random() % (TEST_SNAP_TICK_MAX * USEC_PER_TICK);
+
   usleep(r + USEC_PER_TICK * 2);
 }
 
@@ -438,6 +443,7 @@ static void drivertest_pm_smp(FAR void **argv)
     {
       struct test_pm_entry_s *entry = &g_test_pm_smp.entry[i];
       pthread_attr_t attr;
+
       pthread_attr_init(&attr);
       pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &entry->cpuset);
       attr.priority = CONFIG_SCHED_HPWORKPRIORITY + 1;
@@ -449,6 +455,7 @@ static void drivertest_pm_smp(FAR void **argv)
       struct test_pm_entry_s *entry = &g_test_pm_smp.entry[i];
       pthread_addr_t pthread_ret;
       int ret;
+
       pthread_join(entry->tid, &pthread_ret);
       ret = (uintptr_t)pthread_ret;
       assert_int_equal(ret, 0);
diff --git a/testing/drivers/pcitest/pcitest.c b/testing/drivers/pcitest/pcitest.c
index 684498d24..79261b56f 100644
--- a/testing/drivers/pcitest/pcitest.c
+++ b/testing/drivers/pcitest/pcitest.c
@@ -286,93 +286,94 @@ int main(int argc, FAR char *argv[])
 
   while ((c = getopt(argc, argv, "D:b:m:x:i:deIlhrwcs:")) != EOF)
     {
-    switch (c)
-      {
-        case 'D':
-          test->device = optarg;
-          continue;
-        case 'b':
-          test->barnum = atoi(optarg);
-          if (test->barnum < 0 || test->barnum > 5)
-            {
-              goto usage;
-            }
-
-          continue;
-        case 'l':
-          test->legacyirq = true;
-          continue;
-        case 'm':
-          test->msinum = atoi(optarg);
-          if (test->msinum < 1 || test->msinum > 32)
-            {
-              goto usage;
-            }
-
-          continue;
-        case 'x':
-          test->msixnum = atoi(optarg);
-          if (test->msixnum < 1 || test->msixnum > 2048)
-            {
-              goto usage;
-            }
-
-          continue;
-        case 'i':
-          test->irqtype = atoi(optarg);
-          if (test->irqtype < 0 || test->irqtype > 2)
-            {
-              goto usage;
-            }
-
-          test->set_irqtype = true;
-          continue;
-        case 'I':
-          test->get_irqtype = true;
-          continue;
-        case 'r':
-          test->read = true;
-          continue;
-        case 'w':
-          test->write = true;
-          continue;
-        case 'c':
-          test->copy = true;
-          continue;
-        case 'e':
-          test->clear_irq = true;
-          continue;
-        case 's':
-          test->size = strtoul(optarg, NULL, 0);
-          continue;
-        case 'd':
-          test->use_dma = true;
-          continue;
-        case 'h':
-        default:
+      switch (c)
+        {
+          case 'D':
+            test->device = optarg;
+            continue;
+          case 'b':
+            test->barnum = atoi(optarg);
+            if (test->barnum < 0 || test->barnum > 5)
+              {
+                goto usage;
+              }
+
+            continue;
+          case 'l':
+            test->legacyirq = true;
+            continue;
+          case 'm':
+            test->msinum = atoi(optarg);
+            if (test->msinum < 1 || test->msinum > 32)
+              {
+                goto usage;
+              }
+
+            continue;
+          case 'x':
+            test->msixnum = atoi(optarg);
+            if (test->msixnum < 1 || test->msixnum > 2048)
+              {
+                goto usage;
+              }
+
+            continue;
+          case 'i':
+            test->irqtype = atoi(optarg);
+            if (test->irqtype < 0 || test->irqtype > 2)
+              {
+                goto usage;
+              }
+
+            test->set_irqtype = true;
+            continue;
+          case 'I':
+            test->get_irqtype = true;
+            continue;
+          case 'r':
+            test->read = true;
+            continue;
+          case 'w':
+            test->write = true;
+            continue;
+          case 'c':
+            test->copy = true;
+            continue;
+          case 'e':
+            test->clear_irq = true;
+            continue;
+          case 's':
+            test->size = strtoul(optarg, NULL, 0);
+            continue;
+          case 'd':
+            test->use_dma = true;
+            continue;
+          case 'h':
+          default:
 usage:
-          fprintf(stderr,
-            "usage: %s [options]\n"
-            "Options:\n"
-            "\t-D <dev> \n"
-            "\t    PCI e test device {default: /dev/pci-ep-test.0}\n"
-            "\t-b <bar num>     BAR test (bar number between 0..5)\n"
-            "\t-m <msi num>     MSI test (msi number between 1..32)\n"
-            "\t-x <msix num>    \tMSI-X test (msix number between 1..2048)\n"
-            "\t-i <irq type>  \n"
-            "\t    Set IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n"
-            "\t-e           Clear IRQ\n"
-            "\t-I           Get current IRQ type configured\n"
-            "\t-d           Use DMA\n"
-            "\t-l           Legacy IRQ test\n"
-            "\t-r           Read buffer test\n"
-            "\t-w           Write buffer test\n"
-            "\t-c           Copy buffer test\n"
-            "\t-s <size>        Size of buffer {default: 100KB}\n"
-            "\t-h           Print this help message\n",
-            argv[0]);
+            fprintf(stderr,
+              "usage: %s [options]\n"
+              "Options:\n"
+              "\t-D <dev> \n"
+              "\t    PCI e test device {default: /dev/pci-ep-test.0}\n"
+              "\t-b <bar num>     BAR test (bar number between 0..5)\n"
+              "\t-m <msi num>     MSI test (msi number between 1..32)\n"
+              "\t-x <msix num>    \tMSI-X test "
+              "(msix number between 1..2048)\n"
+              "\t-i <irq type>  \n"
+              "\t    Set IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n"
+              "\t-e           Clear IRQ\n"
+              "\t-I           Get current IRQ type configured\n"
+              "\t-d           Use DMA\n"
+              "\t-l           Legacy IRQ test\n"
+              "\t-r           Read buffer test\n"
+              "\t-w           Write buffer test\n"
+              "\t-c           Copy buffer test\n"
+              "\t-s <size>        Size of buffer {default: 100KB}\n"
+              "\t-h           Print this help message\n",
+              argv[0]);
             return -EINVAL;
-      }
+        }
     }
 
   return run_test(test);
diff --git a/testing/drivers/ser/ser.c b/testing/drivers/ser/ser.c
index ca5820c74..00ed25bd0 100644
--- a/testing/drivers/ser/ser.c
+++ b/testing/drivers/ser/ser.c
@@ -78,7 +78,7 @@ int main(int argc, FAR char *argv[])
 
       if (rcount.brk > scount.brk)
         {
-           printf("ERROR: break %d\n", rcount.brk - scount.brk);
+          printf("ERROR: break %d\n", rcount.brk - scount.brk);
         }
 
       if (rcount.buf_overrun > scount.buf_overrun)
diff --git a/testing/drivers/setest/setest.c b/testing/drivers/setest/setest.c
index 4ac3e3c88..3fd66ff1a 100644
--- a/testing/drivers/setest/setest.c
+++ b/testing/drivers/setest/setest.c
@@ -80,21 +80,22 @@ static int parse_arguments(int argc, FAR char *argv[],
   int result = 0;
   int opt;
   FAR char *prg = basename(argv[0]);
+
   while (((opt = getopt(argc, argv, "b:h")) != -1) && (result == 0))
     {
       switch (opt)
         {
-        case 'b':
-          settings->base_id = (uint32_t)strtoul(optarg, NULL, 0);
-          break;
-        case 'h':
-          print_usage(stdout, prg);
-          settings->skip_process = TRUE;
-          break;
-        default:
-          print_usage(stderr, prg);
-          result = -EINVAL;
-          break;
+          case 'b':
+            settings->base_id = (uint32_t)strtoul(optarg, NULL, 0);
+            break;
+          case 'h':
+            print_usage(stdout, prg);
+            settings->skip_process = TRUE;
+            break;
+          default:
+            print_usage(stderr, prg);
+            result = -EINVAL;
+            break;
         }
     }
 
@@ -138,6 +139,7 @@ static int invert_result(int result)
 static int run_tests(int fd, FAR struct settings_t *settings)
 {
   int result = 0;
+
   puts("Setup");
   for (uint32_t id = get_se05x_id(settings, 1);
        id < get_se05x_id(settings, 5); id++)
@@ -164,6 +166,7 @@ static int run_tests(int fd, FAR struct settings_t *settings)
 
   uint8_t public_key[300];
   size_t public_key_size;
+
   if (result == 0)
     {
       puts("Read from pub #1");
@@ -207,6 +210,7 @@ static int run_tests(int fd, FAR struct settings_t *settings)
 
   uint8_t signature[300];
   size_t signature_content_size;
+
   if (result == 0)
     {
       puts("Create signature with priv #1");
@@ -263,6 +267,7 @@ static int run_tests(int fd, FAR struct settings_t *settings)
     }
 
   uint8_t symm_key_a[32];
+
   if (result == 0)
     {
       puts("Derive symm key #a from priv #1 and pub #2");
@@ -280,6 +285,7 @@ static int run_tests(int fd, FAR struct settings_t *settings)
     }
 
   uint8_t symm_key_b[32];
+
   if (result == 0)
     {
       puts("Derive symm key #b from priv #2 and pub #1");
@@ -297,6 +303,7 @@ static int run_tests(int fd, FAR struct settings_t *settings)
     }
 
   uint8_t symm_key_c[32];
+
   if (result == 0)
     {
       puts("Derive symm key #c from priv #1 and pub #3");
@@ -350,6 +357,7 @@ int main(int argc, FAR char *argv[])
   int result = parse_arguments(argc, argv, &settings);
 
   int fd;
+
   if ((result == 0) && (!settings.skip_process))
     {
       fd = open(settings.se05x_dev, O_RDONLY);
diff --git a/testing/fs/fdsantest/fdsantest_simple.c b/testing/fs/fdsantest/fdsantest_simple.c
index 114f0aeeb..a045fe7ff 100644
--- a/testing/fs/fdsantest/fdsantest_simple.c
+++ b/testing/fs/fdsantest/fdsantest_simple.c
@@ -100,9 +100,11 @@ static void test_case_overflow(void **state)
 static void test_case_vfork(void **state)
 {
   int fd = open("/dev/null", O_RDONLY);
+
   android_fdsan_exchange_owner_tag(fd, 0, 0xbadc0de);
 
   pid_t rc = vfork();
+
   assert_int_not_equal(-1, rc);
 
   if (rc == 0)
diff --git a/testing/mm/cachetest/cachetest_main.c b/testing/mm/cachetest/cachetest_main.c
index 2916932c8..ddbf7951b 100644
--- a/testing/mm/cachetest/cachetest_main.c
+++ b/testing/mm/cachetest/cachetest_main.c
@@ -170,6 +170,7 @@ static void cachetest_teardown(FAR struct cachetest_s *info)
 static inline char cachetest_randchar(void)
 {
   int value = random() % 63;
+
   if (value == 0)
     {
       return '0';
@@ -198,6 +199,7 @@ static void cachetest_randcontext(uint32_t size, FAR void *input)
 
   int i;
   FAR char *tmp;
+
   tmp = input;
   for (i = 0; i < size - 1; i++)
     {
diff --git a/wireless/ieee802154/i8sak/i8sak_acceptassoc.c b/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
index 42d54288d..beffea18f 100644
--- a/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
+++ b/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
@@ -162,7 +162,7 @@ static void acceptassoc_eventcb(FAR struct ieee802154_primitive_s *primitive,
 
   printf("i8sak: a device is trying to associate\n");
 
-  /* Send a ASSOC.resp primtive to the MAC. Copy the association
+  /* Send a ASSOC.resp primitive to the MAC. Copy the association
    * indication address into the association response primitive
    */
 


(nuttx-apps) 02/02: apps: Include the headers that are used.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c56e79394c2998ca2369e0737925ab77c504da83
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Mon Oct 12 08:42:56 2026 +0200

    apps: Include the headers that are used.
    
    These files use declarations from stdlib.h, unistd.h, pthread.h and
    other headers without including them.  They got the declarations only
    because stdio.h included nuttx/lib/lib.h, and through it stdlib.h,
    nuttx/sched.h and more.
    
    - stdlib.h: adjtime, ads7046, audio_rttl, baromonitor, bmp280, hx711,
      netpkt_ethercat, nimble_blecent (main, peer), nimble_bleprph (main,
      gatt_svr), shv-test, stepper, tmp112, dhcpd, netlib_iptables,
      netlib_ip6tables, adcscope, iptables, ip6tables, nxdiag, sensorscope,
      nxboot boot.c, nand_sim, pcitest, cachetest, ymodem rb and sb.
    - unistd.h: nxboot boot.c and flash.c, fbcon, netpkt_ethercat,
      nimble_blecent, nimble_bleprph, shv-test, stepper, watched,
      lapi_other, ofloader, nand_sim, ser, setest, drivertest_block,
      drivertest_i2c_spi, drivertest_relay, epoll, fdsantest_simple,
      memfd_test, i8sak_acceptassoc, passwd_delete, plcatool.  NXDoom: in
      i_timer.h, which every file that calls usleep() includes.
    - pthread.h: camera_bkgd, mqttc_pub, nxterm, pty_test, pwfb_events,
      pwlines_events, ofloader, epoll, memfd_test, ostest
      sched_thread_local.c and i8sak.h.
    - sched.h: ble_main, calib_udelay, drivertest_pm_smp.
      nuttx/atomic.h: the atomic test.  nuttx/kmalloc.h: nand_sim,
      drivertest_block.
    - testing/cmocka: the downloaded cmocka.c uses ftruncate(); include
      unistd.h in cmocka_platform.h, which cmocka.c includes.
    - system/zlib: the downloaded gzlib.c, gzread.c and gzwrite.c use
      lseek(), read() and write(); make zconf.h include unistd.h, as
      zlib's configure does on Unix.
    - interpreters/wamr: the NuttX platform of older WAMR versions (sim:wamr
      pins one) uses the pthread types without including pthread.h; build
      WAMR with -include pthread.h.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 boot/nxboot/loader/boot.c                       | 2 ++
 boot/nxboot/loader/flash.c                      | 1 +
 examples/adjtime/adjtime_main.c                 | 1 +
 examples/ads7046/ads7046_main.c                 | 1 +
 examples/audio_rttl/audio_rttl_main.c           | 1 +
 examples/baromonitor/baromonitor_main.c         | 1 +
 examples/ble/ble_main.c                         | 1 +
 examples/bmp280/bmp280_main.c                   | 1 +
 examples/calib_udelay/calib_udelay_main.c       | 1 +
 examples/camera/camera_bkgd.c                   | 1 +
 examples/fbcon/fbcon_main.c                     | 1 +
 examples/hx711/hx711_main.c                     | 1 +
 examples/mqttc/mqttc_pub.c                      | 1 +
 examples/netpkt/netpkt_ethercat.c               | 2 ++
 examples/nimble_blecent/nimble_blecent_main.c   | 2 ++
 examples/nimble_blecent/peer.c                  | 1 +
 examples/nimble_bleprph/gatt_svr.c              | 1 +
 examples/nimble_bleprph/nimble_bleprph_main.c   | 2 ++
 examples/nxterm/nxterm_main.c                   | 1 +
 examples/pty_test/pty_test.c                    | 1 +
 examples/pwfb/pwfb_events.c                     | 1 +
 examples/pwlines/pwlines_events.c               | 1 +
 examples/shv-test/shv_test.c                    | 2 ++
 examples/stepper/stepper.c                      | 2 ++
 examples/tmp112/tmp112_main.c                   | 1 +
 examples/watched/watched.c                      | 1 +
 fsutils/passwd/passwd_delete.c                  | 1 +
 games/NXDoom/src/i_timer.h                      | 6 ++++++
 interpreters/wamr/CMakeLists.txt                | 5 +++++
 interpreters/wamr/Makefile                      | 5 +++++
 lte/lapi/src/lapi_other.c                       | 1 +
 netutils/dhcpd/dhcpd.c                          | 1 +
 netutils/netlib/netlib_ip6tables.c              | 1 +
 netutils/netlib/netlib_iptables.c               | 1 +
 netutils/plcatool/plcatool.c                    | 1 +
 system/adcscope/adcscope_main.c                 | 1 +
 system/iptables/ip6tables.c                     | 1 +
 system/iptables/iptables.c                      | 1 +
 system/nxdiag/nxdiag.c                          | 1 +
 system/ofloader/ofloader.c                      | 2 ++
 system/sensorscope/sensorscope_main.c           | 1 +
 system/ymodem/rb_main.c                         | 1 +
 system/ymodem/sb_main.c                         | 1 +
 system/zlib/CMakeLists.txt                      | 8 ++++++++
 system/zlib/Makefile                            | 5 +++++
 testing/cmocka/cmocka_platform.h                | 1 +
 testing/drivers/drivertest/drivertest_block.c   | 2 ++
 testing/drivers/drivertest/drivertest_i2c_spi.c | 1 +
 testing/drivers/drivertest/drivertest_pm_smp.c  | 1 +
 testing/drivers/drivertest/drivertest_relay.c   | 1 +
 testing/drivers/nand_sim/nand_sim_main.c        | 3 +++
 testing/drivers/pcitest/pcitest.c               | 1 +
 testing/drivers/ser/ser.c                       | 1 +
 testing/drivers/setest/setest.c                 | 1 +
 testing/fs/epoll/epoll.c                        | 2 ++
 testing/fs/fdsantest/fdsantest_simple.c         | 1 +
 testing/fs/memfd/memfd_test.c                   | 2 ++
 testing/libc/atomic/atomic_main.c               | 1 +
 testing/mm/cachetest/cachetest_main.c           | 1 +
 testing/ostest/sched_thread_local.c             | 1 +
 wireless/ieee802154/i8sak/i8sak.h               | 1 +
 wireless/ieee802154/i8sak/i8sak_acceptassoc.c   | 1 +
 62 files changed, 98 insertions(+)

diff --git a/boot/nxboot/loader/boot.c b/boot/nxboot/loader/boot.c
index 54ac92678..b2b350e42 100644
--- a/boot/nxboot/loader/boot.c
+++ b/boot/nxboot/loader/boot.c
@@ -34,6 +34,8 @@
 
 #include <nuttx/crc32.h>
 #include <nxboot.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include "flash.h"
 
diff --git a/boot/nxboot/loader/flash.c b/boot/nxboot/loader/flash.c
index ab6a24320..50ef92930 100644
--- a/boot/nxboot/loader/flash.c
+++ b/boot/nxboot/loader/flash.c
@@ -33,6 +33,7 @@
 #include <stddef.h>
 #include <fcntl.h>
 #include <syslog.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
diff --git a/examples/adjtime/adjtime_main.c b/examples/adjtime/adjtime_main.c
index fefe80567..1ec96e6ff 100644
--- a/examples/adjtime/adjtime_main.c
+++ b/examples/adjtime/adjtime_main.c
@@ -27,6 +27,7 @@
 #include <nuttx/config.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/time.h>
 
 /****************************************************************************
diff --git a/examples/ads7046/ads7046_main.c b/examples/ads7046/ads7046_main.c
index 1b0ca7253..8fd61a53a 100644
--- a/examples/ads7046/ads7046_main.c
+++ b/examples/ads7046/ads7046_main.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 #include <nuttx/analog/ioctl.h>
 #include <nuttx/analog/ads7046.h>
diff --git a/examples/audio_rttl/audio_rttl_main.c b/examples/audio_rttl/audio_rttl_main.c
index 4c0389bd7..6d1e29326 100644
--- a/examples/audio_rttl/audio_rttl_main.c
+++ b/examples/audio_rttl/audio_rttl_main.c
@@ -29,6 +29,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include <sys/ioctl.h>
 
diff --git a/examples/baromonitor/baromonitor_main.c b/examples/baromonitor/baromonitor_main.c
index c3a93d6b9..3f6044f61 100644
--- a/examples/baromonitor/baromonitor_main.c
+++ b/examples/baromonitor/baromonitor_main.c
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 #include <uORB/uORB.h>
 
diff --git a/examples/ble/ble_main.c b/examples/ble/ble_main.c
index 7afb2eedd..966b4318a 100644
--- a/examples/ble/ble_main.c
+++ b/examples/ble/ble_main.c
@@ -26,6 +26,7 @@
 
 #include <nuttx/config.h>
 #include <pthread.h>
+#include <sched.h>
 #include "sensors.h"
 
 extern void setup_ble(void);
diff --git a/examples/bmp280/bmp280_main.c b/examples/bmp280/bmp280_main.c
index 1b8fdde88..97279074c 100644
--- a/examples/bmp280/bmp280_main.c
+++ b/examples/bmp280/bmp280_main.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <nuttx/sensors/sensor.h>
 
 /****************************************************************************
diff --git a/examples/calib_udelay/calib_udelay_main.c b/examples/calib_udelay/calib_udelay_main.c
index 1c9a822f9..509434aa1 100644
--- a/examples/calib_udelay/calib_udelay_main.c
+++ b/examples/calib_udelay/calib_udelay_main.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
+#include <sched.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/examples/camera/camera_bkgd.c b/examples/camera/camera_bkgd.c
index a0c0bd2fa..78ff81dc6 100644
--- a/examples/camera/camera_bkgd.c
+++ b/examples/camera/camera_bkgd.c
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <semaphore.h>
 #include <errno.h>
+#include <pthread.h>
 #include <nuttx/debug.h>
 #include <sys/boardctl.h>
 
diff --git a/examples/fbcon/fbcon_main.c b/examples/fbcon/fbcon_main.c
index 40edc91f8..9a16f7723 100644
--- a/examples/fbcon/fbcon_main.c
+++ b/examples/fbcon/fbcon_main.c
@@ -44,6 +44,7 @@
 #include <spawn.h>
 #include <nuttx/debug.h>
 #include <poll.h>
+#include <unistd.h>
 #include <nuttx/ascii.h>
 #include <nuttx/lib/builtin.h>
 
diff --git a/examples/hx711/hx711_main.c b/examples/hx711/hx711_main.c
index 28258dc5d..e3b847713 100644
--- a/examples/hx711/hx711_main.c
+++ b/examples/hx711/hx711_main.c
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 
 /****************************************************************************
diff --git a/examples/mqttc/mqttc_pub.c b/examples/mqttc/mqttc_pub.c
index 0e5999599..195e988a1 100644
--- a/examples/mqttc/mqttc_pub.c
+++ b/examples/mqttc/mqttc_pub.c
@@ -33,6 +33,7 @@
 #include <netdb.h>
 #include <errno.h>
 #include <mqtt.h>
+#include <pthread.h>
 
 #ifdef MQTT_USE_MBEDTLS
 #  include <inttypes.h>
diff --git a/examples/netpkt/netpkt_ethercat.c b/examples/netpkt/netpkt_ethercat.c
index ea24791a7..683a2f579 100644
--- a/examples/netpkt/netpkt_ethercat.c
+++ b/examples/netpkt/netpkt_ethercat.c
@@ -29,6 +29,8 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <time.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include <net/if.h>
 #include <netinet/if_ether.h>
diff --git a/examples/nimble_blecent/nimble_blecent_main.c b/examples/nimble_blecent/nimble_blecent_main.c
index 1d78e6d11..faec78daf 100644
--- a/examples/nimble_blecent/nimble_blecent_main.c
+++ b/examples/nimble_blecent/nimble_blecent_main.c
@@ -26,6 +26,8 @@
 
 #include <assert.h>
 #include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 /* BLE */
 
diff --git a/examples/nimble_blecent/peer.c b/examples/nimble_blecent/peer.c
index 16ebd7872..b0e889ce4 100644
--- a/examples/nimble_blecent/peer.c
+++ b/examples/nimble_blecent/peer.c
@@ -26,6 +26,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <stdlib.h>
 #include "host/ble_hs.h"
 #include "blecent.h"
 
diff --git a/examples/nimble_bleprph/gatt_svr.c b/examples/nimble_bleprph/gatt_svr.c
index 38efeefd1..aff7940d7 100644
--- a/examples/nimble_bleprph/gatt_svr.c
+++ b/examples/nimble_bleprph/gatt_svr.c
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include "host/ble_hs.h"
 #include "host/ble_uuid.h"
 #include "services/ans/ble_svc_ans.h"
diff --git a/examples/nimble_bleprph/nimble_bleprph_main.c b/examples/nimble_bleprph/nimble_bleprph_main.c
index 9c41f72b2..4d1cd4463 100644
--- a/examples/nimble_bleprph/nimble_bleprph_main.c
+++ b/examples/nimble_bleprph/nimble_bleprph_main.c
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 /* BLE */
 
diff --git a/examples/nxterm/nxterm_main.c b/examples/nxterm/nxterm_main.c
index afe6f34ba..a544934e8 100644
--- a/examples/nxterm/nxterm_main.c
+++ b/examples/nxterm/nxterm_main.c
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
+#include <pthread.h>
 #include <nuttx/debug.h>
 
 #ifdef CONFIG_NX_LCDDRIVER
diff --git a/examples/pty_test/pty_test.c b/examples/pty_test/pty_test.c
index 25c4c9fe0..15b519f1d 100644
--- a/examples/pty_test/pty_test.c
+++ b/examples/pty_test/pty_test.c
@@ -35,6 +35,7 @@
 #include <poll.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <pthread.h>
 #include <sys/ioctl.h>
 
 #include <nuttx/serial/pty.h>
diff --git a/examples/pwfb/pwfb_events.c b/examples/pwfb/pwfb_events.c
index bec7a845a..741279aea 100644
--- a/examples/pwfb/pwfb_events.c
+++ b/examples/pwfb/pwfb_events.c
@@ -33,6 +33,7 @@
 #include <semaphore.h>
 #include <nuttx/debug.h>
 #include <errno.h>
+#include <pthread.h>
 
 #include <nuttx/nx/nx.h>
 #include <nuttx/nx/nxtk.h>
diff --git a/examples/pwlines/pwlines_events.c b/examples/pwlines/pwlines_events.c
index 3dcd0504c..c7da7d096 100644
--- a/examples/pwlines/pwlines_events.c
+++ b/examples/pwlines/pwlines_events.c
@@ -33,6 +33,7 @@
 #include <semaphore.h>
 #include <nuttx/debug.h>
 #include <errno.h>
+#include <pthread.h>
 
 #include <nuttx/nx/nx.h>
 #include <nuttx/nx/nxtk.h>
diff --git a/examples/shv-test/shv_test.c b/examples/shv-test/shv_test.c
index 1d2d1acf9..1b69bb24d 100644
--- a/examples/shv-test/shv_test.c
+++ b/examples/shv-test/shv_test.c
@@ -37,6 +37,8 @@
 #include <signal.h>
 #include <semaphore.h>
 #include <stdbool.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Function Prototypes
diff --git a/examples/stepper/stepper.c b/examples/stepper/stepper.c
index 2d9acdaff..c2f7e6180 100644
--- a/examples/stepper/stepper.c
+++ b/examples/stepper/stepper.c
@@ -28,6 +28,8 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdbool.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/motor/stepper.h>
 
diff --git a/examples/tmp112/tmp112_main.c b/examples/tmp112/tmp112_main.c
index 0fbf6f0f9..9af75a208 100644
--- a/examples/tmp112/tmp112_main.c
+++ b/examples/tmp112/tmp112_main.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 /****************************************************************************
  * Public Functions
diff --git a/examples/watched/watched.c b/examples/watched/watched.c
index 9013590a0..07ab6be28 100644
--- a/examples/watched/watched.c
+++ b/examples/watched/watched.c
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include "watched.h"
 #include <signal.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Definitions
diff --git a/fsutils/passwd/passwd_delete.c b/fsutils/passwd/passwd_delete.c
index 3dbc49fdd..fe620af93 100644
--- a/fsutils/passwd/passwd_delete.c
+++ b/fsutils/passwd/passwd_delete.c
@@ -29,6 +29,7 @@
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <assert.h>
 #include <errno.h>
 
diff --git a/games/NXDoom/src/i_timer.h b/games/NXDoom/src/i_timer.h
index eb9d7756c..e731beca4 100644
--- a/games/NXDoom/src/i_timer.h
+++ b/games/NXDoom/src/i_timer.h
@@ -24,6 +24,12 @@
 #ifndef __I_TIMER__
 #define __I_TIMER__
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <unistd.h>
+
 /****************************************************************************
  * Preprocessor Definitions
  ****************************************************************************/
diff --git a/interpreters/wamr/CMakeLists.txt b/interpreters/wamr/CMakeLists.txt
index 0803dc98e..c948bdc5b 100644
--- a/interpreters/wamr/CMakeLists.txt
+++ b/interpreters/wamr/CMakeLists.txt
@@ -58,6 +58,11 @@ if(CONFIG_INTERPRETERS_WAMR)
   include(${WAMR_DIR}/product-mini/platforms/nuttx/CMakeLists.txt)
   target_sources(wamr PRIVATE ${WAMR_SOURCES})
   target_compile_options(wamr PRIVATE ${WAMR_CFLAGS})
+
+  # The NuttX platform of older WAMR versions uses the pthread types without
+  # including pthread.h.
+
+  target_compile_options(wamr PRIVATE -include pthread.h)
   # the WAMR_INCDIRS and WAMR_DEFINITIONS already exist in the directory domain
   nuttx_add_application(
     MODULE
diff --git a/interpreters/wamr/Makefile b/interpreters/wamr/Makefile
index 4e78fa7bd..d7149952c 100644
--- a/interpreters/wamr/Makefile
+++ b/interpreters/wamr/Makefile
@@ -31,6 +31,11 @@ WAMR_URL      = $(WAMR_URL_BASE)/$(WAMR_TARBALL)
 
 -include $(WAMR_UNPACK)/product-mini/platforms/nuttx/wamr.mk
 
+# The NuttX platform of older WAMR versions uses the pthread types without
+# including pthread.h.
+
+CFLAGS += -include pthread.h
+
 VPATH += $(WAMR_UNPACK)/product-mini/platforms/nuttx
 DEPPATH += --dep-path $(WAMR_UNPACK)/product-mini/platforms/nuttx
 
diff --git a/lte/lapi/src/lapi_other.c b/lte/lapi/src/lapi_other.c
index 14a0734ec..1936a40dc 100644
--- a/lte/lapi/src/lapi_other.c
+++ b/lte/lapi/src/lapi_other.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <sys/types.h>
 #include <sys/ioctl.h>
diff --git a/netutils/dhcpd/dhcpd.c b/netutils/dhcpd/dhcpd.c
index 61842ce26..e6b469bc8 100644
--- a/netutils/dhcpd/dhcpd.c
+++ b/netutils/dhcpd/dhcpd.c
@@ -57,6 +57,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <errno.h>
+#include <stdlib.h>
 
 #include <net/if.h>
 #include <netinet/in.h>
diff --git a/netutils/netlib/netlib_ip6tables.c b/netutils/netlib/netlib_ip6tables.c
index 564de741b..cfc88335d 100644
--- a/netutils/netlib/netlib_ip6tables.c
+++ b/netutils/netlib/netlib_ip6tables.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <stdlib.h>
 
 #include <sys/socket.h>
 
diff --git a/netutils/netlib/netlib_iptables.c b/netutils/netlib/netlib_iptables.c
index 887c45f36..5bf2aab41 100644
--- a/netutils/netlib/netlib_iptables.c
+++ b/netutils/netlib/netlib_iptables.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <stdlib.h>
 
 #include <sys/socket.h>
 
diff --git a/netutils/plcatool/plcatool.c b/netutils/plcatool/plcatool.c
index 90edf2b57..75a768b45 100644
--- a/netutils/plcatool/plcatool.c
+++ b/netutils/plcatool/plcatool.c
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
 
 #include <net/if.h>
diff --git a/system/adcscope/adcscope_main.c b/system/adcscope/adcscope_main.c
index 991a756ca..aada30324 100644
--- a/system/adcscope/adcscope_main.c
+++ b/system/adcscope/adcscope_main.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 #include <nuttx/analog/adc.h>
 #include <nuttx/analog/ioctl.h>
diff --git a/system/iptables/ip6tables.c b/system/iptables/ip6tables.c
index e15e26685..7702985b2 100644
--- a/system/iptables/ip6tables.c
+++ b/system/iptables/ip6tables.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <stdlib.h>
 
 #include <arpa/inet.h>
 
diff --git a/system/iptables/iptables.c b/system/iptables/iptables.c
index ad0eec099..8ec7feb86 100644
--- a/system/iptables/iptables.c
+++ b/system/iptables/iptables.c
@@ -27,6 +27,7 @@
 #include <nuttx/config.h>
 
 #include <fcntl.h>
+#include <stdlib.h>
 #include <arpa/inet.h>
 
 #include <nuttx/net/netfilter/ip_tables.h>
diff --git a/system/nxdiag/nxdiag.c b/system/nxdiag/nxdiag.c
index 062cc8f56..dbdd476f5 100644
--- a/system/nxdiag/nxdiag.c
+++ b/system/nxdiag/nxdiag.c
@@ -36,6 +36,7 @@
 #include "sysinfo.h"
 #ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
 #include <fcntl.h>
+#include <stdlib.h>
 #endif
 
 /****************************************************************************
diff --git a/system/ofloader/ofloader.c b/system/ofloader/ofloader.c
index fe6ca12e3..dbe942d74 100644
--- a/system/ofloader/ofloader.c
+++ b/system/ofloader/ofloader.c
@@ -29,6 +29,8 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <mqueue.h>
+#include <pthread.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/boardctl.h>
 
diff --git a/system/sensorscope/sensorscope_main.c b/system/sensorscope/sensorscope_main.c
index ddccf1d87..77a25caa0 100644
--- a/system/sensorscope/sensorscope_main.c
+++ b/system/sensorscope/sensorscope_main.c
@@ -37,6 +37,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <libgen.h>
+#include <stdlib.h>
 
 #include <nuttx/sensors/sensor.h>
 
diff --git a/system/ymodem/rb_main.c b/system/ymodem/rb_main.c
index b282aa341..342b6d6ff 100644
--- a/system/ymodem/rb_main.c
+++ b/system/ymodem/rb_main.c
@@ -26,6 +26,7 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <getopt.h>
 #include <pthread.h>
 
diff --git a/system/ymodem/sb_main.c b/system/ymodem/sb_main.c
index 971dac4ac..c6ba3914a 100644
--- a/system/ymodem/sb_main.c
+++ b/system/ymodem/sb_main.c
@@ -26,6 +26,7 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <getopt.h>
 #include <libgen.h>
 #include <pthread.h>
diff --git a/system/zlib/CMakeLists.txt b/system/zlib/CMakeLists.txt
index 072134047..1a7bb24ae 100644
--- a/system/zlib/CMakeLists.txt
+++ b/system/zlib/CMakeLists.txt
@@ -43,6 +43,14 @@ if(CONFIG_LIB_ZLIB)
     if(NOT zlib_fetch_POPULATED)
       FetchContent_Populate(zlib_fetch)
     endif()
+
+    # Make zconf.h include unistd.h, as zlib's configure does on Unix: gzlib.c,
+    # gzread.c and gzwrite.c use lseek(), read() and write().
+
+    file(READ ${ZLIB_DIR}/zconf.h ZCONF)
+    string(REPLACE "#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by"
+                   "#if 1    /* was set to #if 1 by" ZCONF "${ZCONF}")
+    file(WRITE ${ZLIB_DIR}/zconf.h "${ZCONF}")
   endif()
 
   # ############################################################################
diff --git a/system/zlib/Makefile b/system/zlib/Makefile
index 43a09bb50..711f3bd2e 100644
--- a/system/zlib/Makefile
+++ b/system/zlib/Makefile
@@ -41,9 +41,14 @@ $(ZLIB_ZIP):
 	@echo "Downloading: $(ZLIB_ZIP)"
 	$(Q) curl -O -L https://github.com/madler/zlib/releases/download/v1.3/zlib13.zip
 
+# Make zconf.h include unistd.h, as zlib's configure does on Unix:
+# gzlib.c, gzread.c and gzwrite.c use lseek(), read() and write().
+
 $(ZLIB_SRC) : $(ZLIB_ZIP)
 	unzip -o $(ZLIB_ZIP)
 	mv zlib-1.3 $(ZLIB_SRC)
+	sed -i.orig "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" $(ZLIB_SRC)/zconf.h
+	$(call DELFILE, $(ZLIB_SRC)/zconf.h.orig)
 
 context:: $(ZLIB_SRC)
 
diff --git a/testing/cmocka/cmocka_platform.h b/testing/cmocka/cmocka_platform.h
index 70d262500..d9ac969ea 100644
--- a/testing/cmocka/cmocka_platform.h
+++ b/testing/cmocka/cmocka_platform.h
@@ -28,6 +28,7 @@
  ****************************************************************************/
 
 #include <syslog.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/drivers/drivertest/drivertest_block.c b/testing/drivers/drivertest/drivertest_block.c
index 2a111ce93..86420c023 100644
--- a/testing/drivers/drivertest/drivertest_block.c
+++ b/testing/drivers/drivertest/drivertest_block.c
@@ -44,6 +44,8 @@
 #include <string.h>
 #include <fcntl.h>
 #include <cmocka.h>
+#include <unistd.h>
+#include <nuttx/kmalloc.h>
 
 #include "inode/inode.h"
 #include "driver/driver.h"
diff --git a/testing/drivers/drivertest/drivertest_i2c_spi.c b/testing/drivers/drivertest/drivertest_i2c_spi.c
index 7fc8a63d8..1049a79cc 100644
--- a/testing/drivers/drivertest/drivertest_i2c_spi.c
+++ b/testing/drivers/drivertest/drivertest_i2c_spi.c
@@ -38,6 +38,7 @@
 #include <nuttx/sensors/bmi160.h>
 
 #include <cmocka.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/drivers/drivertest/drivertest_pm_smp.c b/testing/drivers/drivertest/drivertest_pm_smp.c
index 0373301ca..3fd72d099 100644
--- a/testing/drivers/drivertest/drivertest_pm_smp.c
+++ b/testing/drivers/drivertest/drivertest_pm_smp.c
@@ -39,6 +39,7 @@
 #include <sys/param.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <sched.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/drivers/drivertest/drivertest_relay.c b/testing/drivers/drivertest/drivertest_relay.c
index adca1bb59..7257cbd4a 100644
--- a/testing/drivers/drivertest/drivertest_relay.c
+++ b/testing/drivers/drivertest/drivertest_relay.c
@@ -38,6 +38,7 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <cmocka.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Types
diff --git a/testing/drivers/nand_sim/nand_sim_main.c b/testing/drivers/nand_sim/nand_sim_main.c
index 48ee969e5..0bc3ca133 100644
--- a/testing/drivers/nand_sim/nand_sim_main.c
+++ b/testing/drivers/nand_sim/nand_sim_main.c
@@ -27,12 +27,15 @@
 #include <nuttx/debug.h>
 #include <sched.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include <nuttx/drivers/drivers.h>
 #include <nuttx/mtd/nand.h>
 #include <nuttx/mtd/nand_scheme.h>
 #include <nuttx/mtd/nand_ram.h>
 #include <nuttx/mtd/nand_wrapper.h>
+#include <nuttx/kmalloc.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/drivers/pcitest/pcitest.c b/testing/drivers/pcitest/pcitest.c
index 79261b56f..3ba9f2e12 100644
--- a/testing/drivers/pcitest/pcitest.c
+++ b/testing/drivers/pcitest/pcitest.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <sys/ioctl.h>
 
 #include <nuttx/pci/pci_ep_test.h>
diff --git a/testing/drivers/ser/ser.c b/testing/drivers/ser/ser.c
index 00ed25bd0..20cac3d75 100644
--- a/testing/drivers/ser/ser.c
+++ b/testing/drivers/ser/ser.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <nuttx/serial/serial.h>
 
diff --git a/testing/drivers/setest/setest.c b/testing/drivers/setest/setest.c
index 3fd66ff1a..ed2cb2b7f 100644
--- a/testing/drivers/setest/setest.c
+++ b/testing/drivers/setest/setest.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 
 /****************************************************************************
diff --git a/testing/fs/epoll/epoll.c b/testing/fs/epoll/epoll.c
index 8422c5fe7..206453f6b 100644
--- a/testing/fs/epoll/epoll.c
+++ b/testing/fs/epoll/epoll.c
@@ -40,6 +40,8 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <cmocka.h>
+#include <pthread.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/fs/fdsantest/fdsantest_simple.c b/testing/fs/fdsantest/fdsantest_simple.c
index a045fe7ff..4a9c7c133 100644
--- a/testing/fs/fdsantest/fdsantest_simple.c
+++ b/testing/fs/fdsantest/fdsantest_simple.c
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <cmocka.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Private Data
diff --git a/testing/fs/memfd/memfd_test.c b/testing/fs/memfd/memfd_test.c
index 1e72915bf..fdab7f26c 100644
--- a/testing/fs/memfd/memfd_test.c
+++ b/testing/fs/memfd/memfd_test.c
@@ -26,6 +26,8 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <pthread.h>
+#include <unistd.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/libc/atomic/atomic_main.c b/testing/libc/atomic/atomic_main.c
index a9348071b..5a2e45d88 100644
--- a/testing/libc/atomic/atomic_main.c
+++ b/testing/libc/atomic/atomic_main.c
@@ -27,6 +27,7 @@
 #include <nuttx/config.h>
 #include <stdio.h>
 #include <stdatomic.h>
+#include <nuttx/atomic.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/mm/cachetest/cachetest_main.c b/testing/mm/cachetest/cachetest_main.c
index ddbf7951b..3f0db444e 100644
--- a/testing/mm/cachetest/cachetest_main.c
+++ b/testing/mm/cachetest/cachetest_main.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <syslog.h>
+#include <stdlib.h>
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/testing/ostest/sched_thread_local.c b/testing/ostest/sched_thread_local.c
index f36d119da..9ab8bf169 100644
--- a/testing/ostest/sched_thread_local.c
+++ b/testing/ostest/sched_thread_local.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
+#include <pthread.h>
 
 #include "ostest.h"
 
diff --git a/wireless/ieee802154/i8sak/i8sak.h b/wireless/ieee802154/i8sak/i8sak.h
index 385d2c1b9..b5f826e09 100644
--- a/wireless/ieee802154/i8sak/i8sak.h
+++ b/wireless/ieee802154/i8sak/i8sak.h
@@ -28,6 +28,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <pthread.h>
 
 #include <arpa/inet.h>
 #include <netinet/in.h>
diff --git a/wireless/ieee802154/i8sak/i8sak_acceptassoc.c b/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
index beffea18f..69298d268 100644
--- a/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
+++ b/wireless/ieee802154/i8sak/i8sak_acceptassoc.c
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 #include <assert.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <nuttx/fs/ioctl.h>