Use non-deprecated APIs for dynloader/darwin.c

Lists: pgsql-hackerspgsql-patches
From: Chris Campbell <chris(at)bignerdranch(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Use non-deprecated APIs for dynloader/darwin.c
Date: 2006-10-08 01:04:26
Message-ID: A9076D86-13E1-415C-8DB6-858276D55E15@bignerdranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Re: Darwin stuff is getting deprecated

http://archives.postgresql.org/pgsql-hackers/2006-09/msg02238.php

Mac OS X has included dlopen() and friends etc since Mac OS X 10.3.
From the dlopen(3) man page:

Mac OS X 10.3 incorporated the dlcompat package written by
Jorge Acereda
<jacereda(at)users(dot)sourceforge(dot)net> and Peter O'Gorman <ogor-
man(at)users(dot)sourceforge(dot)net>.

In Mac OS X 10.4, dlopen was rewritten to be a native part of
dyld.

The attached patch switches to using those APIs in src/backend/port/
dynloader/darwin.c (and passes "make check").

(1) This change requires Mac OS X 10.3 and later. Do we currently
support PostgreSQL on older versions of Mac OS X?

(2) The pg_* functions are such trivial wrappers for the OS's APIs --
should they be turned into macros in dynloader/darwin.h and we can
just delete the .c file?

(3) If we need to continue supporting Mac OS X 10.2 and earlier, I
guess we'll need to add a configure test for the presence of dlopen
()? Is that a check that should only be run on Darwin, or all platforms?

Thanks!

- Chris

Attachment Content-Type Size
dynloader.patch application/octet-stream 2.7 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Use non-deprecated APIs for dynloader/darwin.c
Date: 2006-10-08 18:29:25
Message-ID: 26187.1160332165@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Chris Campbell <chris(at)bignerdranch(dot)com> writes:
> Mac OS X has included dlopen() and friends etc since Mac OS X 10.3.
> The attached patch switches to using those APIs in src/backend/port/
> dynloader/darwin.c (and passes "make check").

Looks good, but I don't think we want to abandon OSX 10.2 support
just yet. I'll revise this to use a configure probe for dlopen.

My inclination is to apply this one now, since it only affects OSX
and should be easily testable, but to hold off on your other patch
for portable Bonjour support until 8.3 devel starts. The portability
implications of that one are unclear, and I don't know how to test it
either, so I think putting it in now is too much risk.

regards, tom lane


From: Chris Campbell <chris(at)bignerdranch(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c
Date: 2006-10-08 18:43:28
Message-ID: 2D06E628-77EC-46B7-933D-CFCBDD800645@bignerdranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Oct 8, 2006, at 14:29, Tom Lane wrote:

> Looks good, but I don't think we want to abandon OSX 10.2 support
> just yet. I'll revise this to use a configure probe for dlopen.

Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
port these patches to the 7.x, 8.0, and 8.1 branches?

BTW, I think the configure probe (only on Darwin, correct?) should
test for the existence of <dlfcn.h>.

> My inclination is to apply this one now, since it only affects OSX
> and should be easily testable, but to hold off on your other patch
> for portable Bonjour support until 8.3 devel starts. The portability
> implications of that one are unclear, and I don't know how to test it
> either, so I think putting it in now is too much risk.

The Bonjour patch wasn't intended to be portable to other platforms
just yet. As submitted, it has the same risks/advantages as this
dlopen() patch -- it only works on 10.3 and later, but isn't
deprecated in 10.4.

If we want to keep 10.2 support for Bonjour, we can test for both
DNSServiceDiscovery.h and dns_sd.h in ./configure, and prefer
dns_sd.h if it's found (which will be the case for 10.3 and 10.4) but
use DNSServiceDiscovery.h if not (which will be the case for 10.2).

Thanks!

- Chris


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c
Date: 2006-10-08 19:39:46
Message-ID: 7084.1160336386@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Chris Campbell <chris(at)bignerdranch(dot)com> writes:
> On Oct 8, 2006, at 14:29, Tom Lane wrote:
>> Looks good, but I don't think we want to abandon OSX 10.2 support
>> just yet. I'll revise this to use a configure probe for dlopen.

> Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
> port these patches to the 7.x, 8.0, and 8.1 branches?

I don't see any particular reason to abandon 10.2 at all, as long as
all it's costing us is a couple dozen lines in dynloader/darwin.c.
As for back-porting, I don't see a strong reason to do that either.
Apple will presumably maintain the compatibility APIs for a long
while yet.

> BTW, I think the configure probe (only on Darwin, correct?) should
> test for the existence of <dlfcn.h>.

I realized that configure is already probing for dlopen(), so I just
used HAVE_DLOPEN. We can add a separate test for the header file if
it proves really necessary, but I bet it's not.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c
Date: 2007-02-14 00:39:08
Message-ID: 200702140039.l1E0d8B04468@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


The Darwin dlopen() patch has already been applied. Where are we on the
Bonjour patch? Do we want code that works on Darwin 10.2 and 10.3?

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

Chris Campbell wrote:
> On Oct 8, 2006, at 14:29, Tom Lane wrote:
>
> > Looks good, but I don't think we want to abandon OSX 10.2 support
> > just yet. I'll revise this to use a configure probe for dlopen.
>
> Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
> port these patches to the 7.x, 8.0, and 8.1 branches?
>
> BTW, I think the configure probe (only on Darwin, correct?) should
> test for the existence of <dlfcn.h>.
>
> > My inclination is to apply this one now, since it only affects OSX
> > and should be easily testable, but to hold off on your other patch
> > for portable Bonjour support until 8.3 devel starts. The portability
> > implications of that one are unclear, and I don't know how to test it
> > either, so I think putting it in now is too much risk.
>
> The Bonjour patch wasn't intended to be portable to other platforms
> just yet. As submitted, it has the same risks/advantages as this
> dlopen() patch -- it only works on 10.3 and later, but isn't
> deprecated in 10.4.
>
> If we want to keep 10.2 support for Bonjour, we can test for both
> DNSServiceDiscovery.h and dns_sd.h in ./configure, and prefer
> dns_sd.h if it's found (which will be the case for 10.3 and 10.4) but
> use DNSServiceDiscovery.h if not (which will be the case for 10.2).
>
> Thanks!
>
> - Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Bonjour patch
Date: 2007-04-02 20:33:25
Message-ID: 200704022033.l32KXP609702@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


With no new version from the author and no working version for all
supported OS/X version, I am saving this patch for 8.4.

This has been saved for the 8.4 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

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

Chris Campbell wrote:
> On Oct 8, 2006, at 14:29, Tom Lane wrote:
>
> > Looks good, but I don't think we want to abandon OSX 10.2 support
> > just yet. I'll revise this to use a configure probe for dlopen.
>
> Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
> port these patches to the 7.x, 8.0, and 8.1 branches?
>
> BTW, I think the configure probe (only on Darwin, correct?) should
> test for the existence of <dlfcn.h>.
>
> > My inclination is to apply this one now, since it only affects OSX
> > and should be easily testable, but to hold off on your other patch
> > for portable Bonjour support until 8.3 devel starts. The portability
> > implications of that one are unclear, and I don't know how to test it
> > either, so I think putting it in now is too much risk.
>
> The Bonjour patch wasn't intended to be portable to other platforms
> just yet. As submitted, it has the same risks/advantages as this
> dlopen() patch -- it only works on 10.3 and later, but isn't
> deprecated in 10.4.
>
> If we want to keep 10.2 support for Bonjour, we can test for both
> DNSServiceDiscovery.h and dns_sd.h in ./configure, and prefer
> dns_sd.h if it's found (which will be the case for 10.3 and 10.4) but
> use DNSServiceDiscovery.h if not (which will be the case for 10.2).
>
> Thanks!
>
> - Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Chris Campbell <chris(at)bignerdranch(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c
Date: 2007-04-02 20:59:08
Message-ID: 200704022059.l32Kx8h13344@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Ah, I already had this on the TODO list with URLs, so I will not put it
in the hold queue.

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

Chris Campbell wrote:
> On Oct 8, 2006, at 14:29, Tom Lane wrote:
>
> > Looks good, but I don't think we want to abandon OSX 10.2 support
> > just yet. I'll revise this to use a configure probe for dlopen.
>
> Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
> port these patches to the 7.x, 8.0, and 8.1 branches?
>
> BTW, I think the configure probe (only on Darwin, correct?) should
> test for the existence of <dlfcn.h>.
>
> > My inclination is to apply this one now, since it only affects OSX
> > and should be easily testable, but to hold off on your other patch
> > for portable Bonjour support until 8.3 devel starts. The portability
> > implications of that one are unclear, and I don't know how to test it
> > either, so I think putting it in now is too much risk.
>
> The Bonjour patch wasn't intended to be portable to other platforms
> just yet. As submitted, it has the same risks/advantages as this
> dlopen() patch -- it only works on 10.3 and later, but isn't
> deprecated in 10.4.
>
> If we want to keep 10.2 support for Bonjour, we can test for both
> DNSServiceDiscovery.h and dns_sd.h in ./configure, and prefer
> dns_sd.h if it's found (which will be the case for 10.3 and 10.4) but
> use DNSServiceDiscovery.h if not (which will be the case for 10.2).
>
> Thanks!
>
> - Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Chris Campbell <chris(at)bignerdranch(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c
Date: 2007-04-02 21:00:50
Message-ID: 200704022100.l32L0o613655@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Actually, can we now say we only support OS/X 10.3 and later. If so, we
can use the patch unchanged.

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

Bruce Momjian wrote:
>
> Ah, I already had this on the TODO list with URLs, so I will not put it
> in the hold queue.
>
> ---------------------------------------------------------------------------
>
> Chris Campbell wrote:
> > On Oct 8, 2006, at 14:29, Tom Lane wrote:
> >
> > > Looks good, but I don't think we want to abandon OSX 10.2 support
> > > just yet. I'll revise this to use a configure probe for dlopen.
> >
> > Maybe we can abandon Mac OS X 10.2 in 8.3 and later? And not back-
> > port these patches to the 7.x, 8.0, and 8.1 branches?
> >
> > BTW, I think the configure probe (only on Darwin, correct?) should
> > test for the existence of <dlfcn.h>.
> >
> > > My inclination is to apply this one now, since it only affects OSX
> > > and should be easily testable, but to hold off on your other patch
> > > for portable Bonjour support until 8.3 devel starts. The portability
> > > implications of that one are unclear, and I don't know how to test it
> > > either, so I think putting it in now is too much risk.
> >
> > The Bonjour patch wasn't intended to be portable to other platforms
> > just yet. As submitted, it has the same risks/advantages as this
> > dlopen() patch -- it only works on 10.3 and later, but isn't
> > deprecated in 10.4.
> >
> > If we want to keep 10.2 support for Bonjour, we can test for both
> > DNSServiceDiscovery.h and dns_sd.h in ./configure, and prefer
> > dns_sd.h if it's found (which will be the case for 10.3 and 10.4) but
> > use DNSServiceDiscovery.h if not (which will be the case for 10.2).
> >
> > Thanks!
> >
> > - Chris
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://www.enterprisedb.com
>
> + If your life is a hard drive, Christ can be your backup. +
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +