static CPU_t* cpus = NULL;
static unsigned long probe_so_size = 0;
- status = -(errno)
+
+int get_file_status_no_open(int pfd, const char* filename)
+{
+ int status = 0;
+
+#ifndef LOCALTEST
+ if (likely(pfd != NULL))
+ {
+ if (unlikely(pfd < 0)) {
+ // open file first
+ return 0;
+ }
+
+ char buf[STATUS_STRING_MAX];
+
+
+ lseek(pfd, 0, SEEK_SET); // rewind to start of file
+
+ // read from file
+ if (unlikely(read(pfd, buf, STATUS_STRING_MAX) == -1))
++ status = -(errno);
+ else
+ status = atoi(buf);
+ }
+#endif
+
+ return status;
+}
// daemon api : get status from file
// pfd must not be null
int get_file_status(int* pfd, const char* filename)