void init() { output_type = OUPUT_EXE; subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI; lib_path = get_lib_path(); linker.init(); }
static void show_libdir(bool all) { char path[MAXPGPATH]; if (all) printf("LIBDIR = "); get_lib_path(mypath, path); cleanup_path(path); printf("%s\n", path); }
SmartPtr<X3aAnalyzer> X3aAnalyzerLoader::load_dynamic_analyzer (SmartPtr<X3aAnalyzerLoader> &self) { XCAM_ASSERT (self.ptr () == this); SmartPtr<X3aAnalyzer> analyzer; XCam3ADescription *desc = (XCam3ADescription*)load_library (get_lib_path ()); analyzer = new DynamicAnalyzer (desc, self); if (!analyzer.ptr ()) { XCAM_LOG_WARNING ("create DynamicAnalyzer from lib failed"); close_handle (); return NULL; } XCAM_LOG_INFO ("analyzer(%s) created from 3a lib", XCAM_STR (analyzer->get_name())); return analyzer; }
SmartPtr<X3aAnalyzer> X3aAnalyzerLoader::load_hybrid_analyzer (SmartPtr<X3aAnalyzerLoader> &self, SmartPtr<IspController> &isp, const char *cpf_path) { XCAM_ASSERT (self.ptr () == this); SmartPtr<X3aAnalyzer> analyzer; #if HAVE_IA_AIQ XCam3ADescription *desc = (XCam3ADescription*)load_library (get_lib_path ()); analyzer = new HybridAnalyzer (desc, self, isp, cpf_path); #endif if (!analyzer.ptr ()) { XCAM_LOG_WARNING ("create HybridAnalyzer from lib failed"); close_handle (); return NULL; } XCAM_LOG_INFO ("analyzer(%s) created from 3a lib", XCAM_STR (analyzer->get_name())); return analyzer; }
void tlink(void) { int i; FILE *fp; if ( ( obj_file_cnt() + lib_file_cnt() ) > 0 ) { if ( get_dosex() != OPT_PMODE ) fprintf( stderr, "TLINK use only with PMODE!\n" ); fp = response( RESPONSE ); fprintf( fp, "/3/c/d%s%s", get_option(OPT_MAPFILE) ? "/m/l/s" : "/x", get_option(OPT_DEBUG) ? "/v" : "" ); if ( lib_file_cnt() > 0 ) fprintf(fp, "/L%s ", get_lib_path() ); if (! get_option(OPT_NODEFLIB) ) { if ( get_option(OPT_DEBUG) ) fprintf(fp,"%s\\C0DOSD.OBJ", get_syslib_path() ); else fprintf(fp,"%s\\C0DOS.OBJ", get_syslib_path() ); } for ( i = 0; i < obj_file_cnt(); i++ ) fprintf( fp, " %s", obj_file(i) ); fprintf( fp, ",%s,%s,", get_exe_name(), get_option( OPT_MAPFILE) ? get_exe_name() : "NUL" ); if (! get_option(OPT_NODEFLIB) ) fprintf(fp,"%s\\CLDOS.LIB", get_syslib_path() ); for ( i = 0; i < lib_file_cnt(); i++ ) fprintf( fp, " %s", lib_file(i) ); fprintf( fp, "\n" ); fclose(fp); exec("TLINK", "@" RESPONSE ); if (! get_option(OPT_KEEPRSP) ) unlink( RESPONSE ); } }
SmartPtr<SmartAnalysisHandler> SmartAnalyzerLoader::load_smart_handler (SmartPtr<SmartAnalyzerLoader> &self) { XCAM_ASSERT (self.ptr () == this); SmartPtr<SmartAnalysisHandler> handler; XCamSmartAnalysisDescription *desc = (XCamSmartAnalysisDescription*)load_library (get_lib_path ()); if (NULL == desc) { XCAM_LOG_WARNING ("load smart handler lib symbol failed"); return NULL; } handler = new SmartAnalysisHandler (desc, self, _name); if (!handler.ptr ()) { XCAM_LOG_WARNING ("create smart handler failed"); close_handle (); return NULL; } XCAM_LOG_INFO ("smart handler(%s) created from lib", XCAM_STR (handler->get_name())); return handler; }
/* * get_configdata(const char *my_exec_path, size_t *configdata_len) * * Get configure-time constants. The caller is responsible * for pfreeing the result. */ ConfigData * get_configdata(const char *my_exec_path, size_t *configdata_len) { ConfigData *configdata; char path[MAXPGPATH]; char *lastsep; int i = 0; /* Adjust this to match the number of items filled below */ *configdata_len = 23; configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData)); configdata[i].name = pstrdup("BINDIR"); strlcpy(path, my_exec_path, sizeof(path)); lastsep = strrchr(path, '/'); if (lastsep) *lastsep = '\0'; cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("DOCDIR"); get_doc_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("HTMLDIR"); get_html_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("INCLUDEDIR"); get_include_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("PKGINCLUDEDIR"); get_pkginclude_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("INCLUDEDIR-SERVER"); get_includeserver_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("LIBDIR"); get_lib_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("PKGLIBDIR"); get_pkglib_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("LOCALEDIR"); get_locale_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("MANDIR"); get_man_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("SHAREDIR"); get_share_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("SYSCONFDIR"); get_etc_path(my_exec_path, path); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("PGXS"); get_pkglib_path(my_exec_path, path); strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path)); cleanup_path(path); configdata[i].setting = pstrdup(path); i++; configdata[i].name = pstrdup("CONFIGURE"); #ifdef VAL_CONFIGURE configdata[i].setting = pstrdup(VAL_CONFIGURE); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("CC"); #ifdef VAL_CC configdata[i].setting = pstrdup(VAL_CC); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("CPPFLAGS"); #ifdef VAL_CPPFLAGS configdata[i].setting = pstrdup(VAL_CPPFLAGS); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("CFLAGS"); #ifdef VAL_CFLAGS configdata[i].setting = pstrdup(VAL_CFLAGS); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("CFLAGS_SL"); #ifdef VAL_CFLAGS_SL configdata[i].setting = pstrdup(VAL_CFLAGS_SL); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("LDFLAGS"); #ifdef VAL_LDFLAGS configdata[i].setting = pstrdup(VAL_LDFLAGS); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("LDFLAGS_EX"); #ifdef VAL_LDFLAGS_EX configdata[i].setting = pstrdup(VAL_LDFLAGS_EX); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("LDFLAGS_SL"); #ifdef VAL_LDFLAGS_SL configdata[i].setting = pstrdup(VAL_LDFLAGS_SL); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("LIBS"); #ifdef VAL_LIBS configdata[i].setting = pstrdup(VAL_LIBS); #else configdata[i].setting = pstrdup(_("not recorded")); #endif i++; configdata[i].name = pstrdup("VERSION"); configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION); i++; Assert(i == *configdata_len); return configdata; }
int main(int argc, char **argv){ char c; char *cores = NULL; char *nodes = NULL; int shuffle = 0; struct shared_state s = {}; while ((c = getopt(argc, argv, "+vVsc:n:SN")) != -1) { switch (c) { case 'c': if(cores) { fprintf(stderr, "-c or -n already used !\n"); exit(EXIT_FAILURE); } cores = strdup(optarg); break; case 'n': if(nodes || cores) { fprintf(stderr, "-c or -n already used !\n"); exit(EXIT_FAILURE); } nodes = strdup(optarg); break; case 'N': s.per_node = 1; break; case 's': shuffle = 1; break; case 'S': s.server = 1; break; case 'v': s.verbose = 1; break; case 'V': s.verbose = 1; s.verbose_err = 1; break; default: usage(argv[0]); } } if(!cores && !nodes) cores = build_default_affinity_string(shuffle); if(optind == argc) usage(argv[0]); argv += optind; char *lib = get_lib_path(); setenv("LD_PRELOAD", lib, 1); free(lib); int *cores_array; if(cores) { parse_cores(cores, &cores_array, &s.nr_entries_in_cores, 0); } else { parse_cores(nodes, &cores_array, &s.nr_entries_in_cores, 1); } char *uniq_shm_name = NULL; assert(asprintf(&uniq_shm_name, "%s_%d", "/tmp/shm", gettid())); assert(create_shm(uniq_shm_name, &s, cores_array)); setenv("PINTHREADS_SHMID", uniq_shm_name, 1); setenv("PINTHREADS_SHMSIZE", get_shm_size(), 1); free(uniq_shm_name); execvp(argv[0], argv); perror("execvp"); fprintf(stderr,"failed to execute %s\n", argv[0]); cleanup_shm(uniq_shm_name); return EXIT_SUCCESS; }
int main(int argc, char **argv) { int i; int ret; char mypath[MAXPGPATH]; char otherpath[MAXPGPATH]; set_pglocale_pgservice(argv[0], "pg_config"); progname = get_progname(argv[0]); if (argc < 2) { fprintf(stderr, _("%s: argument required\n"), progname); advice(); exit(1); } for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--bindir") == 0 || strcmp(argv[i], "--includedir") == 0 || strcmp(argv[i], "--includedir-server") == 0 || strcmp(argv[i], "--libdir") == 0 || strcmp(argv[i], "--pkglibdir") == 0 || strcmp(argv[i], "--pgxs") == 0 || strcmp(argv[i], "--configure") == 0) { /* come back to these later */ continue; } if (strcmp(argv[i], "--version") == 0) { printf("PostgreSQL " PG_VERSION "\n"); exit(0); } if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-?") == 0) { help(); exit(0); } fprintf(stderr, _("%s: invalid argument: %s\n"), progname, argv[i]); advice(); exit(1); } ret = find_my_exec(argv[0], mypath); if (ret) { fprintf(stderr, _("%s: could not find own executable\n"), progname); exit(1); } for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--configure") == 0) { /* the VAL_CONFIGURE macro must be defined by the Makefile */ printf("%s\n", VAL_CONFIGURE); continue; } if (strcmp(argv[i], "--bindir") == 0) { /* assume we are located in the bindir */ char *lastsep; strcpy(otherpath, mypath); lastsep = strrchr(otherpath, '/'); if (lastsep) *lastsep = '\0'; } else if (strcmp(argv[i], "--includedir") == 0) get_include_path(mypath, otherpath); else if (strcmp(argv[i], "--includedir-server") == 0) get_includeserver_path(mypath, otherpath); else if (strcmp(argv[i], "--libdir") == 0) get_lib_path(mypath, otherpath); else if (strcmp(argv[i], "--pkglibdir") == 0) get_pkglib_path(mypath, otherpath); else if (strcmp(argv[i], "--pgxs") == 0) { get_pkglib_path(mypath, otherpath); strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH - 1); } printf("%s\n", otherpath); } return 0; }