Q: OK - I got a server built on a Sun, but when I run the
server it does nothing - it just quits. What's up with that?
A:By default, a server based on rpcgen generated code will
become a daemon process by forking and having the parent exit. You
can turn this off by defining the symbol RPC_SVC_FG when
compiling your server (look in the _svc to see how this
changes things in the server main). You can define a symbol via a
command line option to the compiler by adding this "-DRPC_SVC_FG" to
the compile command for the rpcgen generated _svc file.
You can also change the header file generated by rpcgen, but this is
not a good idea since rerunning rpcgen will overwrite the header
file.
To find and get rid of a daemon process you need to use the
ps command and the kill command - here is an example that
finds a process that was started by running the program ./test:
> /usr/ucb/ps aux | grep test
hollingd 9722 0.2 0.6 2040 1512 ? S 10:30:39 0:00 ./test
> kill -9 9722