nethogs package

This commit is contained in:
Pierre Rudloff 2016-06-13 23:11:31 +02:00 committed by Yaksh Bariya
parent 177b41322e
commit 4441aaa75e
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
3 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,62 @@
diff --git a/Makefile b/Makefile
index 11c43f8..46b9589 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ SUBVERSION := 8
MINORVERSION := 1
#prefix := /usr
-prefix := /usr/local
+prefix ?= /usr/local
sbin := $(prefix)/sbin
man8 := $(prefix)/share/man/man8/
@@ -39,36 +39,36 @@ install: nethogs nethogs.8
install -m 644 nethogs.8 $(DESTDIR)$(man8)
test: test.cpp
- $(CXX) $(CXXFLAGS) $(LDFLAGS) test.cpp -o test -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) test.cpp -o test -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
nethogs: main.cpp nethogs.cpp $(OBJS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) main.cpp $(OBJS) -o nethogs -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) main.cpp $(OBJS) -o nethogs -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
nethogs_testsum: nethogs_testsum.cpp $(OBJS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) nethogs_testsum.cpp $(OBJS) -o nethogs_testsum -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) nethogs_testsum.cpp $(OBJS) -o nethogs_testsum -lpcap -lm ${NCURSES_LIBS} -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
decpcap_test: decpcap_test.cpp decpcap.o
- $(CXX) $(CXXFLAGS) $(LDFLAGS) decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm
#-lefence
refresh.o: refresh.cpp refresh.h nethogs.h
- $(CXX) $(CXXFLAGS) -c refresh.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c refresh.cpp
process.o: process.cpp process.h nethogs.h
- $(CXX) $(CXXFLAGS) -c process.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c process.cpp
packet.o: packet.cpp packet.h nethogs.h
- $(CXX) $(CXXFLAGS) -c packet.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c packet.cpp
connection.o: connection.cpp connection.h nethogs.h
- $(CXX) $(CXXFLAGS) -c connection.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c connection.cpp
decpcap.o: decpcap.c decpcap.h
- $(CC) $(CFLAGS) -c decpcap.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c decpcap.c
inode2prog.o: inode2prog.cpp inode2prog.h nethogs.h
- $(CXX) $(CXXFLAGS) -c inode2prog.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c inode2prog.cpp
conninode.o: conninode.cpp nethogs.h conninode.h
- $(CXX) $(CXXFLAGS) -c conninode.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c conninode.cpp
#devices.o: devices.cpp devices.h
# $(CXX) $(CXXFLAGS) -c devices.cpp
cui.o: cui.cpp cui.h nethogs.h
- $(CXX) $(CXXFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
.PHONY: clean
clean:

View File

@ -0,0 +1,9 @@
TERMUX_PKG_HOMEPAGE=https://github.com/raboof/nethogs
TERMUX_PKG_DESCRIPTION="Net top tool grouping bandwidth per process"
TERMUX_PKG_VERSION=0.8.1
TERMUX_PKG_SRCURL=https://github.com/raboof/nethogs/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_FOLDERNAME=nethogs-${TERMUX_PKG_VERSION}
TERMUX_PKG_DEPENDS="ncurses, libpcap"
TERMUX_PKG_MAINTAINER="Pierre Rudloff <contact@rudloff.pro>"
CPPFLAGS+=" -I./"

View File

@ -0,0 +1,12 @@
diff --git a/inode2prog.cpp b/inode2prog.cpp
index cfac566..4c1c4c5 100644
--- a/inode2prog.cpp
+++ b/inode2prog.cpp
@@ -117,7 +117,7 @@ std::string getprogname (pid_t pid) {
const int maxfilenamelen = 14 + MAX_PID_LENGTH + 1;
char filename[maxfilenamelen];
- std::snprintf(filename, maxfilenamelen, "/proc/%d/cmdline", pid);
+ snprintf(filename, maxfilenamelen, "/proc/%d/cmdline", pid);
return read_file(filename);
}