[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] openat: reduce syscalls in first probe of /proc
From: |
Jim Meyering |
Subject: |
Re: [PATCH] openat: reduce syscalls in first probe of /proc |
Date: |
Tue, 10 May 2011 11:32:06 +0200 |
Bastien ROUCARIES wrote:
> I disagree here:
>> else
>> {
>> + /* Detect whether /proc/self/fd/../fd exists. On Linux, that name
>> + resolves to /proc/self/fd, which was opened above. However, on
>> + Solaris, it may resolve to /proc/self/fd/fd, which cannot
>> exist,
>> + since all names in /proc/self/fd are numeric. */
>
> Will be better
> /* Detect whether /proc/self/fd/%i/../fd exists. Where %i is an
> open fd on /proc/self/fd.
> On Linux, that name
> resolves to /proc/self/fd, which was opened above. However, on
> Solaris, it may resolve to /proc/self/fd/fd, which cannot exist,
> since all names in /proc/self/fd are numeric. */
Thanks for catching that.
I've tweaked it slightly. Since it's in your name,
I'll wait until you ACK before pushing:
>From 38ed8cbdaac9ed0f1c8cbedfac78ca3f10991528 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20Roucari=C3=A8s?= <address@hidden>
Date: Tue, 10 May 2011 11:30:19 +0200
Subject: [PATCH] openat: correct new comment
* lib/openat-proc.c (openat_proc_name): Correct the comment.
---
ChangeLog | 5 +++++
lib/openat-proc.c | 9 +++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5a89d18..74919bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-10 Bastien Roucariès <address@hidden>
+
+ openat: correct new comment
+ * lib/openat-proc.c (openat_proc_name): Correct the comment.
+
2011-05-10 Jim Meyering <address@hidden>
openat: add comments
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
index c326ffc..2e2e966 100644
--- a/lib/openat-proc.c
+++ b/lib/openat-proc.c
@@ -80,10 +80,11 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd,
char const *file)
proc_status = -1;
else
{
- /* Detect whether /proc/self/fd/../fd exists. On Linux, that name
- resolves to /proc/self/fd, which was opened above. However, on
- Solaris, it may resolve to /proc/self/fd/fd, which cannot exist,
- since all names in /proc/self/fd are numeric. */
+ /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the
+ number of a file descriptor open on /proc/self/fd. On Linux,
+ that name resolves to /proc/self/fd, which was opened above.
+ However, on Solaris, it may resolve to /proc/self/fd/fd, which
+ cannot exist, since all names in /proc/self/fd are numeric. */
char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)];
sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd");
proc_status = access (dotdot_buf, F_OK) ? -1 : 1;
--
1.7.5.1.354.g761178