From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/9] syscalls: Add epoll_create03
Date: Thu, 9 Jul 2026 16:56:29 +0200 [thread overview]
Message-ID: <20260709145629.GA997675@pevik> (raw)
In-Reply-To: <ak-kwx287miu1Bki@yuki.lan>
> Hi!
> > > +static void setup(void)
> > > +{
> > > + int fd;
> > > +
> > > + variant_info();
> > > +
> > > + maxfds = SAFE_SYSCONF(_SC_OPEN_MAX);
> > > + fds = SAFE_MALLOC(maxfds * sizeof(int));
> > > + memset(fds, -1, maxfds * sizeof(int));
> > > +
> > > + fds[0] = SAFE_OPEN("dummy", O_RDWR | O_CREAT, 0700);
> > > + nfds = 1;
> > > +
> > > + for (int i = 1; i < maxfds; i++) {
> > > + fd = dup(fds[0]);
> > > + if (fd == -1)
> > > + break;
> > > + fds[nfds++] = fd;
> > > + }
> > How many files are created is done via `ulimit -n`, right? (not sure if there
> > is file for it in /proc/sys).
> It's not about created files. There is a per-process limit on the number
> of file descriptors. That can be accessed either via sysconf() or via
> rlimit() and the values are also exported into /proc/$PID/limits.
> > Would it be worth we check that? Or at least check that at least 2 files were
> > opened? Maybe this check should be rather put into dup03.c.
> I guess that it would make more sense to put such check into dup03.c.
OK, let's ignore it.
> However we would have to scan the whole file descriptor table first to
> check on how many fds are already open.
> Something as;
> int used_fds = 0;
> for (i = 0; i < maxfds; i++) {
> if (fcntl(i, F_GETFD) != -1)
> used_fds++;
> }
> Then we can expect that the limit for the test is maxfds - used_fd
+1
I'll try to add it either into my TODO list or to the issues.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-07-09 14:56 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 8:53 [LTP] [PATCH v3 0/9] Add more epoll tests Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 1/9] syscalls: Add epoll_create03 Cyril Hrubis
2026-07-09 10:44 ` [LTP] " linuxtestproject.agent
2026-07-09 14:03 ` Cyril Hrubis
2026-07-09 10:51 ` [LTP] [PATCH v3 1/9] " Petr Vorel
2026-07-09 11:17 ` Petr Vorel
2026-07-09 12:54 ` Cyril Hrubis
2026-07-09 13:40 ` Cyril Hrubis
2026-07-09 14:56 ` Petr Vorel [this message]
2026-07-14 9:20 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 2/9] syscalls: Add epoll_wait08 Cyril Hrubis
2026-07-10 6:15 ` Petr Vorel
2026-07-14 9:24 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 3/9] syscalls: Add epoll_wait09 Cyril Hrubis
2026-07-10 6:41 ` Petr Vorel
2026-07-14 9:35 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 4/9] syscalls: Add epoll_ctl06 Cyril Hrubis
2026-07-10 6:25 ` Petr Vorel
2026-07-14 9:44 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 5/9] syscalls: Add epoll_wait10 Cyril Hrubis
2026-07-10 6:55 ` Petr Vorel
2026-07-14 10:11 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 6/9] syscalls: Add epoll_wait11 Cyril Hrubis
2026-07-10 7:01 ` Petr Vorel
2026-07-14 10:16 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 7/9] SAFE_MACROS: Add SAFE_POLL() Cyril Hrubis
2026-07-10 7:05 ` Petr Vorel
2026-07-14 8:07 ` Andrea Cervesato via ltp
2026-07-14 8:33 ` Andrea Cervesato via ltp
2026-07-14 10:34 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 8/9] syscalls: Add epoll_wait12 Cyril Hrubis
2026-07-10 7:27 ` Petr Vorel
2026-07-14 11:47 ` Cyril Hrubis
2026-07-09 8:53 ` [LTP] [PATCH v3 9/9] syscalls: Remove old epoll-ltp test Cyril Hrubis
2026-07-10 7:30 ` Petr Vorel
2026-07-14 11:48 ` Cyril Hrubis
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=20260709145629.GA997675@pevik \
--to=pvorel@suse.cz \
--cc=chrubis@suse.cz \
--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.