├── instructions-v3.txt └── patches ├── mesa.patch └── xserver.patch /instructions-v3.txt: -------------------------------------------------------------------------------- 1 | # Notice I copied something inside suhan-paradkar's instructions-v2,eNB256's instruction,and also termux's official build options 2 | #So its just an article collection 3 | 4 | #EDIT TIME=2023-2-1 5 | 6 | #Firstly solve the dependency problem 7 | 8 | apt install x11-repo -y 9 | 10 | apt install clang lld cmake autoconf automake libtool binutils '*ndk*' make python git libandroid-shmem-static 'vulkan*' ninja llvm bison flex libx11 libdrm libpixman libxfixes libjpeg-turbo xtrans libxxf86vm xorg-xrandr xorg-font-util xorg-util-macros libxfont2 libxkbfile libpciaccess xcb-util-renderutil xcb-util-image xcb-util-keysyms xcb-util-wm xorg-xkbcomp xkeyboard-config libxdamage libxinerama libepoxy xwayland libwayland libwayland-protocols xorg* virglrenderer -y 11 | apt remove xorg*static -y 12 | pip install meson mako 13 | 14 | #Collect the git repos 15 | 16 | cd ~ 17 | mkdir builds ; cd builds 18 | git clone -b xorgproto-2022.2 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto.git 19 | git clone -b 1.21.0 --depth 1 https://gitlab.freedesktop.org/wayland/wayland.git 20 | git clone --depth 1 -b 1.31 https://gitlab.freedesktop.org/wayland/wayland-protocols.git 21 | git clone --depth 1 -b libxshmfence-1.3.2 https://gitlab.freedesktop.org/xorg/lib/libxshmfence.git 22 | git clone --depth 1 -b mesa-22.0.5 https://gitlab.freedesktop.org/mesa/mesa.git 23 | git clone --depth 1 https://github.com/dottedmag/libsha1.git 24 | wget https://github.com/anholt/libepoxy/archive/refs/tags/1.5.10.tar.gz 25 | git clone --depth 1 https://gitlab.freedesktop.org/xorg/xserver.git -b xorg-server-1.20.14 xorg-server-1.20.14 26 | wget https://dri.freedesktop.org/libdrm/libdrm-2.4.114.tar.xz 27 | git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git -b virglrenderer-0.9.0 --depth 1 28 | 29 | #Build 30 | 31 | #1 xorgproto 32 | 33 | cd xorgproto* 34 | ./autogen.sh --prefix=$PREFIX --with-xmlto=no --with-fop=no --with-xsltproc=no 35 | make -j8 install 36 | 37 | #2 libwayland 38 | 39 | cd ../wayland* 40 | mkdir b ; cd b 41 | meson -Dprefix=$PREFIX -Ddocumentation=false .. 42 | ninja -j8 install 43 | 44 | #3 wayland-protocols 45 | 46 | cd ../../*protocols 47 | mkdir b 48 | cd b 49 | meson -Dprefix=$PREFIX .. 50 | ninja -j8 install 51 | 52 | #4 libxshmfence 53 | 54 | cd ../../libxshm* 55 | ./autogen.sh --prefix=$PREFIX --with-shared-memory-dir=$TMPDIR 56 | sed -i s/values.h/limits.h/ ./src/xshmfence_futex.h 57 | make -j8 install CPPFLAGS=-DMAXINT=INT_MAX 58 | 59 | #5 libdrm 60 | 61 | cd ~/builds 62 | tar xJf *xz 63 | rm *xz 64 | cd libdrm* 65 | mkdir b 66 | cd b 67 | meson -Dprefix=$PREFIX -Dintel=disabled -Dradeon=disabled -Damdgpu=disabled -Dnouveau=disabled -Dvmwgfx=disabled -Dvc4=disabled .. 68 | ninja -j8 install 69 | 70 | #6 mesa 71 | 72 | cd ~/builds/mesa 73 | mkdir b 74 | cd b 75 | *apply patches* 76 | LDFLAGS='-l:libandroid-shmem.a -llog -latomic' meson .. -Dprefix=$PREFIX -Dplatforms=x11 -Degl-native-platform=x11 -Ddri3=true -Dshader-cache=true -Dshader-cache-max-size=8G -Dshared-glapi=true -Dgles1=true -Dgles2=true -Dglx=dri -Degl=true -Dllvm=false -Dglx-direct=true -Dgbm=enabled -Ddri-drivers='' -Dgallium-drivers=zink,swrast,virgl -Ddraw-use-llvm=true -Dshared-llvm=true -Dvulkan-drivers='' -Dcpp_rtti=false -Dc_args=-Wno-error=incompatible-function-pointer-types -Dbuildtype=release -Dgallium-vdpau=false -Dgallium-xvmc=false -Dgallium-omx=disabled -Dgallium-va=false -Dgallium-xa=false -Dopencl-native=false -Dmicrosoft-clc=disabled -Dvalgrind=disabled -Dlibunwind=disabled -Dlmsensors=disabled -Dpower8=disabled -Dosmesa=true 77 | ninja -j8 install 78 | 79 | #7 libepoxy 80 | 81 | cd ~/builds 82 | tar xzf 1.5* 83 | rm *gz 84 | cd libepoxy* 85 | mkdir b 86 | cd b 87 | meson -Dprefix=$PREFIX -Degl=yes -Dglx=yes -Dx11=true -Dtests=false -Dc_args=-U__ANDROID__ -Dbuildtype=release .. 88 | ninja -j8 install 89 | 90 | #8 X-server 91 | 92 | cd ~/builds 93 | cd xorg* 94 | *apply patches* 95 | ./autogen.sh --enable-mitshm --enable-xcsecurity --enable-xf86bigfont --enable-xwayland --enable-xorg --enable-xnest --enable-xvfb --disable-xwin --enable-xephyr --enable-kdrive --disable-devel-docs --disable-config-hal --disable-config-udev --disable-unit-tests --disable-selective-werror --disable-static --without-dtrace --disable-glamor --enable-dri --enable-dri2 --enable-dri3 --enable-glx --with-sha1=libsha1 --with-pic --prefix=$PREFIX 96 | make install -j4 LDFLAGS=' -fuse-ld=lld /data/data/com.termux/files/usr/lib/libandroid-shmem.a -llog' 97 | 98 | #9 virglrenderer 99 | 100 | cd ~/builds 101 | cd virgl* 102 | *apply patch* 103 | sed -i 's+"/tmp+"/data/data/com.termux/files/usr/tmp+' vtest/vtest_protocol.h 104 | mkdir b 105 | cd b 106 | meson -Dbuildtype=release -Dprefix=$PREFIX -Dplatforms=egl,glx .. 107 | ninja -j8 install 108 | 109 | 110 | #Lock the packages that we have built 111 | apt-mark hold libdrm libepoxy libglvnd libwayland libwayland-protocols libxshmfence mesa mesa-dev osmesa virglrenderer vulkan-headers vulkan-tools xorg-font-util xorg-iceauth xorg-util-macros xorg-xauth xorg-xrdb xorgproto 112 | -------------------------------------------------------------------------------- /patches/mesa.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bin/install_megadrivers.py b/bin/install_megadrivers.py 2 | index 60ee457..298e8ac 100644 3 | --- a/bin/install_megadrivers.py 4 | +++ b/bin/install_megadrivers.py 5 | @@ -23,7 +23,13 @@ 6 | """Script to install megadriver symlinks for meson.""" 7 | 8 | import argparse 9 | -import os 10 | +import os, shutil 11 | +def link(src, dest): 12 | + shutil.copyfile(src, dest) 13 | +def unlink(src): 14 | + os.remove(src) 15 | +os.link = link 16 | +os.unlink = unlink 17 | 18 | 19 | def main(): 20 | diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h 21 | index 0ee06a4..94584f3 100644 22 | --- a/src/egl/main/egldisplay.h 23 | +++ b/src/egl/main/egldisplay.h 24 | @@ -37,7 +37,7 @@ 25 | #include "egltypedefs.h" 26 | #include "egldefines.h" 27 | #include "eglarray.h" 28 | - 29 | +#include "X11/Xlib.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp 34 | index ddd2e5e..b8d9295 100644 35 | --- a/src/gallium/drivers/zink/zink_draw.cpp 36 | +++ b/src/gallium/drivers/zink/zink_draw.cpp 37 | @@ -504,6 +504,17 @@ zink_draw(struct pipe_context *pctx, 38 | zink_rebind_all_buffers(ctx); 39 | } 40 | 41 | + if (!zink_screen(pctx->screen)->info.have_EXT_extended_dynamic_state) { 42 | + for (unsigned i = 0; i < ctx->element_state->hw_state.num_bindings; i++) { 43 | + unsigned binding = ctx->element_state->binding_map[i]; 44 | + const struct pipe_vertex_buffer *vb = ctx->vertex_buffers + binding; 45 | + if (ctx->gfx_pipeline_state.bindings[i].stride != vb->stride) { 46 | + ctx->gfx_pipeline_state.bindings[i].stride = vb->stride; 47 | + ctx->gfx_pipeline_state.dirty = true; 48 | + } 49 | + } 50 | + } 51 | + 52 | unsigned index_offset = 0; 53 | unsigned index_size = dinfo->index_size; 54 | struct pipe_resource *index_buffer = NULL; 55 | diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c 56 | index 0fceb9e..a1a6a2f 100644 57 | --- a/src/gallium/drivers/zink/zink_pipeline.c 58 | +++ b/src/gallium/drivers/zink/zink_pipeline.c 59 | @@ -57,7 +57,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen, 60 | if (!screen->info.have_EXT_vertex_input_dynamic_state || !state->element_state->num_attribs) { 61 | memset(&vertex_input_state, 0, sizeof(vertex_input_state)); 62 | vertex_input_state.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; 63 | - vertex_input_state.pVertexBindingDescriptions = state->element_state->b.bindings; 64 | + vertex_input_state.pVertexBindingDescriptions = state->bindings; 65 | vertex_input_state.vertexBindingDescriptionCount = state->element_state->num_bindings; 66 | vertex_input_state.pVertexAttributeDescriptions = state->element_state->attribs; 67 | vertex_input_state.vertexAttributeDescriptionCount = state->element_state->num_attribs; 68 | diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h 69 | index b3acb61..a905527 100644 70 | --- a/src/gallium/drivers/zink/zink_pipeline.h 71 | +++ b/src/gallium/drivers/zink/zink_pipeline.h 72 | @@ -66,10 +66,14 @@ struct zink_gfx_pipeline_state { 73 | bool modules_changed; 74 | 75 | struct zink_vertex_elements_hw_state *element_state; 76 | + uint8_t divisors_present; 77 | uint32_t vertex_hash; 78 | 79 | uint32_t final_hash; 80 | 81 | + VkVertexInputBindingDivisorDescriptionEXT divisors[PIPE_MAX_ATTRIBS]; 82 | + VkVertexInputBindingDescription bindings[PIPE_MAX_ATTRIBS]; // combination of element_state and stride 83 | + 84 | uint32_t vertex_buffers_enabled_mask; 85 | uint32_t vertex_strides[PIPE_MAX_ATTRIBS]; 86 | bool sample_locations_enabled; 87 | diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h 88 | index b93673e..064e4a3 100644 89 | --- a/src/gallium/drivers/zink/zink_screen.h 90 | +++ b/src/gallium/drivers/zink/zink_screen.h 91 | @@ -40,7 +40,7 @@ 92 | #include "util/u_vertex_state_cache.h" 93 | #include "pipebuffer/pb_cache.h" 94 | #include "pipebuffer/pb_slab.h" 95 | -#include 96 | +#include 97 | 98 | extern uint32_t zink_debug; 99 | struct hash_table; 100 | diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c 101 | index 40feb9b..1d77338 100644 102 | --- a/src/gallium/drivers/zink/zink_state.c 103 | +++ b/src/gallium/drivers/zink/zink_state.c 104 | @@ -222,10 +222,19 @@ zink_bind_vertex_elements_state(struct pipe_context *pctx, 105 | key->size += 2 * size; 106 | } 107 | state->element_state = &ctx->element_state->hw_state; 108 | - } else { 109 | - state->element_state = NULL; 110 | + struct zink_vertex_elements_state *ves = cso; 111 | + for (int i = 0; i < state->element_state->num_bindings; ++i) { 112 | + state->bindings[i].binding = ves->bindings[i].binding; 113 | + state->bindings[i].inputRate = ves->bindings[i].inputRate; 114 | + if (ves->divisor[i]) { 115 | + state->divisors[state->divisors_present].divisor = ves->divisor[i]; 116 | + state->divisors[state->divisors_present].binding = state->bindings[i].binding; 117 | + state->divisors_present++; 118 | + } 119 | + } 120 | + } else 121 | + state->element_state = NULL; 122 | ctx->vertex_buffers_dirty = false; 123 | - } 124 | } 125 | 126 | static void 127 | diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c 128 | index d933b7f..ada7f11 100644 129 | --- a/src/vulkan/wsi/wsi_common_display.c 130 | +++ b/src/vulkan/wsi/wsi_common_display.c 131 | @@ -1267,7 +1267,6 @@ wsi_display_wait_thread(void *data) 132 | .events = POLLIN 133 | }; 134 | 135 | - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); 136 | for (;;) { 137 | int ret = poll(&pollfd, 1, -1); 138 | if (ret > 0) { 139 | @@ -1297,7 +1296,6 @@ wsi_display_stop_wait_thread(struct wsi_display *wsi) 140 | { 141 | pthread_mutex_lock(&wsi->wait_mutex); 142 | if (wsi->wait_thread) { 143 | - pthread_cancel(wsi->wait_thread); 144 | pthread_join(wsi->wait_thread, NULL); 145 | wsi->wait_thread = 0; 146 | } 147 | -------------------------------------------------------------------------------- /patches/xserver.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c 2 | index 529595b..4a56ad0 100644 3 | --- a/Xext/xf86bigfont.c 4 | +++ b/Xext/xf86bigfont.c 5 | @@ -716,7 +716,7 @@ XFree86BigfontExtensionInit(void) 6 | 7 | FontShmdescIndex = xfont2_allocate_font_private_index(); 8 | 9 | -#if !defined(CSRG_BASED) && !defined(__CYGWIN__) 10 | +#if false 11 | pagesize = SHMLBA; 12 | #else 13 | #ifdef _SC_PAGESIZE 14 | diff --git a/dix/stubmain.c b/dix/stubmain.c 15 | index 7efb4b8..2e2bf65 100644 16 | --- a/dix/stubmain.c 17 | +++ b/dix/stubmain.c 18 | @@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE. 19 | 20 | ******************************************************************/ 21 | 22 | +extern const char *xf86LogFile; 23 | int dix_main(int argc, char *argv[], char *envp[]); 24 | 25 | /* 26 | @@ -31,5 +32,9 @@ int dix_main(int argc, char *argv[], char *envp[]); 27 | int 28 | main(int argc, char *argv[], char *envp[]) 29 | { 30 | +#ifdef ANDROID 31 | + xf86LogFile = "/dev/null"; 32 | +#endif 33 | + 34 | return dix_main(argc, argv, envp); 35 | } 36 | diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h 37 | index 2b2008b..eb788d3 100644 38 | --- a/hw/xfree86/common/compiler.h 39 | +++ b/hw/xfree86/common/compiler.h 40 | @@ -518,14 +518,10 @@ xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, 41 | barrier(); 42 | } 43 | 44 | -#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__)) 45 | -#if defined(__arm32__) || defined(__mips64) 46 | +#elif defined(__arm32__) && !defined(__linux__) 47 | #define PORT_SIZE long 48 | -#else 49 | -#define PORT_SIZE short 50 | -#endif 51 | 52 | -_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */ 53 | +extern _X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */ 54 | 55 | static __inline__ void 56 | outb(unsigned PORT_SIZE port, unsigned char val) 57 | diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c 58 | index 0f4f05d..b3c74a3 100644 59 | --- a/hw/xfree86/common/xf86AutoConfig.c 60 | +++ b/hw/xfree86/common/xf86AutoConfig.c 61 | @@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDrivers *md) 62 | xf86PciMatchDriver(md); 63 | #endif 64 | 65 | -#if defined(__linux__) 66 | +#if defined(__linux__) && !defined(__ANDROID__) 67 | xf86AddMatchedDriver(md, "modesetting"); 68 | #endif 69 | 70 | diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c 71 | index 503c47e..bda3d64 100644 72 | --- a/hw/xfree86/loader/loader.c 73 | +++ b/hw/xfree86/loader/loader.c 74 | @@ -64,16 +64,10 @@ 75 | #error i have no dynamic linker and i must scream 76 | #endif 77 | 78 | -#ifndef XORG_NO_SDKSYMS 79 | -extern void *xorg_symbols[]; 80 | -#endif 81 | 82 | void 83 | LoaderInit(void) 84 | { 85 | -#ifndef XORG_NO_SDKSYMS 86 | - LogMessageVerb(X_INFO, 2, "Loader magic: %p\n", (void *) xorg_symbols); 87 | -#endif 88 | LogMessageVerb(X_INFO, 2, "Module ABI versions:\n"); 89 | LogWrite(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, 90 | GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), 91 | diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c 92 | index dd1020e..180d705 100644 93 | --- a/hw/xfree86/os-support/bsd/arm_video.c 94 | +++ b/hw/xfree86/os-support/bsd/arm_video.c 95 | @@ -65,6 +65,7 @@ 96 | #include "xf86Priv.h" 97 | #include "xf86_OSlib.h" 98 | #include "xf86OSpriv.h" 99 | +#include "compiler.h" 100 | 101 | #if defined(__NetBSD__) && !defined(MAP_FILE) 102 | #define MAP_FLAGS MAP_SHARED 103 | @@ -162,6 +163,8 @@ xf86DisableIO() 104 | 105 | #if defined(USE_ARC_MMAP) || defined(__arm32__) 106 | 107 | +unsigned int IOPortBase; 108 | + 109 | Bool 110 | xf86EnableIO() 111 | { 112 | diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c 113 | index dbd5afe..cf3d1a3 100644 114 | --- a/hw/xfree86/os-support/linux/lnx_acpi.c 115 | +++ b/hw/xfree86/os-support/linux/lnx_acpi.c 116 | @@ -15,7 +15,7 @@ 117 | #include 118 | #include 119 | 120 | -#define ACPI_SOCKET "/var/run/acpid.socket" 121 | +#define ACPI_SOCKET "/data/data/com.termux/files/usr/var/run/acpid.socket" 122 | 123 | #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 124 | #define ACPI_VIDEO_NOTIFY_PROBE 0x81 125 | diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c 126 | index 011d8da..ca7acf4 100644 127 | --- a/hw/xfree86/os-support/linux/lnx_init.c 128 | +++ b/hw/xfree86/os-support/linux/lnx_init.c 129 | @@ -250,27 +250,7 @@ xf86OpenConsole(void) 130 | ("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n", 131 | strerror(errno)); 132 | 133 | - SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS)); 134 | - if (ret < 0) 135 | - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n", 136 | - strerror(errno)); 137 | - 138 | tcgetattr(xf86Info.consoleFd, &tty_attr); 139 | - SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode)); 140 | - 141 | - /* disable kernel special keys and buffering */ 142 | - SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF)); 143 | - if (ret < 0) 144 | - { 145 | - /* fine, just disable special keys */ 146 | - SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW)); 147 | - if (ret < 0) 148 | - FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n", 149 | - strerror(errno)); 150 | - 151 | - /* ... and drain events, else the kernel gets angry */ 152 | - xf86SetConsoleHandler(drain_console, NULL); 153 | - } 154 | 155 | nTty = tty_attr; 156 | nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); 157 | @@ -313,12 +293,7 @@ xf86CloseConsole(void) 158 | xf86SetConsoleHandler(NULL, NULL); 159 | 160 | /* Back to text mode ... */ 161 | - SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT)); 162 | - if (ret < 0) 163 | - xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n", 164 | - strerror(errno)); 165 | 166 | - SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode)); 167 | tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr); 168 | 169 | SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT)); 170 | diff --git a/hw/xfree86/os-support/linux/lnx_kmod.c b/hw/xfree86/os-support/linux/lnx_kmod.c 171 | index 6d12226..46cc7af 100644 172 | --- a/hw/xfree86/os-support/linux/lnx_kmod.c 173 | +++ b/hw/xfree86/os-support/linux/lnx_kmod.c 174 | @@ -68,14 +68,6 @@ xf86LoadKernelModule(const char *modName) 175 | */ 176 | switch (pid = fork()) { 177 | case 0: /* child */ 178 | - /* change real/effective user ID to 0/0 as we need to 179 | - * preinstall agpgart module for some DRM modules 180 | - */ 181 | - if (setreuid(0, 0)) { 182 | - xf86Msg(X_WARNING, "LoadKernelModule: " 183 | - "Setting of real/effective user Id to 0/0 failed"); 184 | - } 185 | - setenv("PATH", "/sbin", 1); 186 | execl(mpPath, "modprobe", modName, NULL); 187 | xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno)); 188 | exit(EXIT_FAILURE); /* if we get here the child's exec failed */ 189 | diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h 190 | index 159c806..d7a6243 100644 191 | --- a/hw/xfree86/os-support/xf86_OSlib.h 192 | +++ b/hw/xfree86/os-support/xf86_OSlib.h 193 | @@ -132,7 +132,6 @@ 194 | #if !defined(__sun) 195 | #include 196 | #endif 197 | -#include 198 | #include 199 | 200 | extern _X_HIDDEN void xf86VTAcquire(int); 201 | @@ -195,7 +194,6 @@ extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX]; 202 | #include 203 | #ifdef __linux__ 204 | #define HAS_USL_VTS 205 | -#include 206 | #include 207 | #define LDGMAP GIO_SCRNMAP 208 | #define LDSMAP PIO_SCRNMAP 209 | diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c 210 | index 1eb35ed..e7a4f43 100644 211 | --- a/hw/xfree86/parser/scan.c 212 | +++ b/hw/xfree86/parser/scan.c 213 | @@ -873,13 +873,13 @@ xf86initConfigFiles(void) 214 | */ 215 | 216 | #ifndef DEFAULT_CONF_PATH 217 | -#define DEFAULT_CONF_PATH "/etc/X11/%S," \ 218 | +#define DEFAULT_CONF_PATH "/data/data/com.termux/files/usr/etc/X11/%S," \ 219 | "%P/etc/X11/%S," \ 220 | - "/etc/X11/%G," \ 221 | + "/data/data/com.termux/files/usr/etc/X11/%G," \ 222 | "%P/etc/X11/%G," \ 223 | - "/etc/X11/%X-%M," \ 224 | - "/etc/X11/%X," \ 225 | - "/etc/%X," \ 226 | + "/data/data/com.termux/files/usr/etc/X11/%X-%M," \ 227 | + "/data/data/com.termux/files/usr/etc/X11/%X," \ 228 | + "/data/data/com.termux/files/usr/etc/%X," \ 229 | "%P/etc/X11/%X.%H," \ 230 | "%P/etc/X11/%X-%M," \ 231 | "%P/etc/X11/%X," \ 232 | diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c 233 | index c5e4a27..a016191 100644 234 | --- a/hw/xfree86/xorg-wrapper.c 235 | +++ b/hw/xfree86/xorg-wrapper.c 236 | @@ -251,23 +251,6 @@ int main(int argc, char *argv[]) 237 | } 238 | #endif 239 | 240 | - /* If we've found cards, and all cards support kms, drop root rights */ 241 | - if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) { 242 | - gid_t realgid = getgid(); 243 | - uid_t realuid = getuid(); 244 | - 245 | - if (setresgid(-1, realgid, realgid) != 0) { 246 | - fprintf(stderr, "%s: Could not drop setgid privileges: %s\n", 247 | - progname, strerror(errno)); 248 | - exit(1); 249 | - } 250 | - if (setresuid(-1, realuid, realuid) != 0) { 251 | - fprintf(stderr, "%s: Could not drop setuid privileges: %s\n", 252 | - progname, strerror(errno)); 253 | - exit(1); 254 | - } 255 | - } 256 | - 257 | snprintf(buf, sizeof(buf), "%s/Xorg", SUID_WRAPPER_DIR); 258 | 259 | /* Check if the server is executable by our real uid */ 260 | diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c 261 | index 42530cb..b41db5b 100644 262 | --- a/hw/xquartz/mach-startup/bundle-main.c 263 | +++ b/hw/xquartz/mach-startup/bundle-main.c 264 | @@ -74,7 +74,7 @@ extern int noPanoramiXExtension; 265 | 266 | #define DEFAULT_CLIENT X11BINDIR "/xterm" 267 | #define DEFAULT_STARTX X11BINDIR "/startx -- " X11BINDIR "/Xquartz" 268 | -#define DEFAULT_SHELL "/bin/sh" 269 | +#define DEFAULT_SHELL "/data/data/com.termux/files/usr/bin/sh" 270 | 271 | #ifndef BUILD_DATE 272 | #define BUILD_DATE "" 273 | @@ -489,7 +489,7 @@ ensure_path(const char *dir) 274 | temp = getenv("PATH"); 275 | if (temp == NULL || temp[0] == 0) { 276 | snprintf(buf, sizeof(buf), 277 | - "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", 278 | + "/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:%s", 279 | dir); 280 | setenv("PATH", buf, TRUE); 281 | } 282 | diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c 283 | index 66720bc..ec00294 100644 284 | --- a/hw/xwayland/xwayland-cursor.c 285 | +++ b/hw/xwayland/xwayland-cursor.c 286 | @@ -66,7 +66,8 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) 287 | PixmapPtr pixmap; 288 | 289 | pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width, 290 | - cursor->bits->height, 32, 0); 291 | + cursor->bits->height, 32, 292 | + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); 293 | dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap); 294 | 295 | return TRUE; 296 | diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c 297 | index b519492..ddaafd9 100644 298 | --- a/hw/xwayland/xwayland-glamor-gbm.c 299 | +++ b/hw/xwayland/xwayland-glamor-gbm.c 300 | @@ -202,9 +202,9 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, 301 | PixmapPtr pixmap = NULL; 302 | 303 | if (width > 0 && height > 0 && depth >= 15 && 304 | - (hint == 0 || 305 | - hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || 306 | - hint == CREATE_PIXMAP_USAGE_SHARED)) { 307 | + (hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || 308 | + hint == CREATE_PIXMAP_USAGE_SHARED || 309 | + (xwl_screen->rootless && hint == 0))) { 310 | uint32_t format = gbm_format_for_depth(depth); 311 | 312 | #ifdef GBM_BO_WITH_MODIFIERS 313 | diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c 314 | index ae646c6..efef56b 100644 315 | --- a/hw/xwayland/xwayland-output.c 316 | +++ b/hw/xwayland/xwayland-output.c 317 | @@ -187,6 +187,9 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height) 318 | if (!xwl_screen->rootless && xwl_screen->screen->root) 319 | update_backing_pixmaps (xwl_screen, width, height); 320 | 321 | + if (!xwl_screen->rootless && xwl_screen->screen->root) 322 | + update_backing_pixmaps (xwl_screen, width, height); 323 | + 324 | xwl_screen->width = width; 325 | xwl_screen->height = height; 326 | xwl_screen->screen->width = width; 327 | diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c 328 | index 29732ea..e6bf7b5 100644 329 | --- a/hw/xwayland/xwayland-shm.c 330 | +++ b/hw/xwayland/xwayland-shm.c 331 | @@ -40,12 +40,17 @@ 332 | #include 333 | #include 334 | 335 | +#ifdef __ANDROID__ 336 | +#include "ashmem.h" 337 | +#endif 338 | + 339 | struct xwl_pixmap { 340 | struct wl_buffer *buffer; 341 | void *data; 342 | size_t size; 343 | }; 344 | 345 | +#ifndef __ANDROID__ 346 | #ifndef HAVE_MKOSTEMP 347 | static int 348 | set_cloexec_or_close(int fd) 349 | @@ -172,6 +177,37 @@ os_create_anonymous_file(off_t size) 350 | return fd; 351 | } 352 | 353 | +#else // __ANDROID__ 354 | + 355 | +static int 356 | +os_create_anonymous_file(off_t size) { 357 | + int fd, ret; 358 | + long flags; 359 | + 360 | + fd = open("/dev/ashmem", O_RDWR); 361 | + if (fd < 0) 362 | + return fd; 363 | + 364 | + ret = ioctl(fd, ASHMEM_SET_SIZE, size); 365 | + if (ret < 0) 366 | + goto err; 367 | + 368 | + flags = fcntl(fd, F_GETFD); 369 | + if (flags == -1) 370 | + goto err; 371 | + 372 | + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) 373 | + goto err; 374 | + 375 | + return fd; 376 | + 377 | +err: 378 | + close(fd); 379 | + return ret; 380 | +} 381 | + 382 | +#endif // __ANDROID__ 383 | + 384 | static uint32_t 385 | shm_format_for_depth(int depth) 386 | { 387 | @@ -202,6 +238,7 @@ xwl_shm_create_pixmap(ScreenPtr screen, 388 | int fd; 389 | 390 | if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE || 391 | + (!xwl_screen->rootless && hint != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) || 392 | (width == 0 && height == 0) || depth < 15) 393 | return fbCreatePixmap(screen, width, height, depth, hint); 394 | 395 | diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c 396 | index 1c6fa9f..b3da3cf 100644 397 | --- a/hw/xwin/InitOutput.c 398 | +++ b/hw/xwin/InitOutput.c 399 | @@ -294,7 +294,7 @@ winCheckMount(void) 400 | level = none, curlevel; 401 | BOOL binary = TRUE; 402 | 403 | - mnt = setmntent("/etc/mtab", "r"); 404 | + mnt = setmntent("/data/data/com.termux/files/usr/etc/mtab", "r"); 405 | if (mnt == NULL) { 406 | ErrorF("setmntent failed"); 407 | return; 408 | @@ -303,7 +303,7 @@ winCheckMount(void) 409 | while ((ent = getmntent(mnt)) != NULL) { 410 | BOOL sys = (winCheckMntOpt(ent, "user") != NULL); 411 | BOOL root = (strcmp(ent->mnt_dir, "/") == 0); 412 | - BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); 413 | + BOOL tmp = (strcmp(ent->mnt_dir, "/data/data/com.termux/files/usr/tmp") == 0); 414 | 415 | if (sys) { 416 | if (root) 417 | diff --git a/include/site.h b/include/site.h 418 | index 9bd8e2f..dea17ac 100644 419 | --- a/include/site.h 420 | +++ b/include/site.h 421 | @@ -72,7 +72,7 @@ SOFTWARE. 422 | * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! 423 | */ 424 | #ifndef COMPILEDDEFAULTFONTPATH 425 | -#define COMPILEDDEFAULTFONTPATH "/usr/share/fonts/X11/misc/" 426 | +#define COMPILEDDEFAULTFONTPATH "/data/data/com.termux/files/usr/share/fonts/X11/misc/" 427 | #endif 428 | 429 | /* 430 | diff --git a/miext/sync/meson.build b/miext/sync/meson.build 431 | index 8b7ee4d..746c709 100644 432 | --- a/miext/sync/meson.build 433 | +++ b/miext/sync/meson.build 434 | @@ -1,6 +1,7 @@ 435 | srcs_miext_sync = [ 436 | 'misync.c', 437 | 'misyncfd.c', 438 | + 'misyncshm.c', 439 | ] 440 | 441 | hdrs_miext_sync = [ 442 | @@ -10,10 +11,6 @@ hdrs_miext_sync = [ 443 | 'misyncstr.h', 444 | ] 445 | 446 | -if build_dri3 447 | - srcs_miext_sync += 'misyncshm.c' 448 | -endif 449 | - 450 | libxserver_miext_sync = static_library('libxserver_miext_sync', 451 | srcs_miext_sync, 452 | include_directories: inc, 453 | diff --git a/os/access.c b/os/access.c 454 | index 9724616..33316a3 100644 455 | --- a/os/access.c 456 | +++ b/os/access.c 457 | @@ -961,7 +961,7 @@ ResetHosts(const char *display) 458 | #if defined WIN32 && defined __MINGW32__ 459 | #define ETC_HOST_PREFIX "X" 460 | #else 461 | -#define ETC_HOST_PREFIX "/etc/X" 462 | +#define ETC_HOST_PREFIX "/data/data/com.termux/files/usr/etc/X" 463 | #endif 464 | #define ETC_HOST_SUFFIX ".hosts" 465 | fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + 466 | diff --git a/os/backtrace.c b/os/backtrace.c 467 | index 2aad0e3..ff11b83 100644 468 | --- a/os/backtrace.c 469 | +++ b/os/backtrace.c 470 | @@ -247,14 +247,13 @@ xorg_backtrace_pstack(void) 471 | /* CHILD */ 472 | char parent[16]; 473 | 474 | - seteuid(0); 475 | close(STDIN_FILENO); 476 | close(STDOUT_FILENO); 477 | dup2(pipefd[1], STDOUT_FILENO); 478 | closefrom(STDERR_FILENO); 479 | 480 | snprintf(parent, sizeof(parent), "%d", getppid()); 481 | - execle("/usr/bin/pstack", "pstack", parent, NULL); 482 | + execle("/data/data/com.termux/files/usr/bin/pstack", "pstack", parent, NULL); 483 | exit(1); 484 | } 485 | else { 486 | diff --git a/os/connection.c b/os/connection.c 487 | index 32d2cda..e0ef16a 100644 488 | --- a/os/connection.c 489 | +++ b/os/connection.c 490 | @@ -1004,7 +1004,7 @@ ListenOnOpenFD(int fd, int noxauth) 491 | XtransConnInfo ciptr; 492 | const char *display_env = getenv("DISPLAY"); 493 | 494 | - if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) { 495 | + if (display_env && (strncmp(display_env, "/data/data/com.termux/files/usr/tmp/launch", 11) == 0)) { 496 | /* Make the path the launchd socket if our DISPLAY is set right */ 497 | strcpy(port, display_env); 498 | } 499 | diff --git a/os/osinit.c b/os/osinit.c 500 | index 8575319..bb14c6b 100644 501 | --- a/os/osinit.c 502 | +++ b/os/osinit.c 503 | @@ -72,7 +72,7 @@ SOFTWARE. 504 | #endif 505 | 506 | #ifndef ADMPATH 507 | -#define ADMPATH "/usr/adm/X%smsgs" 508 | +#define ADMPATH "/data/data/com.termux/files/usr/adm/X%smsgs" 509 | #endif 510 | 511 | #ifdef RLIMIT_DATA 512 | diff --git a/os/utils.c b/os/utils.c 513 | index 2ba1c80..06a9957 100644 514 | --- a/os/utils.c 515 | +++ b/os/utils.c 516 | @@ -228,7 +228,7 @@ OsSignal(int sig, OsSigHandlerPtr handler) 517 | * server at a time. This keeps the servers from stomping on each other 518 | * if the user forgets to give them different display numbers. 519 | */ 520 | -#define LOCK_DIR "/tmp" 521 | +#define LOCK_DIR "/data/data/com.termux/files/usr/tmp" 522 | #define LOCK_TMP_PREFIX "/.tX" 523 | #define LOCK_PREFIX "/.X" 524 | #define LOCK_SUFFIX "-lock" 525 | @@ -320,7 +320,7 @@ LockServer(void) 526 | i = 0; 527 | haslock = 0; 528 | while ((!haslock) && (i++ < 3)) { 529 | - haslock = (link(tmp, LockFile) == 0); 530 | + haslock = (rename(tmp, LockFile) == 0); 531 | if (haslock) { 532 | /* 533 | * We're done. 534 | @@ -1384,11 +1384,7 @@ System(const char *command) 535 | p = -1; 536 | break; 537 | case 0: /* child */ 538 | - if (setgid(getgid()) == -1) 539 | - _exit(127); 540 | - if (setuid(getuid()) == -1) 541 | - _exit(127); 542 | - execl("/bin/sh", "sh", "-c", command, (char *) NULL); 543 | + execl("/data/data/com.termux/files/usr/bin/sh", "sh", "-c", command, (char *) NULL); 544 | _exit(127); 545 | default: /* parent */ 546 | do { 547 | @@ -1454,10 +1450,6 @@ Popen(const char *command, const char *type) 548 | #endif 549 | return NULL; 550 | case 0: /* child */ 551 | - if (setgid(getgid()) == -1) 552 | - _exit(127); 553 | - if (setuid(getuid()) == -1) 554 | - _exit(127); 555 | if (*type == 'r') { 556 | if (pdes[1] != 1) { 557 | /* stdout */ 558 | @@ -1474,7 +1466,7 @@ Popen(const char *command, const char *type) 559 | } 560 | close(pdes[1]); 561 | } 562 | - execl("/bin/sh", "sh", "-c", command, (char *) NULL); 563 | + execl("/data/data/com.termux/files/usr/bin/sh", "sh", "-c", command, (char *) NULL); 564 | _exit(127); 565 | } 566 | 567 | @@ -1532,10 +1524,6 @@ Fopen(const char *file, const char *type) 568 | free(cur); 569 | return NULL; 570 | case 0: /* child */ 571 | - if (setgid(getgid()) == -1) 572 | - _exit(127); 573 | - if (setuid(getuid()) == -1) 574 | - _exit(127); 575 | if (*type == 'r') { 576 | if (pdes[1] != 1) { 577 | /* stdout */ 578 | @@ -1578,20 +1566,7 @@ Fopen(const char *file, const char *type) 579 | 580 | return iop; 581 | #else 582 | - int ruid, euid; 583 | - 584 | - ruid = getuid(); 585 | - euid = geteuid(); 586 | - 587 | - if (seteuid(ruid) == -1) { 588 | - return NULL; 589 | - } 590 | iop = fopen(file, type); 591 | - 592 | - if (seteuid(euid) == -1) { 593 | - fclose(iop); 594 | - return NULL; 595 | - } 596 | return iop; 597 | #endif /* HAS_SAVED_IDS_AND_SETEUID */ 598 | } 599 | @@ -1671,7 +1646,7 @@ Win32TempDir(void) 600 | else if (getenv("TMP") != NULL) 601 | return getenv("TMP"); 602 | else 603 | - return "/tmp"; 604 | + return "/data/data/com.termux/files/usr/tmp"; 605 | } 606 | 607 | int 608 | @@ -1723,64 +1698,7 @@ System(const char *cmdline) 609 | Bool 610 | PrivsElevated(void) 611 | { 612 | - static Bool privsTested = FALSE; 613 | - static Bool privsElevated = TRUE; 614 | - 615 | - if (!privsTested) { 616 | -#if defined(WIN32) 617 | - privsElevated = FALSE; 618 | -#else 619 | - if ((getuid() != geteuid()) || (getgid() != getegid())) { 620 | - privsElevated = TRUE; 621 | - } 622 | - else { 623 | -#if defined(HAVE_ISSETUGID) 624 | - privsElevated = issetugid(); 625 | -#elif defined(HAVE_GETRESUID) 626 | - uid_t ruid, euid, suid; 627 | - gid_t rgid, egid, sgid; 628 | - 629 | - if ((getresuid(&ruid, &euid, &suid) == 0) && 630 | - (getresgid(&rgid, &egid, &sgid) == 0)) { 631 | - privsElevated = (euid != suid) || (egid != sgid); 632 | - } 633 | - else { 634 | - printf("Failed getresuid or getresgid"); 635 | - /* Something went wrong, make defensive assumption */ 636 | - privsElevated = TRUE; 637 | - } 638 | -#else 639 | - if (getuid() == 0) { 640 | - /* running as root: uid==euid==0 */ 641 | - privsElevated = FALSE; 642 | - } 643 | - else { 644 | - /* 645 | - * If there are saved ID's the process might still be privileged 646 | - * even though the above test succeeded. If issetugid() and 647 | - * getresgid() aren't available, test this by trying to set 648 | - * euid to 0. 649 | - */ 650 | - unsigned int oldeuid; 651 | - 652 | - oldeuid = geteuid(); 653 | - 654 | - if (seteuid(0) != 0) { 655 | - privsElevated = FALSE; 656 | - } 657 | - else { 658 | - if (seteuid(oldeuid) != 0) { 659 | - FatalError("Failed to drop privileges. Exiting\n"); 660 | - } 661 | - privsElevated = TRUE; 662 | - } 663 | - } 664 | -#endif 665 | - } 666 | -#endif 667 | - privsTested = TRUE; 668 | - } 669 | - return privsElevated; 670 | + return FALSE; 671 | } 672 | 673 | /* 674 | diff --git a/test/xtest.c b/test/xtest.c 675 | index fc5e433..d7e6620 100644 676 | --- a/test/xtest.c 677 | +++ b/test/xtest.c 678 | @@ -61,7 +61,7 @@ xtest_init_devices(void) 679 | { 680 | ScreenRec screen = {0}; 681 | ClientRec server_client = {0}; 682 | - WindowRec root = {0}; 683 | + WindowRec root = {{0}}; 684 | WindowOptRec optional = {0}; 685 | 686 | /* random stuff that needs initialization */ 687 | diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c 688 | index a8b8368..9ac78cc 100644 689 | --- a/xkb/ddxLoad.c 690 | +++ b/xkb/ddxLoad.c 691 | @@ -76,8 +76,8 @@ OutputDirectory(char *outdir, size_t size) 692 | } 693 | else 694 | #endif 695 | - if (strlen("/tmp/") < size) { 696 | - (void) strcpy(outdir, "/tmp/"); 697 | + if (strlen("/data/data/com.termux/files/usr/tmp/") < size) { 698 | + (void) strcpy(outdir, "/data/data/com.termux/files/usr/tmp/"); 699 | } 700 | } 701 | 702 | --- /dev/null 2021-12-20 22:38:19.660000000 +0530 703 | +++ ./hw/xwayland/ashmem.h 2021-12-22 19:55:12.324060367 +0530 704 | @@ -0,0 +1,47 @@ 705 | +/**************************************************************************** 706 | + **************************************************************************** 707 | + *** 708 | + *** This header was automatically generated from a Linux kernel header 709 | + *** of the same name, to make information necessary for userspace to 710 | + *** call into the kernel available to libc. It contains only constants, 711 | + *** structures, and macros generated from the original header, and thus, 712 | + *** contains no copyrightable information. 713 | + *** 714 | + **************************************************************************** 715 | + ****************************************************************************/ 716 | +#ifndef _LINUX_ASHMEM_H 717 | +#define _LINUX_ASHMEM_H 718 | + 719 | +#include 720 | +#include 721 | +#include 722 | + 723 | +#define ASHMEM_NAME_LEN 256 724 | + 725 | +#define ASHMEM_NAME_DEF "dev/ashmem" 726 | + 727 | +#define ASHMEM_NOT_PURGED 0 728 | +#define ASHMEM_WAS_PURGED 1 729 | + 730 | +#define ASHMEM_IS_UNPINNED 0 731 | +#define ASHMEM_IS_PINNED 1 732 | + 733 | +struct ashmem_pin { 734 | + uint32_t offset; 735 | + uint32_t len; 736 | +}; 737 | + 738 | +#define __ASHMEMIOC 0x77 739 | + 740 | +#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) 741 | +#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) 742 | +#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) 743 | +#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) 744 | +#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) 745 | +#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) 746 | +#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) 747 | +#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) 748 | +#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) 749 | +#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) 750 | + 751 | +#endif 752 | --------------------------------------------------------------------------------