OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   07-Oct-2006 12:00:59
  Branch: HEAD                             Handle: 2006100711005800

  Modified files:
    openpkg-src/postgresql  postgresql.patch postgresql.spec

  Log:
    A small patch to allow DSO-based PostgreSQL extensions to be more
    flexible by providing initialization and finishing hooks. This patch was
    contributed by Ralf S. Engelschall to the upstream vendor in August 2006
    and taken over by the upstream vendor for inclusion into the next major
    PostgreSQL release.
    
    
http://groups.google.com/group/pgsql.hackers/browse_frm/thread/ce7858f865a6fecd/19a3f052656f3a69?tvc=1&q=PG_init#19a3f052656f3a69
    
    PS: This allows my OSSP uuid's PostgreSQL extension to finally do the Right 
Thing ;-)

  Summary:
    Revision    Changes     Path
    1.3         +70 -0      openpkg-src/postgresql/postgresql.patch
    1.201       +1  -1      openpkg-src/postgresql/postgresql.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/postgresql/postgresql.patch
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 postgresql.patch
  --- openpkg-src/postgresql/postgresql.patch   16 Feb 2005 16:16:47 -0000      
1.2
  +++ openpkg-src/postgresql/postgresql.patch   7 Oct 2006 10:00:58 -0000       
1.3
  @@ -60,3 +60,73 @@
    # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
   -CPPFLAGS="-D_GNU_SOURCE"
   +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  +
  +-----------------------------------------------------------------------------
  +
  +A small patch to allow DSO-based PostgreSQL extensions to be more
  +flexible by providing initialization and finishing hooks. This patch was
  +contributed by Ralf S. Engelschall to the upstream vendor in August 2006
  +and taken over by the upstream vendor for inclusion into the next major
  +PostgreSQL release.
  +
  
+http://groups.google.com/group/pgsql.hackers/browse_frm/thread/ce7858f865a6fecd/19a3f052656f3a69?tvc=1&q=PG_init#19a3f052656f3a69
  +
  +Index: src/backend/utils/fmgr/dfmgr.c
  +--- src/backend/utils/fmgr/dfmgr.c.orig      2005-10-15 04:49:32 +0200
  ++++ src/backend/utils/fmgr/dfmgr.c   2006-10-07 11:53:58 +0200
  +@@ -60,6 +60,10 @@
  + static char *expand_dynamic_library_name(const char *name);
  + static char *substitute_libpath_macro(const char *name);
  + 
  ++/* types for PostgreSQL-specific DSO init/fini functions */
  ++typedef void (*PG_init_t)(void);
  ++typedef void (*PG_fini_t)(void);
  ++
  + /*
  +  * Load the specified dynamic-link library file, and look for a function
  +  * named funcname in it.  (funcname can be NULL to just load the file.)
  +@@ -77,6 +81,7 @@
  + load_external_function(char *filename, char *funcname,
  +                                        bool signalNotFound, void 
**filehandle)
  + {
  ++    PG_init_t *PG_init;
  +     DynamicFileList *file_scanner;
  +     PGFunction      retval;
  +     char       *load_error;
  +@@ -146,6 +151,13 @@
  +                                                     fullname, load_error)));
  +             }
  + 
  ++            /* optionally give the DSO a chance to initialize by calling a
  ++               PostgreSQL-specific (and this way portable) "_PG_init" 
function
  ++               similar to what dlopen(3) implicitly does with "_init" on 
some
  ++               Unix platforms. */
  ++            if ((PG_init = (PG_init_t *)pg_dlsym(file_scanner->handle, 
"_PG_init")) != NULL)
  ++                    (*PG_init)();
  ++
  +             /* OK to link it into list */
  +             if (file_list == NULL)
  +                     file_list = file_scanner;
  +@@ -187,6 +199,7 @@
  + void
  + load_file(char *filename)
  + {
  ++    PG_fini_t *PG_fini;
  +     DynamicFileList *file_scanner,
  +                        *prv,
  +                        *nxt;
  +@@ -223,6 +236,14 @@
  +                             prv->next = nxt;
  +                     else
  +                             file_list = nxt;
  ++
  ++                    /* optionally give the DSO a chance to finish by calling
  ++                       a PostgreSQL-specific (and this way portable) 
"_PG_fini"
  ++                       function similar to what dlopen(3) implicitly does 
with
  ++                       "_fini" on some Unix platforms. */
  ++                    if ((PG_fini = (PG_fini_t 
*)pg_dlsym(file_scanner->handle, "_PG_fini")) != NULL)
  ++                            (*PG_fini)();
  ++
  +                     clear_external_function_hash(file_scanner->handle);
  +                     pg_dlclose(file_scanner->handle);
  +                     free((char *) file_scanner);
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/postgresql/postgresql.spec
  ============================================================================
  $ cvs diff -u -r1.200 -r1.201 postgresql.spec
  --- openpkg-src/postgresql/postgresql.spec    1 Sep 2006 05:16:19 -0000       
1.200
  +++ openpkg-src/postgresql/postgresql.spec    7 Oct 2006 10:00:58 -0000       
1.201
  @@ -45,7 +45,7 @@
   Group:        Database
   License:      GPL
   Version:      %{V_postgresql}
  -Release:      20060901
  +Release:      20061007
   
   #   package options
   %option       with_server       yes
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to