What is the cause of error "Bus Error"?

What is the cause of error "Bus Error"?

Post by Carfield Yi » Tue, 21 Mar 2000 04:00:00



I have a problem, I have a client and server talk program written in C,
and now I modify it to do the other thing (test the network speed).
In the connection statement in these program haven't change, but I
don't know why that when the client program call connect() function the
program terminate and print "Bus Error" on the screen, do you know what
is the cause? Please help!

Besides, what is the shell command that can tell me the IP address
using host name?

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

What is the cause of error "Bus Error"?

Post by Phil Edwar » Tue, 21 Mar 2000 04:00:00



+ I have a problem, I have a client and server talk program written in C,
+ and now I modify it to do the other thing (test the network speed).
+ In the connection statement in these program haven't change, but I
+ don't know why that when the client program call connect() function the
+ program terminate and print "Bus Error" on the screen, do you know what
+ is the cause? Please help!

You're probably doing some kind of unaligned access to data; check your
typecasts.  Below is Dan Sheppard's explanation of signals from four
years ago.

+ Besides, what is the shell command that can tell me the IP address
+ using host name?

There are several.  You're probably thinking of nslookup.

Luck++;
Phil

=======================================================================
Newsgroups: alt.humor.best-of-usenet
Subject: [ucam.chat] SIGBUS
Date: 21 May 1996 20:40:03 -0700

Subject: Re: SIGBUS
Newsgroup: ucam.chat


>I've just been handed two of these by trn. What is it? Is it the sort of
>thing trn can do itself, like a SIGSEGV, or a hardware fault?

A SIGSEGV is an attempt to do an _illegal_ thing,
A SIGBUS  is an attempt to do an _immoral_ thing.

For example *NULL is illegal, it's breaking and entering, trying to
smash up something which you have no right to,

whereas *(char *)0x00000002 on many larger machines is immoral, you're trying
to get your memory to do a misaligned access, half from one side of
a wall and half from another, which would, no doubt, get it thrown out
of the army.

For all those wondering I present the dps guide to SIGs.

SIGHUP    a. You're dumped, see if you can live alone, cackle, cackle.
          b. I think you need to reconsider your position in life.

SIGINT    Oy, you.

SIGQUIT   Bog off.

SIGILL    What, me do that, with my war-wounded ALU?

SIGBUS    Eugh, you're disgusting, I couldn't do that.

SIGFPE    Look I never was any good at maths, I was more of an arts
          person really.....

SIGKILL   You are dead.

SIGUSR1   Prod (Left hand side)

SIGSEGV   You're nicked, sonny.

SIGUSR2   Prod (Right hand side)

SIGPIPE   Lecturer, the students are asleep, nobody's listening to you.

SIGALRM   Student, you're asleep.

SIGTERM   You are being asked to resign.....

SIGCHLD   Mr. Process, it's bad news I'm afraid, perhaps you better
          sit down, it's your child....

SIGCONT   Sorry about that, right, yes, anyway, I'm all ears again
          now, fire away.

SIGSTOP   Hang on a moment, I think I'm going to sneeze.

SIGTSTP   Could you stop in a sec, I think I'm going to sneeze.

SIGTTIN   Hang on, you mean there's a real world out there???  And I
          need to ask them a question?

SIGTTOU   Hang on, you mean there's a real world out there???  And I
          need to tell them something?

SIGURG    I am an orange, you are a camel, la de da, brwrwrwrwrwrwrw.

SIGWINCH  Wow, I can see for miles now. The worlds really big, hang on
          it's shrinking.  Where's that chocolate?

SIGPWR    The auxillary power is failing Cap'n.  We've got 20 minutes
          of air left, Jim.
=======================================================================

 
 
 

What is the cause of error "Bus Error"?

Post by Carfield Yi » Wed, 22 Mar 2000 04:00:00


Thx a lot!

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

1. "Bus error" please help, I am going insane!

On solaris, I am writing a client/server gizmo using sockets.  Now, the
problem I'm running into is this:

I have an array of void*.

void *myargs[ HOWEVERMANYIWANT ]

I pass this array to a function:

myfunction( void **args ) { ...

Now, inside that function I try and dereference the args, depending on the
type I stuffed into it earlier.

int i = *(int*)args[0];

(Can you believe that this blows up in my face and gives me a "Bus
Error"??!!)
(Maybe you can...so then let me know!)

Now, maybe it is important to know that the original args array of void *'s
was declared in a static library, and linked in with the program.  It is
also certainly large enough for the integer.

But now here comes the amazing part, in the debugger, when I do a:
'print args[0]'
it spits out an address 'xxxyyy', when I examined the memory at this
address, it pointed to exactly the integer I wanted in the first place
(namely, 0xDEADBEEF ).

Further confusing me completely is the fact that a
memcpy ( &someint, args[0], sizeof( int ) ); ----> works! yay, i got my
integer.

BUT, if I use the type 'double' ( memcpy( &somedouble, args[0], sizeof(
double) ) ),
this fails, with.....sadly....a "Bus Error".

In the debugger, the error is reported as a segmentation violation.
However, when run on its own the error is "Bus error".

People, I am going insane....If you read through this all the way, I say to
you, thanks.  I appreciate any help.  Please let me know whats going on!

Imran

2. i18n - cyrillic. upgrade from 7.1 to 7.2 problem.

3. ps command failed and produced "Bus error" or "Segmentation fault" messages

4. IP-Masquerading: domain server not found from winNT

5. "Bus error" or "Segmentation Fault" By ps command

6. Appending a string after a designated text

7. GETSERVBYNAME()????????????????????"""""""""""""

8. socket() - Other address families?

9. APACHE Error: "Signaling Error: error already pending"

10. tinyX gives "xinit: Unknown error (errno 0): Client error." error and dies

11. gcc error: "elf error: file insn-attrtab.o: elf_strptr: Request error: no string table"

12. Install error on G3: "error unpacking archive: unknown error"

13. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""