Re: darwin pgsql patches

From: Peter Bierman <bierman(at)apple(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: darwin pgsql patches
Date: 2000-11-29 22:21:03
Message-ID: v03130301b64b293e25de@[17.202.21.230]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

At 11:05 AM -0500 11/29/00, Tom Lane wrote:
>Peter Bierman <bierman(at)apple(dot)com> writes:
>> /* placeholder file for a self-test program I plan to write. pmb-001128 */
>
>I think there is a semaphore-testing program in the QNX port; have you
>looked at that?

Yes, and it allowed the user to manually toggle semaphores, but I want to write something that will do more of a full regression sweep and produce a pass or fail result. (Which might be unnecessary if latest darwin kernels actually implement <sys/sem.h> completely, see below.)

>> +#define darwin
>
>Could we make this symbol __darwin__, or something else a little less
>likely to conflict with plain names in the code? (For that matter,
>doesn't the compiler predefine some symbol along this line?)

Sure.
The only symbols darwin gcc defines are:
#define __MACH__ 1
#define __NATURAL_ALIGNMENT__ 1
#define __APPLE__ 1
#define __GNUC_MINOR__ 95
#define __ppc__ 1
#define __GNUC__ 2
#define __STDC__ 1
#define __DYNAMIC__ 1
#define __APPLE_CC__ 912
#define __BIG_ENDIAN__ 1
So defining one in PG via configure seems best.

At 5:30 PM +0100 11/29/00, Peter Eisentraut wrote:
>Peter Bierman writes:
>
>> Here are patches to CVS top of tree that allow darwin to completely
>> build and install. Unfortunately, the sem...() shim does not function
>> correctly yet, so it's not stable enough to use.
>
>We've been through this before. Newer Darwin kernels have semaphore
>support, which means that you'll at least have to compensate for that. I
>believe we agreed that semaphore support for older kernels would be
>available as a patch.

Can you point me to an archive of that discussion? I'd love for it to be true.
I did the patch on a Mac OS X Public Beta machine, and gave it a quick test on the most recent Mac OS X internal build, but I didn't try it without the shim on the latest build. I'll try that.

>> +//#include <sys/sem.h>
>
>No C++ comments.

Good to know.

>> -void *pg_dlopen(const char *filename)
>> +void *pg_dlopen(char *filename)
>
>Why?

All of the other ports do not use the const. The code is called from the main sourcebase assuming it's not const. I chose the quicker fix of having the darwin code match the rest of the source instead of trying to push the more correct const definition back into the rest of the code.

>> +#if defined(darwin) && defined(__ppc__)
>> +static void
>> +tas_dummy()
>> +{
>> + __asm__(" \n\
>
>Here the question was why the existing powerpc code doesn't work. There
>are only syntax differences. Any idea?

I think it has more to do with Apple's forked gcc than anything else. I don't have a LinuxPPC machine to check if adding the rX syntax there would continue to work. Also, the darwin gcc doesn't create the _tas symbol automatically, so it has to be declared in the asm routine.

>> +#if defined(darwin)
>> +#include "../backend/port/darwin/sem.h"
>> +#endif
>
>This doesn't work. There's no guarantee that the source tree is the same
>as the build tree.

Fair enough, what would be the right way to include this file then?

>> 4c6,7
>> < CFLAGS=-O0
>> ---
>> > #CFLAGS=-O2
>
>No commented out things. Either you take -02 or -O0 or you set CFLAGS to
>something else, but it has to be set to something.

Ok. I don't see any reason why -O2 shouldn't work, So I'll just pull the line.

Thanks for the feedback! I'm doing the port for personal reasons, but I think it will be a great feature if Mac OS X GM works with PG.

-pmb

--
bierman(at)apple(dot)com

"4 out of 5 people with the wrong hardware want to run Mac OS X because..."
http://www.newertech.com/oscompatibility/osxinfo.html

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2000-11-29 22:35:27 Re: darwin pgsql patches
Previous Message Peter Eisentraut 2000-11-29 16:30:33 Re: darwin pgsql patches