From: hooanon05@yahoo.co.jp
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, stewb@linux-foundation.org
Subject: Re: [RFC 0/5] pathconf(3) with _PC_LINK_MAX
Date: Sun, 06 Dec 2009 18:09:06 +0900 [thread overview]
Message-ID: <11114.1260090546@jrobl> (raw)
In-Reply-To: <20091206083958.GC14381@ZenIV.linux.org.uk>
Al Viro:
> Um... Why do we need that, again? Note that there is no way whatsoever
> for predicting whether link(2) will fail due to having too many existing
> links before you attempt the call - links can be created or removed between
> stat(2) and link(2). So any uses of that value are heuristical.
>
> Can you actually show any use cases of that thing? Preferably - in existing
> code, but even a theoretical one would be interesting.
Thanx for quick reply.
To be honest, I am unsure how important this is in real world.
But I've met (reported, precisly) such test program. It seems to come
from old X/Open, though the actual reporter tried the LSB (Linux
Standard Base) runtime-test.
You can get the source code from
ftp.freestandards.org/pub/lsb/test_suites/released-3.2/source/runtime/lsb-test-core-3.2.0-2.src.rpm
+ lsb-test-core-3.2.0.tar.gz
+ lts_vsx-pcts-3.2.0.tgz
+ tset/POSIX.os/files/link/link.c
Here I quote just a part from tset/POSIX.os/files/link/link.c,
The function tblink() behaves as a wrapper for link(2) with the error
checking.
When the filesystem is unknown to pathconf(_PC_LINK_MAX), 'link_max' may
be incorrect and LSB cannot pass this test.
test15()
{
creat(t15a_file, MODEANY);
link_max = pathconf(t15a_file, _PC_LINK_MAX);
/* create lesser of LINK_MAX and PCTS_LINK_MAX links successfully */
/* i.e. make (testmax-1) link() calls, as there is 1 link already */
testmax = link_max;
for (i = 0; i < testmax-1; i++)
{
(void) sprintf(links[i], "L%ld", i+1);
if (tblink(t15a_file, links[i], SUCCEED, NOERROR) != SUCCEED)
break;
}
/* if LINK_MAX is testable, next link gives EMLINK */
(void) tblink(t15a_file, t15b_file, SYSERROR, EMLINK);
}
J. R. Okajima
next prev parent reply other threads:[~2009-12-06 9:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-06 7:58 [RFC 0/5] pathconf(3) with _PC_LINK_MAX J. R. Okajima
2009-12-06 7:58 ` [RFC 1/5] vfs, support " J. R. Okajima
2009-12-06 7:59 ` [RFC 2/5] ext2, " J. R. Okajima
2009-12-06 7:59 ` [RFC 3/5] ext3, " J. R. Okajima
2009-12-06 7:59 ` [RFC 4/5] nfs, " J. R. Okajima
2009-12-06 7:59 ` [RFC 5/5] tmpfs, " J. R. Okajima
2009-12-06 8:39 ` [RFC 0/5] " Al Viro
2009-12-06 9:09 ` hooanon05 [this message]
2009-12-06 21:39 ` tytso
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=11114.1260090546@jrobl \
--to=hooanon05@yahoo.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=stewb@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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