Nicholas Nethercote a1527f6993 Move a heap of tests from corecheck/tests/ into none/tests/. There's
no real point in having them in corecheck/tests since they're not testing
anything that Nulgrind doesn't provide.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4048
2005-06-29 03:46:32 +00:00

34 lines
591 B
C

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
int main()
{
int shmid = shmget(IPC_PRIVATE, 0x10000, IPC_CREAT|IPC_EXCL|0777);
void *addr;
char local;
char *top = (char *)(((unsigned long)&local + 0x0fffffff) & ~0x0fffffff);
if (shmid == -1)
perror("shmget");
addr = shmat(shmid, 0, 0);
if (addr == (void *)-1)
perror("shmat @ 0");
else
printf("shmat 0: addr=...\n");
addr = shmat(shmid, top, 0);
if (addr == (void *)-1)
perror("shmat @ top");
else
printf("shmat 2: addr=...\n");
shmctl(shmid, IPC_RMID, NULL);
return 0;
}