[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new files imported without new modules added
From: |
Bruno Haible |
Subject: |
Re: new files imported without new modules added |
Date: |
Tue, 24 May 2011 23:39:13 +0200 |
User-agent: |
KMail/1.9.9 |
Sam Steingold wrote:
> > strerror and perror now depend on strerror_r ...
>
> I do _not_ want strerror_r.
Actually you do want strerror_r in clisp, not strerror.
There are two kinds of uses of strerror() in clisp:
1) In code that ends up in lisp.run (e.g. errunix.d). This executable has
the option to use multiple threads. Therefore strerror_r should be
used instead of strerror(), because - as Eric explained - when you
call strerror(EACCES) in one thread and strerror(ENOENT) in another
thread at nearly the same time, by the time you retrieve the error message
in the first thread, it might read "Permissionle or directory".
YES, even for fixed error messages, strerror() uses a static buffer
in the majority of OSes (at least on NetBSD, HP-UX, native Win32, Cygwin).
2) In the launcher program _clisp.c, the use of strerror() is misplaced:
if (!CloseHandle(pinfo.hProcess)) goto w32err;
if (com_initialized) CoUninitialize();
return exitcode;
w32err:
fprintf(stderr,"%s:\n * %s\n * %s\n * [%s]\n = %s\n",program_name,
executable,resolved,command_line,strerror(GetLastError()));
On native Windows, there are two distinct enumerations of error codes:
- the Win32 one, to be retrieved via GetLastError() and to be formatted
via FormatMessage.
- the ANSI C one, to be retrieved via 'errno' and to be formatted
via 'strerror' (which makes a lookup in _sys_errlist, *not* a call
to FormatMessage).
So you really need to use FormatMessage here, not strerror().
Bruno
--
In memoriam Georges Darboy <http://en.wikipedia.org/wiki/Georges_Darboy>
- Re: strerror vs. threads, (continued)
- Re: strerror vs. threads, Paul Eggert, 2011/05/24
- Re: strerror vs. threads, Simon Josefsson, 2011/05/24
- Re: strerror vs. threads, Eric Blake, 2011/05/24
- Re: strerror vs. threads, Simon Josefsson, 2011/05/25
- Re: strerror vs. threads, Eric Blake, 2011/05/25
- coping with conflicting strerror_r signatures [was: strerror vs. threads], Eric Blake, 2011/05/25
- Re: strerror vs. threads [was: new files imported without new modules added], Sam Steingold, 2011/05/24
- Re: strerror vs. threads [was: new files imported without new modules added], Eric Blake, 2011/05/24
- [PATCH 1/2] perror: call strerror_r directly, Eric Blake, 2011/05/24
- [PATCH 2/2] strerror: drop strerror_r dependency, Eric Blake, 2011/05/24
- Re: new files imported without new modules added,
Bruno Haible <=
- Re: new files imported without new modules added, Eric Blake, 2011/05/24