Thread: BeOS take 2

BeOS take 2

From
"David Reid"
Date:
Peter,

Here's a new set of diffs.  I ran them using

diff -cr pgsql pgsql_beos -x configure

I also grabbed a new anonymous CVS checkout so they should be OK for
your current tree.  I've not modified anything (though I would normally
remove the lines about .o files only being in the pgsql_beos tree) and
have included the new BeOS files.  The only difference in the new files
is that I've removed the -DBEOS as per your request and the version of
BeOS that is now being targetted (to overcome some of the problems) has
more of the definitions.

Looking at the code in pqcomm.c|h should a new define of
NO_UNIX_SOCKETS be defined to clean up the defines around the unix
socket code?

BTW, the IPC code for BeOS currently has  aLOT of defines of __BEOS__
in it.  Any suggestions?

I await your response with interest again.

david

Re: BeOS take 2

From
Tom Lane
Date:
"David Reid" <david@jetnet.co.uk> writes:
> Looking at the code in pqcomm.c|h should a new define of
> NO_UNIX_SOCKETS be defined to clean up the defines around the unix
> socket code?

Yes, I was thinking that would be a good idea even before you sent
this patch.  We already have QNX and WIN wanting to ifdef out
the unix-domain socket code, so it's time to make an OS-independent
name for that compilation flag.

I'm not sure if HAVE_SYS_UN_H is an appropriate way of testing
for it or not (I see you did it that way in a couple of places).
I'd rather make a new symbol HAVE_UNIX_SOCKETS, I think, and
ifdef the code on that basis.

Also, I object to coding like

      saddr.sa.sa_family = family;
      if (family == AF_UNIX)
      {
+ #ifdef HAVE_SYS_UN_H /* we have unix sockets */
          len = UNIXSOCK_PATH(saddr.un, portName);
          strcpy(sock_path, saddr.un.sun_path);
! #endif
          /*
           * If the socket exists but nobody has an advisory lock on it we
           * can safely delete the file.

If you are going to break the socket code path then you ought to disable
it completely, ie the whole "if (family == AF_UNIX)" path ought to be
commented out so that control must go to the TCP path.  Falling through
a nonfunctional code path is not a good idea.

            regards, tom lane

Re: BeOS take 2

From
Giles Lean
Date:
On Fri, 09 Jun 2000 11:26:40 -0400  Tom Lane wrote:

> I'm not sure if HAVE_SYS_UN_H is an appropriate way of testing
> for it or not (I see you did it that way in a couple of places).
> I'd rather make a new symbol HAVE_UNIX_SOCKETS, I think, and

HAVE_AF_UNIX or HAVE_AF_UNIX_SOCKETS might be clearer about what the
feature includes/excludes.

Regards,

Giles



Re: BeOS take 2

From
Peter Eisentraut
Date:
David Reid writes:

> I've not modified anything (though I would normally remove the lines
> about .o files only being in the pgsql_beos tree)

It seems like you want to run make distclean before making patches.

> Looking at the code in pqcomm.c|h should a new define of
> NO_UNIX_SOCKETS be defined to clean up the defines around the unix
> socket code?

Yup.

> BTW, the IPC code for BeOS currently has  aLOT of defines of __BEOS__
> in it.  Any suggestions?

I didn't see any ifdef __BEOS__ in the IPC code in your patch. (Heck,
you're lucky you have IPC. The QNX port that was new for 7.0 had to
provide its own implementation of semaphores.)

What worries me is that BEOS seems to predefine bool with typedef.
PostgreSQL requires that bool is a `char', so if your system headers think
otherwise (`int' presumably), then we're in for a lot of trouble. How does
it look?


--
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden