[Python-checkins] python/dist/src/Modules posixmodule.c,2.227,2.228

loewis@sourceforge.net loewis@sourceforge.net
Sun, 14 Apr 2002 03:19:46 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv28399/Modules

Modified Files:
	posixmodule.c 
Log Message:
Patch #543447: Add posix.mknod.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.227
retrieving revision 2.228
diff -C2 -d -r2.227 -r2.228
*** posixmodule.c	3 Apr 2002 01:47:00 -0000	2.227
--- posixmodule.c	14 Apr 2002 10:19:44 -0000	2.228
***************
*** 4583,4587 ****
  #ifdef HAVE_MKFIFO
  static char posix_mkfifo__doc__[] =
! "mkfifo(file, [, mode=0666]) -> None\n\
  Create a FIFO (a POSIX named pipe).";
  
--- 4583,4587 ----
  #ifdef HAVE_MKFIFO
  static char posix_mkfifo__doc__[] =
! "mkfifo(filename, [, mode=0666]) -> None\n\
  Create a FIFO (a POSIX named pipe).";
  
***************
*** 4589,4599 ****
  posix_mkfifo(PyObject *self, PyObject *args)
  {
! 	char *file;
  	int mode = 0666;
  	int res;
! 	if (!PyArg_ParseTuple(args, "s|i:mkfifo", &file, &mode))
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
! 	res = mkfifo(file, mode);
  	Py_END_ALLOW_THREADS
  	if (res < 0)
--- 4589,4632 ----
  posix_mkfifo(PyObject *self, PyObject *args)
  {
! 	char *filename;
  	int mode = 0666;
  	int res;
! 	if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode))
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
! 	res = mkfifo(filename, mode);
! 	Py_END_ALLOW_THREADS
! 	if (res < 0)
! 		return posix_error();
! 	Py_INCREF(Py_None);
! 	return Py_None;
! }
! #endif
! 
! 
! #ifdef HAVE_MKNOD
! static char posix_mknod__doc__[] =
! "mknod(filename, [, mode=0600, major, minor]) -> None\n\
! Create a filesystem node (file, device special file or named pipe)\n\
! named filename. mode specifies both the permissions to use and the\n\
! type of node to be created, being combined (bitwise OR) with one of\n\
! S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\
! major and minor define the newly created device special file, otherwise\n\
! they are ignored.";
! 
! 
! static PyObject *
! posix_mknod(PyObject *self, PyObject *args)
! {
! 	char *filename;
! 	int mode = 0600;
! 	int major = 0;
! 	int minor = 0;
! 	int res;
! 	if (!PyArg_ParseTuple(args, "s|iii:mknod", &filename,
! 			      &mode, &major, &minor))
! 		return NULL;
! 	Py_BEGIN_ALLOW_THREADS
! 	res = mknod(filename, mode, makedev(major, minor));
  	Py_END_ALLOW_THREADS
  	if (res < 0)
***************
*** 6336,6339 ****
--- 6369,6375 ----
  #ifdef HAVE_MKFIFO
  	{"mkfifo",	posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__},
+ #endif
+ #ifdef HAVE_MKNOD
+ 	{"mknod",	posix_mknod, METH_VARARGS, posix_mknod__doc__},
  #endif
  #ifdef HAVE_FTRUNCATE