From: chrubis@suse.cz
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 3/3] setns: add new syscall test setns02
Date: Tue, 12 Feb 2013 13:41:49 +0100 [thread overview]
Message-ID: <20130212124149.GB9378@rei> (raw)
In-Reply-To: <6624dba3afd6a1782b4d3760871964f14be60a38.1360149841.git.jstancek@redhat.com>
Hi!
> +static void setup(void)
> +{
> + char tmp[PATH_MAX];
> +
> + tst_require_root(NULL);
> +
> + /* runtime check if syscall is supported */
> + syscall(__NR_setns, -1, 0);
> +
What happens when the syscall is not supported? The call should return
-1 and errno should be set to ENOSYS but the return value is not
checked, I'm puzzled.
> + /* check if kernel has CONFIG_*_NS set and exports /proc entries */
> + ns_ipc_fd = get_ns_fd(getpid(), "ns/ipc");
> + ns_uts_fd = get_ns_fd(getpid(), "ns/uts");
> + if (ns_ipc_fd == -1 && ns_uts_fd == -1)
> + tst_brkm(TCONF, NULL, "your kernel has CONFIG_IPC_NS, "
> + "CONFIG_UTS_NS or CONFIG_PROC disabled");
> +
> + if (getcwd(tmp, PATH_MAX) == NULL)
> + tst_brkm(TBROK|TERRNO, NULL, "getcwd");
> + ipc_key = ftok(tmp, 65);
> + shmid = shmget(ipc_key, getpagesize(), IPC_CREAT | 0666);
> + if (shmid == -1)
> + tst_brkm(TBROK|TERRNO, NULL, "shmget");
> +
> + TEST_PAUSE;
> +}
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-02-12 12:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-06 11:55 [LTP] [PATCH v2 0/3] add new syscall test for setns(2) Jan Stancek
2013-02-06 11:55 ` [LTP] [PATCH v2 1/3] setns: setup directory at kernel/syscalls/setns Jan Stancek
2013-02-06 11:55 ` [LTP] [PATCH v2 2/3] setns: add new syscall test setns01 Jan Stancek
2013-02-12 12:33 ` chrubis
2013-02-06 11:55 ` [LTP] [PATCH v2 3/3] setns: add new syscall test setns02 Jan Stancek
2013-02-12 12:41 ` chrubis [this message]
[not found] ` <1704604395.1338521.1360674295147.JavaMail.root@redhat.com>
2013-02-12 13:09 ` chrubis
[not found] ` <1446382265.1343619.1360674762081.JavaMail.root@redhat.com>
2013-02-12 13:16 ` chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130212124149.GB9378@rei \
--to=chrubis@suse.cz \
--cc=jstancek@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox