]> git.saurik.com Git - apple/libc.git/blame - gen/asl_store.h
Libc-763.11.tar.gz
[apple/libc.git] / gen / asl_store.h
CommitLineData
b5d655f7 1/*
1f2f436a 2 * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
b5d655f7
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
1f2f436a
A
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
b5d655f7
A
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1f2f436a
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
b5d655f7
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
1f2f436a
A
24#ifndef __ASL_STORE_H__
25#define __ASL_STORE_H__
26
b5d655f7
A
27#include <stdio.h>
28#include <stdint.h>
29#include <sys/time.h>
30#include <asl.h>
1f2f436a
A
31#include "asl_file.h"
32#include <Availability.h>
b5d655f7
A
33
34#define PATH_ASL_STORE "/var/log/asl"
35#define PATH_ASL_ARCHIVE "/var/log/asl.archive"
36#define FILE_ASL_STORE_DATA "StoreData"
37#define FILE_ASL_STORE_SWEEP_SEMAPHORE "SweepStore"
38
39#define FILE_CACHE_SIZE 64
40#define FILE_CACHE_TTL 300
41
42typedef struct
43{
44 time_t ts;
45 uid_t u;
46 gid_t g;
34e8f829 47 time_t bb;
b5d655f7
A
48 char *path;
49 asl_file_t *f;
50} asl_cached_file_t;
51
52typedef struct
53{
54 char *base_dir;
55 FILE *storedata;
56 uint64_t next_id;
b5d655f7
A
57 asl_cached_file_t file_cache[FILE_CACHE_SIZE];
58 void *work;
59 time_t start_today;
60 time_t start_tomorrow;
61 time_t last_write;
62 size_t max_file_size;
63} asl_store_t;
64
1f2f436a
A
65uint32_t asl_store_open_write(const char *basedir, asl_store_t **s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
66uint32_t asl_store_open_read(const char *basedir, asl_store_t **s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
67uint32_t asl_store_close(asl_store_t *s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
68uint32_t asl_store_statistics(asl_store_t *s, aslmsg *msg) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
69
70uint32_t asl_store_save(asl_store_t *s, aslmsg msg) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
b5d655f7 71
1f2f436a
A
72uint32_t asl_store_match(asl_store_t *s, aslresponse query, aslresponse *res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
73uint32_t asl_store_match_timeout(asl_store_t *s, aslresponse query, aslresponse *res, uint64_t *last_id, uint64_t start_id, uint32_t count, int32_t direction, uint32_t usec) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2);
b5d655f7 74
1f2f436a
A
75uint32_t asl_store_match_start(asl_store_t *s, uint64_t start_id, int32_t direction) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
76uint32_t asl_store_match_next(asl_store_t *s, aslresponse query, aslresponse *res, uint32_t count) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
b5d655f7 77
1f2f436a
A
78uint32_t asl_store_max_file_size(asl_store_t *s, size_t max) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
79uint32_t asl_store_signal_sweep(asl_store_t *s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
80uint32_t asl_store_sweep_file_cache(asl_store_t *s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2);
b5d655f7 81
1f2f436a 82uint32_t asl_store_open_aux(asl_store_t *s, aslmsg msg, int *fd, char **url) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
b5d655f7
A
83
84#endif __ASL_STORE_H__