List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:March 27 2008 9:21am
Subject:re: my_socket that's useful in detecting portability breakage
View as plain text  
Hi!

>>>>> "Stewart" == Stewart Smith <stewart@stripped> writes:

Stewart> Here's an idea/patch I've had floating about that I'm going to bring
Stewart> into the ndb on Windows tree.

Stewart> basically does this:
Stewart> typedef struct { int fd; } my_socket;

Stewart> to give build errors when you go use close() on a socket instead of
Stewart> socketclose() etc.

Stewart> i.e. turns subtle portability bugs into compile errors.

Stewart> More complete patch to come (i.e. one that actually builds the whole
Stewart> server).

Stewart> I'd quite like thoughts/ok on this though.

I think the basic idea is fine.

The only suggestions I have are the following:

- Instead of having 3 include files for sockets, do it with one.
  ie, let my_socket.h handle all cases with ifdefs.
  (Makes it easier to understand the socket interface with one glance)

In my_gobal.h, remove the ifdefs for close_socket() and socket_errno and
change all code to use the new my_socket() calls.
(No reason to have two indirections for the same thing).

Regards,
Monty
Thread
my_socket that's useful in detecting portability breakageStewart Smith13 Mar
  • re: my_socket that's useful in detecting portability breakageMichael Widenius27 Mar
    • re: my_socket that's useful in detecting portability breakageStewart Smith28 Mar
      • Re: my_socket that's useful in detecting portability breakageJoerg Bruehe28 Mar