473,473 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why the disk space keep on decreasing,is that due to use popen()?

Why the disk space keep on decreasing,is that due to use popen()?
I have wrote a monitor program to ensure my program on working by
using popen to
use 'ps' command, but the disk space keep on decreasing.

And when the disk shrink to near 40K , it seems stop to decrease
anymore.

So Is the popen implementation needs write disk other than using meory
instead?
got wired.
And also , can their be a way to only access the memory for my
program's purpose?

Following is the code :

#define PS_COMMAND "ps -ef | awk '{print $2 , $8;}'| grep %s |grep -v
grep"
main()
{
while (_GetProcessId("programA",&already_start))
{
//do something ... and sleep a minute.

}

}

int _GetProcessId(char *program_name,int* already_start)
{

FILE *fd;
char command[255];
char str[255];
sprintf(command,PS_COMMAND,program_name);
if((fd = popen(command, "r")) == NULL) {
printf("call popen failed ");
return APR_EINIT;
} else {
while(fgets(str, 255, fd) != NULL) {
//printf("%s ",str);
*already_start=atoi(str);
pclose( fd ) ;
return APR_SUCCESS;
}
}
pclose( fd ) ;
return APR_EGENERAL;
}

Feb 15 '07 #1
2 1736
In article <11**********************@p10g2000cwp.googlegroups .com>,
CFAN <ey******@gmail.comwrote:
>Why the disk space keep on decreasing,is that due to use popen()?
We don't know. popen() is not part of the C standard. You will need
to ask the question in a forum that deals with the peculiarities
of your operating system.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
Feb 15 '07 #2
On 2ÔÂ15ÈÕ, ÉÏÎç9ʱ32·Ö, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
In article <1171501711.205064.192...@p10g2000cwp.googlegroups .com>,

CFAN <eyeli...@gmail.comwrote:
Why the disk space keep on decreasing,is that due to use popen()?

We don't know. popen() is not part of the C standard. You will need
to ask the question in a forum that deals with the peculiarities
of your operating system.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
I think so.

Feb 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: O.Gir | last post by:
Hi all, can't manage to do it ..... was so easy under solaris .... anybody knows how to get free disk space on remote disks ??? (with both local and remote *$#@%§&* machines running *$#@%§&*...
4
by: cover | last post by:
The question is, we have two options to store images, either in a Database (MySQL, Postgres, ...) like blob data, or in the hard disk the file and the path in database. Which option is better?...
4
by: Cloud Burst | last post by:
I'm writing a javascript for my own use. I'd like it to read my disk to get some information. In particular, I want to find out how much disk is being used by some directories. At present, I'm...
12
by: New World Order Pigs | last post by:
Is there no way in .net to get disk space remaining for a given drive??? I can't believe it and yet is seems to be so. If someone knows of a way to do this in the .net libraries I'd be very much...
3
by: A P | last post by:
Hi, I am loosing disk space and wanting to install .Net Framework on my W2KSP4 Server. I only have 400MB available, is this enough for me to install .Net Framework? Me
1
by: Nils Rennebarth | last post by:
I have a table that is essentially a log where new entries are streaming in continually and from time to time I throw old entries away to keep the table from growing. I understand that in...
6
by: PyPK | last post by:
how can we compute the current system disk space using a python script.? any ideas or have anyone tried this..
2
by: =?Utf-8?B?R2VvcmR5?= | last post by:
Hello everyone, I would really appreciate if someone helped me in this matter cause I am going to lose my mind... I am using a Sony Vaio Laptop with Windows XP professional (512MB Ram, 1,7 GHz CPU...
5
by: mostro713 | last post by:
Hello all, I would like to write a script in Python to email me when disk space gets below a certain value. My first question (I'm sure of many) is how do get this output into a dictionary or...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.