Re: Problem on 64 bit machine
"Dave Shield" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
On 23/08/06, Sachin Mishra <[email protected]> wrote: > Thanks Dave. Size of long is 8. Was just curious if I can get the > portion of the code where the value is assigned. Ummm... Probably as follows: snmplib/snmp_api.c:snmp_pdu_parse(): lines 4429ff: switch ((short) vp->type) { case ASN_INTEGER: vp->val.integer = (long *) vp->buf; vp->val_len = sizeof(long); asn_parse_int(..., sizeof(*vp->val.integer)); break; case ASN_COUNTER: case ASN_GAUGE: case ASN_TIMETICKS: case ASN_UINTEGER: vp->val.integer = (long *) vp->buf; vp->val_len = sizeof(u_long); asn_parse_unsigned_int(...., vp->val_len); break; Dave > > -Sachin > > On Wed, 2006-08-23 at 15:19, Dave Shield wrote: > > On 23/08/06, Sachin Mishra <[email protected]> wrote: > > > When I am trying to set the value of the object on a 64 bit > > > machine, the "requests" variable passed in the table_handler function > > > has requests->requestvb->val_len assigned as 8. I want to know why this > > > value is 8 and not 4. (sizeof(int) gives 4 on that machine)? > > > > What does "sizeof(long)" give? 4 or 8? > > Note that (for historical reasons), integer values are held internally > > as "long" rather than "int". This is so pervasive that it would be > > extremely difficult to change now. > > > > I believe that what's been done to address this problem, is to mask > > off the bottom 32-bits of all integer values (other than Counter64) - > > probably when building the PDU. You could either tweak your library > > code to do the same, or do an equivalent masking when setting the > > values. As long as the *value* is 32-bits, it doesn't actually matter > > if the variable that holds it is 64. > > > > Dave > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Net-snmp-users mailing list > [email protected] > Please see the following page to unsubscribe or change other options: > https://lists.sourceforge.net/lists/listinfo/net-snmp-users > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users