HP OpenVMS Systems

ask the wizard
Content starts here

Programming with Mailboxes?

» close window

The Question is:

Hello Mr. Wizard,
When issuing the command "show dev/full mba389"
the following information is displayed:
Device MBA389:, device type local memory mailbox, is online, record-oriented
    device, shareable, mailbox device.
    Error count                    0    Operations completed                184
    Owner process                 ""    Owner UIC                    [TFI_EXEC]
    Owner process ID        00000000    Dev Prot    S:RWPL,O:RWPL,G:RWPL,W:RWPL
    Reference count                7    Default buffer size                1536
My question deals with the "Reference Count".  Is there a way that I can find
 out what processes are connected to this mailbox?  As noted above, there are 7
 channels connected to this mailbox.  What process(es) owns or are connected to
 these channels.
If at all possible, could you provide sample "C" code or references that show
 what I'm trying to achieve (I'm a mailbox trying to find out who's connected
 to me before I receive any messages).
Thank you,
Terry D. Frierson

The Answer is :

  The usual approach when working with mailboxes does not involve
  determining who is connected (as a mailbox is not a connection-oriented
  device), but who sent the message.  The PID of the sender of the mailbox
  message is included in the IOSB given to the reader to facilitate this.
  The OpenVMS Wizard strongly recommends using pairs of mailboxes for
  each process, with only one process reading from any particular mailbox
  and zero or more processes writing to it.  This approach simplifies the
  application design and the debugging that can be required.
  You can clearly determine if there are any read or write channels
  open, using the READERCHECK or WRITERCHECK itemcodes.
  It is conceivable (but rather difficult) to use security alarms
  and ACLs and the security auditing mailbox to detect any accesses
  to the mailbox.
  For new code running on recent OpenVMS releases, the Intra-Cluster
  Communications Services will be of interest.
  As for locating the I/O channels that are currently attached to the
  mailbox, this entails some familiarity with kernel-mode structures.
  The simplest approach involves the SDA command:
  or (depending on the OpenVMS version) the SDA command:
  There is no user-mode interface to this function.

answer written or last revised on ( 12-SEP-2000 )

» close window