Operating System - Tru64 Unix
1754389 Members
2569 Online
108813 Solutions
New Discussion юеВ

fs_get_dom_list() opens file but never closes

 
Abhik Das
Occasional Contributor

fs_get_dom_list() opens file but never closes

I'm using fs_get_dom_list() in my product. It seems that it never closes an opened file descriptor.

To confirm this, below is the sample program...
#include
#include
#include
#include
#include "fs_config.h"
#include
#include
#include
#include
extern int errno;
main()
{
int i=0;
while(1)
{
char *domlist=NULL,*err_buf=NULL;
domlist = fs_get_dom_list(&err_buf);
cout< i++;
cout< delete domlist;
delete err_buf;
}
}

/*To compile: cxx -g grp.cpp -D__USE_STD_IOSTREAM -L. -lmsfs -lstocfg -lxerces-c1_4 -llsm -lrt -lc -lpthread -lstor */
//libstocfg.a & libxerces-c1_4.a might not be available by default in Tru64v5.1B. you may find it in Tru64v5.1A.
//It stops after printing 4091. 4096 being the default max file descriptor.

Let me know if this is a bug. If yes, is there any place where we can log the same?
9 REPLIES 9
Venkatesh BL
Honored Contributor

Re: fs_get_dom_list() opens file but never closes

This is interesting. I am wondering why this call should open any system file. [may be it does open files under /etc/fdmns - not sure.]

Did you try using lsof on the process to see what is the file that is opened?
Abhik Das
Occasional Contributor

Re: fs_get_dom_list() opens file but never closes

Yes, most probabaly it is /etc/fdmns directory. How do we check with "lsof" that a file is opened?
Venkatesh BL
Honored Contributor

Re: fs_get_dom_list() opens file but never closes

# lsof -f -p
Abhik Das
Occasional Contributor

Re: fs_get_dom_list() opens file but never closes

lsof doesn't seem to be a default command available in tru64v5.1B(rev 2650). Also, "find / -name lsof" doesn't return anything. Is there any place where we can download the same?
Venkatesh BL
Honored Contributor

Re: fs_get_dom_list() opens file but never closes

lsof is not tru64 specific. You can download it from ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof.tar.gz

[Also, as you appear new to this forum, I would suggest that you check out
http://forums1.itrc.hp.com/service/forums/helptips.do?#28 link to learn about member points system.]
Abhik Das
Occasional Contributor

Re: fs_get_dom_list() opens file but never closes

Checked with "lsof". Yes, it is "/etc/fdmns" directory only which never gets closed.
Thanks a ton for the lsof utility. I didn't know about this useful stuff lying around.

However, the question remains: "Where do we log the bug?"
Venkatesh BL
Honored Contributor

Re: fs_get_dom_list() opens file but never closes

I think you could pass it on to your local HP support personnel.
Michael Schulte zur Sur
Honored Contributor

Re: fs_get_dom_list() opens file but never closes

Hi Abhik,

each program has at least three file descriptors of its own.
0=stdin, 1=stdout, 2=stderr

greetings,

Michael
Abhik Das
Occasional Contributor

Re: fs_get_dom_list() opens file but never closes

Local contact owning the library raised the internal QAR & fixed it.