mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
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
34 lines
591 B
C
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;
|
|
}
|