I wish to know is there any way (solaris api) for getting the process name from the given process id. In Linux there is way from using the /proc but I am not sure about Solaris.
Thanks in advance.
Thanks
Arpit
Solaris has /proc as well, but it behaves somewhat differently. The documentation for it is here. You probably want the psinfo stuff.
Related
I have a process that seems to be hanging on solaris, I have tried to attach to the process using GDB to see what it is doing but no luck.
There is no error from what I can see, it is just sitting there...
Are there any other tools or techniques I can use to see what the process is stuck on?
Thanks for the help
Lynton
pstack <pid> will print you what all the threads within this process are doing (full stack traces, including function names, if your binary is not stripped.
truss is Linux's strace equivalent. It will show all the system calls that the process is doing. It might help you in debugging.
DTrace is a great debugging swiss-army-knife that can show you pretty much anything you can think of. The downside is that it needs to be run with root permissions on a global zone. It takes some time to learn, but it's time well worth spending.
Use powerful dtrace facility.
Here the short introduction how to trace user processes.
It seems some software can do this, how is it done?
GetProcessMemoryInfo will give you lots of information on the resources a process uses in Windows.
i used to get a list of processs under linux by enumerating the /proc file system, since it had plain-text files that i can read data from (stat, status, exe link....) but thats not the case on solaris, i tried porting my tools to Oracle Solaris 11 (my first solaris) but it wont work, i tried accessing the /proc folder manually, but couldn't find anything readable, but ps -fu user works !
is it possible that someone can point me on how to get a list of processes uneder solaris?
im coding in gcc btw.
thanks.
Unlike Linux, Solaris /proc is providing binary data, not text one.
Solaris has an extensive and detailed manual page proc(4) describing what the different files under a process number hierarchy contain, how to access them and what structures to use in order to get their content.
This manual page is of course also accessible locally with man -s 4 proc
Similar to this: How to get process info programmatically in C/C++ from a Solaris system?
You want the interface described by /usr/include/procfs.h and /usr/include/sys/procfs.h to decode the binary data in /proc
I have a very nice idea for a kernel patch, and I want to conduct some research and see code examples before I shape my idea.
I'm looking for interesting code examples that would demonstrate advanced usage of procfs (the Linux /proc file system). By interesting, I mean more than just reading a documented value.
My idea is to provide every process with an easy broadcast mechanism. For example, let's consider a process that runs multiple instances of rsync and wants to check the transfer status (how many bytes have been transfered so far) for each child. Currently, I don't know of any way that can be done.
I intend to provide the process with a minimal interface to write data to the procfs. That data would be placed under the PID directory. For example:
/procfs/1343/data_transfered/incoming
I can think of numerous advantage for this, mainly in the concurrency field.
By the way, if such a mechanism already exists, do tell...
Yes, I've written stuff that pokes around in /proc. I suspect you are unlikely to get linux kernel patches accepted that do anything with proc, unless they are just fixing something that is already there that was broken in some way.*
/sysfs seems to be where things are moving.
/proc was originally for process information, but a lot of misc. driver stuff ended up in there.
*well, maybe they'll take it if whatever you're doing has to do with processes, and isn't in a driver.
Go look at the source code for the procps package for code that uses /proc
http://github.com/tialaramex/leakdice/tree/master
Uses proc to figure out the memory address layout of a process, and dump random pages from its heap (for reasons which are explained in its documentation).
I did an application that create a partintion and format the disk using system calls...
In the middle of the process there is a query asking to type the size of the disk... What can i do in my application in order to automaticly answer that query??
can you please help me?
This is certainly possible with, for instance libexpect but I never tried it (but Google found what seems to be a good example). On my Debian machine, man libexpect says:
libexpect - programmed dialogue library with interactive programs
This library contains functions that allow Expect to be used as a Tcl
extension or to be used directly from C or C++ (without Tcl).
Depending on your operating system (windows can do it for instance) you can have the stdin for the programmed redirected to come from an output of your program.
Maybe you can use system() do run utilities like expect to control the process
fortunately, There is nothing you can do. :)