static void load_xinerama(void) { void *handle; if (!(handle = wine_dlopen(SONAME_LIBXINERAMA, RTLD_NOW, NULL, 0))) { WARN( "failed to open %s\n", SONAME_LIBXINERAMA ); return; } pXineramaQueryExtension = wine_dlsym( handle, "XineramaQueryExtension", NULL, 0 ); if (!pXineramaQueryExtension) WARN( "XineramaQueryScreens not found\n" ); pXineramaQueryScreens = wine_dlsym( handle, "XineramaQueryScreens", NULL, 0 ); if (!pXineramaQueryScreens) WARN( "XineramaQueryScreens not found\n" ); }
void X11DRV_XRandR_Init(void) { int event_base, error_base, minor, ret; static int major; Bool ok; if (major) return; /* already initialized? */ if (!usexrandr) return; /* disabled in config */ if (root_window != DefaultRootWindow( gdi_display )) return; if (!(ret = load_xrandr())) return; /* can't load the Xrandr library */ /* see if Xrandr is available */ if (!pXRRQueryExtension( gdi_display, &event_base, &error_base )) return; X11DRV_expect_error( gdi_display, XRandRErrorHandler, NULL ); ok = pXRRQueryVersion( gdi_display, &major, &minor ); if (X11DRV_check_error() || !ok) return; TRACE("Found XRandR %d.%d.\n", major, minor); #ifdef HAVE_XRRGETSCREENRESOURCES if (ret >= 2 && (major > 1 || (major == 1 && minor >= 2))) { if (major > 1 || (major == 1 && minor >= 3)) pXRRGetScreenResourcesCurrent = wine_dlsym( xrandr_handle, "XRRGetScreenResourcesCurrent", NULL, 0 ); if (!pXRRGetScreenResourcesCurrent) pXRRGetScreenResourcesCurrent = pXRRGetScreenResources; } if (!pXRRGetScreenResourcesCurrent || xrandr12_init_modes() < 0) #endif xrandr10_init_modes(); }
/* separate thread to check for NPTL and TLS features */ static void *needs_pthread( void *arg ) { pid_t tid = syscall( 224 /* SYS_gettid */ ); /* check for NPTL */ if (tid != -1 && tid != getpid()) return (void *)1; /* check for TLS glibc */ if (wine_get_gs() != 0) return (void *)1; /* check for exported epoll_create to detect new glibc versions without TLS */ if (wine_dlsym( RTLD_DEFAULT, "epoll_create", NULL, 0 )) fprintf( stderr, "wine: glibc >= 2.3 without NPTL or TLS is not a supported combination.\n" " Please upgrade to a glibc with NPTL support.\n" ); else fprintf( stderr, "wine: Your C library is too old. You need at least glibc 2.3 with NPTL support.\n" ); return 0; }
static BOOL init_opengl(void) { static BOOL init_done = FALSE; static void *osmesa_handle; char buffer[200]; unsigned int i; if (init_done) return (osmesa_handle != NULL); init_done = TRUE; osmesa_handle = wine_dlopen( SONAME_LIBOSMESA, RTLD_NOW, buffer, sizeof(buffer) ); if (osmesa_handle == NULL) { ERR( "Failed to load OSMesa: %s\n", buffer ); return FALSE; } for (i = 0; i < sizeof(opengl_func_names)/sizeof(opengl_func_names[0]); i++) { if (!(((void **)&opengl_funcs.gl)[i] = wine_dlsym( osmesa_handle, opengl_func_names[i], buffer, sizeof(buffer) ))) { ERR( "%s not found in %s (%s), disabling.\n", opengl_func_names[i], SONAME_LIBOSMESA, buffer ); goto failed; } } #define LOAD_FUNCPTR(f) do if (!(p##f = wine_dlsym( osmesa_handle, #f, buffer, sizeof(buffer) ))) \ { \ ERR( "%s not found in %s (%s), disabling.\n", #f, SONAME_LIBOSMESA, buffer ); \ goto failed; \ } while(0) LOAD_FUNCPTR(OSMesaCreateContextExt); LOAD_FUNCPTR(OSMesaDestroyContext); LOAD_FUNCPTR(OSMesaGetProcAddress); LOAD_FUNCPTR(OSMesaMakeCurrent); LOAD_FUNCPTR(OSMesaPixelStore); #undef LOAD_FUNCPTR return TRUE; failed: wine_dlclose( osmesa_handle, NULL, 0 ); osmesa_handle = NULL; return FALSE; }
static void video_init(void) { #ifdef SONAME_LIBV4L1 static void *video_lib; if (video_lib) return; video_lib = wine_dlopen(SONAME_LIBV4L1, RTLD_NOW, NULL, 0); if (!video_lib) return; video_open = wine_dlsym(video_lib, "v4l1_open", NULL, 0); video_close = wine_dlsym(video_lib, "v4l1_close", NULL, 0); video_ioctl = wine_dlsym(video_lib, "v4l1_ioctl", NULL, 0); video_read = wine_dlsym(video_lib, "v4l1_read", NULL, 0); video_mmap = wine_dlsym(video_lib, "v4l1_mmap", NULL, 0); video_munmap = wine_dlsym(video_lib, "v4l1_munmap", NULL, 0); #endif }
/*********************************************************************** * wine_init * * Main Wine initialisation. */ void wine_init( int argc, char *argv[], char *error, int error_size ) { struct dll_path_context context; char *path; void *ntdll = NULL; void (*init_func)(void); /* force a few limits that are set too low on some platforms */ #ifdef RLIMIT_NOFILE set_max_limit( RLIMIT_NOFILE ); #endif #ifdef RLIMIT_AS set_max_limit( RLIMIT_AS ); #endif wine_init_argv0_path( argv[0] ); build_dll_path(); __wine_main_argc = argc; __wine_main_argv = argv; __wine_main_environ = environ; mmap_init(); for (path = first_dll_path( "ntdll.dll", 0, &context ); path; path = next_dll_path( &context )) { if ((ntdll = wine_dlopen( path, RTLD_NOW, error, error_size ))) { /* if we didn't use the default dll dir, remove it from the search path */ if (default_dlldir[0] && context.index < nb_dll_paths + 2) nb_dll_paths--; break; } } free_dll_path( &context ); if (!ntdll) return; if (!(init_func = wine_dlsym( ntdll, "__wine_process_init", error, error_size ))) return; init_func(); }