diff options
author | Guido van Rossum <guido@python.org> | 2005-09-14 18:09:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2005-09-14 18:09:42 (GMT) |
commit | 8ee3e5aa9306a00573817e237bed4a482473e818 (patch) | |
tree | 6d5dc937d3b495c5295fe6c5c4b3e212ab5509c0 /Modules | |
parent | 539c662f10b41d15f658cabfa03cc02902862adc (diff) | |
download | cpython-8ee3e5aa9306a00573817e237bed4a482473e818.zip cpython-8ee3e5aa9306a00573817e237bed4a482473e818.tar.gz cpython-8ee3e5aa9306a00573817e237bed4a482473e818.tar.bz2 |
- Changes donated by Elemental Security to make it work on AIX 5.3
with IBM's 64-bit compiler (SF patch #1284289). This also closes SF
bug #105470: test_pwd fails on 64bit system (Opteron).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/grpmodule.c | 4 | ||||
-rwxr-xr-x | Modules/makexp_aix | 8 | ||||
-rw-r--r-- | Modules/pwdmodule.c | 4 | ||||
-rw-r--r-- | Modules/signalmodule.c | 1 | ||||
-rw-r--r-- | Modules/socketmodule.c | 42 | ||||
-rw-r--r-- | Modules/socketmodule.h | 39 |
6 files changed, 52 insertions, 46 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 136dca0..5f33fe9 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -85,9 +85,9 @@ mkgrent(struct group *p) static PyObject * grp_getgrgid(PyObject *self, PyObject *args) { - int gid; + unsigned int gid; struct group *p; - if (!PyArg_ParseTuple(args, "i:getgrgid", &gid)) + if (!PyArg_ParseTuple(args, "I:getgrgid", &gid)) return NULL; if ((p = getgrgid(gid)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrgid(): gid not found: %d", gid); diff --git a/Modules/makexp_aix b/Modules/makexp_aix index 9d3bccb..cb349c2 100755 --- a/Modules/makexp_aix +++ b/Modules/makexp_aix @@ -70,6 +70,12 @@ echo "*" >> $expFileName # left with just the symbol name. # 7. Eliminate all entries containing two colons, like Class::method # -/usr/ccs/bin/nm -Bex $inputFiles \ + +# Use -X32_64 if it appears to be implemented in this version of 'nm'. +NM=/usr/ccs/bin/nm +xopt=-X32_64 +$NM -e $xopt $1 >/dev/null 2>&1 || xopt="" + +$NM -Bex $xopt $inputFiles \ | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \ | sort | uniq >> $expFileName diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 805d4d9..f418e43 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -102,9 +102,9 @@ See pwd.__doc__ for more on password database entries."); static PyObject * pwd_getpwuid(PyObject *self, PyObject *args) { - int uid; + unsigned int uid; struct passwd *p; - if (!PyArg_ParseTuple(args, "i:getpwuid", &uid)) + if (!PyArg_ParseTuple(args, "I:getpwuid", &uid)) return NULL; if ((p = getpwuid(uid)) == NULL) { PyErr_Format(PyExc_KeyError, diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index f952e3e..bec2729 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -669,5 +669,6 @@ PyOS_AfterFork(void) PyEval_ReInitThreads(); main_thread = PyThread_get_thread_ident(); main_pid = getpid(); + _PyImport_ReInitLock(); #endif } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 059153d..4c0a0fc 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1344,7 +1344,7 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret) static PyObject * sock_accept(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; SOCKET_T newfd; socklen_t addrlen; PyObject *sock = NULL; @@ -1354,7 +1354,7 @@ sock_accept(PySocketSockObject *s) if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); #ifdef MS_WINDOWS newfd = INVALID_SOCKET; @@ -1365,7 +1365,7 @@ sock_accept(PySocketSockObject *s) Py_BEGIN_ALLOW_THREADS timeout = internal_select(s, 0); if (!timeout) - newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, + newfd = accept(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS @@ -1392,7 +1392,7 @@ sock_accept(PySocketSockObject *s) SOCKETCLOSE(newfd); goto finally; } - addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); if (addr == NULL) goto finally; @@ -1865,19 +1865,19 @@ Return a new socket object connected to the same system resource."); static PyObject * sock_getsockname(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getsockname(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getsockname(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -1894,19 +1894,19 @@ info is a pair (hostaddr, port)."); static PyObject * sock_getpeername(PySocketSockObject *s) { - char addrbuf[256]; + sock_addr_t addrbuf; int res; socklen_t addrlen; if (!getsockaddrlen(s, &addrlen)) return NULL; - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS - res = getpeername(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); + res = getpeername(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen); Py_END_ALLOW_THREADS if (res < 0) return s->errorhandler(); - return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, + return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto); } @@ -2115,7 +2115,7 @@ the remote end is closed and all data is read, return the empty string."); static PyObject * sock_recvfrom(PySocketSockObject *s, PyObject *args) { - char addrbuf[256]; + sock_addr_t addrbuf; PyObject *buf = NULL; PyObject *addr = NULL; PyObject *ret = NULL; @@ -2132,18 +2132,18 @@ sock_recvfrom(PySocketSockObject *s, PyObject *args) return NULL; Py_BEGIN_ALLOW_THREADS - memset(addrbuf, 0, addrlen); + memset(&addrbuf, 0, addrlen); timeout = internal_select(s, 0); if (!timeout) n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #else - (void *)addrbuf, &addrlen + (void *) &addrbuf, &addrlen #endif #else - (struct sockaddr *)addrbuf, &addrlen + (struct sockaddr *) &addrbuf, &addrlen #endif ); Py_END_ALLOW_THREADS @@ -2161,7 +2161,7 @@ sock_recvfrom(PySocketSockObject *s, PyObject *args) if (n != len && _PyString_Resize(&buf, n) < 0) return NULL; - if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, + if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen, s->sock_proto))) goto finally; @@ -2589,11 +2589,7 @@ static PyObject * socket_gethostbyname(PyObject *self, PyObject *args) { char *name; -#ifdef ENABLE_IPV6 - struct sockaddr_storage addrbuf; -#else - struct sockaddr_in addrbuf; -#endif + sock_addr_t addrbuf; if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 601c282..384d595 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -72,6 +72,26 @@ typedef int SOCKET_T; # define SIZEOF_SOCKET_T SIZEOF_INT #endif +/* Socket address */ +typedef union sock_addr { + struct sockaddr_in in; +#ifdef AF_UNIX + struct sockaddr_un un; +#endif +#ifdef ENABLE_IPV6 + struct sockaddr_in6 in6; + struct sockaddr_storage storage; +#endif +#ifdef HAVE_BLUETOOTH_BLUETOOTH_H + struct sockaddr_l2 bt_l2; + struct sockaddr_rc bt_rc; + struct sockaddr_sco bt_sco; +#endif +#ifdef HAVE_NETPACKET_PACKET_H + struct sockaddr_ll ll; +#endif +} sock_addr_t; + /* The object holding a socket. It holds some extra information, like the address family, which is used to decode socket address arguments properly. */ @@ -82,24 +102,7 @@ typedef struct { int sock_family; /* Address family, e.g., AF_INET */ int sock_type; /* Socket type, e.g., SOCK_STREAM */ int sock_proto; /* Protocol type, usually 0 */ - union sock_addr { - struct sockaddr_in in; -#ifdef AF_UNIX - struct sockaddr_un un; -#endif -#ifdef ENABLE_IPV6 - struct sockaddr_in6 in6; - struct sockaddr_storage storage; -#endif -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H - struct sockaddr_l2 bt_l2; - struct sockaddr_rc bt_rc; - struct sockaddr_sco bt_sco; -#endif -#ifdef HAVE_NETPACKET_PACKET_H - struct sockaddr_ll ll; -#endif - } sock_addr; + sock_addr_t sock_addr; /* Socket address */ PyObject *(*errorhandler)(void); /* Error handler; checks errno, returns NULL and sets a Python exception */ |