signals (SIGBUS and SIGSEGV)

J

junky_fellow

what is the difference between signals SIGBUS and SIGSEGV ?
when does an application program receive SIGBUS and in which
cases SIGSEGV ?

thanx in advance for any help ...
 
U

Ulrich Eckhardt

junky_fellow said:
what is the difference between signals SIGBUS and SIGSEGV ?
when does an application program receive SIGBUS and in which
cases SIGSEGV ?

Neither of them are defined by the C language, so in order to get info you
better also say which operating system and then take all that to an OS
specific group.
That said, google didn't take me more than a minute to find something(ok, I
knew what I was looking for, but ...).

Uli
 
B

Ben Pfaff

Ulrich Eckhardt said:
Neither of them are defined by the C language, so in order to get info you
better also say which operating system and then take all that to an OS
specific group.

On the contrary, SIGSEGV is defined by the C standard as "an
invalid access to storage". SIGBUS is, as you say, not defined
as part of C.
 
J

James Stevenson

SEGV - Tends to mean you have attempted to access a segment of
memory that does not exist.

BUS - Tends to mean you have attempted to access a segment of
memory that dies exist but have accessed it in correctly
sometimes certin cpu's require address to be aligned on certin
boundryies eg 8 / 16 / 32 / 64 bit address

Although this is offtopic it can cause havoc when trying
to write C programs on certin types of cpu's because of certin
alignment problems.

PS. i had to rewrite malloc / free / etc.. to get around this
problem on 1 system.

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SIGBUS Error ! 0
Signal dispositions 32
coredump due to SIGBUS 0
Question about signals 4
SIGSEGV in malloc() 5
string close causes SIGSEGV 3
SIGSEGV due to fscanf 4
Testing if a pointer is valid 248

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top