Re: [HACKERS] Snapshot 270198 compile error

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: goran(at)bildbasen(dot)se (Goran Thyni)
Cc: fenix(at)am(dot)ring(dot)ru, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Snapshot 270198 compile error
Date: 1998-01-27 12:37:07
Message-ID: 199801271237.HAA00806@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> On linux-elf:
> pqcomm.c: In function `StreamServerPort':
> pqcomm.c:605: structure has no member named `sun_len'
> pqcomm.c: In function `StreamOpen':
> pqcomm.c:760: structure has no member named `sun_len'
>
> Yes,
> the sun_len member of struct sockaddr_un is BSD-specific.
> It is not there in Linux, nor in a SVR4-system we run here.
>
> I had hard-coded the extra offset to 1 in the UNIXSOCK_PATH macro,
> maybe 2 or 4 works OK on all systems.

Gee, thanks. This does help tremendously. The protocol overhaul person
did not have the sun_len field, thought the +1 as a mistake of counting
the trailing null and removed it. I will apply the following patch
which should fix the situation. One problem is that under BSD, we never
set the sun_len field, but it still seems to work, and I can't think of
a platform-safe way of doing the assignment, so I will leave it alone.

---------------------------------------------------------------------------

*** ./include/libpq/pqcomm.h.orig Tue Jan 27 07:25:25 1998
--- ./include/libpq/pqcomm.h Tue Jan 27 07:36:34 1998
***************
*** 35,42 ****

#define UNIXSOCK_PATH(sun,port) \
(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
! sizeof ((sun).sun_len) + sizeof ((sun).sun_family))
!

/*
* These manipulate the frontend/backend protocol version number.
--- 35,46 ----

#define UNIXSOCK_PATH(sun,port) \
(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
! + 1 + sizeof ((sun).sun_family))
! /*
! * + 1 is for BSD-specific sizeof((sun).sun_len)
! * We never actually set sun_len, and I can't think of a
! * platform-safe way of doing it, but the code still works. bjm
! */

/*
* These manipulate the frontend/backend protocol version number.

--
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darren King 1998-01-27 13:43:29 Re: [HACKERS] No: implied sort with group by
Previous Message Bruce Momjian 1998-01-27 12:21:12 Re: [HACKERS] postmaster crash and .s.pgsql file