line |
stmt |
bran |
cond |
sub |
time |
code |
1
|
|
|
|
|
|
BOOT: |
2
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
#ifdef dTHX |
4
|
|
|
|
|
|
dTHX; |
5
|
|
|
|
|
|
#endif |
6
|
2
|
|
|
|
|
HV *symbol_table = get_hv("Sys::Syslog::", GV_ADD); |
7
|
|
|
|
|
|
|
8
|
|
|
|
|
|
static const struct iv_s values_for_iv[] = |
9
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
#ifdef LOG_ALERT |
11
|
|
|
|
|
|
{ "LOG_ALERT", 9, LOG_ALERT }, |
12
|
|
|
|
|
|
#endif |
13
|
|
|
|
|
|
#ifdef LOG_CRIT |
14
|
|
|
|
|
|
{ "LOG_CRIT", 8, LOG_CRIT }, |
15
|
|
|
|
|
|
#endif |
16
|
|
|
|
|
|
#ifdef LOG_DEBUG |
17
|
|
|
|
|
|
{ "LOG_DEBUG", 9, LOG_DEBUG }, |
18
|
|
|
|
|
|
#endif |
19
|
|
|
|
|
|
#ifdef LOG_EMERG |
20
|
|
|
|
|
|
{ "LOG_EMERG", 9, LOG_EMERG }, |
21
|
|
|
|
|
|
#endif |
22
|
|
|
|
|
|
#ifdef LOG_ERR |
23
|
|
|
|
|
|
{ "LOG_ERR", 7, LOG_ERR }, |
24
|
|
|
|
|
|
#endif |
25
|
|
|
|
|
|
#ifdef LOG_INFO |
26
|
|
|
|
|
|
{ "LOG_INFO", 8, LOG_INFO }, |
27
|
|
|
|
|
|
#endif |
28
|
|
|
|
|
|
#ifdef LOG_NOTICE |
29
|
|
|
|
|
|
{ "LOG_NOTICE", 10, LOG_NOTICE }, |
30
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
#ifdef LOG_WARNING |
32
|
|
|
|
|
|
{ "LOG_WARNING", 11, LOG_WARNING }, |
33
|
|
|
|
|
|
#endif |
34
|
|
|
|
|
|
#ifdef LOG_AUTH |
35
|
|
|
|
|
|
{ "LOG_AUTH", 8, LOG_AUTH }, |
36
|
|
|
|
|
|
#endif |
37
|
|
|
|
|
|
#ifdef LOG_AUTHPRIV |
38
|
|
|
|
|
|
{ "LOG_AUTHPRIV", 12, LOG_AUTHPRIV }, |
39
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
#ifdef LOG_CRON |
41
|
|
|
|
|
|
{ "LOG_CRON", 8, LOG_CRON }, |
42
|
|
|
|
|
|
#endif |
43
|
|
|
|
|
|
#ifdef LOG_DAEMON |
44
|
|
|
|
|
|
{ "LOG_DAEMON", 10, LOG_DAEMON }, |
45
|
|
|
|
|
|
#endif |
46
|
|
|
|
|
|
#ifdef LOG_FTP |
47
|
|
|
|
|
|
{ "LOG_FTP", 7, LOG_FTP }, |
48
|
|
|
|
|
|
#endif |
49
|
|
|
|
|
|
#ifdef LOG_KERN |
50
|
|
|
|
|
|
{ "LOG_KERN", 8, LOG_KERN }, |
51
|
|
|
|
|
|
#endif |
52
|
|
|
|
|
|
#ifdef LOG_LOCAL0 |
53
|
|
|
|
|
|
{ "LOG_LOCAL0", 10, LOG_LOCAL0 }, |
54
|
|
|
|
|
|
#endif |
55
|
|
|
|
|
|
#ifdef LOG_LOCAL1 |
56
|
|
|
|
|
|
{ "LOG_LOCAL1", 10, LOG_LOCAL1 }, |
57
|
|
|
|
|
|
#endif |
58
|
|
|
|
|
|
#ifdef LOG_LOCAL2 |
59
|
|
|
|
|
|
{ "LOG_LOCAL2", 10, LOG_LOCAL2 }, |
60
|
|
|
|
|
|
#endif |
61
|
|
|
|
|
|
#ifdef LOG_LOCAL3 |
62
|
|
|
|
|
|
{ "LOG_LOCAL3", 10, LOG_LOCAL3 }, |
63
|
|
|
|
|
|
#endif |
64
|
|
|
|
|
|
#ifdef LOG_LOCAL4 |
65
|
|
|
|
|
|
{ "LOG_LOCAL4", 10, LOG_LOCAL4 }, |
66
|
|
|
|
|
|
#endif |
67
|
|
|
|
|
|
#ifdef LOG_LOCAL5 |
68
|
|
|
|
|
|
{ "LOG_LOCAL5", 10, LOG_LOCAL5 }, |
69
|
|
|
|
|
|
#endif |
70
|
|
|
|
|
|
#ifdef LOG_LOCAL6 |
71
|
|
|
|
|
|
{ "LOG_LOCAL6", 10, LOG_LOCAL6 }, |
72
|
|
|
|
|
|
#endif |
73
|
|
|
|
|
|
#ifdef LOG_LOCAL7 |
74
|
|
|
|
|
|
{ "LOG_LOCAL7", 10, LOG_LOCAL7 }, |
75
|
|
|
|
|
|
#endif |
76
|
|
|
|
|
|
#ifdef LOG_LPR |
77
|
|
|
|
|
|
{ "LOG_LPR", 7, LOG_LPR }, |
78
|
|
|
|
|
|
#endif |
79
|
|
|
|
|
|
#ifdef LOG_MAIL |
80
|
|
|
|
|
|
{ "LOG_MAIL", 8, LOG_MAIL }, |
81
|
|
|
|
|
|
#endif |
82
|
|
|
|
|
|
#ifdef LOG_NEWS |
83
|
|
|
|
|
|
{ "LOG_NEWS", 8, LOG_NEWS }, |
84
|
|
|
|
|
|
#endif |
85
|
|
|
|
|
|
#ifdef LOG_SYSLOG |
86
|
|
|
|
|
|
{ "LOG_SYSLOG", 10, LOG_SYSLOG }, |
87
|
|
|
|
|
|
#endif |
88
|
|
|
|
|
|
#ifdef LOG_USER |
89
|
|
|
|
|
|
{ "LOG_USER", 8, LOG_USER }, |
90
|
|
|
|
|
|
#endif |
91
|
|
|
|
|
|
#ifdef LOG_UUCP |
92
|
|
|
|
|
|
{ "LOG_UUCP", 8, LOG_UUCP }, |
93
|
|
|
|
|
|
#endif |
94
|
|
|
|
|
|
#ifdef LOG_INSTALL |
95
|
|
|
|
|
|
{ "LOG_INSTALL", 11, LOG_INSTALL }, |
96
|
|
|
|
|
|
#endif |
97
|
|
|
|
|
|
#ifdef LOG_LAUNCHD |
98
|
|
|
|
|
|
{ "LOG_LAUNCHD", 11, LOG_LAUNCHD }, |
99
|
|
|
|
|
|
#endif |
100
|
|
|
|
|
|
#ifdef LOG_NETINFO |
101
|
|
|
|
|
|
{ "LOG_NETINFO", 11, LOG_NETINFO }, |
102
|
|
|
|
|
|
#endif |
103
|
|
|
|
|
|
#ifdef LOG_RAS |
104
|
|
|
|
|
|
{ "LOG_RAS", 7, LOG_RAS }, |
105
|
|
|
|
|
|
#endif |
106
|
|
|
|
|
|
#ifdef LOG_REMOTEAUTH |
107
|
|
|
|
|
|
{ "LOG_REMOTEAUTH", 14, LOG_REMOTEAUTH }, |
108
|
|
|
|
|
|
#endif |
109
|
|
|
|
|
|
#ifdef LOG_CONSOLE |
110
|
|
|
|
|
|
{ "LOG_CONSOLE", 11, LOG_CONSOLE }, |
111
|
|
|
|
|
|
#endif |
112
|
|
|
|
|
|
#ifdef LOG_NTP |
113
|
|
|
|
|
|
{ "LOG_NTP", 7, LOG_NTP }, |
114
|
|
|
|
|
|
#endif |
115
|
|
|
|
|
|
#ifdef LOG_SECURITY |
116
|
|
|
|
|
|
{ "LOG_SECURITY", 12, LOG_SECURITY }, |
117
|
|
|
|
|
|
#endif |
118
|
|
|
|
|
|
#ifdef LOG_AUDIT |
119
|
|
|
|
|
|
{ "LOG_AUDIT", 9, LOG_AUDIT }, |
120
|
|
|
|
|
|
#endif |
121
|
|
|
|
|
|
#ifdef LOG_LFMT |
122
|
|
|
|
|
|
{ "LOG_LFMT", 8, LOG_LFMT }, |
123
|
|
|
|
|
|
#endif |
124
|
|
|
|
|
|
#ifdef LOG_CONS |
125
|
|
|
|
|
|
{ "LOG_CONS", 8, LOG_CONS }, |
126
|
|
|
|
|
|
#endif |
127
|
|
|
|
|
|
#ifdef LOG_PID |
128
|
|
|
|
|
|
{ "LOG_PID", 7, LOG_PID }, |
129
|
|
|
|
|
|
#endif |
130
|
|
|
|
|
|
#ifdef LOG_NDELAY |
131
|
|
|
|
|
|
{ "LOG_NDELAY", 10, LOG_NDELAY }, |
132
|
|
|
|
|
|
#endif |
133
|
|
|
|
|
|
#ifdef LOG_NOWAIT |
134
|
|
|
|
|
|
{ "LOG_NOWAIT", 10, LOG_NOWAIT }, |
135
|
|
|
|
|
|
#endif |
136
|
|
|
|
|
|
#ifdef LOG_ODELAY |
137
|
|
|
|
|
|
{ "LOG_ODELAY", 10, LOG_ODELAY }, |
138
|
|
|
|
|
|
#endif |
139
|
|
|
|
|
|
#ifdef LOG_PERROR |
140
|
|
|
|
|
|
{ "LOG_PERROR", 10, LOG_PERROR }, |
141
|
|
|
|
|
|
#endif |
142
|
|
|
|
|
|
#ifdef LOG_FACMASK |
143
|
|
|
|
|
|
{ "LOG_FACMASK", 11, LOG_FACMASK }, |
144
|
|
|
|
|
|
#endif |
145
|
|
|
|
|
|
#ifdef LOG_PRIMASK |
146
|
|
|
|
|
|
{ "LOG_PRIMASK", 11, LOG_PRIMASK }, |
147
|
|
|
|
|
|
#endif |
148
|
|
|
|
|
|
#ifdef LOG_NFACILITIES |
149
|
|
|
|
|
|
{ "LOG_NFACILITIES", 15, LOG_NFACILITIES }, |
150
|
|
|
|
|
|
#endif |
151
|
|
|
|
|
|
#ifndef LOG_INSTALL |
152
|
|
|
|
|
|
/* This is the default value: */ |
153
|
|
|
|
|
|
{ "LOG_INSTALL", 11, LOG_USER }, |
154
|
|
|
|
|
|
#endif |
155
|
|
|
|
|
|
#ifndef LOG_LAUNCHD |
156
|
|
|
|
|
|
/* This is the default value: */ |
157
|
|
|
|
|
|
{ "LOG_LAUNCHD", 11, LOG_DAEMON }, |
158
|
|
|
|
|
|
#endif |
159
|
|
|
|
|
|
#ifndef LOG_NETINFO |
160
|
|
|
|
|
|
/* This is the default value: */ |
161
|
|
|
|
|
|
{ "LOG_NETINFO", 11, LOG_DAEMON }, |
162
|
|
|
|
|
|
#endif |
163
|
|
|
|
|
|
#ifndef LOG_RAS |
164
|
|
|
|
|
|
/* This is the default value: */ |
165
|
|
|
|
|
|
{ "LOG_RAS", 7, LOG_AUTH }, |
166
|
|
|
|
|
|
#endif |
167
|
|
|
|
|
|
#ifndef LOG_REMOTEAUTH |
168
|
|
|
|
|
|
/* This is the default value: */ |
169
|
|
|
|
|
|
{ "LOG_REMOTEAUTH", 14, LOG_AUTH }, |
170
|
|
|
|
|
|
#endif |
171
|
|
|
|
|
|
#ifndef LOG_CONSOLE |
172
|
|
|
|
|
|
/* This is the default value: */ |
173
|
|
|
|
|
|
{ "LOG_CONSOLE", 11, LOG_USER }, |
174
|
|
|
|
|
|
#endif |
175
|
|
|
|
|
|
#ifndef LOG_NTP |
176
|
|
|
|
|
|
/* This is the default value: */ |
177
|
|
|
|
|
|
{ "LOG_NTP", 7, LOG_DAEMON }, |
178
|
|
|
|
|
|
#endif |
179
|
|
|
|
|
|
#ifndef LOG_SECURITY |
180
|
|
|
|
|
|
/* This is the default value: */ |
181
|
|
|
|
|
|
{ "LOG_SECURITY", 12, LOG_AUTH }, |
182
|
|
|
|
|
|
#endif |
183
|
|
|
|
|
|
#ifndef LOG_AUDIT |
184
|
|
|
|
|
|
/* This is the default value: */ |
185
|
|
|
|
|
|
{ "LOG_AUDIT", 9, LOG_AUTH }, |
186
|
|
|
|
|
|
#endif |
187
|
|
|
|
|
|
#ifndef LOG_LFMT |
188
|
|
|
|
|
|
/* This is the default value: */ |
189
|
|
|
|
|
|
{ "LOG_LFMT", 8, LOG_USER }, |
190
|
|
|
|
|
|
#endif |
191
|
|
|
|
|
|
#ifndef LOG_PRIMASK |
192
|
|
|
|
|
|
/* This is the default value: */ |
193
|
|
|
|
|
|
{ "LOG_PRIMASK", 11, 7 }, |
194
|
|
|
|
|
|
#endif |
195
|
|
|
|
|
|
#ifndef LOG_NFACILITIES |
196
|
|
|
|
|
|
/* This is the default value: */ |
197
|
|
|
|
|
|
{ "LOG_NFACILITIES", 15, 30 }, |
198
|
|
|
|
|
|
#endif |
199
|
|
|
|
|
|
{ NULL, 0, 0 } }; |
200
|
|
|
|
|
|
const struct iv_s *value_for_iv = values_for_iv; |
201
|
|
|
|
|
|
|
202
|
|
|
|
|
|
static const struct pv_s values_for_pv[] = |
203
|
|
|
|
|
|
{ |
204
|
|
|
|
|
|
#ifdef _PATH_LOG |
205
|
|
|
|
|
|
{ "_PATH_LOG", 9, _PATH_LOG }, |
206
|
|
|
|
|
|
#endif |
207
|
|
|
|
|
|
#ifndef _PATH_LOG |
208
|
|
|
|
|
|
/* This is the default value: */ |
209
|
|
|
|
|
|
{ "_PATH_LOG", 9, "/dev/log" }, |
210
|
|
|
|
|
|
#endif |
211
|
|
|
|
|
|
{ NULL, 0, 0 } }; |
212
|
|
|
|
|
|
const struct pv_s *value_for_pv = values_for_pv; |
213
|
98
|
|
|
|
|
while (value_for_iv->name) { |
214
|
94
|
|
|
|
|
constant_add_symbol(aTHX_ symbol_table, value_for_iv->name, |
215
|
|
|
|
|
|
value_for_iv->namelen, newSViv(value_for_iv->value)); |
216
|
94
|
|
|
|
|
++value_for_iv; |
217
|
|
|
|
|
|
} |
218
|
4
|
|
|
|
|
while (value_for_pv->name) { |
219
|
2
|
|
|
|
|
constant_add_symbol(aTHX_ symbol_table, value_for_pv->name, |
220
|
|
|
|
|
|
value_for_pv->namelen, newSVpv(value_for_pv->value, 0)); |
221
|
2
|
|
|
|
|
++value_for_pv; |
222
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
if (C_ARRAY_LENGTH(values_for_notfound) > 1) { |
224
|
|
|
|
|
|
#ifndef SYMBIAN |
225
|
|
|
|
|
|
HV *const constant_missing = get_missing_hash(aTHX); |
226
|
|
|
|
|
|
#endif |
227
|
|
|
|
|
|
const struct notfound_s *value_for_notfound = values_for_notfound; |
228
|
|
|
|
|
|
do { |
229
|
|
|
|
|
|
|
230
|
|
|
|
|
|
/* Need to add prototypes, else parsing will vary by platform. */ |
231
|
|
|
|
|
|
HE *he = (HE*) hv_common_key_len(symbol_table, |
232
|
|
|
|
|
|
value_for_notfound->name, |
233
|
|
|
|
|
|
value_for_notfound->namelen, |
234
|
|
|
|
|
|
HV_FETCH_LVALUE, NULL, 0); |
235
|
|
|
|
|
|
SV *sv; |
236
|
|
|
|
|
|
#ifndef SYMBIAN |
237
|
|
|
|
|
|
HEK *hek; |
238
|
|
|
|
|
|
#endif |
239
|
|
|
|
|
|
if (!he) { |
240
|
|
|
|
|
|
Perl_croak(aTHX_ |
241
|
|
|
|
|
|
"Couldn't add key '%s' to %%Sys::Syslog::", |
242
|
|
|
|
|
|
value_for_notfound->name); |
243
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
sv = HeVAL(he); |
245
|
|
|
|
|
|
if (!SvOK(sv) && SvTYPE(sv) != SVt_PVGV) { |
246
|
|
|
|
|
|
/* Nothing was here before, so mark a prototype of "" */ |
247
|
|
|
|
|
|
sv_setpvn(sv, "", 0); |
248
|
|
|
|
|
|
} else if (SvPOK(sv) && SvCUR(sv) == 0) { |
249
|
|
|
|
|
|
/* There is already a prototype of "" - do nothing */ |
250
|
|
|
|
|
|
} else { |
251
|
|
|
|
|
|
/* Someone has been here before us - have to make a real |
252
|
|
|
|
|
|
typeglob. */ |
253
|
|
|
|
|
|
/* It turns out to be incredibly hard to deal with all the |
254
|
|
|
|
|
|
corner cases of sub foo (); and reporting errors correctly, |
255
|
|
|
|
|
|
so lets cheat a bit. Start with a constant subroutine */ |
256
|
|
|
|
|
|
CV *cv = newCONSTSUB(symbol_table, |
257
|
|
|
|
|
|
value_for_notfound->name, |
258
|
|
|
|
|
|
&PL_sv_yes); |
259
|
|
|
|
|
|
/* and then turn it into a non constant declaration only. */ |
260
|
|
|
|
|
|
SvREFCNT_dec(CvXSUBANY(cv).any_ptr); |
261
|
|
|
|
|
|
CvCONST_off(cv); |
262
|
|
|
|
|
|
CvXSUB(cv) = NULL; |
263
|
|
|
|
|
|
CvXSUBANY(cv).any_ptr = NULL; |
264
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
#ifndef SYMBIAN |
266
|
|
|
|
|
|
hek = HeKEY_hek(he); |
267
|
|
|
|
|
|
if (!hv_common(constant_missing, NULL, HEK_KEY(hek), |
268
|
|
|
|
|
|
HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE, |
269
|
|
|
|
|
|
&PL_sv_yes, HEK_HASH(hek))) |
270
|
|
|
|
|
|
Perl_croak(aTHX_ "Couldn't add key '%s' to missing_hash", |
271
|
|
|
|
|
|
value_for_notfound->name); |
272
|
|
|
|
|
|
#endif |
273
|
|
|
|
|
|
} while ((++value_for_notfound)->name); |
274
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
/* As we've been creating subroutines, we better invalidate any cached |
276
|
|
|
|
|
|
methods */ |
277
|
2
|
|
|
|
|
mro_method_changed_in(symbol_table); |
278
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
280
|
|
|
|
|
|
void |
281
|
|
|
|
|
|
constant(sv) |
282
|
|
|
|
|
|
INPUT: |
283
|
|
|
|
|
|
SV * sv; |
284
|
|
|
|
|
|
PPCODE: |
285
|
|
|
|
|
|
#ifndef SYMBIAN |
286
|
|
|
|
|
|
/* It's not obvious how to calculate this at C pre-processor time. |
287
|
|
|
|
|
|
However, any compiler optimiser worth its salt should be able to |
288
|
|
|
|
|
|
remove the dead code, and hopefully the now-obviously-unused static |
289
|
|
|
|
|
|
function too. */ |
290
|
|
|
|
|
|
HV *constant_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1) |
291
|
|
|
|
|
|
? get_missing_hash(aTHX) : NULL; |
292
|
|
|
|
|
|
if ((C_ARRAY_LENGTH(values_for_notfound) > 1) |
293
|
|
|
|
|
|
? hv_exists_ent(constant_missing, sv, 0) : 0) { |
294
|
|
|
|
|
|
sv = newSVpvf("Your vendor has not defined Sys::Syslog macro %" SVf |
295
|
|
|
|
|
|
", used", sv); |
296
|
|
|
|
|
|
} else |
297
|
|
|
|
|
|
#endif |
298
|
|
|
|
|
|
{ |
299
|
0
|
|
|
|
|
sv = newSVpvf("%"SVf" is not a valid Sys::Syslog macro", |
300
|
|
|
|
|
|
sv); |
301
|
|
|
|
|
|
} |
302
|
0
|
|
|
|
|
PUSHs(sv_2mortal(sv)); |