I've got to remotely determine if a process is running, using SSH. The target machine is running CentOS Linux (basically Red Hat Enterprise). I know the obvious way of doing it is by issuing the "ps" command, but I need a way of determining what the output of that command is.

To use SSH, I'm using the libssh library, version 0.3. Unfortunately, it is quite poorly documented, and I am unsure of how the "channel_read" function reads the output (from the most recent character back, or from the first onward?).

Any ideas on how to determine the status of a process are welcome. Thanks in advance.