📄 p4_md.h
字号:
#if defined(CRAY) || defined(NEXT)#define GLOBMEMSIZE (4*1024*1024)#define CAN_DO_SOCKET_MSGS#define CAN_DO_XDR#define P4_MAX_MSG_QUEUES 1typedef int MD_lock_t;#define MD_lock_init(l)#define MD_lock(l)#define MD_unlock(l)#endif#if defined(SUN_SOLARIS)#include <sys/mman.h>#include <sys/systeminfo.h>#include <sys/processor.h>#include <sys/procset.h>#include <synch.h>#if !defined(THREAD_LISTENER)#define P4_PRECONNECT 1#endif#endif #if defined(SUN) || defined(SGI) \ || defined(DEC5000) || defined(LINUX) \ || defined(RS6000) || defined(IBM3090) || defined(FREEBSD) \ || defined(TITAN) || defined(NETBSD) \ || defined(HP)/* Increase P4_SYSV_SHM_SEGSIZE if you need more memory per segment. Not all (few?) systems may support larger segments */#ifndef P4_SYSV_SHM_SEGSIZE# define P4_SYSV_SHM_SEGSIZE (1*1024*1024)#endif# if defined(SYSV_IPC)/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE# define GLOBMEMSIZE (4*1024*1024)#endif# define CAN_DO_SOCKET_MSGS# define CAN_DO_XDR# define CAN_DO_SHMEM_MSGS# define USE_XX_SHMALLOC# define P4_MAX_MSG_QUEUES 8# define P4_MAX_SYSV_SHMIDS 256# define P4_MAX_SYSV_SEMIDS 256 typedef struct { int semid; int semnum; } MD_lock_t;# include <sys/ipc.h># include <sys/shm.h># include <sys/sem.h> static struct sembuf sem_lock[1] = { { 0, -1, 0 } }; static struct sembuf sem_unlock[1] = { { 0, 1, 0 } };# endif# if !defined(SYSV_IPC) && !defined(VENDOR_IPC)/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE# define GLOBMEMSIZE (4*1024*1024)#endif# define CAN_DO_SOCKET_MSGS# define CAN_DO_XDR# define P4_MAX_MSG_QUEUES 1 typedef int MD_lock_t;# define MD_lock_init(l)# define MD_lock(l)# define MD_unlock(l)# endif#endif#if defined(SUN_SOLARIS) && defined(VENDOR_IPC)#define CAN_DO_SOCKET_MSGS#define CAN_DO_XDR#define P4_MAX_MSG_QUEUES 8# define CAN_DO_SHMEM_MSGS# define USE_XX_SHMALLOC/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE# define GLOBMEMSIZE (16*1024*1024)#endif typedef mutex_t MD_lock_t;# define MD_lock_init(l) mutex_init(l,USYNC_PROCESS,(P4VOID *)NULL)# define MD_lock(l) mutex_lock(l)# define MD_unlock(l) mutex_unlock(l)#endif#if defined(SGI) && defined(VENDOR_IPC)#define CAN_DO_SOCKET_MSGS#define CAN_DO_XDR#define P4_MAX_MSG_QUEUES 32# include <ulocks.h># include <malloc.h># define CAN_DO_SHMEM_MSGS/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE# define GLOBMEMSIZE (16*1024*1024)#endif typedef usema_t *MD_lock_t;/* MD_lock_init must be defined in p4_MD.c *//* spinlock method */# define MD_lock(l) ussetlock(*(l))# define MD_unlock(l) usunsetlock(*(l))/* semaphore method *//*****# define MD_lock(l) uspsema(*l)# define MD_unlock(l) usvsema(*l)*****/#endif/* following is for POSIX std versions of Unix *//* if defined(SGI) || defined(RS6000) || defined(HP) || */#if defined(HAVE_UNISTD_H)#include <unistd.h>#endif/* Peter Krauss suggested this change (POSIX ?) */#if defined(HP)#define getdtablesize() sysconf(_SC_OPEN_MAX)#endif/*---------------------------- IPSC860 Cube --------------------------- */#if defined(IPSC860)# if defined(DELTA)# define P4_MAX_CUBE_MSGS_OUT 5# else# define P4_MAX_CUBE_MSGS_OUT 5# endif#define MD_cube_send MD_i860_send#define MD_cube_recv MD_i860_recv#define MD_cube_msgs_available MD_i860_msgs_availabletypedef int MD_lock_t;#if defined(IPSC860)#define MYNODE mynode#endif#ifndef LINT#define MD_lock_init(l)#define MD_lock(l)#define MD_unlock(l)#endif/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE#define GLOBMEMSIZE (1*1024*1024)#endif#define CAN_DO_CUBE_MSGS#define P4_MAX_MSG_QUEUES 1#define ALL_NODES -1#define NO_TYPE_IPSC 0 #define ACK_REQUEST_IPSC 1#define ACK_REPLY_IPSC 2#if defined(MEIKO_CS2)#define ANY_P4TYPE_IPSC -1#else#define ANY_P4TYPE_IPSC 0x80000007#endif#define NODE_PID 0#if defined(IPSC860_SOCKETS)#define CAN_DO_SOCKET_MSGS/*****#include <CMC/sys/types.h>#include <CMC/sys/socket.h>#include <CMC/netinet/in.h>#include <CMC/netdb.h>*****/#include <CMC/ntoh.h>#endif#endif /*---------------------------- CM-5 --------------------------- */#if defined(CM5)#include <cm/cmmd.h>/* #include <cm/cmmd-io.h> */typedef int MD_lock_t;#if defined(CM5)#define MYNODE CMMD_self_address#endif#ifndef LINT#define MD_lock_init(l)#define MD_lock(l)#define MD_unlock(l)#endif/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE#define GLOBMEMSIZE (1*1024*1024)#endif#define CAN_DO_CUBE_MSGS#define P4_MAX_MSG_QUEUES 1#define NO_TYPE_CM5 0 #define ACK_REQUEST_CM5 1#define ACK_REPLY_CM5 2#define ANY_P4TYPE_CM5 CMMD_ANY_TAG#define MD_cube_send MD_CM5_send#define MD_cube_recv MD_CM5_recv#define MD_cube_msgs_available MD_CM5_msgs_available#endif /*---------------------------- NCUBE --------------------------- */#if defined(NCUBE)typedef int MD_lock_t;#include <sysn.h> #define MYNODE npid#ifndef LINT#define MD_lock_init(l)#define MD_lock(l)#define MD_unlock(l)#endif/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE#define GLOBMEMSIZE (1*1024*1024)#endif#define CAN_DO_CUBE_MSGS#define P4_MAX_MSG_QUEUES 1#define NO_TYPE_NCUBE 0 #define ACK_REQUEST_NCUBE 1#define ACK_REPLY_NCUBE 2#define ANY_P4TYPE_NCUBE (-1)#define NCUBE_ANY_NODE (-1)#define NCUBE_ANY_TAG (-1)#define MD_cube_send MD_NCUBE_send#define MD_cube_recv MD_NCUBE_recv#define MD_cube_msgs_available MD_NCUBE_msgs_available#endif /*---------------- KSR -------------------------*/#if defined(KSR)#include <sys/mman.h>#include <pthread.h>#define USE_XX_SHMALLOC/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE#define GLOBMEMSIZE (16*1024*1024)#endif#define P4_MAX_MSG_QUEUES 64#define CAN_DO_SOCKET_MSGS#define CAN_DO_XDR#define CAN_DO_SHMEM_MSGS#define MD_lock_t msemaphore#define MD_lock_init(l) msem_init(l, MSEM_UNLOCKED)#define MD_lock(l) msem_lock(l, 0)#define MD_unlock(l ) msem_unlock(l, 0)#endif/*------------------ Butterfly TC-2000/GP-1000 -------------- */#if defined(TC_2000) || defined(GP_1000)#include <mach.h> #include <sys/cluster.h>#include <sys/kern_return.h>#include <heap.h>char *xx_malloc();P4VOID MD_malloc_hint();#ifdef MALLOC_STATSstatic unsigned int allocated = 0;#endif#define MD_lock_t int#ifndef LINT#define MD_lock_init(l) simple_unlock(l)#define MD_lock(l) simple_lock(l)#define MD_unlock(l) simple_unlock(l)#endif/* Increase GLOBMEMSIZE to allow more memory. Not all systems will be able to allocate large amounts of shared memory */#ifndef GLOBMEMSIZE#define GLOBMEMSIZE (8*1024*1024)#endif#define CAN_DO_SOCKET_MSGS#define CAN_DO_XDR#define CAN_DO_SHMEM_MSGS#define P4_MAX_MSG_QUEUES 128#endif#ifdef TCMP#define CAN_DO_TCMP_MSGS/* #include </Net/sparky/sparky1/lusk/lepido/tcmp/tcmp.h> */#include </usr/bbnm/tcmp/tcmp.h>#endif/* Some systems don't include XDR */#if !defined(HAVE_XDRMEM_CREATE) || !defined(HAS_XDR)#undef CAN_DO_XDR#endif/* ----------------- Thread definitions ------------------- */#if defined(CYGWIN32_NT)typedef HANDLE p4_thread_t;/* The threadid appears useless; the HANDLE return value is used to manipulate the thread */static LPDWORD threadid;#define p4_create_thread(threadhandle,routine,args) \ threadhandle = CreateThread(NULL,\ 0,\ (LPTHREAD_START_ROUTINE) routine,\ (LPVOID) args, /* arbitrary argument */\ 0, /* runs now; could use CREATE_SUSPENDED */\ (LPDWORD) &threadid)#elif defined(USE_PTHREADS)#include <pthread.h>typedef pthread_t p4_thread_t;#define p4_create_thread(threadhandle,routine,args) \ pthread_create( &threadhandle, NULL, (void*(*)(void*))routine, (void *)args )#else/* No threads */#endif/* ----------------- Can be made machine dependent -------------------*/typedef unsigned long p4_usc_time_t;/* Bill says take this out, 12/22/94extern P4VOID exit (int);*/#define P4_MAXPROCS 1024/* For sysinfo */#if defined(SUN_SOLARIS) || defined(MEIKO_CS2)#include <sys/systeminfo.h>#endif/* Note that defining MEMDEBUG fails on HPs unless the ANSI option is selected in the compiler *//* #define MEMDEBUG */#if defined(MEMDEBUG)#ifndef LINT#define P4_INCLUDED/* For this include to work, the include path must include the ch_p4mpd directory */#include "tr2.h"#define p4_malloc(size) MALLOC(size)#define p4_free(p) FREE(p)#define p4_clock MD_clock#endif#else#ifndef LINT#define p4_malloc malloc#define p4_free free#define p4_clock MD_clock#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -