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.
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 @@
#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 @@
}
+/* 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 @@
{"bind", sock_bind},
{"close", sock_close},
{"connect", sock_connect},
+ {"fileno", sock_fileno},
{"listen", sock_listen},
{"makefile", sock_makefile},
{"recv", sock_recv},