1 /* 2 * Copyright (c) International Business Machines Corp., 2009 3 * Copyright (c) Nadia Derbey, 2009 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12 * the GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * 17 * Author: Serge Hallyn <serue (at) us.ibm.com> 18 ***************************************************************************/ 19 #include <sys/mount.h> 20 #include <sys/stat.h> 21 #include <sys/types.h> 22 #include <mqueue.h> 23 #include "../libclone/libclone.h" 24 #include "lapi/syscalls.h" 25 #include "safe_macros.h" 26 #include "test.h" 27 28 static int dummy_child(void *v) 29 { 30 (void) v; 31 return 0; 32 } 33 34 static void check_mqns(void) 35 { 36 int pid, status; 37 mqd_t mqd; 38 39 if (tst_kvercmp(2, 6, 30) < 0) 40 tst_brkm(TCONF, NULL, "Kernel version is lower than expected"); 41 42 mq_unlink("/checkmqnsenabled"); 43 mqd = 44 mq_open("/checkmqnsenabled", O_RDWR | O_CREAT | O_EXCL, 0777, NULL); 45 if (mqd == -1) 46 tst_brkm(TCONF, NULL, "mq_open check failed"); 47 48 mq_close(mqd); 49 mq_unlink("/checkmqnsenabled"); 50 51 pid = do_clone_unshare_test(T_CLONE, CLONE_NEWIPC, dummy_child, NULL); 52 if (pid == -1) 53 tst_brkm(TCONF | TERRNO, NULL, "CLONE_NEWIPC not supported"); 54 55 SAFE_WAIT(NULL, &status); 56 } 57