[PATCH] Add thread safety to socket_wrapper

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Feb 22 11:30:16 UTC 2018

On Thu, Feb 22, 2018 at 12:03:11PM +0100, Andreas Schneider via samba-technical wrote:
> On Thursday, 22 February 2018 11:46:36 CET Volker Lendecke wrote:
> > On Thu, Feb 22, 2018 at 11:28:30AM +0100, Andreas Schneider via samba-
> technical wrote:
> > > the attached patchset adds thread safety support to socket_wrapper. It is
> > > the ground work for fd passing to test multichannel and smbdirect in
> > > selftest.
> > > 
> > > It would be great to get additional review. If I don't hear anything till
> > > next week Wednesday I'm going to push it.
> > 
> > Not that it's relevant for the cwrap project, still my 2ct:
> > 
> > What's the point of SOCKET_INFO_GET_REFCOUNT? It's even more
> > characters in source code. Also, SOCKET_INFO_GET hides the reference
> > to a global variable. Why? These macros make the code harder to read,
> > at least for me. Macros can have their place, but what's the reasoning
> > here?
> we implemented it that way, that in future steps, we just have to change 
> SOCKET_INFO_GET() and not modify the complete source code again and again. We 
> wanted to keep changes minimal if possible. Yes, currently it is a global 
> variable but that will change. I hope our TODO list (appended at the end) 
> helps you to understand the master plan behind it.

To me, helper functions are always preferrable. They give improved
error checking, and less hassle with variable name conflicts. See
https://en.wikipedia.org/wiki/Hygienic_macro for info on that. C in
contrast to scheme just does not have hygienic macros. Helper
functions also allow for anonymous structures when added to a separate


Besuchen Sie die verinice.XP 2018 in Berlin,
Anwenderkonferenz für Informationssicherheit
vom 21.-23.03.2018 im Sofitel Kurfürstendamm
Info & Anmeldung hier: http://veriniceXP.org

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

More information about the samba-technical mailing list