impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Volker (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-5624: Replace "ls -l" with opendir() in ProcessStateInfo
Date Fri, 17 Nov 2017 18:45:57 GMT
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 <csringhofer@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <csringhofer@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dhecht@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <philip@cloudera.com>
Gerrit-Comment-Date: Fri, 17 Nov 2017 18:45:57 +0000
Gerrit-HasComments: No

Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message