From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Lars-Peter Clausen <lars@metafoo.de>, Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: Re: [PATCH] ALSA: control: add .flush operation to release blocked operation
Date: Fri, 31 Jul 2015 06:30:07 +0900 [thread overview]
Message-ID: <55BA975F.9000504@sakamocchi.jp> (raw)
In-Reply-To: <55B67B11.3070808@metafoo.de>
Hi, Iwai-san, Lars,
Thanks for your replies. And I realize that this idea is wrong.
I wrote somewhat that blocking operations to file descriptors for files
on filesystems, sockets, virtual character devices are released after
closing. But this is completely wrong. I did test wrongly and had
misunderstanding about these behaviour. Please drop this patch from your
memory...
On Jul 28 2015 03:40, Lars-Peter Clausen wrote:
> Is it really a problem? I'd say it's the expected behavior. What close
> does is destroys the mapping between the process local fd and the global
> struct file. It does not abort any pending blocking operations. If you
> want to wakeup a blocking operation you need to send a signal to the
> thread.
Indeed. Usually, blocking operations are not waken up after closing. We
have only a way to do it, sending signals.
>> One thing I'm not sure is the
>> case where the file descriptor is copied. Is the flush op called only
>> if one of the multiple processes is closed, or is it after all fps
>> closed? In the former case, this might be a problem.
>
> Should be on every close. Especially with close-on-exec this quickly
> becomes a problem.
After dup()/dup2()/dup3(), file descriptors are duplicated but still
refer to the same file structure. This is the same as execve() executed.
These operations are completed within VFS and character device drivers
or file system implementation can do nothing for it.
We can set a flag of 'close_on_exec' to file descriptors by several
ways. When a file descriptsor has this flag, the old file descriptors
are closed when duplicated, even if it's an operation of duplicating
process image.
On Jul 27 2015 19:27, Takashi Iwai wrote:
> BTW, a minor nitpick: please omit the explicit 0 or 1 comparison for
> subscribed field. It's a (kind of) boolean flag, so a form like
> if (ctl->subscribed)
>
> or
> if (!ctl->subscribed)
>
> is preferred.
OK, sure. I have a habit to write codes so that the type of variables
are clear at a glance (I'm not so familiar with weak-typing language).
When posting, I'll folliw to C-like idioms.
# My brain may be beaten by terrible summer heat...
Thanks
Takashi Sakamoto
prev parent reply other threads:[~2015-07-30 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-25 11:53 [RFC][PATCH] ALSA: control: ensure returning from blocked system-call after closing Takashi Sakamoto
2015-07-25 11:54 ` [PATCH] ALSA: control: add .flush operation to release blocked operation Takashi Sakamoto
2015-07-27 10:27 ` Takashi Iwai
2015-07-27 18:40 ` Lars-Peter Clausen
2015-07-30 21:30 ` Takashi Sakamoto [this message]
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=55BA975F.9000504@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=lars@metafoo.de \
--cc=tiwai@suse.de \
/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.