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