~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to record/record.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XdotOrg: xserver/xorg/record/record.c,v 1.5 2005/07/03 07:02:08 daniels Exp $ */
 
1
/* $XdotOrg: xserver/xorg/record/record.c,v 1.7 2006/03/28 01:21:00 ajax Exp $ */
2
2
/* $Xorg: record.c,v 1.4 2001/02/09 02:05:27 xorgcvs Exp $ */
3
3
 
4
4
/*
45
45
#define _XRECORD_SERVER_
46
46
#include <X11/extensions/recordstr.h>
47
47
#include "set.h"
 
48
#include "swaprep.h"
48
49
 
49
 
#ifndef XFree86LOADER
50
50
#include <stdio.h>
51
51
#include <assert.h>
52
 
#else
53
 
#include "xf86_ansic.h"
54
 
#endif
55
52
 
56
53
#ifdef PANORAMIX
57
54
#include "globals.h"
206
203
 * Side Effects: none.
207
204
 */
208
205
static int
209
 
RecordFindContextOnAllContexts(pContext)
210
 
    RecordContextPtr pContext;
 
206
RecordFindContextOnAllContexts(RecordContextPtr pContext)
211
207
{
212
208
    int i;
213
209
 
469
465
 * Note: this function exists mainly to make RecordARequest smaller.
470
466
 */
471
467
static void
472
 
RecordABigRequest(pContext, client, stuff)
473
 
    RecordContextPtr pContext;
474
 
    ClientPtr client;
475
 
    xReq *stuff;
 
468
RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
476
469
{
477
470
    CARD32 bigLength;
478
471
    char n;
521
514
 *      request for this client.  The real Proc function is called.
522
515
 */
523
516
static int
524
 
RecordARequest(client)
525
 
    ClientPtr client;
 
517
RecordARequest(ClientPtr client)
526
518
{
527
519
    RecordContextPtr pContext;
528
520
    RecordClientsAndProtocolPtr pRCAP;
605
597
 *       the word skip in ddx.tbl.ms (the porting layer document).
606
598
 */
607
599
static void
608
 
RecordASkippedRequest(pcbl , nulldata, calldata)
609
 
    CallbackListPtr *pcbl;
610
 
    pointer nulldata;
611
 
    pointer calldata;
 
600
RecordASkippedRequest(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
612
601
{
613
602
    SkippedRequestInfoRec *psi = (SkippedRequestInfoRec *)calldata;
614
603
    RecordContextPtr pContext;
695
684
 *      chunk of data belonging to this reply, it is set to 0.
696
685
 */
697
686
static void
698
 
RecordAReply(pcbl, nulldata, calldata)
699
 
    CallbackListPtr *pcbl;
700
 
    pointer nulldata;
701
 
    pointer calldata;
 
687
RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
702
688
{
703
689
    RecordContextPtr pContext;
704
690
    RecordClientsAndProtocolPtr pRCAP;
780
766
 *      it for this client.
781
767
 */
782
768
static void
783
 
RecordADeliveredEventOrError(pcbl, nulldata, calldata)
784
 
    CallbackListPtr *pcbl;
785
 
    pointer nulldata;
786
 
    pointer calldata;
 
769
RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
787
770
{
788
771
    EventInfoRec *pei = (EventInfoRec *)calldata;
789
772
    RecordContextPtr pContext;
802
785
            xEvent *pev = pei->events;
803
786
            for (ev = 0; ev < pei->count; ev++, pev++)
804
787
            {
805
 
                int recordit;
806
 
                if (pev->u.u.type == X_Error)
 
788
                int recordit = 0;
 
789
                if (pRCAP->pErrorSet)
807
790
                {
808
791
                    recordit = RecordIsMemberOfSet(pRCAP->pErrorSet,
809
792
                                                ((xError *)(pev))->errorCode);
810
793
                }
811
 
                else
 
794
                else if (pRCAP->pDeliveredEventSet)
812
795
                {
813
796
                    recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet,
814
797
                                                   pev->u.u.type & 0177);
849
832
 *      it for this client.
850
833
 */
851
834
static void
852
 
RecordADeviceEvent(pcbl, nulldata, calldata)
853
 
    CallbackListPtr *pcbl;
854
 
    pointer nulldata;
855
 
    pointer calldata;
 
835
RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
856
836
{
857
837
    DeviceEventInfoRec *pei = (DeviceEventInfoRec *)calldata;
858
838
    RecordContextPtr pContext;
973
953
 *      various callback lists.
974
954
 */
975
955
static int
976
 
RecordInstallHooks(pRCAP, oneclient)
977
 
    RecordClientsAndProtocolPtr pRCAP;
978
 
    XID oneclient;
 
956
RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
979
957
{
980
958
    int i = 0;
981
959
    XID client;
1068
1046
 *      various callback lists.
1069
1047
 */
1070
1048
static void
1071
 
RecordUninstallHooks(pRCAP, oneclient)
1072
 
    RecordClientsAndProtocolPtr pRCAP;
1073
 
    XID oneclient;
 
1049
RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
1074
1050
{
1075
1051
    int i = 0;
1076
1052
    XID client;
1169
1145
 *      have at least one client.)
1170
1146
 */
1171
1147
static void
1172
 
RecordDeleteClientFromRCAP(pRCAP, position)
1173
 
    RecordClientsAndProtocolPtr pRCAP;
1174
 
    int position;
 
1148
RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
1175
1149
{
1176
1150
    if (pRCAP->pContext->pRecordingClient)
1177
1151
        RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]);
1218
1192
 *      is no more room to hold clients internal to the RCAP.
1219
1193
 */
1220
1194
static void
1221
 
RecordAddClientToRCAP(pRCAP, clientspec)
1222
 
    RecordClientsAndProtocolPtr pRCAP;
1223
 
    XID clientspec;
 
1195
RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
1224
1196
{
1225
1197
    if (pRCAP->numClients == pRCAP->sizeClients)
1226
1198
    {
1266
1238
 *      RCAP.  (A given clientspec can only be on one RCAP of a context.)
1267
1239
 */
1268
1240
static void
1269
 
RecordDeleteClientFromContext(pContext, clientspec)
1270
 
    RecordContextPtr pContext;
1271
 
    XID clientspec;
 
1241
RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec)
1272
1242
{
1273
1243
    RecordClientsAndProtocolPtr pRCAP;
1274
1244
    int position;
1291
1261
 * Side Effects: none.
1292
1262
 */
1293
1263
static int
1294
 
RecordSanityCheckClientSpecifiers(clientspecs, nspecs, errorspec)
1295
 
    XID *clientspecs;
1296
 
    int nspecs;
1297
 
    XID errorspec;
 
1264
RecordSanityCheckClientSpecifiers(XID *clientspecs, int nspecs, XID errorspec)
1298
1265
{
1299
1266
    int i;
1300
1267
    int clientIndex;
1353
1320
 *      pClientspecs may be modified in place.
1354
1321
 */
1355
1322
static XID *
1356
 
RecordCanonicalizeClientSpecifiers(pClientspecs, pNumClientspecs, excludespec)
1357
 
    XID *pClientspecs;
1358
 
    int *pNumClientspecs;
1359
 
    XID excludespec;
 
1323
RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID excludespec)
1360
1324
{
1361
1325
    int i;
1362
1326
    int numClients = *pNumClientspecs;
1453
1417
 * Side Effects: none.
1454
1418
 */
1455
1419
static int
1456
 
RecordSanityCheckRegisterClients(pContext, client, stuff)
1457
 
    RecordContextPtr pContext;
1458
 
    ClientPtr client;
1459
 
    xRecordRegisterClientsReq *stuff;
 
1420
RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
1460
1421
{
1461
1422
    int err;
1462
1423
    xRecordRange *pRange;
1591
1552
 *      RecordSetIntervals, all zeroed, and psi->size is set to size.
1592
1553
 */
1593
1554
static int
1594
 
RecordAllocIntervals(psi, nIntervals)
1595
 
    SetInfoPtr psi;
1596
 
    int nIntervals;
 
1555
RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
1597
1556
{
1598
1557
    assert(!psi->intervals);
1599
1558
    psi->intervals = (RecordSetInterval *)
1715
1674
 *      to record the new clients and protocol.
1716
1675
 */
1717
1676
static int
1718
 
RecordRegisterClients(pContext, client, stuff)
1719
 
    RecordContextPtr pContext;
1720
 
    ClientPtr client;
1721
 
    xRecordRegisterClientsReq *stuff;
 
1677
RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
1722
1678
{
1723
1679
    int err;
1724
1680
    int i;
1991
1947
 */
1992
1948
 
1993
1949
static int
1994
 
ProcRecordQueryVersion(client)
1995
 
    ClientPtr client;
 
1950
ProcRecordQueryVersion(ClientPtr client)
1996
1951
{
1997
1952
    /* REQUEST(xRecordQueryVersionReq); */
1998
1953
    xRecordQueryVersionReply    rep;
2017
1972
 
2018
1973
 
2019
1974
static int
2020
 
ProcRecordCreateContext(client)
2021
 
    ClientPtr client;
 
1975
ProcRecordCreateContext(ClientPtr client)
2022
1976
{
2023
1977
    REQUEST(xRecordCreateContextReq);
2024
1978
    RecordContextPtr pContext;
2072
2026
 
2073
2027
 
2074
2028
static int
2075
 
ProcRecordRegisterClients(client)
2076
 
    ClientPtr client;
 
2029
ProcRecordRegisterClients(ClientPtr client)
2077
2030
{
2078
2031
    RecordContextPtr pContext;
2079
2032
    REQUEST(xRecordRegisterClientsReq);
2086
2039
 
2087
2040
 
2088
2041
static int
2089
 
ProcRecordUnregisterClients(client)
2090
 
    ClientPtr client;
 
2042
ProcRecordUnregisterClients(ClientPtr client)
2091
2043
{
2092
2044
    RecordContextPtr pContext;
2093
2045
    int err;
2151
2103
 *      number of ranges.  Newly allocated ranges are zeroed.
2152
2104
 */
2153
2105
static int
2154
 
RecordAllocRanges(pri, nRanges)
2155
 
    GetContextRangeInfoPtr pri;
2156
 
    int nRanges;
 
2106
RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
2157
2107
{
2158
2108
    int newsize;
2159
2109
    xRecordRange *pNewRange;
2313
2263
 *      The 16 bit fields of each xRecordRange are byte swapped.
2314
2264
 */
2315
2265
static void
2316
 
RecordSwapRanges(pRanges, nRanges)
2317
 
    xRecordRange *pRanges;
2318
 
    int nRanges;
 
2266
RecordSwapRanges(xRecordRange *pRanges, int nRanges)
2319
2267
{
2320
2268
    int i;
2321
2269
    register char n;
2330
2278
 
2331
2279
 
2332
2280
static int
2333
 
ProcRecordGetContext(client)
2334
 
    ClientPtr client;
 
2281
ProcRecordGetContext(ClientPtr client)
2335
2282
{
2336
2283
    RecordContextPtr pContext;
2337
2284
    REQUEST(xRecordGetContextReq);
2477
2424
 
2478
2425
 
2479
2426
static int
2480
 
ProcRecordEnableContext(client)
2481
 
    ClientPtr client;
 
2427
ProcRecordEnableContext(ClientPtr client)
2482
2428
{
2483
2429
    RecordContextPtr pContext;
2484
2430
    REQUEST(xRecordEnableContextReq);
2556
2502
 *      is resumed.
2557
2503
 */
2558
2504
static void
2559
 
RecordDisableContext(pContext)
2560
 
    RecordContextPtr pContext;
 
2505
RecordDisableContext(RecordContextPtr pContext)
2561
2506
{
2562
2507
    RecordClientsAndProtocolPtr pRCAP;
2563
2508
    int i;
2594
2539
 
2595
2540
 
2596
2541
static int
2597
 
ProcRecordDisableContext(client)
2598
 
    ClientPtr client;
 
2542
ProcRecordDisableContext(ClientPtr client)
2599
2543
{
2600
2544
    RecordContextPtr pContext;
2601
2545
    REQUEST(xRecordDisableContextReq);
2620
2564
 *      it from the ppAllContexts array.
2621
2565
 */
2622
2566
static int
2623
 
RecordDeleteContext(value, id)
2624
 
    pointer value;
2625
 
    XID id;
 
2567
RecordDeleteContext(pointer value, XID id)
2626
2568
{
2627
2569
    int i;
2628
2570
    RecordContextPtr pContext = (RecordContextPtr)value;
2662
2604
 
2663
2605
 
2664
2606
static int
2665
 
ProcRecordFreeContext(client)
2666
 
    ClientPtr       client;
 
2607
ProcRecordFreeContext(ClientPtr client)
2667
2608
{
2668
2609
    RecordContextPtr pContext;
2669
2610
    REQUEST(xRecordFreeContextReq);
2676
2617
 
2677
2618
 
2678
2619
static int
2679
 
ProcRecordDispatch(client)
2680
 
    ClientPtr client;
 
2620
ProcRecordDispatch(ClientPtr client)
2681
2621
{
2682
2622
    REQUEST(xReq);
2683
2623
 
2706
2646
 
2707
2647
 
2708
2648
static int
2709
 
SProcRecordQueryVersion(client)
2710
 
    ClientPtr client;
 
2649
SProcRecordQueryVersion(ClientPtr client)
2711
2650
{
2712
2651
    REQUEST(xRecordQueryVersionReq);
2713
2652
    register char       n;
2740
2679
 
2741
2680
 
2742
2681
static int
2743
 
SProcRecordCreateContext(client)
2744
 
    ClientPtr client;
 
2682
SProcRecordCreateContext(ClientPtr client)
2745
2683
{
2746
2684
    REQUEST(xRecordCreateContextReq);
2747
2685
    register char       n;
2754
2692
 
2755
2693
 
2756
2694
static int
2757
 
SProcRecordRegisterClients(client)
2758
 
    ClientPtr client;
 
2695
SProcRecordRegisterClients(ClientPtr client)
2759
2696
{
2760
2697
    REQUEST(xRecordRegisterClientsReq);
2761
2698
    register char       n;
2768
2705
 
2769
2706
 
2770
2707
static int
2771
 
SProcRecordUnregisterClients(client)
2772
 
    ClientPtr client;
 
2708
SProcRecordUnregisterClients(ClientPtr client)
2773
2709
{
2774
2710
    REQUEST(xRecordUnregisterClientsReq);
2775
2711
    register char       n;
2784
2720
 
2785
2721
 
2786
2722
static int
2787
 
SProcRecordGetContext(client)
2788
 
    ClientPtr client;
 
2723
SProcRecordGetContext(ClientPtr client)
2789
2724
{
2790
2725
    REQUEST(xRecordGetContextReq);
2791
2726
    register char       n;
2797
2732
} /* SProcRecordGetContext */
2798
2733
 
2799
2734
static int
2800
 
SProcRecordEnableContext(client)
2801
 
    ClientPtr client;
 
2735
SProcRecordEnableContext(ClientPtr client)
2802
2736
{
2803
2737
    REQUEST(xRecordEnableContextReq);
2804
2738
    register char       n;
2811
2745
 
2812
2746
 
2813
2747
static int
2814
 
SProcRecordDisableContext(client)
2815
 
    ClientPtr client;
 
2748
SProcRecordDisableContext(ClientPtr client)
2816
2749
{
2817
2750
    REQUEST(xRecordDisableContextReq);
2818
2751
    register char       n;
2825
2758
 
2826
2759
 
2827
2760
static int
2828
 
SProcRecordFreeContext(client)
2829
 
    ClientPtr client;
 
2761
SProcRecordFreeContext(ClientPtr client)
2830
2762
{
2831
2763
    REQUEST(xRecordFreeContextReq);
2832
2764
    register char       n;
2839
2771
 
2840
2772
 
2841
2773
static int
2842
 
SProcRecordDispatch(client)
2843
 
    ClientPtr client;
 
2774
SProcRecordDispatch(ClientPtr client)
2844
2775
{
2845
2776
    REQUEST(xReq);
2846
2777
 
2867
2798
    }
2868
2799
} /* SProcRecordDispatch */
2869
2800
 
2870
 
/* XXX goes in header file */
2871
 
extern void SwapConnSetupInfo(), SwapConnSetupPrefix();
2872
 
 
2873
2801
/* RecordConnectionSetupInfo
2874
2802
 *
2875
2803
 * Arguments:
2883
2811
 *      The connection setup info is sent to the recording client.
2884
2812
 */
2885
2813
static void
2886
 
RecordConnectionSetupInfo(pContext, pci)
2887
 
    RecordContextPtr pContext;
2888
 
    NewClientInfoRec *pci;
 
2814
RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
2889
2815
{
2890
2816
    int prefixsize = SIZEOF(xConnSetupPrefix);
2891
2817
    int restsize = pci->prefix->length * 4;
2892
2818
 
2893
2819
    if (pci->client->swapped)
2894
2820
    {
2895
 
        char * pConnSetup = (char *)ALLOCATE_LOCAL(prefixsize + restsize);
 
2821
        char *pConnSetup = (char *)ALLOCATE_LOCAL(prefixsize + restsize);
2896
2822
        if (!pConnSetup)
2897
2823
            return;
2898
2824
        SwapConnSetupPrefix(pci->prefix, pConnSetup);
2938
2864
 */
2939
2865
 
2940
2866
static void
2941
 
RecordAClientStateChange(pcbl, nulldata, calldata)
2942
 
    CallbackListPtr *pcbl;
2943
 
    pointer nulldata;
2944
 
    pointer calldata;
 
2867
RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
2945
2868
{
2946
2869
    NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
2947
2870
    int i;
3004
2927
 *      
3005
2928
 */
3006
2929
static void
3007
 
RecordCloseDown(extEntry)
3008
 
    ExtensionEntry *extEntry;
 
2930
RecordCloseDown(ExtensionEntry *extEntry)
3009
2931
{
3010
2932
    DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
3011
2933
} /* RecordCloseDown */
3021
2943
 *      Enables the RECORD extension if possible.
3022
2944
 */
3023
2945
void 
3024
 
RecordExtensionInit()
 
2946
RecordExtensionInit(void)
3025
2947
{
3026
2948
    ExtensionEntry *extentry;
3027
2949