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