Hello All,
 

I am working on a hpux(11.22 IPF).
 
In this architecture
******************************************
file mntab.h(present)
 
function getmntent
it is used to open the /etc/mntab file
is defined in the c library
 
function endmntent
it is used to close the /etc/mntab file
is defined in the c library
 
******************************************
 
file fstab.h(present)
 
function setfsent
it is used to open the /etc/fstab file
declared in fstab.h but not defined in the c library
 
function endfsent
it is used to close the /etc/fstab file
declared in fstab.h but not defined in the c library
 
*******************************************
 
the following function is defined and declared in net-snmp-5.1.2/agent/mibgroup/ucd-snmp/disk.c
 
Note : In this function
If  HAVE_GETMNTENT is defined then the corresponding code is executed
if  HAVE_GETMNTENT is not defined and if  HAVE_FSTAB_H is defined then the corresponding code is executed
if  HAVE_FSTAB_H is not defined and if  HAVE_STATFS is defined then the corresponding code is executed
 
find_device(char *path)
{
 
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
               #if HAVE_GETMNTENT
                             #if HAVE_SETMNTENT
 
                                  code with setmntent
  
                              #else
 
                               code without setmntent
 
                            #endif
 
               #elif HAVE_FSTAB_H
                       stat(path, &stat1); 
                    /* open /etc/fstab for reading */
                    setfsent();
                     /* read /etc/fstab for reading */
                     if ((fstab = getfsfile(path))) {
                     copy_nword(fstab->fs_spec, device, sizeof(device));
                 }
             #elif HAVE_STATFS
 
                       code for statfs
 
             #endif
           else {
                sprintf(tmpbuf, "Couldn't find device for disk %s",path);
                config_pwarn(tmpbuf);
                 }
 
             #if HAVE_FSTAB_H
 
             /* close /etc/fstab  */
                endfsent(); 
             /* this gets executed  even if HAVE_GETMNTENT is defined */
              /*ld: (Warning) Unsatisfied symbol "endfsent" occurs while running snmpd*/
               
             #endif
#else
            config_perror("'disk' checks not supported on this architecture.");
#endif                   /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
 return device;
}
 

I think the  endfsent(); must be called soon after reading /etc/fstab (or) just before the previous #endif
Am I going wrong anywhere.
Your suggestions please.
 

Thanks,
Prakash

Reply via email to