Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-15 Thread Bruce Momjian
Giles Lean wrote:
> 
> Tom Lane  wrote:
> 
> > I suppose that at least some of the *BSD herd really do predefine some
> > of the symbols being attributed to them here, but I would like to see
> > something authoritative about which and what.
> 
> Documentation follows, but first the summary:
> 
> FreeBSD: __FreeBSD__
> NetBSD:  __NetBSD__
> OpenBSD: __OpenBSD__

Great.  I have updated pg_upgrade to use those defines.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-15 Thread Bruce Momjian
Tom Lane wrote:
> I'm not even too sure what "bsdi" is, but I'm suspicious of that branch
> too.  A search of our code finds
> 
> contrib/pg_upgrade/file.c: 248: #elif defined(freebsd) || defined(bsdi) || 
> defined(__darwin__) || defined(openbsd)
> src/backend/utils/misc/ps_status.c: 67: #elif (defined(BSD) || 
> defined(__bsdi__) || defined(__hurd__)) && !defined(__darwin__)
> src/include/port.h: 355: #if defined(bsdi) || defined(netbsd)
> src/port/fseeko.c: 20: #if defined(__bsdi__) || defined(__NetBSD__)
> src/port/fseeko.c: 24: #ifdef bsdi
> src/port/fseeko.c: 47: #ifdef bsdi
> src/port/fseeko.c: 55: #ifdef bsdi
> src/port/fseeko.c: 66: #ifdef bsdi
> src/port/fseeko.c: 76: #ifdef bsdi
> src/port/fseeko.c: 87: #ifdef bsdi
> 
> which leaves one with not a lot of warm fuzzies that we know how to
> spell the symbol for either bsdi or netbsd.  (Oh, and shouldn't
> this pg_upgrade check be looking for netbsd too?)

BSDi defines "bsdi" and "__bsdi__", but our code was clearly
inconsistent.  I have changed all references to __bsdi__.

FYI, src/tools/ccsym will show you your predefined symbols.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-15 Thread Andrew Dunstan



Bruce Momjian wrote:

Peter Eisentraut wrote:
  

On l?r, 2010-05-15 at 00:23 -0400, Robert Haas wrote:


It's a commercial distribution of BSD.  I remember it being pretty
nice when I used it 10+ years ago, but it sounds like it's dead now.
  

BSDI is the company that produced BSD/OS, which was Bruce's main
development environment at some point, which is why it has left
excruciating traces all over the PostgreSQL source.



Uh, I still run BSDi.

  


That's more or less the OS equivalent of writing with a quill. :-)

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-15 Thread Bruce Momjian
Peter Eisentraut wrote:
> On l?r, 2010-05-15 at 00:23 -0400, Robert Haas wrote:
> > It's a commercial distribution of BSD.  I remember it being pretty
> > nice when I used it 10+ years ago, but it sounds like it's dead now.
> 
> BSDI is the company that produced BSD/OS, which was Bruce's main
> development environment at some point, which is why it has left
> excruciating traces all over the PostgreSQL source.

Uh, I still run BSDi.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-15 Thread Giles Lean

Tom Lane  wrote:

> I suppose that at least some of the *BSD herd really do predefine some
> of the symbols being attributed to them here, but I would like to see
> something authoritative about which and what.

Documentation follows, but first the summary:

FreeBSD: __FreeBSD__
NetBSD:  __NetBSD__
OpenBSD: __OpenBSD__

I believe those #defines also tell you what the release is.
I didn't look into their encoding schemes just now, but can if
you want.

(OS X aka Darwin is harder: they seem to like __APPLE__, but
to determine the OS version the best I can see is
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__, which is quite
horrid.)

Re BSDi, I have no idea really but based on Google searching
I'd bet on __bsdi__.

Per Wikipedia BSDi was discontinued in 2003 and support ended
in 2004.  I submit that anyone still using it is not likely to
be updating their PostgreSQL installation, so +1 from me for
dropping support for it unless a volunteer using it comes
forward.

FYI (and you may know this, but I didn't learn until recently)
GCC will tell you quite easily what #defines are predefined,
and all those platforms use gcc:

  $ cc -E -dM - < /dev/null | grep FreeBSD  
  #define __FreeBSD_cc_version 73
  #define __VERSION__ "4.2.1 20070719  [FreeBSD]"
  #define __FreeBSD__ 7

But you wanted something authoritative, so here's what I found:

FreeBSD
===

  http://www.freebsd.org/doc/en/books/porters-handbook/porting-versions.html

  "__FreeBSD__ is defined in all versions of FreeBSD."

NetBSD
==

>From the NetBSD-1.1 release notes (November, 1995):

  "* implement new cpp predefine strategy
 define __NetBSD__, ..."

This is still the current behaviour, although the current
release is 5.0.2 from February 2010.

OpenBSD
===

  http://www.openbsd.org/porting.html

  "Generic Porting Hints

* __OpenBSD__ should be used sparingly, if at all. Constructs that
  look like

#if defined(__NetBSD__) || defined(__FreeBSD__)

  are often inappropriate. Don't add blindly __OpenBSD__ to
  it. Instead, try to figure out what's going on, and what actual
  feature is needed."

Regards,

Giles

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-14 Thread Peter Eisentraut
On lör, 2010-05-15 at 00:23 -0400, Robert Haas wrote:
> It's a commercial distribution of BSD.  I remember it being pretty
> nice when I used it 10+ years ago, but it sounds like it's dead now.

BSDI is the company that produced BSD/OS, which was Bruce's main
development environment at some point, which is why it has left
excruciating traces all over the PostgreSQL source.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-14 Thread Peter Eisentraut
On lör, 2010-05-15 at 00:15 -0400, Tom Lane wrote:
> I suppose that at least some of the *BSD herd really do predefine some
> of the symbols being attributed to them here, but I would like to see
> something authoritative about which and what.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-versions.html


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-14 Thread Robert Haas
On Sat, May 15, 2010 at 12:37 AM, Tom Lane  wrote:
> Robert Haas  writes:
>> On Sat, May 15, 2010 at 12:15 AM, Tom Lane  wrote:
>>> I'm not even too sure what "bsdi" is, but I'm suspicious of that branch
>>> too.  A search of our code finds
>
>> It's a commercial distribution of BSD.  I remember it being pretty
>> nice when I used it 10+ years ago, but it sounds like it's dead now.
>
> Um ... so do you remember which symbol they predefined?  It's pretty
> lame that we can't even spell it consistently in one source file.
> (Or, if BSDI is so dead that no one remembers, shouldn't we rip out
> those #if branches?)

No clue.  I agree.  (Yes.)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-14 Thread Tom Lane
Robert Haas  writes:
> On Sat, May 15, 2010 at 12:15 AM, Tom Lane  wrote:
>> I'm not even too sure what "bsdi" is, but I'm suspicious of that branch
>> too.  A search of our code finds

> It's a commercial distribution of BSD.  I remember it being pretty
> nice when I used it 10+ years ago, but it sounds like it's dead now.

Um ... so do you remember which symbol they predefined?  It's pretty
lame that we can't even spell it consistently in one source file.
(Or, if BSDI is so dead that no one remembers, shouldn't we rip out
those #if branches?)

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] predefined macros for various BSD-based systems?

2010-05-14 Thread Robert Haas
On Sat, May 15, 2010 at 12:15 AM, Tom Lane  wrote:
> I'm not even too sure what "bsdi" is, but I'm suspicious of that branch
> too.  A search of our code finds

It's a commercial distribution of BSD.  I remember it being pretty
nice when I used it 10+ years ago, but it sounds like it's dead now.
Too bad.

http://en.wikipedia.org/wiki/Berkeley_Software_Design

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers