All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 10/13] getdtablesize01: Handle ENFILE errno
Date: Fri, 01 Dec 2017 15:30:51 +0000	[thread overview]
Message-ID: <874lpazcr8.fsf@e105922-lin.cambridge.arm.com> (raw)
In-Reply-To: <20171201133857.GB30225@rei> (Cyril Hrubis's message of "Fri, 1 Dec 2017 14:38:57 +0100")

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> > When process has exhausted the maximal number of file descriptors it can
>> > open we are supposted to fail with EMFILE, when that happened to the
>> > whole system before we hit the per process limit we get ENFILE. So I was
>> > suggesting that we may as well check that we were able to open expected
>> > number of file descriptors and that the last open() failed with EMFILE.
>> 
>> But isn't that we check already ? I mean, the test already gets the limit
>> on number of open files for this process and tries to open one less fd.
>
> As far as I can tell it tries to open as much fds as is the limit, the
> loop is kind of silly since it starts at 1 and the condition is <= but
> that should call open the open number of limit times.
>
>> So I don't think we should check that error. If we get that error, something
>> else is wrong in the accounting and should be treated as an error.
>
> But the loop never finishes and the open() always fails with EMFILE
> because process has at least three fds opened when it starts (the
> stdin/stdout/stderr are inherited from the parent). Hence the loop is
> always broken on fd == -1.
>
> I guess that we may as well change the loop to infinite one, which would
> be less confusing in this case.

Ok, I've changed the for loop to start from 0 and dropped the stopping
condition.

Thanks,
Punit

  reply	other threads:[~2017-12-01 15:30 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 15:59 [LTP] [PATCH v2 00/13] Collection of fixes Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 01/13] Move check_hugepage() helper to mem/lib Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 02/13] thp: ensure THP/hugetlbfs is available Punit Agrawal
2017-11-27 16:20   ` Cyril Hrubis
2017-11-27 16:59     ` Punit Agrawal
2017-11-29 12:44       ` Cyril Hrubis
2017-11-29 13:29         ` Punit Agrawal
2017-11-29 14:34           ` Cyril Hrubis
2017-11-14 15:59 ` [LTP] [PATCH v2 03/13] hugeshmctl01: Convert to LTP synchronisation primitives Punit Agrawal
2017-11-27 16:52   ` Cyril Hrubis
2017-11-27 17:34     ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 04/13] hugeshmctl01: Fix warning about signed/unsigned comparison Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 05/13] hugeshmctl02: Fix allocation size for odd number of hugepages Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 06/13] hugeshmget02: add missing SHM_HUGETLB flag on segment creation Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 07/13] sigwaitinfo01: fix race between sending and dequeueing RT signals Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 08/13] sigwaitinfo01: catch SEGV and report success for bad_address2 testcase Punit Agrawal
2017-11-29 10:29   ` Cyril Hrubis
2017-11-29 13:25     ` Punit Agrawal
2017-11-29 15:33       ` Cyril Hrubis
2017-11-14 15:59 ` [LTP] [PATCH v2 09/13] syscalls/mount03: Copy setuid_test to execute instead of 'TEST FILE' Punit Agrawal
2017-11-29 13:20   ` Cyril Hrubis
2017-11-29 16:50     ` Punit Agrawal
2017-11-30 12:21       ` Cyril Hrubis
2017-11-30 12:56         ` Punit Agrawal
2017-11-30 13:17           ` Cyril Hrubis
2017-11-30 15:56             ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 10/13] getdtablesize01: Handle ENFILE errno Punit Agrawal
2017-11-30 13:12   ` Cyril Hrubis
2017-11-30 16:06     ` Punit Agrawal
2017-11-30 16:20       ` Cyril Hrubis
2017-11-30 16:41         ` Suzuki K Poulose
2017-12-01 13:38           ` Cyril Hrubis
2017-12-01 15:30             ` Punit Agrawal [this message]
2017-11-14 15:59 ` [LTP] [PATCH v2 11/13] perf_event_open: Handle absence of PMU gracefully Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 12/13] hotplug/cpu_hotplug: Repopulate cgroup:cpusets after testing hotplug Punit Agrawal
2017-11-30 13:58   ` Cyril Hrubis
2017-12-01 16:00     ` Punit Agrawal
2017-11-14 15:59 ` [LTP] [PATCH v2 13/13] hotplug/cpu_hotplug: Remove bashism disown from kill_pid() Punit Agrawal
2017-11-21 16:15 ` [LTP] [PATCH v2 00/13] Collection of fixes Punit Agrawal

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=874lpazcr8.fsf@e105922-lin.cambridge.arm.com \
    --to=punit.agrawal@arm.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.