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 (initialization of 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_NLM
	buf = (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

Mon, 4 Mar 2002 15:02:00 +0200
Ulrich Neumann <u_neumann@gne.de>
Some additions/#ifdefs to target new OS NetWare
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

Mon, 04 Mar 2002 10:27:29 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Some additions/#ifdefs to target new OS NetWare 