Change the thread name of the various ndhc processes so that they can

be identified via ps/top.
This commit is contained in:
Nicholas J. Kain 2014-03-10 14:44:12 -04:00
parent 47dbf3e24d
commit df0898dfb6
2 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <sys/signalfd.h> #include <sys/signalfd.h>
#include <sys/prctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -374,6 +375,7 @@ void do_ifch_work(void)
} }
void ifch_main() { void ifch_main() {
prctl(PR_SET_NAME, "ndhc: ifch");
if (file_exists(pidfile_ifch, "w") == -1) { if (file_exists(pidfile_ifch, "w") == -1) {
log_line("FATAL - can't open ifch-pidfile '%s' for write!", log_line("FATAL - can't open ifch-pidfile '%s' for write!",
pidfile_ifch); pidfile_ifch);

View File

@ -43,6 +43,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <sys/signalfd.h> #include <sys/signalfd.h>
#include <sys/prctl.h>
#include <net/if.h> #include <net/if.h>
#include <errno.h> #include <errno.h>
#include <pwd.h> #include <pwd.h>
@ -279,6 +280,7 @@ static void create_ipc_pipes() {
} }
void ndhc_main() { void ndhc_main() {
prctl(PR_SET_NAME, "ndhc: master");
log_line("ndhc client " NDHC_VERSION " started on interface [%s].", log_line("ndhc client " NDHC_VERSION " started on interface [%s].",
client_config.interface); client_config.interface);