Hello all,
 
            Here are the patch details for solving the problem of the unsatisfied symbol endfsent in 11.22 IPF(HPUX) machines.
I have applied the patch and tested it. Everything works fine. Please verify it.
 
path   : net-snmp-5.1.2/agent/mibgroup/ucd-snmp
file     : disk.c

[EMAIL PROTECTED] net-snmp]$ diff -uNr disk.c disk_new.c
--- disk.c      2004-10-05 21:14:07.000000000 +0530
+++ disk_new.c  2004-10-05 21:12:59.000000000 +0530
@@ -533,6 +533,13 @@
     copy_nword(fstab->fs_spec, device,
               sizeof(device));
   }
+  endfsent();
+  if (device[0] != '\0') {
+     /*
+      * dummy clause for else below
+      */
+   }
+
 #elif HAVE_STATFS
   if (statfs(path, &statf) == 0) {
     copy_word(statf.f_mntfromname, device);
@@ -545,9 +552,6 @@
            path);
     config_pwarn(tmpbuf);
   }
-#if HAVE_FSTAB_H
-  endfsent();
-#endif
 #else
   config_perror("'disk' checks not supported on this architecture.");
 #endif                   /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */

 
 
Thanks,
Prakash
 
 
----- Original Message -----
From: Prakash
Sent: Monday, October 04, 2004 9:34 AM
Subject: endfsent() not found in 11.22 IPF (HPUX) machines

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