Print this page
11544 ofmt(3OFMT) should talk about the callback handler
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man3ofmt/ofmt.3ofmt.man.txt
          +++ new/usr/src/man/man3ofmt/ofmt.3ofmt.man.txt
↓ open down ↓ 80 lines elided ↑ open up ↑
  81   81  
  82   82             {<of_name>, <of_width>, <of_id>, <of_cb> },
  83   83             ...
  84   84             {<of_name>, <of_width>, <of_id>, <of_cb> },
  85   85             {NULL, 0, 0, NULL}
  86   86  
  87   87       of_cb is the application-specified callback function with the following
  88   88       prototype that provides a string representation of the value to be
  89   89       printed for the field:
  90   90  
  91      -           (*of_cb)(ofmt_arg_t *ofmt_arg, char *buf, uint_t bufsize)
       91 +           boolean_t (*of_cb)(ofmt_arg_t *ofmt_arg, char *buf, uint_t bufsize)
  92   92  
       93 +     The callback must not write beyond bufsize bytes of the string form into
       94 +     buf.  If the function successfully translates the field into its string
       95 +     representation and places it into buf, then the callback function should
       96 +     return B_TRUE.  Otherwise, the callback function should return B_FALSE.
       97 +
  93   98       The interpretation of the of_id field is completely private to the
  94   99       caller, and can be optionally used by the callback function as a cookie
  95  100       to identify the field being printed when a single callback function is
  96  101       shared between multiple template entries.
  97  102  
  98  103       The flags can be any valid combination of the following:
  99  104  
 100  105       OFMT_PARSABLE   Machine-parsable mode.  Specifying a null or empty fields
 101  106                       in the machine-parsable mode will result in a returned
 102  107                       error value of OFMT_EPARSENONE.  An attempt to create a
↓ open down ↓ 52 lines elided ↑ open up ↑
 155  160       ofmt_strerror().
 156  161  
 157  162       The ofmt_strerror() function returns the buf.
 158  163  
 159  164  INTERFACE STABILITY
 160  165       Private.
 161  166  
 162  167  SEE ALSO
 163  168       ioctl(2), strerror(3C), attributes(5)
 164  169  
 165      -illumos                          June 1, 2017                          illumos
      170 +illumos                        December 20, 2018                       illumos
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX