mmap and SIGBUS

Pavel Machek pavel at suse.cz
Sun Sep 23 18:34:21 UTC 2001


Hi!

> > > And I like mmap, not just because of the file size thing but because it
> > > should provide the fastest parsers and reduce VM page duplication.  (I
> > > use it for text parsing, and so does GCC these days).  SIGBUS is an
> > > essential ingredient in fast parsers, if they are to recover on
> > > problematic filesystems.  Fortunately, recovery from SIGBUS _is_
> > > possible when it's required.
> > 
> > I'm not very experienced in such matters, but I understand that the only
> > way to recover after SIGBUS and SIGSEGV is to use longjpm in the signal
> > handler.  Otherwise, the same instruction is executed, and if it's
> > something like "movl (%edx), %eax", there is no way to prevent it from
> > failing over and over again.  Is it correct?
> 
> No, it is possible to change the mapping and then return from the signal
> handler.  The same instruction can then proceed without raising a signal.
> 
> However, in the cases of a file read error (due to permissions or hard
> errors), you'd probably want to use a longjmp or siglongjmp.  That would
> at least prevent a viewer from crashing: it would report a read error
> instead.
> 
> That is probably the right thing to do for GMC.

Or you could map there /dev/zero, and set error flag somewhere,
killing longjmp mess.

								Pavel
> > Your sentiment about network transparency is very understandable.  Some
> > people want their fancy keyboard combinations work they do in Windows, but
> > the terminfo database doesn't have entries for keys like Ctrl-Alt-PgUp.
> > Making everyone happy requires either hacks or redesigning very
> > fundamental things.
> 
> Well, xterm, emacs, ghostview etc. and even netscape & mozilla work just
> fine remotely, so I'm disappointed to find Gnome apps have the special
> feature of _not_ working remotely.  It is a peculiar weakness, given
> that "network" is what the N stands for.

pavel at bug:~$ ssh elf
Last login: Sun Sep 23 22:30:15 2001 from bug.ucw.cz
You have mail.
TERM=xterm

pavel at Elf:~$ gmc

Gdk-WARNING **: locale not supported by C library

...and it worked for me. Pretty new debian/testing, but gnome apps
worked over network forever...

								Pavel
-- 
I'm pavel at ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at discuss at linmodems.org




More information about the mc-devel mailing list