Prakash,

there is another function in the same file (find_and_add_allDisks()) which works similar, but it calls endfsent() in the same #elif clause where setfsent() is used. This is what has to be changed in the find_device() function.

The code in find_device() should look as follows:

...
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
#if HAVE_GETMNTENT
#if HAVE_SETMNTENT
  // code using setmntent()
#else
  // code using getmntent()
#endif
#elif HAVE_FSTAB_H
  stat(path, &stat1);
  setfsent();
  if ((fstab = getfsfile(path))) {
    copy_nword(fstab->fs_spec, device,
               sizeof(device));
  }
  // the following 6 lines to be added here
  endfsent();
  if (device[0] != '\0') {
    /*
     * dummy clause for else below
     */
  }
#elif HAVE_STATFS
  // code using statfs()
#endif
  else {
    sprintf(tmpbuf, "Couldn't find device for disk %s",
            path);
    config_pwarn(tmpbuf);
  }
  // remove 3 lines "#if HAVE...", "endfsent();", "#endif"
#else
  config_perror("'disk' checks not supported on this architecture.");
#endif
  ...

Please check whether this works with HPUX 11.22, and if yes please submit a patch as Mike Slifcak pleased you to do.

Johannes

Prakash wrote:

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

-- Johannes Schmidt-Fischer

InterFace AG                 phone  +49 (0)89 / 610 49 - 207
Leipziger Str. 16            fax    +49 (0)89 / 610 49 - 85
D-82008 Unterhaching         mobile +49 (0)171/ 787 76 01
http://www.InterFace-AG.com  mailto:[EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to