/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "vmtest.h"
/* Test safe concurrent accesses of memory obtained by
** either mmap or shmget.
**
** Written by Kiem-Phong Vo
*/
#ifndef N_PROC
#endif
typedef struct _piece_s
{
} Piece_t;
static char *Mapstore;
static char *Shmstore;
{
ssize_t k, f;
for(k = f = 0; k < N_ALLOC; ++k)
continue;
for(; f <= k; ++f ) /* free anything that should be freed */
continue;
}
}
tinfo("Process %s[pid=%d]: extent=%d busy=(n=%d,z=%d) free=(n=%d,z=%d)",
return 0;
}
{
argv[5] = 0;
terror("Could not fork() a subprocess");
else if(pid > 0 ) /* return to parent process */
return pid;
else return 0; /* strictly speaking, never reached */
}
tmain()
{
size = 0; /* make up list of pieces for allocation */
srandom(0); /* make it easier to debug */
for(k = 0; k < N_ALLOC; ++k)
}
for(f = 0; f < N_FREE; ) /* set up what should be freed */
{ for(k = 0; k < N_ALLOC; ++k)
continue;
else if(random()%16 == 0)
if((f += 1) >= N_FREE)
break;
}
}
}
if(k = tchild())
{ if (test)
{ type = "shm";
flag = 1;
}
else
{ type = "map";
flag = -1;
}
if(!vm)
for(k = 0; k < N_PROC; ++k)
{ tinfo("Creating subprocess %d", k);
}
if (code)
break;
if(k < 0 )
tinfo("Statistics: store=%s extent=%d busy=(n=%d,z=%d) free=(n=%d,z=%d)",
terror("%s: Number of busy blocks %d is not the expected %d",
}
}