/* 2 Jul 1991 by Eric Grosse. Copyright (c) 1991 by AT&T. * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */ /* Tested only on IRIX 3.3.2. May need modification for other systems. * We assume memory is laid out, in order of increasing addresses, as * shared memory segments * global variables * sbrk * stack */ #include #include int isshm_junk; /* returns non-0 if p points into shared memory segment */ int isshm(char* p) /* p should either point to the beginning of the data area of a shared memory segment, or to someplace in the stack or malloc arena. */ { if( p > &isshm_junk ) return(0); if(!isdigit(*(p-128))){ /* should have seen first digit of shmid */ fprintf(stderr,"inconsistency discovered in isshm\n"); abort(); } return(1); }