All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Dake <sdake-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] change thread-unsafe readdir to thread-safe readdir_r calls
Date: Wed, 07 Jul 2010 14:24:45 -0700	[thread overview]
Message-ID: <4C34F09D.6080908@redhat.com> (raw)
In-Reply-To: <20100707204712.GK4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

On 07/07/2010 01:47 PM, Jason Gunthorpe wrote:
> On Wed, Jul 07, 2010 at 12:14:16PM -0700, Steven Dake wrote:
>
>>> But, you surely could not have seen a bug on Linux that was caused by
>>> this - so why was this patch prepared?
>
>> We redefine all the non-thread-safe posix calls in our package (such as
>> readdir) to assert(0).  This prevents their usage in our app.  The
>> reason we do this is to prevent plugin developers from writing plugins
>> that use non-thread-safe posix APIs.  Our app is portable, where the
>> glibc semantics you describe above are not present.  POSIX is blank on
>> this issue, and was addressed in readdir_r.
>
> Well, if you are already creating wrappers, wouldn't it be better to
> provide wrappers that provide the glibc functionality on platforms you
> port to that don't already do that, rather than forbid a perfectly
> functional, and thread safe, call?
>

Not sure how to map a readdir to readdir_r on a thread unsafe system... 
  perhaps with thread keys.  In any regard, seems pointless, readdir_r 
is there and what POSIX specifies for this purpose.

> FWIW, I've always considered readdir_r to be broken, you pass in a
> buffer without passing in a size and hope everything works out. Your

I also have objections to some POSIX standard APIs - however, using 
non-reentrant POSIX apis when reentrant POSIX APIs are available seems 
counterproductive.

> proposed patch to libibverbs is also not-portable because it uses
> NAME_MAX, not pathconf.. Sigh POSIX.
>

On bsd/solaris/darwin/linux, NAME_MAX is defined.  Not sure which other 
POSIX systems one would care about..

> I guess, as a general question, do you know of any libc
> implementations that actually use a static buffer for readdir and
> would require readdir_r to function properly?

I have not looked at each libc's implementation to see if it matches the 
glibc behaviour.  The resolution provided by glibc seems like an 
enhancement over POSIX, where the behaviour is unspecified.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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:[~2010-07-07 21:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 18:37 [PATCH] change thread-unsafe readdir to thread-safe readdir_r calls Steven Dake
     [not found] ` <1278527821-14804-1-git-send-email-sdake-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-07 18:52   ` Jason Gunthorpe
     [not found]     ` <20100707185257.GJ4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-07-07 19:14       ` Steven Dake
     [not found]         ` <4C34D208.1000705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-07 20:47           ` Jason Gunthorpe
     [not found]             ` <20100707204712.GK4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-07-07 21:24               ` Steven Dake [this message]
     [not found]                 ` <4C34F09D.6080908-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-07 21:49                   ` Jason Gunthorpe
     [not found]                     ` <20100707214920.GN4630-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-07-07 22:17                       ` Steven Dake
2010-07-07 18:54   ` Roland Dreier
     [not found]     ` <adatyobyvg7.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-07 19:17       ` Steven Dake
  -- strict thread matches above, loose matches on Subject: below --
2010-07-07 22:14 Steven Dake
     [not found] ` <1278540873-3857-1-git-send-email-sdake-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-08 18:27   ` Roland Dreier
     [not found]     ` <adalj9lzv4r.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-08 18:47       ` Jason Gunthorpe
2010-07-21 18:06   ` Roland Dreier
     [not found]     ` <adak4ooogjj.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-21 18:33       ` Steven Dake

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=4C34F09D.6080908@redhat.com \
    --to=sdake-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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 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.