SunOS patches

From: t-ishii(at)sra(dot)co(dot)jp
To: The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: PostgreSQL HACKERS <pgsql-hackers(at)postgreSQL(dot)org>
Subject: SunOS patches
Date: 1998-02-25 02:51:52
Message-ID: 199802250251.LAA19912@srapc451.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Included are patches for SunOS port based on the Feb 24 snapshot.
Remaining problems are some minor compiling errors of ecpg and strange
NOTICE messages from initdb (known bug?). I have tested the patches
on FreeBSD and Solairs2.6 to make sure they do not break other ports.

o added SunOS support to template/.similar

o changed UNIXSOCK_PATH macro in include/libpq/pqcomm.h. The macro
supposes sprintf() return the length of the result
string. Unfortunately on some platforms such as SunOS sprintf() never
returns value (I guess that behavior was inherited from BSD4.2). So I
changed in more portable way using strlen().

o changed backend/libpq/pqcomm.c. It uses atexit() to unlink an Unix
domain socket when postmaster exits. Again unfortunately SunOS does
not have it. Looking for an alternative, I found a general exiting
callback manager called on_exitpg() has already existed in PostgreSQL!
So I replaced atexit() with on_exitpg().

Tatsuo Ishii
t-ishii(at)sra(dot)co(dot)jp
----------------------------------------------------------------
*** template/.similar.orig Wed Feb 25 10:00:55 1998
--- template/.similar Wed Feb 25 10:03:02 1998
***************
*** 20,22 ****
--- 20,26 ----
powerpc-unknown-linux-gnu=linux-elf
sparc-sun-solaris=sparc_solaris-gcc
sparc-unknown-linux-gnu=linux-elf-sparc
+ sparc-sun-sunos4.1.3=sunos4-gcc
+ sparc-sun-sunos4.1.3_JL=sunos4-gcc
+ sparc-sun-sunos4.1.4=sunos4-gcc
+ sparc-sun-sunos4.1.4_JL=sunos4-gcc
*** backend/libpq/pqcomm.c.orig Wed Feb 25 10:04:28 1998
--- backend/libpq/pqcomm.c Wed Feb 25 10:05:57 1998
***************
*** 645,651 ****
if (family == AF_UNIX)
{
chmod(sock_path, 0777);
! atexit(do_unlink);
}
return (STATUS_OK);
}
--- 645,651 ----
if (family == AF_UNIX)
{
chmod(sock_path, 0777);
! on_exitpg(do_unlink,0);
}
return (STATUS_OK);
}
*** include/libpq/pqcomm.h.orig Wed Feb 25 10:07:25 1998
--- include/libpq/pqcomm.h Wed Feb 25 10:07:41 1998
***************
*** 34,41 ****
/* Configure the UNIX socket address for the well known port. */

#define UNIXSOCK_PATH(sun,port) \
! (sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
! offsetof(struct sockaddr_un, sun_path))
/*
* We do this because sun_len is in BSD's struct, while others don't.
* We never actually set BSD's sun_len, and I can't think of a
--- 34,41 ----
/* Configure the UNIX socket address for the well known port. */

#define UNIXSOCK_PATH(sun,port) \
! (sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)), \
! strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
/*
* We do this because sun_len is in BSD's struct, while others don't.
* We never actually set BSD's sun_len, and I can't think of a

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-02-25 03:06:27 Re: [HACKERS] initdb problem
Previous Message t-ishii 1998-02-25 02:48:52 Re: [HACKERS] initdb problem