1*7c3d14c8STreehugger Robot // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 2*7c3d14c8STreehugger Robot // XFAIL: android 3*7c3d14c8STreehugger Robot // 4*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 5*7c3d14c8STreehugger Robot // Regression test for 6*7c3d14c8STreehugger Robot // https://code.google.com/p/address-sanitizer/issues/detail?id=250 7*7c3d14c8STreehugger Robot #include <stdio.h> 8*7c3d14c8STreehugger Robot #include <sys/ipc.h> 9*7c3d14c8STreehugger Robot #include <sys/shm.h> 10*7c3d14c8STreehugger Robot #include <assert.h> 11*7c3d14c8STreehugger Robot main()12*7c3d14c8STreehugger Robotint main() { 13*7c3d14c8STreehugger Robot int id = shmget(IPC_PRIVATE, 4096, 0644 | IPC_CREAT); 14*7c3d14c8STreehugger Robot assert(id > -1); 15*7c3d14c8STreehugger Robot struct shmid_ds ds; 16*7c3d14c8STreehugger Robot int res = shmctl(id, IPC_STAT, &ds); 17*7c3d14c8STreehugger Robot assert(res > -1); 18*7c3d14c8STreehugger Robot printf("shm_segsz: %zd\n", ds.shm_segsz); 19*7c3d14c8STreehugger Robot assert(ds.shm_segsz == 4096); 20*7c3d14c8STreehugger Robot assert(-1 != shmctl(id, IPC_RMID, 0)); 21*7c3d14c8STreehugger Robot 22*7c3d14c8STreehugger Robot struct shm_info shmInfo; 23*7c3d14c8STreehugger Robot res = shmctl(0, SHM_INFO, (struct shmid_ds *)&shmInfo); 24*7c3d14c8STreehugger Robot assert(res > -1); 25*7c3d14c8STreehugger Robot 26*7c3d14c8STreehugger Robot return 0; 27*7c3d14c8STreehugger Robot } 28