Commit f28f9e43b3d81d1e69da0ebf77c8a6780cb5e0c8

Authored by Randy Dunlap
Committed by David S. Miller
1 parent 876e956f20

timestamping: fix example build

Fix Makefiles so that Documentation/networking/timestamping/timestamping.c
will build when using the CONFIG_BUILD_DOCSRC kconfig option.
(timestamping.c does not build currently with its simple Makefile.)

Also fix printf format warnings.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 16 additions and 7 deletions Side-by-side Diff

Documentation/networking/Makefile
... ... @@ -6,4 +6,6 @@
6 6  
7 7 # Tell kbuild to always build the programs
8 8 always := $(hostprogs-y)
  9 +
  10 +obj-m := timestamping/
Documentation/networking/timestamping/Makefile
1   -CPPFLAGS = -I../../../include
  1 +# kbuild trick to avoid linker error. Can be omitted if a module is built.
  2 +obj- := dummy.o
2 3  
3   -timestamping: timestamping.c
  4 +# List of programs to build
  5 +hostprogs-y := timestamping
  6 +
  7 +# Tell kbuild to always build the programs
  8 +always := $(hostprogs-y)
  9 +
  10 +HOSTCFLAGS_timestamping.o += -I$(objtree)/usr/include
4 11  
5 12 clean:
6 13 rm -f timestamping
Documentation/networking/timestamping/timestamping.c
... ... @@ -41,9 +41,9 @@
41 41 #include <arpa/inet.h>
42 42 #include <net/if.h>
43 43  
44   -#include "asm/types.h"
45   -#include "linux/net_tstamp.h"
46   -#include "linux/errqueue.h"
  44 +#include <asm/types.h>
  45 +#include <linux/net_tstamp.h>
  46 +#include <linux/errqueue.h>
47 47  
48 48 #ifndef SO_TIMESTAMPING
49 49 # define SO_TIMESTAMPING 37
... ... @@ -164,7 +164,7 @@
164 164  
165 165 gettimeofday(&now, 0);
166 166  
167   - printf("%ld.%06ld: received %s data, %d bytes from %s, %d bytes control messages\n",
  167 + printf("%ld.%06ld: received %s data, %d bytes from %s, %zu bytes control messages\n",
168 168 (long)now.tv_sec, (long)now.tv_usec,
169 169 (recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
170 170 res,
... ... @@ -173,7 +173,7 @@
173 173 for (cmsg = CMSG_FIRSTHDR(msg);
174 174 cmsg;
175 175 cmsg = CMSG_NXTHDR(msg, cmsg)) {
176   - printf(" cmsg len %d: ", cmsg->cmsg_len);
  176 + printf(" cmsg len %zu: ", cmsg->cmsg_len);
177 177 switch (cmsg->cmsg_level) {
178 178 case SOL_SOCKET:
179 179 printf("SOL_SOCKET ");