From: | Thomas Boos <Thomas(dot)Boos(at)mchu(dot)si-t(dot)de> |
---|---|
To: | Mailinglist pgsql-port <pgsql-ports(at)postgresql(dot)org> |
Subject: | postgresql with gcc on dec aplha osf |
Date: | 2000-04-17 15:15:18 |
Message-ID: | 38FB2A86.C3833C47@mchu.si-t.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-ports |
hello,
i'm using postgresql 6.5.3 on a dec alpha.
i have tried to compile it with gcc and ran into many errors.
after i have inspected some of these errors, it seems, that
there is a problem with the s_lock (semaphore, shared memory).
some hours later, i have found some interesting definitions,
which let me come to the conclution, that this version of
postgresql could never be compiled on a dec alpha with gcc.
the bug is in postgresql-6.5.3/src/include/os.h
which is a link to postgresql-6.5.3/src/include/port/alpha.h
in relation to postgresql-6.5.3/src/include/storage/s_lock.h.
there is the following problem:
os.h says:
typedef msemaphore slock_t;
and msemaphore (from <sys/mman.h>) is:
typedef struct {
int msem_state;
int msem_wanted;
} msemaphore;
which means, it is a aggregation.
if we look on the lines 81 - 107 from the file s_lock.h we could
see the definitions for alpha (__alpha__) with gcc (__GNUC__).
there is following line:
#define S_UNLOCK(lock) {__asm__("mb"); *(lock) = 0; }
but there is no definition of S_INIT_LOCK, which means that the
definition in the lines 380 - 382 will be used:
#define S_INIT_LOCK(lock) S_UNLOCK(lock)
ok. so far so good (or not :) ).
then we should take a look into
postgresql-6.5.3/src/backend/storage/buffer/buf_init.c
to the line 219:
S_INIT_LOCK(&(buf->io_in_progress_lock));
definition of buf:
BufferDesc *buf;
definition of BufferDesc (in file
postgresql-6.5.3/src/include/storage/buf_internals.h):
typedef struct sbufdesc BufferDesc;
in sbufdesc is io_in_progress_lock defined as (line 101):
slock_t io_in_progress_lock;
when i replace the variable by its type (surrounded by $), i
will get the following line:
S_INIT_LOCK(&($slock_t$));
now, lets use our brain and we will get:
{__asm__("mb"); *($msemaphore$) = 0; }
wow, its a nice thing, but the compiler doesn't like things such
this ones.
you can't assign something to a structure!
after some more investigation i discoverd, that there is a semaphore
mechanism, which will be used, if we compile with the normal cc.
but someone has the opinion, that we can't use this mechanism, when
we want to use gcc. ok, i won't doubt it, but he has forgotten to
replace msemaphore with a simple long.
this means, imho postgresql-6.5.3/src/include/port/alpha.h should look
like this:
1 #define USE_POSIX_TIME
2 #define DISABLE_XOPEN_NLS
3 #define HAS_TEST_AND_SET
4 #include <sys/mman.h> /* for msemaphore */
5
6 #if defined(__GNUC__)
7 typedef long slock_t;
8 #else
9 typedef msemaphore slock_t;
10 #endif
11
12 /* some platforms define __alpha, but not __alpha__ */
13 #if defined(__alpha) && !defined(__alpha__)
14 #define __alpha__
15 #endif
ok, thats all.
after "make all", "make install" and a initdb, everything works fine.
i could do a regression test and the results looks good. (only a few
failure,
look at the attachment)
i hope, i'm not wrong and i could help someone.
thanks for your patience... :)
--
MfG
Thomas Boos
Diplom Informatiker
DaimlerChrysler Aerospace Verteidigung und Zivile Systeme
Defense and Civil Systems
Knowledge Based Systems Engineering
Command Control Communications Intelligence
VCE13 Fax: +49 89 3179 2893
Landshuter Str. 26 Tel: +49 89 3179 3231
85716 Unterschleissheim
Attachment | Content-Type | Size |
---|---|---|
regress.out | text/plain | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Adriaan Joubert | 2000-04-17 16:02:46 | Re: postgresql with gcc on dec aplha osf |
Previous Message | Ryan Kirkpatrick | 2000-04-17 02:48:46 | Re: [HACKERS] Linux/Alpha and Postgres 7.0 Beta Status |