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 DEBIAN
sdl_stretchrow2
SDL_SETROWSTRETCHCOD(3) Manual Pages SDL_SETROWSTRETCHCOD(3)
NAME
SDL_SetRowStretchCode, SDL_PutRowStretchCode, SDL_RunRowStretchCode, SDL_StretchRow1, SDL_StretchRow2, SDL_StretchRow3, SDL_StretchRow4 -
(src/SDL_stretchcode.h)
SYNOPSIS
#include <SDL_stretch.h>
unsigned char* SDL_SetRowStretchCode(int src_w, int dst_w, int bpp);
unsigned char* SDL_PutRowStretchCode(unsigned char* buffer, int buflen, int src_w, int dst_w, int bpp);
void SDL_RunRowStretchCode(unsigned char* buffer, unsigned char* src, unsigned char* dst);
void SDL_StretchRow1(Uint8 *src, int src_w, Uint8 *dst, int dst_w);
void SDL_StretchRow2(Uint16 *src, int src_w, Uint16 *dst, int dst_w);
void SDL_StretchRow3(Uint8 *src, int src_w, Uint8 *dst, int dst_w);
void SDL_StretchRow4(Uint32 *src, int src_w, Uint32 *dst, int dst_w);
DESCRIPTION
The SetRowStretchCode is a wrapper around PutRowStretchCode that uses the Adress and Size of the shared SDL_TheRowStretchCode buffer. The
PutRowStretchCode will fill the given buffer with an assembler stream that should be called with SDL_RunRowStretchCode. The assembler
stream is usually faster as all the scale decisions are done in advance of the execution. This helps when a RunCode is done multiple times
with the same src_w/dst_w/bpp pair. All the pixel-get and pixel-set calls are unrolled in that buffer. Therefore, the buffer should be big
enough - as a rule of thumb use a buffer of size (src_w+dst_w)*5
If PutCode or SetCode fails, a NULL is returned and SDL_SetError. Otherwise, the start adress of the machine code buffer is returned, which
is also the input argument of PutCode and RunCode.
If SDL_SetRowStretchCode fails, the SDL_StretchRow1 function must be used instead. The SDL_StretchRow1 function and its cousins are
singular routines that work in a tight loop to scale a single row. The number specifies the byte-width of each pixel (it is not a
bit-width!).
SDL_stretch 0.3.1 SDL_SETROWSTRETCHCOD(3)