From: nicolas sitbon <nicolas.sitbon@gmail.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: epoll_ctl and const correctness
Date: Wed, 25 Mar 2009 18:27:03 +0100 [thread overview]
Message-ID: <84a01a8b0903251027p18fceee4h813f4d9616245a2d@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0903250921230.15216@makko.or.mcafeemobile.com>
Ok for "const correctness", but:
do you keep track of the structure event after the call to epoll_ctl or no?
I mean I found some codes that reuse this structure for multiple call
to epoll_ctl but with different file descriptor, is this allowed?
struct epoll_event ev = {.fd = STDIN_FILENO, .data.fd = STDIN_FILENO};
/* <= one structure for 2 calls */
epoll_ctl(epfd, EPOLL_CTL_ADD, STDIN_FILENO, &ev);
ev.fd = STDOUT_FILENO;
ev.data.fd = STDOUT_FILENO;
epoll_ctl(epfd, EPOLL_CTL_ADD, STDOUT_FILENO, &ev);
Other question:
int epoll_create(int size);
can you please, explain me why size is an int and not a size_t or at
least an unsigned integer?
thanks.
2009/3/25 Davide Libenzi <davidel@xmailserver.org>:
> On Wed, 25 Mar 2009, nicolas sitbon wrote:
>
>> Currently, the prototype of epoll_ctl is :
>>
>> int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
>>
>> I searched in the man of epoll_ctl and google, and it seems that the
>> structure pointed to by event isn't modify, valgrind confirms this
>> behaviour, so am I wrong? or the good prototype is
>>
>> int epoll_ctl(int epfd, int op, int fd, struct epoll_event const *event);
>
> According to the current ctl operations, yes. But doing that would prevent
> other non-const operations to be added later on.
>
>
> - Davide
>
>
>
next prev parent reply other threads:[~2009-03-25 17:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 12:45 nicolas sitbon
2009-03-25 16:23 ` Davide Libenzi
2009-03-25 17:27 ` nicolas sitbon [this message]
2009-03-27 19:43 ` nicolas sitbon
2009-03-25 21:21 ` Jeremy Fitzhardinge
2009-03-25 21:37 ` nicolas sitbon
2009-03-27 9:44 ` nicolas sitbon
2009-03-27 21:47 ` Michael Tokarev
2009-03-27 22:17 ` nicolas sitbon
2009-03-27 22:30 ` nicolas sitbon
2009-03-27 22:40 ` Davide Libenzi
2009-03-27 22:42 ` Michael Tokarev
2009-03-27 22:55 ` nicolas sitbon
2009-03-27 23:01 ` Michael Tokarev
2009-03-27 23:10 ` nicolas sitbon
2009-03-27 23:16 ` Michael Tokarev
2009-03-27 23:25 ` nicolas sitbon
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=84a01a8b0903251027p18fceee4h813f4d9616245a2d@mail.gmail.com \
--to=nicolas.sitbon@gmail.com \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®