linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fw-d32yF4oPJVt0XxTmqZlbVQ@public.gmane.org>
To: Daniel Colascione <dancol-CpwT7fMy01Ydnm+yROfE0A@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] document that O_TMPFILE works with shm_open
Date: Tue, 27 Oct 2015 23:19:38 +0100	[thread overview]
Message-ID: <87vb9sc5tx.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <562FF70C.5030600-CpwT7fMy01Ydnm+yROfE0A@public.gmane.org> (Daniel Colascione's message of "Tue, 27 Oct 2015 15:13:32 -0700")

* Daniel Colascione:

> On 10/27/2015 03:12 PM, Florian Weimer wrote:
>> * Daniel Colascione:
>>
>>> This test program works fine. (Watch it work in strace.) This patch is
>>> against git master. It's okay to document accidental features, right?
>>>
>>> int
>>> main()
>>> {
>>>     int shmfd = shm_open(".", O_TMPFILE | O_RDWR | O_EXCL, 0600);
>>>     ftruncate(shmfd, 1000);
>>>     mmap(NULL, 1000, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0);
>>>
>>>     return 0;
>>> }
>>
>> This looks more like a bug to me.  I wouldn't count on it continuing
>> to work.  glibc already tightened the rules for the name once.
>
> I don't think they can break compatibility like that, and besides: it's
> a useful feature, not a bug.

Names not starting with '/' do not have well-defined behavior with
shm_open.  Applications shouldn't rely on that.

> Is it better for people to blindly open files in /dev/shm? Because
> that's what they do today.

memfd_create is the official interface for this purpose.  But neither
O_TMPFILE or memfd_create is very widely supported.

Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-27 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24  7:01 [patch] document that O_TMPFILE works with shm_open Daniel Colascione
     [not found] ` <562B2CD9.80901-CpwT7fMy01Ydnm+yROfE0A@public.gmane.org>
2015-10-27 22:12   ` Florian Weimer
     [not found]     ` <87ziz4c665.fsf-ZqZwdwZz9NfTBotR3TxKnbNAH6kLmebB@public.gmane.org>
2015-10-27 22:13       ` Daniel Colascione
     [not found]         ` <562FF70C.5030600-CpwT7fMy01Ydnm+yROfE0A@public.gmane.org>
2015-10-27 22:19           ` Florian Weimer [this message]
     [not found]             ` <87vb9sc5tx.fsf-ZqZwdwZz9NfTBotR3TxKnbNAH6kLmebB@public.gmane.org>
2015-10-27 22:25               ` Daniel Colascione
2015-12-04 19:40   ` Michael Kerrisk (man-pages)

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=87vb9sc5tx.fsf@mid.deneb.enyo.de \
    --to=fw-d32yf4opjvt0xxtmqzlbvq@public.gmane.org \
    --cc=dancol-CpwT7fMy01Ydnm+yROfE0A@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).