[Python-Dev] mknod for posixmodule (original) (raw)

Gustavo Niemeyer niemeyer@conectiva.com
Sat, 13 Apr 2002 03:59:36 -0300


People,

we need support for mknod() in python mode. This makes possible for python modules like tarfile.py to create special nodes.

The first option is of course adding a plain mknod(), with similar parameters to that found in the C interface, like other examples we have in the module. The closest interface would be something like:

mknod(filename, mode, major, minor)

But the mode parameter, like in the C interface, may be or'ed with S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO. That seems unpythonic. The other option that comes to my mind is:

mknod(filename, mode, type, major, minor)

That would make more explicit the need for type. OTOH, we already have in the library functions for creating fifos and regular files (S_IFIFO and S_IFREG). So there's another option:

mkblkdev(filename, mode, major, minor) mkchrdev(filename, mode, major, minor)

What do you think?

-- Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]