On Mon, Nov 13, 2017 at 11:46 PM, QI Fuli <qi.fuli(a)jp.fujitsu.com> wrote:
This patch is used to provide helper functions needed for nvdimm
These util functions can be used by other features as well in the future.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
nvdimmd/util.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
nvdimmd/util.h | 33 ++++++++++++++++++++++++
2 files changed, 113 insertions(+)
create mode 100644 nvdimmd/util.c
create mode 100644 nvdimmd/util.h
diff --git a/nvdimmd/util.c b/nvdimmd/util.c
new file mode 100644
@@ -0,0 +1,80 @@
+ * Copyright (c) 2017, FUJITSU LIMITED. All rights reserved.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+ * more details.
+void logrotate(char *file)
+ time_t c_time;
+ char buf, tstamp;
+ c_time = time(NULL);
+ strftime(tstamp, sizeof(tstamp), ".%Y%m%d%H%M%S",
+ strcpy(buf, file);
+ strcat(buf, tstamp);
+ rename(file, buf);
Why does the monitor need to rotate logs? This should be the
responsibility of whatever is consuming the nvdimmd events.