Lars Volker has posted comments on this change. ( http://gerrit.cloudera.org:8080/8546 )
Change subject: IMPALA-5624: Replace "ls -l" with opendir() in ProcessStateInfo ...................................................................... Patch Set 3: > Patch Set 3: > > > > Patch Set 3: > > > > > > > Dan, what's your take? > > > > > > I think the question is where does the structure that is returned > > come from? In the non-reentrant C lib functions, the problem is > > usually that they return a pointer to a static structure, so if you > > call the function again (or concurrently), the returned structure > > can be overwritten. > > > > I double checked the opendir() implementation in sysdeps/posix/opendir.c > > and it does not return any static structures but calls malloc() to > > get a new DIR*. > > I was talking about the return value of readdir() (dirent*). Ah, I see, sorry for the confusion. readdir() only accesses the DIR* struct that is passed as a parameter (I checked that). The DIR* struct gets created by opendir() and does not share data structures with other DIR*s. It contains a fd, which is different for every DIR*, too. readdir() eventually calls getdents(2) and copies the result into the DIR* struct. -- To view, visit http://gerrit.cloudera.org:8080/8546 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibffae8069a62e100abbfa7d558b49040b095ddc0 Gerrit-Change-Number: 8546 Gerrit-PatchSet: 3 Gerrit-Owner: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Dan Hecht <dhe...@cloudera.com> Gerrit-Reviewer: Lars Volker <l...@cloudera.com> Gerrit-Reviewer: Philip Zeyliger <phi...@cloudera.com> Gerrit-Comment-Date: Fri, 17 Nov 2017 18:45:57 +0000 Gerrit-HasComments: No