~ubuntu-branches/ubuntu/precise/net-snmp/precise

« back to all changes in this revision

Viewing changes to agent/mibgroup/host/hr_swrun.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
#include <net-snmp/agent/auto_nlist.h>
85
85
#include "kernel.h"
86
86
#ifdef solaris2
 
87
#if _SLASH_PROC_METHOD_ && defined _ILP32
 
88
#include <net-snmp/agent/cache_handler.h>
 
89
#include <net-snmp/agent/hardware/memory.h>
 
90
#endif
 
91
 
87
92
#include "kernel_sunos5.h"
88
93
#endif
89
94
#if defined(aix4) || defined(aix5) || defined(aix6)
742
747
            sprintf(string, "/proc/%d/status", pid);
743
748
            if ((fp = fopen(string, "r")) == NULL)
744
749
                return NULL;
745
 
            fgets(buf, sizeof(buf), fp);        /* Name: process name */
746
 
            if ( cp == NULL ) {
 
750
            if (!fgets(buf, sizeof(buf), fp)) {
747
751
                fclose(fp);
748
752
                return NULL;    /* the process probably died */
749
753
            }
1151
1155
        long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024;
1152
1156
#elif defined(solaris2)
1153
1157
#if _SLASH_PROC_METHOD_
 
1158
#ifdef _ILP32
 
1159
        if(NULL != proc_buf && 0 == proc_buf->pr_rssize)
 
1160
        { /* Odds on that we are looking with a 32 bit app at a 64 bit psinfo.*/
 
1161
            netsnmp_memory_info *mem;
 
1162
            netsnmp_memory_load();
 
1163
            mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 );
 
1164
            if (!mem) 
 
1165
            {
 
1166
                snmp_log(LOG_INFO, "netsnmp_memory_get_byIdx returned NULL pointer\n");
 
1167
                long_return = 0;/* Tried my best, giving up.*/
 
1168
            } 
 
1169
            else 
 
1170
            {/* 0x8000 is the maximum range of pr_pctmem. devision of 1024 is to go from B to kB*/
 
1171
                uint32_t pct_unit = (mem->size/0x8000) * (mem->units/1024);
 
1172
                long_return = proc_buf ? proc_buf->pr_pctmem * pct_unit : 0;
 
1173
            }
 
1174
        }
 
1175
        else
 
1176
        {    
 
1177
            long_return = proc_buf ? proc_buf->pr_rssize : 0;
 
1178
        
 
1179
        }
 
1180
#else /*_LP64*/
1154
1181
        long_return = proc_buf ? proc_buf->pr_rssize : 0;
 
1182
#endif /*_LP64*/
 
1183
 
1155
1184
#else
1156
1185
        long_return = proc_buf->p_swrss;
1157
1186
#endif