tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: APR/native errors with non-blocking I/O
Date Fri, 31 May 2013 21:46:25 GMT
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: APR/native errors with non-blocking I/O

> I'm pretty sure that sterror is thread safe: it should just return a
> static char*.

Would that it were that simple.  Seriously, it's not thread safe; a second thread calling
the API can overlay a prior thread's message.  If it were thread safe, GNU wouldn't have bothered
with the _r alternative.

> "For unknown error numbers, the strerror() function will return its 
> result in a static buffer which may be overwritten by subsequent calls."
> Hopefully, that means static and private to the thread, but I don't know.

Nope, it's static and global.

> Back to the GNU man page, it says: "strerror()  is specified by
> POSIX.1-2001, C89, C99.  strerror_r() is specified by POSIX.1-2001.", so
> we may be able to rely upon it.

Yes, the _r alternative is available on many (probably most, these days) platforms, but it's
by no means universal.  (On another mailing list, we had someone still trying to use gcc 3.3...)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message