tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Philippe Benard <phi () hpfrcu03 ! france ! hp ! com>
To: tru64-unix-managers
Subject: msem_lock()
Date: Tue, 25 Feb 1997 14:57:21 +0000	[thread overview]
Message-ID: <96078608810501.tru64-unix-managers.marc@archive.invalid> (raw)

Hi OSF/1 team

I'd like to know what is the expected behavior of OSF/1 regarding a
double msem_lock() by the same process.

1) Suspend
Does the process suspend on the second msem_lock() since it already owns
it. Then waiting an another process to unlock it or waiting to be
killed.

2) EDEADLK
Does the second msem_lock() return immediatly with -1 and errno set to
EDEADLK, since the process owns the lock and want the lock?

In case it helps here is a little prg to run on an OSF/1 (preferaply dec
apha)

#include <unistd.h>
#include <sys/mman.h>
     
main()
{ char *p;
  int sts;
  p = (char*) mmap(NULL, (1)*sysconf(_SC_PAGE_SIZE),
                   PROT_READ | PROT_WRITE,
                   MAP_ANONYMOUS | MAP_VARIABLE | MAP_SHARED, -1, 0 );
     
  printf("#1\n");
  sts = msem_init(p,0);
  printf("#2 sts=0x%08x\n",sts);
  sts = msem_lock(p,0);
  printf("#3 sts=%d\n",sts);
  sts = msem_lock(p,0);
  printf("#4 sts=%d\n",sts);perror("msem");
}
 
If sysconf() is a problem replace it by 4096
If  MAP_ANONYMOUS | MAP_VARIABLE is a problem just remove them...

Thanx in advance.
Phi

--
Philippe BENARD 
mailto:phi@hpfrcu03.france.hp.com

                 reply	other threads:[~1997-02-25 14:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox