[Python-Dev] mkdev, major, st_rdev, etc

Martin v. Loewis martin@v.loewis.de
15 Jun 2002 23:22:19 +0200

Gustavo Niemeyer <niemeyer@conectiva.com> writes:

> - mkdev would be able to use the standard posix format, and would
>   work regardless of makedev's availability (mkdev is being
>   introduced in 2.3).

Notice that the this interface is *not* part of the Posix spec.


says that the only portable use of mknod is to create FIFOs; any use
where dev is not null is unspecified. Furthermore, major and minor are
not part of Posix.

> - TYPES.py is already trying to provide them, but it's broken
>   (indeed, it's more broken than that. h2py should use cpp to
>   preprocess the files, but that's something for another occasion).

That cannot work: the preprocessor will eat the macro definition, and
you have no way to find out what its body was.

> A patch providing these functions is available at
> http://www.python.org/sf/569139

I wonder whether the additional TRY_COMPILE test is really
necessary. Isn't it sufficient to restrict attention to systems on
which major and minor are macros, and use

#ifdef major

inside posixmodule.c?