]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Python/dynload_aix.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Python / dynload_aix.c
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Python/dynload_aix.c b/AppPkg/Applications/Python/Python-2.7.2/Python/dynload_aix.c
deleted file mode 100644 (file)
index 28247e1..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-\r
-/* Support for dynamic loading of extension modules */\r
-\r
-#include "Python.h"\r
-#include "importdl.h"\r
-\r
-#include <ctype.h>      /*  for isdigit()         */\r
-#include <errno.h>      /*  for global errno      */\r
-#include <string.h>     /*  for strerror()        */\r
-#include <stdlib.h>     /*  for malloc(), free()  */\r
-#include <sys/ldr.h>\r
-\r
-\r
-#ifdef AIX_GENUINE_CPLUSPLUS\r
-#include <load.h>\r
-#define aix_load loadAndInit\r
-#else\r
-#define aix_load load\r
-#endif\r
-\r
-\r
-extern char *Py_GetProgramName(void);\r
-\r
-typedef struct Module {\r
-    struct Module *next;\r
-    void          *entry;\r
-} Module, *ModulePtr;\r
-\r
-const struct filedescr _PyImport_DynLoadFiletab[] = {\r
-    {".so", "rb", C_EXTENSION},\r
-    {"module.so", "rb", C_EXTENSION},\r
-    {0, 0}\r
-};\r
-\r
-static int\r
-aix_getoldmodules(void **modlistptr)\r
-{\r
-    register ModulePtr       modptr, prevmodptr;\r
-    register struct ld_info  *ldiptr;\r
-    register char            *ldibuf;\r
-    register int             errflag, bufsize = 1024;\r
-    register unsigned int    offset;\r
-    char *progname = Py_GetProgramName();\r
-\r
-    /*\r
-    -- Get the list of loaded modules into ld_info structures.\r
-    */\r
-    if ((ldibuf = malloc(bufsize)) == NULL) {\r
-        PyErr_SetString(PyExc_ImportError, strerror(errno));\r
-        return -1;\r
-    }\r
-    while ((errflag = loadquery(L_GETINFO, ldibuf, bufsize)) == -1\r
-           && errno == ENOMEM) {\r
-        free(ldibuf);\r
-        bufsize += 1024;\r
-        if ((ldibuf = malloc(bufsize)) == NULL) {\r
-            PyErr_SetString(PyExc_ImportError, strerror(errno));\r
-            return -1;\r
-        }\r
-    }\r
-    if (errflag == -1) {\r
-        PyErr_SetString(PyExc_ImportError, strerror(errno));\r
-        return -1;\r
-    }\r
-    /*\r
-    -- Make the modules list from the ld_info structures.\r
-    */\r
-    ldiptr = (struct ld_info *)ldibuf;\r
-    prevmodptr = NULL;\r
-    do {\r
-        if (strstr(progname, ldiptr->ldinfo_filename) == NULL &&\r
-            strstr(ldiptr->ldinfo_filename, "python") == NULL) {\r
-            /*\r
-            -- Extract only the modules belonging to the main\r
-            -- executable + those containing "python" as a\r
-            -- substring (like the "python[version]" binary or\r
-            -- "libpython[version].a" in case it's a shared lib).\r
-            */\r
-            offset = (unsigned int)ldiptr->ldinfo_next;\r
-            ldiptr = (struct ld_info *)((char*)ldiptr + offset);\r
-            continue;\r
-        }\r
-        if ((modptr = (ModulePtr)malloc(sizeof(Module))) == NULL) {\r
-            PyErr_SetString(PyExc_ImportError, strerror(errno));\r
-            while (*modlistptr) {\r
-                modptr = (ModulePtr)*modlistptr;\r
-                *modlistptr = (void *)modptr->next;\r
-                free(modptr);\r
-            }\r
-            return -1;\r
-        }\r
-        modptr->entry = ldiptr->ldinfo_dataorg;\r
-        modptr->next  = NULL;\r
-        if (prevmodptr == NULL)\r
-            *modlistptr = (void *)modptr;\r
-        else\r
-            prevmodptr->next = modptr;\r
-        prevmodptr = modptr;\r
-        offset = (unsigned int)ldiptr->ldinfo_next;\r
-        ldiptr = (struct ld_info *)((char*)ldiptr + offset);\r
-    } while (offset);\r
-    free(ldibuf);\r
-    return 0;\r
-}\r
-\r
-\r
-static void\r
-aix_loaderror(const char *pathname)\r
-{\r
-\r
-    char *message[1024], errbuf[1024];\r
-    register int i,j;\r
-\r
-    struct errtab {\r
-        int errNo;\r
-        char *errstr;\r
-    } load_errtab[] = {\r
-        {L_ERROR_TOOMANY,               "too many errors, rest skipped."},\r
-        {L_ERROR_NOLIB,                 "can't load library:"},\r
-        {L_ERROR_UNDEF,                 "can't find symbol in library:"},\r
-        {L_ERROR_RLDBAD,\r
-         "RLD index out of range or bad relocation type:"},\r
-        {L_ERROR_FORMAT,                "not a valid, executable xcoff file:"},\r
-        {L_ERROR_MEMBER,\r
-         "file not an archive or does not contain requested member:"},\r
-        {L_ERROR_TYPE,                  "symbol table mismatch:"},\r
-        {L_ERROR_ALIGN,                 "text alignment in file is wrong."},\r
-        {L_ERROR_SYSTEM,                "System error:"},\r
-        {L_ERROR_ERRNO,                 NULL}\r
-    };\r
-\r
-#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0]))\r
-#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1)\r
-\r
-    PyOS_snprintf(errbuf, sizeof(errbuf), "from module %.200s ", pathname);\r
-\r
-    if (!loadquery(L_GETMESSAGES, &message[0], sizeof(message))) {\r
-        ERRBUF_APPEND(strerror(errno));\r
-        ERRBUF_APPEND("\n");\r
-    }\r
-    for(i = 0; message[i] && *message[i]; i++) {\r
-        int nerr = atoi(message[i]);\r
-        for (j=0; j<LOAD_ERRTAB_LEN ; j++) {\r
-            if (nerr == load_errtab[j].errNo && load_errtab[j].errstr)\r
-            ERRBUF_APPEND(load_errtab[j].errstr);\r
-        }\r
-        while (isdigit(Py_CHARMASK(*message[i]))) message[i]++ ;\r
-        ERRBUF_APPEND(message[i]);\r
-        ERRBUF_APPEND("\n");\r
-    }\r
-    errbuf[strlen(errbuf)-1] = '\0';            /* trim off last newline */\r
-    PyErr_SetString(PyExc_ImportError, errbuf);\r
-    return;\r
-}\r
-\r
-\r
-dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,\r
-                                    const char *pathname, FILE *fp)\r
-{\r
-    dl_funcptr p;\r
-\r
-    /*\r
-    -- Invoke load() with L_NOAUTODEFER leaving the imported symbols\r
-    -- of the shared module unresolved. Thus we have to resolve them\r
-    -- explicitly with loadbind. The new module is loaded, then we\r
-    -- resolve its symbols using the list of already loaded modules\r
-    -- (only those that belong to the python executable). Get these\r
-    -- with loadquery(L_GETINFO).\r
-    */\r
-\r
-    static void *staticmodlistptr = NULL;\r
-\r
-    if (!staticmodlistptr)\r
-        if (aix_getoldmodules(&staticmodlistptr) == -1)\r
-            return NULL;\r
-    p = (dl_funcptr) aix_load((char *)pathname, L_NOAUTODEFER, 0);\r
-    if (p == NULL) {\r
-        aix_loaderror(pathname);\r
-        return NULL;\r
-    }\r
-\r
-    return p;\r
-}\r