source: rtems/doc/new_chapters/eventlog.t @ 8ed58e65

4.104.114.84.95
Last change on this file since 8ed58e65 was 8ed58e65, checked in by Wade A Smith <warm38@…>, on 09/30/98 at 18:19:40

Made formatting changes to the file

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