From owner-freebsd-questions Wed Jan 12 18:48:30 2000 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.pit.adelphia.net (alpha.pit.adelphia.net [24.48.44.2]) by hub.freebsd.org (Postfix) with ESMTP id DEBE414D15 for ; Wed, 12 Jan 2000 18:48:27 -0800 (PST) (envelope-from evstiounin@adelphia.net) Received: from evstiouninadelphia ([24.48.53.252]) by alpha.pit.adelphia.net (8.9.2/8.9.2) with SMTP id VAA10127 for ; Wed, 12 Jan 2000 21:48:16 -0500 (EST) Message-ID: <00a201bf5d70$fb0cbea0$fc353018@evstiouninadelphia.net.pit.adelphia.net> From: "Mikhail Evstiounin" To: Subject: Re: Giving a sighandler more information Date: Wed, 12 Jan 2000 21:50:41 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG -----Original Message----- From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG Date: Wednesday, January 12, 2000 9:37 PM Subject: Re: Giving a sighandler more information >Laurence Berland wrote in list.freebsd-questions: > > Followup question: is a sig_atomic_t appropriate to hold the value of a > > FILE * ? > >No. It is only guaranteed to be large enough to hold an int. >Of course, on intel PCs, a pointer has the same size as an int, >but not on other platforms (e.g. the Alpha). Therefore, >portable programs cannot store a pointer in a sig_atomic_t. Sorry, guys, but it requirenments of ANSI that sizeof(void*)==sizeof(int). Don't get me wrong, I like Alpha, but alpha compiler is not 100% ANSI compatible. If you take a look at HP aCC and 64 bit architecture - you will see the same. So, let me rephrase it - in ANSI world you could do it. and question does it mean that alpha integer is 32 bit, or pointer has more than 64? I used GNU C a couple of times there and everything was OK. Is it a special compiler? > >Apart from that: You can't use a FILE* within a signal handler >anyway, because most of stdio's functions are not guaranteed to >be re-entrant. > >If you have to do something with a file within a signal >handler, use the lower-level file handling functions based on >file descriptors, i.e. open(), read(), write(), close(). >Conveniently, a file descriptor fits in a sig_atomic_t, too. > >Please refer to the sigaction(2) manpage, it contains a >complete list of all functions that are "async-signal safe". >All other functions are _not_ safe to use from within a signal >handler. > >Regards > Oliver > >-- >Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany >(Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) > >"In jedem Stück Kohle wartet ein Diamant auf seine Geburt" > (Terry Pratchett) > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message