File descriptor directory in HPUX

Hi,

In solaris I remember this direcotry structure

/proc/<pid>/fd

in this directory

ls -l | wc -l

would give me the number of file descriptor for that process.

Where can I find the similar in HPUX

HPUX has nothing like it.

The closest you might get is the various information ps can offer, which turns out to be quite a bit.

Are you looking for open files by the process? "lsof" is available for HP-UX as well.

lsof -c process_name

And you can drill down on a process with HP-UX glance and see which files that process has open.
Very important when configuring kernel parameters to know how many files a database client actually opens (it can be a large number).

@Corona688
"HPUX has nothing like it."

Sorry, but that is a rubbish post.
Also there is no "ps" option for file descriptors on any unix/Linux Operating System.

I need the number of file descriptor a process has opened and the max limit that is set on my system.

Can you help me with the exact command ?

Yes, with lsof it's very easy.

To check numbers of file descriptors opened by a process:

lsof -p PID | awk '$4~/^[0-9]/' | wc -l

To check the max. limit that's set, on ksh type this:

ulimit -n
1 Like

Check out these kernel parameters.

# kctune maxfiles maxfiles_lim
Tunable       Value  Expression  Changes
maxfiles       2048  Default
maxfiles_lim   4096  Default     Immed
# ulimit -a | grep nofiles
nofiles(descriptors) 2048

This will set it system wide, and with ulimit command you can change per user inside .profile, but not above the kernel parameter maxfiles_lim.

Hope that helps.
Regards
Peasant.

Look here:
HP Communities - /proc or equivalent in HPUX - Enterprise Business Community

The kernel metrics you are looking for are PROC_OPEN, THREAD_OPEN... by what I remember and apeared in HP-UX 11.00...
Addendum : (they may be glance specific - they are counts of open(2) system calls.)

Oh? What virtual filesystem resembling /proc/ does HPUX have, then?

Anything?

The kernel tables used by glance , top , ps , lsof and more.
It's an anomaly of Solaris and some Linux that these tables are visible to ls .
HP-UX ps does not list Open Files.

So, no virtual filesystem resembling /proc/, then.

Unfortunately, there's no HP-UX equivalent of Linux's /proc filesystem. Linux has gone beyond just listing different process related stuffs in /proc which is quite hard to find in HP-UX without custom C programs using some kind of pstat(2) functions.

Work around is to use ps, pfiles, pmap, ptree, etc commands which can give various details of a process.