I am new to Linux programming. As part of learning, I need to create a *.c program where we call certain /proc files (i.e. such as meminfo, version, uptime, etc...) from our program. Can anyone point me to a simple program on how one would do this (i.e. can you directly call uptime() or ... straight from my program - I would be very surprised if one could)?
Run strace on a program which is known to access /proc. The system calls involved will be logged. Inside you will find calls to read from the proc filesystem.
You mention that I can run a program 'known' to access a file in the '/proc' subsystem. Is there a good example program you can recommend I run (and how do you run with strace?).
So open() /proc/modules gives a file descriptor 3, so you just look for lines whose file descriptors are 3 and you can then trace the system calls involved. Here you see that apparently the lsmod program tries to read() from the open()ed file descriptor in 1024-byte chunks until EOF is reached, and finally close() it.
If you know of a program which reads /proc in a similar fashion you can try to strace it to find out what is involved.
Hi, I am new to shell scripting and Sybase database i need a help that i try to execute a SYBASE stored procedure from a Unix shell script and wanna write the output of the SP into a Text File.somehow i try to find a solution but whwn i try to run the script i am not getting the output file with... (1 Reply)
Hi Team,
I am very new to this forum and hope someone will help me in resolving the issue.
I am new to Pro C also.
I made some changes to the existing Pro C program and want to run the program with the changes.
But I am unable to neither compile nor run the program.
Please do the... (2 Replies)
Hello
I am writing a script that will first execute ps to get the list of processes running, and the go into the /proc folder for each PID listed and gather relevant information.
I looked through the contents of a particular process in the /proc folder and I can't find where I can locate... (2 Replies)
hi,
i need to compile a proc program, say prog.pc
can we compile this program in the unix environment? does this need a make file? can anyone help me on this since i am new to this area.
Thanks in advance. (1 Reply)
Hi,
I'm porting some old C++ code (that I didn't write) from Linux to AIX and have run into a problem in getting the process name from within the code when it is run on AIX. Basically the code is getting the process name so it can then return it to the rest of the code as argv. This code is trying... (1 Reply)
Hi,
I would like to know how to call a program "cmp_size" ... where to put in progam to run it
ex: program checkdisk is below, and it will call a nother problem "cmp_size"
Do I just put the cmp_size program at the end of this program.
Thank you very much,
# check all directory for size... (3 Replies)
HI,
I'm trying to get this right, please can you help. In my unix korn shell script, I call an oracle stored proc within a package and I specify 3 parameters, 2 of which are IN OUT parameters (i.e. I expect the stored proc to change them and return them back to me).
Does the unix code... (7 Replies)