Thread: Some additions/#ifdefs to target new OS NetWare

Some additions/#ifdefs to target new OS NetWare

From
Ulrich Neumann
Date:
Hello,

I am working on the port of PostgreSQL to NetWare.

During my work i�ve found the following that need to be added to
the sources in order to compile postgreSQL on NetWare. There
may be some more changes i�ve not seen until today, but if so
i�ll post the upcomping issues here.


1. The following additions to main.c:
#ifdef N_PLAT_NLM/* NetWare-specific actions on startup */    NWInit();
#endif /* N_PLAT_NLM */

and

#if !defined(__BEOS__) && !defined(N_PLAT_NLM)
if (geteuid() == 0)
{
...


2. in bootstrap.c/cleanup()
static void
cleanup()
{static int    beenhere = 0;
if (!beenhere)    beenhere = 1;else{    elog(FATAL, "Memory manager fault: cleanup called twice.\n");
proc_exit(1);}if(reldesc != (Relation) NULL)    heap_close(reldesc, NoLock);CommitTransactionCommand();
 

#ifdef N_PLAT_NLM   NWCleanUp();
#endif
proc_exit(Warnings);
}


3. in xlog.c
#if !defined(__BEOS__) && !defined(N_PLAT_NLM)if (link(tmppath, path) < 0)    elog(STOP, "link from %s to %s
(initializationof log file %u, segment %u) failed: %m",         tmppath, path, log, seg);unlink(tmppath);
 


4. in fd.c/filepath()
static char *
filepath(const char *filename)
{char       *buf;

#ifdef N_PLAT_NLMbuf = (char *) palloc(strlen(filename) + 1);strcpy(buf, filename);
#else/* Not an absolute path name? Then fill in with database path... */if (*filename != '/'){...

5. in dfmgr.c/load_external_function()
#ifdef N_PLAT_NLM    file_scanner->handle = dlopen(filename, RTLD_LAZY);
#else    file_scanner->handle = pg_dlopen(filename);
#endif


6. in datetime.h
#if !defined(__CYGWIN__) && !defined(N_PLAT_NLM)
#define TIMEZONE_GLOBAL timezone
#else
#define TIMEZONE_GLOBAL _timezone
#endif


7. in dynamic_loader.h
#ifndef N_PLAT_NLM
extern void *pg_dlopen(char *filename);
extern PGFunction pg_dlsym(void *handle, char *funcname);
extern void pg_dlclose(void *handle);
extern char *pg_dlerror(void);
#endif


8. a directory backend/port/netware for some OS specific files I want to maintain.
Please give me some information how I can get access to such a directory and how
I can check in files to this directory. If you have another way please let me know.


As you see these are only some simple #ifdefs that need to be added to the code.


best regards


Ulrich Neumann
Novell Worldwide Developer Support


Re: Some additions/#ifdefs to target new OS NetWare

From
Tom Lane
Date:
Ulrich Neumann <u_neumann@gne.de> writes:
> During my work i�ve found the following that need to be added to
> the sources in order to compile postgreSQL on NetWare.

We'd appreciate a patch (diff -c format), not random snippets of code.

> 2. in bootstrap.c/cleanup()
> #ifdef N_PLAT_NLM
>     NWCleanUp();
> #endif

Unlikely to be the right place for it, if it's needed at all which I
doubt.  (Surely NetWare can manage to provide a *standard* C execution
environment, in which any platform-specific startup and cleanup stuff
is done in the C library?)

> 4. in fd.c/filepath()

> #ifdef N_PLAT_NLM
>     buf = (char *) palloc(strlen(filename) + 1);
>     strcpy(buf, filename);
> #else

I don't believe this either.

> 7. in dynamic_loader.h
> #ifndef N_PLAT_NLM
> extern void *pg_dlopen(char *filename);
> extern PGFunction pg_dlsym(void *handle, char *funcname);
> extern void pg_dlclose(void *handle);
> extern char *pg_dlerror(void);
> #endif

Nope.  Make a platform-specific implementation of pg_dlopen and friends,
just like all the other platforms have done.
        regards, tom lane


Re: Some additions/#ifdefs to target new OS NetWare

From
Ulrich Neumann
Date:
Hi Tom,

thanks for your quick response.

I�ll do it with a patch and I�ll add some code to the OS specific stuff that I
don�t need no. 4 and 7. If I couldn�t avoid no.4 I�ll let you know with some
explanation.

On Netware there is a standard ANSI/POSIX C library with startup and
cleanup possibilities. PostgreSQL is based on a very new one that isn�t
completely finished, so I need NWInit and NWCleanUp at the moment.
This will change in the next weeks so I don�t need NWInit and NWCleanup
on NetWare.

Another question: I�ll present PostgreSQL at Novell�s BrainShare this month
to many Novell customers. Do you have some material that I can use?
(If you want to follow Brainshare you can look at http://www.novell.com/brainshare.)

regards

Ulrich