2002-05-24 04:29:10 +00:00
|
|
|
// test program for shmem functions
|
|
|
|
|
|
|
|
// -a attach and sleep
|
|
|
|
// -d destroy
|
|
|
|
// -c create
|
|
|
|
|
|
|
|
#define KEY 0xbeefcafe
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/wait.h>
|
2002-05-24 17:45:30 +00:00
|
|
|
#include <unistd.h>
|
2002-05-24 04:29:10 +00:00
|
|
|
|
|
|
|
#include "shmem.h"
|
|
|
|
|
|
|
|
main(int argc, char** argv) {
|
|
|
|
void* p;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
if (!strcmp(argv[1], "-a")) {
|
|
|
|
retval = attach_shmem(KEY, &p);
|
|
|
|
sleep(60);
|
|
|
|
} else if (!strcmp(argv[1], "-d")) {
|
|
|
|
destroy_shmem(KEY);
|
|
|
|
} else if (!strcmp(argv[1], "-c")) {
|
|
|
|
create_shmem(KEY, 100, &p);
|
|
|
|
}
|
|
|
|
}
|