mailx uses /tmp

 
SOLVED
Go to solution
Kevin Wright
Honored Contributor

mailx uses /tmp

i have noticed that mailx -f username somehow seems to 'take'space from the /tmp directory, however nothing is written to the /tmp dir. upon exit of the mailx program, a bdf returns to normal..what is happening and what other programs perform similar to mailx -f??
thank you
3 REPLIES 3
Bruce Laughlin
Frequent Advisor
Solution

Re: mailx uses /tmp

Hi Kevin,

It's possible to unlink() a file, yet keep it open, and continue to write to it:

1) The space the file uses isn't returned to the file system until the file is closed, usually when the process terminates.

2) The file has no name, and thus, can't be seen with ls, ll, find, and so forth.

3) This is commonly done with temporary files, so that if the system crashes while the file is open, there is not a file left laying around, taking up space.

If you can run glance, or the 3rd party tool lsof, you should be able to see files that mailx has open, and I suspect you'll see that mailx does in fact have an inode open in /tmp, with no associated filename.

Hope this is helpful to you,
Bruce Laughlin
Bruce Laughlin
Frequent Advisor

Re: mailx uses /tmp

More info...

Here's an indication, using glance, that mailx has opened an inode in /tmp, with no associated filename:

From the glance "open files" screen, for the mailx process:
4

Now, let's see if there is any such inode _viewable_ in the /tmp directory:
# cd /tmp
# ls -i | grep 241
#

Nope, nothing, so mailx has likely opened this file, unlinked it, and is using it as a temporary file. When mailx closes the file, or terminates, the space used by this file will be returned to the filesystem.

Also, you can get lsof at the following URL:
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.51/

Regards,
Bruce Laughlin
Kevin Wright
Honored Contributor

Re: mailx uses /tmp

I have that lsof program, and i have tried it. This is kind of what I thought was happening, mailx just reserves space kindof, but your explanation clears it up for me, thank you.