| Author |
Replaceing popen() function with pipe() and fork() to avoid Linux command df hung.
|
ashish jadhav
Ranch Hand
Joined: Nov 20, 2008
Posts: 62
|
|
Hi friends,
We have C class (sysclckpi) in which we are using do_PCTDSKFRE function.
1 The function do_PCTDSKFRE in sysclckpi calculates the free disk space.
2 In do_PCTDSKFRE function the function popen() executes the Linux command [popen(df -km /u01 2>&1 | grep -v Mounted 2>&1)] i.e. df which returns disk used space in percentage from which free space can be calculated.
3 After searching on Internet we found that lots of people are facing same problem of process hang out for df command in Linux sometimes.
4 We are planning to replace popen() function with pipe() and fork() methods,so sysclckpi will continue without hanging and therefore not be killed off.
Can anyone please do needful? or how can i replace popen() function with pipe() and fork() functions?
Thanks,
Ashish
|
 |
ashish jadhav
Ranch Hand
Joined: Nov 20, 2008
Posts: 62
|
|
hi
Can anyone do needful?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 23395
|
|
|
You're asking the wrong question, my friend. The right question is "should we use a pipe to df to find out disk usage on Linux?" The answer is an emphatic "no". Use statfs() -- try "man statfs" to learn about it.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: Replaceing popen() function with pipe() and fork() to avoid Linux command df hung.
|
|
|