Skip to content

Commit

Permalink
diod: log listen addresses
Browse files Browse the repository at this point in the history
Problem: it may be useful, especially when debugging, to know
what ports and interfaces diod is listening on.

Log this when diod starts up.

Update tests/misc/t15 for this change and clean up its Makefile.am.
  • Loading branch information
garlick committed Jan 20, 2025
1 parent 6d3d25d commit 5e22ace
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/libdiod/diod_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/signal.h>
#include <sys/param.h>
Expand Down Expand Up @@ -103,6 +104,10 @@ diod_rdma_listen (diod_rdma_t rdma)
if (n)
errn (n, "rdma_listen");

msg ("Listening on rdma %s:%d",
inet_ntoa (rdma->addr.sin_addr),
rdma_port);

return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions src/libdiod/diod_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ _setup_one_inet (char *host, char *port, struct pollfd **fdsp, int *nfdsp)
break;
count++;
}
if (count > 0)
msg ("Listening on %s:%s", host, port);
done:
if (res)
freeaddrinfo (res);
Expand Down Expand Up @@ -211,6 +213,7 @@ _setup_one_unix (char *path, struct pollfd **fdsp, int *nfdsp)
}
if (_poll_add (fdsp, nfdsp, fd) < 0)
goto error;
msg ("Listening on %s", path);
return 1;
error:
if (fd != -1)
Expand Down
22 changes: 2 additions & 20 deletions tests/misc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ TESTS_ENVIRONMENT += "TOP_BUILDDIR=$(top_builddir)"

TESTS = t15

CLEANFILES = *.out *.diff
CLEANFILES = *.out *.diod

AM_CFLAGS = @WARNING_CFLAGS@

AM_CPPFLAGS = \
-I$(top_srcdir) \
$(LUA_INCLUDE)

LDADD = $(top_builddir)/src/cmd/opt.o \
$(top_builddir)/src/daemon/ops.o \
$(top_builddir)/src/daemon/fid.o \
$(top_builddir)/src/daemon/exp.o \
$(top_builddir)/src/daemon/ioctx.o \
$(top_builddir)/src/daemon/xattr.o \
$(top_builddir)/src/libdiod/libdiod.a \
$(top_builddir)/src/libnpclient/libnpclient.a \
$(top_builddir)/src/libnpfs/libnpfs.a \
$(top_builddir)/src/liblsd/liblsd.a \
$(LIBPTHREAD) $(LUA_LIB) $(LIBMUNGE) $(LIBCAP) $(LIBTCMALLOC)

EXTRA_DIST = $(TESTS) $(TESTS:%=%.exp) memcheck valgrind.supp
EXTRA_DIST = $(TESTS) memcheck valgrind.supp
3 changes: 1 addition & 2 deletions tests/misc/t15
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ bg_test ()
TEST=$(basename $0 | cut -d- -f1)
sockfile=$(mktemp)
bg_test $sockfile &
${MISC_SRCDIR}/memcheck ${TOP_BUILDDIR}/src/cmd/diod -c /dev/null -n -e ctl -l $sockfile -s >$TEST.out 2>&1
diff ${MISC_SRCDIR}/$TEST.exp $TEST.out >$TEST.diff
${MISC_SRCDIR}/memcheck ${TOP_BUILDDIR}/src/cmd/diod -L $TEST.diod -c /dev/null -n -e ctl -l $sockfile -s >$TEST.out 2>&1
rm -f $sockfile
wait %1

0 comments on commit 5e22ace

Please sign in to comment.