09-21-2005
Memory Alignment Problem on Sun Sparcs
Hi, I try to marshal a unsigned int and a char * into a buffer, and then unmarshal them later to get them out. I need to put the char * in the front and unsigned int at the end of the buffer. However, my system always give me "BUS ERROR". I am using Sun Sparcs Sloris 2.10.
My code to marshal the data:
unsigned dev = 111;
unsigned inode = 222;
int s_docname = strlen(docname) + 1;
int s_key = s_docname + sizeof(unsigned) * 2;
keybuf = malloc(s_key);
memset(keybuf, 0, s_key);
memcpy(keybuf, docname, s_docname);
memcpy(keybuf + s_docname, &(dev), sizeof(unsigned));
memcpy(keybuf + s_docname + sizeof(unsigned), &(inode),
sizeof(unsigned));
My code to unmarshal the data:
char * docname = (char *)key.data;
int s_docname = strlen(docname) + 1;
dev =*((unsigned *)((char *)key.data + s_docname));
inode = *((unsigned *)((char *)key.data + s_docname +
sizeof(unsigned)));
I can print the dev and inode out in dbx debugger by typing the same
code, but running the program always have the BUS error.
I realize this is a problems of memory alignement. s_docname has byte granularity, somehow I need to "round up" my s_docname by some suitable calculation. But I really don't know how to? Help is appreciated.
10 More Discussions You Might Find Interesting
1. Solaris
The problem is that I use this station as a remote computer for an AOI Orbotech machine and in the root of the station there is no memory available and on the refmgr folder on the same station there are 5GB free memory. So if anyone knows how can I free some space and not damaging the root files,... (0 Replies)
Discussion started by: Dac
0 Replies
2. UNIX for Dummies Questions & Answers
With older Linux servers, the command:
ls -al
would output text that would have the filenames all lined up in the same column (the owner and group names were truncated to produce a uniform right column).
In newer distros (i.e. RHEL 3), the command will push the right column out when owners... (0 Replies)
Discussion started by: robf
0 Replies
3. Programming
Hi, I try to marshal a unsigned int and a char * into a buffer, and then unmarshal them later to get them out. I need to put the char * in the front and unsigned int at the end of the buffer. However, my system always give me "BUS ERROR". I am using Sun Sparcs Sloris 2.10.
My code to marshal... (6 Replies)
Discussion started by: nj302
6 Replies
4. Solaris
Hi
I am facing a problem with memory in SunOS 5.9. I just want to check the memory usage. Can anybody suggest me a command that will help me in this regard. (4 Replies)
Discussion started by: rajarsi.ghosh
4 Replies
5. Shell Programming and Scripting
Dear Friends,
I've one file "sample.log" with the below comma separated lines:
BOND_FORWARD,0 succeeded,0 failed.
EQUITY_FORWARD,0 succeeded,0 failed.
FRA,12 succeeded,0 failed.
OPTION_BAR,16 succeeded,0 failed.
OPTION_VAN,76 succeeded,0 failed.
RENTOPT_CAP_FLOOR,4775 succeeded,0 failed.... (2 Replies)
Discussion started by: ganapati
2 Replies
6. Solaris
Hi folks, can you please help to print cpu and memory configuration on sun host. (4 Replies)
Discussion started by: ggolub
4 Replies
7. Shell Programming and Scripting
Hi Gurus,
This is my raw data. How would I able to format this output into a better alignment?
/dev/vg00/lvol5 /home 0.12 GB 0.02 GB 0.10 GB 19%
/dev/vg00/misc /misc 28.43 GB 4.92 GB 23.51 GB 17%
/dev/vg00/lvol6 /opt 8.25 GB 5.43 GB 2.82 GB 65%
/dev/vgsap/ora10264 ... (10 Replies)
Discussion started by: superHonda123
10 Replies
8. What is on Your Mind?
I used to have a Sparcstation20 some years ago with one of the HUGE HEAVY Sun monitors. I regret having gotten rid of it. Does anyone know where I can find a working sparcstation, monitor, keyboard, mouse these days?? (1 Reply)
Discussion started by: bsdforme
1 Replies
9. Shell Programming and Scripting
Hello Everyone,
I have a csv file with text qualifier as "" and data similar to below:
"1","abc","address1","US"
"2","def","address1 "characters in double-quote" address2","IND"
"3","ghi","address1","UK"
In above example, for record 2, we have an issue as in column3 contains double... (2 Replies)
Discussion started by: AnkitSenghani
2 Replies
10. Solaris
Hello all,
I recently powered on my Netra AX1105 server only to be greeted with the following error message. I am not sure what to do here,
I cant fun fsck on OK prompt.. did ok>boot -r and now it keeps booting from net, then I run ok>boot disk then outputs the following message... and keeps... (3 Replies)
Discussion started by: br1an
3 Replies
LEARN ABOUT CENTOS
hwloc_topology_membind_support
hwloc_topology_membind_support(3) Hardware Locality (hwloc) hwloc_topology_membind_support(3)
NAME
hwloc_topology_membind_support -
SYNOPSIS
#include <hwloc.h>
Data Fields
unsigned char set_thisproc_membind
unsigned char get_thisproc_membind
unsigned char set_proc_membind
unsigned char get_proc_membind
unsigned char set_thisthread_membind
unsigned char get_thisthread_membind
unsigned char set_area_membind
unsigned char get_area_membind
unsigned char alloc_membind
unsigned char firsttouch_membind
unsigned char bind_membind
unsigned char interleave_membind
unsigned char replicate_membind
unsigned char nexttouch_membind
unsigned char migrate_membind
Detailed Description
Flags describing actual memory binding support for this topology.
Field Documentation
unsigned char hwloc_topology_membind_support::alloc_membind
Allocating a bound memory area is supported.
unsigned char hwloc_topology_membind_support::bind_membind
Bind policy is supported.
unsigned char hwloc_topology_membind_support::firsttouch_membind
First-touch policy is supported.
unsigned char hwloc_topology_membind_support::get_area_membind
Getting the binding of a given memory area is supported.
unsigned char hwloc_topology_membind_support::get_proc_membind
Getting the binding of a whole given process is supported.
unsigned char hwloc_topology_membind_support::get_thisproc_membind
Getting the binding of the whole current process is supported.
unsigned char hwloc_topology_membind_support::get_thisthread_membind
Getting the binding of the current thread only is supported.
unsigned char hwloc_topology_membind_support::interleave_membind
Interleave policy is supported.
unsigned char hwloc_topology_membind_support::migrate_membind
Migration flags is supported.
unsigned char hwloc_topology_membind_support::nexttouch_membind
Next-touch migration policy is supported.
unsigned char hwloc_topology_membind_support::replicate_membind
Replication policy is supported.
unsigned char hwloc_topology_membind_support::set_area_membind
Binding a given memory area is supported.
unsigned char hwloc_topology_membind_support::set_proc_membind
Binding a whole given process is supported.
unsigned char hwloc_topology_membind_support::set_thisproc_membind
Binding the whole current process is supported.
unsigned char hwloc_topology_membind_support::set_thisthread_membind
Binding the current thread only is supported.
Author
Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.
Version 1.7 Sun Apr 7 2013 hwloc_topology_membind_support(3)