]> granicus.if.org Git - python/commitdiff
Doc strings by Chris Petrilli.
authorGuido van Rossum <guido@python.org>
Mon, 23 Nov 1998 15:32:55 +0000 (15:32 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 23 Nov 1998 15:32:55 +0000 (15:32 +0000)
Modules/fcntlmodule.c

index 8f7407f52ab0053c03a2c25f06f813ebfe9f8ca2..6e7c1c2d9c1840a257e77d9ffa945cee8e1bd4f0 100644 (file)
@@ -95,6 +95,15 @@ fcntl_fcntl(self, args)
        return PyInt_FromLong((long)ret);
 }
 
+static char fcntl_doc [] =
+
+"fcntl(fd, opt, [arg])\n\
+\n\
+Perform the requested operation on file descriptor fd.  The operation\n\
+is defined by op and is operating system dependent.  Typically these\n\
+codes can be retrieved from the library module FCNTL.  The argument arg\n\
+is optional, and defaults to 0; it may be an int or a string.";
+
 
 /* ioctl(fd, opt, [arg]) */
 
@@ -146,6 +155,14 @@ fcntl_ioctl(self, args)
        return PyInt_FromLong((long)ret);
 }
 
+static char ioctl_doc [] =
+"ioctl(fd, opt, [arg])\n\
+\n\
+Perform the requested operation on file descriptor fd.  The operation\n\
+is defined by op and is operating system dependent.  Typically these\n\
+codes can be retrieved from the library module IOCTL.  The argument arg\n\
+is optional, and defaults to 0; it may be an int or a string.";
+
 
 /* flock(fd, operation) */
 
@@ -198,6 +215,14 @@ fcntl_flock(self, args)
        return Py_None;
 }
 
+static char flock_doc [] =
+"flock(fd, operation)\n\
+\n\
+Perform the lock operation op on file descriptor fd.  See the Unix \n\
+manual flock(3) for details.  (On some systems, this function is\n\
+emulated using fcntl().)";
+
+
 /* lockf(fd, operation) */
 static PyObject *
 fcntl_lockf(self, args)
@@ -244,17 +269,30 @@ fcntl_lockf(self, args)
        return Py_None;
 }
 
+static char lockf_doc [] =
+"lockf (fd, operation)\n\
+\n\
+This is a wrapper around the FCNTL.F_SETLK and FCNTL.F_SETLKW fcntl()\n\
+calls.  See the Unix manual for details.";
+
 /* List of functions */
 
 static PyMethodDef fcntl_methods[] = {
-       {"fcntl",       fcntl_fcntl},
-       {"ioctl",       fcntl_ioctl},
-       {"flock",       fcntl_flock},
-       {"lockf",       fcntl_lockf, 1},
+       {"fcntl",       fcntl_fcntl, 0, fcntl_doc},
+       {"ioctl",       fcntl_ioctl, 0, ioctl_doc},
+       {"flock",       fcntl_flock, 0, flock_doc},
+       {"lockf",       fcntl_lockf, 1, lockf_doc},
        {NULL,          NULL}           /* sentinel */
 };
 
 
+static char module_doc [] =
+
+"This module performs file control and I/O control on file \n\
+descriptors.  It is an interface to the fcntl() and ioctl() Unix\n\
+routines.  File descriptors can be obtained with the fileno() method of\n\
+a file or socket object.";
+
 /* Module initialisation */
 
 static int
@@ -287,8 +325,8 @@ initfcntl()
 {
        PyObject *m, *d;
 
-       /* Create the module and add the functions */
-       m = Py_InitModule("fcntl", fcntl_methods);
+       /* Create the module and add the functions and documentation */
+       m = Py_InitModule3("fcntl", fcntl_methods, module_doc);
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);