> diff --git a/testcases/kernel/containers/mqns/mqns_helper.h 
> b/testcases/kernel/containers/mqns/mqns_helper.h
> new file mode 100644
> index 0000000..f1281fa
> --- /dev/null
> +++ b/testcases/kernel/containers/mqns/mqns_helper.h
> @@ -0,0 +1,54 @@
> +/*
> + * Copyright (c) International Business Machines Corp., 2009
> + * Copyright (c) Nadia Derbey, 2009
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> + * the GNU General Public License for more details.
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + *
> + * Author: Serge Hallyn <se...@us.ibm.com>
> + ***************************************************************************/
> +#include <sys/mount.h>
> +#include <sys/stat.h>
> +#include <sys/types.h>
> +#include "../libclone/libclone.h"
> +#include "test.h"
> +#include "mqns.h"
> +
> +static int dummy_child(void *v)
> +{
> +     (void) v;
> +     return 0;
> +}
> +
> +static int check_mqns(void)
> +{
> +     int pid;
> +     mqd_t mqd;
> +
> +     if (tst_kvercmp(2, 6, 30) < 0)
> +             tst_brkm(TCONF, NULL, "Kernel version is lower than expected");
> +
> +     mq_unlink("/checkmqnsenabled");
> +     mqd =
> +         mq_open("/checkmqnsenabled", O_RDWR | O_CREAT | O_EXCL, 0777, NULL);
> +     if (mqd == -1)
> +             tst_brkm(TCONF, NULL, "mq_open check failed");
> +
> +     mq_close(mqd);
> +     mq_unlink("/checkmqnsenabled");
> +
> +     pid = ltp_clone_quick(CLONE_NEWIPC, dummy_child, NULL);
> +     if (pid == -1)
> +             tst_brkm(TCONF | TERRNO, NULL, "CLONE_NEWIPC not supported");

I guess that we should reap the child with waitpid(pid, ...) here.

> +     return 0;

And since the function calls tst_brkm() we don't have to return any
value here so we can define it as void check_mqns(void).

> +}

The rest looks fine.

-- 
Cyril Hrubis
chru...@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to