Xref: utzoo comp.unix.i386:3785 comp.unix.xenix:10784 comp.unix.wizards:21195 Path: utzoo!attcan!uunet!ibmpa!slo!jsalter From: jsalter@slo.uucp (James Salter) Newsgroups: comp.unix.i386,comp.unix.xenix,comp.unix.wizards Subject: Re: floating point exception status not inherited by exec Message-ID: <4624@ibmpa.UUCP> Date: 25 Mar 90 03:29:38 GMT References: <795@s7.Morgan.COM> Sender: news@ibmpa.UUCP Reply-To: jsalter@slo.UUCP (James Salter) Organization: IBM AWD, Palo Alto Lines: 36 In article <795@s7.Morgan.COM> amull@Morgan.COM (Andrew P. Mullhaupt) writes: > > On SCO UNIX System V/386 R3.2: > >I need to preserve the state of the floating point exception mask >across an exec(). Experiments show that the exception mask and the >sticky bit status seems to be preserved across fork() (i.e. is >inherited by a child) but when exec is invoked, the exceptions may >change. This has ummm - 'unpleasant' consequences. Note that it >is not sufficient to work at the level of SIGFPE, but it is actually >required to specify the floating point exception mask and sticky bit >status to different values than the (otherwise sensible) defaults. You mean apart from rewriting the exec() function? :-) Realistically, the only way you could preserve the state is through a save mechanism before the exec() and a restore after the exec(). In the System V/386 3.2 programmer's reference manual I have, it lists some routines under FPGETROUND(3C). Including the functions: fpgetmask(), fpsetmask(), fpgetsticky(), fpsetsticky() and the include file: #include I don't know what SCO version does... To do your own such routines, it would require some machine coding and use of at least a short int to save just the status word. If you require the status AND the control word to be saved, just store it into a long int and do some byte shifting. Or use two shorts if you're lazy... >Andrew Mullhaupt jim/jsalter IBM AWD T465/(415)855-4427 VNET: JSALTER at PALOALTO UUCP: ..!uunet!ibmsupt!jsalter Disc: Any opinions are mine. IP: ibmsupt!jsalter@uunet.uu.net "PS/2 it, or DIE!"