mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
>> xlog.c : special case for beos to avoid 'link' which does not work yet >> beos/sem.c : implementation of new sem_ctl call (GETPID) and a new >sem_op >> flag (IPCNOWAIT) >> dynloader/beos.c : add a verification of symbol validity (seem that the >> loader sometime return OK with an invalid symbol) >> postmaster.c : add beos forking support for the new checkpoint process >> postgres.c : remove beos special case for getrusage >> beos.h : Correction of a bas definition of AF_UNIX, misc defnitions >> >> >> thanks >> >> >> cyril Cyril VELTER
77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* dynloader.c
|
|
* Dynamic Loader for Postgres for BeOS
|
|
*
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
*
|
|
* IDENTIFICATION
|
|
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.4 2000/12/18 18:45:04 momjian Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
#include "utils/dynamic_loader.h"
|
|
#include "utils/elog.h"
|
|
|
|
|
|
void *
|
|
pg_dlopen(char *filename)
|
|
{
|
|
image_id* im;
|
|
|
|
/* Handle memory allocation to store the Id of the shared object*/
|
|
im=(image_id*)(malloc(sizeof(image_id)));
|
|
|
|
/* Add-on loading */
|
|
*im=beos_dl_open(filename);
|
|
|
|
return im;
|
|
}
|
|
|
|
|
|
char *
|
|
pg_dlerror()
|
|
{
|
|
static char errmsg[] = "Load Add-On failed";
|
|
return errmsg;
|
|
}
|
|
|
|
PGFunction
|
|
pg_dlsym(void *handle, char *funcname)
|
|
{
|
|
PGFunction fpt;
|
|
|
|
/* Checking that "Handle" is valid */
|
|
if ((handle) && ((*(int*)(handle))>=0))
|
|
{
|
|
/* Loading symbol */
|
|
if(get_image_symbol(*((int*)(handle)),funcname,B_SYMBOL_TYPE_TEXT,(void**)&fpt)==B_OK);
|
|
{
|
|
/* Sometime the loader return B_OK for an inexistant function with an invalid address !!!
|
|
Check that the return address is in the image range */
|
|
image_info info;
|
|
get_image_info(*((int*)(handle)),&info);
|
|
if ((fpt<info.text) || (fpt>=(info.text+info.text_size))) return NULL;
|
|
return fpt;
|
|
}
|
|
elog(NOTICE, "loading symbol '%s' failed ",funcname);
|
|
}
|
|
elog(NOTICE, "add-on not loaded correctly");
|
|
return NULL;
|
|
}
|
|
|
|
void
|
|
pg_dlclose(void *handle)
|
|
{
|
|
/* Checking that "Handle" is valid */
|
|
if ((handle) && ((*(int*)(handle))>=0))
|
|
{
|
|
if (beos_dl_close(*(image_id*)handle)!=B_OK)
|
|
elog(NOTICE, "error while unloading add-on");
|
|
free(handle);
|
|
}
|
|
} |