summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-06-23 09:07:03 (GMT)
committerGuido van Rossum <guido@python.org>1992-06-23 09:07:03 (GMT)
commited233a56963233bbd646fdac01e55c9fdec50a30 (patch)
tree590cee6874280421f9288568015bf9b30326b8ed /Modules/socketmodule.c
parent5dc8eb0914a6fcea604a6626af9e63120e84b527 (diff)
downloadcpython-ed233a56963233bbd646fdac01e55c9fdec50a30.zip
cpython-ed233a56963233bbd646fdac01e55c9fdec50a30.tar.gz
cpython-ed233a56963233bbd646fdac01e55c9fdec50a30.tar.bz2
Changes for new UNIX-specific built-in module 'select' and new header for
interfaces to variants of select() system call, "myselect.h". This includes adding fileno() methods to files, sockets and stdwin.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 21ddf62..b1fc81f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -73,17 +73,13 @@ Socket methods:
#include "allobjects.h"
#include "modsupport.h"
+#include "myselect.h" /* Implies <sys/types.h>, <sys/time.h>, <sys/param.h> */
+
#include <signal.h>
-#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/time.h> /* Needed for struct timeval */
#include <netinet/in.h>
#include <sys/un.h>
#include <netdb.h>
-#ifdef _AIX /* I *think* this works */
-/* AIX defines fd_set in a separate file. Sigh... */
-#include <sys/select.h>
-#endif
/* Global variable holding the exception type for errors detected
@@ -526,6 +522,19 @@ sock_connect(s, args)
}
+/* s.fileno() method */
+
+static object *
+sock_fileno(s, args)
+ sockobject *s;
+ object *args;
+{
+ if (!getnoarg(args))
+ return NULL;
+ return newintobject((long) s->sock_fd);
+}
+
+
/* s.listen(n) method */
static object *
@@ -699,6 +708,7 @@ static struct methodlist sock_methods[] = {
{"bind", sock_bind},
{"close", sock_close},
{"connect", sock_connect},
+ {"fileno", sock_fileno},
{"listen", sock_listen},
{"makefile", sock_makefile},
{"recv", sock_recv},