const-xs.inc

filter: Statementstmt 58.3% 7 / 12 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 56.2% 9 / 16 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« const-c.inc ↑ Summary
1 BOOT:
2 {
3 #if defined(dTHX) && !defined(PERL_NO_GET_CONTEXT)
4 dTHX;
5 #endif
6 4 HV *symbol_table = get_hv("Linux::Fanotify::", GV_ADD);
7  
8 static const struct iv_s values_for_iv[] =
9 {
10 #ifdef FAN_ACCESS
11 { "FAN_ACCESS", 10, FAN_ACCESS },
12 #endif
13 #ifdef FAN_MODIFY
14 { "FAN_MODIFY", 10, FAN_MODIFY },
15 #endif
16 #ifdef FAN_CLOSE_WRITE
17 { "FAN_CLOSE_WRITE", 15, FAN_CLOSE_WRITE },
18 #endif
19 #ifdef FAN_CLOSE_NOWRITE
20 { "FAN_CLOSE_NOWRITE", 17, FAN_CLOSE_NOWRITE },
21 #endif
22 #ifdef FAN_OPEN
23 { "FAN_OPEN", 8, FAN_OPEN },
24 #endif
25 #ifdef FAN_Q_OVERFLOW
26 { "FAN_Q_OVERFLOW", 14, FAN_Q_OVERFLOW },
27 #endif
28 #ifdef FAN_OPEN_PERM
29 { "FAN_OPEN_PERM", 13, FAN_OPEN_PERM },
30 #endif
31 #ifdef FAN_ACCESS_PERM
32 { "FAN_ACCESS_PERM", 15, FAN_ACCESS_PERM },
33 #endif
34 #ifdef FAN_ONDIR
35 { "FAN_ONDIR", 9, FAN_ONDIR },
36 #endif
37 #ifdef FAN_EVENT_ON_CHILD
38 { "FAN_EVENT_ON_CHILD", 18, FAN_EVENT_ON_CHILD },
39 #endif
40 #ifdef FAN_CLOSE
41 { "FAN_CLOSE", 9, FAN_CLOSE },
42 #endif
43 #ifdef FAN_CLOEXEC
44 { "FAN_CLOEXEC", 11, FAN_CLOEXEC },
45 #endif
46 #ifdef FAN_NONBLOCK
47 { "FAN_NONBLOCK", 12, FAN_NONBLOCK },
48 #endif
49 #ifdef FAN_CLASS_NOTIF
50 { "FAN_CLASS_NOTIF", 15, FAN_CLASS_NOTIF },
51 #endif
52 #ifdef FAN_CLASS_CONTENT
53 { "FAN_CLASS_CONTENT", 17, FAN_CLASS_CONTENT },
54 #endif
55 #ifdef FAN_CLASS_PRE_CONTENT
56 { "FAN_CLASS_PRE_CONTENT", 21, FAN_CLASS_PRE_CONTENT },
57 #endif
58 #ifdef FAN_ALL_CLASS_BITS
59 { "FAN_ALL_CLASS_BITS", 18, FAN_ALL_CLASS_BITS },
60 #endif
61 #ifdef FAN_UNLIMITED_QUEUE
62 { "FAN_UNLIMITED_QUEUE", 19, FAN_UNLIMITED_QUEUE },
63 #endif
64 #ifdef FAN_UNLIMITED_MARKS
65 { "FAN_UNLIMITED_MARKS", 19, FAN_UNLIMITED_MARKS },
66 #endif
67 #ifdef FAN_ALL_INIT_FLAGS
68 { "FAN_ALL_INIT_FLAGS", 18, FAN_ALL_INIT_FLAGS },
69 #endif
70 #ifdef FAN_MARK_ADD
71 { "FAN_MARK_ADD", 12, FAN_MARK_ADD },
72 #endif
73 #ifdef FAN_MARK_REMOVE
74 { "FAN_MARK_REMOVE", 15, FAN_MARK_REMOVE },
75 #endif
76 #ifdef FAN_MARK_DONT_FOLLOW
77 { "FAN_MARK_DONT_FOLLOW", 20, FAN_MARK_DONT_FOLLOW },
78 #endif
79 #ifdef FAN_MARK_ONLYDIR
80 { "FAN_MARK_ONLYDIR", 16, FAN_MARK_ONLYDIR },
81 #endif
82 #ifdef FAN_MARK_MOUNT
83 { "FAN_MARK_MOUNT", 14, FAN_MARK_MOUNT },
84 #endif
85 #ifdef FAN_MARK_IGNORED_MASK
86 { "FAN_MARK_IGNORED_MASK", 21, FAN_MARK_IGNORED_MASK },
87 #endif
88 #ifdef FAN_MARK_IGNORED_SURV_MODIFY
89 { "FAN_MARK_IGNORED_SURV_MODIFY", 28, FAN_MARK_IGNORED_SURV_MODIFY },
90 #endif
91 #ifdef FAN_MARK_FLUSH
92 { "FAN_MARK_FLUSH", 14, FAN_MARK_FLUSH },
93 #endif
94 #ifdef FAN_ALL_MARK_FLAGS
95 { "FAN_ALL_MARK_FLAGS", 18, FAN_ALL_MARK_FLAGS },
96 #endif
97 #ifdef FAN_ALL_EVENTS
98 { "FAN_ALL_EVENTS", 14, FAN_ALL_EVENTS },
99 #endif
100 #ifdef FAN_ALL_PERM_EVENTS
101 { "FAN_ALL_PERM_EVENTS", 19, FAN_ALL_PERM_EVENTS },
102 #endif
103 #ifdef FAN_ALL_OUTGOING_EVENTS
104 { "FAN_ALL_OUTGOING_EVENTS", 23, FAN_ALL_OUTGOING_EVENTS },
105 #endif
106 #ifdef FANOTIFY_METADATA_VERSION
107 { "FANOTIFY_METADATA_VERSION", 25, FANOTIFY_METADATA_VERSION },
108 #endif
109 #ifdef FAN_ALLOW
110 { "FAN_ALLOW", 9, FAN_ALLOW },
111 #endif
112 #ifdef FAN_DENY
113 { "FAN_DENY", 8, FAN_DENY },
114 #endif
115 #ifdef FAN_NOFD
116 { "FAN_NOFD", 8, FAN_NOFD },
117 #endif
118 { NULL, 0, 0 } };
119 4 const struct iv_s *value_for_iv = values_for_iv;
120 148 ▶ while (value_for_iv->name) {
Branch: 1 branch
BranchTrueFalseTotal
while (value_for_iv->name) { 144 4 148
121 288 constant_add_symbol(aTHX_ symbol_table, value_for_iv->name,
122 144 value_for_iv->namelen, newSViv(value_for_iv->value));
123 144 ++value_for_iv;
124 }
125 if (C_ARRAY_LENGTH(values_for_notfound) > 1) {
126 #ifndef SYMBIAN
127 HV *const constant_missing = get_missing_hash(aTHX);
128 #endif
129 const struct notfound_s *value_for_notfound = values_for_notfound;
130 do {
131  
132 /* Need to add prototypes, else parsing will vary by platform. */
133 HE *he = (HE*) hv_common_key_len(symbol_table,
134 value_for_notfound->name,
135 value_for_notfound->namelen,
136 HV_FETCH_LVALUE, NULL, 0);
137 SV *sv;
138 #ifndef SYMBIAN
139 HEK *hek;
140 #endif
141 if (!he) {
142 croak("Couldn't add key '%s' to %%Linux::Fanotify::",
143 value_for_notfound->name);
144 }
145 sv = HeVAL(he);
146 if (!SvOK(sv) && SvTYPE(sv) != SVt_PVGV) {
147 /* Nothing was here before, so mark a prototype of "" */
148 sv_setpvn(sv, "", 0);
149 } else if (SvPOK(sv) && SvCUR(sv) == 0) {
150 /* There is already a prototype of "" - do nothing */
151 } else {
152 /* Someone has been here before us - have to make a real
153 typeglob. */
154 /* It turns out to be incredibly hard to deal with all the
155 corner cases of sub foo (); and reporting errors correctly,
156 so lets cheat a bit. Start with a constant subroutine */
157 CV *cv = newCONSTSUB(symbol_table,
158 value_for_notfound->name,
159 &PL_sv_yes);
160 /* and then turn it into a non constant declaration only. */
161 SvREFCNT_dec(CvXSUBANY(cv).any_ptr);
162 CvCONST_off(cv);
163 CvXSUB(cv) = NULL;
164 CvXSUBANY(cv).any_ptr = NULL;
165 }
166 #ifndef SYMBIAN
167 hek = HeKEY_hek(he);
168 if (!hv_common(constant_missing, NULL, HEK_KEY(hek),
169 HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE,
170 &PL_sv_yes, HEK_HASH(hek)))
171 croak("Couldn't add key '%s' to missing_hash",
172 value_for_notfound->name);
173 #endif
174 } while ((++value_for_notfound)->name);
175 }
176 /* As we've been creating subroutines, we better invalidate any cached
177 methods */
178 4 mro_method_changed_in(symbol_table);
179 }
180  
181 void
182 AUTOLOAD()
183 PROTOTYPE: DISABLE
184 PREINIT:
185 0 SV *sv = newSVpvn_flags(SvPVX(cv), SvCUR(cv), SVs_TEMP | SvUTF8(cv));
186 0 const COP *cop = PL_curcop;
187 PPCODE:
188 #ifndef SYMBIAN
189 /* It's not obvious how to calculate this at C pre-processor time.
190 However, any compiler optimiser worth its salt should be able to
191 remove the dead code, and hopefully the now-obviously-unused static
192 function too. */
193 0 HV *constant_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1)
194 ? get_missing_hash(aTHX) : NULL;
195 if ((C_ARRAY_LENGTH(values_for_notfound) > 1)
196 ? hv_exists_ent(constant_missing, sv, 0) : 0) {
197 sv = newSVpvf("Your vendor has not defined Linux::Fanotify macro %" SVf
198 ", used at %" COP_FILE_F " line %" UVuf "\n",
199 sv, COP_FILE(cop), (UV)CopLINE(cop));
200 } else
201 #endif
202 {
203 0 ▶ sv = newSVpvf("%" SVf
Branch: 1 branch
BranchTrueFalseTotal
sv = newSVpvf("%" SVf 0 0 0
204 " is not a valid Linux::Fanotify macro at %"
205 COP_FILE_F " line %" UVuf "\n",
206 sv, COP_FILE(cop), (UV)CopLINE(cop));
207 }
208 0 croak_sv(sv_2mortal(sv));
« const-c.inc ↑ Summary