From 0d4ee190ec0a2eeb957404ed29ab3ac38786c545 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 25 Sep 2016 18:32:46 +0800 Subject: [PATCH] Replace deprecated bcopy() by memmove() --- src/apps_plugin.c | 14 +++++++------- src/plugin_nfacct.c | 2 +- src/plugins_d.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/apps_plugin.c b/src/apps_plugin.c index 59c27e62..31899eac 100644 --- a/src/apps_plugin.c +++ b/src/apps_plugin.c @@ -518,7 +518,7 @@ void del_pid_entry(pid_t pid) { // update pids from proc int read_proc_pid_cmdline(struct pid_stat *p) { - + if(unlikely(!p->cmdline_filename)) { char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/proc/%d/cmdline", global_host_prefix, p->pid); @@ -1273,14 +1273,14 @@ void find_lost_child_debug(struct pid_stat *pe, unsigned long long lost, int typ found++; } break; - + case 2: if(p->cmajflt > lost) { fprintf(stderr, " > process %d (%s) could use the lost exited child majflt %llu of process %d (%s)\n", p->pid, p->comm, lost, pe->pid, pe->comm); found++; } break; - + case 3: if(p->cutime > lost) { fprintf(stderr, " > process %d (%s) could use the lost exited child utime %llu of process %d (%s)\n", p->pid, p->comm, lost, pe->pid, pe->comm); @@ -1309,11 +1309,11 @@ void find_lost_child_debug(struct pid_stat *pe, unsigned long long lost, int typ case 1: fprintf(stderr, " > cannot find any process to use the lost exited child minflt %llu of process %d (%s)\n", lost, pe->pid, pe->comm); break; - + case 2: fprintf(stderr, " > cannot find any process to use the lost exited child majflt %llu of process %d (%s)\n", lost, pe->pid, pe->comm); break; - + case 3: fprintf(stderr, " > cannot find any process to use the lost exited child utime %llu of process %d (%s)\n", lost, pe->pid, pe->comm); break; @@ -2175,8 +2175,8 @@ unsigned long long send_resource_usage_to_netdata() { cpuuser = me.ru_utime.tv_sec * 1000000ULL + me.ru_utime.tv_usec; cpusyst = me.ru_stime.tv_sec * 1000000ULL + me.ru_stime.tv_usec; - bcopy(&now, &last, sizeof(struct timeval)); - bcopy(&me, &me_last, sizeof(struct rusage)); + memmove(&last, &now, sizeof(struct timeval)); + memmove(&me_last, &me, sizeof(struct rusage)); } buffer_sprintf(output, diff --git a/src/plugin_nfacct.c b/src/plugin_nfacct.c index e513e5d0..7843161d 100644 --- a/src/plugin_nfacct.c +++ b/src/plugin_nfacct.c @@ -188,7 +188,7 @@ void *nfacct_main(void *ptr) { usleep(susec); // copy current to last - bcopy(&now, &last, sizeof(struct timeval)); + memmove(&last, &now, sizeof(struct timeval)); } mnl_socket_close(nl); diff --git a/src/plugins_d.c b/src/plugins_d.c index 627cc90e..55ccd544 100644 --- a/src/plugins_d.c +++ b/src/plugins_d.c @@ -358,7 +358,7 @@ void *pluginsd_worker_thread(void *arg) error("PLUGINSD: %s sleeping for %llu. Will kill with SIGCONT pid %d to wake it up.\n", cd->fullfilename, susec, cd->pid); usleep(susec); killpid(cd->pid, SIGCONT); - bcopy(&now, &last, sizeof(struct timeval)); + memmove(&last, &now, sizeof(struct timeval)); break; } #endif -- 2.39.2