Subject: problems building src/backend/storage/ipc/s_lock.c

From: [email-masked]
Date: Mon, 31 Oct 94 21:30:59 PST

I'm busy porting postgres 4.2 to NetBSD 1.0 and I came across  the
following error:

cc -O -DPORTNAME_netbsd -DPOSTPORT='"4321"' -DDEADLOCK_TIMEOUT=60 -DPOSTGRESDIR='"/usr/local/postgres"'  -DDATADIR='"/usr/local/postgres/data"'  -DBINDIR='"/usr/local/postgres/bin"'  -I/usr/postgres/src/backend/. -I/usr/postgres/src/backend/obj  -I/usr/postgres/src/backend/tmp  -I/usr/postgres/src/backend/port/netbsd  -c /usr/postgres/src/backend/storage/ipc/s_lock.c
/usr/postgres/src/backend/storage/ipc/s_lock.c: In function `tas':
/usr/postgres/src/backend/storage/ipc/s_lock.c:283: `m' undeclared (first use this function)
/usr/postgres/src/backend/storage/ipc/s_lock.c:283: (Each undeclared identifier is reported only once
/usr/postgres/src/backend/storage/ipc/s_lock.c:283: for each function it appears in.)
*** Error code 1

The code segment that is giving me the problem looks like this

#if defined(__i386__) && defined(__GNUC__)
 
tas(lock)
    slock_t *lock;
{
    slock_t res;
    __asm__("xchgb %0,%1":"=q" (res),"=m" (*m):"0" (0x1));
    return(res);
}
 
line 283 is the __asm__ line. My questin is where is "m" supposed to
be defined and why does this compile for other OS's (i.e. linux freebsd),
or does it. I'm not an assembly guru so any help you can give me is
appreciated.

Thanks,

Jim Bachesta
[email-masked]

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: " (Kai Petzke)" <[email-masked]>
Date: Tue, 1 Nov 1994 11:58:57 +0100

> I'm busy porting postgres 4.2 to NetBSD 1.0 and I came across  the

[...]

> or does it. I'm not an assembly guru so any help you can give me is

No, the (*m) is wrong.  It should be (*lock).

You have started your port from the core distribution of Postgres,
which has only part of the linux or FreeBSD specific changes in
it (eg. those, that Paul Aoki came around to include).

I recommend you to get the FreeBSD (or linux) patches, and apply
them, before you continue.  It will save you lots of doubled work.

Kai