On Wed, Mar 15, 2006 at 01:14:19AM -0800, Rama Krishna wrote:
> Hi,
>
> I have found cas32() atomic function in </usr/include/sys/atomic.h> (and
> also there is another atomic.h header file in </usr/include/atomic.h> but
> this header file does not have any cas32() function declarations) the
> declaration of cas32 in <sys/atomic.h>
> is as follows
>
> extern uint32_t cas32(uint32_t *target, uint32_t cmp, uint32_t newval);
> extern ulong_t caslong(ulong_t *target, ulong_t cmp, ulong_t newval);
> extern uint64_t cas64(uint64_t *target, uint64_t cmp, uint64_t newval);
> extern void *casptr(void *target, void *cmp, void *newval);
> extern uint8_t cas8(uint8_t *target, uint8_t cmp, uint8_t newval);
>
> But the problem is when iam using these functions in c programs and compiling
> using gcc it is showing the following error.
> -------------------------------------------------------------------------------
> Undefined first referenced
> symbol in file
> cas32 /var/tmp//ccQcsnev.o
> --------------------------------------------------------------------------------
> And if i use the function other than cas32 group of instruction
> such as atomic_or_uint() whose declaration is extern void
> atomic_or_uint(uint_t *target, uint_t bits); in <sys/atomic.h> it is
> giving no error where as for CAS32 it showing as undefined symbol.Why
> it is giving like that we are not able to know.Is it the case that
> CAS32 instruction only available in Kernel mode and not available
> to user mode.Please inform us if anyone knows how to use cas32()
> instruction in the user C programs.As this is usefull for writing
> Nonblocking versions of stacks and Queues. Is there any way to write
> our own atomic functions?
cas32() was not available in S10 FCS. It was added in
Solaris 10's 01/06 update, and is bugid:
4954703 userland atomic.h port should include cas primitives
which is also in the following patches:
sparc:
119689-03 (or greater) libc.so.1 patch
118822-13 (or greater) kernel patch
118884-01 (or greater) atomic.h patch
118890-01 (or greater) llib-lc patch
i386:
118345-04 (or greater) ld & libc.so.1 patch
118844-12 (or greater) kernel patch
118891-01 (or greater) llib-lc patch
118885-01 (or greater) atomic.h patch
as well as in Solaris Express / OpenSolaris.
Cheers,
- jonathan
> Rama
> This message posted from opensolaris.org
> _______________________________________________
> opensolaris-discuss mailing list
> [email protected]
--
Jonathan Adams, Solaris Kernel Development
_______________________________________________
opensolaris-discuss mailing list
[email protected]