On 05/22/2012 03:42 PM, Janne Blomqvist wrote:
On Tue, May 22, 2012 at 10:33 PM, Janne Blomqvist
<blomqvist.ja...@gmail.com> wrote:
On Tue, May 22, 2012 at 5:57 PM, Tobias Burnus<bur...@net-b.de> wrote:
On 05/22/2012 03:06 PM, Tobias Burnus wrote:
The attached patches fix compilation issues on VxWorks.
a) VxWorks has strerror_r but contrary to POSIX, the function in VxWorks
(at least in older versions) takes only two arguments: errnum and buf and
not also the buffer length. I added a configure check for that variant.
I forgot to attach that patch. Now with patch and automake 1.11.1 for the
generated files.
Tobias
For the a) patch (strerror_r): The configure.ac diff occurs twice in
the patch, and the patch file has DOS line endings. Also, based on
some googling the vxworks 2-arg strerror_r returns OK or ERROR (an
enum, I presume). So the trick with builtin_choose_expr is both wrong
and unnecessary. Thus I'd replace
+#elif defined(HAVE_STRERROR_R_2ARGS)
+ return
+ __builtin_choose_expr (__builtin_classify_type (strerror_r (0, buf))
+ == 5,
+ /* char*-returning strerror_r() */
+ strerror_r (errnum, buf),
+ /* int-returning strerror_r () */
+ (strerror_r (errnum, buf), buf));
with
#elif defined(HAVE_STRERROR_R_2ARGS)
if (strerror_r (errnum, buf) == OK)
return buf;
return NULL;
Googling some more, it seems the vxworks STATUS is just a typedef for
int, so I guess the original patch works. Also the error checking is
not useful here, so we could do just
#elif defined(HAVE_STRERROR_R_2ARGS)
strerror_r (errnum, buf);
return buf;
All the proposed solutions work for me.
Robert Mason