Skip to contentSkip to conversation

profiling: Include unistd.h to avoid compiler warnings

PATCH In review Phil Sutter 1 participant 2 messages Jun 10 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 profiling: Include unistd.h to avoid compiler warnings

RHEL8's gcc-8.5.0 emits these warnings:

src/profiling.c: In function ‘get_signalfd’:
src/profiling.c:32:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
close(fd);
^~~~~
pclose
src/profiling.c: In function ‘check_signalfd’:
src/profiling.c:42:6: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
if (read(fd, &info, sizeof(info)) < (signed)sizeof(info))

      ^~~~
      fread
Fixes 868040f892238 ("configure: Implement --enable-profiling option")
---
 src/profiling.c | 1 +
 1 file changed, 1 insertion(+)
src/profiling.c +1 -0
index 34d91cc1746ec..f9ac36bd1c183 100644
@@ -12,6 +12,7 @@
 #include <sys/signalfd.h>
 #include <signal.h>
 #include <stdio.h>
+#include <unistd.h>
 
 int get_signalfd(void)
 {
Signature · 1 line
2.54.0
author reviewer
#1 lore raw
Quoted 13 lines · Phil Sutter

RHEL8's gcc-8.5.0 emits these warnings:

src/profiling.c: In function ‘get_signalfd’:
src/profiling.c:32:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]

   close(fd);
   ^~~~~
   pclose
src/profiling.c: In function ‘check_signalfd’:
src/profiling.c:42:6: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
  if (read(fd, &info, sizeof(info)) < (signed)sizeof(info))
      ^~~~
      fread
Quoted 2 lines
Fixes 868040f892238 ("configure: Implement --enable-profiling option")

Patch applied.