2 Function: comedi_errno -- number of last Comedilib error
6 When a Comedilib function fails, it usually returns -1 or
7 NULL, depending on the return type. An internal library
8 variable stores an error number, which can be retrieved with
9 comedi_errno(). This error number can be converted to a
10 human-readable form by the functions
11 <link linkend="func-ref-comedi-perror"><function>comedi_perror</function></link>
13 <link linkend="func-ref-comedi-strerror"><function>comedi_strerror</function></link>
16 These functions are intended to mimic the behavior of the
17 standard C library functions perror(), strerror(), and errno.
18 In particular, Comedilib functions sometimes return an error
19 that is generated inside the C library; the comedi error
20 message in this case is the same as the C library.
22 The function comedi_errno() returns an integer describing
23 the most recent comedilib error. This integer may be used
24 as the errnum parameter for comedi_strerror().
26 Function: comedi_loglevel -- change Comedilib logging properties
30 This function affects the output of debugging and error messages
31 from Comedilib. By increasing the loglevel, additional debugging
32 information will be printed. Error and debugging messages are
33 printed to the stream stderr.
35 The default loglevel can be set by using the environment variable
36 COMEDI_LOGLEVEL. The default loglevel is 1.
38 In order to conserve resources, some debugging information is
39 disabled by default when Comedilib is compiled.
41 The meaning of the loglevels is as follows:
42 <table frame="box" rules="all">
49 <td>Comedilib prints nothing.</td>
54 (default) Comedilib prints error messages when
55 there is a self-consistency error (i.e., an internal bug.)
61 Comedilib prints an error message when an invalid
68 Comedilib prints an error message whenever an
69 error is generated in the Comedilib library or in the C library,
70 when called by Comedilib.
75 <td>Comedilib prints a lot of junk.</td>
79 This function returns the previous loglevel.
81 Function: comedi_perror -- print a Comedilib error message
85 When a Comedilib function fails, it usually returns -1 or
86 NULL, depending on the return type. An internal library
87 variable stores an error number, which can be retrieved with
88 <link linkend="func-ref-comedi-errno"><function>comedi_errno</function></link>
89 . This error number can be converted to a
90 human-readable form by the functions
92 <link linkend="func-ref-comedi-strerror"><function>comedi_strerror</function></link>
95 These functions are intended to mimic the behavior of the
96 standard C library functions perror(), strerror(), and errno.
97 In particular, Comedilib functions sometimes return an error
98 that is generated inside the C library; the comedi error
99 message in this case is the same as the C library.
101 The function comedi_perror() prints an error message to stderr.
102 The error message consists of the argument string, a colon, a
103 space, a description of the error condition, and a new line.
105 Function: comedi_strerror -- return string describing Comedilib error code
109 When a Comedilib function fails, it usually returns -1 or
110 NULL, depending on the return type. An internal library
111 variable stores an error number, which can be retrieved with
112 comedi_errno(). This error number can be converted to a
113 human-readable form by the functions
114 <link linkend="func-ref-comedi-perror"><function>comedi_perror</function></link>
115 or comedi_strerror().
117 These functions are intended to mimic the behavior of the
118 standard C library functions perror(), strerror(), and errno.
119 In particular, Comedilib functions sometimes return an error
120 that is generated inside the C library; the comedi error
121 message in this case is the same as the C library.
123 The function comedi_strerror() returns a pointer to a
125 describing the Comedilib error <parameter>errnum</parameter>.
126 The returned string may be
127 modified by a subsequent call to a strerr or perror function
128 (either the libc or Comedilib versions).
129 An unrecognized error number will
130 return a pointer to the string "undefined error", or similar.