lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jan 30, 2013 at 05:33:48PM -0800, William Ahern wrote:
<snip>
> FWIW, POSIX also enumerates many macros in the specification for <errno.h>,
> most of which are mandatory (but for which you can test with #ifdef anyhow).
> 
> This won't get all the possible errno macros on the local system, but covers
> most of the useful ones. I include these along with the one I've discovered
> at built-time, per chance there's a bug in the way I generate and scan the
> preprocessor output.
<snip>

Some interesting numbers:

o 71, the number errno macros recognized by luaposix

o 81, the number of errno macros specified by POSIX (optional and mandatory)

o 93, the number defined by OpenBSD 5.2
  - 91, the number of unique values therein

o 97, the number defined by FreeBSD 9.0
  - 94, the number of unique values therein

o 98, the number defined by NetBSD 5.1.2
  - 96, the number of unique values therein

o 108, the number defined by OS X 10.8.2
  - 106, the number of unique values therein

o 122, the number defined by Solaris 11
  - 121, the number of unique values therein

o 134, the number defined by Ubuntu Linux 12.04
  - 131, the number of unique values therein

To determine unique values I used the -x (expand) switch of my errno.ls
script:

./errno.ls -x | awk '$2~/^[0123456789]+$/{ print $2 }' | sort -u | wc -l

Note that the BSDs fail to define several POSIX specified macros. errno.ls
emits all the POSIX specified macros regardless, so you have to make sure
that they aren't left unexpanded by the preprocessor.