sme.h revision 943
222N/A/* Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
98N/A *
967N/A * Permission is hereby granted, free of charge, to any person obtaining a
98N/A * copy of this software and associated documentation files (the "Software"),
98N/A * to deal in the Software without restriction, including without limitation
919N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A * and/or sell copies of the Software, and to permit persons to whom the
919N/A * Software is furnished to do so, subject to the following conditions:
919N/A *
919N/A * The above copyright notice and this permission notice (including the next
919N/A * paragraph) shall be included in all copies or substantial portions of the
919N/A * Software.
919N/A *
919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A * DEALINGS IN THE SOFTWARE.
919N/A */
919N/A
98N/A
98N/A/************************************************************
98N/ACopyright 1989 by The Massachusetts Institute of Technology
98N/A
810N/APermission to use, copy, modify, and distribute this
810N/Asoftware and its documentation for any purpose and without
810N/Afee is hereby granted, provided that the above copyright
810N/Anotice appear in all copies and that both that copyright
810N/Anotice and this permission notice appear in supporting
837N/Adocumentation, and that the name of MIT not be used in
561N/Aadvertising or publicity pertaining to distribution of the
810N/Asoftware without specific prior written permission.
222N/AM.I.T. makes no representation about the suitability of
306N/Athis software for any purpose. It is provided "as is"
653N/Awithout any express or implied warranty.
372N/A
561N/AMIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
561N/AINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
561N/ANESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
561N/AABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
306N/AANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
561N/APROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
561N/AOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
561N/ATHE USE OR PERFORMANCE OF THIS SOFTWARE.
561N/A
561N/A********************************************************/
561N/A
561N/A#ifndef _SME_H_
306N/A#define _SME_H_
561N/A
561N/A#include <X11/Xmd.h>
306N/A#include <thread.h>
561N/A#include <synch.h>
561N/A
561N/Atypedef struct _xSMEReq {
561N/A CARD8 reqType;
306N/A CARD8 subReqType;
561N/A CARD16 length B16;
561N/A CARD32 xsunsmesize B32;
561N/A} xSMEReq;
561N/A
561N/A#define sz_xSMEReq 8
561N/A#define SMENAME "SUN_SME"
561N/A#define SMEFILE "/tmp/.X11-sme"
561N/A
561N/Atypedef struct _xSmeConnInitReply {
561N/A BYTE type; /* X_Reply */
561N/A BYTE status;
561N/A CARD16 sequenceNumber B16; /* of last request received by server */
561N/A CARD32 length B32;
561N/A CARD32 client_index B32; /* client index to be used in opening sme*/
810N/A CARD32 pad1 B32; /* Pad to standard reply size */
810N/A CARD32 pad2 B32;
810N/A CARD32 pad3 B32;
810N/A CARD32 pad4 B32;
810N/A CARD32 pad5 B32;
837N/A} xSmeConnInitReply;
98N/A
810N/A/* "Sme2" in hex */
837N/A#define SME_MAGIC2 0x53686d32
810N/A/* "Sme3" in hex */
493N/A#define SME_MAGIC3 0x53686d33
493N/A/* "Sme4" in hex */
98N/A#define SME_MAGIC4 0x53686d34
493N/A
967N/A/*
380N/A * Add a few more fields to shared memory data structures for
493N/A * debugging.
493N/A */
967N/A
493N/A#define INIT_SME_CONN 1
#define START_SME_CONN 2
#define SMECONNQSIZE 512 /* Total number of allocation
* chunks that can be queued in
* the fifo. */
/*
* Shared memory structure
*/
typedef struct _smeRegion {
INT32 smeMagic;
INT32 smeHeapSize; /* Total number of bytes in heap */
INT32 smeBufferSize; /* Allocation chunk within heap */
volatile INT32 smeClientBufferBlocked;
mutex_t smeBufferMutex;
cond_t smeBufferCV;
volatile INT32 smeIn;
volatile INT32 smeOut;
volatile INT32 smeHeadptr; /* Relative ptr to first free byte in
* the heap. Only the client updates
* this. */
volatile INT32 smeTailptr; /* Relative ptr to the last free byte
* in the heap. Only the server
* updates this. */
struct smeQueueEntry {
volatile INT32 bufp;
volatile INT32 msgSize;
} smeQueue[SMECONNQSIZE];
} smeRegion;
#endif /* _SME_H_ */