]>
git.saurik.com Git - apple/syslog.git/blob - aslmanager.tproj/daemon.h
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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,
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.
21 * @APPLE_LICENSE_HEADER_END@
27 #include <asl_msg_list.h>
28 #include "asl_common.h"
30 #define DEFAULT_MAX_SIZE 150000000
31 #define IOBUFSIZE 4096
33 #define DO_ASLDB 0x00000001
34 #define DO_MODULE 0x00000002
35 #define DO_CHECKPT 0x00000004
37 #define DEBUG_FLAG_MASK 0xfffffff0
38 #define DEBUG_LEVEL_MASK 0x0000000f
39 #define DEBUG_FILE 0x00000010
40 #define DEBUG_STDERR 0x00000020
41 #define DEBUG_ASL 0x00000040
43 #define AUX_URL_MINE "file:///var/log/asl/"
44 #define AUX_URL_MINE_LEN 20
46 #define SECONDS_PER_HOUR 3600
47 #define SECONDS_PER_MINUTE 60
49 /* length of "file://" */
50 #define AUX_URL_PATH_OFFSET 7
52 #define NAME_LIST_FLAG_COMPRESSED 0x00000001
54 #define DAEMON_STATE_IDLE 0x00000000
55 #define DAEMON_STATE_MAIN 0x00000001
56 #define DAEMON_STATE_CACHE 0x00000002
58 typedef struct name_list_s
63 struct name_list_s
*next
;
66 const char *keep_str(uint8_t mask
);
67 void set_debug(int flag
, const char *str
);
68 void debug_log(int level
, char *str
, ...);
71 name_list_t
*add_to_name_list(name_list_t
*l
, const char *name
, size_t size
, uint32_t flags
);
72 void free_name_list(name_list_t
*l
);
74 int copy_compress_file(asl_out_dst_data_t
*asldst
, const char *src
, const char *dst
);
76 void filesystem_rename(const char *src
, const char *dst
);
77 void filesystem_unlink(const char *path
);
78 void filesystem_truncate(const char *path
);
79 void filesystem_rmdir(const char *path
);
80 int32_t filesystem_copy(asl_out_dst_data_t
*asldst
, const char *src
, const char *dst
, uint32_t flags
);
81 int32_t filesystem_reset_ctime(const char *path
);
83 int remove_directory(const char *path
);
84 size_t directory_size(const char *path
);
86 time_t parse_ymd_name(const char *name
);
87 uint32_t ymd_file_age(const char *name
, time_t now
, uid_t
*u
, gid_t
*g
);
88 uint32_t ymd_file_filter(const char *name
, const char *path
, uint32_t keep_mask
, mode_t ymd_mode
, uid_t ymd_uid
, gid_t ymd_gid
);
90 int process_asl_data_store(asl_out_dst_data_t
*dst
, asl_out_dst_data_t
*opts
);
91 int module_copy_rename(asl_out_dst_data_t
*dst
);
92 int module_expire(asl_out_dst_data_t
*dst
, asl_out_dst_data_t
*opts
);
93 int module_check_size(asl_out_dst_data_t
*dst
, asl_out_dst_data_t
*opts
, bool check
, size_t *msize
);
94 int process_module(asl_out_module_t
*mod
, asl_out_dst_data_t
*opts
);
95 int process_dst(asl_out_dst_data_t
*dst
, asl_out_dst_data_t
*opts
);
97 asl_msg_list_t
* control_query(asl_msg_t
*a
);
98 int checkpoint(const char *name
);
100 int cache_delete_task(bool query
, size_t *size
);
101 void main_task(void);