sme.h revision 258
258N/A/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
258N/A *
258N/A * Permission is hereby granted, free of charge, to any person obtaining a
258N/A * copy of this software and associated documentation files (the
258N/A * "Software"), to deal in the Software without restriction, including
258N/A * without limitation the rights to use, copy, modify, merge, publish,
258N/A * distribute, and/or sell copies of the Software, and to permit persons
258N/A * to whom the Software is furnished to do so, provided that the above
258N/A * copyright notice(s) and this permission notice appear in all copies of
258N/A * the Software and that both the above copyright notice(s) and this
258N/A * permission notice appear in supporting documentation.
258N/A *
258N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
258N/A * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
258N/A * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
258N/A * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
258N/A * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
258N/A * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
258N/A * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
258N/A * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
258N/A * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
258N/A *
258N/A * Except as contained in this notice, the name of a copyright holder
258N/A * shall not be used in advertising or otherwise to promote the sale, use
258N/A * or other dealings in this Software without prior written authorization
258N/A * of the copyright holder.
258N/A */
258N/A
258N/A#pragma ident "@(#)sme.h 1.6 07/12/04 SMI"
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_ */