1vga_safety_fork(3) Svgalib User Manual vga_safety_fork(3)
2
3
4
6 vga_safety_fork - start a parallel process to restore the console at a
7 crash
8
10 #include <vga.h>
11
12 void vga_safety_fork(void (*shutdown_routine)(void))
13
14
16 Calling this at the start of a program results in a better chance of
17 textmode being restored in case of a crash. However it has to raise
18 the iopl level to 3 to work. This is a small security breach as it is
19 inherited to any programs you fork of. However, some SVGA card drivers
20 have to use iopl(3) anyway. If you use it call that function as the
21 very first vga_ function. Call it right before vga_init (3). Note that
22 vga_safety_fork() will already enter a graphicsmode. (For font and
23 grafix state saving). Don't overestimate the power of this function.
24 Your application will continue to run in background while a foreground
25 application will restore a usable screen and graphics mode in case of a
26 crash.
27
28 The forktest(6) demo shows the principal operation. (*shutdown_rou‐
29 tine)() is called when the system crashes. However, realize that the
30 call will take in a forked copy of your program, you'll not have access
31 to any globals modified after the vga_safety_fork() call!
32
34 svgalib(7), vgagl(7), libvga.config(5), forktest(6), vga_init(3),
35
36
38 This manual page was edited by Michael Weller <eowmob@exp-math.uni-
39 essen.de>. The exact source of the referenced function as well as of
40 the original documentation is unknown.
41
42 It is very likely that both are at least to some extent are due to Harm
43 Hanemaayer <H.Hanemaayer@inter.nl.net>.
44
45 Occasionally this might be wrong. I hereby asked to be excused by the
46 original author and will happily accept any additions or corrections to
47 this first version of the svgalib manual.
48
49
50
51Svgalib (>= 1.2.11) 27 July 1997 vga_safety_fork(3)