+void get_cur_epoch() {
+ int fd;
+ fd = open("/tmp/fprobe_last_epoch",O_RDONLY);
+ if (fd != -1) {
+ char snum[7];
+ ssize_t len;
+ len = read(fd, snum, sizeof(snum)-1);
+ if (len != -1) {
+ snum[len]='\0';
+ sscanf(snum,"%d",&cur_epoch);
+ close(fd);
+ }
+ }
+ return;
+}
+
+
+void update_cur_epoch_file(int n) {
+ int fd, len;
+ char snum[7];
+ len=snprintf(snum,6,"%d",n);
+ fd = open("/tmp/fprobe_last_epoch",O_WRONLY|O_CREAT|O_TRUNC);
+ if (fd == -1) {
+ my_log(LOG_ERR, "open() failed: /tmp/fprobe_last_epoch.The next restart will resume logging from epoch id 0.");
+ return;
+ }
+ write(fd, snum, len);
+ close(fd);
+}
+