Ensure all resource types created have names registered

Calls RegisterResourceName to record the type name for
use by X-Resource, XACE/SELinux/XTsol, and DTrace.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Alan Coopersmith 2009-12-11 00:58:25 -08:00
parent eb750f8b5e
commit a11c58fa0c
30 changed files with 122 additions and 4 deletions

View File

@ -42,6 +42,8 @@ in this Software without prior written authorization from The Open Group.
#include "opaque.h"
#include "sleepuntil.h"
#include "inputstr.h"
#include "registry.h"
#include <X11/extensions/multibufconst.h>
#include <X11/extensions/multibufproto.h>
@ -481,6 +483,11 @@ MultibufferExtensionInit()
ProcMultibufferDispatch, SProcMultibufferDispatch,
MultibufferResetProc, StandardMinorOpcode)))
{
RegisterResourceName(MultibufferDrawableResType,
"MultibufferDrawable");
RegisterResourceName(MultibufferResType, "MultibufferBuffer");
RegisterResourceName(MultibuffersResType, "MultibufferWindow");
RegisterResourceName(OtherClientResType, "MultibufferOtherClient");
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;

View File

@ -52,6 +52,7 @@ Equipment Corporation.
#include "globals.h"
#include "servermd.h"
#include "resource.h"
#include "registry.h"
#ifdef RENDER
#include "picturestr.h"
#endif
@ -513,6 +514,11 @@ void PanoramiXExtensionInit(int argc, char *argv[])
XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource);
if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) {
RegisterResourceName(XRT_WINDOW, "XineramaWindow");
RegisterResourceName(XRT_PIXMAP, "XineramaPixmap");
RegisterResourceName(XRT_GC, "XineramaGC");
RegisterResourceName(XRT_COLORMAP, "XineramaColormap");
panoramiXGeneration = serverGeneration;
success = TRUE;
}

View File

@ -47,6 +47,7 @@ in this Software without prior written authorization from the X Consortium.
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "registry.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@ -266,6 +267,9 @@ ScreenSaverExtensionInit(INITARGS)
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
NULL, StandardMinorOpcode)))
{
RegisterResourceName(AttrType, "SaverAttr");
RegisterResourceName(SaverEventType, "SaverEvent");
RegisterResourceName(SuspendType, "SaverSuspend");
ScreenSaverEventBase = extEntry->eventBase;
EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
}

View File

@ -40,6 +40,7 @@ in this Software without prior written authorization from The Open Group.
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "registry.h"
#include "opaque.h"
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
@ -134,6 +135,8 @@ ShapeExtensionInit(void)
ProcShapeDispatch, SProcShapeDispatch,
NULL, StandardMinorOpcode)))
{
RegisterResourceName(ClientType, "ShapeClient");
RegisterResourceName(ShapeEventType, "ShapeEvent");
ShapeEventBase = extEntry->eventBase;
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}

View File

@ -52,6 +52,7 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#include "shmint.h"
#include "xace.h"
#include "registry.h"
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include "protocol-versions.h"
@ -283,6 +284,7 @@ ShmExtensionInit(INITARGS)
ProcShmDispatch, SProcShmDispatch,
ShmResetProc, StandardMinorOpcode)))
{
RegisterResourceName(ShmSegType, "ShmSeg");
ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase;

View File

@ -39,6 +39,7 @@ in this Software without prior written authorization from The Open Group.
#include "dixstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "registry.h"
typedef struct _Sertafied {
struct _Sertafied *next;
@ -90,6 +91,7 @@ ClientSleepUntil (ClientPtr client,
SertafiedResType = CreateNewResourceType (SertafiedDelete);
if (!SertafiedResType)
return FALSE;
RegisterResourceName(SertafiedResType, "ClientSleep");
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}

View File

@ -64,6 +64,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "registry.h"
#include "opaque.h"
#include <X11/extensions/syncproto.h>
#include "syncsrv.h"
@ -878,6 +879,7 @@ SyncCreateSystemCounter(
{
return NULL;
}
RegisterResourceName(RTCounter, "SyncCounter");
}
pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
@ -2133,6 +2135,10 @@ SyncExtensionInit(void)
return;
}
RegisterResourceName(RTCounter, "SyncCounter");
RegisterResourceName(RTAlarm, "SyncAlarm");
RegisterResourceName(RTAwait, "SyncAwait");
RegisterResourceName(RTAlarmClient, "SyncAlarmClient");
SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase;
EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;

View File

@ -36,6 +36,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "dixstruct.h"
#include "resource.h"
#include "registry.h"
#include "opaque.h"
#include <X11/extensions/Xv.h>
@ -1867,6 +1868,8 @@ void XineramifyXv(void)
if (!xvsp0 || !XvXRTPort) return;
RegisterResourceName(XvXRTPort, "XvXRTPort");
for(i = 0; i < xvsp0->nAdaptors; i++) {
refAdapt = xvsp0->pAdaptors + i;

View File

@ -90,6 +90,7 @@ SOFTWARE.
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "registry.h"
#include "opaque.h"
#include "input.h"
@ -213,36 +214,42 @@ CreateResourceTypes(void)
ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
return FALSE;
}
RegisterResourceName(XvRTPort, "XvRTPort");
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab)))
{
ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
return FALSE;
}
RegisterResourceName(XvRTGrab, "XvRTGrab");
if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding)))
{
ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
return FALSE;
}
RegisterResourceName(XvRTEncoding, "XvRTEncoding");
if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify)))
{
ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
return FALSE;
}
RegisterResourceName(XvRTVideoNotify, "XvRTVideoNotify");
if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList)))
{
ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
return FALSE;
}
RegisterResourceName(XvRTVideoNotifyList, "XvRTVideoNotifyList");
if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify)))
{
ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
return FALSE;
}
RegisterResourceName(XvRTPortNotify, "XvRTPortNotify");
return TRUE;

View File

@ -11,6 +11,7 @@
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "registry.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "servermd.h"
@ -676,12 +677,15 @@ XvMCExtensionInit(void)
if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
return;
RegisterResourceName(XvMCRTContext, "XvMCRTContext");
if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes)))
return;
RegisterResourceName(XvMCRTSurface, "XvMCRTSurface");
if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes)))
return;
RegisterResourceName(XvMCRTSubpicture, "XvMCRTSubpicture");
extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors,
ProcXvMCDispatch, SProcXvMCDispatch,

View File

@ -47,6 +47,7 @@
#include "compint.h"
#include "xace.h"
#include "registry.h"
#include "protocol-versions.h"
static CARD8 CompositeReqCode;
@ -549,14 +550,19 @@ CompositeExtensionInit (void)
CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
if (!CompositeClientWindowType)
return;
RegisterResourceName(CompositeClientWindowType, "CompositeClientWindow");
CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows);
if (!CompositeClientSubwindowsType)
return;
RegisterResourceName(CompositeClientSubwindowsType,
"CompositeClientSubwindows");
CompositeClientOverlayType = CreateNewResourceType (FreeCompositeClientOverlay);
if (!CompositeClientOverlayType)
return;
RegisterResourceName(CompositeClientOverlayType,
"CompositeClientOverlay");
if (!dixRequestPrivate(CompositeClientPrivateKey,
sizeof(CompositeClientRec)))

View File

@ -24,6 +24,7 @@
#include <dix-config.h>
#endif
#include "registry.h"
#include "damageextint.h"
#include "protocol-versions.h"
@ -500,10 +501,12 @@ DamageExtensionInit(void)
DamageExtType = CreateNewResourceType (FreeDamageExt);
if (!DamageExtType)
return;
RegisterResourceName(DamageExtType, "DamageExt");
DamageExtWinType = CreateNewResourceType (FreeDamageExtWin);
if (!DamageExtWinType)
return;
RegisterResourceName(DamageExtWinType, "DamageExtWin");
if (!dixRequestPrivate(DamageClientPrivateKey, sizeof (DamageClientRec)))
return;

View File

@ -54,6 +54,7 @@
#include "dbestruct.h"
#include "midbe.h"
#include "xace.h"
#include "registry.h"
/* GLOBALS */
@ -1577,11 +1578,13 @@ DbeExtensionInit(void)
if (!dbeDrawableResType)
return;
dbeDrawableResType |= RC_DRAWABLE;
RegisterResourceName(dbeDrawableResType, "dbeDrawable");
dbeWindowPrivResType =
CreateNewResourceType(DbeWindowPrivDelete);
if (!dbeWindowPrivResType)
return;
RegisterResourceName(dbeWindowPrivResType, "dbeWindow");
if (!dixRegisterPrivateOffset(dbeDrawableResType,
offsetof(PixmapRec, devPrivates)))

View File

@ -44,6 +44,7 @@
#include "glxvisuals.h"
#include "micmap.h"
#include "glxswap.h"
#include "registry.h"
/*
** Stubs to satisfy miinitext.c references.
@ -303,6 +304,12 @@ void GlxExtensionInit(void)
!__glXWindowRes || !__glXPbufferRes)
return;
RegisterResourceName(__glXContextRes, "GLXContext");
RegisterResourceName(__glXClientRes, "GLXClient");
RegisterResourceName(__glXPixmapRes, "GLXPixmap");
RegisterResourceName(__glXWindowRes, "GLXWindow");
RegisterResourceName(__glXPbufferRes, "GLXPbuffer");
/*
** Add extension to server extensions.
*/

View File

@ -43,6 +43,7 @@
#include "privates.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -145,6 +146,7 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
goto out ;
}
RegisterResourceName(EventType, "DRIEvents");
#endif
if ((extEntry = AddExtension(XF86DRINAME,

View File

@ -39,6 +39,7 @@ from Kaleb S. KEITHLEY
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "scrnintstr.h"
#include "servermd.h"
#include <X11/extensions/xf86vmproto.h>
@ -201,6 +202,7 @@ XFree86VidModeExtensionInit(void)
#endif
VidModeErrorBase = extEntry->errorBase;
#ifdef XF86VIDMODE_EVENTS
RegisterResourceName(EventType, "VidModeEvent");
XF86VidModeEventBase = extEntry->eventBase;
EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
#endif

View File

@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -794,6 +795,8 @@ DRIExtensionInit(void)
if (!DRIDrawablePrivResType || !DRIContextPrivResType)
return FALSE;
RegisterResourceName(DRIDrawablePrivResType, "DRIDrawable");
RegisterResourceName(DRIContextPrivResType, "DRIContext");
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);

View File

@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -111,6 +112,9 @@ XFree86DRIExtensionInit(void)
StandardMinorOpcode))) {
DRIReqCode = (unsigned char)extEntry->base;
DRIErrorBase = extEntry->errorBase;
#ifdef XF86DRI_EVENTS
RegisterResourceName(EventType, "DRIEvent");
#endif
}
}

View File

@ -42,6 +42,7 @@
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "registry.h"
#include "xf86drm.h"
#include "xfixes.h"
#include "dri2.h"
@ -421,6 +422,8 @@ DRI2ExtensionInit(void)
if (!dri2DrawableRes)
return;
RegisterResourceName(dri2DrawableRes, "DRI2Drawable");
dri2Extension = AddExtension(DRI2_NAME,
DRI2NumberEvents,
DRI2NumberErrors,

View File

@ -37,6 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dixstruct.h"
#include "globals.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -129,6 +130,8 @@ AppleWMExtensionInit(
WMEventBase = extEntry->eventBase;
EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
appleWMProcs = procsPtr;
RegisterResourceName(ClientType, "WMClient");
RegisterResourceName(EventType, "WMEvent");
}
}

View File

@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -279,6 +280,9 @@ DRIExtensionInit(void)
{
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
if (DRIDrawablePrivResType != 0)
RegisterResourceName(DRIDrawablePrivResType, "DRIDrawable");
return (DRIDrawablePrivResType != 0);
}

View File

@ -34,6 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "registry.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "scrnintstr.h"
@ -102,6 +103,8 @@ winWindowsWMExtensionInit ()
WMErrorBase = extEntry->errorBase;
WMEventBase = extEntry->eventBase;
EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
RegisterResourceName(ClientType, "WMClient");
RegisterResourceName(eventResourceType, "WMEvent");
}
}

View File

@ -62,6 +62,7 @@ SOFTWARE.
#include "mifpoly.h"
#include "mi.h"
#include "mifillarc.h"
#include "registry.h"
#include <X11/Xfuncproto.h>
static double miDsin(double a);
@ -867,6 +868,7 @@ miComputeWideEllipse(
if (!cacheType)
{
cacheType = CreateNewResourceType(miFreeArcCache);
RegisterResourceName(cacheType, "miArcCache");
(void) AddResource(FakeClientID(0), cacheType, NULL);
}
} else {

View File

@ -29,6 +29,8 @@
#include <dix-config.h>
#endif
#include "registry.h"
#include "randrstr.h"
/* From render.h */
@ -339,9 +341,11 @@ RRExtensionInit (void)
RRClientType = CreateNewResourceType(RRFreeClient);
if (!RRClientType)
return;
RegisterResourceName(RRClientType, "RandRClient");
RREventType = CreateNewResourceType(RRFreeEvents);
if (!RREventType)
return;
RegisterResourceName(RREventType, "RandREvent");
extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
ProcRRDispatch, SProcRRDispatch,
NULL, StandardMinorOpcode);

View File

@ -42,6 +42,7 @@ and Jim Haggerty of Metheus.
#include "set.h"
#include "swaprep.h"
#include "inputstr.h"
#include "registry.h"
#include <stdio.h>
#include <assert.h>
@ -2878,6 +2879,7 @@ RecordExtensionInit(void)
RTContext = CreateNewResourceType(RecordDeleteContext);
if (!RTContext)
return;
RegisterResourceName(RTContext, "RecordContext");
ppAllContexts = NULL;
numContexts = numEnabledContexts = numEnabledRCAPs = 0;

View File

@ -46,6 +46,7 @@
#include "cursorstr.h"
#include "xace.h"
#include "protocol-versions.h"
#include "registry.h"
#if HAVE_STDINT_H
#include <stdint.h>
@ -3241,6 +3242,9 @@ PanoramiXRenderInit (void)
int i;
XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource);
if (XRT_PICTURE)
RegisterResourceName(XRT_PICTURE, "XineramaPicture");
for (i = 0; i < RenderNumberRequests; i++)
PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
/*

View File

@ -53,6 +53,7 @@
#include "inputstr.h"
#include "windowstr.h"
#include "xace.h"
#include "registry.h"
static RESTYPE CursorClientType;
static RESTYPE CursorHideCountType;
@ -1085,8 +1086,14 @@ XFixesCursorInit (void)
SetCursorScreen (pScreen, cs);
}
CursorClientType = CreateNewResourceType(CursorFreeClient);
if (CursorClientType)
RegisterResourceName(CursorClientType, "XFixesCursorClient");
CursorHideCountType = CreateNewResourceType(CursorFreeHideCount);
if (CursorHideCountType)
RegisterResourceName(CursorClientType, "XFixesCursorClient");
CursorWindowType = CreateNewResourceType(CursorFreeWindow);
if (CursorWindowType)
RegisterResourceName(CursorWindowType, "XFixesCursorWindow");
if (pInvisibleCursor == NULL) {
pInvisibleCursor = createInvisibleCursor();

View File

@ -33,6 +33,7 @@ extern int RenderErrBase;
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
#include "registry.h"
RESTYPE RegionResType;
@ -65,6 +66,9 @@ XFixesRegionInit (void)
{
RegionResType = CreateNewResourceType(RegionResFree);
if (RegionResType)
RegisterResourceName(RegionResType, "XFixesRegion");
return (RegionResType != 0);
}

View File

@ -26,6 +26,7 @@
#include "xfixesint.h"
#include "xace.h"
#include "registry.h"
static RESTYPE SelectionClientType, SelectionWindowType;
static Bool SelectionCallbackRegistered = FALSE;
@ -285,6 +286,11 @@ Bool
XFixesSelectionInit (void)
{
SelectionClientType = CreateNewResourceType(SelectionFreeClient);
if (SelectionClientType)
RegisterResourceName(SelectionClientType, "XFixesSelectionClient");
SelectionWindowType = CreateNewResourceType(SelectionFreeWindow);
if (SelectionWindowType)
RegisterResourceName(SelectionWindowType, "XFixesSelectionWindow");
return SelectionClientType && SelectionWindowType;
}

View File

@ -39,6 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xace.h"
#include "xkb.h"
#include "protocol-versions.h"
#include "registry.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XKMformat.h>
@ -6707,6 +6708,7 @@ XkbExtensionInit(void)
RT_XKBCLIENT = CreateNewResourceType(XkbClientGone);
if (!RT_XKBCLIENT)
return;
RegisterResourceName(RT_XKBCLIENT, "XkbClient");
if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
ProcXkbDispatch, SProcXkbDispatch,