[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3211.0. "Landmark Systems" by HYDRA::AXPDEVELOPER (Alpha Developer support) Mon Feb 17 1997 18:09

    Company Name :  Landmark Systems
    Contact Name :  Shyam
    Phone        :  (703) 902-8237
    Fax          :  
    Email        :  [email protected]
    Date/Time in :  17-FEB-1997 18:08:10
    Entered by   :  Marvin Davis
    SPE center   :  MRO

    Category     :  UNIX
    OS Version   :  3.2
    System H/W   :  DEC 3000 Model 300X,


    Brief Description of Problem:
    -----------------------------
We have a DEC 3000 Model 300X, running Digital UNIX 3.2.  We compiled a
program to print sizes of integer, double, float, ulong, and the size of
integer was returned as 4 and size of Double was 8.  I have the
following questions:

1. How does the 64 bit architecture affect the system macros like
'sizeof(int)'?

2. Our application programs make use of standard macros such as 'sizeof'
for computing sizes of integers and pointers.  These programs are
working on 32 bit Operating Systems (such as SunOS4.1.4 and Solaris 2.4,
and HP-UX 9.x).  Can I assume, that these source files get compiled and
work well on Digital UNIX also?

3. What precautions do we need to take while reading kernel data
structures from /dev/kmem?

4. What precautions do I need to take while data is being transferred
over TCP/IP sockets from a 32 bit O.S (Solaris) to Digital UNIX?

Thanks,
Shyam
Landmark Systems Corporation

T.RTitleUserPersonal
Name
DateLines
3211.1Reply sent to developerHYDRA::NEWMANChuck Newman, 508/467-5499 (DTN 297), MRO1-3/F26Tue Feb 18 1997 12:0545
Shyam --

Hopefully this note will answer your questions.  If not, please
reference problem 1997-3211 for further follow-up.  If you have new
issues, however, they should be logged as a new problem.

1. How does the 64 bit architecture affect the system macros like
'sizeof(int)'?

Digital UNIX on Alpha uses 64 bit addresses.  This does not dictate the
size of data.  As you noticed, the size of an integer is 4 bytes.  If
you printed out the size of theh ADDRESS of an integer, you would have
found it to be 8 bytes.

sizeof() will correctly return the size of the item specified -- just
make sure you specify the correct item!

2. Our application programs make use of standard macros such as 'sizeof'
for computing sizes of integers and pointers.  These programs are
working on 32 bit Operating Systems (such as SunOS4.1.4 and Solaris 2.4,
and HP-UX 9.x).  Can I assume, that these source files get compiled and
work well on Digital UNIX also?

As stated above, sizeof() will give you the size of the datum (measured
in bytes).  As long as you don't do things like attempt to store an
address (8 bytes) into an integer (4 bytes) you'll be okay.

3. What precautions do we need to take while reading kernel data
structures from /dev/kmem?

As noted in the man pages, there is a restriction when attempting to
modify /dev/kmem, in that modifications should be to whole quadwords.
Other cases need to be protected by LDQ_L/STQ_C operations.

I don't see where any precautions around reading need to be taken.

4. What precautions do I need to take while data is being transferred
over TCP/IP sockets from a 32 bit O.S (Solaris) to Digital UNIX?

Your concerns in this area will be more likely related to the byte order
of data.

Note that Digital UNIX on the Alpha is little-endian, while Solaris is
big-endian.  You may use htonl() and friends to ensure proper byte
order.