tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* msem_lock()
@ 1997-02-25 14:57 Philippe Benard
  0 siblings, 0 replies; only message in thread
From: Philippe Benard @ 1997-02-25 14:57 UTC (permalink / raw)
  To: tru64-unix-managers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-02-25 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-25 14:57 msem_lock() Philippe Benard

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