Commit f28f9e43 authored by Randy Dunlap's avatar Randy Dunlap Committed by David S. Miller

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: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Cc: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 876e956f
...@@ -6,3 +6,5 @@ hostprogs-y := ifenslave ...@@ -6,3 +6,5 @@ hostprogs-y := ifenslave
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(hostprogs-y) always := $(hostprogs-y)
obj-m := timestamping/
CPPFLAGS = -I../../../include # kbuild trick to avoid linker error. Can be omitted if a module is built.
obj- := dummy.o
timestamping: timestamping.c # List of programs to build
hostprogs-y := timestamping
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS_timestamping.o += -I$(objtree)/usr/include
clean: clean:
rm -f timestamping rm -f timestamping
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <net/if.h> #include <net/if.h>
#include "asm/types.h" #include <asm/types.h>
#include "linux/net_tstamp.h" #include <linux/net_tstamp.h>
#include "linux/errqueue.h" #include <linux/errqueue.h>
#ifndef SO_TIMESTAMPING #ifndef SO_TIMESTAMPING
# define SO_TIMESTAMPING 37 # define SO_TIMESTAMPING 37
...@@ -164,7 +164,7 @@ static void printpacket(struct msghdr *msg, int res, ...@@ -164,7 +164,7 @@ static void printpacket(struct msghdr *msg, int res,
gettimeofday(&now, 0); gettimeofday(&now, 0);
printf("%ld.%06ld: received %s data, %d bytes from %s, %d bytes control messages\n", printf("%ld.%06ld: received %s data, %d bytes from %s, %zu bytes control messages\n",
(long)now.tv_sec, (long)now.tv_usec, (long)now.tv_sec, (long)now.tv_usec,
(recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular", (recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
res, res,
...@@ -173,7 +173,7 @@ static void printpacket(struct msghdr *msg, int res, ...@@ -173,7 +173,7 @@ static void printpacket(struct msghdr *msg, int res,
for (cmsg = CMSG_FIRSTHDR(msg); for (cmsg = CMSG_FIRSTHDR(msg);
cmsg; cmsg;
cmsg = CMSG_NXTHDR(msg, cmsg)) { cmsg = CMSG_NXTHDR(msg, cmsg)) {
printf(" cmsg len %d: ", cmsg->cmsg_len); printf(" cmsg len %zu: ", cmsg->cmsg_len);
switch (cmsg->cmsg_level) { switch (cmsg->cmsg_level) {
case SOL_SOCKET: case SOL_SOCKET:
printf("SOL_SOCKET "); printf("SOL_SOCKET ");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment