$PostgreSQL: pgsql/src/backend/port/darwin/README,v 1.4 2008/03/20 17:55:14 momjian Exp $

Darwin
------

The file system.c included herein is taken directly from Apple's Darwin
open-source CVS archives, and is redistributed under the BSD copyright
notice it bears.  (According to Apple's CVS logs, their version is
identical to the FreeBSD original.)  It provides our own implementation of
the system(3) function, which ought by all rights to be identical to the
one provided in libc on Darwin machines.  Nonetheless, this version works,
whereas the one that actually ships with Mac OS X 10.1 doesn't.  The
shipped version appears to disconnect the calling process from any shared
memory segments it is attached to.  (The symptom seen in PostgreSQL is
that a backend attempting to execute CREATE DATABASE core-dumps.)  I would
love to know why there is a discrepancy between the published source and
the actual behavior --- tgl 7-Nov-2001.

Appropriate bug reports have been filed with Apple --- see 
Radar Bug#s 2767956, 2683531, 2805147.  One hopes we can retire this
kluge in the not too distant future.


As of PostgreSQL 7.3 and Mac OS X 10.1, one should expect warnings
like these while linking the backend:

/usr/bin/ld: warning unused multiple definitions of symbol _system
port/SUBSYS.o definition of _system in section (__TEXT,__text)
/usr/lib/libm.dylib(system.o) unused definition of _system

These are due to overriding system() per the above-described hack.


The bug appears to be repaired in OS X 10.2.6 and later (possibly in
earlier 10.2.* as well, but no systems handy to check).  We #ifdef out
the substitute system() definition on 10.3 and later.
