home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / catD / allocb.z / allocb
Encoding:
Text File  |  2002-10-03  |  11.3 KB  |  223 lines

  1.  
  2.  
  3.  
  4. aaaallllllllooooccccbbbb((((DDDD3333))))                                                          aaaallllllllooooccccbbbb((((DDDD3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _aaaa_llll_llll_oooo_cccc_bbbb - allocate a message block
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
  15.      _mmmm_bbbb_llll_kkkk______tttt _****_aaaa_llll_llll_oooo_cccc_bbbb_((((_iiii_nnnn_tttt _s_i_z_e_,,,, _uuuu_iiii_nnnn_tttt______tttt _p_r_i_))))_;;;;
  16.  
  17.    AAAArrrrgggguuuummmmeeeennnnttttssss
  18.      _s_i_z_e      The number of bytes in the message block.
  19.  
  20.      _p_r_i       Priority of the request.
  21.  
  22. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.      _aaaa_llll_llll_oooo_cccc_bbbb tries to allocate a STREAMS message block.
  24.  
  25.    RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
  26.      If successful, _aaaa_llll_llll_oooo_cccc_bbbb returns a pointer to the allocated message block of
  27.      type _MMMM______DDDD_AAAA_TTTT_AAAA (defined in _ssss_yyyy_ssss_////_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh).  If a block cannot be allocated, a
  28.      _NNNN_UUUU_LLLL_LLLL pointer is returned.
  29.  
  30. UUUUSSSSAAAAGGGGEEEE
  31.      Buffer allocation fails only when the system is out of memory.  If no
  32.      buffer is available, the _bbbb_uuuu_ffff_cccc_aaaa_llll_llll(D3) function can help a module recover
  33.      from an allocation failure.
  34.  
  35.      The psi argument is no longer used, but is retained for compatibility.
  36.  
  37.      The following figure identifies the data structure members that are
  38.      affected when a message block is allocated.
  39.      ||||
  40.      ________
  41.              ||||
  42.      ________
  43.            ______
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.            __
  51.  
  52.            __
  53.  
  54.  
  55.                 |||
  56.       _bbbb______cccc_oooo_nnnn_tttt _((((_0000_))))
  57.       _bbbb______rrrr_pppp_tttt_rrrr
  58.       _bbbb______wwww_pppp_tttt_rrrr
  59.       _bbbb______dddd_aaaa_tttt_aaaa_pppp
  60.    message block
  61.      (_mmmm_bbbb_llll_kkkk______tttt)
  62.                   data block
  63.                    (_dddd_bbbb_llll_kkkk______tttt)
  64.                                 data buffer
  65.                         ______
  66.  
  67.  
  68.                         ______
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                  ||||
  77.                  ____________
  78.                              ||||
  79.                  ____________
  80.                                  ||||
  81.                                  ______
  82.                                         ||||
  83.                                   ______
  84.                                  .
  85.                                   .
  86.                                   .
  87.                                    .
  88.                                    .
  89.                                    .
  90.                                     .
  91.                                     .
  92.                                      .
  93.                                      .
  94.                                      .
  95.                                       .
  96.                                       .
  97.                                        .
  98.                                        .
  99.                                        .
  100.                                         .
  101.                                  .
  102.                                   .
  103.                                   .
  104.                                    .
  105.                                    .
  106.                                    .
  107.                                     .
  108.                                     .
  109.                                      .
  110.                                      .
  111.                                      .
  112.                                       .
  113.                                       .
  114.                                        .
  115.                                        .
  116.                                        .
  117.                                         .
  118.                 _____________________
  119.                                      ||
  120.  
  121.                   _dddd_bbbb______bbbb_aaaa_ssss_eeee
  122.                   _dddd_bbbb______llll_iiii_mmmm
  123.                   _dddd_bbbb______tttt_yyyy_pppp_eeee _((((_MMMM______DDDD_AAAA_TTTT_AAAA_))))
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.    LLLLeeeevvvveeeellll
  133.      Base or Interrupt.
  134.  
  135.    SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
  136.      Does not sleep.
  137.  
  138.      Driver-defined basic locks, read/write locks, and sleep locks may be held
  139.      across calls to this function.
  140.  
  141.  
  142.  
  143.                                                                         PPPPaaaaggggeeee 1111
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. aaaallllllllooooccccbbbb((((DDDD3333))))                                                          aaaallllllllooooccccbbbb((((DDDD3333))))
  151.  
  152.  
  153.  
  154.    EEEExxxxaaaammmmpppplllleeee
  155.      Given a pointer to a queue (_q) and an error number (_e_r_r), the _ssss_eeee_nnnn_dddd______eeee_rrrr_rrrr_oooo_rrrr
  156.      routine sends an _MMMM______EEEE_RRRR_RRRR_OOOO_RRRR type message to the stream head.
  157.  
  158.      If a message cannot be allocated, 0 is returned, indicating an allocation
  159.      failure (line 8).  Otherwise, the message type is set to _MMMM______EEEE_RRRR_RRRR_OOOO_RRRR (line
  160.      9).  Line 10 increments the write pointer (_bbbb_pppp_----_>>>>_bbbb______wwww_pppp_tttt_rrrr) by the size (one
  161.      byte) of the data in the message.
  162.  
  163.      A message must be sent up the read side of the stream to arrive at the
  164.      stream head.  To determine whether _q points to a read queue or a write
  165.      queue, the _qqqq_----_>>>>_qqqq______ffff_llll_aaaa_gggg member is tested to see if _QQQQ_RRRR_EEEE_AAAA_DDDD_RRRR is set (line 12).
  166.      If it is not set, _q points to a write queue, and on line 13 the _RRRR_DDDD(D3)
  167.      function is used to find the corresponding read queue.  In line 14, the
  168.      _pppp_uuuu_tttt_nnnn_eeee_xxxx_tttt(D3) function is used to send the message upstream.  Then
  169.      _ssss_eeee_nnnn_dddd______eeee_rrrr_rrrr_oooo_rrrr returns 1 indicating success.
  170.  
  171.       _1111  _ssss_eeee_nnnn_dddd______eeee_rrrr_rrrr_oooo_rrrr_((((_qqqq_,,,, _eeee_rrrr_rrrr_))))
  172.       _2222   _qqqq_uuuu_eeee_uuuu_eeee______tttt _****_qqqq_;;;;
  173.       _3333   _uuuu_cccc_hhhh_aaaa_rrrr______tttt _eeee_rrrr_rrrr_;;;;
  174.       _4444  _{{{{
  175.       _5555   _mmmm_bbbb_llll_kkkk______tttt _****_bbbb_pppp_;;;;
  176.       _6666   _llll_oooo_nnnn_gggg _ffff_llll_====_0000_;;;;
  177.       _7777   _iiii_ffff _((((_((((_bbbb_pppp _==== _aaaa_llll_llll_oooo_cccc_bbbb_((((_1111_,,,, _BBBB_PPPP_RRRR_IIII______HHHH_IIII_))))_)))) _====_==== _NNNN_UUUU_LLLL_LLLL_))))
  178.       _8888        _rrrr_eeee_tttt_uuuu_rrrr_nnnn_((((_0000_))))_;;;;
  179.       _9999   _bbbb_pppp_----_>>>>_bbbb______dddd_aaaa_tttt_aaaa_pppp_----_>>>>_dddd_bbbb______tttt_yyyy_pppp_eeee _==== _MMMM______EEEE_RRRR_RRRR_OOOO_RRRR_;;;;
  180.      _1111_0000   _****_bbbb_pppp_----_>>>>_bbbb______wwww_pppp_tttt_rrrr_++++_++++ _==== _eeee_rrrr_rrrr_;;;;
  181.      _1111_1111   _((((_vvvv_oooo_iiii_dddd_)))) _ssss_tttt_rrrr_qqqq_gggg_eeee_tttt_((((_qqqq_,,,, _QQQQ_FFFF_LLLL_AAAA_GGGG_,,,, _0000_,,,, _&&&&_ffff_llll_))))_;;;;
  182.      _1111_2222   _iiii_ffff _((((_ffff_llll _&&&& _QQQQ_RRRR_EEEE_AAAA_DDDD_RRRR_))))_))))
  183.      _1111_3333        _qqqq _==== _RRRR_DDDD_((((_qqqq_))))_;;;;
  184.      _1111_4444   _pppp_uuuu_tttt_nnnn_eeee_xxxx_tttt_((((_qqqq_,,,, _bbbb_pppp_))))_;;;;
  185.      _1111_5555   _rrrr_eeee_tttt_uuuu_rrrr_nnnn_((((_1111_))))_;;;;
  186.      _1111_6666  _}}}}
  187.  
  188. RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
  189.      _bbbb_uuuu_ffff_cccc_aaaa_llll_llll(D3), _eeee_ssss_bbbb_aaaa_llll_llll_oooo_cccc(D3), _eeee_ssss_bbbb_bbbb_cccc_aaaa_llll_llll(D3), _ffff_rrrr_eeee_eeee_bbbb(D3), _mmmm_ssss_gggg_bbbb(D4)
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.                                                                         PPPPaaaaggggeeee 2222
  208.  
  209.  
  210.  
  211.