msem_lock()

From: Philippe Benard <phi_at_hpfrcu03.france.hp.com>
Date: Tue, 25 Feb 1997 15:57:21 +0100

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_at_hpfrcu03.france.hp.com
Received on Tue Feb 25 1997 - 16:24:58 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT