I have a desire to know what the controlling terminal is
for my process. As a test, I wanted to see some differences
between jobs I start from a UNIX shell and those I start as
UNIX cron jobs. Using
Proc::ProcessTable gives me the results I would expect:
The shell jobs, no matter how I start or background them,
have a ttynum value greater than zero. For
cron jobs ttynum is -1. However, using
the POSIX
ctermid function, I get /dev/tty no
matter how the jobs is started.
This is Solaris 2.8, Perl 5.6.1. I'd also use it under
Perl 5.8.0 but I haven't tried it there yet.
Update: It looks like ctermid just gives you
back a path name you can use to open a controlling terminal.
For the cron jobs, attempts to open that device
fail. That tells me what I need to know.