sshhmmaatt() -- General Function (libc)

Attach a shared-memory segment to a process
#iinncclluuddee <ssyyss/ttyyppeess.hh>
#iinncclluuddee <ssyyss/iippcc.hh>
#iinncclluuddee <ssyyss/sshhmm.hh>
cchhaarr *sshhmmaatt (_s_h_m_i_d, _s_h_m_a_d_d_r, _s_h_m_f_l_g)
iinntt _s_h_m_i_d, _s_h_m_f_l_a_g; cchhaarr *_s_h_m_a_d_d_r;

sshhmmaatt() attaches  the shared-memory segment associated  with the identifier
_s_h_m_i_d with the .ddaattaa segment of the calling process.

sshhmmaatt() selects  the address at which to  attach the shared-memory segment.
If

    _s_h_m_f_l_g & SHM_RDONLY

is true, the attached memory is read-only; otherwise, it is read-write.

sshhmmaatt() fails if any of the following is true:

-> _s_h_m_i_d is  not a valid  shared-memory identifier.  sshhmmaatt()  sets eerrrrnnoo to
   EEIINNVVAALL.

-> The calling process lacks appropriate permission (EEAACCCCEESS).

-> Not  enough  memory  is  available  to  hold the  shared-memory  segment
   (EENNOOMMEEMM).

-> The  process already  has the maximum  number of  shared-memory segments
   attached to it (EEMMFFIILLEE).

You can  attach more than one  shared-memory segment to a  process, up to a
maximum of six.  COHERENT assigns each segment its own address.

If all went well, sshhmmaatt() returns the address of the newly attached shared-
memory segment;  otherwise, it returns -1 and sets  eerrrrnnoo to an appropriate
value.

_E_x_a_m_p_l_e
For an example of this function, see the Lexicon entry for sshhmmggeett().

_S_e_e _A_l_s_o
lliibbcc, sshhmmccttll(), sshhmmddtt(), sshhmmggeett()

_N_o_t_e_s
The COHERENT implementation of shared memory does not yet support attaching
a shared-memory  segment to a user-defined  address.  Therefore, you should
always set _s_h_m_a_d_d_r to zero.
