diff options
author | Adam Jackson <ajax@redhat.com> | 2007-12-03 14:12:58 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2007-12-03 14:12:58 -0500 |
commit | 1faba797cbfe1a4804b7ea6b47e1ca9d4e4324e4 (patch) | |
tree | 03361fd875f0dc36b3389a44cfed6a3729a9b261 | |
parent | f4dc521b38560c8f93b614316a3a5511941a93a9 (diff) |
Death to libcwrapper.
This has been deprecated since 1.1. Since we're breaking ABI again anyway,
remove it entirely.
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 2 | ||||
-rw-r--r-- | hw/xfree86/ddc/ddcProperty.c | 1 | ||||
-rw-r--r-- | hw/xfree86/loader/xf86sym.c | 191 | ||||
-rw-r--r-- | hw/xfree86/os-support/Makefile.am | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/bsd/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/hurd/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/misc/Delay.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/bios_mmap.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/libc_wrapper.c | 2123 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSlib.h | 15 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_ansic.h | 314 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_libc.h | 721 | ||||
-rw-r--r-- | hw/xfree86/utils/xorgcfg/Makefile.am | 1 | ||||
-rw-r--r-- | os/Makefile.am | 9 |
17 files changed, 11 insertions, 3391 deletions
diff --git a/configure.ac b/configure.ac index bea49a720..52f1ef64d 100644 --- a/configure.ac +++ b/configure.ac @@ -1064,7 +1064,6 @@ else DIX_LIB='$(top_builddir)/dix/libdix.la' OS_LIB='$(top_builddir)/os/libos.la' fi -CWRAP_LIB='$(top_builddir)/os/libcwrapper.la' MI_LIB='$(top_builddir)/mi/libmi.la' MI_EXT_LIB='$(top_builddir)/mi/libmiext.la' MI_INC='-I$(top_srcdir)/mi' @@ -1166,7 +1165,7 @@ AC_MSG_RESULT([$XVFB]) AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes]) if test "x$XVFB" = xyes; then - XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB" + XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB" XVFB_SYS_LIBS="$XVFBMODULES_LIBS" AC_SUBST([XVFB_LIBS]) AC_SUBST([XVFB_SYS_LIBS]) @@ -1184,7 +1183,7 @@ AC_MSG_RESULT([$XNEST]) AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes]) if test "x$XNEST" = xyes; then - XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $DIX_LIB $OS_LIB $CONFIG_LIB" + XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $DIX_LIB $OS_LIB $CONFIG_LIB" XNEST_SYS_LIBS="$XNESTMODULES_LIBS" AC_SUBST([XNEST_LIBS]) AC_SUBST([XNEST_SYS_LIBS]) @@ -1214,7 +1213,7 @@ AC_MSG_RESULT([$XGL]) AM_CONDITIONAL(XGL, [test "x$XGL" = xyes]) if test "x$XGL" = xyes; then - XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB" + XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB" XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS" AC_SUBST([XGL_LIBS]) AC_SUBST([XGL_SYS_LIBS]) @@ -1236,7 +1235,7 @@ AC_MSG_RESULT([$XEGL]) AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes]) if test "x$XEGL" = xyes; then - XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB" + XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB" XEGL_SYS_LIBS = "$XEGL_SYS_LIBS $XEGLMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XEGL_LIBS]) AC_SUBST([XEGL_SYS_LIBS]) @@ -1253,7 +1252,7 @@ AC_MSG_RESULT([$XGLX]) AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes]) if test "x$XGLX" = xyes; then - XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB" + XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB" XGLX_SYS_LIBS="$XGLX_SYS_LIBS $XGLXMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XGLX_LIBS]) AC_SUBST([XGLX_SYS_LIBS]) @@ -1546,7 +1545,7 @@ AC_MSG_RESULT([$XPRINT]) if test "x$XPRINT" = xyes; then PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS" - XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $CWRAP_LIBS $XKB_LIB $XKB_STUB_LIB" + XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB" XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" xpconfigdir=$libdir/X11/xserver @@ -1787,7 +1786,7 @@ if test "x$DMX" = xyes; then fi DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB" + XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" XDMX_SYS_LIBS="$DMXMODULES_LIBS" AC_SUBST([XDMX_CFLAGS]) AC_SUBST([XDMX_LIBS]) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index b5ee21d19..c72fe30e8 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1203,8 +1203,6 @@ OsVendorInit() { static Bool beenHere = FALSE; - xf86WrapperInit(); - #ifdef SIGCHLD signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ #endif diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c index 67351d3dc..02125dff7 100644 --- a/hw/xfree86/ddc/ddcProperty.c +++ b/hw/xfree86/ddc/ddcProperty.c @@ -31,7 +31,6 @@ #include "property.h" #include "propertyst.h" #include "xf86DDC.h" -#include "xf86_ansic.h" #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" #define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA" diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 7c46e0266..050b873fb 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -79,8 +79,6 @@ #include "vidmodeproc.h" #include "xf86miscproc.h" #include "loader.h" -#define DONT_DEFINE_WRAPPERS -#include "xf86_ansic.h" #include "xisb.h" #include "vbe.h" #ifndef __OpenBSD__ @@ -269,7 +267,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86ReadSerial) SYMFUNC(xf86WriteSerial) SYMFUNC(xf86CloseSerial) - SYMFUNC(xf86GetErrno) SYMFUNC(xf86WaitForInput) SYMFUNC(xf86SerialSendBreak) SYMFUNC(xf86FlushInput) @@ -724,186 +721,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(LoaderGetOS) SYMFUNC(LoaderGetABIVersion) - /* - * These are our own interfaces to libc functions. - */ - SYMFUNC(xf86abort) - SYMFUNC(xf86abs) - SYMFUNC(xf86acos) - SYMFUNC(xf86asin) - SYMFUNC(xf86atan) - SYMFUNC(xf86atan2) - SYMFUNC(xf86atof) - SYMFUNC(xf86atoi) - SYMFUNC(xf86atol) - SYMFUNC(xf86bsearch) - SYMFUNC(xf86ceil) - SYMFUNC(xf86calloc) - SYMFUNC(xf86clearerr) - SYMFUNC(xf86close) - SYMFUNC(xf86cos) - SYMFUNC(xf86exit) - SYMFUNC(xf86exp) - SYMFUNC(xf86fabs) - SYMFUNC(xf86fclose) - SYMFUNC(xf86feof) - SYMFUNC(xf86ferror) - SYMFUNC(xf86fflush) - SYMFUNC(xf86fgetc) - SYMFUNC(xf86fgetpos) - SYMFUNC(xf86fgets) - SYMFUNC(xf86finite) - SYMFUNC(xf86floor) - SYMFUNC(xf86fmod) - SYMFUNC(xf86fopen) - SYMFUNC(xf86fprintf) - SYMFUNC(xf86fputc) - SYMFUNC(xf86fputs) - SYMFUNC(xf86fread) - SYMFUNC(xf86free) - SYMFUNC(xf86freopen) - SYMFUNC(xf86frexp) - SYMFUNC(xf86fscanf) - SYMFUNC(xf86fseek) - SYMFUNC(xf86fsetpos) - SYMFUNC(xf86ftell) - SYMFUNC(xf86fwrite) - SYMFUNC(xf86getc) - SYMFUNC(xf86getenv) - SYMFUNC(xf86getpagesize) - SYMFUNC(xf86hypot) - SYMFUNC(xf86ioctl) - SYMFUNC(xf86isalnum) - SYMFUNC(xf86isalpha) - SYMFUNC(xf86iscntrl) - SYMFUNC(xf86isdigit) - SYMFUNC(xf86isgraph) - SYMFUNC(xf86islower) - SYMFUNC(xf86isprint) - SYMFUNC(xf86ispunct) - SYMFUNC(xf86isspace) - SYMFUNC(xf86isupper) - SYMFUNC(xf86isxdigit) - SYMFUNC(xf86labs) - SYMFUNC(xf86ldexp) - SYMFUNC(xf86log) - SYMFUNC(xf86log10) - SYMFUNC(xf86lseek) - SYMFUNC(xf86malloc) - SYMFUNC(xf86memchr) - SYMFUNC(xf86memcmp) - SYMFUNC(xf86memcpy) - /* - * Some compilers generate calls to memcpy to handle structure copies - * or run-time initializations. - */ - SYMFUNCALIAS("memcpy", xf86memcpy) - SYMFUNC(xf86memset) - /* - * Some compilers generate calls to memset to handle aggregate - * initializations. - */ - SYMFUNCALIAS("memset", xf86memset) - SYMFUNC(xf86memmove) - SYMFUNC(xf86mmap) - SYMFUNC(xf86modf) - SYMFUNC(xf86munmap) - SYMFUNC(xf86open) - SYMFUNC(xf86perror) - SYMFUNC(xf86pow) - SYMFUNC(xf86printf) - SYMFUNC(xf86qsort) - SYMFUNC(xf86read) - SYMFUNC(xf86realloc) - SYMFUNC(xf86remove) - SYMFUNC(xf86rename) - SYMFUNC(xf86rewind) - SYMFUNC(xf86setbuf) - SYMFUNC(xf86setvbuf) - SYMFUNC(xf86sin) - SYMFUNC(xf86snprintf) - SYMFUNC(xf86sprintf) - SYMFUNC(xf86sqrt) - SYMFUNC(xf86sscanf) - SYMFUNC(xf86strcat) - SYMFUNC(xf86strcmp) - SYMFUNC(xf86strcasecmp) - SYMFUNC(xf86strcpy) - SYMFUNC(xf86strcspn) - SYMFUNC(xf86strerror) - SYMFUNC(xf86strlcat) - SYMFUNC(xf86strlcpy) - SYMFUNC(xf86strlen) - SYMFUNC(xf86strncasecmp) - SYMFUNC(xf86strncat) - SYMFUNC(xf86strncmp) - SYMFUNC(xf86strncpy) - SYMFUNC(xf86strpbrk) - SYMFUNC(xf86strchr) - SYMFUNC(xf86strrchr) - SYMFUNC(xf86strspn) - SYMFUNC(xf86strstr) - SYMFUNC(xf86strtod) - SYMFUNC(xf86strtok) - SYMFUNC(xf86strtol) - SYMFUNC(xf86strtoul) - SYMFUNC(xf86tan) - SYMFUNC(xf86tmpfile) - SYMFUNC(xf86tolower) - SYMFUNC(xf86toupper) - SYMFUNC(xf86ungetc) - SYMFUNC(xf86vfprintf) - SYMFUNC(xf86vsnprintf) - SYMFUNC(xf86vsprintf) - SYMFUNC(xf86write) - - /* non-ANSI C functions */ - SYMFUNC(xf86opendir) - SYMFUNC(xf86closedir) - SYMFUNC(xf86readdir) - SYMFUNC(xf86rewinddir) - SYMFUNC(xf86ffs) - SYMFUNC(xf86strdup) - SYMFUNC(xf86bzero) - SYMFUNC(xf86usleep) - SYMFUNC(xf86execl) - - SYMFUNC(xf86getsecs) - SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */ - - /* Some of these were added for DRI support. */ - SYMFUNC(xf86stat) - SYMFUNC(xf86fstat) - SYMFUNC(xf86access) - SYMFUNC(xf86geteuid) - SYMFUNC(xf86getegid) - SYMFUNC(xf86getpid) - SYMFUNC(xf86mknod) - SYMFUNC(xf86chmod) - SYMFUNC(xf86chown) - SYMFUNC(xf86sleep) - SYMFUNC(xf86mkdir) - SYMFUNC(xf86shmget) - SYMFUNC(xf86shmat) - SYMFUNC(xf86shmdt) - SYMFUNC(xf86shmctl) -#ifdef HAS_GLIBC_SIGSETJMP - SYMFUNC(xf86setjmp) - SYMFUNC(xf86setjmp0) -#if defined(__GLIBC__) && (__GLIBC__ >= 2) - SYMFUNCALIAS("xf86setjmp1", __sigsetjmp) -#else - SYMFUNC(xf86setjmp1) /* For libc5 */ -#endif -#else - SYMFUNCALIAS("xf86setjmp", setjmp) - SYMFUNC(xf86setjmp0) - SYMFUNC(xf86setjmp1) -#endif - SYMFUNCALIAS("xf86longjmp", longjmp) - SYMFUNC(xf86getjmptype) - SYMFUNC(xf86setjmp1_arg2) - SYMFUNC(xf86setjmperror) #ifdef XF86DRI /* * These may have more general uses, but for now, they are only used @@ -1088,14 +905,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { #endif #endif - /* Some variables. */ - - SYMVAR(xf86stdin) - SYMVAR(xf86stdout) - SYMVAR(xf86stderr) - SYMVAR(xf86errno) - SYMVAR(xf86HUGE_VAL) - /* General variables (from xf86.h) */ SYMVAR(xf86ScreenIndex) SYMVAR(xf86PixmapIndex) diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am index e5a71c00a..f9a82c68d 100644 --- a/hw/xfree86/os-support/Makefile.am +++ b/hw/xfree86/os-support/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd -sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h xf86_ansic.h xf86_libc.h \ +sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \ assyntax.h xf86OSmouse.h EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index 446b69ee2..4fc270aa9 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -54,7 +54,6 @@ AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS) INCLUDES = $(XORG_INCS) libbsd_la_SOURCES = \ - $(srcdir)/../shared/libc_wrapper.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am index e6543e133..2214b1c2d 100644 --- a/hw/xfree86/os-support/hurd/Makefile.am +++ b/hw/xfree86/os-support/hurd/Makefile.am @@ -4,7 +4,6 @@ libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \ hurd_mouse.c hurd_video.c \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/posix_tty.c \ - $(srcdir)/../shared/libc_wrapper.c \ $(srcdir)/../shared/stdResource.c \ $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/pm_noop.c \ diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index 5bb252be3..5a52ffdd4 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -34,7 +34,6 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \ $(srcdir)/../shared/vidmem.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/stdResource.c \ - $(srcdir)/../shared/libc_wrapper.c \ $(ACPI_SRCS) \ $(APM_SRCS) \ $(PLATFORM_PCI_SUPPORT) diff --git a/hw/xfree86/os-support/misc/Delay.c b/hw/xfree86/os-support/misc/Delay.c index e3e93faa4..b18789a3a 100644 --- a/hw/xfree86/os-support/misc/Delay.c +++ b/hw/xfree86/os-support/misc/Delay.c @@ -18,7 +18,7 @@ xf86UDelay(long usec) int sigio; sigio = xf86BlockSIGIO(); - xf86usleep(usec); + usleep(usec); xf86UnblockSIGIO(sigio); #endif diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c index cccf86a04..51d429948 100644 --- a/hw/xfree86/os-support/shared/bios_mmap.c +++ b/hw/xfree86/os-support/shared/bios_mmap.c @@ -55,7 +55,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, DEV_MEM, strerror(errno)); return(-1); } - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c deleted file mode 100644 index 959424110..000000000 --- a/hw/xfree86/os-support/shared/libc_wrapper.c +++ /dev/null @@ -1,2123 +0,0 @@ -/* - * Copyright 1997-2003 by The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Orest Zborowski and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#if defined(linux) && !defined(__GLIBC__) -#undef __STRICT_ANSI__ -#endif -#include <X11/X.h> -#include <X11/Xmd.h> -#include <X11/Xos.h> -#include <sys/types.h> -#include <sys/stat.h> -#if defined(__bsdi__) -#undef _POSIX_SOURCE -#undef _ANSI_SOURCE -#endif -#include <sys/time.h> -#include <math.h> -#ifdef sun -#include <ieeefp.h> -#endif -#include <stdarg.h> -#include <fcntl.h> -#include <X11/Xfuncproto.h> -#include "os.h" -#include <ctype.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <stdio.h> -#include <sys/ioctl.h> -#ifdef HAS_SVR3_MMAPDRV -#define NO_MMAP -#ifdef SELF_CONTAINED_WRAPPER -#include <sys/at_ansi.h> -#include <sys/kd.h> -#include <sys/sysmacros.h> -#if !defined(_NEED_SYSI86) -# include <sys/immu.h> -# include <sys/region.h> -#endif -#include <sys/mmap.h> -struct kd_memloc MapDSC; -int mmapFd = -2; -#else -extern struct kd_memloc MapDSC; -extern int mmapFd; -#endif -#endif -#ifndef NO_MMAP -#include <sys/mman.h> -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif -#endif -#if !defined(ISC) -#include <stdlib.h> -#endif - -#define NEED_XF86_TYPES 1 -#define NEED_XF86_PROTOTYPES 1 -#define DONT_DEFINE_WRAPPERS -#include "xf86_ansic.h" - -#ifndef SELF_CONTAINED_WRAPPER -#include "xf86.h" -#include "xf86Priv.h" -#define NO_OSLIB_PROTOTYPES -#define XF86_OS_PRIVS -#define HAVE_WRAPPER_DECLS -#include "xf86_OSlib.h" -#else -void xf86WrapperInit(void); -#endif - - -#ifndef X_NOT_POSIX -#include <dirent.h> -#else -#ifdef SYSV -#include <dirent.h> -#else -#ifdef USG -#include <dirent.h> -#else -#include <sys/dir.h> -#ifndef dirent -#define dirent direct -#endif -#endif -#endif -#endif -typedef struct dirent DIRENTRY; - -#ifdef ISC202 -#include <sys/types.h> -#define WIFEXITED(a) ((a & 0x00ff) == 0) /* LSB will be 0 */ -#define WEXITSTATUS(a) ((a & 0xff00) >> 8) -#define WIFSIGNALED(a) ((a & 0xff00) == 0) /* MSB will be 0 */ -#define WTERMSIG(a) (a & 0x00ff) -#else -#if defined(ISC) && !defined(_POSIX_SOURCE) -#define _POSIX_SOURCE -#include <sys/types.h> -#include <sys/wait.h> -#undef _POSIX_SOURCE -#else -#if (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) -#include <sys/types.h> -#endif -#include <sys/wait.h> -#endif -#endif -#ifdef Lynx -#if !defined(S_IFIFO) && defined(S_IFFIFO) -#define S_IFIFO S_IFFIFO -#endif -#endif - -/* For xf86getpagesize() */ -#if defined(linux) -#define HAS_SC_PAGESIZE -#define HAS_GETPAGESIZE -#elif defined(CSRG_BASED) -#define HAS_GETPAGESIZE -#elif defined(DGUX) -#define HAS_GETPAGESIZE -#elif defined(sun) && !defined(SVR4) -#define HAS_GETPAGESIZE -#endif -#ifdef XNO_SYSCONF -#undef _SC_PAGESIZE -#endif -#ifdef HAVE_SYSV_IPC -#include <sys/ipc.h> -#include <sys/shm.h> -#endif -#include <setjmp.h> - -#if defined(setjmp) && defined(__GNU_LIBRARY__) && \ - (!defined(__GLIBC__) || (__GLIBC__ < 2) || \ - ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3))) -#define HAS_GLIBC_SIGSETJMP 1 -#endif - -#if 0 -#define SETBUF_RETURNS_INT -#endif - -_X_EXPORT double xf86HUGE_VAL; - -#ifndef SELF_CONTAINED_WRAPPERS -extern void xf86DisableIO(void); -#endif - -/* - * This file contains the XFree86 wrappers for libc functions that can be - * called by loadable modules - */ - -_X_EXPORT double -xf86hypot(double x, double y) -{ - return(hypot(x,y)); -} - -_X_EXPORT void -xf86qsort(void *base, xf86size_t nmemb, xf86size_t size, - int (*comp)(const void *, const void *)) -{ - qsort(base, nmemb, size, comp); -} - -/* string functions */ - -_X_EXPORT char* -xf86strcat(char* dest, const char* src) -{ - return(strcat(dest,src)); -} - -_X_EXPORT char* -xf86strchr(const char* s, int c) -{ - return strchr(s,c); -} - -_X_EXPORT int -xf86strcmp(const char* s1, const char* s2) -{ - return strcmp(s1,s2); -} - -/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ -_X_EXPORT int -xf86strcasecmp(const char* s1, const char* s2) -{ - const unsigned char *us1 = (const unsigned char *)s1; - const unsigned char *us2 = (const unsigned char *)s2; - - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return 0; - - return tolower(*us1) - tolower(*--us2); -} - -_X_EXPORT char* -xf86strcpy(char* dest, const char* src) -{ - return strcpy(dest,src); -} - -_X_EXPORT xf86size_t -xf86strcspn(const char* s1, const char* s2) -{ - return (xf86size_t)strcspn(s1,s2); -} - -_X_EXPORT xf86size_t -xf86strlen(const char* s) -{ - return (xf86size_t)strlen(s); -} - -_X_EXPORT xf86size_t -xf86strlcat(char *dest, const char *src, xf86size_t size) -{ - return(strlcat(dest, src, size)); -} - -_X_EXPORT xf86size_t -xf86strlcpy(char *dest, const char *src, xf86size_t size) -{ - return strlcpy(dest, src, size); -} - -_X_EXPORT char* -xf86strncat(char* dest, const char* src, xf86size_t n) -{ - return strncat(dest,src,(size_t)n); -} - -_X_EXPORT int -xf86strncmp(const char* s1, const char* s2, xf86size_t n) -{ - return strncmp(s1,s2,(size_t)n); -} - -/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */ -_X_EXPORT int -xf86strncasecmp(const char* s1, const char* s2, xf86size_t n) -{ - if (n != 0) { - const unsigned char *us1 = (const unsigned char *)s1; - const unsigned char *us2 = (const unsigned char *)s2; - - do { - if (tolower(*us1) != tolower(*us2++)) - return tolower(*us1) - tolower(*--us2); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return 0; -} - -_X_EXPORT char* -xf86strncpy(char* dest, const char* src, xf86size_t n) -{ - return strncpy(dest,src,(size_t)n); -} - -_X_EXPORT char* -xf86strpbrk(const char* s1, const char* s2) -{ - return strpbrk(s1,s2); -} - -_X_EXPORT char* -xf86strrchr(const char* s, int c) -{ - return strrchr(s,c); -} - -_X_EXPORT xf86size_t -xf86strspn(const char* s1, const char* s2) -{ - return strspn(s1,s2); -} - -_X_EXPORT char* -xf86strstr(const char* s1, const char* s2) -{ - return strstr(s1,s2); -} - -_X_EXPORT char* -xf86strtok(char* s1, const char* s2) -{ - return strtok(s1,s2); -} - -_X_EXPORT char* -xf86strdup(const char* s) -{ - return xstrdup(s); -} - -_X_EXPORT int -xf86sprintf(char *s, const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - ret = vsprintf(s, format, args); - va_end(args); - return ret; -} - -_X_EXPORT int -xf86snprintf(char *s, xf86size_t len, const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - ret = vsnprintf(s, (size_t)len, format, args); - va_end(args); - return ret; -} - -_X_EXPORT void -xf86bzero(void* s, unsigned int n) -{ - memset(s, 0, n); -} - -#ifdef HAVE_VSSCANF -_X_EXPORT int -xf86sscanf(char *s, const char *format, ...) -#else -_X_EXPORT int -xf86sscanf(char *s, const char *format, char *a0, char *a1, char *a2, - char *a3, char *a4, char *a5, char *a6, char *a7, char *a8, - char *a9) /* limit of ten args */ -#endif -{ -#ifdef HAVE_VSSCANF - int ret; - va_list args; - va_start(args, format); - - ret = vsscanf(s,format,args); - va_end(args); - return ret; -#else - return sscanf(s, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); -#endif -} - -/* Basic I/O */ - -_X_EXPORT int xf86errno; - -/* XXX This is not complete */ - -static int -xfToOsOpenFlags(int xfflags) -{ - int flags = 0; - - /* XXX This assumes O_RDONLY is 0 */ - if (xfflags & XF86_O_WRONLY) - flags |= O_WRONLY; - if (xfflags & XF86_O_RDWR) - flags |= O_RDWR; - if (xfflags & XF86_O_CREAT) - flags |= O_CREAT; - - return flags; -} - -_X_EXPORT int -xf86open(const char *path, int flags, ...) -{ - int fd; - va_list ap; - - va_start(ap, flags); - flags = xfToOsOpenFlags(flags); - if (flags & O_CREAT) { - /* can't request a mode_t directly on systems where mode_t - is an unsigned short */ - mode_t mode = (mode_t)va_arg(ap, unsigned int); - fd = open(path, flags, mode); - } else { - fd = open(path, flags); - } - va_end(ap); - xf86errno = xf86GetErrno(); - - return fd; -} - -_X_EXPORT int -xf86close(int fd) -{ - int status = close(fd); - - xf86errno = xf86GetErrno(); - return status; -} - -_X_EXPORT long -xf86lseek(int fd, long offset, int whence) -{ - switch (whence) { - case XF86_SEEK_SET: - whence = SEEK_SET; - break; - case XF86_SEEK_CUR: - whence = SEEK_CUR; - break; - case XF86_SEEK_END: - whence = SEEK_END; - break; - } - return (long)lseek(fd, (off_t)offset, whence); -} - -_X_EXPORT int -xf86ioctl(int fd, unsigned long request, pointer argp) -{ - int status = ioctl(fd, request, argp); - - xf86errno = xf86GetErrno(); - return status; -} - -_X_EXPORT xf86ssize_t -xf86read(int fd, void *buf, xf86size_t nbytes) -{ - xf86ssize_t n = read(fd, buf, (size_t)nbytes); - - xf86errno = xf86GetErrno(); - return n; -} - -_X_EXPORT xf86ssize_t -xf86write(int fd, const void *buf, xf86size_t nbytes) -{ - xf86ssize_t n = write(fd, buf, (size_t)nbytes); - - xf86errno = xf86GetErrno(); - return n; -} - -_X_EXPORT void* -xf86mmap(void *start, xf86size_t length, int prot, - int flags, int fd, xf86size_t /* off_t */ offset) -{ -#ifndef NO_MMAP - int p=0, f=0; - void *rc; - - if (flags & XF86_MAP_FIXED) f |= MAP_FIXED; - if (flags & XF86_MAP_SHARED) f |= MAP_SHARED; - if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE; -#if defined(__amd64__) && defined(linux) - if (flags & XF86_MAP_32BIT) f |= MAP_32BIT; -#endif - if (prot & XF86_PROT_EXEC) p |= PROT_EXEC; - if (prot & XF86_PROT_READ) p |= PROT_READ; - if (prot & XF86_PROT_WRITE) p |= PROT_WRITE; - if (prot & XF86_PROT_NONE) p |= PROT_NONE; - - rc = mmap(start,(size_t)length,p,f,fd,(off_t)offset); - - xf86errno = xf86GetErrno(); - if (rc == MAP_FAILED) - return XF86_MAP_FAILED; - else - return rc; -#else -#ifdef HAS_SVR3_MMAPDRV - void *rc; -#ifdef SELF_CONTAINED_WRAPPER - if(mmapFd < 0) { - if ((mmapFd = open("/dev/mmap", O_RDWR)) == -1) { - ErrorF("Warning: failed to open /dev/mmap \n"); - xf86errno = xf86_ENOSYS; - return XF86_MAP_FAILED; - } - } -#endif - MapDSC.vaddr = (char *)start; - MapDSC.physaddr = (char *)offset; - MapDSC.length = length; - MapDSC.ioflg = 1; - - rc = (pointer)ioctl(mmapFd, MAP, &MapDSC); - xf86errno = xf86GetErrno(); - if (rc == NULL) - return XF86_MAP_FAILED; - else - return rc; -#else - ErrorF("Warning: mmap() is not supported on this platform\n"); - xf86errno = xf86_ENOSYS; - return XF86_MAP_FAILED; -#endif -#endif -} - -_X_EXPORT int -xf86munmap(void *start, xf86size_t length) -{ -#ifndef NO_MMAP - int rc = munmap(start,(size_t)length); - - xf86errno = xf86GetErrno(); - return rc; -#else -#ifdef HAS_SVR3_MMAPDRV - int rc = ioctl(mmapFd, UNMAPRM , start); - - xf86errno = xf86GetErrno(); - return rc; -#else - ErrorF("Warning: munmap() is not supported on this platform\n"); - xf86errno = xf86_ENOSYS; - return -1; -#endif -#endif -} - -_X_EXPORT int -xf86stat(const char *file_name, struct xf86stat *xfst) -{ - int rc; - struct stat st; - - rc = stat(file_name, &st); - xf86errno = xf86GetErrno(); - xfst->st_rdev = st.st_rdev; /* Not much is currently supported */ - return rc; -} - -_X_EXPORT int -xf86fstat(int fd, struct xf86stat *xfst) -{ - int rc; - struct stat st; - - rc = fstat(fd, &st); - xf86errno = xf86GetErrno(); - xfst->st_rdev = st.st_rdev; /* Not much is currently supported */ - return rc; -} - -static int -xfToOsAccessMode(int xfmode) -{ - switch(xfmode) { - case XF86_R_OK: return R_OK; - case XF86_W_OK: return W_OK; - case XF86_X_OK: return X_OK; - case XF86_F_OK: return F_OK; - } - return 0; -} - -_X_EXPORT int -xf86access(const char *pathname, int mode) -{ - int rc; - - mode = xfToOsAccessMode(mode); - rc = access(pathname, mode); - xf86errno = xf86GetErrno(); - return rc; -} - - - -/* limited stdio support */ - -#define XF86FILE_magic 0x58464856 /* "XFHV" */ - -typedef struct _xf86_file_ { - INT32 fileno; - INT32 magic; - FILE* filehnd; - char* fname; -} XF86FILE_priv; - -static XF86FILE_priv stdhnd[3] = { - { 0, XF86FILE_magic, NULL, "$stdinp$" }, - { 0, XF86FILE_magic, NULL, "$stdout$" }, - { 0, XF86FILE_magic, NULL, "$stderr$" } -}; - -_X_EXPORT XF86FILE* xf86stdin = (XF86FILE*)&stdhnd[0]; -_X_EXPORT XF86FILE* xf86stdout = (XF86FILE*)&stdhnd[1]; -_X_EXPORT XF86FILE* xf86stderr = (XF86FILE*)&stdhnd[2]; - -void -xf86WrapperInit() -{ - if (stdhnd[0].filehnd == NULL) - stdhnd[0].filehnd = stdin; - if (stdhnd[1].filehnd == NULL) - stdhnd[1].filehnd = stdout; - if (stdhnd[2].filehnd == NULL) - stdhnd[2].filehnd = stderr; - xf86HUGE_VAL = HUGE_VAL; -} - -_X_EXPORT XF86FILE* -xf86fopen(const char* fn, const char* mode) -{ - XF86FILE_priv* fp; - FILE *f = fopen(fn,mode); - xf86errno = xf86GetErrno(); - if (!f) return 0; - - fp = xalloc(sizeof(XF86FILE_priv)); - fp->magic = XF86FILE_magic; - fp->filehnd = f; - fp->fileno = fileno(f); - fp->fname = xf86strdup(fn); -#ifdef DEBUG - ErrorF("xf86fopen(%s,%s) yields FILE %p XF86FILE %p\n", - fn,mode,f,fp); -#endif - return (XF86FILE*)fp; -} - -static void _xf86checkhndl(XF86FILE_priv* f,const char *func) -{ - if (!f || f->magic != XF86FILE_magic || - !f->filehnd || !f->fname) { - FatalError("libc_wrapper error: passed invalid FILE handle to %s", - func); - exit(42); - } -} - -_X_EXPORT int -xf86fclose(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - int ret; - - _xf86checkhndl(fp,"xf86fclose"); - - /* somewhat bad check */ - if (fp->fileno < 3 && fp->fname[0]=='$') { - /* assume this is stdin/out/err, don't dispose */ - ret = fclose(fp->filehnd); - } else { - ret = fclose(fp->filehnd); - fp->magic = 0; /* invalidate */ - xfree(fp->fname); - xfree(fp); - } - return ret ? -1 : 0; -} - -_X_EXPORT int -xf86printf(const char *format, ...) -{ - int ret; - va_list args; - va_start(args, format); - - ret = printf(format,args); - va_end(args); - return ret; -} - -_X_EXPORT int -xf86fprintf(XF86FILE* f, const char *format, ...) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - int ret; - va_list args; - va_start(args, format); - -#ifdef DEBUG - ErrorF("xf86fprintf for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86fprintf"); - - ret = vfprintf(fp->filehnd,format,args); - va_end(args); - return ret; -} - -_X_EXPORT int -xf86vfprintf(XF86FILE* f, const char *format, va_list ap) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef DEBUG - ErrorF("xf86vfprintf for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86vfprintf"); - - return vfprintf(fp->filehnd,format,ap); -} - -_X_EXPORT int -xf86vsprintf(char *s, const char *format, va_list ap) -{ - return vsprintf(s, format, ap); -} - -_X_EXPORT int -xf86vsnprintf(char *s, xf86size_t len, const char *format, va_list ap) -{ - return vsnprintf(s, (size_t)len, format, ap); -} - -#ifdef HAVE_VFSCANF -_X_EXPORT int -xf86fscanf(XF86FILE* f, const char *format, ...) -#else -_X_EXPORT int -xf86fscanf(XF86FILE* f, const char *format, char *a0, char *a1, char *a2, - char *a3, char *a4, char *a5, char *a6, char *a7, char *a8, - char *a9) /* limit of ten args */ -#endif -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef HAVE_VFSCANF - int ret; - va_list args; - va_start(args, format); - - _xf86checkhndl(fp,"xf86fscanf"); - - ret = vfscanf(fp->filehnd,format,args); - va_end(args); - return ret; -#else - _xf86checkhndl(fp,"xf86fscanf"); - return fscanf(fp->filehnd, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); -#endif -} - -_X_EXPORT char * -xf86fgets(char *buf, INT32 n, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fgets"); - return fgets(buf,(int)n,fp->filehnd); -} - -_X_EXPORT int -xf86fputs(const char *buf, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fputs"); - return fputs(buf,fp->filehnd); -} - -_X_EXPORT int -xf86getc(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86getc"); - return getc(fp->filehnd); -} - -_X_EXPORT int -xf86fgetc(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fgetc"); - return fgetc(fp->filehnd); -} - -_X_EXPORT int -xf86fputc(int c,XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fputc"); - return fputc(c,fp->filehnd); -} - -_X_EXPORT int -xf86fflush(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fflush"); - return fflush(fp->filehnd); -} - -_X_EXPORT xf86size_t -xf86fread(void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - -#ifdef DEBUG - ErrorF("xf86fread for XF86FILE %p\n", fp); -#endif - _xf86checkhndl(fp,"xf86fread"); - return fread(buf,(size_t)sz,(size_t)cnt,fp->filehnd); -} - -_X_EXPORT xf86size_t -xf86fwrite(const void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fwrite"); - return fwrite(buf,(size_t)sz,(size_t)cnt,fp->filehnd); -} - -_X_EXPORT int -xf86fseek(XF86FILE* f, long offset, int whence) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fseek"); - switch (whence) { - case XF86_SEEK_SET: - whence = SEEK_SET; - break; - case XF86_SEEK_CUR: - whence = SEEK_CUR; - break; - case XF86_SEEK_END: - whence = SEEK_END; - break; - } - return fseek(fp->filehnd,offset,whence); -} - -_X_EXPORT long -xf86ftell(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ftell"); - return ftell(fp->filehnd); -} - -#define mapnum(e) case (xf86_##e): err = e; break; - -_X_EXPORT char* -xf86strerror(int n) -{ - int err; - - switch (n) - { - case 0: err = 0; break; - mapnum (EACCES); - mapnum (EAGAIN); - mapnum (EBADF); - mapnum (EEXIST); - mapnum (EFAULT); - mapnum (EINTR); - mapnum (EINVAL); - mapnum (EISDIR); - mapnum (ELOOP); /* not POSIX 1 */ - mapnum (EMFILE); - mapnum (ENAMETOOLONG); - mapnum (ENFILE); - mapnum (ENOENT); - mapnum (ENOMEM); - mapnum (ENOSPC); - mapnum (ENOTDIR); - mapnum (EPIPE); - mapnum (EROFS); - mapnum (ETXTBSY); /* not POSIX 1 */ - mapnum (ENOTTY); -#ifdef ENOSYS - mapnum (ENOSYS); -#endif - mapnum (EBUSY); - mapnum (ENODEV); - mapnum (EIO); -#ifdef ESRCH - mapnum (ESRCH); -#endif -#ifdef ENXIO - mapnum (ENXIO); -#endif -#ifdef E2BIG - mapnum (E2BIG); -#endif -#ifdef ENOEXEC - mapnum (ENOEXEC); -#endif -#ifdef ECHILD - mapnum (ECHILD); -#endif -#ifdef ENOTBLK - mapnum (ENOTBLK); -#endif -#ifdef EXDEV - mapnum (EXDEV); -#endif -#ifdef EFBIG - mapnum (EFBIG); -#endif -#ifdef ESPIPE - mapnum (ESPIPE); -#endif -#ifdef EMLINK - mapnum (EMLINK); -#endif -#ifdef EDOM - mapnum (EDOM); -#endif -#ifdef ERANGE - mapnum (ERANGE); -#endif - - default: - err = 999; - } - return strerror(err); -} - -#undef mapnum - - -/* required for portable fgetpos/fsetpos, - * use as - * XF86fpos_t* pos = xalloc(xf86fpossize()); - */ -_X_EXPORT long -xf86fpossize() -{ - return sizeof(fpos_t); -} - -_X_EXPORT int -xf86fgetpos(XF86FILE* f,XF86fpos_t* pos) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - fpos_t *ppos = (fpos_t*)pos; - - _xf86checkhndl(fp,"xf86fgetpos"); -#ifndef ISC - return fgetpos(fp->filehnd,ppos); -#else - *ppos = ftell(fp->filehnd); - if (*ppos < 0L) - return(-1); - return(0); -#endif -} - -_X_EXPORT int -xf86fsetpos(XF86FILE* f,const XF86fpos_t* pos) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - fpos_t *ppos = (fpos_t*)pos; - - /* XXX need to handle xf86errno here */ - _xf86checkhndl(fp,"xf86fsetpos"); -#ifndef ISC - return fsetpos(fp->filehnd,ppos); -#else - if (ppos == NULL) - { - errno = EINVAL; - return EOF; - } - return fseek(fp->filehnd, *ppos, SEEK_SET); -#endif -} - -_X_EXPORT void -xf86perror(const char *s) -{ - perror(s); -} - -_X_EXPORT int -xf86remove(const char *s) -{ -#ifdef _POSIX_SOURCE - return remove(s); -#else - return unlink(s); -#endif -} - -_X_EXPORT int -xf86rename(const char *old, const char *new) -{ -#ifdef _POSIX_SOURCE - return rename(old,new); -#else - int ret = link(old,new); - if (!ret) { - ret = unlink(old); - if (ret) unlink(new); - } else - ret = unlink(new); - return ret; -#endif -} - -_X_EXPORT void -xf86rewind(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fsetpos"); - rewind(fp->filehnd); -} - -_X_EXPORT void -xf86clearerr(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86clearerr"); - clearerr(fp->filehnd); -} - -_X_EXPORT int -xf86feof(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86feof"); - return feof(fp->filehnd); -} - -_X_EXPORT int -xf86ferror(XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ferror"); - return ferror(fp->filehnd); -} - -_X_EXPORT XF86FILE* -xf86freopen(const char* fname,const char* mode,XF86FILE* fold) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)fold; - FILE *fnew; - - _xf86checkhndl(fp,"xf86freopen"); - fnew = freopen(fname,mode,fp->filehnd); - xf86errno = xf86GetErrno(); - if (!fnew) { - xf86fclose(fold); /* discard old XF86FILE structure */ - return 0; - } - /* recycle the old XF86FILE structure */ - fp->magic = XF86FILE_magic; - fp->filehnd = fnew; - fp->fileno = fileno(fnew); - fp->fname = xf86strdup(fname); -#ifdef DEBUG - ErrorF("xf86freopen(%s,%s,%p) yields FILE %p XF86FILE %p\n", - fname,mode,fold,fnew,fp); -#endif - return (XF86FILE*)fp; -} - -_X_EXPORT int -xf86setbuf(XF86FILE* f, char *buf) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86fsetbuf"); -#ifdef SETBUF_RETURNS_INT - return setbuf(fp->filehnd, buf); -#else - setbuf(fp->filehnd, buf); - return 0; -#endif -} - -_X_EXPORT int -xf86setvbuf(XF86FILE* f, char *buf, int mode, xf86size_t size) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - int vbufmode; - - _xf86checkhndl(fp,"xf86fsetvbuf"); - - switch (mode) { - case XF86_IONBF: - vbufmode = _IONBF; - break; - case XF86_IOLBF: - vbufmode = _IOFBF; - break; - case XF86_IOFBF: - vbufmode = _IOLBF; - break; - default: - FatalError("libc_wrapper error: mode in setvbuf incorrect"); - exit(42); - } - - return setvbuf(fp->filehnd,buf,vbufmode,(size_t)size); -} - -_X_EXPORT XF86FILE* -xf86tmpfile(void) -{ -#ifdef NEED_TMPFILE - return xf86fopen(tmpnam((char*)0),"w+"); -#else - XF86FILE_priv* fp; - FILE *f = tmpfile(); - xf86errno = xf86GetErrno(); - if (!f) return 0; - - fp = xalloc(sizeof(XF86FILE_priv)); - fp->magic = XF86FILE_magic; - fp->filehnd = f; - fp->fileno = fileno(f); - fp->fname = xf86strdup("*tmpfile*"); /* so that it can be xfree()'d */ -#ifdef DEBUG - ErrorF("xf86tmpfile() yields FILE %p XF86FILE %p\n",f,fp); -#endif - return (XF86FILE*)fp; -} -#endif /* HAS_TMPFILE */ - - -_X_EXPORT int -xf86ungetc(int c,XF86FILE* f) -{ - XF86FILE_priv* fp = (XF86FILE_priv*)f; - - _xf86checkhndl(fp,"xf86ungetc"); - return ungetc(c,fp->filehnd); -} - -/* Misc functions. Some are ANSI C, some are not. */ - -_X_EXPORT void -xf86usleep(usec) - unsigned long usec; -{ -#if (defined(SYSV) || defined(SVR4)) && !defined(sun) - syscall(3112, (usec) / 1000 + 1); -#else - usleep(usec); -#endif -} - -_X_EXPORT void -xf86getsecs(long * secs, long * usecs) -{ - struct timeval tv; - - X_GETTIMEOFDAY(&tv); - if (secs) - *secs = tv.tv_sec; - if (usecs) - *usecs= tv.tv_usec; - - return; -} - -_X_EXPORT int -xf86ffs(int mask) -{ - int n; - if (mask == 0) return 0; - for (n = 1; (mask & 1)==0; n++) - mask >>= 1; - return n; -} - -_X_EXPORT char * -xf86getenv(const char * a) -{ - /* Only allow this when the real and effective uids are the same */ - if (getuid() != geteuid()) - return NULL; - else - return(getenv(a)); -} - -_X_EXPORT void * -xf86bsearch(const void *key, const void *base, xf86size_t nmemb, - xf86size_t size, int (*compar)(const void *, const void *)) -{ - return bsearch(key, base, (size_t)nmemb, (size_t)size, compar); -} - -_X_EXPORT int -xf86execl(const char *pathname, const char *arg, ...) -{ - int i; - pid_t pid; - int exit_status; - char *arglist[5]; - va_list args; - va_start(args, arg); - arglist[0] = (char*)&args; - i = 1; - while (i < 5 && (arglist[i++] = va_arg(args, char *)) != NULL) - ; - va_end(args); - - if ((pid = fork()) < 0) { - ErrorF("Fork failed (%s)\n", strerror(errno)); - return -1; - } else if (pid == 0) { /* child */ - /* - * Make sure that the child doesn't inherit any I/O permissions it - * shouldn't have. It's better to put constraints on the development - * of a clock program than to give I/O permissions to a bogus program - * in someone's XF86Config file - */ -#ifndef SELF_CONTAINED_WRAPPER - xf86DisableIO(); -#endif - if (setuid(getuid()) == -1) { - ErrorF("xf86Execl: setuid() failed: %s\n", strerror(errno)); - exit(255); - } -#if !defined(SELF_CONTAINED_WRAPPER) - /* set stdin, stdout to the consoleFD, and leave stderr alone */ - for (i = 0; i < 2; i++) - { - if (xf86Info.consoleFd != i) - { - close(i); - dup(xf86Info.consoleFd); - } - } -#endif - - execv(pathname, arglist); - ErrorF("Exec failed for command \"%s\" (%s)\n", - pathname, strerror(errno)); - exit(255); - } - - /* parent */ - wait(&exit_status); - if (WIFEXITED(exit_status)) - { - switch (WEXITSTATUS(exit_status)) - { - case 0: /* OK */ - return 0; - case 255: /* exec() failed */ - return(255); - default: /* bad exit status */ - ErrorF("Program \"%s\" had bad exit status %d\n", - pathname, WEXITSTATUS(exit_status)); - return(WEXITSTATUS(exit_status)); - } - } - else if (WIFSIGNALED(exit_status)) - { - ErrorF("Program \"%s\" died on signal %d\n", - pathname, WTERMSIG(exit_status)); - return(WTERMSIG(exit_status)); - } -#ifdef WIFSTOPPED - else if (WIFSTOPPED(exit_status)) - { - ErrorF("Program \"%s\" stopped by signal %d\n", - pathname, WSTOPSIG(exit_status)); - return(WSTOPSIG(exit_status)); - } -#endif - else /* should never get to this point */ - { - ErrorF("Program \"%s\" has unknown exit condition\n", - pathname); - return(1); - } -} - -_X_EXPORT void -xf86abort(void) -{ - ErrorF("Module called abort() function\n"); - abort(); -} - -_X_EXPORT void -xf86exit(int ex) -{ - ErrorF("Module called exit() function with value=%d\n",ex); - exit(ex); -} - -/* directory handling functions */ -#define XF86DIR_magic 0x78666876 /* "xfhv" */ - -typedef struct _xf86_dir_ { - DIR *dir; - INT32 magic; - XF86DIRENT *dirent; -} XF86DIR_priv; - -static void -_xf86checkdirhndl(XF86DIR_priv* f,const char *func) -{ - if (!f || f->magic != XF86DIR_magic || !f->dir || !f->dirent) { - FatalError("libc_wrapper error: passed invalid DIR handle to %s", - func); - exit(42); - } -} - -_X_EXPORT XF86DIR * -xf86opendir(const char *name) -{ - XF86DIR_priv *dp; - DIR *dirp; - - dirp = opendir(name); - if (!dirp) - return (XF86DIR*)0; - - dp = xalloc(sizeof(XF86DIR_priv)); - dp->magic = XF86DIR_magic; /* This time I have this, Dirk! :-) */ - dp->dir = dirp; - dp->dirent = xalloc(sizeof(struct _xf86dirent)); - - return (XF86DIR*)dp; -} - -_X_EXPORT XF86DIRENT* -xf86readdir(XF86DIR* dirp) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dirp; - DIRENTRY *de; - XF86DIRENT* xde; - int sz; - - _xf86checkdirhndl(dp,"xf86readdir"); - - de = readdir(dp->dir); - if (!de) - return (XF86DIRENT*)0; - xde = dp->dirent; - sz = strlen(de->d_name); - strncpy(xde->d_name,de->d_name, sz>_XF86NAMELEN ? (_XF86NAMELEN+1) : (sz+1)); - xde->d_name[_XF86NAMELEN] = '\0'; /* be sure to have a 0 byte */ - return xde; -} - -_X_EXPORT void -xf86rewinddir(XF86DIR* dirp) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dirp; - - _xf86checkdirhndl(dp,"xf86readdir"); - rewinddir(dp->dir); -} - -_X_EXPORT int -xf86closedir(XF86DIR* dir) -{ - XF86DIR_priv* dp = (XF86DIR_priv*)dir; - int n; - - _xf86checkdirhndl(dp,"xf86readdir"); - - n = closedir(dp->dir); - dp->magic = 0; - xfree(dp->dirent); - xfree(dp); - - return n; -} - -static mode_t -xfToOsChmodMode(xf86mode_t xfmode) -{ - mode_t mode = 0; - - if (xfmode & XF86_S_ISUID) mode |= S_ISUID; - if (xfmode & XF86_S_ISGID) mode |= S_ISGID; - if (xfmode & XF86_S_ISVTX) mode |= S_ISVTX; - if (xfmode & XF86_S_IRUSR) mode |= S_IRUSR; - if (xfmode & XF86_S_IWUSR) mode |= S_IWUSR; - if (xfmode & XF86_S_IXUSR) mode |= S_IXUSR; - if (xfmode & XF86_S_IRGRP) mode |= S_IRGRP; - if (xfmode & XF86_S_IWGRP) mode |= S_IWGRP; - if (xfmode & XF86_S_IXGRP) mode |= S_IXGRP; - if (xfmode & XF86_S_IROTH) mode |= S_IROTH; - if (xfmode & XF86_S_IWOTH) mode |= S_IWOTH; - if (xfmode & XF86_S_IXOTH) mode |= S_IXOTH; - - return mode; -} - -_X_EXPORT int -xf86chmod(const char *path, xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - int rc = chmod(path, mode); - - xf86errno = xf86GetErrno(); - return rc; -} - -_X_EXPORT int -xf86chown(const char *path, xf86uid_t owner, xf86gid_t group) -{ - int rc = chown(path, owner, group); - xf86errno = xf86GetErrno(); - return rc; -} - -_X_EXPORT xf86uid_t -xf86geteuid(void) -{ - return geteuid(); -} - -_X_EXPORT xf86gid_t -xf86getegid(void) -{ - return getegid(); -} - -_X_EXPORT int -xf86getpid(void) -{ - return getpid(); -} - -static mode_t -xfToOsMknodMode(xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - - if (xfmode & XF86_S_IFREG) mode |= S_IFREG; - if (xfmode & XF86_S_IFCHR) mode |= S_IFCHR; - if (xfmode & XF86_S_IFBLK) mode |= S_IFBLK; - if (xfmode & XF86_S_IFIFO) mode |= S_IFIFO; - - return mode; -} - -_X_EXPORT int xf86mknod(const char *pathname, xf86mode_t xfmode, xf86dev_t dev) -{ - mode_t mode = xfToOsMknodMode(xfmode); - int rc = mknod(pathname, mode, dev); - xf86errno = xf86GetErrno(); - return rc; -} - -_X_EXPORT unsigned int xf86sleep(unsigned int seconds) -{ - return sleep(seconds); -} - -_X_EXPORT int xf86mkdir(const char *pathname, xf86mode_t xfmode) -{ - mode_t mode = xfToOsChmodMode(xfmode); - int rc = mkdir(pathname, mode); - - xf86errno = xf86GetErrno(); - return rc; -} - - -/* Several math functions */ - -_X_EXPORT int -xf86abs(int x) -{ - return abs(x); -} - -_X_EXPORT double -xf86acos(double x) -{ - return acos(x); -} - -_X_EXPORT double -xf86asin(double x) -{ - return asin(x); -} - -_X_EXPORT double -xf86atan(double x) -{ - return atan(x); -} - -_X_EXPORT double -xf86atan2(double x,double y) -{ - return atan2(x,y); -} - -_X_EXPORT double -xf86atof(const char* s) -{ - return atof(s); -} - -_X_EXPORT int -xf86atoi(const char* s) -{ - return atoi(s); -} - -_X_EXPORT long -xf86atol(const char* s) -{ - return atol(s); -} - -_X_EXPORT double -xf86ceil(double x) -{ - return ceil(x); -} - -_X_EXPORT double -xf86cos(double x) -{ - return(cos(x)); -} - -_X_EXPORT double -xf86exp(double x) -{ - return(exp(x)); -} - -_X_EXPORT double -xf86fabs(double x) -{ - return(fabs(x)); -} - -_X_EXPORT int -xf86finite(double x) -{ -#ifndef QNX4 - return(finite(x)); -#else - /* XXX Replace this with something that really works. */ - return 1; -#endif -} - -_X_EXPORT double -xf86floor(double x) -{ - return floor(x); -} - -_X_EXPORT double -xf86fmod(double x,double y) -{ - return fmod(x,y); -} - -_X_EXPORT long -xf86labs(long x) -{ - return labs(x); -} - -_X_EXPORT double -xf86ldexp(double x, int exp) -{ - return ldexp(x, exp); -} - -_X_EXPORT double -xf86log(double x) -{ - return(log(x)); -} - -_X_EXPORT double -xf86log10(double x) -{ - return(log10(x)); -} - -_X_EXPORT double -xf86modf(double x,double* y) -{ - return modf(x,y); -} - -_X_EXPORT double -xf86pow(double x, double y) -{ - return(pow(x,y)); -} - -_X_EXPORT double -xf86sin(double x) -{ - return sin(x); -} - -_X_EXPORT double -xf86sqrt(double x) -{ - return(sqrt(x)); -} - -_X_EXPORT double -xf86strtod(const char *s, char **end) -{ - return strtod(s,end); -} - -_X_EXPORT long -xf86strtol(const char *s, char **end, int radix) -{ - return strtol(s,end,radix); -} - -_X_EXPORT unsigned long -xf86strtoul(const char *s, char **end,int radix) -{ - return strtoul(s,end,radix); -} - -_X_EXPORT double -xf86tan(double x) -{ - return tan(x); -} - -/* memory functions */ -_X_EXPORT void* -xf86memchr(const void* s, int c, xf86size_t n) -{ - return memchr(s,c,(size_t)n); -} - -_X_EXPORT int -xf86memcmp(const void* s1, const void* s2, xf86size_t n) -{ - return(memcmp(s1,s2,(size_t)n)); -} - -_X_EXPORT void* -xf86memcpy(void* dest, const void* src, xf86size_t n) -{ - return(memcpy(dest,src,(size_t)n)); -} - -_X_EXPORT void* -xf86memmove(void* dest, const void* src, xf86size_t n) -{ - return(memmove(dest,src,(size_t)n)); -} - -_X_EXPORT void* -xf86memset(void* s, int c, xf86size_t n) -{ - return(memset(s,c,(size_t)n)); -} - -/* ctype functions */ - -_X_EXPORT int -xf86isalnum(int c) -{ - return isalnum(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isalpha(int c) -{ - return isalpha(c) ? 1 : 0; -} - -_X_EXPORT int -xf86iscntrl(int c) -{ - return iscntrl(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isdigit(int c) -{ - return isdigit(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isgraph(int c) -{ - return isgraph(c) ? 1 : 0; -} - -_X_EXPORT int -xf86islower(int c) -{ - return islower(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isprint(int c) -{ - return isprint(c) ? 1 : 0; -} - -_X_EXPORT int -xf86ispunct(int c) -{ - return ispunct(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isspace(int c) -{ - return isspace(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isupper(int c) -{ - return isupper(c) ? 1 : 0; -} - -_X_EXPORT int -xf86isxdigit(int c) -{ - return isxdigit(c) ? 1 : 0; -} - -_X_EXPORT int -xf86tolower(int c) -{ - return tolower(c); -} - -_X_EXPORT int -xf86toupper(int c) -{ - return toupper(c); -} - -/* memory allocation functions */ -_X_EXPORT void* -xf86calloc(xf86size_t sz,xf86size_t n) -{ - return xcalloc(sz, n); -} - -_X_EXPORT void -xf86free(void* p) -{ - xfree(p); -} - -_X_EXPORT double -xf86frexp(double x, int *exp) -{ - return frexp(x, exp); -} - -_X_EXPORT void* -xf86malloc(xf86size_t n) -{ - return xalloc(n); -} - -_X_EXPORT void* -xf86realloc(void* p, xf86size_t n) -{ - return xrealloc(p,n); -} - -/* - * XXX This probably doesn't belong here. - */ -_X_EXPORT int -xf86getpagesize() -{ - static int pagesize = -1; - - if (pagesize != -1) - return pagesize; - -#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE) - pagesize = sysconf(_SC_PAGESIZE); -#endif -#ifdef _SC_PAGE_SIZE - if (pagesize == -1) - pagesize = sysconf(_SC_PAGE_SIZE); -#endif -#ifdef HAS_GETPAGESIZE - if (pagesize == -1) - pagesize = getpagesize(); -#endif -#ifdef PAGE_SIZE - if (pagesize == -1) - pagesize = PAGE_SIZE; -#endif - if (pagesize == -1) - FatalError("xf86getpagesize: Cannot determine page size"); - - return pagesize; -} - - -#define mapnum(e) case (e): return (xf86_##e) - -_X_EXPORT int -xf86GetErrno () -{ - switch (errno) - { - case 0: return 0; - mapnum (EACCES); - mapnum (EAGAIN); - mapnum (EBADF); - mapnum (EEXIST); - mapnum (EFAULT); - mapnum (EINTR); - mapnum (EINVAL); - mapnum (EISDIR); - mapnum (ELOOP); /* not POSIX 1 */ - mapnum (EMFILE); - mapnum (ENAMETOOLONG); - mapnum (ENFILE); - mapnum (ENOENT); - mapnum (ENOMEM); - mapnum (ENOSPC); - mapnum (ENOTDIR); - mapnum (EPIPE); - mapnum (EROFS); - mapnum (ETXTBSY); /* not POSIX 1 */ - mapnum (ENOTTY); -#ifdef ENOSYS - mapnum (ENOSYS); -#endif - mapnum (EBUSY); - mapnum (ENODEV); - mapnum (EIO); -#ifdef ESRCH - mapnum (ESRCH); -#endif -#ifdef ENXIO - mapnum (ENXIO); -#endif -#ifdef E2BIG - mapnum (E2BIG); -#endif -#ifdef ENOEXEC - mapnum (ENOEXEC); -#endif -#ifdef ECHILD - mapnum (ECHILD); -#endif -#ifdef ENOTBLK - mapnum (ENOTBLK); -#endif -#ifdef EXDEV - mapnum (EXDEV); -#endif -#ifdef EFBIG - mapnum (EFBIG); -#endif -#ifdef ESPIPE - mapnum (ESPIPE); -#endif -#ifdef EMLINK - mapnum (EMLINK); -#endif -#ifdef EDOM - mapnum (EDOM); -#endif -#ifdef ERANGE - mapnum (ERANGE); -#endif - default: - return (xf86_UNKNOWN); - } -} - -#undef mapnum - - - -#ifdef HAVE_SYSV_IPC - -_X_EXPORT int -xf86shmget(xf86key_t key, int size, int xf86shmflg) -{ - int shmflg; - int ret; - - /* This copies the permissions (SHM_R, SHM_W for u, g, o). */ - shmflg = xf86shmflg & 0777; - - if (key == XF86IPC_PRIVATE) key = IPC_PRIVATE; - - if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT; - if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL; - if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT; - ret = shmget((key_t) key, size, shmflg); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -_X_EXPORT char * -xf86shmat(int id, char *addr, int xf86shmflg) -{ - int shmflg = 0; - pointer ret; - -#ifdef SHM_RDONLY - if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY; -#endif -#ifdef SHM_RND - if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND; -#endif -#ifdef SHM_REMAP - if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP; -#endif - - ret = shmat(id,addr,shmflg); - - if (ret == (pointer) -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -_X_EXPORT int -xf86shmdt(char *addr) -{ - int ret; - - ret = shmdt(addr); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} - -/* - * for now only implement the rmid command. - */ -_X_EXPORT int -xf86shmctl(int id, int xf86cmd, pointer buf) -{ - int cmd; - int ret; - - switch (xf86cmd) { - case XF86IPC_RMID: - cmd = IPC_RMID; - break; - default: - return 0; - } - - ret = shmctl(id, cmd, buf); - - if (ret == -1) - xf86errno = xf86GetErrno(); - - return ret; -} -#else - -int -xf86shmget(xf86key_t key, int size, int xf86shmflg) -{ - xf86errno = ENOSYS; - - return -1; -} - -char * -xf86shmat(int id, char *addr, int xf86shmflg) -{ - xf86errno = ENOSYS; - - return (char *)-1; -} - -int -xf86shmctl(int id, int xf86cmd, pointer buf) -{ - xf86errno = ENOSYS; - - return -1; -} - -int -xf86shmdt(char *addr) -{ - xf86errno = ENOSYS; - - return -1; -} -#endif /* HAVE_SYSV_IPC */ - -_X_EXPORT int -xf86getjmptype() -{ -#ifdef HAS_GLIBC_SIGSETJMP - return 1; -#else - return 0; -#endif -} - -#ifdef HAS_GLIBC_SIGSETJMP - -_X_EXPORT int -xf86setjmp(xf86jmp_buf env) -{ -#if defined(__GLIBC__) && (__GLIBC__ >= 2) - return __sigsetjmp((void *)env, xf86setjmp1_arg2()); -#else - return xf86setjmp1(env, xf86setjmp1_arg2()); -#endif -} - -_X_EXPORT int -xf86setjmp0(xf86jmp_buf env) -{ - FatalError("setjmp: type 0 called instead of type %d", xf86getjmptype()); -} - -#if !defined(__GLIBC__) || (__GLIBC__ < 2) /* libc5 */ - -_X_EXPORT int -xf86setjmp1(xf86jmp_buf env, int arg2) -{ - __sigjmp_save((void *)env, arg2); - return __setjmp((void *)env); -} - -#endif - -#else /* HAS_GLIBC_SIGSETJMP */ - -int -xf86setjmp1(xf86jmp_buf env, int arg2) -{ - FatalError("setjmp: type 1 called instead of type %d", xf86getjmptype()); -} - -int -xf86setjmp0(xf86jmp_buf env) -{ - return setjmp((void *)env); -} - -#endif /* HAS_GLIBC_SIGSETJMP */ - -_X_EXPORT int -xf86setjmp1_arg2() -{ - return 1; -} - -_X_EXPORT int -xf86setjmperror(xf86jmp_buf env) -{ - FatalError("setjmp: don't know how to handle setjmp() type %d", - xf86getjmptype()); -} - -long -xf86random() -{ - return random(); -} diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am index 5ed60bc55..68f6b4cd0 100644 --- a/hw/xfree86/os-support/solaris/Makefile.am +++ b/hw/xfree86/os-support/solaris/Makefile.am @@ -20,7 +20,6 @@ solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S noinst_LTLIBRARIES = libsolaris.la libsolaris_la_SOURCES = sun_bios.c sun_init.c \ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ - $(srcdir)/../shared/libc_wrapper.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/stdResource.c \ diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 77f2253e9..aba47581f 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -76,21 +76,6 @@ #include <X11/Xos.h> #include <X11/Xfuncproto.h> -/* - * Define some things from the "ANSI" C wrappers that are needed in the - * the core server. - */ -#ifndef HAVE_WRAPPER_DECLS -#define HAVE_WRAPPER_DECLS -#undef usleep -#define usleep(a) xf86usleep(a) -extern void xf86usleep(unsigned long); -extern int xf86getpagesize(void); -extern int xf86GetErrno(void); -typedef unsigned long xf86size_t; -typedef signed long xf86ssize_t; -#endif - #include <stdio.h> #include <ctype.h> #include <stddef.h> diff --git a/hw/xfree86/os-support/xf86_ansic.h b/hw/xfree86/os-support/xf86_ansic.h deleted file mode 100644 index 0afd96744..000000000 --- a/hw/xfree86/os-support/xf86_ansic.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright 1997-2003 by The XFree86 Project, Inc - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holders - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holders make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef _XF86_ANSIC_H -#define _XF86_ANSIC_H - -#include <stdarg.h> - -/* - * The first set of definitions are required both for modules and - * libc_wrapper.c. - */ - -#if !defined(SYSV) && !defined(SVR4) && !defined(Lynx) || \ - defined(__SCO__) || defined(__UNIXWARE__) -#define HAVE_VSSCANF -#define HAVE_VFSCANF -#endif - -#ifndef NULL -#if (defined(SVR4) || defined(SYSV)) && !defined(__GNUC__) -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif -#ifndef EOF -#define EOF (-1) -#endif - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -/* <limits.h> stuff */ -#define x_BITSPERBYTE 8 -#define x_BITS(type) (x_BITSPERBYTE * (int)sizeof(type)) -#define x_SHORTBITS x_BITS(short) -#define x_INTBITS x_BITS(int) -#define x_LONGBITS x_BITS(long) -#ifndef SHRT_MIN -#define SHRT_MIN ((short)(1 << (x_SHORTBITS - 1))) -#endif - -#ifndef FONTMODULE -#include "misc.h" -#endif -#include "xf86_libc.h" -#ifndef SHRT_MAX -#define SHRT_MAX ((short)~SHRT_MIN) -#endif -#ifndef USHRT_MAX -#define USHRT_MAX ((unsigned short)~0) -#endif -#ifndef MINSHORT -#define MINSHORT SHRT_MIN -#endif -#ifndef MAXSHORT -#define MAXSHORT SHRT_MAX -#endif -#ifndef INT_MIN -#define INT_MIN (1 << (x_INTBITS - 1)) -#endif -#ifndef INT_MAX -#define INT_MAX (~INT_MIN) -#endif -#ifndef UINT_MAX -#define UINT_MAX (~0) -#endif -#ifndef MININT -#define MININT INT_MIN -#endif -#ifndef MAXINT -#define MAXINT INT_MAX -#endif -#ifndef LONG_MIN -#define LONG_MIN ((long)(1 << (x_LONGBITS - 1))) -#endif -#ifndef LONG_MAX -#define LONG_MAX ((long)~LONG_MIN) -#endif -#ifndef ULONG_MAX -#define ULONG_MAX ((unsigned long)~0UL) -#endif -#ifndef MINLONG -#define MINLONG LONG_MIN -#endif -#ifndef MAXLONG -#define MAXLONG LONG_MAX -#endif - -/* - * ANSI C compilers only. - */ - -/* ANSI C emulation library */ - -extern void xf86abort(void); -extern int xf86abs(int); -extern double xf86acos(double); -extern double xf86asin(double); -extern double xf86atan(double); -extern double xf86atan2(double,double); -extern double xf86atof(const char*); -extern int xf86atoi(const char*); -extern long xf86atol(const char*); -extern void *xf86bsearch(const void *, const void *, xf86size_t, xf86size_t, - int (*)(const void *, const void *)); -extern double xf86ceil(double); -extern void* xf86calloc(xf86size_t,xf86size_t); -extern void xf86clearerr(XF86FILE*); -extern double xf86cos(double); -extern void xf86exit(int); -extern double xf86exp(double); -extern double xf86fabs(double); -extern int xf86fclose(XF86FILE*); -extern int xf86feof(XF86FILE*); -extern int xf86ferror(XF86FILE*); -extern int xf86fflush(XF86FILE*); -extern int xf86fgetc(XF86FILE*); -extern int xf86getc(XF86FILE*); -extern int xf86fgetpos(XF86FILE*,XF86fpos_t*); -extern char* xf86fgets(char*,INT32,XF86FILE*); -extern int xf86finite(double); -extern double xf86floor(double); -extern double xf86fmod(double,double); -extern XF86FILE* xf86fopen(const char*,const char*); -extern double xf86frexp(double, int*); -extern int xf86printf(const char*,...); -extern int xf86fprintf(XF86FILE*,const char*,...); -extern int xf86fputc(int,XF86FILE*); -extern int xf86fputs(const char*,XF86FILE*); -extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*); -extern void xf86free(void*); -extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*); -#if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES) -extern int xf86fscanf(XF86FILE*,const char*,...); -#else -extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *, - char *,char *,char *,char *,char *,char * */); -#endif -extern int xf86fseek(XF86FILE*,long,int); -extern int xf86fsetpos(XF86FILE*,const XF86fpos_t*); -extern long xf86ftell(XF86FILE*); -extern xf86size_t xf86fwrite(const void*,xf86size_t,xf86size_t,XF86FILE*); -extern char* xf86getenv(const char*); -extern int xf86isalnum(int); -extern int xf86isalpha(int); -extern int xf86iscntrl(int); -extern int xf86isdigit(int); -extern int xf86isgraph(int); -extern int xf86islower(int); -extern int xf86isprint(int); -extern int xf86ispunct(int); -extern int xf86isspace(int); -extern int xf86isupper(int); -extern int xf86isxdigit(int); -extern long xf86labs(long); -extern double xf86ldexp(double,int); -extern double xf86log(double); -extern double xf86log10(double); -extern void* xf86malloc(xf86size_t); -extern void* xf86memchr(const void*,int,xf86size_t); -extern int xf86memcmp(const void*,const void*,xf86size_t); -extern void* xf86memcpy(void*,const void*,xf86size_t); -extern void* xf86memmove(void*,const void*,xf86size_t); -extern void* xf86memset(void*,int,xf86size_t); -extern double xf86modf(double,double*); -extern void xf86perror(const char*); -extern double xf86pow(double,double); -extern void xf86qsort(void*, xf86size_t, xf86size_t, - int(*)(const void*, const void*)); -extern void* xf86realloc(void*,xf86size_t); -extern long xf86random(void); -extern int xf86remove(const char*); -extern int xf86rename(const char*,const char*); -extern void xf86rewind(XF86FILE*); -extern int xf86setbuf(XF86FILE*,char*); -extern int xf86setvbuf(XF86FILE*,char*,int,xf86size_t); -extern double xf86sin(double); -extern int xf86sprintf(char*,const char*,...); -extern int xf86snprintf(char*,xf86size_t,const char*,...); -extern double xf86sqrt(double); -#if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES) -extern int xf86sscanf(char*,const char*,...); -#else -extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *, - char *,char *,char *,char *,char *,char * */); -#endif -extern char* xf86strcat(char*,const char*); -extern char* xf86strchr(const char*, int c); -extern int xf86strcmp(const char*,const char*); -extern int xf86strcasecmp(const char*,const char*); -extern char* xf86strcpy(char*,const char*); -extern xf86size_t xf86strcspn(const char*,const char*); -extern char* xf86strerror(int); -extern xf86size_t xf86strlcat(char*,const char*,xf86size_t); -extern xf86size_t xf86strlcpy(char*,const char*,xf86size_t); -extern xf86size_t xf86strlen(const char*); -extern char* xf86strncat(char *, const char *, xf86size_t); -extern int xf86strncmp(const char*,const char*,xf86size_t); -extern int xf86strncasecmp(const char*,const char*,xf86size_t); -extern char* xf86strncpy(char*,const char*,xf86size_t); -extern char* xf86strpbrk(const char*,const char*); -extern char* xf86strrchr(const char*,int); -extern xf86size_t xf86strspn(const char*,const char*); -extern char* xf86strstr(const char*,const char*); -extern double xf86strtod(const char*,char**); -extern char* xf86strtok(char*,const char*); -extern long xf86strtol(const char*,char**,int); -extern unsigned long xf86strtoul(const char*,char**,int); -extern double xf86tan(double); -extern XF86FILE* xf86tmpfile(void); -extern char* xf86tmpnam(char*); -extern int xf86tolower(int); -extern int xf86toupper(int); -extern int xf86ungetc(int,XF86FILE*); -extern int xf86vfprintf(XF86FILE*,const char*,va_list); -extern int xf86vsprintf(char*,const char*,va_list); -extern int xf86vsnprintf(char*,xf86size_t,const char*,va_list); - -extern int xf86open(const char*, int,...); -extern int xf86close(int); -extern long xf86lseek(int, long, int); -extern int xf86ioctl(int, unsigned long, pointer); -extern xf86ssize_t xf86read(int, void *, xf86size_t); -extern xf86ssize_t xf86write(int, const void *, xf86size_t); -extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */); -extern int xf86munmap(void*, xf86size_t); -extern int xf86stat(const char *, struct xf86stat *); -extern int xf86fstat(int, struct xf86stat *); -extern int xf86access(const char *, int); -extern int xf86errno; -extern int xf86GetErrno(void); - -extern double xf86HUGE_VAL; - -extern double xf86hypot(double,double); - -/* non-ANSI C functions */ -extern XF86DIR* xf86opendir(const char*); -extern int xf86closedir(XF86DIR*); -extern XF86DIRENT* xf86readdir(XF86DIR*); -extern void xf86rewinddir(XF86DIR*); -extern void xf86bcopy(const void*,void*,xf86size_t); -extern int xf86ffs(int); -extern char* xf86strdup(const char*); -extern void xf86bzero(void*,unsigned int); -extern int xf86execl(const char *, const char *, ...); -extern long xf86fpossize(void); -extern int xf86chmod(const char *, xf86mode_t); -extern int xf86chown(const char *, xf86uid_t, xf86gid_t); -extern xf86uid_t xf86geteuid(void); -extern xf86gid_t xf86getegid(void); -extern int xf86getpid(void); -extern int xf86mknod(const char *, xf86mode_t, xf86dev_t); -extern int xf86mkdir(const char *, xf86mode_t); -unsigned int xf86sleep(unsigned int seconds); -/* sysv IPC */ -extern int xf86shmget(xf86key_t key, int size, int xf86shmflg); -extern char * xf86shmat(int id, char *addr, int xf86shmflg); -extern int xf86shmdt(char *addr); -extern int xf86shmctl(int id, int xf86cmd, pointer buf); - -extern int xf86setjmp(xf86jmp_buf env); -extern int xf86setjmp0(xf86jmp_buf env); -extern int xf86setjmp1(xf86jmp_buf env, int); -extern int xf86setjmp1_arg2(void); -extern int xf86setjmperror(xf86jmp_buf env); -extern int xf86getjmptype(void); -extern void xf86longjmp(xf86jmp_buf env, int val); -#define xf86setjmp_macro(env) \ - (xf86getjmptype() == 0 ? xf86setjmp0((env)) : \ - (xf86getjmptype() == 1 ? xf86setjmp1((env), xf86setjmp1_arg2()) : \ - xf86setjmperror((env)))) - -/* - * These things are always required by drivers (but not by libc_wrapper.c), - * even for a static server because some OSs don't provide them. - */ - -extern int xf86getpagesize(void); -extern void xf86usleep(unsigned long); -extern void xf86getsecs(long *, long *); -#ifndef DONT_DEFINE_WRAPPERS -#undef getpagesize -#define getpagesize() xf86getpagesize() -#undef usleep -#define usleep(ul) xf86usleep(ul) -#undef getsecs -#define getsecs(a, b) xf86getsecs(a, b) -#endif -#endif /* _XF86_ANSIC_H */ diff --git a/hw/xfree86/os-support/xf86_libc.h b/hw/xfree86/os-support/xf86_libc.h deleted file mode 100644 index 199fcd6b9..000000000 --- a/hw/xfree86/os-support/xf86_libc.h +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file is an attempt to make developing code for the new loadable module - * architecure simpler. It tries to use macros to hide all libc wrappers so - * that all that is needed to "port" a module to this architecture is to - * include this one header file - * - * Revision history: - * - * - * 0.4 Apr 12 1997 add the ANSI defines - * 0.3 Feb 24 1997 handle getenv - * 0.2 Feb 24 1997 hide few FILE functions - * 0.1 Feb 24 1997 hide the trivial functions mem* str* - */ - -#ifndef XF86_LIBC_H -#define XF86_LIBC_H 1 - -#include <X11/Xfuncs.h> -#include <stddef.h> - -/* - * The first set of definitions are required both for modules and - * libc_wrapper.c. - */ - -/* - * First, the new data types - * - * note: if some pointer is declared "opaque" here, pass it between - * xf86* functions only, and don't rely on it having a whatever internal - * structure, even if some source file might reveal the existence of - * such a structure. - */ -typedef void XF86FILE; /* opaque FILE replacement */ -extern XF86FILE* xf86stdin; -extern XF86FILE* xf86stdout; -extern XF86FILE* xf86stderr; - -typedef void XF86fpos_t; /* opaque fpos_t replacement */ - -#define _XF86NAMELEN 263 /* enough for a larger filename */ - /* (divisble by 8) */ -typedef void XF86DIR; /* opaque DIR replacement */ - -/* Note: the following is POSIX! POSIX only requires the d_name member. - * Normal Unix has often a number of other members, but don't rely on that - */ -struct _xf86dirent { /* types in struct dirent/direct: */ - char d_name[_XF86NAMELEN+1]; /* char [MAXNAMLEN]; might be smaller or unaligned */ -}; -typedef struct _xf86dirent XF86DIRENT; - -typedef unsigned long xf86size_t; -typedef signed long xf86ssize_t; -typedef unsigned long xf86dev_t; -typedef unsigned int xf86mode_t; -typedef unsigned int xf86uid_t; -typedef unsigned int xf86gid_t; - -struct xf86stat { - xf86dev_t st_rdev; /* This is incomplete, and makes assumptions */ -}; - -/* sysv IPC */ -typedef int xf86key_t; - -/* setjmp/longjmp */ -#if defined(__ia64__) -typedef int xf86jmp_buf[1024] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ -#else -typedef int xf86jmp_buf[1024]; -#endif - -/* for setvbuf */ -#define XF86_IONBF 1 -#define XF86_IOFBF 2 -#define XF86_IOLBF 3 - -/* for open (XXX not complete) */ -#define XF86_O_RDONLY 0x0000 -#define XF86_O_WRONLY 0x0001 -#define XF86_O_RDWR 0x0002 -#define XF86_O_CREAT 0x0200 - -/* for mmap */ -#define XF86_PROT_EXEC 0x0001 -#define XF86_PROT_READ 0x0002 -#define XF86_PROT_WRITE 0x0004 -#define XF86_PROT_NONE 0x0008 -#define XF86_MAP_FIXED 0x0001 -#define XF86_MAP_SHARED 0x0002 -#define XF86_MAP_PRIVATE 0x0004 -#define XF86_MAP_32BIT 0x0040 -#define XF86_MAP_FAILED ((void *)-1) - -/* for fseek */ -#define XF86_SEEK_SET 0 -#define XF86_SEEK_CUR 1 -#define XF86_SEEK_END 2 - -/* for access */ -#define XF86_R_OK 0 -#define XF86_W_OK 1 -#define XF86_X_OK 2 -#define XF86_F_OK 3 - -/* for chmod */ -#define XF86_S_ISUID 04000 /* set user ID on execution */ -#define XF86_S_ISGID 02000 /* set group ID on execution */ -#define XF86_S_ISVTX 01000 /* sticky bit */ -#define XF86_S_IRUSR 00400 /* read by owner */ -#define XF86_S_IWUSR 00200 /* write by owner */ -#define XF86_S_IXUSR 00100 /* execute/search by owner */ -#define XF86_S_IRGRP 00040 /* read by group */ -#define XF86_S_IWGRP 00020 /* write by group */ -#define XF86_S_IXGRP 00010 /* execute/search by group */ -#define XF86_S_IROTH 00004 /* read by others */ -#define XF86_S_IWOTH 00002 /* write by others */ -#define XF86_S_IXOTH 00001 /* execute/search by others */ - -/* for mknod */ -#define XF86_S_IFREG 0010000 -#define XF86_S_IFCHR 0020000 -#define XF86_S_IFBLK 0040000 -#define XF86_S_IFIFO 0100000 - -/* - * errno values - * They start at 1000 just so they don't match real errnos at all - */ -#define xf86_UNKNOWN 1000 -#define xf86_EACCES 1001 -#define xf86_EAGAIN 1002 -#define xf86_EBADF 1003 -#define xf86_EEXIST 1004 -#define xf86_EFAULT 1005 -#define xf86_EINTR 1006 -#define xf86_EINVAL 1007 -#define xf86_EISDIR 1008 -#define xf86_ELOOP 1009 -#define xf86_EMFILE 1010 -#define xf86_ENAMETOOLONG 1011 -#define xf86_ENFILE 1012 -#define xf86_ENOENT 1013 -#define xf86_ENOMEM 1014 -#define xf86_ENOSPC 1015 -#define xf86_ENOTDIR 1016 -#define xf86_EPIPE 1017 -#define xf86_EROFS 1018 -#define xf86_ETXTBSY 1019 -#define xf86_ENOTTY 1020 -#define xf86_ENOSYS 1021 -#define xf86_EBUSY 1022 -#define xf86_ENODEV 1023 -#define xf86_EIO 1024 - -#define xf86_ESRCH 1025 -#define xf86_ENXIO 1026 -#define xf86_E2BIG 1027 -#define xf86_ENOEXEC 1028 -#define xf86_ECHILD 1029 -#define xf86_ENOTBLK 1030 -#define xf86_EXDEV 1031 -#define xf86_EFBIG 1032 -#define xf86_ESPIPE 1033 -#define xf86_EMLINK 1034 -#define xf86_EDOM 1035 -#define xf86_ERANGE 1036 - - -/* sysv IPV */ -/* xf86shmget() */ -#define XF86IPC_CREAT 01000 -#define XF86IPC_EXCL 02000 -#define XF86IPC_NOWAIT 04000 -#define XF86SHM_R 0400 -#define XF86SHM_W 0200 -#define XF86IPC_PRIVATE ((xf86key_t)0) -/* xf86shmat() */ -#define XF86SHM_RDONLY 010000 /* attach read-only else read-write */ -#define XF86SHM_RND 020000 /* round attach address to SHMLBA */ -#define XF86SHM_REMAP 040000 /* take-over region on attach */ -/* xf86shmclt() */ -#define XF86IPC_RMID 0 - -/* - * the rest of this file should only be included for code that is supposed - * to go into modules - */ - -#if !defined(DONT_DEFINE_WRAPPERS) - -#undef abort -#define abort() xf86abort() -#undef abs -#define abs(i) xf86abs(i) -#undef acos -#define acos(d) xf86acos(d) -#undef asin -#define asin(d) xf86asin(d) -#undef atan -#define atan(d) xf86atan(d) -#undef atan2 -#define atan2(d1,d2) xf86atan2(d1,d2) -#undef atof -#define atof(ccp) xf86atof(ccp) -#undef atoi -#define atoi(ccp) xf86atoi(ccp) -#undef atol -#define atol(ccp) xf86atol(ccp) -#undef bsearch -#define bsearch(a,b,c,d,e) xf86bsearch(a,b,c,d,e) -#undef ceil -#define ceil(d) xf86ceil(d) -#undef calloc -#define calloc(I1,I2) xf86calloc(I1,I2) -#undef clearerr -#define clearerr(FP) xf86clearerr(FP) -#undef cos -#define cos(d) xf86cos(d) -#undef exit -#define exit(i) xf86exit(i) -#undef exp -#define exp(d) xf86exp(d) -#undef fabs -#define fabs(d) xf86fabs(d) -#undef fclose -#define fclose(FP) xf86fclose(FP) -#undef feof -#define feof(FP) xf86feof(FP) -#undef ferror -#define ferror(FP) xf86ferror(FP) -#undef fflush -#define fflush(FP) xf86fflush(FP) -#undef fgetc -#define fgetc(FP) xf86fgetc(FP) -#undef getc -#define getc(FP) xf86getc(FP) -#undef fgetpos -#define fgetpos(FP,fpp) xf86fgetpos(FP,fpp) -#undef fgets -#define fgets(cp,i,FP) xf86fgets(cp,i,FP) -#undef finite -#define finite(d) xf86finite(d) -#undef floor -#define floor(d) xf86floor(d) -#undef fmod -#define fmod(d1,d2) xf86fmod(d1,d2) -#undef fopen -#define fopen(ccp1,ccp2) xf86fopen(ccp1,ccp2) -#undef printf -#define printf xf86printf -#undef fprintf -#define fprintf xf86fprintf -#undef fputc -#define fputc(i,FP) xf86fputc(i,FP) -#undef fputs -#define fputs(ccp,FP) xf86fputs(ccp,FP) -#undef fread -#define fread(vp,I1,I2,FP) xf86fread(vp,I1,I2,FP) -#undef free -#define free(vp) xf86free(vp) -#undef freopen -#define freopen(ccp1,ccp2,FP) xf86freopen(ccp1,ccp2,FP) -#undef frexp -#define frexp(x,exp) xf86frexp(x,exp) -#undef fscanf -#define fscanf xf86fscanf -#undef fseek -#define fseek(FP,l,i) xf86fseek(FP,l,i) -#undef fsetpos -#define fsetpos(FP,cfpp) xf86fsetpos(FP,cfpp) -#undef ftell -#define ftell(FP) xf86ftell(FP) -#undef fwrite -#define fwrite(cvp,I1,I2,FP) xf86fwrite(cvp,I1,I2,FP) -#undef getenv -#define getenv(ccp) xf86getenv(ccp) -#undef isalnum -#define isalnum(i) xf86isalnum(i) -#undef isalpha -#define isalpha(i) xf86isalpha(i) -#undef iscntrl -#define iscntrl(i) xf86iscntrl(i) -#undef isdigit -#define isdigit(i) xf86isdigit(i) -#undef isgraph -#define isgraph(i) xf86isgraph(i) -#undef islower -#define islower(i) xf86islower(i) -#undef isprint -#define isprint(i) xf86isprint(i) -#undef ispunct -#define ispunct(i) xf86ispunct(i) -#undef isspace -#define isspace(i) xf86isspace(i) -#undef isupper -#define isupper(i) xf86isupper(i) -#undef isxdigit -#define isxdigit(i) xf86isxdigit(i) -#undef labs -#define labs(l) xf86labs(l) -#undef ldexp -#define ldexp(x, exp) xf86ldexp(x, exp) -#undef log -#define log(d) xf86log(d) -#undef log10 -#define log10(d) xf86log10(d) -#undef malloc -#define malloc(I) xf86malloc(I) -#undef memchr -#define memchr(cvp,i,I) xf86memchr(cvp,i,I) -#undef memcmp -#define memcmp(cvp1,cvp2,I) xf86memcmp(cvp1,cvp2,I) -#undef memcpy -#define memcpy(vp,cvp,I) xf86memcpy(vp,cvp,I) -#undef memmove -#define memmove(vp,cvp,I) xf86memmove(vp,cvp,I) -#undef memset -#define memset(vp,int,I) xf86memset(vp,int,I) -#undef modf -#define modf(d,dp) xf86modf(d,dp) -#undef perror -#define perror(ccp) xf86perror(ccp) -#undef pow -#define pow(d1,d2) xf86pow(d1,d2) -#undef random -#define random() xf86random() -#undef realloc -#define realloc(vp,I) xf86realloc(vp,I) -#undef remove -#define remove(ccp) xf86remove(ccp) -#undef rename -#define rename(ccp1,ccp2) xf86rename(ccp1,ccp2) -#undef rewind -#define rewind(FP) xf86rewind(FP) -#undef setbuf -#define setbuf(FP,cp) xf86setbuf(FP,cp) -#undef setvbuf -#define setvbuf(FP,cp,i,I) xf86setvbuf(FP,cp,i,I) -#undef sin -#define sin(d) xf86sin(d) -#undef snprintf -#define snprintf xf86snprintf -#undef sprintf -#define sprintf xf86sprintf -#undef sqrt -#define sqrt(d) xf86sqrt(d) -#undef sscanf -#define sscanf xf86sscanf -#undef strcat -#define strcat(cp,ccp) xf86strcat(cp,ccp) -#undef strcmp -#define strcmp(ccp1,ccp2) xf86strcmp(ccp1,ccp2) -#undef strcasecmp -#define strcasecmp(ccp1,ccp2) xf86strcasecmp(ccp1,ccp2) -#undef strcpy -#define strcpy(cp,ccp) xf86strcpy(cp,ccp) -#undef strcspn -#define strcspn(ccp1,ccp2) xf86strcspn(ccp1,ccp2) -#undef strerror -#define strerror(i) xf86strerror(i) -#undef strlcat -#define strlcat(cp,ccp,I) xf86strlcat(cp,ccp,I) -#undef strlcpy -#define strlcpy(cp,ccp,I) xf86strlcpy(cp,ccp,I) -#undef strlen -#define strlen(ccp) xf86strlen(ccp) -#undef strncmp -#define strncmp(ccp1,ccp2,I) xf86strncmp(ccp1,ccp2,I) -#undef strncasecmp -#define strncasecmp(ccp1,ccp2,I) xf86strncasecmp(ccp1,ccp2,I) -#undef strncpy -#define strncpy(cp,ccp,I) xf86strncpy(cp,ccp,I) -#undef strpbrk -#define strpbrk(ccp1,ccp2) xf86strpbrk(ccp1,ccp2) -#undef strchr -#define strchr(ccp,i) xf86strchr(ccp,i) -#undef strrchr -#define strrchr(ccp,i) xf86strrchr(ccp,i) -#undef strspn -#define strspn(ccp1,ccp2) xf86strspn(ccp1,ccp2) -#undef strstr -#define strstr(ccp1,ccp2) xf86strstr(ccp1,ccp2) -#undef srttod -#define strtod(ccp,cpp) xf86strtod(ccp,cpp) -#undef strtok -#define strtok(cp,ccp) xf86strtok(cp,ccp) -#undef strtol -#define strtol(ccp,cpp,i) xf86strtol(ccp,cpp,i) -#undef strtoul -#define strtoul(ccp,cpp,i) xf86strtoul(ccp,cpp,i) -#undef tan -#define tan(d) xf86tan(d) -#undef tmpfile -#define tmpfile() xf86tmpfile() -#undef tolower -#define tolower(i) xf86tolower(i) -#undef toupper -#define toupper(i) xf86toupper(i) -#undef ungetc -#define ungetc(i,FP) xf86ungetc(i,FP) -#undef vfprintf -#define vfprintf(p,f,a) xf86vfprintf(p,f,a) -#undef vsnprintf -#define vsnprintf(s,n,f,a) xf86vsnprintf(s,n,f,a) -#undef vsprintf -#define vsprintf(s,f,a) xf86vsprintf(s,f,a) -/* XXX Disable assert as if NDEBUG was defined */ -/* Some X headers defined this away too */ -#undef assert -#define assert(a) ((void)0) -#undef HUGE_VAL -#define HUGE_VAL xf86HUGE_VAL - -#undef hypot -#define hypot(x,y) xf86hypot(x,y) - -#undef qsort -#define qsort(b, n, s, f) xf86qsort(b, n, s, f) - -/* non-ANSI C functions */ -#undef opendir -#define opendir(cp) xf86opendir(cp) -#undef closedir -#define closedir(DP) xf86closedir(DP) -#undef readdir -#define readdir(DP) xf86readdir(DP) -#undef rewinddir -#define rewinddir(DP) xf86rewinddir(DP) -#undef bcopy -#define bcopy(vp,cvp,I) xf86memmove(cvp,vp,I) -#undef ffs -#define ffs(i) xf86ffs(i) -#undef strdup -#define strdup(ccp) xf86strdup(ccp) -#undef bzero -#define bzero(vp,ui) xf86bzero(vp,ui) -#undef execl -#define execl xf86execl -#undef chmod -#define chmod(a,b) xf86chmod(a,b) -#undef chown -#define chown(a,b,c) xf86chown(a,b,c) -#undef geteuid -#define geteuid xf86geteuid -#undef getegid -#define getegid xf86getegid -#undef getpid -#define getpid xf86getpid -#undef mknod -#define mknod(a,b,c) xf86mknod(a,b,c) -#undef sleep -#define sleep(a) xf86sleep(a) -#undef mkdir -#define mkdir(a,b) xf86mkdir(a,b) -#undef getpagesize -#define getpagesize xf86getpagesize -#undef shmget -#define shmget(a,b,c) xf86shmget(a,b,c) -#undef shmat -#define shmat(a,b,c) xf86shmat(a,b,c) -#undef shmdt -#define shmdt(a) xf86shmdt(a) -#undef shmctl -#define shmctl(a,b,c) xf86shmctl(a,b,c) - -#undef S_ISUID -#define S_ISUID XF86_S_ISUID -#undef S_ISGID -#define S_ISGID XF86_S_ISGID -#undef S_ISVTX -#define S_ISVTX XF86_S_ISVTX -#undef S_IRUSR -#define S_IRUSR XF86_S_IRUSR -#undef S_IWUSR -#define S_IWUSR XF86_S_IWUSR -#undef S_IXUSR -#define S_IXUSR XF86_S_IXUSR -#undef S_IRGRP -#define S_IRGRP XF86_S_IRGRP -#undef S_IWGRP -#define S_IWGRP XF86_S_IWGRP -#undef S_IXGRP -#define S_IXGRP XF86_S_IXGRP -#undef S_IROTH -#define S_IROTH XF86_S_IROTH -#undef S_IWOTH -#define S_IWOTH XF86_S_IWOTH -#undef S_IXOTH -#define S_IXOTH XF86_S_IXOTH -#undef S_IFREG -#define S_IFREG XF86_S_IFREG -#undef S_IFCHR -#define S_IFCHR XF86_S_IFCHR -#undef S_IFBLK -#define S_IFBLK XF86_S_IFBLK -#undef S_IFIFO -#define S_IFIFO XF86_S_IFIFO - -/* some types */ -#undef FILE -#define FILE XF86FILE -#undef fpos_t -#define fpos_t XF86fpos_t -#undef DIR -#define DIR XF86DIR -#undef DIRENT -#define DIRENT XF86DIRENT -#undef size_t -#define size_t xf86size_t -#undef ssize_t -#define ssize_t xf86ssize_t -#undef dev_t -#define dev_t xf86dev_t -#undef mode_t -#define mode_t xf86mode_t -#undef uid_t -#define uid_t xf86uid_t -#undef gid_t -#define gid_t xf86gid_t -#undef stat_t -#define stat_t struct xf86stat - -#undef ulong -#define ulong unsigned long - -/* - * There should be no need to #undef any of these. If they are already - * defined it is because some illegal header has been included. - */ - -/* some vars */ -#undef stdin -#define stdin xf86stdin -#undef stdout -#define stdout xf86stdout -#undef stderr -#define stderr xf86stderr - -#undef SEEK_SET -#define SEEK_SET XF86_SEEK_SET -#undef SEEK_CUR -#define SEEK_CUR XF86_SEEK_CUR -#undef SEEK_END -#define SEEK_END XF86_SEEK_END - -/* - * XXX Basic I/O functions BAD,BAD,BAD! - */ -#define open xf86open -#define close(a) xf86close(a) -#define lseek(a,b,c) xf86lseek(a,b,c) -#if !defined(__DragonFly__) -#define ioctl(a,b,c) xf86ioctl(a,b,c) -#endif -#define read(a,b,c) xf86read(a,b,c) -#define write(a,b,c) xf86write(a,b,c) -#define mmap(a,b,c,d,e,f) xf86mmap(a,b,c,d,e,f) -#define munmap(a,b) xf86munmap(a,b) -#define stat(a,b) xf86stat(a,b) -#define fstat(a,b) xf86fstat(a,b) -#define access(a,b) xf86access(a,b) -#undef O_RDONLY -#define O_RDONLY XF86_O_RDONLY -#undef O_WRONLY -#define O_WRONLY XF86_O_WRONLY -#undef O_RDWR -#define O_RDWR XF86_O_RDWR -#undef O_CREAT -#define O_CREAT XF86_O_CREAT -#undef PROT_EXEC -#define PROT_EXEC XF86_PROT_EXEC -#undef PROT_READ -#define PROT_READ XF86_PROT_READ -#undef PROT_WRITE -#define PROT_WRITE XF86_PROT_WRITE -#undef PROT_NONE -#define PROT_NONE XF86_PROT_NONE -#undef MAP_FIXED -#define MAP_FIXED XF86_MAP_FIXED -#undef MAP_SHARED -#define MAP_SHARED XF86_MAP_SHARED -#undef MAP_PRIVATE -#define MAP_PRIVATE XF86_MAP_PRIVATE -#undef MAP_FAILED -#define MAP_FAILED XF86_MAP_FAILED -#undef R_OK -#define R_OK XF86_R_OK -#undef W_OK -#define W_OK XF86_W_OK -#undef X_OK -#define X_OK XF86_X_OK -#undef F_OK -#define F_OK XF86_F_OK -#undef errno -#define errno xf86errno -#undef putchar -#define putchar(i) xf86fputc(i, xf86stdout) -#undef puts -#define puts(s) xf86fputs(s, xf86stdout) - -#undef EACCES -#define EACCES xf86_EACCES -#undef EAGAIN -#define EAGAIN xf86_EAGAIN -#undef EBADF -#define EBADF xf86_EBADF -#undef EEXIST -#define EEXIST xf86_EEXIST -#undef EFAULT -#define EFAULT xf86_EFAULT -#undef EINTR -#define EINTR xf86_EINTR -#undef EINVAL -#define EINVAL xf86_EINVAL -#undef EISDIR -#define EISDIR xf86_EISDIR -#undef ELOOP -#define ELOOP xf86_ELOOP -#undef EMFILE -#define EMFILE xf86_EMFILE -#undef ENAMETOOLONG -#define ENAMETOOLONG xf86_ENAMETOOLONG -#undef ENFILE -#define ENFILE xf86_ENFILE -#undef ENOENT -#define ENOENT xf86_ENOENT -#undef ENOMEM -#define ENOMEM xf86_ENOMEM -#undef ENOSPC -#define ENOSPC xf86_ENOSPC -#undef ENOTDIR -#define ENOTDIR xf86_ENOTDIR -#undef EPIPE -#define EPIPE xf86_EPIPE -#undef EROFS -#define EROFS xf86_EROFS -#undef ETXTBSY -#define ETXTBSY xf86_ETXTBSY -#undef ENOTTY -#define ENOTTY xf86_ENOTTY -#undef ENOSYS -#define ENOSYS xf86_ENOSYS -#undef EBUSY -#define EBUSY xf86_EBUSY -#undef ENODEV -#define ENODEV xf86_ENODEV -#undef EIO -#define EIO xf86_EIO - -/* IPC stuff */ -#undef SHM_RDONLY -#define SHM_RDONLY XF86SHM_RDONLY -#undef SHM_RND -#define SHM_RND XF86SHM_RND -#undef SHM_REMAP -#define SHM_REMAP XF86SHM_REMAP -#undef IPC_RMID -#define IPC_RMID XF86IPC_RMID -#undef IPC_CREAT -#define IPC_CREAT XF86IPC_CREAT -#undef IPC_EXCL -#define IPC_EXCL XF86IPC_EXCL -#undef PC_NOWAIT -#define IPC_NOWAIT XF86IPC_NOWAIT -#undef SHM_R -#define SHM_R XF86SHM_R -#undef SHM_W -#define SHM_W XF86SHM_W -#undef IPC_PRIVATE -#define IPC_PRIVATE XF86IPC_PRIVATE - -/* Some ANSI macros */ -#undef FILENAME_MAX -#define FILENAME_MAX 1024 - -#if (defined(sun) && defined(__SVR4)) -# define _FILEDEFED /* Already have FILE defined, don't redefine it */ -#endif - -#endif /* !DONT_DEFINE_WRAPPERS */ - -#if (!defined(DONT_DEFINE_WRAPPERS) || defined(DEFINE_SETJMP_WRAPPERS)) -#undef setjmp -#define setjmp(a) xf86setjmp_macro(a) -#undef longjmp -#define longjmp(a,b) xf86longjmp(a,b) -#undef jmp_buf -#define jmp_buf xf86jmp_buf -#endif - -#endif /* XF86_LIBC_H */ diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am index e7113035f..31d1b3f00 100644 --- a/hw/xfree86/utils/xorgcfg/Makefile.am +++ b/hw/xfree86/utils/xorgcfg/Makefile.am @@ -42,7 +42,6 @@ xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \ #if DoLoadableServer LDSRCS = \ - $(top_srcdir)/hw/xfree86/os-support/shared/libc_wrapper.c \ loader.c loadmod.c LOADERLIB = ../../loader/libloader.a #endif diff --git a/os/Makefile.am b/os/Makefile.am index 8ed12e47a..16070f5b8 100644 --- a/os/Makefile.am +++ b/os/Makefile.am @@ -1,4 +1,4 @@ -noinst_LTLIBRARIES = libos.la libcwrapper.la +noinst_LTLIBRARIES = libos.la AM_CFLAGS = $(DIX_CFLAGS) @@ -41,13 +41,6 @@ if NEED_STRLCAT libos_la_SOURCES += $(STRLCAT_SRCS) endif -libcwrapper_la_SOURCES = \ - $(top_srcdir)/hw/xfree86/os-support/shared/libc_wrapper.c -libcwrapper_la_CFLAGS = \ - -DSELF_CONTAINED_WRAPPER \ - -I$(top_srcdir)/hw/xfree86/os-support \ - $(AM_CFLAGS) - EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \ $(XCSECURITY_SRCS) $(XDMCP_SRCS) $(STRLCAT_SRCS) |