prctl: Add support for PR_SET_THP_DISABLE and PR_GET_THP_DISABLE
Change-Id: I04c5568a9eb78bcac632b734f34bba49cf602c4d Refs: #1181
This commit is contained in:
committed by
Masamichi Takagi
parent
eb184419ea
commit
dfd23c3ebe
37
test/issues/1181/shm_large.c
Normal file
37
test/issues/1181/shm_large.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#define SHM_SIZE (16 << 20)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *shm = NULL;
|
||||
key_t key = ftok(argv[0], 0);
|
||||
int shmid;
|
||||
struct shmid_ds buf;
|
||||
|
||||
shmid = shmget(key, SHM_SIZE, IPC_CREAT | 0660);
|
||||
if (shmid < 0) {
|
||||
perror("shmget: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
shm = shmat(shmid, NULL, 0);
|
||||
if (!shm) {
|
||||
perror("shmat: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("shmat to %p, size: %ldM\n", shm, SHM_SIZE / 1024 / 1024);
|
||||
memset(shm, 0, SHM_SIZE);
|
||||
|
||||
shmdt(shm);
|
||||
|
||||
shmctl(shmid, IPC_RMID, &buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user