consolidate MITSHM and HAS_SHM symbols

Both symbols are set on exactly the same condition (build_mitshm),
so can be consolidated into one: MITSHM

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1296>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-14 16:51:17 +01:00 committed by Marge Bot
parent 77f9792911
commit ebabca56a4
4 changed files with 22 additions and 26 deletions

View File

@ -39,7 +39,7 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifdef HAS_SHM #ifdef MITSHM
#ifdef SVR4 #ifdef SVR4
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
@ -73,7 +73,7 @@
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */ static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
); );
#ifdef HAS_SHM #ifdef MITSHM
/* A random signature, transmitted to the clients so they can verify that the /* A random signature, transmitted to the clients so they can verify that the
shared memory segment they are attaching to was really established by the shared memory segment they are attaching to was really established by the
@ -126,7 +126,7 @@ CheckForShmSyscall(void)
/* ========== Management of shared memory segments ========== */ /* ========== Management of shared memory segments ========== */
#ifdef HAS_SHM #ifdef MITSHM
#ifdef __linux__ #ifdef __linux__
/* On Linux, shared memory marked as "removed" can still be attached. /* On Linux, shared memory marked as "removed" can still be attached.
@ -221,7 +221,7 @@ shmdealloc(ShmDescPtr pDesc)
void void
XF86BigfontFreeFontShm(FontPtr pFont) XF86BigfontFreeFontShm(FontPtr pFont)
{ {
#ifdef HAS_SHM #ifdef MITSHM
ShmDescPtr pDesc; ShmDescPtr pDesc;
/* If during shutdown of the server, XF86BigfontCleanup() has already /* If during shutdown of the server, XF86BigfontCleanup() has already
@ -240,7 +240,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
void void
XF86BigfontCleanup(void) XF86BigfontCleanup(void)
{ {
#ifdef HAS_SHM #ifdef MITSHM
while (ShmList) while (ShmList)
shmdealloc(ShmList); shmdealloc(ShmList);
#endif #endif
@ -277,7 +277,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION, .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(), .uid = geteuid(),
.gid = getegid(), .gid = getegid(),
#ifdef HAS_SHM #ifdef MITSHM
.signature = signature, .signature = signature,
.capabilities = (client->local && !client->swapped) .capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0 ? XF86Bigfont_CAP_LocalShm : 0
@ -329,7 +329,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
int nCharInfos; int nCharInfos;
int shmid; int shmid;
#ifdef HAS_SHM #ifdef MITSHM
ShmDescPtr pDesc = NULL; ShmDescPtr pDesc = NULL;
#else #else
#define pDesc 0 #define pDesc 0
@ -374,7 +374,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
nUniqCharInfos = 0; nUniqCharInfos = 0;
if (nCharInfos > 0) { if (nCharInfos > 0) {
#ifdef HAS_SHM #ifdef MITSHM
if (!badSysCall) if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex); pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc) { if (pDesc) {
@ -395,7 +395,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
pCI = xallocarray(nCharInfos, sizeof(xCharInfo)); pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
if (!pCI) if (!pCI)
return BadAlloc; return BadAlloc;
#ifdef HAS_SHM #ifdef MITSHM
} }
#endif #endif
/* Fill nCharInfos starting at pCI. */ /* Fill nCharInfos starting at pCI. */
@ -427,7 +427,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
} }
} }
} }
#ifdef HAS_SHM #ifdef MITSHM
if (pDesc && !badSysCall) { if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature; *(CARD32 *) (pCI + nCharInfos) = signature;
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) { if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
@ -694,7 +694,7 @@ XFree86BigfontExtensionInit(void)
ProcXF86BigfontDispatch, ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch, SProcXF86BigfontDispatch,
XF86BigfontResetProc, StandardMinorOpcode)) { XF86BigfontResetProc, StandardMinorOpcode)) {
#ifdef HAS_SHM #ifdef MITSHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL #ifdef MUST_CHECK_FOR_SHM_SYSCALL
/* /*
* Note: Local-clients will not be optimized without shared memory * Note: Local-clients will not be optimized without shared memory

View File

@ -59,10 +59,10 @@ from The Open Group.
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#include <X11/XWDFile.h> #include <X11/XWDFile.h>
#ifdef HAS_SHM #ifdef MITSHM
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#endif /* HAS_SHM */ #endif /* MITSHM */
#include "dix.h" #include "dix.h"
#include "miline.h" #include "miline.h"
#include "glx_extinit.h" #include "glx_extinit.h"
@ -98,7 +98,7 @@ typedef struct {
char mmap_file[MAXPATHLEN]; char mmap_file[MAXPATHLEN];
#endif #endif
#ifdef HAS_SHM #ifdef MITSHM
int shmid; int shmid;
#endif #endif
} vfbScreenInfo, *vfbScreenInfoPtr; } vfbScreenInfo, *vfbScreenInfoPtr;
@ -173,17 +173,17 @@ freeScreenInfo(vfbScreenInfoPtr pvfb)
break; break;
#endif /* HAVE_MMAP */ #endif /* HAVE_MMAP */
#ifdef HAS_SHM #ifdef MITSHM
case SHARED_MEMORY_FB: case SHARED_MEMORY_FB:
if (-1 == shmdt((char *) pvfb->pXWDHeader)) { if (-1 == shmdt((char *) pvfb->pXWDHeader)) {
perror("shmdt"); perror("shmdt");
ErrorF("shmdt failed, %s", strerror(errno)); ErrorF("shmdt failed, %s", strerror(errno));
} }
break; break;
#else /* HAS_SHM */ #else /* MITSHM */
case SHARED_MEMORY_FB: case SHARED_MEMORY_FB:
break; break;
#endif /* HAS_SHM */ #endif /* MITSHM */
case NORMAL_MEMORY_FB: case NORMAL_MEMORY_FB:
free(pvfb->pXWDHeader); free(pvfb->pXWDHeader);
@ -252,7 +252,7 @@ ddxUseMsg(void)
("-fbdir directory put framebuffers in mmap'ed files in directory\n"); ("-fbdir directory put framebuffers in mmap'ed files in directory\n");
#endif #endif
#ifdef HAS_SHM #ifdef MITSHM
ErrorF("-shmem put framebuffers in shared memory\n"); ErrorF("-shmem put framebuffers in shared memory\n");
#endif #endif
} }
@ -368,7 +368,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
} }
#endif /* HAVE_MMAP */ #endif /* HAVE_MMAP */
#ifdef HAS_SHM #ifdef MITSHM
if (strcmp(argv[i], "-shmem") == 0) { /* -shmem */ if (strcmp(argv[i], "-shmem") == 0) { /* -shmem */
fbmemtype = SHARED_MEMORY_FB; fbmemtype = SHARED_MEMORY_FB;
return 1; return 1;
@ -537,7 +537,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
} }
#endif /* HAVE_MMAP */ #endif /* HAVE_MMAP */
#ifdef HAS_SHM #ifdef MITSHM
static void static void
vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb) vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
{ {
@ -563,7 +563,7 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid); ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid);
} }
#endif /* HAS_SHM */ #endif /* MITSHM */
static char * static char *
vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb) vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
@ -606,7 +606,7 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
break; break;
#endif #endif
#ifdef HAS_SHM #ifdef MITSHM
case SHARED_MEMORY_FB: case SHARED_MEMORY_FB:
vfbAllocateSharedMemoryFramebuffer(pvfb); vfbAllocateSharedMemoryFramebuffer(pvfb);
break; break;

View File

@ -212,7 +212,6 @@ conf_data.set('DRI3', build_dri3 ? '1' : false)
if build_glx if build_glx
conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_variable(pkgconfig : 'dridriverdir')) conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_variable(pkgconfig : 'dridriverdir'))
endif endif
conf_data.set('HAS_SHM', build_mitshm ? '1' : false)
conf_data.set('MITSHM', build_mitshm ? '1' : false) conf_data.set('MITSHM', build_mitshm ? '1' : false)
conf_data.set('PANORAMIX', build_xinerama ? '1' : false) conf_data.set('PANORAMIX', build_xinerama ? '1' : false)
conf_data.set('PRESENT', '1') conf_data.set('PRESENT', '1')

View File

@ -41,9 +41,6 @@
/* Support XDM-AUTH*-1 */ /* Support XDM-AUTH*-1 */
#mesondefine HASXDMAUTH #mesondefine HASXDMAUTH
/* Support SHM */
#mesondefine HAS_SHM
/* Define to 1 if you have the `reallocarray' function. */ /* Define to 1 if you have the `reallocarray' function. */
#mesondefine HAVE_REALLOCARRAY #mesondefine HAVE_REALLOCARRAY