source: rtems/doc/new_chapters/eventlog.t @ 1dedfde9

4.104.114.84.95
Last change on this file since 1dedfde9 was 1dedfde9, checked in by Wade A Smith <warm38@…>, on 09/30/98 at 19:39:56

Updated the STATUS CODE section of the routines in this file.

  • Property mode set to 100644
File size: 32.8 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Event Logging Manager
10
11@section Introduction
12
13The event logging manager provides a portable method for logging
14system and application events and subsequent processing of those
15events.  The capabilities in this manager were defined in the POSIX
161003.1h/D3 proposed standard titled @b{Services for Reliable,
17Available, and Serviceable Systems}.
18
19The directives provided by the event logging manager are:
20
21@itemize @bullet
22@item @code{log_create} - Create a log file
23@item @code{log_sys_create} - Create a system log file
24@item @code{log_write} - Write to the system Log
25@item @code{log_write_any} - Write to any log file
26@item @code{log_write_entry} - Write entry to any log file
27@item @code{log_open} - Open a log file
28@item @code{log_read} - Read from a log file
29@item @code{log_notify} - Notify Process of writes to the system log
30@item @code{log_close} - Close log descriptor
31@item @code{log_seek} - Reposition log file offset
32@item @code{log_severity_before} - Compare event record severities
33@item @code{log_facilityemptyset} - Manipulate log facility sets
34@item @code{log_facilityfillset} - Manipulate log facility sets
35@item @code{log_facilityaddset} - Manipulate log facility sets
36@item @code{log_facilitydelset} - Manipulate log facility sets
37@item @code{log_facilityismember} - Manipulate log facility sets
38@item @code{log_facilityisvalid} - Manipulate log facility sets
39@end itemize
40
41@section Background
42
43@subsection Log Files and Events
44
45The operating system uses a special log file named @code{syslog}. 
46This log file is called the system log and is automatically created and
47tracked by the operating system.  The system log is written with
48the @code{log_write()} function.  An alternative log file may be written
49using the @code{log_write_any()} function.  It is possible to use @code{log_read()}
50to query the system log and and write the records to a non-system log file
51using @code{log_write_entry()} to produce a filtered version of the
52system log.  For example you could produce a log of all disk controller
53faults that have occurred. 
54
55A non-system log may be a special log file created by an application to
56describe application faults, or a subset of the system log created
57by the application. 
58
59
60
61@subsection Facilities
62
63A facility is an identification code for a subsystem, device, or
64other object about which information is being written to
65a log file. 
66
67A facility set is a collection of facilities.
68
69@subsection Severity
70
71Severity is a rating of the error that is being logged.   
72
73@subsection Queries
74
75
76The facility identifier and the event severity are the basis for
77subsequent log query.  A log query is used as a filter to
78obtain a subset of a given log file.  The log file may be configured
79to send out an event.
80
81@section Operations
82
83@subsection Creating and Writing a non-System Log
84
85The following code fragment create a non-System log file at /temp/.
86A real filename previously read entry and buffer @code{log_buf} of size
87@code{readsize} are written into the log.  See the discussion on opening
88and reading a log for how the entry is created.
89
90@example
91#include <evlog.h>
92   :
93  logd_t           *outlog = NULL;
94  char             *path   = "/temp/";
95
96  log_create( outlog, path );
97   : 
98  log_write_entry( outlog, &entry, log_buf, readsize );
99
100@end example
101
102@subsection Reading a Log
103
104Discuss opening and reading from a log.
105
106@example
107  build a query
108  log_open
109  log_read loop
110@end example
111
112@section Directives
113
114This section details the event logging manager's directives.
115A subsection is dedicated to each of this manager's directives
116and describes the calling sequence, related constants, usage,
117and status codes.
118
119@page
120@subsection log_write - Write to the system Log
121
122@subheading CALLING SEQUENCE:
123
124@ifset is-C
125@example
126#include <evlog.h>
127
128int log_write(
129  const log_facility_t  facility,
130  const int             event_id,
131  const log_severity_t  severity,
132  const void           *buf,
133  const size_t          len
134);
135@end example
136@end ifset
137
138@ifset is-Ada
139@end ifset
140
141@subheading STATUS CODES:
142
143A successful call to @code{log_write()} returns a value of zero
144and an unsuccessful call returns the @code{errno}.
145
146@table @b
147@item E2BIG
148This error indicates an inconsistency in the implementation.
149Report this as a bug.
150
151@item EINVAL
152The @code{facility} argument is not a valid log facility.
153
154@item EINVAL
155The @code{severity} argument exceeds @code{LOG_SEVERITY_MAX}.
156
157@item EINVAL
158The @code{len} argument exceeds @code{LOG_MAXIUM_BUFFER_SIZE}.
159
160@item EINVAL
161The @code{len} argument was non-zero and @code{buf} is @code{NULL}.
162
163@item ENOSPC
164The device which contains the log file has run out of space.
165
166@item EIO
167An I/O error occurred in writing to the log file.
168
169@end table
170
171@subheading DESCRIPTION:
172
173The @code{log_write} function writes an event record to the
174system log file.  The event record written consists of the
175event attributes specified by the @code{facility}, @code{event_id},
176and @code{severity} arguments as well as the data identified by the
177@code{buf} and @code{len} arguments.  The fields of the event record
178structure to be written are filled in as follows:
179
180@table @b
181@item log_recid
182This is set to a monotonically increasing log record id
183maintained by the system for this individual log file.
184
185@item log_size
186This is set to the value of the @code{len} argument.
187
188@item log_event_id
189This is set to the value of the @code{event_id} argument.
190
191@item log_facility
192This is set to the value of the @code{facility} argument.
193
194@item log_severity
195This is set to the value of the @code{severity} argument.
196
197@item log_uid
198This is set to the value returned by @code{geteuid()}.
199
200@item log_gid
201This is set to the value returned by @code{getegid()}.
202
203@item log_pid
204This is set to the value returned by @code{getpid()}.
205
206@item log_pgrp
207This is set to the value returned by @code{getpgrp()}.
208
209@item log_time
210This is set to the value returned by @code{clock_gettime()} for the
211@code{CLOCK_REALTIME clock} source.
212
213@end table
214
215@subheading NOTES:
216
217The @code{_POSIX_LOGGING} feature flag is defined to indicate
218this service is available.
219
220This implementation can not return the @code{EPERM} error.
221
222@page
223@subsection log_write_any - Write to the any log file
224
225@subheading CALLING SEQUENCE:
226
227@ifset is-C
228@example
229#include <evlog.h>
230
231int log_write_any(
232  const logd_t          logdes,
233  const log_facility_t  facility,
234  const int             event_id,
235  const log_severity_t  severity,
236  const void           *buf,
237  const size_t          len
238);
239@end example
240@end ifset
241 
242@ifset is-Ada
243@end ifset
244
245@subheading STATUS CODES:
246
247A successful call to @code{log_write_any()} returns a value of zero
248and an unsuccessful call returns the @code{errno}.
249
250@table @b
251@item E2BIG
252This error indicates an inconsistency in the implementation.
253Report this as a bug.
254
255@item EBADF
256The @code{logdes} argument is not a valid log descriptor.
257
258@item EINVAL
259The @code{facility} argument is not a valid log facility.
260
261@item EINVAL
262The @code{severity} argument exceeds @code{LOG_SEVERITY_MAX}.
263
264@item EINVAL
265The @code{len} argument exceeds @code{LOG_MAXIMUM_BUFFER_SIZE}.
266
267@item EINVAL
268The @code{len} argument was non-zero and @code{buf} is @code{NULL}.
269
270@item ENOSPC
271The device which contains the log file has run out of space.
272
273@item EIO
274An I/O error occurred in writing to the log file.
275
276@end table
277
278@subheading DESCRIPTION:
279
280The @code{log_write_any()} function writes an event record to the log file
281specified by @code{logdes}.  The event record written consists of the
282event attributes specified by the @code{facility}, @code{event_id},
283and @code{severity} arguments as well as the data identified by the
284@code{buf} and @code{len} arguments.  The fields of the event record
285structure to be written are filled in as follows:
286
287@table @b
288@item log_recid
289This is set to a monotonically increasing log record id
290maintained by the system for this individual log file.
291
292@item log_size
293This is set to the value of the @code{len} argument.
294
295@item log_event_id
296This is set to the value of the @code{event_id} argument.
297
298@item log_facility
299This is set to the value of the @code{facility} argument.
300
301@item log_severity
302This is set to the value of the @code{severity} argument.
303
304@item log_uid
305This is set to the value returned by @code{geteuid()}.
306
307@item log_gid
308This is set to the value returned by @code{getegid()}.
309
310@item log_pid
311This is set to the value returned by @code{getpid()}.
312
313@item log_pgrp
314This is set to the value returned by @code{getpgrp()}.
315
316@item log_time
317This is set to the value returned by @code{clock_gettime()} for the
318@code{CLOCK_REALTIME} clock source.
319
320@end table
321
322@subheading NOTES:
323
324The @code{_POSIX_LOGGING} feature flag is defined to indicate
325this service is available.
326
327This implementation can not return the @code{EPERM} error.
328
329This function is not defined in the POSIX specification.  It is
330an extension provided by this implementation.
331
332@page
333@subsection log_write_entry - Write entry to any log file
334
335@subheading CALLING SEQUENCE:
336
337@ifset is-C
338@example
339#include <evlog.h>
340
341int log_write_entry(
342  const logd_t      logdes,
343  struct log_entry *entry,
344  const void       *buf,
345  const size_t      len
346);
347@end example
348@end ifset
349 
350@ifset is-Ada
351@end ifset
352
353@subheading STATUS CODES:
354
355A successful call to @code{log_write_entry()} returns a value of zero
356and an unsuccessful call returns the @code{errno}.
357
358@table @b
359@item E2BIG
360This error indicates an inconsistency in the implementation.
361Report this as a bug.
362
363@item EBADF
364The @code{logdes} argument is not a valid log descriptor.
365
366@item EFAULT
367The @code{entry} argument is not a valid pointer to a log entry.
368
369@item EINVAL
370The @code{facility} field in @code{entry} is not a valid log facility.
371
372@item EINVAL
373The @code{severity} field in @code{entry} exceeds @code{LOG_SEVERITY_MAX}.
374
375@item EINVAL
376The @code{len} argument exceeds @code{LOG_MAXIMUM_BUFFER_SIZE}.
377
378@item EINVAL
379The @code{len} argument was non-zero and @code{buf} is NULL.
380
381@item ENOSPC
382The device which contains the log file has run out of space.
383
384@item EIO
385An I/O error occurred in writing to the log file.
386
387@end table
388
389@subheading DESCRIPTION:
390
391The @code{log_write_entry()} function writes an event record
392specified by the @code{entry}, @code{buf}, and @code{len} arguments.
393Most of the fields of the event record pointed to by @code{entry}
394are left intact.  The following fields are filled in as follows:
395
396@table @b
397@item log_recid
398This is set to a monotonically increasing log record id
399maintained by the system for this individual log file.
400
401@item log_size
402This is set to the value of the @code{len} argument.
403
404@end table
405
406This allows existing log entries from one log file to be written to
407another log file without destroying the logged information.
408
409@subheading NOTES:
410
411The @code{_POSIX_LOGGING} feature flag is defined to indicate
412this service is available.
413
414This implementation can not return the @code{EPERM} error.
415
416This function is not defined in the POSIX specification.  It is
417an extension provided by this implementation.
418
419@page
420@subsection log_open - Open a log file
421
422@subheading CALLING SEQUENCE:
423
424@ifset is-C
425@example
426#include <evlog.h>
427
428int log_open(
429  logd_t               *logdes,
430  const char           *path,
431  const log_query_t    *query
432);
433@end example
434@end ifset
435
436@ifset is-Ada
437@end ifset
438
439@subheading STATUS CODES:
440
441A successful call to @code{log_open()} returns a value of zero
442and an unsuccessful call returns the @code{errno}.
443
444@table @b
445@item EACCES
446Search permission is denied on a component of the @cdoe{path} prefix,
447or the log file exists and read permission is denied.
448
449@item  EINTR
450A signal interrupted the call to @code{log_open()}.
451
452@item EINVAL
453The log_severity field of the query argument exceeds
454@code{LOG_SEVERITY_MAX}.
455
456@item EINVAL
457The @code{path} argument referred to a file that was not a log file.
458
459@item EMFILE
460Too many log file descriptors are currently in use by this
461process.
462
463@item ENAMETOOLONG
464The length of the path string exceeds @code{PATH_MAX}, or a pathname
465component is longer than @code{NAME_MAX} while @code{_POSIX_NO_TRUNC} is
466in effect.
467
468@item ENFILE
469Too many files are currently open in the system.
470
471@item ENOENT
472The file specified by the @code{path} argument does not exist.
473
474@item ENOTDIR
475A component of the @code{path} prefix is not a directory.
476
477@end table
478
479@subheading DESCRIPTION:
480
481The @code{log_open()} function establishes the connection between a
482log file and a log file descriptor.  It creates an open log file
483descriptor that refers to this query stream on the specified log file
484The log file descriptor is used by the other log functions to refer
485to that log query stream.  The @code{path} argument points to a
486pathname for a log file.  A @code{path} argument of @code{NULL} specifies
487the current system log file. 
488
489The @code{query} argument is not @code{NULL}, then it points to a log query
490specification that is used to filter the records in the log file on
491subsequent @code{log_read()} operations.  This restricts the set of
492event records read using the returned log file descriptor to those
493which match the query.  A query match occurs for a given record when
494that record's facility is a member of the query's facility set and
495the record's severity is greater than or equal to the severity specified
496in the query.
497
498If the value of the @code{query} argument is @code{NULL}, no query filter
499shall be applied.
500
501@subheading NOTES:
502
503The @code{_POSIX_LOGGING} feature flag is defined to indicate
504this service is available.
505
506POSIX specifies that @code{EINVAL} will be returned if the
507@code{log_facilities} field of the @code{query} argument is not
508a valid facility set.  In this implementation, this condition
509can never occur.
510
511Many error codes that POSIX specifies to be returned by @code{log_open()}
512should actually be detected by @code{open()} and passed back by the
513@code{log_open()} implementation.  In this implementation, @code{EACCESS},
514@code{EMFILE}, @code{ENAMETOOLONG}, @code{ENFILE}, @code{ENOENT},
515and @code{ENOTDIR} are detected in this manner.
516
517@page
518@subsection log_read - Read from a log file
519
520@subheading CALLING SEQUENCE:
521
522@ifset is-C
523@example
524#include <evlog.h>
525
526int log_read(
527  const logd_t      logdes,
528  struct log_entry *entry,
529  void             *log_buf,
530  const size_t      log_len,
531  const size_t     *log_sizeread
532);
533@end example
534@end ifset
535
536@ifset is-Ada
537@end ifset
538
539@subheading STATUS CODES:
540
541A successful call to @code{log_read()} returns a value of zero
542and an unsuccessful call returns the @code{errno}.
543
544@table @b
545@item E2BIG
546This error indicates an inconsistency in the implementation.
547Report this as a bug.
548
549@item EBADF
550The @code{logdes} argument is not a valid log file descriptor.
551
552@item EFAULT
553The @code{entry} argument is not a valid pointer to a log entry structure.
554
555@item EFAULT
556The @code{log_sizeread} argument is not a valid pointer to a size_t.
557
558@item EBUSY
559No data available.  There are no unread event records remaining
560in this log file.
561
562@item EINTR
563A signal interrupted the call to @code{log_read()}.
564
565@item EIO
566An I/O error occurred in reading from the event log.
567
568@item EINVAL
569The matching event record has data associated with it and
570@code{log_buf} was not a valid pointer.
571
572@item EINVAL
573The matching event record has data associated with it which is
574longer than @code{log_len}.
575
576@end table
577
578@subheading DESCRIPTION:
579
580The @code{log_read()} function reads the @code{log_entry}
581structure and up to @code{log_len} bytes of data from the next
582event record of the log file associated with the open log file
583descriptor @code{logdes}.  The event record read is placed
584into the @code{log_entry} structure pointed to by
585@code{entry} and any data into the buffer pointed to by @code{log_buf}.
586The log record ID of the returned event record is be stored in the
587@code{log_recid} member of the @code{log_entry} structure for the event
588record.
589
590If the query attribute of the open log file description associated with
591the @code{logdes} is set, the event record read will match that query.
592
593If the @code{log_read()} is successful the call stores the actual length
594of the data associated with the event record into the location specified by
595@code{log_sizeread}.  This number will be less than or equal to
596@code{log_len}.
597
598@subheading NOTES:
599
600The @code{_POSIX_LOGGING} feature flag is defined to indicate
601this service is available.
602
603When @code{EINVAL} is returned, then no data is returned although the
604event record is returned.  This is an extension to the POSIX specification.
605
606The POSIX specification specifically allows @code{log_read()} to write
607greater than @code{log_len} bytes into @code{log_buf}.  This is highly
608undesirable and this implementation will NOT do this.
609
610@page
611@subsection log_notify - Notify Process of writes to the system log.
612
613@subheading CALLING SEQUENCE:
614
615@ifset is-C
616@example
617#include <evlog.h>
618
619int log_notify(
620  const logd_t           logdes,
621  const struct sigevent *notification
622);
623@end example
624@end ifset
625
626@ifset is-Ada
627@end ifset
628
629@subheading STATUS CODES:
630
631A successful call to @code{log_notify()} returns a value of zero
632and an unsuccessful call returns the @code{errno}.
633
634@table @b
635@item EBADF
636The logdes argument is not a valid log file descriptor.
637
638@item EINVAL
639The notification argument specifies an invalid signal.
640
641@item EINVAL
642The process has requested a notify on a log that will not be
643written to.
644
645@item ENOSYS
646The function @code{log_notify()} is not supported by this implementation.
647
648@end table
649
650@subheading DESCRIPTION:
651
652If the argument @code{notification} is not @code{NULL} this function registers
653the calling process to be notified of event records received by the system
654log, which match the query parameters associated with the open log descriptor
655specified by @code{logdes}.  The notification specified by the
656@code{notification} argument shall be sent to the process when an event
657record received by the system log is matched by the query attribute of the
658open log file description associated with the @code{logdes} log file
659descriptor.  If the calling process has already registered a notification
660for the @code{logdes} log file descriptor, the new notification shall
661replace the existing notification registration.
662
663If the @code{notification} argument is @code{NULL} and the calling process is
664currently registered to be notified for the @code{logdes} log file
665descriptor, the existing registration shall be removed.
666
667@subheading NOTES:
668
669The @code{_POSIX_LOGGING} feature flag is defined to indicate
670this service is available.
671
672@page
673@subsection log_close - Close log descriptor
674
675@subheading CALLING SEQUENCE:
676
677@ifset is-C
678@example
679#include <evlog.h>
680
681int log_close(
682  const logd_t   logdes
683);
684@end example
685@end ifset
686
687@ifset is-Ada
688@end ifset
689
690@subheading STATUS CODES:
691
692A successful call to @code{log_close()} returns a value of zero
693and an unsuccessful call returns the @code{errno}.
694
695@table @b
696@item EBADF
697The logdes argument is not a valid log file descriptor.
698
699@end table
700
701@subheading DESCRIPTION:
702
703The @code{log_close()} function deallocates the open log file descriptor
704indicated by @code{log_des}.
705
706When all log file descriptors associated with an open log file description
707have been closed, the open log file description is freed.
708
709If the link count of the log file is zero, when all log file descriptors
710have been closed, the space occupied by the log file is freed and the
711log file shall no longer be accessible.
712
713If the process has successfully registered a notification request for the
714log file descriptor, the registration is removed.
715
716@subheading NOTES:
717
718The @code{_POSIX_LOGGING} feature flag is defined to indicate
719this service is available.
720
721@page
722@subsection log_seek - Reposition log file offset
723
724@subheading CALLING SEQUENCE:
725
726@ifset is-C
727@example
728#include <evlog.h>
729
730int log_seek(
731  const logd_t    logdes,
732  log_recid_t     log_recid
733);
734@end example
735@end ifset
736
737@ifset is-Ada
738@end ifset
739
740@subheading STATUS CODES:
741
742A successful call to @code{log_seek()} returns a value of zero
743and an unsuccessful call returns the @code{errno}.
744
745@table @b
746@item EBADF
747The @code{logdes} argument is not a valid log file descriptor.
748@item EINVAL
749The @code{log_recid} argument is not a valid record id.
750
751@end table
752
753@subheading DESCRIPTION:
754
755The @code{log_seek()} function sets the log file offset of the open
756log description associated with the @code{logdes} log file descriptor
757to the event record in the log file identified by @code{log_recid}. 
758The @code{log_recid} argument is either the record id of a valid event
759record or one of the following values, as defined in the header file
760@code{<evlog.h>:}
761
762@table @b
763@item LOG_SEEK_START
764Set log file position to point at the first event
765record in the log file.
766
767@item LOG_SEEK_END
768Set log file position to point after the last event
769record in the log file.
770
771@end table
772
773@subheading NOTES:
774
775The @code{_POSIX_LOGGING} feature flag is defined to indicate
776this service is available.
777
778This implementation can not return EINTR.
779
780This implementation can not return EINVAL to indicate that
781the @code{log_recid} argument is not a valid record id.
782
783@page
784@subsection log_severity_before - Compare event record severities
785
786@subheading CALLING SEQUENCE:
787
788@ifset is-C
789@example
790#include <evlog.h>
791
792int log_severity_before(
793  log_severity_t  s1,
794  log_severity_t  s2
795);
796@end example
797@end ifset
798
799@ifset is-Ada
800@end ifset
801
802@subheading STATUS CODES:
803
804@table @b
805@item 0
806The severity of @code{s1} is less than that of @code{s2}.
807
808@item 1
809The severity of @code{s1} is greater than or equal that of @code{s2}.
810
811@item EINVAL
812The value of either s1 or s2 exceeds @code{LOG_SEVERITY_MAX}.
813
814@end table
815
816@subheading DESCRIPTION:
817
818The @code{log_severity_before()} function compares the severity order
819of the @code{s1} and @code{s2} arguments.  If @code{s1} is of
820severity greater than or equal to that of @code{s2}, then this
821function returns 1.  Otherwise, it returns 0.
822
823If either @code{s1} or @code{s2} specify invalid severity values, the
824return value of @code{log_severity_before()} is unspecified.
825
826@subheading NOTES:
827
828The @code{_POSIX_LOGGING} feature flag is defined to indicate
829this service is available.
830
831The POSIX specification of the return value for this function is ambiguous.
832If EINVAL is equal to 1 in an implementation, then the application
833can not distinguish between greater than and an error condition.
834
835@page
836@subsection log_facilityemptyset - Manipulate log facility sets
837
838@subheading CALLING SEQUENCE:
839
840@ifset is-C
841@example
842#include <evlog.h>
843
844int log_facilityemptyset(
845  log_facility_set_t  *set
846);
847@end example
848@end ifset
849
850@ifset is-Ada
851@end ifset
852
853@subheading STATUS CODES:
854
855A successful call to @code{log_facilityemptyset()} returns a value of zero
856and a unsuccessful call returns the @code{errno}.
857
858@table @b
859@item EFAULT
860The @code{set} argument is an invalid pointer.
861
862@end table
863
864@subheading DESCRIPTION:
865
866The @code{log_facilityemptyset()} function initializes the facility
867set pointed to by the argument @code{set}, such that all facilities
868are excluded.
869
870@subheading NOTES:
871
872The @code{_POSIX_LOGGING} feature flag is defined to indicate
873this service is available.
874
875Applications shall call either @code{log_facilityemptyset()} or
876@code{log_facilityfillset()} at least once for each object of type
877@code{log_facilityset_t} prior to any other use of that object.  If
878such an object is not initialized in this way, but is nonetheless
879supplied as an argument to any of the @code{log_facilityaddset()},
880@code{logfacilitydelset()}, @code{log_facilityismember()} or
881@code{log_open()} functions, the results are undefined.
882
883@page
884@subsection log_facilityfillset - Manipulate log facility sets
885
886@subheading CALLING SEQUENCE:
887
888@ifset is-C
889@example
890#include <evlog.h>
891
892int log_facilityfillset(
893  log_facility_set_t  *set
894);
895@end example
896@end ifset
897
898@ifset is-Ada
899@end ifset
900
901@subheading STATUS CODES:
902
903A successful call to @code{log_facilityfillset()} returns a value of zero
904and a unsuccessful call returns the @code{errno}.
905
906@table @b
907@item EFAULT
908The @code{set} argument is an invalid pointer.
909
910@end table
911
912@subheading DESCRIPTION:
913
914The @code{log_facilityfillset()} function initializes the facility
915set pointed to by the argument @code{set}, such that all facilities
916are included.
917
918@subheading NOTES:
919
920The @code{_POSIX_LOGGING} feature flag is defined to indicate
921this service is available.
922
923Applications shall call either @code{log_facilityemptyset()} or
924@code{log_facilityfillset()} at least once for each object of type
925@code{log_facilityset_t} prior to any other use of that object.  If
926such an object is not initialized in this way, but is nonetheless
927supplied as an argument to any of the @code{log_facilityaddset()},
928@code{logfacilitydelset()}, @code{log_facilityismember()} or
929@code{log_open()} functions, the results are undefined.
930
931@page
932@subsection log_facilityaddset - Manipulate log facility sets
933
934@subheading CALLING SEQUENCE:
935
936@ifset is-C
937@example
938#include <evlog.h>
939
940int log_facilityaddset(
941  log_facility_set_t  *set,
942  log_facility_t       facilityno
943);
944@end example
945@end ifset
946
947@ifset is-Ada
948@end ifset
949
950@subheading STATUS CODES:
951
952A successful call to @code{log_facilityaddset()} returns a value of zero
953and a unsuccessful call returns the @code{errno}.
954
955@table @b
956@item EFAULT
957The @code{set} argument is an invalid pointer.
958
959@item EINVAL
960The @code{facilityno} argument is not a valid facility.
961
962@end table
963
964@subheading DESCRIPTION:
965
966The @code{log_facilityaddset()} function adds the individual
967facility specified by the value of the argument @code{facilityno}
968to the facility set pointed to by the argument @code{set}.
969
970@subheading NOTES:
971
972The @code{_POSIX_LOGGING} feature flag is defined to indicate
973this service is available.
974
975Applications shall call either @code{log_facilityemptyset()} or
976@code{log_facilityfillset()} at least once for each object of type
977@code{log_facilityset_t} prior to any other use of that object.  If
978such an object is not initialized in this way, but is nonetheless
979supplied as an argument to any of the @code{log_facilityaddset()},
980@code{logfacilitydelset()}, @code{log_facilityismember()} or
981@code{log_open()} functions, the results are undefined.
982
983@page
984@subsection log_facilitydelset - Manipulate log facility sets
985
986@subheading CALLING SEQUENCE:
987
988@ifset is-C
989@example
990#include <evlog.h>
991
992int log_facilitydelset(
993  log_facility_set_t  *set,
994  log_facility_t       facilityno
995);
996@end example
997@end ifset
998
999@ifset is-Ada
1000@end ifset
1001
1002@subheading STATUS CODES:
1003
1004A successful call to @code{log_facilitydelset()} returns a value of zero
1005and a unsuccessful call returns the @code{errno}.
1006
1007@table @b
1008@item EFAULT
1009The @code{set} argument is an invalid pointer.
1010
1011@item EINVAL
1012The @code{facilityno} argument is not a valid facility.
1013
1014@end table
1015
1016@subheading DESCRIPTION:
1017
1018The @code{log_facilitydelset()} function deletes the individual
1019facility specified by the value of the argument @code{facilityno}
1020from the facility set pointed to by the argument @code{set}.
1021
1022@subheading NOTES:
1023
1024The @code{_POSIX_LOGGING} feature flag is defined to indicate
1025this service is available.
1026
1027Applications shall call either @code{log_facilityemptyset()} or
1028@code{log_facilityfillset()} at least once for each object of type
1029@code{log_facilityset_t} prior to any other use of that object.  If
1030such an object is not initialized in this way, but is nonetheless
1031supplied as an argument to any of the @code{log_facilityaddset()},
1032@code{logfacilitydelset()}, @code{log_facilityismember()} or
1033@code{log_open()} functions, the results are undefined.
1034
1035@page
1036@subsection log_facilityismember - Manipulate log facility sets
1037
1038@subheading CALLING SEQUENCE:
1039
1040@ifset is-C
1041@example
1042#include <evlog.h>
1043
1044int log_facilityismember(
1045  const log_facility_set_t *set,
1046  log_facility_t            facilityno,
1047  const int                *member
1048);
1049@end example
1050@end ifset
1051
1052@ifset is-Ada
1053@end ifset
1054
1055@subheading STATUS CODES:
1056
1057A successful call to @code{log_facilityismember()} returns a value
1058of zero and a unsuccessful call returns the @code{errno}.
1059
1060@table @b
1061@item EFAULT
1062The @code{set} or @code{member} argument is an invalid pointer.
1063
1064@item EINVAL
1065The @code{facilityno} argument is not a valid facility.
1066
1067@end table
1068
1069@subheading DESCRIPTION:
1070
1071The @code{log_facilityismember()} function tests whether the facility
1072specified by the value of the argument @code{facilityno} is a member
1073of the set pointed to by the argument @code{set}.  Upon successful
1074completion, the @code{log_facilityismember()} function either returns
1075a value of one to the location specified by @code{member} if the
1076specified facility is a member of the specified set or value of
1077zero to the location specified by @code{member} if the specified
1078facility is not a member of the specified set.
1079
1080@subheading NOTES:
1081
1082The @code{_POSIX_LOGGING} feature flag is defined to indicate
1083this service is available.
1084
1085Applications shall call either @code{log_facilityemptyset()} or
1086@code{log_facilityfillset()} at least once for each object of type
1087@code{log_facilityset_t} prior to any other use of that object.  If
1088such an object is not initialized in this way, but is nonetheless
1089supplied as an argument to any of the @code{log_facilityaddset()},
1090@code{logfacilitydelset()}, @code{log_facilityismember()} or
1091@code{log_open()} functions, the results are undefined.
1092
1093@page
1094@subsection log_facilityisvalid - Manipulate log facility sets
1095
1096@subheading CALLING SEQUENCE:
1097
1098@ifset is-C
1099@example
1100#include <evlog.h>
1101
1102int log_facilityisvalid(
1103  log_facility_t        facilityno
1104);
1105@end example
1106@end ifset
1107
1108@ifset is-Ada
1109@end ifset
1110
1111@subheading STATUS CODES:
1112
1113A return value of zero indicates that the @code{facilityno} is valid and
1114a return value other than zero represents an @code{errno}.
1115
1116@table @b
1117@item EFAULT
1118The @code{set} or @code{member} argument is an invalid pointer.
1119
1120@item EINVAL
1121The @code{facilityno} argument is not a valid facility.
1122
1123@end table
1124
1125@subheading DESCRIPTION:
1126
1127The @code{log_facilityisvalid()} function tests whether the facility
1128specified by the value of the argument @code{facilityno} is a valid
1129facility number.  Upon successful completion, the
1130the @code{log_facilityisvalid()} function either returns a value of
11310 if the specified facility is a valid facility or value of EINVAL
1132if the specified facility is not a valid facility.
1133
1134@subheading NOTES:
1135
1136The @code{_POSIX_LOGGING} feature flag is defined to indicate
1137this service is available.
1138
1139Applications shall call either @code{log_facilityemptyset()} or
1140@code{log_facilityfillset()} at least once for each object of type
1141@code{log_facilityset_t} prior to any other use of that object.  If
1142such an object is not initialized in this way, but is nonetheless
1143supplied as an argument to any of the @code{log_facilityaddset()},
1144@code{logfacilitydelset()}, @code{log_facilityismember()} or
1145@code{log_open()} functions, the results are undefined.
1146
1147@page
1148@subsection log_create - Creates a log file
1149
1150@subheading CALLING SEQUENCE:
1151
1152@ifset is-C
1153@example
1154#include <evlog.h>
1155
1156int log_create(
1157  logd_t       *ld,
1158  const char   *path,
1159);
1160@end example
1161@end ifset
1162
1163@ifset is-Ada
1164@end ifset
1165
1166@subheading STATUS CODES:
1167
1168A successful call to @code{log_create()} returns a value
1169of zero and a unsuccessful call returns the @code{errno}.
1170
1171@table @b
1172
1173@item EEXIST
1174The @code{path} already exists and O_CREAT and O_EXCL were used.
1175
1176@item EISDIR
1177The @code{path} refers to a directory and the access requested involved
1178writing.
1179
1180@item ETXTBSY
1181The @code{path} refers to an executable image which is currently being 
1182executed and write access was requested.
1183
1184@item EFAULT
1185The @code{path} points outside your accessible address space.
1186
1187@item EACCES
1188The requested access to the file is not allowed, or one of the
1189directories in @code{path} did not allow search (execute) permission.
1190
1191@item ENAMETOOLONG
1192The @code{path} was too long.
1193
1194@item ENOENT
1195A directory component in @code{path} does not exist or is a dangling symbolic
1196link.
1197
1198@item ENOTDIR
1199A component used as a directory in @code{path} is not, in fact, a directory.
1200
1201@item EMFILE
1202The process already has the maximum number of files open.
1203
1204@item ENFILE
1205The limit on the total number of files open on the system has been reached.
1206
1207@item ENOMEM
1208Insufficient kernel memory was available.
1209
1210@item EROFS
1211The @code{path} refers to a file on a read-only filesystem and write access
1212was requested.
1213
1214@item ELOOP
1215The @code{path} contains a reference to a circular symbolic link, ie a
1216symbolic link whose expansion contains a reference to itself.
1217
1218@end table
1219
1220@subheading DESCRIPTION:
1221
1222This function attempts to create a file associated with the @code{logdes}
1223argument in the directory provided by the argument @code{path}.
1224
1225@subheading NOTES:
1226
1227The @code{_POSIX_LOGGING} feature flag is defined to indicate
1228this service is available.
1229
1230@page
1231@subsection log_sys_create - Creates a system log file
1232
1233@subheading CALLING SEQUENCE:
1234
1235@ifset is-C
1236@example
1237#include <evlog.h>
1238
1239int log_sys_create();
1240@end example
1241@end ifset
1242
1243@ifset is-Ada
1244@end ifset
1245
1246@subheading STATUS CODES:
1247
1248A successful call to @code{log_sys_create()} returns a value
1249of zero and a unsuccessful call returns the @code{errno}.
1250
1251@table @b
1252@item EEXIST
1253The directory path to the system log already exist.
1254
1255@end table
1256
1257@subheading DESCRIPTION:
1258
1259This function will create a predefined system log directory path and
1260system log file if they do not already exist.
1261
1262@subheading NOTES:
1263
1264The @code{_POSIX_LOGGING} feature flag is defined to indicate
1265this service is available.
Note: See TracBrowser for help on using the repository browser.