diff options
author | LAN-TW <lantw44@gmail.com> | 2012-10-11 01:16:16 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2012-10-11 01:16:16 +0800 |
commit | 1cca9fc8044dd115de7d57ca910e43fe8f483ad1 (patch) | |
tree | a0ef79083629a13f4e5deffabcacc2bc23b3af1d | |
parent | 65c8bf8a1ea5e74c3965374723fdbdf5cf5ce3ea (diff) | |
download | sctjudge-1cca9fc8044dd115de7d57ca910e43fe8f483ad1.tar.gz sctjudge-1cca9fc8044dd115de7d57ca910e43fe8f483ad1.tar.zst sctjudge-1cca9fc8044dd115de7d57ca910e43fe8f483ad1.zip |
proc 檔案系統不一定要掛載在 /proc(預備動作,尚未完成)
-rw-r--r-- | src/config2.h | 3 | ||||
-rw-r--r-- | src/disptime.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/config2.h b/src/config2.h index 822ebdb..793fb18 100644 --- a/src/config2.h +++ b/src/config2.h @@ -8,6 +8,9 @@ /* XXX 這個看能不能用 GNU autotool 取代,我可不確定 /dev/null 永遠存在!*/ #define NULL_DEVICE "/dev/null" +/* TODO 定義 Linux proc 檔案系統在哪裡,之後會用 GNU autotool 取代 */ +#define PROC_PATH "/proc" + /* sctjudge 這個程式的 exit status */ #define SCTEXIT_SUCCESS 0 /* 當然就是正常結束 */ #define SCTEXIT_SYNTAX 1 /* 解析階段:命令列語法錯誤 */ diff --git a/src/disptime.c b/src/disptime.c index bc47ce0..5bc6c66 100644 --- a/src/disptime.c +++ b/src/disptime.c @@ -24,7 +24,7 @@ void* sctjudge_dispaytime(void* arg){ pid_t pidcopy; - const char* sysstatfile = "/proc/stat"; + const char* sysstatfile = PROC_PATH"stat"; char statfile[25], statusfile[25]; FILE *statp, *statusp, *sysstatp; @@ -60,8 +60,8 @@ void* sctjudge_dispaytime(void* arg){ #endif #ifdef HAVE_CONF_PROCMON - sprintf(statfile, "/proc/%d/stat", pidcopy); - sprintf(statusfile, "/proc/%d/status", pidcopy); + sprintf(statfile, PROC_PATH"/%d/stat", pidcopy); + sprintf(statusfile, PROC_PATH"/%d/status", pidcopy); #endif while(1){ |