Skip Menu |

This queue is for tickets about the Proc-ProcessTable CPAN distribution.

Report information
The Basics
Id: 4181
Status: new
Priority: 0/
Queue: Proc-ProcessTable

People
Owner: Nobody in particular
Requestors: djberge [...] qwest.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.39
Fixed in: (no value)



Subject: Bad ttynum's on HPUX
The ttynum value returned on HPUX is invalid. The current code, using makedev, returns a rather large integer, or a negative int if their is no tty associated with the process. A better approach in my opinion would be to use the devnm() function and simply return a string for the ttyname, or undef if there is no associated tty. Here's a bit of sample code, partially lifted from a post by Dan Mercer in comp.unix.programmer: #include <devnm.h> ... char path[MAXPATHLEN+1]; /* from sys/param.h */ struct pst_status pst; ... if(pst.pst_term.psd_major != -1){ /* -1 means no associated tty */ devnm(S_IFCHR, /* from sys/stat.h */ (dev_t)((pst.pst_term.psd_major<<24) |pst.pst_term.psd_minor), path, sizeof path, 1); } Then "path" will contain something like "/dev/pty/ttyp4", for example. You could always strip out the leading "/dev/xxx" junk, too, if you'd like to keep it closer to what a ps -ef returns. Anyway, that's what I'm doing for the Ruby port. :) Regards, Dan