mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487)
* Remove an unnecessary cache of shared object handles.
This commit is contained in:
parent
052930f241
commit
fed2fc4443
2 changed files with 4 additions and 22 deletions
|
@ -0,0 +1,4 @@
|
||||||
|
An obsolete internal cache of shared object file handles added in 1995 that
|
||||||
|
attempted, but did not guarantee, that a .so would not be dlopen'ed twice to
|
||||||
|
work around flaws in mid-1990s posix-ish operating systems has been removed
|
||||||
|
from dynload_shlib.c.
|
|
@ -48,13 +48,6 @@ const char *_PyImport_DynLoadFiletab[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
|
||||||
dev_t dev;
|
|
||||||
ino_t ino;
|
|
||||||
void *handle;
|
|
||||||
} handles[128];
|
|
||||||
static int nhandles = 0;
|
|
||||||
|
|
||||||
|
|
||||||
dl_funcptr
|
dl_funcptr
|
||||||
_PyImport_FindSharedFuncptr(const char *prefix,
|
_PyImport_FindSharedFuncptr(const char *prefix,
|
||||||
|
@ -77,22 +70,9 @@ _PyImport_FindSharedFuncptr(const char *prefix,
|
||||||
LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname);
|
LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname);
|
||||||
|
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
int i;
|
|
||||||
struct _Py_stat_struct status;
|
struct _Py_stat_struct status;
|
||||||
if (_Py_fstat(fileno(fp), &status) == -1)
|
if (_Py_fstat(fileno(fp), &status) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (i = 0; i < nhandles; i++) {
|
|
||||||
if (status.st_dev == handles[i].dev &&
|
|
||||||
status.st_ino == handles[i].ino) {
|
|
||||||
p = (dl_funcptr) dlsym(handles[i].handle,
|
|
||||||
funcname);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nhandles < 128) {
|
|
||||||
handles[nhandles].dev = status.st_dev;
|
|
||||||
handles[nhandles].ino = status.st_ino;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dlopenflags = _PyInterpreterState_GET()->dlopenflags;
|
dlopenflags = _PyInterpreterState_GET()->dlopenflags;
|
||||||
|
@ -126,8 +106,6 @@ _PyImport_FindSharedFuncptr(const char *prefix,
|
||||||
Py_DECREF(path);
|
Py_DECREF(path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (fp != NULL && nhandles < 128)
|
|
||||||
handles[nhandles++].handle = handle;
|
|
||||||
p = (dl_funcptr) dlsym(handle, funcname);
|
p = (dl_funcptr) dlsym(handle, funcname);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue