Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id EAA25306 for postgres-redist; Thu, 8 Dec 1994 04:31:25 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199412081231.EAA25306@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from mailgzrz.TU-Berlin.DE (mailgzrz.TU-Berlin.DE [130.149.4.10]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with ESMTP id EAA25296 for <postgres@nobozo.CS.Berkeley.EDU>; Thu, 8 Dec 1994 04:31:22 -0800
Received: from marie.physik.tu-berlin.de by mailgzrz.TU-Berlin.DE 
          with SMTP (PP); Thu, 8 Dec 1994 13:23:16 +0100
Received: by marie.physik.tu-berlin.de (5.0/SMI-SVR4) id AA00043;
          Thu, 8 Dec 1994 13:23:00 --100
From: wpp@marie.physik.tu-berlin.de (Kai Petzke)
Message-Id: <9412081223.AA00043@marie.physik.tu-berlin.de>
Subject: Re: tas.s
To: explorer@vorpal.com (Michael Graff)
Date: Thu, 8 Dec 1994 13:06:44 +0100 (MET)
Cc: postgres@postgres.Berkeley.EDU
In-Reply-To: <199412060751.BAA04308@packrat.vorpal.com> from "Michael Graff" at Dec 6, 94 01:51:30 am
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 912
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Thu, 08 Dec 94 04:31:24 -0800
Resent-XMts: smtp

> 
> 
> I'm working on a quick port to NetBSD/i386-current and need to
> have an example i386 tas.s.

There is no such thing as a quick port of Postgres.

> Could someone mail this to me if
> possible, or tell me where to find it (other than downloading lots
> of megs over a 14.4k line.  ;)


The following works fine under Linux.  Insert into the file:

	~postgres/src/backend/storage/ipc

slock_t should be defined as char.



Kai
------------- snip here ---------------
#if defined(__i386__) && defined(__GNUC__)

static inline tas(lock)
    slock_t *lock;
{
    slock_t res;
    __asm__("xchgb %0,%1":"=q" (res),"=m" (*lock):"0" (0x1));
    return(res);
}

S_LOCK(lock)
    slock_t *lock;
{
    while (tas(lock))
        ;
}

S_UNLOCK(lock)
    slock_t *lock;
{
    *lock = 0;
}

S_INIT_LOCK(lock)
    slock_t *lock;
{
    S_UNLOCK(lock);
}

#endif /* __i386__ && __GNUC__ */

#endif /* HAS_TEST_AND_SET */


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
