ipc.h 3.04 KB
/*
 * Copyright (C) 1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * Copyright (C) 1998 Digital Equipment Corporation
 *
 * This file is part of the SimOS distribution.
 * See LICENSE file for terms of the license.
 *
 */

#ifndef _IPC_H_
#define _IPC_H_

#include "subst.h"

/*
 * Structure definitions for supporting System V semaphores and
 * shared memory.
 *
 * Copyright (C) 1993 by Jack E. Veenstra (veenstra@cs.rochester.edu)
 * 
 * This file is part of MINT, a MIPS code interpreter and event generator
 * for parallel programs.
 * 
 * MINT is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 1, or (at your option)
 * any later version.
 * 
 * MINT is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MINT; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */


#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>

#include "event.h"
#include "queue.h"

struct sysv_semid_ds {
    struct ipc_perm sem_perm;
    struct sysv_sem *sem_base;
    ushort sem_nsems;
    aint_time_t sem_otime;
    aint_time_t sem_ctime;
    int inuse;
};

struct sysv_sem {
    ushort semval;
    short sempid;
    short semncnt;
    short semzcnt;
    qnode_t nwait_q;
    qnode_t zwait_q;
};

struct sysv_shm {
    struct ipc_perm shm_perm;
    long addr;
    int inuse;
    /* ushort real_seg;  true if a system V segment was allocated */
    int size;
};

#define MAX_SEMASET 1024
#define MAX_SHMSEG   256

struct sysv_semid_ds;
extern SyscallStatus aint_semget ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern void semcpin (struct sysv_semid_ds *, struct sysv_semid_ds *);
extern void semcpout (struct sysv_semid_ds *, struct sysv_semid_ds *);
extern SyscallStatus aint_semop ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern SyscallStatus aint_semctl ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern SyscallStatus aint_shmget ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern int is_valid (long);
extern SyscallStatus aint_shmat ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern SyscallStatus aint_shmdt ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
extern SyscallStatus aint_shmctl ( thread_ptr);
		/* Prototype include a typedef name.
		   It should be moved after the typedef declaration */
#endif /*  _IPC_H_ */