| 1 |
|
| /* |
| 2 |
|
| * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the |
| 3 |
|
| * contents of Hyperman.xs. Do not edit this file, edit Hyperman.xs instead. |
| 4 |
|
| * |
| 5 |
|
| * ANY CHANGES MADE HERE WILL BE LOST! |
| 6 |
|
| * |
| 7 |
|
| */ |
| 8 |
|
| |
| 9 |
|
| #line 1 "Hyperman.xs" |
| 10 |
|
| /* |
| 11 |
|
| * Hyperman.xs - Root XS file |
| 12 |
|
| * |
| 13 |
|
| * Thin wrapper (Chandra-style layout): pulls in the C core from |
| 14 |
|
| * include/hyperman/ - the backend vtable + implementations (unity build), |
| 15 |
|
| * the Future primitive, and the loop/server core - then the per-package |
| 16 |
|
| * XS fragments via INCLUDE:. All Hyperman-namespace behavior lives in C; |
| 17 |
|
| * the .pm files are documentation/loader stubs. |
| 18 |
|
| */ |
| 19 |
|
| |
| 20 |
|
| #ifndef _GNU_SOURCE |
| 21 |
|
| #define _GNU_SOURCE /* memmem on glibc */ |
| 22 |
|
| #endif |
| 23 |
|
| #define PERL_NO_GET_CONTEXT |
| 24 |
|
| /* Under PERL_IMPLICIT_SYS - every Strawberry build - XSUB.h rewrites the |
| 25 |
|
| * plain CRT and socket names into PerlMem_/PerlSock_/PerlEnv_ macros that |
| 26 |
|
| * dereference my_perl. This core is C: its helpers are static functions in |
| 27 |
|
| * headers with no interpreter to hand, and even a struct member called |
| 28 |
|
| * `wait` collides with the PerlProc_wait macro. NO_XSLOCKS is the switch |
| 29 |
|
| * XSUB.h provides for exactly that, and it must come before the include or |
| 30 |
|
| * the rewrites are already in place. |
| 31 |
|
| * |
| 32 |
|
| * Nothing is given up. This code owns what it allocates and closes what it |
| 33 |
|
| * opens end to end, so it never hands a pointer to perl's allocator or takes |
| 34 |
|
| * one from it; the SV and PerlIO calls it does make are functions, not |
| 35 |
|
| * remapped names, and are unaffected. */ |
| 36 |
|
| #define NO_XSLOCKS |
| 37 |
|
| #include "EXTERN.h" |
| 38 |
|
| #include "perl.h" |
| 39 |
|
| #include "XSUB.h" |
| 40 |
|
| #include "hm_compat.h" /* perl API shims (XS_INTERNAL, mg_findext, croak_sv) */ |
| 41 |
|
| |
| 42 |
|
| /* The platform headers come from the shim, first and only - the same rule |
| 43 |
|
| * hm_core.h follows. On POSIX hm_win.h expands to exactly the <sys/socket.h> |
| 44 |
|
| * / <sys/uio.h> / netinet / <unistd.h> block this file used to spell out |
| 45 |
|
| * by hand; on Windows it expands to Winsock. Spelling them out here is what |
| 46 |
|
| * broke the 0.23 Windows build: <sys/uio.h> does not exist on MinGW, and it |
| 47 |
|
| * was included eighteen lines above the header that knows that. */ |
| 48 |
|
| #include "hm_win.h" |
| 49 |
|
| |
| 50 |
|
| /* CRT headers, present everywhere: not the shim's business. */ |
| 51 |
|
| #include <string.h> |
| 52 |
|
| #include <stdlib.h> |
| 53 |
|
| #include <ctype.h> |
| 54 |
|
| #include <signal.h> |
| 55 |
|
| |
| 56 |
|
| /* The prefork supervisor's headers. hm_core.h compiles that whole half |
| 57 |
|
| * under #ifndef _WIN32 (no fork, no waitpid, no POSIX signals there), so |
| 58 |
|
| * its includes carry the same guard. */ |
| 59 |
|
| #ifndef _WIN32 |
| 60 |
|
| #include <sys/wait.h> |
| 61 |
|
| #ifdef __linux__ |
| 62 |
|
| #include <sched.h> |
| 63 |
|
| #endif |
| 64 |
|
| #endif |
| 65 |
|
| |
| 66 |
|
| #include "hyperman.h" |
| 67 |
|
| |
| 68 |
|
| /* readiness backends: one translation unit, guarded per platform */ |
| 69 |
|
| #include "backend_kqueue.c" |
| 70 |
|
| #include "backend_epoll.c" |
| 71 |
|
| #include "backend_iouring.c" |
| 72 |
|
| #include "backend_wsapoll.c" |
| 73 |
|
| #include "backend_poll.c" |
| 74 |
|
| |
| 75 |
|
| #include "hm_future.h" |
| 76 |
|
| #include "hm_sa.h" /* Shared::Arena's table and the one arena */ |
| 77 |
|
| #include "hm_sa_abuse.h" /* the denylist and the fixed window, on it */ |
| 78 |
|
| #include "hm_sa_bus.h" /* the message bus, on a ring in it */ |
| 79 |
|
| #include "hm_sa_bus_perl.h" /* ... and its Perl-side collector and deliverer */ |
| 80 |
|
| #include "hm_sa_board.h" /* the worker scoreboard and the distinct clients */ |
| 81 |
|
| #include "hm_compress.h" /* gzip on the way out (zlib optional) */ |
| 82 |
|
| #include "hm_workerhook.h" /* the v4 on_worker_start registry; hm_core fires |
| 83 |
|
| * it, hm_abi_impl registers into it */ |
| 84 |
|
| #include "hm_workerhook_perl.h" /* ... and the Perl door onto that registry */ |
| 85 |
|
| #include "hm_core.h" |
| 86 |
|
| #include "hm_abi_impl.h" |
| 87 |
|
| |
| 88 |
|
| #line 89 "Hyperman.c" |
| 89 |
|
| #ifndef PERL_UNUSED_VAR |
| 90 |
|
| # define PERL_UNUSED_VAR(var) if (0) var = var |
| 91 |
|
| #endif |
| 92 |
|
| |
| 93 |
|
| #ifndef dVAR |
| 94 |
|
| # define dVAR dNOOP |
| 95 |
|
| #endif |
| 96 |
|
| |
| 97 |
|
| |
| 98 |
|
| /* This stuff is not part of the API! You have been warned. */ |
| 99 |
|
| #ifndef PERL_VERSION_DECIMAL |
| 100 |
|
| # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
| 101 |
|
| #endif |
| 102 |
|
| #ifndef PERL_DECIMAL_VERSION |
| 103 |
|
| # define PERL_DECIMAL_VERSION \ |
| 104 |
|
| PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
| 105 |
|
| #endif |
| 106 |
|
| #ifndef PERL_VERSION_GE |
| 107 |
|
| # define PERL_VERSION_GE(r,v,s) \ |
| 108 |
|
| (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
| 109 |
|
| #endif |
| 110 |
|
| #ifndef PERL_VERSION_LE |
| 111 |
|
| # define PERL_VERSION_LE(r,v,s) \ |
| 112 |
|
| (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
| 113 |
|
| #endif |
| 114 |
|
| |
| 115 |
|
| /* XS_INTERNAL is the explicit static-linkage variant of the default |
| 116 |
|
| * XS macro. |
| 117 |
|
| * |
| 118 |
|
| * XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
| 119 |
|
| * "static", ie. it exports XSUB symbols. You probably don't want that |
| 120 |
|
| * for anything but the BOOT XSUB. |
| 121 |
|
| * |
| 122 |
|
| * See XSUB.h in core! |
| 123 |
|
| */ |
| 124 |
|
| |
| 125 |
|
| |
| 126 |
|
| /* TODO: This might be compatible further back than 5.10.0. */ |
| 127 |
|
| #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
| 128 |
|
| # undef XS_EXTERNAL |
| 129 |
|
| # undef XS_INTERNAL |
| 130 |
|
| # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
| 131 |
|
| # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
| 132 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 133 |
|
| # endif |
| 134 |
|
| # if defined(__SYMBIAN32__) |
| 135 |
|
| # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
| 136 |
|
| # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name) |
| 137 |
|
| # endif |
| 138 |
|
| # ifndef XS_EXTERNAL |
| 139 |
|
| # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
| 140 |
|
| # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
| 141 |
|
| # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__) |
| 142 |
|
| # else |
| 143 |
|
| # ifdef __cplusplus |
| 144 |
|
| # define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
| 145 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 146 |
|
| # else |
| 147 |
|
| # define XS_EXTERNAL(name) XSPROTO(name) |
| 148 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 149 |
|
| # endif |
| 150 |
|
| # endif |
| 151 |
|
| # endif |
| 152 |
|
| #endif |
| 153 |
|
| |
| 154 |
|
| /* perl >= 5.10.0 && perl <= 5.15.1 */ |
| 155 |
|
| |
| 156 |
|
| |
| 157 |
|
| /* The XS_EXTERNAL macro is used for functions that must not be static |
| 158 |
|
| * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
| 159 |
|
| * macro defined, the best we can do is assume XS is the same. |
| 160 |
|
| * Dito for XS_INTERNAL. |
| 161 |
|
| */ |
| 162 |
|
| #ifndef XS_EXTERNAL |
| 163 |
|
| # define XS_EXTERNAL(name) XS(name) |
| 164 |
|
| #endif |
| 165 |
|
| #ifndef XS_INTERNAL |
| 166 |
|
| # define XS_INTERNAL(name) XS(name) |
| 167 |
|
| #endif |
| 168 |
|
| |
| 169 |
|
| /* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
| 170 |
|
| * internal macro that we're free to redefine for varying linkage due |
| 171 |
|
| * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
| 172 |
|
| * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
| 173 |
|
| */ |
| 174 |
|
| |
| 175 |
|
| #undef XS_EUPXS |
| 176 |
|
| #if defined(PERL_EUPXS_ALWAYS_EXPORT) |
| 177 |
|
| # define XS_EUPXS(name) XS_EXTERNAL(name) |
| 178 |
|
| #else |
| 179 |
|
| /* default to internal */ |
| 180 |
|
| # define XS_EUPXS(name) XS_INTERNAL(name) |
| 181 |
|
| #endif |
| 182 |
|
| |
| 183 |
|
| #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 184 |
|
| #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
| 185 |
|
| |
| 186 |
|
| /* prototype to pass -Wmissing-prototypes */ |
| 187 |
|
| static void |
| 188 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params); |
| 189 |
|
| |
| 190 |
|
| static void |
| 191 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params) |
| 192 |
|
| { |
| 193 |
|
| const GV *const gv = CvGV(cv); |
| 194 |
|
| |
| 195 |
|
| PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
| 196 |
|
| |
| 197 |
|
| if (gv) { |
| 198 |
|
| const char *const gvname = GvNAME(gv); |
| 199 |
|
| const HV *const stash = GvSTASH(gv); |
| 200 |
|
| const char *const hvname = stash ? HvNAME(stash) : NULL; |
| 201 |
|
| |
| 202 |
|
| if (hvname) |
| 203 |
|
| Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
| 204 |
|
| else |
| 205 |
|
| Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
| 206 |
|
| } else { |
| 207 |
|
| /* Pants. I don't think that it should be possible to get here. */ |
| 208 |
|
| Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
| 209 |
|
| } |
| 210 |
|
| } |
| 211 |
|
| #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 212 |
|
| |
| 213 |
|
| #define croak_xs_usage S_croak_xs_usage |
| 214 |
|
| |
| 215 |
|
| #endif |
| 216 |
|
| |
| 217 |
|
| /* NOTE: the prototype of newXSproto() is different in versions of perls, |
| 218 |
|
| * so we define a portable version of newXSproto() |
| 219 |
|
| */ |
| 220 |
|
| #ifdef newXS_flags |
| 221 |
|
| #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
| 222 |
|
| #else |
| 223 |
|
| #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
| 224 |
|
| #endif /* !defined(newXS_flags) */ |
| 225 |
|
| |
| 226 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 227 |
|
| # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
| 228 |
|
| #else |
| 229 |
|
| # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
| 230 |
|
| #endif |
| 231 |
|
| |
| 232 |
|
| /* simple backcompat versions of the TARGx() macros with no optimisation */ |
| 233 |
|
| #ifndef TARGi |
| 234 |
|
| # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv) |
| 235 |
|
| # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv) |
| 236 |
|
| # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv) |
| 237 |
|
| #endif |
| 238 |
|
| |
| 239 |
|
| #line 240 "Hyperman.c" |
| 240 |
|
| |
| 241 |
|
| /* INCLUDE: Including 'xs/hyperman.xs' from 'Hyperman.xs' */ |
| 242 |
|
| |
| 243 |
|
| |
| 244 |
|
| XS_EUPXS(XS_Hyperman_run); /* prototype to pass -Wmissing-prototypes */ |
| 245 |
161 |
| XS_EUPXS(XS_Hyperman_run) |
| 246 |
|
| { |
| 247 |
161 |
| dVAR; dXSARGS; |
| 248 |
161 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
161 |
161 |
|
| 249 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 250 |
|
| { |
| 251 |
161 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
1 |
160 |
161 |
|
| 252 |
|
| ; |
| 253 |
|
| #line 21 "./xs/hyperman.xs" |
| 254 |
|
| { |
| 255 |
|
| hm_worker_cfg cfg; |
| 256 |
|
| hm_listener_spec dfl; /* top-level defaults, seeded into each spec */ |
| 257 |
|
| SV *port_sv = NULL, *listen_sv = NULL; |
| 258 |
|
| int i; |
| 259 |
|
| PERL_UNUSED_VAR(class); |
| 260 |
|
| |
| 261 |
|
| if ((items - 1) % 2) |
| 262 |
|
| croak("Hyperman->run: odd number of options"); |
| 263 |
|
| |
| 264 |
|
| memset(&cfg, 0, sizeof(cfg)); |
| 265 |
|
| cfg.log_fd = -1; |
| 266 |
|
| cfg.err_fd = -1; |
| 267 |
|
| cfg.http3_max_conns = 1024; /* an explicit 0 lifts the cap */ |
| 268 |
|
| /* -1 is "the caller said nothing", which is NOT the same as |
| 269 |
|
| * completion => 0. The memset above would otherwise read as an |
| 270 |
|
| * explicit request to turn completion-mode reads off on every |
| 271 |
|
| * server that never mentions them. */ |
| 272 |
|
| cfg.completion = -1; |
| 273 |
|
| memset(&dfl, 0, sizeof(dfl)); |
| 274 |
|
| dfl.host = "0.0.0.0"; |
| 275 |
|
| dfl.port = 8080; |
| 276 |
|
| |
| 277 |
|
| for (i = 1; i + 1 < items; i += 2) { |
| 278 |
|
| const char *key = SvPV_nolen(ST(i)); |
| 279 |
|
| SV *val = ST(i + 1); |
| 280 |
|
| if (strEQ(key, "app")) cfg.app = val; |
| 281 |
|
| else if (strEQ(key, "host")) { if (SvOK(val)) dfl.host = SvPV_nolen(val); } |
| 282 |
|
| else if (strEQ(key, "port")) port_sv = val; |
| 283 |
|
| else if (strEQ(key, "listen")) listen_sv = SvOK(val) ? val : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 284 |
|
| else if (strEQ(key, "workers")) cfg.nworkers = (int)SvIV(val); |
| 285 |
|
| else if (strEQ(key, "idle_timeout")) cfg.idle_t = SvNV(val); |
| 286 |
|
| else if (strEQ(key, "header_timeout")) cfg.header_t = SvNV(val); |
| 287 |
|
| else if (strEQ(key, "body_timeout")) cfg.body_t = SvNV(val); |
| 288 |
|
| else if (strEQ(key, "request_timeout")) cfg.request_t = SvNV(val); |
| 289 |
|
| else if (strEQ(key, "body_min_rate")) cfg.body_min_rate = hm_opt_count(aTHX_ val, key); |
| 290 |
|
| else if (strEQ(key, "max_pipeline")) cfg.max_pipe = (int)SvIV(val); |
| 291 |
|
| else if (strEQ(key, "reuseport")) cfg.reuseport = SvTRUE(val) ? 1 : 0; |
| 292 |
|
| /* Completion-mode reads. On by default wherever the backend can |
| 293 |
|
| * do them - which is io_uring, and only when it was asked for by |
| 294 |
|
| * name - so this is here to turn them OFF. Inert everywhere else: |
| 295 |
|
| * a backend that cannot submit reads simply ignores it. */ |
| 296 |
|
| else if (strEQ(key, "completion")) cfg.completion = SvTRUE(val) ? 1 : 0; |
| 297 |
|
| else if (strEQ(key, "deny")) { if (SvOK(val) && SvROK(val)) cfg.deny = val; } |
| 298 |
|
| else if (strEQ(key, "deny_capacity")) cfg.deny_cap = (unsigned)SvUV(val); |
| 299 |
|
| else if (strEQ(key, "rate_capacity")) cfg.rate_cap = (unsigned)SvUV(val); |
| 300 |
|
| /* The message bus. `bus_slots` is headroom before a slow worker |
| 301 |
|
| * is lapped; `bus_slot_size` is the largest message that will be |
| 302 |
|
| * accepted. Two knobs because they answer two different |
| 303 |
|
| * complaints. */ |
| 304 |
|
| else if (strEQ(key, "bus_slots")) cfg.bus_slots = (unsigned)SvUV(val); |
| 305 |
|
| else if (strEQ(key, "bus_slot_size")) cfg.bus_slot_size = (unsigned)SvUV(val); |
| 306 |
|
| else if (strEQ(key, "bus_groups")) cfg.bus_groups = (unsigned)SvUV(val); |
| 307 |
|
| /* The Shared::Arena. A name makes it attachable by another |
| 308 |
|
| * process and survives a restart; the size is computed from the |
| 309 |
|
| * tenants unless overridden. */ |
| 310 |
|
| else if (strEQ(key, "arena_name")) { |
| 311 |
|
| if (SvOK(val)) cfg.arena_name = SvPV(val, cfg.arena_name_len); |
| 312 |
|
| } |
| 313 |
|
| else if (strEQ(key, "arena_size")) cfg.arena_size = SvUV(val); |
| 314 |
|
| /* Count distinct peers at accept. Off by default: it is a hash |
| 315 |
|
| * and a CAS-max on the accept path, about 20ns, and this server |
| 316 |
|
| * promises that path costs nothing it did not ask for. */ |
| 317 |
|
| else if (strEQ(key, "distinct_clients")) cfg.distinct_clients = SvTRUE(val) ? 1 : 0; |
| 318 |
|
| else if (strEQ(key, "access_log")) { |
| 319 |
|
| /* coderef -> per-request Perl callback (as before); |
| 320 |
|
| * a filehandle or a path -> fast C-side Combined-log writer. */ |
| 321 |
|
| if (!SvOK(val)) { |
| 322 |
|
| cfg.log_cb = NULL; |
| 323 |
|
| } else if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVCV) { |
| 324 |
|
| cfg.log_cb = val; |
| 325 |
|
| } else { |
| 326 |
|
| SV *g = (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVGV) |
| 327 |
|
| ? SvRV(val) : val; |
| 328 |
|
| if (SvTYPE(g) == SVt_PVGV) { |
| 329 |
|
| IO *io = GvIO((GV *)g); |
| 330 |
|
| PerlIO *fp = io ? (IoOFP(io) ? IoOFP(io) : IoIFP(io)) : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 331 |
|
| int raw = fp ? PerlIO_fileno(fp) : -1; |
| 332 |
|
| if (raw < 0) |
| 333 |
|
| croak("Hyperman->run: access_log handle has no fileno"); |
| 334 |
|
| cfg.log_fd = dup(raw); /* own it; freed with the loop */ |
| 335 |
|
| if (cfg.log_fd < 0) |
| 336 |
|
| croak("Hyperman->run: dup access_log fd: %s", /* # uncoverable statement class:ignore_covered_err */ |
| 337 |
|
| strerror(errno)); /* # uncoverable statement class:ignore_covered_err */ |
| 338 |
|
| #ifndef _WIN32 |
| 339 |
|
| (void)fcntl(cfg.log_fd, F_SETFD, FD_CLOEXEC); |
| 340 |
|
| #endif |
| 341 |
|
| } else { |
| 342 |
|
| cfg.log_path = SvPV_nolen(val); /* opened in the parent */ |
| 343 |
|
| } |
| 344 |
|
| } |
| 345 |
|
| } |
| 346 |
|
| else if (strEQ(key, "user")) { if (SvOK(val)) cfg.drop_user = SvPV_nolen(val); } |
| 347 |
|
| else if (strEQ(key, "group")) { if (SvOK(val)) cfg.drop_group = SvPV_nolen(val); } |
| 348 |
|
| else if (strEQ(key, "pid_file")) { if (SvOK(val)) cfg.pid_path = SvPV_nolen(val); } |
| 349 |
|
| else if (strEQ(key, "listen_fds")) cfg.listen_fds = SvTRUE(val) ? 1 : 0; |
| 350 |
|
| else if (strEQ(key, "umask")) { |
| 351 |
|
| /* a number as perl parsed it (0077 is already 63), or a string |
| 352 |
|
| * of octal digits as a shell would write it ("077") */ |
| 353 |
|
| if (SvOK(val)) { |
| 354 |
|
| if (SvIOK(val) || SvNOK(val)) cfg.umask_val = (unsigned)SvUV(val); /* # uncoverable condition left count:2 class:ignore_covered_err */ |
| 355 |
|
| else { |
| 356 |
|
| char *end; |
| 357 |
|
| const char *s = SvPV_nolen(val); |
| 358 |
|
| cfg.umask_val = (unsigned)strtoul(s, &end, 8); |
| 359 |
|
| if (*s == '\0' || *end != '\0') |
| 360 |
|
| croak("Hyperman->run: umask '%s' is not an octal number", s); |
| 361 |
|
| } |
| 362 |
|
| cfg.umask_set = 1; |
| 363 |
|
| } |
| 364 |
|
| } |
| 365 |
|
| else if (strEQ(key, "access_log_format")) { |
| 366 |
|
| if (SvOK(val)) cfg.log_format = SvPV_nolen(val); |
| 367 |
|
| } |
| 368 |
|
| else if (strEQ(key, "error_log")) { |
| 369 |
|
| /* a filehandle or a path; the server's own messages go there |
| 370 |
|
| * instead of stderr. psgi.errors is the application's and is |
| 371 |
|
| * not moved. */ |
| 372 |
|
| if (SvOK(val)) { |
| 373 |
|
| SV *g = (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVGV) |
| 374 |
|
| ? SvRV(val) : val; |
| 375 |
|
| if (SvTYPE(g) == SVt_PVGV) { |
| 376 |
|
| IO *io = GvIO((GV *)g); |
| 377 |
|
| PerlIO *fp = io ? (IoOFP(io) ? IoOFP(io) : IoIFP(io)) : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 378 |
|
| int raw = fp ? PerlIO_fileno(fp) : -1; |
| 379 |
|
| if (raw < 0) |
| 380 |
|
| croak("Hyperman->run: error_log handle has no fileno"); |
| 381 |
|
| cfg.err_fd = dup(raw); |
| 382 |
|
| if (cfg.err_fd < 0) |
| 383 |
|
| croak("Hyperman->run: dup error_log fd: %s", strerror(errno)); /* # uncoverable statement class:ignore_covered_err */ |
| 384 |
|
| #ifndef _WIN32 |
| 385 |
|
| (void)fcntl(cfg.err_fd, F_SETFD, FD_CLOEXEC); |
| 386 |
|
| #endif |
| 387 |
|
| } else { |
| 388 |
|
| cfg.err_path = SvPV_nolen(val); |
| 389 |
|
| } |
| 390 |
|
| } |
| 391 |
|
| } |
| 392 |
|
| else if (strEQ(key, "max_requests_per_worker")) |
| 393 |
|
| cfg.max_requests = hm_opt_count(aTHX_ val, key); |
| 394 |
|
| /* Response compression. Off by default: a server that starts |
| 395 |
|
| * compressing on upgrade is a surprise. Accepted and inert on a |
| 396 |
|
| * build without zlib, so a config is portable across them. */ |
| 397 |
|
| else if (strEQ(key, "compress")) cfg.compress = SvTRUE(val) ? 1 : 0; |
| 398 |
|
| else if (strEQ(key, "compress_min_length")) |
| 399 |
|
| cfg.compress_min = (size_t)hm_opt_count(aTHX_ val, key); |
| 400 |
|
| /* The request ceiling: headers plus body, buffered per |
| 401 |
|
| * connection before the app is called. This is the only thing |
| 402 |
|
| * bounding a worker's memory against a large POST, so 0 is |
| 403 |
|
| * REFUSED rather than read as "unlimited" - an unbounded read |
| 404 |
|
| * ceiling is a memory-exhaustion switch and must not be |
| 405 |
|
| * reachable by a config typo that produces a falsy value. */ |
| 406 |
|
| else if (strEQ(key, "max_body")) { |
| 407 |
|
| UV n = hm_opt_count(aTHX_ val, key); /* -1 was UV_MAX: unbounded */ |
| 408 |
|
| if (!n) |
| 409 |
|
| croak("Hyperman->run: max_body must be a byte count - " |
| 410 |
|
| "0 would mean an unbounded request buffer, which " |
| 411 |
|
| "is a memory-exhaustion switch, not a setting"); |
| 412 |
|
| cfg.max_read = (size_t)n; |
| 413 |
|
| } |
| 414 |
|
| else if (strEQ(key, "compress_level")) { |
| 415 |
|
| IV lv = SvIV(val); |
| 416 |
|
| if (lv < 1 || lv > 9) /* # uncoverable condition left count:1 class:ignore_covered_err */ |
| 417 |
|
| croak("Hyperman->run: compress_level must be 1..9"); |
| 418 |
|
| cfg.compress_level = (int)lv; |
| 419 |
|
| } |
| 420 |
|
| else if (strEQ(key, "shutdown_grace")) cfg.grace = SvNV(val); |
| 421 |
|
| else if (strEQ(key, "affinity")) cfg.affinity = SvTRUE(val) ? 1 : 0; |
| 422 |
|
| else if (strEQ(key, "http2")) dfl.http2 = SvTRUE(val) ? 1 : 0; |
| 423 |
|
| else if (strEQ(key, "http3")) dfl.http3 = SvTRUE(val) ? 1 : 0; |
| 424 |
|
| else if (strEQ(key, "proxy_protocol")) dfl.proxy_protocol = SvTRUE(val) ? 1 : 0; |
| 425 |
|
| else if (strEQ(key, "http3_max_conns")) cfg.http3_max_conns = hm_opt_count(aTHX_ val, key); |
| 426 |
|
| else if (strEQ(key, "tls_cert")) dfl.tls_cert = SvOK(val) ? SvPV_nolen(val) : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 427 |
|
| else if (strEQ(key, "tls_key")) dfl.tls_key = SvOK(val) ? SvPV_nolen(val) : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 428 |
|
| else if (strEQ(key, "tls_ca")) dfl.tls_ca = SvOK(val) ? SvPV_nolen(val) : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 429 |
|
| else if (strEQ(key, "tls_sni")) dfl.tls_sni = SvOK(val) ? val : NULL; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 430 |
|
| else if (strEQ(key, "redirect_https")) dfl.redirect_https = (int)SvIV(val); |
| 431 |
|
| else if (strEQ(key, "tls_verify")) { |
| 432 |
|
| const char *m = SvPV_nolen(val); |
| 433 |
|
| if (strEQ(m, "require")) dfl.tls_verify = 2; |
| 434 |
|
| else if (strEQ(m, "optional")) dfl.tls_verify = 1; |
| 435 |
|
| else if (strEQ(m, "none")) dfl.tls_verify = 0; |
| 436 |
|
| else croak("Hyperman->run: tls_verify must be none/optional/require"); |
| 437 |
|
| } |
| 438 |
|
| else croak("Hyperman->run: unknown option '%s'", key); |
| 439 |
|
| } |
| 440 |
|
| if (!(cfg.app && SvROK(cfg.app) && SvTYPE(SvRV(cfg.app)) == SVt_PVCV)) |
| 441 |
|
| croak("Hyperman->run: 'app' is required"); |
| 442 |
|
| if (dfl.redirect_https == 1) dfl.redirect_https = 443; |
| 443 |
|
| |
| 444 |
|
| /* Build the listener specs. Three shapes, most specific wins: |
| 445 |
|
| * listen => [ {..}, .. ] - full per-listener control (incl. TLS) |
| 446 |
|
| * port => [ N, M ] - several plain listeners sharing defaults |
| 447 |
|
| * port => N (or unset) - one listener from the top-level options */ |
| 448 |
|
| { |
| 449 |
|
| hm_listener_spec *ls; |
| 450 |
|
| int n, j; |
| 451 |
|
| AV *lav = (listen_sv && SvROK(listen_sv) |
| 452 |
|
| && SvTYPE(SvRV(listen_sv)) == SVt_PVAV) |
| 453 |
|
| ? (AV *)SvRV(listen_sv) : NULL; |
| 454 |
|
| AV *pav = (port_sv && SvROK(port_sv) |
| 455 |
|
| && SvTYPE(SvRV(port_sv)) == SVt_PVAV) |
| 456 |
|
| ? (AV *)SvRV(port_sv) : NULL; |
| 457 |
|
| |
| 458 |
|
| if (listen_sv && !lav) |
| 459 |
|
| croak("Hyperman->run: 'listen' must be an arrayref of hashrefs"); |
| 460 |
|
| |
| 461 |
|
| n = lav ? (int)(av_len(lav) + 1) |
| 462 |
|
| : pav ? (int)(av_len(pav) + 1) |
| 463 |
|
| : 1; |
| 464 |
|
| if (n < 1) croak("Hyperman->run: 'listen'/'port' is empty"); |
| 465 |
|
| ls = (hm_listener_spec *)hm_xcalloc(n, sizeof(hm_listener_spec)); |
| 466 |
|
| |
| 467 |
|
| for (j = 0; j < n; j++) { |
| 468 |
|
| ls[j] = dfl; /* seed with top-level defaults */ |
| 469 |
|
| if (lav) { |
| 470 |
|
| SV **e = av_fetch(lav, j, 0); |
| 471 |
|
| if (!(e && SvROK(*e) && SvTYPE(SvRV(*e)) == SVt_PVHV)) |
| 472 |
|
| croak("Hyperman->run: listen[%d] must be a hashref", j); |
| 473 |
|
| hm_listener_from_hv(aTHX_ (HV *)SvRV(*e), &ls[j]); |
| 474 |
|
| } else if (pav) { |
| 475 |
|
| SV **e = av_fetch(pav, j, 0); |
| 476 |
|
| if (e) ls[j].port = (int)SvIV(*e); |
| 477 |
|
| } else if (port_sv && SvOK(port_sv)) { /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 478 |
|
| ls[j].port = (int)SvIV(port_sv); |
| 479 |
|
| } |
| 480 |
|
| hm_check_listener(aTHX_ &ls[j]); |
| 481 |
|
| } |
| 482 |
|
| |
| 483 |
|
| cfg.lspecs = ls; |
| 484 |
|
| cfg.nlspecs = n; |
| 485 |
|
| hm_run_server(aTHX_ &cfg); /* normally blocks until shutdown */ |
| 486 |
|
| free(ls); |
| 487 |
|
| } |
| 488 |
|
| } |
| 489 |
|
| #line 490 "Hyperman.c" |
| 490 |
|
| } |
| 491 |
77 |
| XSRETURN_EMPTY; |
| 492 |
|
| } |
| 493 |
|
| |
| 494 |
|
| |
| 495 |
|
| XS_EUPXS(XS_Hyperman_timer); /* prototype to pass -Wmissing-prototypes */ |
| 496 |
6 |
| XS_EUPXS(XS_Hyperman_timer) |
| 497 |
|
| { |
| 498 |
6 |
| dVAR; dXSARGS; |
| 499 |
6 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
6 |
6 |
|
| 500 |
0 |
| croak_xs_usage(cv, "class, secs"); |
| 501 |
|
| { |
| 502 |
6 |
| SV * class = ST(0) |
| 503 |
|
| ; |
| 504 |
6 |
| double secs = (double)SvNV(ST(1)) |
| 505 |
|
| ; |
| 506 |
|
| SV * RETVAL; |
| 507 |
|
| #line 300 "./xs/hyperman.xs" |
| 508 |
|
| { |
| 509 |
|
| hm_loop *loop = hm_need_loop(); |
| 510 |
|
| SV *f = hmf_new(aTHX_ "Hyperman::Future"); |
| 511 |
|
| PERL_UNUSED_VAR(class); |
| 512 |
|
| hm_add_timer_watch(aTHX_ loop, secs, f, HM_TW_FUTURE); |
| 513 |
|
| RETVAL = f; |
| 514 |
|
| } |
| 515 |
|
| #line 516 "Hyperman.c" |
| 516 |
6 |
| RETVAL = sv_2mortal(RETVAL); |
| 517 |
6 |
| ST(0) = RETVAL; |
| 518 |
|
| } |
| 519 |
6 |
| XSRETURN(1); |
| 520 |
|
| } |
| 521 |
|
| |
| 522 |
|
| |
| 523 |
|
| XS_EUPXS(XS_Hyperman_io_ready); /* prototype to pass -Wmissing-prototypes */ |
| 524 |
3 |
| XS_EUPXS(XS_Hyperman_io_ready) |
| 525 |
|
| { |
| 526 |
3 |
| dVAR; dXSARGS; |
| 527 |
3 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
0 |
3 |
3 |
|
| 528 |
0 |
| croak_xs_usage(cv, "class, fh, ..."); |
| 529 |
|
| { |
| 530 |
3 |
| SV * class = ST(0) |
| 531 |
|
| ; |
| 532 |
3 |
| SV * fh = ST(1) |
| 533 |
|
| ; |
| 534 |
|
| SV * RETVAL; |
| 535 |
|
| #line 317 "./xs/hyperman.xs" |
| 536 |
|
| { |
| 537 |
|
| hm_loop *loop = hm_need_loop(); |
| 538 |
|
| const char *mode = (items > 2 && SvOK(ST(2))) ? SvPV_nolen(ST(2)) : "r"; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 539 |
|
| SV *f = hmf_new(aTHX_ "Hyperman::Future"); |
| 540 |
|
| PERL_UNUSED_VAR(class); |
| 541 |
|
| hm_add_io_watch(aTHX_ loop, hm_fd_of(aTHX_ fh), mode, f, 0); |
| 542 |
|
| RETVAL = f; |
| 543 |
|
| } |
| 544 |
|
| #line 545 "Hyperman.c" |
| 545 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 546 |
1 |
| ST(0) = RETVAL; |
| 547 |
|
| } |
| 548 |
1 |
| XSRETURN(1); |
| 549 |
|
| } |
| 550 |
|
| |
| 551 |
|
| |
| 552 |
|
| XS_EUPXS(XS_Hyperman_stats); /* prototype to pass -Wmissing-prototypes */ |
| 553 |
12 |
| XS_EUPXS(XS_Hyperman_stats) |
| 554 |
|
| { |
| 555 |
12 |
| dVAR; dXSARGS; |
| 556 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 557 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 558 |
|
| { |
| 559 |
|
| SV * RETVAL; |
| 560 |
|
| #line 335 "./xs/hyperman.xs" |
| 561 |
|
| { |
| 562 |
|
| int pool = 0, i; |
| 563 |
|
| for (i = 1; i + 1 < items; i += 2) |
| 564 |
|
| if (strEQ(SvPV_nolen(ST(i)), "pool")) pool = SvTRUE(ST(i + 1)) ? 1 : 0; |
| 565 |
|
| if (pool) { |
| 566 |
|
| hm_sa_pool_stats p; |
| 567 |
|
| if (!hm_sa_board_pool(&p)) RETVAL = &PL_sv_undef; |
| 568 |
|
| else { |
| 569 |
|
| HV *h = newHV(); |
| 570 |
|
| hv_stores(h, "workers", newSVuv((UV)p.workers)); |
| 571 |
|
| hv_stores(h, "alive", newSVuv((UV)p.alive)); |
| 572 |
|
| hv_stores(h, "requests", newSVuv((UV)p.requests)); |
| 573 |
|
| hv_stores(h, "accepts", newSVuv((UV)p.accepts)); |
| 574 |
|
| hv_stores(h, "denied", newSVuv((UV)p.denied)); |
| 575 |
|
| hv_stores(h, "connections", newSVuv((UV)p.conns)); |
| 576 |
|
| hv_stores(h, "bytes_out", newSVuv((UV)p.bytes_out)); |
| 577 |
|
| hv_stores(h, "datagrams", newSVuv((UV)p.datagrams)); |
| 578 |
|
| hv_stores(h, "h3_requests", newSVuv((UV)p.h3)); |
| 579 |
|
| RETVAL = newRV_noinc((SV *)h); |
| 580 |
|
| } |
| 581 |
|
| } |
| 582 |
|
| else if (!hm_cur_loop) { |
| 583 |
|
| RETVAL = &PL_sv_undef; |
| 584 |
|
| } else { |
| 585 |
|
| HV *h = newHV(); |
| 586 |
|
| hv_stores(h, "requests", newSVuv(hm_cur_loop->requests)); |
| 587 |
|
| hv_stores(h, "accepts", newSVuv(hm_cur_loop->accepts)); |
| 588 |
|
| hv_stores(h, "denied", newSVuv(hm_cur_loop->denied)); |
| 589 |
|
| hv_stores(h, "bytes_out", newSVuv(hm_cur_loop->bytes_out)); |
| 590 |
|
| hv_stores(h, "datagrams", newSVuv(hm_cur_loop->datagrams)); |
| 591 |
|
| hv_stores(h, "h3_conns", newSVuv(hm_cur_loop->h3_conns)); |
| 592 |
|
| hv_stores(h, "h3_live", newSVuv(hm_cur_loop->h3_live)); |
| 593 |
|
| hv_stores(h, "h3_requests", newSVuv(hm_cur_loop->h3_requests)); |
| 594 |
|
| hv_stores(h, "datagrams_out", newSVuv(hm_cur_loop->datagrams_out)); |
| 595 |
|
| hv_stores(h, "connections", newSViv(hm_cur_loop->nconns)); |
| 596 |
|
| hv_stores(h, "backend", newSVpv(hm_cur_loop->be->name, 0)); |
| 597 |
|
| hv_stores(h, "pid", newSViv((IV)hm_os_getpid())); |
| 598 |
|
| RETVAL = newRV_noinc((SV *)h); |
| 599 |
|
| } |
| 600 |
|
| } |
| 601 |
|
| #line 602 "Hyperman.c" |
| 602 |
12 |
| RETVAL = sv_2mortal(RETVAL); |
| 603 |
12 |
| ST(0) = RETVAL; |
| 604 |
|
| } |
| 605 |
12 |
| XSRETURN(1); |
| 606 |
|
| } |
| 607 |
|
| |
| 608 |
|
| |
| 609 |
|
| XS_EUPXS(XS_Hyperman_has_http2); /* prototype to pass -Wmissing-prototypes */ |
| 610 |
10 |
| XS_EUPXS(XS_Hyperman_has_http2) |
| 611 |
|
| { |
| 612 |
10 |
| dVAR; dXSARGS; |
| 613 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 614 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 615 |
|
| { |
| 616 |
|
| int RETVAL; |
| 617 |
10 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
10 |
0 |
10 |
|
| 618 |
|
| #line 384 "./xs/hyperman.xs" |
| 619 |
|
| PERL_UNUSED_VAR(items); |
| 620 |
|
| RETVAL = hm_h2_available(); |
| 621 |
|
| #line 622 "Hyperman.c" |
| 622 |
10 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
10 |
10 |
|
| 623 |
10 |
| ST(0) = TARG; |
| 624 |
|
| } |
| 625 |
10 |
| XSRETURN(1); |
| 626 |
|
| } |
| 627 |
|
| |
| 628 |
|
| |
| 629 |
|
| XS_EUPXS(XS_Hyperman_has_http3); /* prototype to pass -Wmissing-prototypes */ |
| 630 |
9 |
| XS_EUPXS(XS_Hyperman_has_http3) |
| 631 |
|
| { |
| 632 |
9 |
| dVAR; dXSARGS; |
| 633 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 634 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 635 |
|
| { |
| 636 |
|
| int RETVAL; |
| 637 |
9 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
9 |
0 |
9 |
|
| 638 |
|
| #line 396 "./xs/hyperman.xs" |
| 639 |
|
| PERL_UNUSED_VAR(items); |
| 640 |
|
| RETVAL = hm_h3_available(); |
| 641 |
|
| #line 642 "Hyperman.c" |
| 642 |
9 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
9 |
9 |
|
| 643 |
9 |
| ST(0) = TARG; |
| 644 |
|
| } |
| 645 |
9 |
| XSRETURN(1); |
| 646 |
|
| } |
| 647 |
|
| |
| 648 |
|
| |
| 649 |
|
| XS_EUPXS(XS_Hyperman_quic_library); /* prototype to pass -Wmissing-prototypes */ |
| 650 |
1 |
| XS_EUPXS(XS_Hyperman_quic_library) |
| 651 |
|
| { |
| 652 |
1 |
| dVAR; dXSARGS; |
| 653 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 654 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 655 |
|
| { |
| 656 |
|
| #line 407 "./xs/hyperman.xs" |
| 657 |
|
| const char *s; |
| 658 |
|
| #line 659 "Hyperman.c" |
| 659 |
|
| SV * RETVAL; |
| 660 |
|
| #line 409 "./xs/hyperman.xs" |
| 661 |
|
| PERL_UNUSED_VAR(items); |
| 662 |
|
| s = hm_quic_library(); |
| 663 |
|
| RETVAL = s ? newSVpv(s, 0) : newSV(0); /* # uncoverable condition left count:1 class:ignore_covered_err */ |
| 664 |
|
| #line 665 "Hyperman.c" |
| 665 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 666 |
1 |
| ST(0) = RETVAL; |
| 667 |
|
| } |
| 668 |
1 |
| XSRETURN(1); |
| 669 |
|
| } |
| 670 |
|
| |
| 671 |
|
| |
| 672 |
|
| XS_EUPXS(XS_Hyperman__accepts_gzip); /* prototype to pass -Wmissing-prototypes */ |
| 673 |
30 |
| XS_EUPXS(XS_Hyperman__accepts_gzip) |
| 674 |
|
| { |
| 675 |
30 |
| dVAR; dXSARGS; |
| 676 |
30 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
30 |
30 |
|
| 677 |
0 |
| croak_xs_usage(cv, "hdr"); |
| 678 |
|
| { |
| 679 |
30 |
| SV * hdr = ST(0) |
| 680 |
|
| ; |
| 681 |
|
| int RETVAL; |
| 682 |
30 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
30 |
0 |
30 |
| dXSTARG; |
29 |
1 |
30 |
|
| 683 |
|
| #line 421 "./xs/hyperman.xs" |
| 684 |
|
| { |
| 685 |
|
| STRLEN l = 0; |
| 686 |
|
| const char *h = SvOK(hdr) ? SvPV_const(hdr, l) : NULL; |
| 687 |
|
| RETVAL = hz_accepts_gzip(h, (size_t)l); |
| 688 |
|
| } |
| 689 |
|
| #line 690 "Hyperman.c" |
| 690 |
30 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
28 |
2 |
30 |
|
| 691 |
30 |
| ST(0) = TARG; |
| 692 |
|
| } |
| 693 |
30 |
| XSRETURN(1); |
| 694 |
|
| } |
| 695 |
|
| |
| 696 |
|
| |
| 697 |
|
| XS_EUPXS(XS_Hyperman__gzip); /* prototype to pass -Wmissing-prototypes */ |
| 698 |
3 |
| XS_EUPXS(XS_Hyperman__gzip) |
| 699 |
|
| { |
| 700 |
3 |
| dVAR; dXSARGS; |
| 701 |
3 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
3 |
3 |
|
| 702 |
0 |
| croak_xs_usage(cv, "bytes"); |
| 703 |
|
| { |
| 704 |
3 |
▶ | SV * bytes = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * bytes = ST(0) |
2 |
1 |
3 |
|
| 705 |
|
| ; |
| 706 |
|
| SV * RETVAL; |
| 707 |
|
| #line 436 "./xs/hyperman.xs" |
| 708 |
|
| { |
| 709 |
|
| STRLEN l = 0; |
| 710 |
|
| const char *b = SvOK(bytes) ? SvPV_const(bytes, l) : NULL; |
| 711 |
|
| char *out = NULL; |
| 712 |
|
| size_t ol = 0; |
| 713 |
|
| if (b && hz_gzip(b, (size_t)l, HZ_LEVEL, &out, &ol)) { |
| 714 |
|
| RETVAL = newSVpvn(out, ol); |
| 715 |
|
| Safefree(out); |
| 716 |
|
| } else { |
| 717 |
|
| RETVAL = newSV(0); |
| 718 |
|
| } |
| 719 |
|
| } |
| 720 |
|
| #line 721 "Hyperman.c" |
| 721 |
3 |
| RETVAL = sv_2mortal(RETVAL); |
| 722 |
3 |
| ST(0) = RETVAL; |
| 723 |
|
| } |
| 724 |
3 |
| XSRETURN(1); |
| 725 |
|
| } |
| 726 |
|
| |
| 727 |
|
| |
| 728 |
|
| XS_EUPXS(XS_Hyperman_has_compression); /* prototype to pass -Wmissing-prototypes */ |
| 729 |
3 |
| XS_EUPXS(XS_Hyperman_has_compression) |
| 730 |
|
| { |
| 731 |
3 |
| dVAR; dXSARGS; |
| 732 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 733 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 734 |
|
| { |
| 735 |
|
| int RETVAL; |
| 736 |
3 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
3 |
0 |
3 |
|
| 737 |
|
| #line 457 "./xs/hyperman.xs" |
| 738 |
|
| PERL_UNUSED_VAR(items); |
| 739 |
|
| RETVAL = hz_available(); |
| 740 |
|
| #line 741 "Hyperman.c" |
| 741 |
3 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
3 |
3 |
|
| 742 |
3 |
| ST(0) = TARG; |
| 743 |
|
| } |
| 744 |
3 |
| XSRETURN(1); |
| 745 |
|
| } |
| 746 |
|
| |
| 747 |
|
| |
| 748 |
|
| XS_EUPXS(XS_Hyperman_has_tls); /* prototype to pass -Wmissing-prototypes */ |
| 749 |
17 |
| XS_EUPXS(XS_Hyperman_has_tls) |
| 750 |
|
| { |
| 751 |
17 |
| dVAR; dXSARGS; |
| 752 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 753 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 754 |
|
| { |
| 755 |
|
| int RETVAL; |
| 756 |
17 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
17 |
0 |
17 |
|
| 757 |
|
| #line 466 "./xs/hyperman.xs" |
| 758 |
|
| PERL_UNUSED_VAR(items); |
| 759 |
|
| RETVAL = hm_tls_available(); |
| 760 |
|
| #line 761 "Hyperman.c" |
| 761 |
17 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
17 |
17 |
|
| 762 |
17 |
| ST(0) = TARG; |
| 763 |
|
| } |
| 764 |
17 |
| XSRETURN(1); |
| 765 |
|
| } |
| 766 |
|
| |
| 767 |
|
| |
| 768 |
|
| XS_EUPXS(XS_Hyperman_has_ktls); /* prototype to pass -Wmissing-prototypes */ |
| 769 |
2 |
| XS_EUPXS(XS_Hyperman_has_ktls) |
| 770 |
|
| { |
| 771 |
2 |
| dVAR; dXSARGS; |
| 772 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 773 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 774 |
|
| { |
| 775 |
|
| int RETVAL; |
| 776 |
2 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
2 |
0 |
2 |
| dXSTARG; |
0 |
2 |
2 |
|
| 777 |
|
| #line 478 "./xs/hyperman.xs" |
| 778 |
|
| PERL_UNUSED_VAR(items); |
| 779 |
|
| #ifdef HM_HAVE_KTLS |
| 780 |
|
| RETVAL = 1; |
| 781 |
|
| #else |
| 782 |
|
| RETVAL = 0; |
| 783 |
|
| #endif |
| 784 |
|
| #line 785 "Hyperman.c" |
| 785 |
2 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
2 |
2 |
|
| 786 |
2 |
| ST(0) = TARG; |
| 787 |
|
| } |
| 788 |
2 |
| XSRETURN(1); |
| 789 |
|
| } |
| 790 |
|
| |
| 791 |
|
| |
| 792 |
|
| XS_EUPXS(XS_Hyperman_tls_library); /* prototype to pass -Wmissing-prototypes */ |
| 793 |
1 |
| XS_EUPXS(XS_Hyperman_tls_library) |
| 794 |
|
| { |
| 795 |
1 |
| dVAR; dXSARGS; |
| 796 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 797 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 798 |
|
| { |
| 799 |
|
| #line 494 "./xs/hyperman.xs" |
| 800 |
|
| const char *s; |
| 801 |
|
| #line 802 "Hyperman.c" |
| 802 |
|
| SV * RETVAL; |
| 803 |
|
| #line 496 "./xs/hyperman.xs" |
| 804 |
|
| PERL_UNUSED_VAR(items); |
| 805 |
|
| s = hm_tls_library(); |
| 806 |
|
| RETVAL = s ? newSVpv(s, 0) : newSV(0); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 807 |
|
| #line 808 "Hyperman.c" |
| 808 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 809 |
1 |
| ST(0) = RETVAL; |
| 810 |
|
| } |
| 811 |
1 |
| XSRETURN(1); |
| 812 |
|
| } |
| 813 |
|
| |
| 814 |
|
| |
| 815 |
|
| XS_EUPXS(XS_Hyperman_tls_reload); /* prototype to pass -Wmissing-prototypes */ |
| 816 |
3 |
| XS_EUPXS(XS_Hyperman_tls_reload) |
| 817 |
|
| { |
| 818 |
3 |
| dVAR; dXSARGS; |
| 819 |
3 |
▶ | if (items < 1 || items > 2) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 1 || items > 2) |
3 |
0 |
3 |
| if (items < 1 || items > 2) |
0 |
3 |
3 |
|
| 820 |
0 |
| croak_xs_usage(cv, "class, sni = &PL_sv_undef"); |
| 821 |
|
| { |
| 822 |
3 |
| SV * class = ST(0) |
| 823 |
|
| ; |
| 824 |
|
| SV * sni; |
| 825 |
|
| int RETVAL; |
| 826 |
3 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
3 |
0 |
3 |
|
| 827 |
|
| |
| 828 |
3 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
0 |
3 |
3 |
|
| 829 |
0 |
| sni = &PL_sv_undef; |
| 830 |
|
| else { |
| 831 |
3 |
| sni = ST(1) |
| 832 |
|
| ; |
| 833 |
|
| } |
| 834 |
|
| #line 522 "./xs/hyperman.xs" |
| 835 |
|
| PERL_UNUSED_VAR(class); |
| 836 |
|
| RETVAL = hm_cur_loop ? hm_tls_reload(aTHX_ hm_cur_loop, sni) : 0; |
| 837 |
|
| #line 838 "Hyperman.c" |
| 838 |
3 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
3 |
3 |
|
| 839 |
3 |
| ST(0) = TARG; |
| 840 |
|
| } |
| 841 |
3 |
| XSRETURN(1); |
| 842 |
|
| } |
| 843 |
|
| |
| 844 |
|
| |
| 845 |
|
| XS_EUPXS(XS_Hyperman_loop); /* prototype to pass -Wmissing-prototypes */ |
| 846 |
8 |
| XS_EUPXS(XS_Hyperman_loop) |
| 847 |
|
| { |
| 848 |
8 |
▶ | dVAR; dXSARGS; |
Branch: 1 branch
| Branch | True | False | Total |
| dVAR; dXSARGS; |
7 |
1 |
8 |
|
| 849 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 850 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 851 |
|
| { |
| 852 |
|
| SV * RETVAL; |
| 853 |
|
| #line 533 "./xs/hyperman.xs" |
| 854 |
|
| PERL_UNUSED_VAR(items); |
| 855 |
|
| if (hm_cur_loop) RETVAL = hm_loop_to_sv(aTHX_ hm_cur_loop); |
| 856 |
|
| else RETVAL = &PL_sv_undef; |
| 857 |
|
| #line 858 "Hyperman.c" |
| 858 |
8 |
| RETVAL = sv_2mortal(RETVAL); |
| 859 |
8 |
| ST(0) = RETVAL; |
| 860 |
|
| } |
| 861 |
8 |
| XSRETURN(1); |
| 862 |
|
| } |
| 863 |
|
| |
| 864 |
|
| |
| 865 |
|
| XS_EUPXS(XS_Hyperman_detach); /* prototype to pass -Wmissing-prototypes */ |
| 866 |
13 |
| XS_EUPXS(XS_Hyperman_detach) |
| 867 |
|
| { |
| 868 |
13 |
| dVAR; dXSARGS; |
| 869 |
13 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
13 |
13 |
|
| 870 |
0 |
| croak_xs_usage(cv, "env"); |
| 871 |
|
| { |
| 872 |
13 |
| SV * env = ST(0) |
| 873 |
|
| ; |
| 874 |
|
| IV RETVAL; |
| 875 |
13 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
13 |
0 |
13 |
| dXSTARG; |
1 |
12 |
13 |
|
| 876 |
|
| #line 547 "./xs/hyperman.xs" |
| 877 |
|
| { |
| 878 |
|
| HV *ehv; |
| 879 |
|
| SV **e; |
| 880 |
|
| AV *cid; |
| 881 |
|
| SV **fsv, **isv; |
| 882 |
|
| int fd, rc; |
| 883 |
|
| UV id; |
| 884 |
|
| if (!hm_cur_loop) |
| 885 |
|
| croak("Hyperman::detach: no running loop (call it from inside " |
| 886 |
|
| "a request)"); |
| 887 |
|
| if (!SvROK(env) || SvTYPE(SvRV(env)) != SVt_PVHV) /* # uncoverable condition left count:2 class:ignore_covered_err */ |
| 888 |
|
| croak("Hyperman::detach: give it the PSGI env hashref"); |
| 889 |
|
| ehv = (HV *)SvRV(env); |
| 890 |
|
| e = hv_fetchs(ehv, "psgix.hyperman.conn", 0); |
| 891 |
|
| if (!(e && *e && SvROK(*e) && SvTYPE(SvRV(*e)) == SVt_PVAV)) |
| 892 |
|
| croak("Hyperman::detach: no psgix.hyperman.conn in this env " |
| 893 |
|
| "(HTTP/2 and HTTP/3 streams share one connection, and " |
| 894 |
|
| "non-Hyperman servers have none, so none can detach)"); |
| 895 |
|
| cid = (AV *)SvRV(*e); |
| 896 |
|
| fsv = av_fetch(cid, 0, 0); |
| 897 |
|
| isv = av_fetch(cid, 1, 0); |
| 898 |
|
| if (!(fsv && *fsv && isv && *isv)) |
| 899 |
|
| croak("Hyperman::detach: malformed psgix.hyperman.conn"); |
| 900 |
|
| fd = (int)SvIV(*fsv); |
| 901 |
|
| id = SvUV(*isv); |
| 902 |
|
| rc = hm_detach(aTHX_ hm_cur_loop, fd, id); |
| 903 |
|
| switch (rc) { |
| 904 |
|
| case 0: break; |
| 905 |
|
| case -1: croak("Hyperman::detach: the connection is gone " |
| 906 |
|
| "(the client hung up, or this env is stale)"); |
| 907 |
|
| case -2: croak("Hyperman::detach: HTTP/2 connections cannot be " /* # uncoverable statement */ |
| 908 |
|
| "detached (streams share one socket)"); |
| 909 |
|
| case -3: croak("Hyperman::detach: TLS connections cannot be " |
| 910 |
|
| "detached (terminate TLS in front of Hyperman)"); |
| 911 |
|
| case -4: croak("Hyperman::detach: a response is still draining " |
| 912 |
|
| "on this connection"); |
| 913 |
|
| case -5: croak("Hyperman::detach: already detached"); |
| 914 |
|
| case -6: croak("Hyperman::detach: not supported on this " /* # uncoverable statement */ |
| 915 |
|
| "platform (it needs fork-style fd ownership)"); |
| 916 |
|
| default: croak("Hyperman::detach: failed (%d)", rc); /* # uncoverable statement */ |
| 917 |
|
| } |
| 918 |
|
| RETVAL = (IV)fd; |
| 919 |
|
| } |
| 920 |
|
| #line 921 "Hyperman.c" |
| 921 |
4 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
1 |
3 |
4 |
|
| 922 |
4 |
| ST(0) = TARG; |
| 923 |
|
| } |
| 924 |
4 |
| XSRETURN(1); |
| 925 |
|
| } |
| 926 |
|
| |
| 927 |
|
| |
| 928 |
|
| XS_EUPXS(XS_Hyperman_stream); /* prototype to pass -Wmissing-prototypes */ |
| 929 |
10 |
| XS_EUPXS(XS_Hyperman_stream) |
| 930 |
|
| { |
| 931 |
10 |
| dVAR; dXSARGS; |
| 932 |
10 |
▶ | if (items < 1 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 1 || items > 3) |
10 |
0 |
10 |
| if (items < 1 || items > 3) |
0 |
10 |
10 |
|
| 933 |
0 |
| croak_xs_usage(cv, "env, status = 200, headers = NULL"); |
| 934 |
|
| { |
| 935 |
10 |
| SV * env = ST(0) |
| 936 |
|
| ; |
| 937 |
|
| int status; |
| 938 |
|
| SV * headers; |
| 939 |
|
| SV * RETVAL; |
| 940 |
|
| |
| 941 |
10 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
2 |
8 |
10 |
|
| 942 |
2 |
| status = 200; |
| 943 |
|
| else { |
| 944 |
8 |
| status = (int)SvIV(ST(1)) |
| 945 |
|
| ; |
| 946 |
|
| } |
| 947 |
|
| |
| 948 |
10 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
2 |
8 |
10 |
|
| 949 |
2 |
| headers = NULL; |
| 950 |
|
| else { |
| 951 |
8 |
| headers = ST(2) |
| 952 |
|
| ; |
| 953 |
|
| } |
| 954 |
|
| #line 619 "./xs/hyperman.xs" |
| 955 |
|
| { |
| 956 |
|
| AV *w; |
| 957 |
|
| void *h; |
| 958 |
|
| int fd; |
| 959 |
|
| UV id; |
| 960 |
|
| int64_t sid = -1; |
| 961 |
|
| if (!hm_cur_loop) |
| 962 |
|
| croak("Hyperman::stream: no running loop (call it from inside " |
| 963 |
|
| "a request)"); |
| 964 |
|
| if (!SvROK(env) || SvTYPE(SvRV(env)) != SVt_PVHV) /* # uncoverable condition left count:2 class:ignore_covered_err */ |
| 965 |
|
| croak("Hyperman::stream: give it the PSGI env hashref"); |
| 966 |
|
| if (!hm_stream_ticket(aTHX_ env, &fd, &id, &sid)) |
| 967 |
|
| croak("Hyperman::stream: no usable psgix.hyperman.stream in this " |
| 968 |
|
| "env (not a Hyperman request, or the env is stale)"); |
| 969 |
|
| if (headers && !SvOK(headers)) headers = NULL; |
| 970 |
|
| if (headers && !(SvROK(headers) |
| 971 |
|
| && SvTYPE(SvRV(headers)) == SVt_PVAV)) |
| 972 |
|
| croak("Hyperman::stream: headers must be an array reference"); |
| 973 |
|
| h = hm_stream_open(aTHX_ (void *)hm_cur_loop, fd, id, sid, |
| 974 |
|
| status, headers); |
| 975 |
|
| if (!h) |
| 976 |
|
| croak("Hyperman::stream: cannot stream on this request (the " |
| 977 |
|
| "client is gone, a response was already sent, or the " |
| 978 |
|
| "handler has not deferred - open a stream from a " |
| 979 |
|
| "psgi.streaming coderef or after parking on a Future)"); |
| 980 |
|
| w = newAV(); |
| 981 |
|
| av_extend(w, 2); |
| 982 |
|
| av_store(w, 0, newSViv(PTR2IV(h))); |
| 983 |
|
| av_store(w, 1, newSVuv(((hm_stream *)h)->serial)); |
| 984 |
|
| av_store(w, 2, newSVpvs("stream")); |
| 985 |
|
| RETVAL = newRV_noinc((SV *)w); |
| 986 |
|
| sv_bless(RETVAL, gv_stashpv("Hyperman::Writer", GV_ADD)); |
| 987 |
|
| } |
| 988 |
|
| #line 989 "Hyperman.c" |
| 989 |
5 |
| RETVAL = sv_2mortal(RETVAL); |
| 990 |
5 |
| ST(0) = RETVAL; |
| 991 |
|
| } |
| 992 |
5 |
| XSRETURN(1); |
| 993 |
|
| } |
| 994 |
|
| |
| 995 |
|
| |
| 996 |
|
| XS_EUPXS(XS_Hyperman_deny_add); /* prototype to pass -Wmissing-prototypes */ |
| 997 |
29 |
| XS_EUPXS(XS_Hyperman_deny_add) |
| 998 |
|
| { |
| 999 |
29 |
| dVAR; dXSARGS; |
| 1000 |
29 |
▶ | if (items < 2 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 2 || items > 3) |
29 |
0 |
29 |
| if (items < 2 || items > 3) |
0 |
29 |
29 |
|
| 1001 |
0 |
| croak_xs_usage(cv, "class, ip, ttl = 0"); |
| 1002 |
|
| { |
| 1003 |
29 |
| SV * class = ST(0) |
| 1004 |
|
| ; |
| 1005 |
29 |
| SV * ip = ST(1) |
| 1006 |
|
| ; |
| 1007 |
|
| IV ttl; |
| 1008 |
|
| |
| 1009 |
29 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
29 |
29 |
|
| 1010 |
0 |
| ttl = 0; |
| 1011 |
|
| else { |
| 1012 |
29 |
| ttl = (IV)SvIV(ST(2)) |
| 1013 |
|
| ; |
| 1014 |
|
| } |
| 1015 |
|
| #line 684 "./xs/hyperman.xs" |
| 1016 |
|
| PERL_UNUSED_VAR(class); |
| 1017 |
|
| if (SvOK(ip)) hm_sa_deny_add(SvPV_nolen(ip), (long)ttl); |
| 1018 |
|
| #line 1019 "Hyperman.c" |
| 1019 |
|
| } |
| 1020 |
29 |
| XSRETURN_EMPTY; |
| 1021 |
|
| } |
| 1022 |
|
| |
| 1023 |
|
| |
| 1024 |
|
| XS_EUPXS(XS_Hyperman_deny_remove); /* prototype to pass -Wmissing-prototypes */ |
| 1025 |
3 |
| XS_EUPXS(XS_Hyperman_deny_remove) |
| 1026 |
|
| { |
| 1027 |
3 |
| dVAR; dXSARGS; |
| 1028 |
3 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
3 |
3 |
|
| 1029 |
0 |
| croak_xs_usage(cv, "class, ip"); |
| 1030 |
|
| { |
| 1031 |
3 |
| SV * class = ST(0) |
| 1032 |
|
| ; |
| 1033 |
3 |
▶ | SV * ip = ST(1) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * ip = ST(1) |
3 |
0 |
3 |
|
| 1034 |
|
| ; |
| 1035 |
|
| #line 695 "./xs/hyperman.xs" |
| 1036 |
|
| PERL_UNUSED_VAR(class); |
| 1037 |
|
| if (SvOK(ip)) hm_sa_deny_remove(SvPV_nolen(ip)); |
| 1038 |
|
| #line 1039 "Hyperman.c" |
| 1039 |
|
| } |
| 1040 |
3 |
| XSRETURN_EMPTY; |
| 1041 |
|
| } |
| 1042 |
|
| |
| 1043 |
|
| |
| 1044 |
|
| XS_EUPXS(XS_Hyperman_pool_stats); /* prototype to pass -Wmissing-prototypes */ |
| 1045 |
6 |
| XS_EUPXS(XS_Hyperman_pool_stats) |
| 1046 |
|
| { |
| 1047 |
6 |
| dVAR; dXSARGS; |
| 1048 |
6 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
6 |
0 |
6 |
| if (items < 0 || items > 1) |
0 |
6 |
6 |
|
| 1049 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 1050 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1051 |
6 |
| SP -= items; |
| 1052 |
|
| { |
| 1053 |
|
| SV * class; |
| 1054 |
|
| |
| 1055 |
6 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
6 |
6 |
|
| 1056 |
0 |
| class = &PL_sv_undef; |
| 1057 |
|
| else { |
| 1058 |
6 |
| class = ST(0) |
| 1059 |
|
| ; |
| 1060 |
|
| } |
| 1061 |
|
| #line 709 "./xs/hyperman.xs" |
| 1062 |
|
| { |
| 1063 |
|
| uint64_t i, n = hm_sa_board_slots(); |
| 1064 |
|
| PERL_UNUSED_VAR(class); |
| 1065 |
|
| for (i = 0; i < n; i++) { |
| 1066 |
|
| sa_sb_reading rd; |
| 1067 |
|
| HV *h; |
| 1068 |
|
| if (!hm_sa_board_read((uint32_t)i, &rd)) continue; |
| 1069 |
|
| h = newHV(); |
| 1070 |
|
| hv_stores(h, "pid", newSVuv((UV)rd.pid)); |
| 1071 |
|
| hv_stores(h, "alive", newSViv(rd.alive ? 1 : 0)); |
| 1072 |
|
| hv_stores(h, "updated", newSVuv((UV)rd.updated)); |
| 1073 |
|
| hv_stores(h, "status", newSVpvn(rd.status, rd.statuslen)); |
| 1074 |
|
| hv_stores(h, "requests", newSVuv((UV)rd.gauges[HM_SB_REQUESTS])); |
| 1075 |
|
| hv_stores(h, "accepts", newSVuv((UV)rd.gauges[HM_SB_ACCEPTS])); |
| 1076 |
|
| hv_stores(h, "denied", newSVuv((UV)rd.gauges[HM_SB_DENIED])); |
| 1077 |
|
| hv_stores(h, "connections", newSVuv((UV)rd.gauges[HM_SB_CONNS])); |
| 1078 |
|
| hv_stores(h, "bytes_out", newSVuv((UV)rd.gauges[HM_SB_BYTES_OUT])); |
| 1079 |
|
| hv_stores(h, "datagrams", newSVuv((UV)rd.gauges[HM_SB_DATAGRAMS])); |
| 1080 |
|
| hv_stores(h, "h3_requests", newSVuv((UV)rd.gauges[HM_SB_H3])); |
| 1081 |
|
| XPUSHs(sv_2mortal(newRV_noinc((SV *)h))); |
| 1082 |
|
| } |
| 1083 |
|
| } |
| 1084 |
|
| #line 1085 "Hyperman.c" |
| 1085 |
6 |
| PUTBACK; |
| 1086 |
6 |
| return; |
| 1087 |
|
| } |
| 1088 |
|
| } |
| 1089 |
|
| |
| 1090 |
|
| |
| 1091 |
|
| XS_EUPXS(XS_Hyperman_leader); /* prototype to pass -Wmissing-prototypes */ |
| 1092 |
5 |
| XS_EUPXS(XS_Hyperman_leader) |
| 1093 |
|
| { |
| 1094 |
5 |
| dVAR; dXSARGS; |
| 1095 |
5 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
0 |
5 |
5 |
|
| 1096 |
0 |
| croak_xs_usage(cv, "class, name, ..."); |
| 1097 |
|
| { |
| 1098 |
5 |
| SV * class = ST(0) |
| 1099 |
|
| ; |
| 1100 |
5 |
▶ | SV * name = ST(1) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * name = ST(1) |
3 |
2 |
5 |
|
| 1101 |
|
| ; |
| 1102 |
|
| SV * RETVAL; |
| 1103 |
|
| #line 742 "./xs/hyperman.xs" |
| 1104 |
|
| { |
| 1105 |
|
| int i, count; |
| 1106 |
|
| SV *ret = NULL; |
| 1107 |
|
| PERL_UNUSED_VAR(class); |
| 1108 |
|
| if (!hm_sa_arena_sv) XSRETURN_UNDEF; |
| 1109 |
|
| { |
| 1110 |
|
| dSP; |
| 1111 |
|
| ENTER; SAVETMPS; |
| 1112 |
|
| PUSHMARK(SP); |
| 1113 |
|
| EXTEND(SP, items + 1); |
| 1114 |
|
| PUSHs(hm_sa_arena_sv); |
| 1115 |
|
| PUSHs(name); |
| 1116 |
|
| for (i = 2; i < items; i++) PUSHs(ST(i)); |
| 1117 |
|
| PUTBACK; |
| 1118 |
|
| count = call_method("lease", G_SCALAR); |
| 1119 |
|
| SPAGAIN; |
| 1120 |
|
| if (count == 1) ret = newSVsv(POPs); |
| 1121 |
|
| PUTBACK; |
| 1122 |
|
| FREETMPS; LEAVE; |
| 1123 |
|
| } |
| 1124 |
|
| if (!ret) XSRETURN_UNDEF; |
| 1125 |
|
| RETVAL = ret; |
| 1126 |
|
| } |
| 1127 |
|
| #line 1128 "Hyperman.c" |
| 1128 |
2 |
| RETVAL = sv_2mortal(RETVAL); |
| 1129 |
2 |
| ST(0) = RETVAL; |
| 1130 |
|
| } |
| 1131 |
2 |
| XSRETURN(1); |
| 1132 |
|
| } |
| 1133 |
|
| |
| 1134 |
|
| |
| 1135 |
|
| XS_EUPXS(XS_Hyperman_distinct_clients); /* prototype to pass -Wmissing-prototypes */ |
| 1136 |
206 |
| XS_EUPXS(XS_Hyperman_distinct_clients) |
| 1137 |
|
| { |
| 1138 |
206 |
| dVAR; dXSARGS; |
| 1139 |
206 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
206 |
0 |
206 |
| if (items < 0 || items > 1) |
0 |
206 |
206 |
|
| 1140 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 1141 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1142 |
206 |
| SP -= items; |
| 1143 |
|
| { |
| 1144 |
|
| SV * class; |
| 1145 |
|
| |
| 1146 |
206 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
206 |
206 |
|
| 1147 |
0 |
| class = &PL_sv_undef; |
| 1148 |
|
| else { |
| 1149 |
206 |
| class = ST(0) |
| 1150 |
|
| ; |
| 1151 |
|
| } |
| 1152 |
|
| #line 778 "./xs/hyperman.xs" |
| 1153 |
|
| { |
| 1154 |
|
| double c = hm_sa_hll_count(); |
| 1155 |
|
| PERL_UNUSED_VAR(class); |
| 1156 |
|
| if (c < 0.0) XSRETURN_EMPTY; |
| 1157 |
|
| EXTEND(SP, 2); |
| 1158 |
|
| mPUSHn(c); |
| 1159 |
|
| mPUSHn(1.04 / 128.0); /* 1.04 / sqrt(2^14) */ |
| 1160 |
|
| } |
| 1161 |
|
| #line 1162 "Hyperman.c" |
| 1162 |
201 |
| PUTBACK; |
| 1163 |
201 |
| return; |
| 1164 |
|
| } |
| 1165 |
|
| } |
| 1166 |
|
| |
| 1167 |
|
| |
| 1168 |
|
| XS_EUPXS(XS_Hyperman_arena); /* prototype to pass -Wmissing-prototypes */ |
| 1169 |
20 |
| XS_EUPXS(XS_Hyperman_arena) |
| 1170 |
|
| { |
| 1171 |
20 |
| dVAR; dXSARGS; |
| 1172 |
20 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
20 |
20 |
|
| 1173 |
0 |
| croak_xs_usage(cv, "class"); |
| 1174 |
|
| { |
| 1175 |
20 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
14 |
6 |
20 |
|
| 1176 |
|
| ; |
| 1177 |
|
| SV * RETVAL; |
| 1178 |
|
| #line 796 "./xs/hyperman.xs" |
| 1179 |
|
| PERL_UNUSED_VAR(class); |
| 1180 |
|
| RETVAL = hm_sa_arena_sv ? newSVsv(hm_sa_arena_sv) : newSV(0); |
| 1181 |
|
| #line 1182 "Hyperman.c" |
| 1182 |
20 |
| RETVAL = sv_2mortal(RETVAL); |
| 1183 |
20 |
| ST(0) = RETVAL; |
| 1184 |
|
| } |
| 1185 |
20 |
| XSRETURN(1); |
| 1186 |
|
| } |
| 1187 |
|
| |
| 1188 |
|
| |
| 1189 |
|
| XS_EUPXS(XS_Hyperman_deny_check); /* prototype to pass -Wmissing-prototypes */ |
| 1190 |
33 |
| XS_EUPXS(XS_Hyperman_deny_check) |
| 1191 |
|
| { |
| 1192 |
33 |
| dVAR; dXSARGS; |
| 1193 |
33 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
33 |
33 |
|
| 1194 |
0 |
| croak_xs_usage(cv, "class, ip"); |
| 1195 |
|
| { |
| 1196 |
33 |
| SV * class = ST(0) |
| 1197 |
|
| ; |
| 1198 |
33 |
| SV * ip = ST(1) |
| 1199 |
|
| ; |
| 1200 |
|
| IV RETVAL; |
| 1201 |
33 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
33 |
0 |
33 |
| dXSTARG; |
33 |
0 |
33 |
|
| 1202 |
|
| #line 807 "./xs/hyperman.xs" |
| 1203 |
|
| PERL_UNUSED_VAR(class); |
| 1204 |
|
| RETVAL = SvOK(ip) ? hm_sa_deny_check(SvPV_nolen(ip)) : 0; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1205 |
|
| #line 1206 "Hyperman.c" |
| 1206 |
33 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
23 |
10 |
33 |
|
| 1207 |
33 |
| ST(0) = TARG; |
| 1208 |
|
| } |
| 1209 |
33 |
| XSRETURN(1); |
| 1210 |
|
| } |
| 1211 |
|
| |
| 1212 |
|
| |
| 1213 |
|
| XS_EUPXS(XS_Hyperman_ratelimit_hit); /* prototype to pass -Wmissing-prototypes */ |
| 1214 |
11 |
| XS_EUPXS(XS_Hyperman_ratelimit_hit) |
| 1215 |
|
| { |
| 1216 |
11 |
| dVAR; dXSARGS; |
| 1217 |
11 |
▶ | if (items < 3 || items > 4) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 3 || items > 4) |
11 |
0 |
11 |
| if (items < 3 || items > 4) |
0 |
11 |
11 |
|
| 1218 |
0 |
| croak_xs_usage(cv, "class, key, limit, window = 60"); |
| 1219 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1220 |
11 |
| SP -= items; |
| 1221 |
|
| { |
| 1222 |
11 |
| SV * class = ST(0) |
| 1223 |
|
| ; |
| 1224 |
11 |
| SV * key = ST(1) |
| 1225 |
|
| ; |
| 1226 |
11 |
| IV limit = (IV)SvIV(ST(2)) |
| 1227 |
|
| ; |
| 1228 |
|
| IV window; |
| 1229 |
|
| |
| 1230 |
11 |
▶ | if (items < 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 4) |
0 |
11 |
11 |
|
| 1231 |
0 |
| window = 60; |
| 1232 |
|
| else { |
| 1233 |
11 |
| window = (IV)SvIV(ST(3)) |
| 1234 |
|
| ; |
| 1235 |
|
| } |
| 1236 |
|
| #line 824 "./xs/hyperman.xs" |
| 1237 |
|
| { |
| 1238 |
|
| STRLEN klen; |
| 1239 |
|
| const char *kp = SvOK(key) ? SvPV_const(key, klen) : ""; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1240 |
|
| long rem = 0, reset = 0; |
| 1241 |
|
| int ok; |
| 1242 |
|
| PERL_UNUSED_VAR(class); |
| 1243 |
|
| if (!SvOK(key)) klen = 0; |
| 1244 |
|
| ok = hm_sa_ratelimit_hit(kp, (size_t)klen, (long)limit, (long)window, |
| 1245 |
|
| &rem, &reset); |
| 1246 |
|
| EXTEND(SP, 3); |
| 1247 |
|
| mPUSHi(ok); |
| 1248 |
|
| mPUSHi(rem); |
| 1249 |
|
| mPUSHi(reset); |
| 1250 |
|
| } |
| 1251 |
|
| #line 1252 "Hyperman.c" |
| 1252 |
11 |
| PUTBACK; |
| 1253 |
11 |
| return; |
| 1254 |
|
| } |
| 1255 |
|
| } |
| 1256 |
|
| |
| 1257 |
|
| |
| 1258 |
|
| XS_EUPXS(XS_Hyperman_on_worker_start); /* prototype to pass -Wmissing-prototypes */ |
| 1259 |
6 |
| XS_EUPXS(XS_Hyperman_on_worker_start) |
| 1260 |
|
| { |
| 1261 |
6 |
| dVAR; dXSARGS; |
| 1262 |
6 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
6 |
6 |
|
| 1263 |
0 |
| croak_xs_usage(cv, "class, cb"); |
| 1264 |
|
| { |
| 1265 |
6 |
| SV * class = ST(0) |
| 1266 |
|
| ; |
| 1267 |
6 |
| SV * cb = ST(1) |
| 1268 |
|
| ; |
| 1269 |
|
| IV RETVAL; |
| 1270 |
6 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
6 |
0 |
6 |
|
| 1271 |
|
| #line 851 "./xs/hyperman.xs" |
| 1272 |
|
| PERL_UNUSED_VAR(class); |
| 1273 |
|
| RETVAL = hm_worker_hook_add_perl(aTHX_ cb); |
| 1274 |
|
| #line 1275 "Hyperman.c" |
| 1275 |
4 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
4 |
4 |
|
| 1276 |
4 |
| ST(0) = TARG; |
| 1277 |
|
| } |
| 1278 |
4 |
| XSRETURN(1); |
| 1279 |
|
| } |
| 1280 |
|
| |
| 1281 |
|
| |
| 1282 |
|
| XS_EUPXS(XS_Hyperman__proxy_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 1283 |
2 |
| XS_EUPXS(XS_Hyperman__proxy_selftest) |
| 1284 |
|
| { |
| 1285 |
2 |
| dVAR; dXSARGS; |
| 1286 |
2 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
2 |
2 |
|
| 1287 |
0 |
| croak_xs_usage(cv, "class"); |
| 1288 |
|
| { |
| 1289 |
2 |
| SV * class = ST(0) |
| 1290 |
|
| ; |
| 1291 |
|
| IV RETVAL; |
| 1292 |
2 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
2 |
0 |
2 |
|
| 1293 |
|
| #line 864 "./xs/hyperman.xs" |
| 1294 |
|
| PERL_UNUSED_VAR(class); |
| 1295 |
|
| RETVAL = hm_proxy_selftest(); |
| 1296 |
|
| #line 1297 "Hyperman.c" |
| 1297 |
2 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
2 |
2 |
|
| 1298 |
2 |
| ST(0) = TARG; |
| 1299 |
|
| } |
| 1300 |
2 |
| XSRETURN(1); |
| 1301 |
|
| } |
| 1302 |
|
| |
| 1303 |
|
| |
| 1304 |
|
| XS_EUPXS(XS_Hyperman__croak_sv_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 1305 |
4 |
| XS_EUPXS(XS_Hyperman__croak_sv_selftest) |
| 1306 |
|
| { |
| 1307 |
4 |
| dVAR; dXSARGS; |
| 1308 |
4 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
4 |
4 |
|
| 1309 |
0 |
| croak_xs_usage(cv, "class, sv"); |
| 1310 |
|
| { |
| 1311 |
4 |
| SV * class = ST(0) |
| 1312 |
|
| ; |
| 1313 |
4 |
| SV * sv = ST(1) |
| 1314 |
|
| ; |
| 1315 |
|
| #line 884 "./xs/hyperman.xs" |
| 1316 |
|
| PERL_UNUSED_VAR(class); |
| 1317 |
|
| hm_croak_sv(aTHX_ sv); |
| 1318 |
|
| #line 1319 "Hyperman.c" |
| 1319 |
|
| } |
| 1320 |
0 |
| XSRETURN_EMPTY; |
| 1321 |
|
| } |
| 1322 |
|
| |
| 1323 |
|
| |
| 1324 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/hyperman.xs' */ |
| 1325 |
|
| |
| 1326 |
|
| |
| 1327 |
|
| /* INCLUDE: Including 'xs/future.xs' from 'Hyperman.xs' */ |
| 1328 |
|
| |
| 1329 |
|
| |
| 1330 |
|
| XS_EUPXS(XS_Hyperman__Future_new); /* prototype to pass -Wmissing-prototypes */ |
| 1331 |
87 |
| XS_EUPXS(XS_Hyperman__Future_new) |
| 1332 |
|
| { |
| 1333 |
87 |
| dVAR; dXSARGS; |
| 1334 |
87 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
87 |
87 |
|
| 1335 |
0 |
| croak_xs_usage(cv, "class"); |
| 1336 |
|
| { |
| 1337 |
87 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
1 |
86 |
87 |
|
| 1338 |
|
| ; |
| 1339 |
|
| SV * RETVAL; |
| 1340 |
|
| #line 16 "./xs/future.xs" |
| 1341 |
|
| { |
| 1342 |
|
| const char *name; |
| 1343 |
|
| if (SvROK(class) && SvOBJECT(SvRV(class))) /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 1344 |
|
| name = HvNAME(SvSTASH(SvRV(class))); |
| 1345 |
|
| else |
| 1346 |
|
| name = SvPV_nolen(class); |
| 1347 |
|
| RETVAL = hmf_new(aTHX_ name); |
| 1348 |
|
| } |
| 1349 |
|
| #line 1350 "Hyperman.c" |
| 1350 |
87 |
| RETVAL = sv_2mortal(RETVAL); |
| 1351 |
87 |
| ST(0) = RETVAL; |
| 1352 |
|
| } |
| 1353 |
87 |
| XSRETURN(1); |
| 1354 |
|
| } |
| 1355 |
|
| |
| 1356 |
|
| |
| 1357 |
|
| XS_EUPXS(XS_Hyperman__Future_done); /* prototype to pass -Wmissing-prototypes */ |
| 1358 |
48 |
| XS_EUPXS(XS_Hyperman__Future_done) |
| 1359 |
|
| { |
| 1360 |
48 |
| dVAR; dXSARGS; |
| 1361 |
48 |
| dXSI32; |
| 1362 |
48 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
48 |
48 |
|
| 1363 |
0 |
| croak_xs_usage(cv, "self, ..."); |
| 1364 |
|
| { |
| 1365 |
48 |
| SV * self = ST(0) |
| 1366 |
|
| ; |
| 1367 |
|
| SV * RETVAL; |
| 1368 |
|
| #line 33 "./xs/future.xs" |
| 1369 |
|
| PERL_UNUSED_VAR(ix); |
| 1370 |
|
| if (hmf_state(aTHX_ self) == HMF_PENDING) |
| 1371 |
|
| hmf_settle(aTHX_ self, HMF_DONE, &ST(1), items - 1); |
| 1372 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1373 |
|
| #line 1374 "Hyperman.c" |
| 1374 |
46 |
| RETVAL = sv_2mortal(RETVAL); |
| 1375 |
46 |
| ST(0) = RETVAL; |
| 1376 |
|
| } |
| 1377 |
46 |
| XSRETURN(1); |
| 1378 |
|
| } |
| 1379 |
|
| |
| 1380 |
|
| |
| 1381 |
|
| XS_EUPXS(XS_Hyperman__Future_fail); /* prototype to pass -Wmissing-prototypes */ |
| 1382 |
14 |
| XS_EUPXS(XS_Hyperman__Future_fail) |
| 1383 |
|
| { |
| 1384 |
14 |
| dVAR; dXSARGS; |
| 1385 |
14 |
| dXSI32; |
| 1386 |
14 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
14 |
14 |
|
| 1387 |
0 |
| croak_xs_usage(cv, "self, ..."); |
| 1388 |
|
| { |
| 1389 |
14 |
| SV * self = ST(0) |
| 1390 |
|
| ; |
| 1391 |
|
| SV * RETVAL; |
| 1392 |
|
| #line 46 "./xs/future.xs" |
| 1393 |
|
| PERL_UNUSED_VAR(ix); |
| 1394 |
|
| if (hmf_state(aTHX_ self) == HMF_PENDING) { |
| 1395 |
|
| if (items > 1) { |
| 1396 |
|
| hmf_settle(aTHX_ self, HMF_FAILED, &ST(1), items - 1); |
| 1397 |
|
| } else { |
| 1398 |
|
| SV *def = sv_2mortal(newSVpvs("Failed\n")); |
| 1399 |
|
| hmf_settle(aTHX_ self, HMF_FAILED, &def, 1); |
| 1400 |
|
| } |
| 1401 |
|
| } |
| 1402 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1403 |
|
| #line 1404 "Hyperman.c" |
| 1404 |
14 |
| RETVAL = sv_2mortal(RETVAL); |
| 1405 |
14 |
| ST(0) = RETVAL; |
| 1406 |
|
| } |
| 1407 |
14 |
| XSRETURN(1); |
| 1408 |
|
| } |
| 1409 |
|
| |
| 1410 |
|
| |
| 1411 |
|
| XS_EUPXS(XS_Hyperman__Future_done_future); /* prototype to pass -Wmissing-prototypes */ |
| 1412 |
10 |
| XS_EUPXS(XS_Hyperman__Future_done_future) |
| 1413 |
|
| { |
| 1414 |
10 |
| dVAR; dXSARGS; |
| 1415 |
10 |
| dXSI32; |
| 1416 |
10 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
10 |
10 |
|
| 1417 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 1418 |
|
| { |
| 1419 |
10 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
0 |
10 |
10 |
|
| 1420 |
|
| ; |
| 1421 |
|
| SV * RETVAL; |
| 1422 |
|
| #line 67 "./xs/future.xs" |
| 1423 |
|
| { |
| 1424 |
|
| const char *name = (SvROK(class) && SvOBJECT(SvRV(class))) ? HvNAME(SvSTASH(SvRV(class))) /* # uncoverable statement class:ignore_covered_err */ |
| 1425 |
|
| : SvPV_nolen(class); |
| 1426 |
|
| PERL_UNUSED_VAR(ix); |
| 1427 |
|
| RETVAL = hmf_new(aTHX_ name); |
| 1428 |
|
| hmf_settle(aTHX_ RETVAL, HMF_DONE, &ST(1), items - 1); |
| 1429 |
|
| } |
| 1430 |
|
| #line 1431 "Hyperman.c" |
| 1431 |
10 |
| RETVAL = sv_2mortal(RETVAL); |
| 1432 |
10 |
| ST(0) = RETVAL; |
| 1433 |
|
| } |
| 1434 |
10 |
| XSRETURN(1); |
| 1435 |
|
| } |
| 1436 |
|
| |
| 1437 |
|
| |
| 1438 |
|
| XS_EUPXS(XS_Hyperman__Future_fail_future); /* prototype to pass -Wmissing-prototypes */ |
| 1439 |
4 |
| XS_EUPXS(XS_Hyperman__Future_fail_future) |
| 1440 |
|
| { |
| 1441 |
4 |
| dVAR; dXSARGS; |
| 1442 |
4 |
| dXSI32; |
| 1443 |
4 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
4 |
4 |
|
| 1444 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 1445 |
|
| { |
| 1446 |
4 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
0 |
4 |
4 |
|
| 1447 |
|
| ; |
| 1448 |
|
| SV * RETVAL; |
| 1449 |
|
| #line 83 "./xs/future.xs" |
| 1450 |
|
| { |
| 1451 |
|
| const char *name = (SvROK(class) && SvOBJECT(SvRV(class))) ? HvNAME(SvSTASH(SvRV(class))) /* # uncoverable statement class:ignore_covered_err */ |
| 1452 |
|
| : SvPV_nolen(class); |
| 1453 |
|
| PERL_UNUSED_VAR(ix); |
| 1454 |
|
| RETVAL = hmf_new(aTHX_ name); |
| 1455 |
|
| if (items > 1) { |
| 1456 |
|
| hmf_settle(aTHX_ RETVAL, HMF_FAILED, &ST(1), items - 1); |
| 1457 |
|
| } else { |
| 1458 |
|
| SV *def = sv_2mortal(newSVpvs("Failed\n")); |
| 1459 |
|
| hmf_settle(aTHX_ RETVAL, HMF_FAILED, &def, 1); |
| 1460 |
|
| } |
| 1461 |
|
| } |
| 1462 |
|
| #line 1463 "Hyperman.c" |
| 1463 |
4 |
| RETVAL = sv_2mortal(RETVAL); |
| 1464 |
4 |
| ST(0) = RETVAL; |
| 1465 |
|
| } |
| 1466 |
4 |
| XSRETURN(1); |
| 1467 |
|
| } |
| 1468 |
|
| |
| 1469 |
|
| |
| 1470 |
|
| XS_EUPXS(XS_Hyperman__Future_cancel); /* prototype to pass -Wmissing-prototypes */ |
| 1471 |
24 |
| XS_EUPXS(XS_Hyperman__Future_cancel) |
| 1472 |
|
| { |
| 1473 |
24 |
| dVAR; dXSARGS; |
| 1474 |
24 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
24 |
24 |
|
| 1475 |
0 |
| croak_xs_usage(cv, "self"); |
| 1476 |
|
| { |
| 1477 |
24 |
| SV * self = ST(0) |
| 1478 |
|
| ; |
| 1479 |
|
| SV * RETVAL; |
| 1480 |
|
| #line 102 "./xs/future.xs" |
| 1481 |
|
| hmf_cancel(aTHX_ self); |
| 1482 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1483 |
|
| #line 1484 "Hyperman.c" |
| 1484 |
24 |
| RETVAL = sv_2mortal(RETVAL); |
| 1485 |
24 |
| ST(0) = RETVAL; |
| 1486 |
|
| } |
| 1487 |
24 |
| XSRETURN(1); |
| 1488 |
|
| } |
| 1489 |
|
| |
| 1490 |
|
| |
| 1491 |
|
| XS_EUPXS(XS_Hyperman__Future_is_ready); /* prototype to pass -Wmissing-prototypes */ |
| 1492 |
23 |
| XS_EUPXS(XS_Hyperman__Future_is_ready) |
| 1493 |
|
| { |
| 1494 |
23 |
| dVAR; dXSARGS; |
| 1495 |
23 |
| dXSI32; |
| 1496 |
23 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
23 |
23 |
|
| 1497 |
0 |
| croak_xs_usage(cv, "self"); |
| 1498 |
|
| { |
| 1499 |
23 |
| SV * self = ST(0) |
| 1500 |
|
| ; |
| 1501 |
|
| int RETVAL; |
| 1502 |
23 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
23 |
0 |
23 |
|
| 1503 |
|
| #line 113 "./xs/future.xs" |
| 1504 |
|
| PERL_UNUSED_VAR(ix); |
| 1505 |
|
| RETVAL = hmf_state(aTHX_ self) != HMF_PENDING; |
| 1506 |
|
| #line 1507 "Hyperman.c" |
| 1507 |
23 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
1 |
22 |
23 |
|
| 1508 |
23 |
| ST(0) = TARG; |
| 1509 |
|
| } |
| 1510 |
23 |
| XSRETURN(1); |
| 1511 |
|
| } |
| 1512 |
|
| |
| 1513 |
|
| |
| 1514 |
|
| XS_EUPXS(XS_Hyperman__Future_is_done); /* prototype to pass -Wmissing-prototypes */ |
| 1515 |
10 |
| XS_EUPXS(XS_Hyperman__Future_is_done) |
| 1516 |
|
| { |
| 1517 |
10 |
| dVAR; dXSARGS; |
| 1518 |
10 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
10 |
10 |
|
| 1519 |
0 |
| croak_xs_usage(cv, "self"); |
| 1520 |
|
| { |
| 1521 |
10 |
| SV * self = ST(0) |
| 1522 |
|
| ; |
| 1523 |
|
| int RETVAL; |
| 1524 |
10 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
10 |
0 |
10 |
|
| 1525 |
|
| #line 122 "./xs/future.xs" |
| 1526 |
|
| RETVAL = hmf_state(aTHX_ self) == HMF_DONE; |
| 1527 |
|
| #line 1528 "Hyperman.c" |
| 1528 |
10 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
10 |
10 |
|
| 1529 |
10 |
| ST(0) = TARG; |
| 1530 |
|
| } |
| 1531 |
10 |
| XSRETURN(1); |
| 1532 |
|
| } |
| 1533 |
|
| |
| 1534 |
|
| |
| 1535 |
|
| XS_EUPXS(XS_Hyperman__Future_is_failed); /* prototype to pass -Wmissing-prototypes */ |
| 1536 |
13 |
| XS_EUPXS(XS_Hyperman__Future_is_failed) |
| 1537 |
|
| { |
| 1538 |
13 |
| dVAR; dXSARGS; |
| 1539 |
13 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
13 |
13 |
|
| 1540 |
0 |
| croak_xs_usage(cv, "self"); |
| 1541 |
|
| { |
| 1542 |
13 |
| SV * self = ST(0) |
| 1543 |
|
| ; |
| 1544 |
|
| int RETVAL; |
| 1545 |
13 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
13 |
0 |
13 |
|
| 1546 |
|
| #line 130 "./xs/future.xs" |
| 1547 |
|
| RETVAL = hmf_state(aTHX_ self) == HMF_FAILED; |
| 1548 |
|
| #line 1549 "Hyperman.c" |
| 1549 |
13 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
13 |
13 |
|
| 1550 |
13 |
| ST(0) = TARG; |
| 1551 |
|
| } |
| 1552 |
13 |
| XSRETURN(1); |
| 1553 |
|
| } |
| 1554 |
|
| |
| 1555 |
|
| |
| 1556 |
|
| XS_EUPXS(XS_Hyperman__Future_is_cancelled); /* prototype to pass -Wmissing-prototypes */ |
| 1557 |
28 |
| XS_EUPXS(XS_Hyperman__Future_is_cancelled) |
| 1558 |
|
| { |
| 1559 |
28 |
| dVAR; dXSARGS; |
| 1560 |
28 |
| dXSI32; |
| 1561 |
28 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
28 |
28 |
|
| 1562 |
0 |
| croak_xs_usage(cv, "self"); |
| 1563 |
|
| { |
| 1564 |
28 |
| SV * self = ST(0) |
| 1565 |
|
| ; |
| 1566 |
|
| int RETVAL; |
| 1567 |
28 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
28 |
0 |
28 |
|
| 1568 |
|
| #line 140 "./xs/future.xs" |
| 1569 |
|
| PERL_UNUSED_VAR(ix); |
| 1570 |
|
| RETVAL = hmf_state(aTHX_ self) == HMF_CANCELLED; |
| 1571 |
|
| #line 1572 "Hyperman.c" |
| 1572 |
28 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
28 |
28 |
|
| 1573 |
28 |
| ST(0) = TARG; |
| 1574 |
|
| } |
| 1575 |
28 |
| XSRETURN(1); |
| 1576 |
|
| } |
| 1577 |
|
| |
| 1578 |
|
| |
| 1579 |
|
| XS_EUPXS(XS_Hyperman__Future_AWAIT_CLONE); /* prototype to pass -Wmissing-prototypes */ |
| 1580 |
1 |
| XS_EUPXS(XS_Hyperman__Future_AWAIT_CLONE) |
| 1581 |
|
| { |
| 1582 |
1 |
| dVAR; dXSARGS; |
| 1583 |
1 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
1 |
1 |
|
| 1584 |
0 |
| croak_xs_usage(cv, "self"); |
| 1585 |
|
| { |
| 1586 |
1 |
| SV * self = ST(0) |
| 1587 |
|
| ; |
| 1588 |
|
| SV * RETVAL; |
| 1589 |
|
| #line 151 "./xs/future.xs" |
| 1590 |
|
| RETVAL = hmf_new(aTHX_ hmf_class_of(aTHX_ self)); |
| 1591 |
|
| #line 1592 "Hyperman.c" |
| 1592 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 1593 |
1 |
| ST(0) = RETVAL; |
| 1594 |
|
| } |
| 1595 |
1 |
| XSRETURN(1); |
| 1596 |
|
| } |
| 1597 |
|
| |
| 1598 |
|
| |
| 1599 |
|
| XS_EUPXS(XS_Hyperman__Future_on_ready); /* prototype to pass -Wmissing-prototypes */ |
| 1600 |
9 |
| XS_EUPXS(XS_Hyperman__Future_on_ready) |
| 1601 |
|
| { |
| 1602 |
9 |
| dVAR; dXSARGS; |
| 1603 |
9 |
| dXSI32; |
| 1604 |
9 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
9 |
9 |
|
| 1605 |
0 |
| croak_xs_usage(cv, "self, cb"); |
| 1606 |
|
| { |
| 1607 |
9 |
| SV * self = ST(0) |
| 1608 |
|
| ; |
| 1609 |
9 |
| SV * cb = ST(1) |
| 1610 |
|
| ; |
| 1611 |
|
| SV * RETVAL; |
| 1612 |
|
| #line 162 "./xs/future.xs" |
| 1613 |
|
| PERL_UNUSED_VAR(ix); |
| 1614 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1615 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1616 |
|
| #line 1617 "Hyperman.c" |
| 1617 |
7 |
| RETVAL = sv_2mortal(RETVAL); |
| 1618 |
7 |
| ST(0) = RETVAL; |
| 1619 |
|
| } |
| 1620 |
7 |
| XSRETURN(1); |
| 1621 |
|
| } |
| 1622 |
|
| |
| 1623 |
|
| |
| 1624 |
|
| XS_EUPXS(XS_Hyperman__Future_on_cancel); /* prototype to pass -Wmissing-prototypes */ |
| 1625 |
9 |
| XS_EUPXS(XS_Hyperman__Future_on_cancel) |
| 1626 |
|
| { |
| 1627 |
9 |
| dVAR; dXSARGS; |
| 1628 |
9 |
| dXSI32; |
| 1629 |
9 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
9 |
9 |
|
| 1630 |
0 |
| croak_xs_usage(cv, "self, thing"); |
| 1631 |
|
| { |
| 1632 |
9 |
| SV * self = ST(0) |
| 1633 |
|
| ; |
| 1634 |
9 |
| SV * thing = ST(1) |
| 1635 |
|
| ; |
| 1636 |
|
| SV * RETVAL; |
| 1637 |
|
| #line 180 "./xs/future.xs" |
| 1638 |
|
| { |
| 1639 |
|
| IV st = hmf_state(aTHX_ self); |
| 1640 |
|
| PERL_UNUSED_VAR(ix); |
| 1641 |
|
| if (st == HMF_CANCELLED) { |
| 1642 |
|
| hmf_cancel_target(aTHX_ thing, self); |
| 1643 |
|
| } else if (st == HMF_PENDING) { |
| 1644 |
|
| SV *cb = hm_closure(aTHX_ hm_xs_oncancel_cb, NULL, thing, |
| 1645 |
|
| NULL, NULL, 0, 0); |
| 1646 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1647 |
|
| SvREFCNT_dec(cb); |
| 1648 |
|
| } |
| 1649 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1650 |
|
| } |
| 1651 |
|
| #line 1652 "Hyperman.c" |
| 1652 |
9 |
| RETVAL = sv_2mortal(RETVAL); |
| 1653 |
9 |
| ST(0) = RETVAL; |
| 1654 |
|
| } |
| 1655 |
9 |
| XSRETURN(1); |
| 1656 |
|
| } |
| 1657 |
|
| |
| 1658 |
|
| |
| 1659 |
|
| XS_EUPXS(XS_Hyperman__Future_on_done); /* prototype to pass -Wmissing-prototypes */ |
| 1660 |
2002 |
| XS_EUPXS(XS_Hyperman__Future_on_done) |
| 1661 |
|
| { |
| 1662 |
2002 |
| dVAR; dXSARGS; |
| 1663 |
2002 |
| dXSI32; |
| 1664 |
2002 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
2002 |
2002 |
|
| 1665 |
0 |
| croak_xs_usage(cv, "self, usercb"); |
| 1666 |
|
| { |
| 1667 |
2002 |
| SV * self = ST(0) |
| 1668 |
|
| ; |
| 1669 |
2002 |
▶ | SV * usercb = ST(1) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * usercb = ST(1) |
2001 |
1 |
2002 |
|
| 1670 |
|
| ; |
| 1671 |
|
| SV * RETVAL; |
| 1672 |
|
| #line 203 "./xs/future.xs" |
| 1673 |
|
| { |
| 1674 |
|
| SV *cb = hm_closure(aTHX_ hm_xs_ondone_cb, NULL, usercb, NULL, NULL, |
| 1675 |
|
| ix == 0 ? HMF_DONE : HMF_FAILED, 0); |
| 1676 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1677 |
|
| SvREFCNT_dec(cb); |
| 1678 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1679 |
|
| } |
| 1680 |
|
| #line 1681 "Hyperman.c" |
| 1681 |
2002 |
| RETVAL = sv_2mortal(RETVAL); |
| 1682 |
2002 |
| ST(0) = RETVAL; |
| 1683 |
|
| } |
| 1684 |
2002 |
| XSRETURN(1); |
| 1685 |
|
| } |
| 1686 |
|
| |
| 1687 |
|
| |
| 1688 |
|
| XS_EUPXS(XS_Hyperman__Future_await); /* prototype to pass -Wmissing-prototypes */ |
| 1689 |
1 |
| XS_EUPXS(XS_Hyperman__Future_await) |
| 1690 |
|
| { |
| 1691 |
1 |
| dVAR; dXSARGS; |
| 1692 |
1 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
1 |
1 |
|
| 1693 |
0 |
| croak_xs_usage(cv, "self"); |
| 1694 |
|
| { |
| 1695 |
1 |
| SV * self = ST(0) |
| 1696 |
|
| ; |
| 1697 |
|
| SV * RETVAL; |
| 1698 |
|
| #line 217 "./xs/future.xs" |
| 1699 |
|
| hmf_await(aTHX_ self); |
| 1700 |
|
| RETVAL = SvREFCNT_inc(self); |
| 1701 |
|
| #line 1702 "Hyperman.c" |
| 1702 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 1703 |
1 |
| ST(0) = RETVAL; |
| 1704 |
|
| } |
| 1705 |
1 |
| XSRETURN(1); |
| 1706 |
|
| } |
| 1707 |
|
| |
| 1708 |
|
| |
| 1709 |
|
| XS_EUPXS(XS_Hyperman__Future_get); /* prototype to pass -Wmissing-prototypes */ |
| 1710 |
46 |
| XS_EUPXS(XS_Hyperman__Future_get) |
| 1711 |
|
| { |
| 1712 |
46 |
| dVAR; dXSARGS; |
| 1713 |
46 |
| dXSI32; |
| 1714 |
46 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
46 |
46 |
|
| 1715 |
0 |
| croak_xs_usage(cv, "self"); |
| 1716 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1717 |
46 |
| SP -= items; |
| 1718 |
|
| { |
| 1719 |
46 |
▶ | SV * self = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * self = ST(0) |
7 |
39 |
46 |
|
| 1720 |
|
| ; |
| 1721 |
|
| #line 230 "./xs/future.xs" |
| 1722 |
|
| { |
| 1723 |
|
| IV st; |
| 1724 |
|
| /* AWAIT_GET is defined only on a future that is already ready, so it |
| 1725 |
|
| * reads the result where every other spelling waits for one. |
| 1726 |
|
| * AWAIT_WAIT is the spelling that does wait - it is what a toplevel |
| 1727 |
|
| * await resolves to. */ |
| 1728 |
|
| if (ix == 3) { |
| 1729 |
|
| st = hmf_state(aTHX_ self); |
| 1730 |
|
| if (st == HMF_PENDING) croak("Hyperman::Future is not ready"); |
| 1731 |
|
| } else { |
| 1732 |
|
| /* The wait pumps the loop, which runs other handlers: the Perl |
| 1733 |
|
| * stack can be reallocated under this frame, so the pointer this |
| 1734 |
|
| * PPCODE pushes results through is re-read afterwards. */ |
| 1735 |
|
| PUTBACK; |
| 1736 |
|
| hmf_await(aTHX_ self); |
| 1737 |
|
| SPAGAIN; |
| 1738 |
|
| st = hmf_state(aTHX_ self); |
| 1739 |
|
| } |
| 1740 |
|
| if (st == HMF_FAILED) { |
| 1741 |
|
| AV *fav = hmf_values_av(aTHX_ self); |
| 1742 |
|
| SV **e = fav ? av_fetch(fav, 0, 0) : NULL; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1743 |
|
| if (e) croak_sv(sv_mortalcopy(*e)); |
| 1744 |
|
| croak("Failed"); /* # uncoverable statement */ |
| 1745 |
|
| } |
| 1746 |
|
| if (st == HMF_CANCELLED) |
| 1747 |
|
| croak("Hyperman::Future was cancelled"); |
| 1748 |
|
| { |
| 1749 |
|
| AV *rav = hmf_values_av(aTHX_ self); |
| 1750 |
|
| SSize_t n = rav ? av_len(rav) + 1 : 0; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1751 |
|
| if (GIMME_V == G_ARRAY) { |
| 1752 |
|
| SSize_t i; |
| 1753 |
|
| EXTEND(SP, n); |
| 1754 |
|
| for (i = 0; i < n; i++) { |
| 1755 |
|
| SV **e = av_fetch(rav, i, 0); |
| 1756 |
|
| PUSHs(e ? sv_mortalcopy(*e) : &PL_sv_undef); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1757 |
|
| } |
| 1758 |
|
| } else if (n) { |
| 1759 |
|
| SV **e = av_fetch(rav, 0, 0); |
| 1760 |
|
| XPUSHs(e ? sv_mortalcopy(*e) : &PL_sv_undef); |
| 1761 |
|
| } else { |
| 1762 |
|
| XPUSHs(&PL_sv_undef); |
| 1763 |
|
| } |
| 1764 |
|
| } |
| 1765 |
|
| } |
| 1766 |
|
| #line 1767 "Hyperman.c" |
| 1767 |
28 |
| PUTBACK; |
| 1768 |
28 |
| return; |
| 1769 |
|
| } |
| 1770 |
|
| } |
| 1771 |
|
| |
| 1772 |
|
| |
| 1773 |
|
| XS_EUPXS(XS_Hyperman__Future_failure); /* prototype to pass -Wmissing-prototypes */ |
| 1774 |
8 |
| XS_EUPXS(XS_Hyperman__Future_failure) |
| 1775 |
|
| { |
| 1776 |
8 |
| dVAR; dXSARGS; |
| 1777 |
8 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
8 |
8 |
|
| 1778 |
0 |
| croak_xs_usage(cv, "self"); |
| 1779 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1780 |
8 |
| SP -= items; |
| 1781 |
|
| { |
| 1782 |
8 |
| SV * self = ST(0) |
| 1783 |
|
| ; |
| 1784 |
|
| #line 283 "./xs/future.xs" |
| 1785 |
|
| { |
| 1786 |
|
| PUTBACK; |
| 1787 |
|
| hmf_await(aTHX_ self); |
| 1788 |
|
| SPAGAIN; |
| 1789 |
|
| if (hmf_state(aTHX_ self) != HMF_FAILED) XSRETURN_EMPTY; |
| 1790 |
|
| { |
| 1791 |
|
| AV *fav = hmf_values_av(aTHX_ self); |
| 1792 |
|
| SSize_t n = fav ? av_len(fav) + 1 : 0; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1793 |
|
| if (GIMME_V == G_ARRAY) { |
| 1794 |
|
| SSize_t i; |
| 1795 |
|
| EXTEND(SP, n); |
| 1796 |
|
| for (i = 0; i < n; i++) { |
| 1797 |
|
| SV **e = av_fetch(fav, i, 0); |
| 1798 |
|
| PUSHs(e ? sv_mortalcopy(*e) : &PL_sv_undef); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1799 |
|
| } |
| 1800 |
|
| } else if (n) { |
| 1801 |
|
| SV **e = av_fetch(fav, 0, 0); |
| 1802 |
|
| XPUSHs(e ? sv_mortalcopy(*e) : &PL_sv_undef); |
| 1803 |
|
| } |
| 1804 |
|
| } |
| 1805 |
|
| } |
| 1806 |
|
| #line 1807 "Hyperman.c" |
| 1807 |
8 |
| PUTBACK; |
| 1808 |
8 |
| return; |
| 1809 |
|
| } |
| 1810 |
|
| } |
| 1811 |
|
| |
| 1812 |
|
| |
| 1813 |
|
| XS_EUPXS(XS_Hyperman__Future__values); /* prototype to pass -Wmissing-prototypes */ |
| 1814 |
17 |
| XS_EUPXS(XS_Hyperman__Future__values) |
| 1815 |
|
| { |
| 1816 |
17 |
| dVAR; dXSARGS; |
| 1817 |
17 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
17 |
17 |
|
| 1818 |
0 |
| croak_xs_usage(cv, "self"); |
| 1819 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 1820 |
17 |
| SP -= items; |
| 1821 |
|
| { |
| 1822 |
17 |
| SV * self = ST(0) |
| 1823 |
|
| ; |
| 1824 |
|
| #line 316 "./xs/future.xs" |
| 1825 |
|
| { |
| 1826 |
|
| AV *rav = hmf_values_av(aTHX_ self); |
| 1827 |
|
| SSize_t i, n = rav ? av_len(rav) + 1 : 0; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1828 |
|
| EXTEND(SP, n); |
| 1829 |
|
| for (i = 0; i < n; i++) { |
| 1830 |
|
| SV **e = av_fetch(rav, i, 0); |
| 1831 |
|
| PUSHs(e ? sv_mortalcopy(*e) : &PL_sv_undef); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1832 |
|
| } |
| 1833 |
|
| } |
| 1834 |
|
| #line 1835 "Hyperman.c" |
| 1835 |
17 |
| PUTBACK; |
| 1836 |
17 |
| return; |
| 1837 |
|
| } |
| 1838 |
|
| } |
| 1839 |
|
| |
| 1840 |
|
| |
| 1841 |
|
| XS_EUPXS(XS_Hyperman__Future_then); /* prototype to pass -Wmissing-prototypes */ |
| 1842 |
50023 |
| XS_EUPXS(XS_Hyperman__Future_then) |
| 1843 |
|
| { |
| 1844 |
50023 |
| dVAR; dXSARGS; |
| 1845 |
50023 |
| dXSI32; |
| 1846 |
50023 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
50023 |
50023 |
|
| 1847 |
0 |
| croak_xs_usage(cv, "self, ..."); |
| 1848 |
|
| { |
| 1849 |
50023 |
▶ | SV * self = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * self = ST(0) |
50022 |
1 |
50023 |
|
| 1850 |
|
| ; |
| 1851 |
|
| SV * RETVAL; |
| 1852 |
|
| #line 334 "./xs/future.xs" |
| 1853 |
|
| { |
| 1854 |
|
| SV *on_done = NULL, *on_fail = NULL; |
| 1855 |
|
| SV *cb; |
| 1856 |
|
| if (ix == 0) { /* then($ok?, $err?) */ |
| 1857 |
|
| if (items > 1 && SvOK(ST(1))) on_done = ST(1); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 1858 |
|
| if (items > 2 && SvOK(ST(2))) on_fail = ST(2); /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 1859 |
|
| } else { /* else($err) */ |
| 1860 |
|
| if (items > 1 && SvOK(ST(1))) on_fail = ST(1); |
| 1861 |
|
| } |
| 1862 |
|
| RETVAL = hmf_new(aTHX_ hmf_class_of(aTHX_ self)); |
| 1863 |
|
| hmf_set_upstream(aTHX_ RETVAL, self); |
| 1864 |
|
| cb = hm_closure(aTHX_ hm_xs_then_cb, RETVAL, on_done, on_fail, NULL, 0, 0); |
| 1865 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1866 |
|
| SvREFCNT_dec(cb); |
| 1867 |
|
| } |
| 1868 |
|
| #line 1869 "Hyperman.c" |
| 1869 |
50023 |
| RETVAL = sv_2mortal(RETVAL); |
| 1870 |
50023 |
| ST(0) = RETVAL; |
| 1871 |
|
| } |
| 1872 |
50023 |
| XSRETURN(1); |
| 1873 |
|
| } |
| 1874 |
|
| |
| 1875 |
|
| |
| 1876 |
|
| XS_EUPXS(XS_Hyperman__Future_followed_by); /* prototype to pass -Wmissing-prototypes */ |
| 1877 |
9 |
| XS_EUPXS(XS_Hyperman__Future_followed_by) |
| 1878 |
|
| { |
| 1879 |
9 |
| dVAR; dXSARGS; |
| 1880 |
9 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
9 |
9 |
|
| 1881 |
0 |
| croak_xs_usage(cv, "self, usercb"); |
| 1882 |
|
| { |
| 1883 |
9 |
| SV * self = ST(0) |
| 1884 |
|
| ; |
| 1885 |
9 |
| SV * usercb = ST(1) |
| 1886 |
|
| ; |
| 1887 |
|
| SV * RETVAL; |
| 1888 |
|
| #line 360 "./xs/future.xs" |
| 1889 |
|
| { |
| 1890 |
|
| SV *cb; |
| 1891 |
|
| RETVAL = hmf_new(aTHX_ hmf_class_of(aTHX_ self)); |
| 1892 |
|
| hmf_set_upstream(aTHX_ RETVAL, self); |
| 1893 |
|
| cb = hm_closure(aTHX_ hm_xs_then_cb, RETVAL, usercb, NULL, NULL, 1, 0); |
| 1894 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1895 |
|
| SvREFCNT_dec(cb); |
| 1896 |
|
| } |
| 1897 |
|
| #line 1898 "Hyperman.c" |
| 1898 |
9 |
| RETVAL = sv_2mortal(RETVAL); |
| 1899 |
9 |
| ST(0) = RETVAL; |
| 1900 |
|
| } |
| 1901 |
9 |
| XSRETURN(1); |
| 1902 |
|
| } |
| 1903 |
|
| |
| 1904 |
|
| |
| 1905 |
|
| XS_EUPXS(XS_Hyperman__Future_transform); /* prototype to pass -Wmissing-prototypes */ |
| 1906 |
9 |
| XS_EUPXS(XS_Hyperman__Future_transform) |
| 1907 |
|
| { |
| 1908 |
9 |
| dVAR; dXSARGS; |
| 1909 |
9 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
9 |
9 |
|
| 1910 |
0 |
| croak_xs_usage(cv, "self, ..."); |
| 1911 |
|
| { |
| 1912 |
9 |
▶ | SV * self = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * self = ST(0) |
1 |
8 |
9 |
|
| 1913 |
|
| ; |
| 1914 |
|
| SV * RETVAL; |
| 1915 |
|
| #line 375 "./xs/future.xs" |
| 1916 |
|
| { |
| 1917 |
|
| SV *xd = NULL, *xf = NULL; |
| 1918 |
|
| SV *cb; |
| 1919 |
|
| int i; |
| 1920 |
|
| if ((items - 1) % 2) |
| 1921 |
|
| croak("transform: odd number of arguments"); |
| 1922 |
|
| for (i = 1; i + 1 < items; i += 2) { |
| 1923 |
|
| const char *key = SvPV_nolen(ST(i)); |
| 1924 |
|
| if (strEQ(key, "done")) xd = ST(i + 1); |
| 1925 |
|
| else if (strEQ(key, "fail")) xf = ST(i + 1); |
| 1926 |
|
| else croak("transform: unknown argument '%s'", key); |
| 1927 |
|
| } |
| 1928 |
|
| RETVAL = hmf_new(aTHX_ hmf_class_of(aTHX_ self)); |
| 1929 |
|
| hmf_set_upstream(aTHX_ RETVAL, self); |
| 1930 |
|
| cb = hm_closure(aTHX_ hm_xs_transform_cb, RETVAL, xd, xf, NULL, 0, 0); |
| 1931 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 1932 |
|
| SvREFCNT_dec(cb); |
| 1933 |
|
| } |
| 1934 |
|
| #line 1935 "Hyperman.c" |
| 1935 |
7 |
| RETVAL = sv_2mortal(RETVAL); |
| 1936 |
7 |
| ST(0) = RETVAL; |
| 1937 |
|
| } |
| 1938 |
7 |
| XSRETURN(1); |
| 1939 |
|
| } |
| 1940 |
|
| |
| 1941 |
|
| |
| 1942 |
|
| XS_EUPXS(XS_Hyperman__Future__set_upstream); /* prototype to pass -Wmissing-prototypes */ |
| 1943 |
1 |
| XS_EUPXS(XS_Hyperman__Future__set_upstream) |
| 1944 |
|
| { |
| 1945 |
1 |
| dVAR; dXSARGS; |
| 1946 |
1 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
1 |
1 |
|
| 1947 |
0 |
| croak_xs_usage(cv, "derived, upstream"); |
| 1948 |
|
| { |
| 1949 |
1 |
| SV * derived = ST(0) |
| 1950 |
|
| ; |
| 1951 |
1 |
| SV * upstream = ST(1) |
| 1952 |
|
| ; |
| 1953 |
|
| #line 402 "./xs/future.xs" |
| 1954 |
|
| hmf_set_upstream(aTHX_ derived, upstream); |
| 1955 |
|
| #line 1956 "Hyperman.c" |
| 1956 |
|
| } |
| 1957 |
1 |
| XSRETURN_EMPTY; |
| 1958 |
|
| } |
| 1959 |
|
| |
| 1960 |
|
| |
| 1961 |
|
| XS_EUPXS(XS_Hyperman__Future_wait_all); /* prototype to pass -Wmissing-prototypes */ |
| 1962 |
17 |
| XS_EUPXS(XS_Hyperman__Future_wait_all) |
| 1963 |
|
| { |
| 1964 |
17 |
| dVAR; dXSARGS; |
| 1965 |
17 |
| dXSI32; |
| 1966 |
17 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
17 |
17 |
|
| 1967 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 1968 |
|
| { |
| 1969 |
17 |
| SV * class = ST(0) |
| 1970 |
|
| ; |
| 1971 |
|
| SV * RETVAL; |
| 1972 |
|
| #line 414 "./xs/future.xs" |
| 1973 |
|
| { |
| 1974 |
|
| static const IV modes[4] = { HM_COMB_WAIT_ALL, HM_COMB_WAIT_ANY, |
| 1975 |
|
| HM_COMB_NEEDS_ALL, HM_COMB_NEEDS_ANY }; |
| 1976 |
|
| RETVAL = hmf_combine(aTHX_ class, &ST(1), items - 1, modes[ix]); |
| 1977 |
|
| } |
| 1978 |
|
| #line 1979 "Hyperman.c" |
| 1979 |
17 |
| RETVAL = sv_2mortal(RETVAL); |
| 1980 |
17 |
| ST(0) = RETVAL; |
| 1981 |
|
| } |
| 1982 |
17 |
| XSRETURN(1); |
| 1983 |
|
| } |
| 1984 |
|
| |
| 1985 |
|
| |
| 1986 |
|
| XS_EUPXS(XS_Hyperman__Future_as_cpan_future); /* prototype to pass -Wmissing-prototypes */ |
| 1987 |
0 |
| XS_EUPXS(XS_Hyperman__Future_as_cpan_future) |
| 1988 |
|
| { |
| 1989 |
0 |
| dVAR; dXSARGS; |
| 1990 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 1991 |
0 |
| croak_xs_usage(cv, "self"); |
| 1992 |
|
| { |
| 1993 |
0 |
| SV * self = ST(0) |
| 1994 |
|
| ; |
| 1995 |
|
| SV * RETVAL; |
| 1996 |
|
| #line 428 "./xs/future.xs" |
| 1997 |
|
| { |
| 1998 |
|
| SV *cf, *cb; |
| 1999 |
|
| dSP; |
| 2000 |
|
| int n; |
| 2001 |
|
| load_module(PERL_LOADMOD_NOIMPORT, newSVpvs("Future"), NULL); |
| 2002 |
|
| ENTER; SAVETMPS; |
| 2003 |
|
| PUSHMARK(SP); |
| 2004 |
|
| XPUSHs(sv_2mortal(newSVpvs("Future"))); |
| 2005 |
|
| PUTBACK; |
| 2006 |
|
| n = call_method("new", G_SCALAR); |
| 2007 |
|
| SPAGAIN; |
| 2008 |
|
| cf = n ? SvREFCNT_inc(POPs) : &PL_sv_undef; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2009 |
|
| PUTBACK; FREETMPS; LEAVE; |
| 2010 |
|
| cb = hm_closure(aTHX_ hm_xs_tocpan_cb, cf, NULL, NULL, NULL, 0, 0); |
| 2011 |
|
| hmf_on_ready(aTHX_ self, cb); |
| 2012 |
|
| SvREFCNT_dec(cb); |
| 2013 |
|
| RETVAL = cf; |
| 2014 |
|
| } |
| 2015 |
|
| #line 2016 "Hyperman.c" |
| 2016 |
0 |
| RETVAL = sv_2mortal(RETVAL); |
| 2017 |
0 |
| ST(0) = RETVAL; |
| 2018 |
|
| } |
| 2019 |
0 |
| XSRETURN(1); |
| 2020 |
|
| } |
| 2021 |
|
| |
| 2022 |
|
| |
| 2023 |
|
| XS_EUPXS(XS_Hyperman__Future_from_future); /* prototype to pass -Wmissing-prototypes */ |
| 2024 |
3 |
| XS_EUPXS(XS_Hyperman__Future_from_future) |
| 2025 |
|
| { |
| 2026 |
3 |
| dVAR; dXSARGS; |
| 2027 |
3 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
3 |
3 |
|
| 2028 |
0 |
| croak_xs_usage(cv, "class, other"); |
| 2029 |
|
| { |
| 2030 |
3 |
| SV * class = ST(0) |
| 2031 |
|
| ; |
| 2032 |
3 |
▶ | SV * other = ST(1) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * other = ST(1) |
0 |
3 |
3 |
|
| 2033 |
|
| ; |
| 2034 |
|
| SV * RETVAL; |
| 2035 |
|
| #line 454 "./xs/future.xs" |
| 2036 |
|
| { |
| 2037 |
|
| const char *name = (SvROK(class) && SvOBJECT(SvRV(class))) ? HvNAME(SvSTASH(SvRV(class))) /* # uncoverable statement class:ignore_covered_err */ |
| 2038 |
|
| : SvPV_nolen(class); |
| 2039 |
|
| SV *cb; |
| 2040 |
|
| RETVAL = hmf_new(aTHX_ name); |
| 2041 |
|
| cb = hm_closure(aTHX_ hm_xs_fromcpan_cb, RETVAL, NULL, NULL, NULL, 0, 0); |
| 2042 |
|
| hm_any_on_ready(aTHX_ other, cb); |
| 2043 |
|
| SvREFCNT_dec(cb); |
| 2044 |
|
| } |
| 2045 |
|
| #line 2046 "Hyperman.c" |
| 2046 |
3 |
| RETVAL = sv_2mortal(RETVAL); |
| 2047 |
3 |
| ST(0) = RETVAL; |
| 2048 |
|
| } |
| 2049 |
3 |
| XSRETURN(1); |
| 2050 |
|
| } |
| 2051 |
|
| |
| 2052 |
|
| |
| 2053 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/future.xs' */ |
| 2054 |
|
| |
| 2055 |
|
| |
| 2056 |
|
| /* INCLUDE: Including 'xs/loop.xs' from 'Hyperman.xs' */ |
| 2057 |
|
| |
| 2058 |
|
| |
| 2059 |
|
| XS_EUPXS(XS_Hyperman__Loop_new); /* prototype to pass -Wmissing-prototypes */ |
| 2060 |
42 |
| XS_EUPXS(XS_Hyperman__Loop_new) |
| 2061 |
|
| { |
| 2062 |
42 |
| dVAR; dXSARGS; |
| 2063 |
42 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
42 |
42 |
|
| 2064 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 2065 |
|
| { |
| 2066 |
42 |
▶ | SV * class = ST(0) |
Branch: 1 branch
| Branch | True | False | Total |
| SV * class = ST(0) |
27 |
15 |
42 |
|
| 2067 |
|
| ; |
| 2068 |
|
| SV * RETVAL; |
| 2069 |
|
| #line 10 "./xs/loop.xs" |
| 2070 |
|
| { |
| 2071 |
|
| const char *bname = (items > 1 && SvOK(ST(1))) ? SvPV_nolen(ST(1)) : NULL; |
| 2072 |
|
| hm_loop *loop; |
| 2073 |
|
| int i; |
| 2074 |
|
| PERL_UNUSED_VAR(class); |
| 2075 |
|
| loop = hm_loop_new(aTHX_ bname); |
| 2076 |
|
| if (!loop) croak("Hyperman::Loop: no usable event backend%s%s", |
| 2077 |
|
| bname ? " named " : "", bname ? bname : ""); |
| 2078 |
|
| /* Key/value options after the backend name, so the loop takes the |
| 2079 |
|
| * same settings the server does rather than only reading the |
| 2080 |
|
| * environment. Odd counts croak instead of silently dropping one. */ |
| 2081 |
|
| if (items > 2) { |
| 2082 |
|
| if ((items - 2) % 2) |
| 2083 |
|
| croak("Hyperman::Loop->new: odd number of options"); |
| 2084 |
|
| for (i = 2; i + 1 < items; i += 2) { |
| 2085 |
|
| const char *key = SvPV_nolen(ST(i)); |
| 2086 |
|
| SV *val = ST(i + 1); |
| 2087 |
|
| if (strEQ(key, "completion")) |
| 2088 |
|
| loop->completion = |
| 2089 |
|
| (SvTRUE(val) && loop->be->submit_recv) ? 1 : 0; |
| 2090 |
|
| else croak("Hyperman::Loop->new: unknown option '%s'", key); |
| 2091 |
|
| } |
| 2092 |
|
| } |
| 2093 |
|
| loop->perl_owned = 1; |
| 2094 |
|
| RETVAL = hm_loop_to_sv(aTHX_ loop); |
| 2095 |
|
| } |
| 2096 |
|
| #line 2097 "Hyperman.c" |
| 2097 |
36 |
| RETVAL = sv_2mortal(RETVAL); |
| 2098 |
36 |
| ST(0) = RETVAL; |
| 2099 |
|
| } |
| 2100 |
36 |
| XSRETURN(1); |
| 2101 |
|
| } |
| 2102 |
|
| |
| 2103 |
|
| |
| 2104 |
|
| XS_EUPXS(XS_Hyperman__Loop_run); /* prototype to pass -Wmissing-prototypes */ |
| 2105 |
17 |
| XS_EUPXS(XS_Hyperman__Loop_run) |
| 2106 |
|
| { |
| 2107 |
17 |
| dVAR; dXSARGS; |
| 2108 |
17 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
17 |
17 |
|
| 2109 |
0 |
| croak_xs_usage(cv, "self"); |
| 2110 |
|
| { |
| 2111 |
17 |
| SV * self = ST(0) |
| 2112 |
|
| ; |
| 2113 |
|
| #line 48 "./xs/loop.xs" |
| 2114 |
|
| hm_loop_run(aTHX_ hm_loop_from_sv(aTHX_ self), NULL); |
| 2115 |
|
| #line 2116 "Hyperman.c" |
| 2116 |
|
| } |
| 2117 |
16 |
| XSRETURN_EMPTY; |
| 2118 |
|
| } |
| 2119 |
|
| |
| 2120 |
|
| |
| 2121 |
|
| XS_EUPXS(XS_Hyperman__Loop_run_until); /* prototype to pass -Wmissing-prototypes */ |
| 2122 |
13 |
| XS_EUPXS(XS_Hyperman__Loop_run_until) |
| 2123 |
|
| { |
| 2124 |
13 |
| dVAR; dXSARGS; |
| 2125 |
13 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
13 |
13 |
|
| 2126 |
0 |
| croak_xs_usage(cv, "self, future"); |
| 2127 |
|
| { |
| 2128 |
13 |
| SV * self = ST(0) |
| 2129 |
|
| ; |
| 2130 |
13 |
| SV * future = ST(1) |
| 2131 |
|
| ; |
| 2132 |
|
| #line 55 "./xs/loop.xs" |
| 2133 |
|
| if (!hmf_is_future(aTHX_ future)) |
| 2134 |
|
| croak("run_until: not a Hyperman::Future"); |
| 2135 |
|
| hm_loop_run(aTHX_ hm_loop_from_sv(aTHX_ self), future); |
| 2136 |
|
| #line 2137 "Hyperman.c" |
| 2137 |
|
| } |
| 2138 |
12 |
| XSRETURN_EMPTY; |
| 2139 |
|
| } |
| 2140 |
|
| |
| 2141 |
|
| |
| 2142 |
|
| XS_EUPXS(XS_Hyperman__Loop_stop); /* prototype to pass -Wmissing-prototypes */ |
| 2143 |
17 |
| XS_EUPXS(XS_Hyperman__Loop_stop) |
| 2144 |
|
| { |
| 2145 |
17 |
| dVAR; dXSARGS; |
| 2146 |
17 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
17 |
17 |
|
| 2147 |
0 |
| croak_xs_usage(cv, "self"); |
| 2148 |
|
| { |
| 2149 |
17 |
| SV * self = ST(0) |
| 2150 |
|
| ; |
| 2151 |
|
| #line 63 "./xs/loop.xs" |
| 2152 |
|
| hm_loop_from_sv(aTHX_ self)->stop = 1; |
| 2153 |
|
| #line 2154 "Hyperman.c" |
| 2154 |
|
| } |
| 2155 |
17 |
| XSRETURN_EMPTY; |
| 2156 |
|
| } |
| 2157 |
|
| |
| 2158 |
|
| |
| 2159 |
|
| XS_EUPXS(XS_Hyperman__Loop_watch_io); /* prototype to pass -Wmissing-prototypes */ |
| 2160 |
4 |
| XS_EUPXS(XS_Hyperman__Loop_watch_io) |
| 2161 |
|
| { |
| 2162 |
4 |
| dVAR; dXSARGS; |
| 2163 |
4 |
▶ | if (items != 4) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 4) |
0 |
4 |
4 |
|
| 2164 |
0 |
| croak_xs_usage(cv, "self, fh, mode, cb"); |
| 2165 |
|
| { |
| 2166 |
4 |
| SV * self = ST(0) |
| 2167 |
|
| ; |
| 2168 |
4 |
| SV * fh = ST(1) |
| 2169 |
|
| ; |
| 2170 |
4 |
| SV * mode = ST(2) |
| 2171 |
|
| ; |
| 2172 |
4 |
| SV * cb = ST(3) |
| 2173 |
|
| ; |
| 2174 |
|
| SV * RETVAL; |
| 2175 |
|
| #line 73 "./xs/loop.xs" |
| 2176 |
|
| { |
| 2177 |
|
| hm_loop *loop = hm_loop_from_sv(aTHX_ self); |
| 2178 |
|
| int fd = hm_fd_of(aTHX_ fh); |
| 2179 |
|
| const char *m = SvOK(mode) ? SvPV_nolen(mode) : "r"; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2180 |
|
| AV *handle = newAV(); |
| 2181 |
|
| hm_add_io_watch(aTHX_ loop, fd, m, cb, 1); |
| 2182 |
|
| av_push(handle, newSViv(fd)); |
| 2183 |
|
| av_push(handle, newSVpv(m, 0)); |
| 2184 |
|
| RETVAL = newRV_noinc((SV *)handle); |
| 2185 |
|
| } |
| 2186 |
|
| #line 2187 "Hyperman.c" |
| 2187 |
4 |
| RETVAL = sv_2mortal(RETVAL); |
| 2188 |
4 |
| ST(0) = RETVAL; |
| 2189 |
|
| } |
| 2190 |
4 |
| XSRETURN(1); |
| 2191 |
|
| } |
| 2192 |
|
| |
| 2193 |
|
| |
| 2194 |
|
| XS_EUPXS(XS_Hyperman__Loop_unwatch_io); /* prototype to pass -Wmissing-prototypes */ |
| 2195 |
6 |
| XS_EUPXS(XS_Hyperman__Loop_unwatch_io) |
| 2196 |
|
| { |
| 2197 |
6 |
| dVAR; dXSARGS; |
| 2198 |
6 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
0 |
6 |
6 |
|
| 2199 |
0 |
| croak_xs_usage(cv, "self, watcher, ..."); |
| 2200 |
|
| { |
| 2201 |
6 |
| SV * self = ST(0) |
| 2202 |
|
| ; |
| 2203 |
6 |
| SV * watcher = ST(1) |
| 2204 |
|
| ; |
| 2205 |
|
| #line 92 "./xs/loop.xs" |
| 2206 |
|
| { |
| 2207 |
|
| hm_loop *loop = hm_loop_from_sv(aTHX_ self); |
| 2208 |
|
| int fd; |
| 2209 |
|
| const char *m = "r"; |
| 2210 |
|
| if (SvROK(watcher) && SvTYPE(SvRV(watcher)) == SVt_PVAV |
| 2211 |
|
| && !SvOBJECT(SvRV(watcher))) { |
| 2212 |
|
| AV *h = (AV *)SvRV(watcher); |
| 2213 |
|
| SV **f = av_fetch(h, 0, 0); |
| 2214 |
|
| SV **mo = av_fetch(h, 1, 0); |
| 2215 |
|
| fd = f ? (int)SvIV(*f) : -1; /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2216 |
|
| if (mo && SvOK(*mo)) m = SvPV_nolen(*mo); |
| 2217 |
|
| } else { |
| 2218 |
|
| fd = hm_fd_of(aTHX_ watcher); |
| 2219 |
|
| if (items > 2 && SvOK(ST(2))) m = SvPV_nolen(ST(2)); |
| 2220 |
|
| } |
| 2221 |
|
| hm_del_io_watch(aTHX_ loop, fd, |
| 2222 |
|
| m[0] == 'w' ? HM_EV_WRITE : HM_EV_READ); /* # uncoverable condition left count:1 class:ignore_covered_err */ |
| 2223 |
|
| } |
| 2224 |
|
| #line 2225 "Hyperman.c" |
| 2225 |
|
| } |
| 2226 |
6 |
| XSRETURN(1); |
| 2227 |
|
| } |
| 2228 |
|
| |
| 2229 |
|
| |
| 2230 |
|
| XS_EUPXS(XS_Hyperman__Loop_timer); /* prototype to pass -Wmissing-prototypes */ |
| 2231 |
33 |
| XS_EUPXS(XS_Hyperman__Loop_timer) |
| 2232 |
|
| { |
| 2233 |
33 |
| dVAR; dXSARGS; |
| 2234 |
33 |
▶ | if (items != 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 3) |
0 |
33 |
33 |
|
| 2235 |
0 |
| croak_xs_usage(cv, "self, secs, cb"); |
| 2236 |
|
| { |
| 2237 |
33 |
| SV * self = ST(0) |
| 2238 |
|
| ; |
| 2239 |
33 |
| double secs = (double)SvNV(ST(1)) |
| 2240 |
|
| ; |
| 2241 |
33 |
| SV * cb = ST(2) |
| 2242 |
|
| ; |
| 2243 |
|
| #line 126 "./xs/loop.xs" |
| 2244 |
|
| hm_add_timer_watch(aTHX_ hm_loop_from_sv(aTHX_ self), secs, cb, HM_TW_CB); |
| 2245 |
|
| #line 2246 "Hyperman.c" |
| 2246 |
|
| } |
| 2247 |
33 |
| XSRETURN_EMPTY; |
| 2248 |
|
| } |
| 2249 |
|
| |
| 2250 |
|
| |
| 2251 |
|
| XS_EUPXS(XS_Hyperman__Loop_timer_f); /* prototype to pass -Wmissing-prototypes */ |
| 2252 |
2022 |
| XS_EUPXS(XS_Hyperman__Loop_timer_f) |
| 2253 |
|
| { |
| 2254 |
2022 |
| dVAR; dXSARGS; |
| 2255 |
2022 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
2022 |
2022 |
|
| 2256 |
0 |
| croak_xs_usage(cv, "self, secs"); |
| 2257 |
|
| { |
| 2258 |
2022 |
| SV * self = ST(0) |
| 2259 |
|
| ; |
| 2260 |
2022 |
| double secs = (double)SvNV(ST(1)) |
| 2261 |
|
| ; |
| 2262 |
|
| SV * RETVAL; |
| 2263 |
|
| #line 135 "./xs/loop.xs" |
| 2264 |
|
| RETVAL = hmf_new(aTHX_ "Hyperman::Future"); |
| 2265 |
|
| hm_add_timer_watch(aTHX_ hm_loop_from_sv(aTHX_ self), secs, RETVAL, |
| 2266 |
|
| HM_TW_FUTURE); |
| 2267 |
|
| #line 2268 "Hyperman.c" |
| 2268 |
2022 |
| RETVAL = sv_2mortal(RETVAL); |
| 2269 |
2022 |
| ST(0) = RETVAL; |
| 2270 |
|
| } |
| 2271 |
2022 |
| XSRETURN(1); |
| 2272 |
|
| } |
| 2273 |
|
| |
| 2274 |
|
| |
| 2275 |
|
| XS_EUPXS(XS_Hyperman__Loop_readable_f); /* prototype to pass -Wmissing-prototypes */ |
| 2276 |
10 |
| XS_EUPXS(XS_Hyperman__Loop_readable_f) |
| 2277 |
|
| { |
| 2278 |
10 |
| dVAR; dXSARGS; |
| 2279 |
10 |
| dXSI32; |
| 2280 |
10 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
10 |
10 |
|
| 2281 |
0 |
| croak_xs_usage(cv, "self, fh"); |
| 2282 |
|
| { |
| 2283 |
10 |
| SV * self = ST(0) |
| 2284 |
|
| ; |
| 2285 |
10 |
| SV * fh = ST(1) |
| 2286 |
|
| ; |
| 2287 |
|
| SV * RETVAL; |
| 2288 |
|
| #line 148 "./xs/loop.xs" |
| 2289 |
|
| RETVAL = hmf_new(aTHX_ "Hyperman::Future"); |
| 2290 |
|
| hm_add_io_watch(aTHX_ hm_loop_from_sv(aTHX_ self), |
| 2291 |
|
| hm_fd_of(aTHX_ fh), ix ? "w" : "r", RETVAL, 0); |
| 2292 |
|
| #line 2293 "Hyperman.c" |
| 2293 |
10 |
| RETVAL = sv_2mortal(RETVAL); |
| 2294 |
10 |
| ST(0) = RETVAL; |
| 2295 |
|
| } |
| 2296 |
10 |
| XSRETURN(1); |
| 2297 |
|
| } |
| 2298 |
|
| |
| 2299 |
|
| |
| 2300 |
|
| XS_EUPXS(XS_Hyperman__Loop_defer); /* prototype to pass -Wmissing-prototypes */ |
| 2301 |
3 |
| XS_EUPXS(XS_Hyperman__Loop_defer) |
| 2302 |
|
| { |
| 2303 |
3 |
| dVAR; dXSARGS; |
| 2304 |
3 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
3 |
3 |
|
| 2305 |
0 |
| croak_xs_usage(cv, "self, cb"); |
| 2306 |
|
| { |
| 2307 |
3 |
| SV * self = ST(0) |
| 2308 |
|
| ; |
| 2309 |
3 |
| SV * cb = ST(1) |
| 2310 |
|
| ; |
| 2311 |
|
| #line 159 "./xs/loop.xs" |
| 2312 |
|
| av_push(hm_loop_from_sv(aTHX_ self)->deferred, newSVsv(cb)); |
| 2313 |
|
| #line 2314 "Hyperman.c" |
| 2314 |
|
| } |
| 2315 |
3 |
| XSRETURN_EMPTY; |
| 2316 |
|
| } |
| 2317 |
|
| |
| 2318 |
|
| |
| 2319 |
|
| XS_EUPXS(XS_Hyperman__Loop_install_await); /* prototype to pass -Wmissing-prototypes */ |
| 2320 |
1 |
| XS_EUPXS(XS_Hyperman__Loop_install_await) |
| 2321 |
|
| { |
| 2322 |
1 |
| dVAR; dXSARGS; |
| 2323 |
1 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
1 |
1 |
|
| 2324 |
0 |
| croak_xs_usage(cv, "self"); |
| 2325 |
|
| { |
| 2326 |
1 |
| SV * self = ST(0) |
| 2327 |
|
| ; |
| 2328 |
|
| SV * RETVAL; |
| 2329 |
|
| #line 167 "./xs/loop.xs" |
| 2330 |
|
| { |
| 2331 |
|
| SV *cb = hm_closure(aTHX_ hm_xs_await_cb, self, NULL, NULL, NULL, 0, 0); |
| 2332 |
|
| SV *aw = get_sv("Hyperman::Future::AWAIT", GV_ADD); |
| 2333 |
|
| sv_setsv(aw, cb); |
| 2334 |
|
| SvREFCNT_dec(cb); |
| 2335 |
|
| RETVAL = SvREFCNT_inc(self); |
| 2336 |
|
| } |
| 2337 |
|
| #line 2338 "Hyperman.c" |
| 2338 |
1 |
| RETVAL = sv_2mortal(RETVAL); |
| 2339 |
1 |
| ST(0) = RETVAL; |
| 2340 |
|
| } |
| 2341 |
1 |
| XSRETURN(1); |
| 2342 |
|
| } |
| 2343 |
|
| |
| 2344 |
|
| |
| 2345 |
|
| XS_EUPXS(XS_Hyperman__Loop_backend); /* prototype to pass -Wmissing-prototypes */ |
| 2346 |
3 |
| XS_EUPXS(XS_Hyperman__Loop_backend) |
| 2347 |
|
| { |
| 2348 |
3 |
| dVAR; dXSARGS; |
| 2349 |
3 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
3 |
3 |
|
| 2350 |
0 |
| croak_xs_usage(cv, "self"); |
| 2351 |
|
| { |
| 2352 |
3 |
| SV * self = ST(0) |
| 2353 |
|
| ; |
| 2354 |
|
| const char * RETVAL; |
| 2355 |
3 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
3 |
0 |
3 |
|
| 2356 |
|
| #line 181 "./xs/loop.xs" |
| 2357 |
|
| RETVAL = hm_loop_from_sv(aTHX_ self)->be->name; |
| 2358 |
|
| #line 2359 "Hyperman.c" |
| 2359 |
3 |
| sv_setpv((SV*)TARG, RETVAL); |
| 2360 |
3 |
| ST(0) = TARG; |
| 2361 |
|
| } |
| 2362 |
3 |
| XSRETURN(1); |
| 2363 |
|
| } |
| 2364 |
|
| |
| 2365 |
|
| |
| 2366 |
|
| XS_EUPXS(XS_Hyperman__Loop_DESTROY); /* prototype to pass -Wmissing-prototypes */ |
| 2367 |
931 |
| XS_EUPXS(XS_Hyperman__Loop_DESTROY) |
| 2368 |
|
| { |
| 2369 |
931 |
| dVAR; dXSARGS; |
| 2370 |
931 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
931 |
931 |
|
| 2371 |
0 |
| croak_xs_usage(cv, "self"); |
| 2372 |
|
| { |
| 2373 |
931 |
| SV * self = ST(0) |
| 2374 |
|
| ; |
| 2375 |
|
| #line 189 "./xs/loop.xs" |
| 2376 |
|
| { |
| 2377 |
|
| hm_loop *loop = hm_loop_from_sv(aTHX_ self); |
| 2378 |
|
| if (loop->perl_owned && !loop->running && loop != hm_cur_loop) |
| 2379 |
|
| hm_loop_free(aTHX_ loop); |
| 2380 |
|
| } |
| 2381 |
|
| #line 2382 "Hyperman.c" |
| 2382 |
|
| } |
| 2383 |
931 |
| XSRETURN_EMPTY; |
| 2384 |
|
| } |
| 2385 |
|
| |
| 2386 |
|
| |
| 2387 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/loop.xs' */ |
| 2388 |
|
| |
| 2389 |
|
| |
| 2390 |
|
| /* INCLUDE: Including 'xs/writer.xs' from 'Hyperman.xs' */ |
| 2391 |
|
| |
| 2392 |
|
| |
| 2393 |
|
| XS_EUPXS(XS_Hyperman__Writer_write); /* prototype to pass -Wmissing-prototypes */ |
| 2394 |
53 |
| XS_EUPXS(XS_Hyperman__Writer_write) |
| 2395 |
|
| { |
| 2396 |
53 |
| dVAR; dXSARGS; |
| 2397 |
53 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
53 |
53 |
|
| 2398 |
0 |
| croak_xs_usage(cv, "self, data"); |
| 2399 |
|
| { |
| 2400 |
53 |
| SV * self = ST(0) |
| 2401 |
|
| ; |
| 2402 |
53 |
| SV * data = ST(1) |
| 2403 |
|
| ; |
| 2404 |
|
| IV RETVAL; |
| 2405 |
53 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
53 |
0 |
53 |
|
| 2406 |
|
| #line 45 "./xs/writer.xs" |
| 2407 |
|
| { |
| 2408 |
|
| AV *w = (AV *)SvRV(self); |
| 2409 |
|
| SSize_t n = av_len(w); |
| 2410 |
|
| RETVAL = -1; |
| 2411 |
|
| if (n == 2) { /* stream-handle form */ |
| 2412 |
|
| SV **h = av_fetch(w, 0, 0); |
| 2413 |
|
| STRLEN l; |
| 2414 |
|
| const char *p = SvPV(data, l); |
| 2415 |
|
| if (h && SvIV(*h)) { /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2416 |
|
| int rc = hm_stream_write_h(aTHX_ INT2PTR(void *, SvIV(*h)), p, l); |
| 2417 |
|
| RETVAL = rc == HM_ABI_STREAM_OK ? 1 |
| 2418 |
|
| : rc == HM_ABI_STREAM_FULL ? 0 : -1; /* # uncoverable condition right count:2 class:ignore_covered_err */ |
| 2419 |
|
| } |
| 2420 |
|
| } else if (n >= 3) { /* h2 or h3: told apart by the tag */ |
| 2421 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2422 |
|
| SV **g = av_fetch(w, 1, 0); |
| 2423 |
|
| SV **s = av_fetch(w, 2, 0); |
| 2424 |
|
| if (f && g && s) { |
| 2425 |
|
| if (hm_writer_tag_is(aTHX_ w, "h1", 2)) |
| 2426 |
|
| RETVAL = hm_stream_write(aTHX_ (int)SvIV(*f), SvUV(*g), SvUV(*s), data); |
| 2427 |
|
| else if (hm_writer_tag_is(aTHX_ w, "h3", 2)) |
| 2428 |
|
| RETVAL = hm_h3_writer_write(aTHX_ (int)SvIV(*f), SvUV(*g), /* # uncoverable statement class:ignore_covered_err */ |
| 2429 |
|
| (int64_t)SvIV(*s), data); /* # uncoverable statement class:ignore_covered_err */ |
| 2430 |
|
| else |
| 2431 |
|
| RETVAL = hm_h2_writer_write(aTHX_ (int)SvIV(*f), SvUV(*g), |
| 2432 |
|
| (int32_t)SvIV(*s), data); |
| 2433 |
|
| } |
| 2434 |
|
| } else { |
| 2435 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2436 |
|
| SV **i = av_fetch(w, 1, 0); |
| 2437 |
|
| if (f && i) |
| 2438 |
|
| RETVAL = hm_stream_write(aTHX_ (int)SvIV(*f), SvUV(*i), 0, data); |
| 2439 |
|
| } |
| 2440 |
|
| } |
| 2441 |
|
| #line 2442 "Hyperman.c" |
| 2442 |
53 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
8 |
45 |
53 |
|
| 2443 |
53 |
| ST(0) = TARG; |
| 2444 |
|
| } |
| 2445 |
53 |
| XSRETURN(1); |
| 2446 |
|
| } |
| 2447 |
|
| |
| 2448 |
|
| |
| 2449 |
|
| XS_EUPXS(XS_Hyperman__Writer_DESTROY); /* prototype to pass -Wmissing-prototypes */ |
| 2450 |
33 |
| XS_EUPXS(XS_Hyperman__Writer_DESTROY) |
| 2451 |
|
| { |
| 2452 |
33 |
| dVAR; dXSARGS; |
| 2453 |
33 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
33 |
33 |
|
| 2454 |
0 |
| croak_xs_usage(cv, "self"); |
| 2455 |
|
| { |
| 2456 |
33 |
| SV * self = ST(0) |
| 2457 |
|
| ; |
| 2458 |
|
| #line 102 "./xs/writer.xs" |
| 2459 |
|
| { |
| 2460 |
|
| AV *w = (AV *)SvRV(self); |
| 2461 |
|
| SSize_t n = av_len(w); |
| 2462 |
|
| if (n == 2) { |
| 2463 |
|
| SV **h = av_fetch(w, 0, 0); |
| 2464 |
|
| if (h && SvIV(*h)) { /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2465 |
|
| hm_stream_close_h(aTHX_ INT2PTR(void *, SvIV(*h))); |
| 2466 |
|
| sv_setiv(*h, 0); |
| 2467 |
|
| } |
| 2468 |
|
| } else if (n == 1) { |
| 2469 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2470 |
|
| SV **i = av_fetch(w, 1, 0); |
| 2471 |
|
| if (f && i && hm_cur_loop) |
| 2472 |
|
| hm_stream_close(aTHX_ (int)SvIV(*f), SvUV(*i), 0); |
| 2473 |
|
| } else if (n >= 3 && hm_writer_tag_is(aTHX_ w, "h1", 2)) { /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2474 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2475 |
|
| SV **g = av_fetch(w, 1, 0); |
| 2476 |
|
| SV **s = av_fetch(w, 2, 0); |
| 2477 |
|
| if (f && g && s && hm_cur_loop) |
| 2478 |
|
| hm_stream_close(aTHX_ (int)SvIV(*f), SvUV(*g), SvUV(*s)); |
| 2479 |
|
| } |
| 2480 |
|
| } |
| 2481 |
|
| #line 2482 "Hyperman.c" |
| 2482 |
|
| } |
| 2483 |
33 |
| XSRETURN_EMPTY; |
| 2484 |
|
| } |
| 2485 |
|
| |
| 2486 |
|
| |
| 2487 |
|
| XS_EUPXS(XS_Hyperman__Writer_close); /* prototype to pass -Wmissing-prototypes */ |
| 2488 |
24 |
| XS_EUPXS(XS_Hyperman__Writer_close) |
| 2489 |
|
| { |
| 2490 |
24 |
| dVAR; dXSARGS; |
| 2491 |
24 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
24 |
24 |
|
| 2492 |
0 |
| croak_xs_usage(cv, "self"); |
| 2493 |
|
| { |
| 2494 |
24 |
| SV * self = ST(0) |
| 2495 |
|
| ; |
| 2496 |
|
| #line 134 "./xs/writer.xs" |
| 2497 |
|
| { |
| 2498 |
|
| AV *w = (AV *)SvRV(self); |
| 2499 |
|
| SSize_t n = av_len(w); |
| 2500 |
|
| if (n == 2) { /* stream-handle form */ |
| 2501 |
|
| SV **h = av_fetch(w, 0, 0); |
| 2502 |
|
| if (h && SvIV(*h)) { |
| 2503 |
|
| hm_stream_close_h(aTHX_ INT2PTR(void *, SvIV(*h))); |
| 2504 |
|
| /* the handle is freed; blank the slot so a second ->close |
| 2505 |
|
| * cannot hand the registry a stale pointer to compare */ |
| 2506 |
|
| sv_setiv(*h, 0); |
| 2507 |
|
| } |
| 2508 |
|
| } else if (n >= 3) { /* h2 or h3: told apart by the tag */ |
| 2509 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2510 |
|
| SV **g = av_fetch(w, 1, 0); |
| 2511 |
|
| SV **s = av_fetch(w, 2, 0); |
| 2512 |
|
| if (f && g && s) { |
| 2513 |
|
| if (hm_writer_tag_is(aTHX_ w, "h1", 2)) |
| 2514 |
|
| hm_stream_close(aTHX_ (int)SvIV(*f), SvUV(*g), SvUV(*s)); |
| 2515 |
|
| else if (hm_writer_tag_is(aTHX_ w, "h3", 2)) |
| 2516 |
|
| hm_h3_writer_close(aTHX_ (int)SvIV(*f), SvUV(*g), /* # uncoverable statement class:ignore_covered_err */ |
| 2517 |
|
| (int64_t)SvIV(*s)); /* # uncoverable statement class:ignore_covered_err */ |
| 2518 |
|
| else |
| 2519 |
|
| hm_h2_writer_close(aTHX_ (int)SvIV(*f), SvUV(*g), |
| 2520 |
|
| (int32_t)SvIV(*s)); |
| 2521 |
|
| } |
| 2522 |
|
| } else { |
| 2523 |
|
| SV **f = av_fetch(w, 0, 0); |
| 2524 |
|
| SV **i = av_fetch(w, 1, 0); |
| 2525 |
|
| if (f && i) |
| 2526 |
|
| hm_stream_close(aTHX_ (int)SvIV(*f), SvUV(*i), 0); |
| 2527 |
|
| } |
| 2528 |
|
| } |
| 2529 |
|
| #line 2530 "Hyperman.c" |
| 2530 |
|
| } |
| 2531 |
24 |
| XSRETURN_EMPTY; |
| 2532 |
|
| } |
| 2533 |
|
| |
| 2534 |
|
| |
| 2535 |
|
| XS_EUPXS(XS_Hyperman__Writer_abort); /* prototype to pass -Wmissing-prototypes */ |
| 2536 |
5 |
| XS_EUPXS(XS_Hyperman__Writer_abort) |
| 2537 |
|
| { |
| 2538 |
5 |
| dVAR; dXSARGS; |
| 2539 |
5 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
5 |
5 |
|
| 2540 |
0 |
| croak_xs_usage(cv, "self"); |
| 2541 |
|
| { |
| 2542 |
5 |
| SV * self = ST(0) |
| 2543 |
|
| ; |
| 2544 |
|
| IV RETVAL; |
| 2545 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 2546 |
|
| #line 187 "./xs/writer.xs" |
| 2547 |
|
| { |
| 2548 |
|
| AV *w = (AV *)SvRV(self); |
| 2549 |
|
| RETVAL = HM_ABI_STREAM_STALE; |
| 2550 |
|
| if (av_len(w) == 2) { |
| 2551 |
|
| SV **h = av_fetch(w, 0, 0); |
| 2552 |
|
| if (h && SvIV(*h)) { /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 2553 |
|
| RETVAL = hm_stream_abort_h(aTHX_ INT2PTR(void *, SvIV(*h))); |
| 2554 |
|
| sv_setiv(*h, 0); /* freed; a later ->close is a no-op */ |
| 2555 |
|
| } |
| 2556 |
|
| } |
| 2557 |
|
| } |
| 2558 |
|
| #line 2559 "Hyperman.c" |
| 2559 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 2560 |
5 |
| ST(0) = TARG; |
| 2561 |
|
| } |
| 2562 |
5 |
| XSRETURN(1); |
| 2563 |
|
| } |
| 2564 |
|
| |
| 2565 |
|
| |
| 2566 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/writer.xs' */ |
| 2567 |
|
| |
| 2568 |
|
| |
| 2569 |
|
| /* INCLUDE: Including 'xs/event.xs' from 'Hyperman.xs' */ |
| 2570 |
|
| |
| 2571 |
|
| |
| 2572 |
|
| XS_EUPXS(XS_Hyperman__Event__Kqueue_available); /* prototype to pass -Wmissing-prototypes */ |
| 2573 |
5 |
| XS_EUPXS(XS_Hyperman__Event__Kqueue_available) |
| 2574 |
|
| { |
| 2575 |
5 |
| dVAR; dXSARGS; |
| 2576 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 2577 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 2578 |
|
| { |
| 2579 |
|
| int RETVAL; |
| 2580 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 2581 |
|
| #line 6 "./xs/event.xs" |
| 2582 |
|
| PERL_UNUSED_VAR(items); |
| 2583 |
|
| RETVAL = hm_backend_kqueue_available(); |
| 2584 |
|
| #line 2585 "Hyperman.c" |
| 2585 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 2586 |
5 |
| ST(0) = TARG; |
| 2587 |
|
| } |
| 2588 |
5 |
| XSRETURN(1); |
| 2589 |
|
| } |
| 2590 |
|
| |
| 2591 |
|
| |
| 2592 |
|
| XS_EUPXS(XS_Hyperman__Event__Epoll_available); /* prototype to pass -Wmissing-prototypes */ |
| 2593 |
5 |
| XS_EUPXS(XS_Hyperman__Event__Epoll_available) |
| 2594 |
|
| { |
| 2595 |
5 |
| dVAR; dXSARGS; |
| 2596 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 2597 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 2598 |
|
| { |
| 2599 |
|
| int RETVAL; |
| 2600 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 2601 |
|
| #line 16 "./xs/event.xs" |
| 2602 |
|
| PERL_UNUSED_VAR(items); |
| 2603 |
|
| RETVAL = hm_backend_epoll_available(); |
| 2604 |
|
| #line 2605 "Hyperman.c" |
| 2605 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 2606 |
5 |
| ST(0) = TARG; |
| 2607 |
|
| } |
| 2608 |
5 |
| XSRETURN(1); |
| 2609 |
|
| } |
| 2610 |
|
| |
| 2611 |
|
| |
| 2612 |
|
| XS_EUPXS(XS_Hyperman__Event__Poll_available); /* prototype to pass -Wmissing-prototypes */ |
| 2613 |
5 |
| XS_EUPXS(XS_Hyperman__Event__Poll_available) |
| 2614 |
|
| { |
| 2615 |
5 |
| dVAR; dXSARGS; |
| 2616 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 2617 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 2618 |
|
| { |
| 2619 |
|
| int RETVAL; |
| 2620 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 2621 |
|
| #line 26 "./xs/event.xs" |
| 2622 |
|
| PERL_UNUSED_VAR(items); |
| 2623 |
|
| RETVAL = hm_backend_poll_available(); |
| 2624 |
|
| #line 2625 "Hyperman.c" |
| 2625 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 2626 |
5 |
| ST(0) = TARG; |
| 2627 |
|
| } |
| 2628 |
5 |
| XSRETURN(1); |
| 2629 |
|
| } |
| 2630 |
|
| |
| 2631 |
|
| |
| 2632 |
|
| XS_EUPXS(XS_Hyperman__Event__IOUring_available); /* prototype to pass -Wmissing-prototypes */ |
| 2633 |
5 |
| XS_EUPXS(XS_Hyperman__Event__IOUring_available) |
| 2634 |
|
| { |
| 2635 |
5 |
| dVAR; dXSARGS; |
| 2636 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 2637 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 2638 |
|
| { |
| 2639 |
|
| int RETVAL; |
| 2640 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 2641 |
|
| #line 36 "./xs/event.xs" |
| 2642 |
|
| PERL_UNUSED_VAR(items); |
| 2643 |
|
| RETVAL = hm_backend_iouring_available(); |
| 2644 |
|
| #line 2645 "Hyperman.c" |
| 2645 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 2646 |
5 |
| ST(0) = TARG; |
| 2647 |
|
| } |
| 2648 |
5 |
| XSRETURN(1); |
| 2649 |
|
| } |
| 2650 |
|
| |
| 2651 |
|
| |
| 2652 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/event.xs' */ |
| 2653 |
|
| |
| 2654 |
|
| |
| 2655 |
|
| /* INCLUDE: Including 'xs/abi.xs' from 'Hyperman.xs' */ |
| 2656 |
|
| |
| 2657 |
|
| |
| 2658 |
|
| XS_EUPXS(XS_Hyperman__abi_ptr); /* prototype to pass -Wmissing-prototypes */ |
| 2659 |
2 |
| XS_EUPXS(XS_Hyperman__abi_ptr) |
| 2660 |
|
| { |
| 2661 |
2 |
| dVAR; dXSARGS; |
| 2662 |
2 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
2 |
2 |
|
| 2663 |
0 |
| croak_xs_usage(cv, ""); |
| 2664 |
|
| { |
| 2665 |
|
| IV RETVAL; |
| 2666 |
2 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
2 |
0 |
2 |
| dXSTARG; |
0 |
2 |
2 |
|
| 2667 |
|
| #line 10 "./xs/abi.xs" |
| 2668 |
|
| RETVAL = PTR2IV(&hm_abi_table); |
| 2669 |
|
| #line 2670 "Hyperman.c" |
| 2670 |
2 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
2 |
2 |
|
| 2671 |
2 |
| ST(0) = TARG; |
| 2672 |
|
| } |
| 2673 |
2 |
| XSRETURN(1); |
| 2674 |
|
| } |
| 2675 |
|
| |
| 2676 |
|
| |
| 2677 |
|
| XS_EUPXS(XS_Hyperman__abi_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 2678 |
1 |
| XS_EUPXS(XS_Hyperman__abi_selftest) |
| 2679 |
|
| { |
| 2680 |
1 |
| dVAR; dXSARGS; |
| 2681 |
1 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
1 |
1 |
|
| 2682 |
0 |
| croak_xs_usage(cv, ""); |
| 2683 |
|
| { |
| 2684 |
|
| IV RETVAL; |
| 2685 |
1 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
1 |
0 |
1 |
|
| 2686 |
|
| #line 20 "./xs/abi.xs" |
| 2687 |
|
| RETVAL = hm_abi_selftest(aTHX); |
| 2688 |
|
| #line 2689 "Hyperman.c" |
| 2689 |
1 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
1 |
1 |
|
| 2690 |
1 |
| ST(0) = TARG; |
| 2691 |
|
| } |
| 2692 |
1 |
| XSRETURN(1); |
| 2693 |
|
| } |
| 2694 |
|
| |
| 2695 |
|
| |
| 2696 |
|
| XS_EUPXS(XS_Hyperman__abi_version); /* prototype to pass -Wmissing-prototypes */ |
| 2697 |
1 |
| XS_EUPXS(XS_Hyperman__abi_version) |
| 2698 |
|
| { |
| 2699 |
1 |
| dVAR; dXSARGS; |
| 2700 |
1 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
1 |
1 |
|
| 2701 |
0 |
| croak_xs_usage(cv, ""); |
| 2702 |
|
| { |
| 2703 |
|
| IV RETVAL; |
| 2704 |
1 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
1 |
0 |
1 |
| dXSTARG; |
0 |
1 |
1 |
|
| 2705 |
|
| #line 29 "./xs/abi.xs" |
| 2706 |
|
| RETVAL = hm_abi_table.abi_version; |
| 2707 |
|
| #line 2708 "Hyperman.c" |
| 2708 |
1 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
1 |
1 |
|
| 2709 |
1 |
| ST(0) = TARG; |
| 2710 |
|
| } |
| 2711 |
1 |
| XSRETURN(1); |
| 2712 |
|
| } |
| 2713 |
|
| |
| 2714 |
|
| |
| 2715 |
|
| XS_EUPXS(XS_Hyperman__abi_worker_hook_install); /* prototype to pass -Wmissing-prototypes */ |
| 2716 |
3 |
| XS_EUPXS(XS_Hyperman__abi_worker_hook_install) |
| 2717 |
|
| { |
| 2718 |
3 |
| dVAR; dXSARGS; |
| 2719 |
3 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
3 |
3 |
|
| 2720 |
0 |
| croak_xs_usage(cv, ""); |
| 2721 |
|
| { |
| 2722 |
|
| IV RETVAL; |
| 2723 |
3 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
3 |
0 |
3 |
|
| 2724 |
|
| #line 39 "./xs/abi.xs" |
| 2725 |
|
| RETVAL = hm_abi_worker_hook_install(aTHX); |
| 2726 |
|
| #line 2727 "Hyperman.c" |
| 2727 |
3 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
3 |
3 |
|
| 2728 |
3 |
| ST(0) = TARG; |
| 2729 |
|
| } |
| 2730 |
3 |
| XSRETURN(1); |
| 2731 |
|
| } |
| 2732 |
|
| |
| 2733 |
|
| |
| 2734 |
|
| XS_EUPXS(XS_Hyperman__abi_worker_hook_state); /* prototype to pass -Wmissing-prototypes */ |
| 2735 |
15 |
| XS_EUPXS(XS_Hyperman__abi_worker_hook_state) |
| 2736 |
|
| { |
| 2737 |
15 |
| dVAR; dXSARGS; |
| 2738 |
15 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
15 |
15 |
|
| 2739 |
0 |
| croak_xs_usage(cv, ""); |
| 2740 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 2741 |
15 |
▶ | SP -= items; |
Branch: 1 branch
| Branch | True | False | Total |
| SP -= items; |
0 |
15 |
15 |
|
| 2742 |
|
| { |
| 2743 |
|
| #line 48 "./xs/abi.xs" |
| 2744 |
|
| EXTEND(SP, 2); |
| 2745 |
|
| mPUSHi(HM_ABI_ST_WORKER_N); |
| 2746 |
|
| mPUSHi(HM_ABI_ST_WORKER_LOOP_OK); |
| 2747 |
|
| #line 2748 "Hyperman.c" |
| 2748 |
15 |
| PUTBACK; |
| 2749 |
15 |
| return; |
| 2750 |
|
| } |
| 2751 |
|
| } |
| 2752 |
|
| |
| 2753 |
|
| |
| 2754 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_open); /* prototype to pass -Wmissing-prototypes */ |
| 2755 |
14 |
| XS_EUPXS(XS_Hyperman__abi_stream_open) |
| 2756 |
|
| { |
| 2757 |
14 |
| dVAR; dXSARGS; |
| 2758 |
14 |
▶ | if (items < 1 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 1 || items > 3) |
14 |
0 |
14 |
| if (items < 1 || items > 3) |
0 |
14 |
14 |
|
| 2759 |
0 |
| croak_xs_usage(cv, "env, status = 200, headers = NULL"); |
| 2760 |
|
| { |
| 2761 |
14 |
| SV * env = ST(0) |
| 2762 |
|
| ; |
| 2763 |
|
| int status; |
| 2764 |
|
| SV * headers; |
| 2765 |
|
| IV RETVAL; |
| 2766 |
14 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
14 |
0 |
14 |
|
| 2767 |
|
| |
| 2768 |
14 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
0 |
14 |
14 |
|
| 2769 |
0 |
| status = 200; |
| 2770 |
|
| else { |
| 2771 |
14 |
| status = (int)SvIV(ST(1)) |
| 2772 |
|
| ; |
| 2773 |
|
| } |
| 2774 |
|
| |
| 2775 |
14 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
14 |
14 |
|
| 2776 |
0 |
| headers = NULL; |
| 2777 |
|
| else { |
| 2778 |
14 |
| headers = ST(2) |
| 2779 |
|
| ; |
| 2780 |
|
| } |
| 2781 |
|
| #line 64 "./xs/abi.xs" |
| 2782 |
|
| if (headers && !SvOK(headers)) headers = NULL; |
| 2783 |
|
| RETVAL = hm_abi_st_stream_open(aTHX_ env, status, headers); |
| 2784 |
|
| #line 2785 "Hyperman.c" |
| 2785 |
14 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
14 |
14 |
|
| 2786 |
14 |
| ST(0) = TARG; |
| 2787 |
|
| } |
| 2788 |
14 |
| XSRETURN(1); |
| 2789 |
|
| } |
| 2790 |
|
| |
| 2791 |
|
| |
| 2792 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_write); /* prototype to pass -Wmissing-prototypes */ |
| 2793 |
18 |
| XS_EUPXS(XS_Hyperman__abi_stream_write) |
| 2794 |
|
| { |
| 2795 |
18 |
| dVAR; dXSARGS; |
| 2796 |
18 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
18 |
18 |
|
| 2797 |
0 |
| croak_xs_usage(cv, "data"); |
| 2798 |
|
| { |
| 2799 |
18 |
| SV * data = ST(0) |
| 2800 |
|
| ; |
| 2801 |
|
| IV RETVAL; |
| 2802 |
18 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
18 |
0 |
18 |
|
| 2803 |
|
| #line 77 "./xs/abi.xs" |
| 2804 |
|
| RETVAL = hm_abi_st_stream_write(aTHX_ data); |
| 2805 |
|
| #line 2806 "Hyperman.c" |
| 2806 |
18 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
4 |
14 |
18 |
|
| 2807 |
18 |
| ST(0) = TARG; |
| 2808 |
|
| } |
| 2809 |
18 |
| XSRETURN(1); |
| 2810 |
|
| } |
| 2811 |
|
| |
| 2812 |
|
| |
| 2813 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_close); /* prototype to pass -Wmissing-prototypes */ |
| 2814 |
12 |
| XS_EUPXS(XS_Hyperman__abi_stream_close) |
| 2815 |
|
| { |
| 2816 |
12 |
| dVAR; dXSARGS; |
| 2817 |
12 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
12 |
12 |
|
| 2818 |
0 |
| croak_xs_usage(cv, ""); |
| 2819 |
|
| { |
| 2820 |
|
| IV RETVAL; |
| 2821 |
12 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
12 |
0 |
12 |
|
| 2822 |
|
| #line 84 "./xs/abi.xs" |
| 2823 |
|
| RETVAL = hm_abi_st_stream_close(aTHX); |
| 2824 |
|
| #line 2825 "Hyperman.c" |
| 2825 |
12 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
5 |
7 |
12 |
|
| 2826 |
12 |
| ST(0) = TARG; |
| 2827 |
|
| } |
| 2828 |
12 |
| XSRETURN(1); |
| 2829 |
|
| } |
| 2830 |
|
| |
| 2831 |
|
| |
| 2832 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_abort); /* prototype to pass -Wmissing-prototypes */ |
| 2833 |
1 |
| XS_EUPXS(XS_Hyperman__abi_stream_abort) |
| 2834 |
|
| { |
| 2835 |
1 |
| dVAR; dXSARGS; |
| 2836 |
1 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
1 |
1 |
|
| 2837 |
0 |
| croak_xs_usage(cv, ""); |
| 2838 |
|
| { |
| 2839 |
|
| IV RETVAL; |
| 2840 |
1 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
1 |
0 |
1 |
|
| 2841 |
|
| #line 94 "./xs/abi.xs" |
| 2842 |
|
| RETVAL = hm_abi_st_stream_do_abort(aTHX); |
| 2843 |
|
| #line 2844 "Hyperman.c" |
| 2844 |
1 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
1 |
1 |
|
| 2845 |
1 |
| ST(0) = TARG; |
| 2846 |
|
| } |
| 2847 |
1 |
| XSRETURN(1); |
| 2848 |
|
| } |
| 2849 |
|
| |
| 2850 |
|
| |
| 2851 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_read); /* prototype to pass -Wmissing-prototypes */ |
| 2852 |
9 |
| XS_EUPXS(XS_Hyperman__abi_stream_read) |
| 2853 |
|
| { |
| 2854 |
9 |
| dVAR; dXSARGS; |
| 2855 |
9 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
9 |
9 |
|
| 2856 |
0 |
| croak_xs_usage(cv, ""); |
| 2857 |
|
| { |
| 2858 |
|
| IV RETVAL; |
| 2859 |
9 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
9 |
0 |
9 |
|
| 2860 |
|
| #line 103 "./xs/abi.xs" |
| 2861 |
|
| RETVAL = hm_abi_st_stream_read(aTHX); |
| 2862 |
|
| #line 2863 "Hyperman.c" |
| 2863 |
9 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
9 |
9 |
|
| 2864 |
9 |
| ST(0) = TARG; |
| 2865 |
|
| } |
| 2866 |
9 |
| XSRETURN(1); |
| 2867 |
|
| } |
| 2868 |
|
| |
| 2869 |
|
| |
| 2870 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_rx); /* prototype to pass -Wmissing-prototypes */ |
| 2871 |
9 |
| XS_EUPXS(XS_Hyperman__abi_stream_rx) |
| 2872 |
|
| { |
| 2873 |
9 |
| dVAR; dXSARGS; |
| 2874 |
9 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
9 |
9 |
|
| 2875 |
0 |
| croak_xs_usage(cv, ""); |
| 2876 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 2877 |
9 |
▶ | SP -= items; |
Branch: 1 branch
| Branch | True | False | Total |
| SP -= items; |
0 |
9 |
9 |
|
| 2878 |
|
| { |
| 2879 |
|
| #line 111 "./xs/abi.xs" |
| 2880 |
|
| EXTEND(SP, 3); |
| 2881 |
|
| mPUSHi(HM_ABI_ST_SH_RXN); |
| 2882 |
|
| mPUSHi(HM_ABI_ST_SH_RXLEN); |
| 2883 |
|
| mPUSHp(HM_ABI_ST_SH_RX, (STRLEN)HM_ABI_ST_SH_RXLEN); |
| 2884 |
|
| #line 2885 "Hyperman.c" |
| 2885 |
9 |
| PUTBACK; |
| 2886 |
9 |
| return; |
| 2887 |
|
| } |
| 2888 |
|
| } |
| 2889 |
|
| |
| 2890 |
|
| |
| 2891 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_produce); /* prototype to pass -Wmissing-prototypes */ |
| 2892 |
1 |
| XS_EUPXS(XS_Hyperman__abi_stream_produce) |
| 2893 |
|
| { |
| 2894 |
1 |
| dVAR; dXSARGS; |
| 2895 |
1 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
1 |
1 |
|
| 2896 |
0 |
| croak_xs_usage(cv, "n"); |
| 2897 |
|
| { |
| 2898 |
1 |
| IV n = (IV)SvIV(ST(0)) |
| 2899 |
|
| ; |
| 2900 |
|
| #line 124 "./xs/abi.xs" |
| 2901 |
|
| hm_abi_st_stream_produce(aTHX_ n); |
| 2902 |
|
| #line 2903 "Hyperman.c" |
| 2903 |
|
| } |
| 2904 |
1 |
| XSRETURN_EMPTY; |
| 2905 |
|
| } |
| 2906 |
|
| |
| 2907 |
|
| |
| 2908 |
|
| XS_EUPXS(XS_Hyperman__abi_stream_state); /* prototype to pass -Wmissing-prototypes */ |
| 2909 |
7 |
| XS_EUPXS(XS_Hyperman__abi_stream_state) |
| 2910 |
|
| { |
| 2911 |
7 |
| dVAR; dXSARGS; |
| 2912 |
7 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
7 |
7 |
|
| 2913 |
0 |
| croak_xs_usage(cv, ""); |
| 2914 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 2915 |
7 |
▶ | SP -= items; |
Branch: 1 branch
| Branch | True | False | Total |
| SP -= items; |
0 |
7 |
7 |
|
| 2916 |
|
| { |
| 2917 |
|
| #line 132 "./xs/abi.xs" |
| 2918 |
|
| EXTEND(SP, 5); |
| 2919 |
|
| mPUSHi(HM_ABI_ST_SH ? 1 : 0); |
| 2920 |
|
| mPUSHi(HM_ABI_ST_SH_ABORTS); |
| 2921 |
|
| mPUSHi(HM_ABI_ST_SH_DRAINS); |
| 2922 |
|
| mPUSHi(HM_ABI_ST_SH_WRITES); |
| 2923 |
|
| mPUSHi(HM_ABI_ST_SH_FULLS); |
| 2924 |
|
| #line 2925 "Hyperman.c" |
| 2925 |
7 |
| PUTBACK; |
| 2926 |
7 |
| return; |
| 2927 |
|
| } |
| 2928 |
|
| } |
| 2929 |
|
| |
| 2930 |
|
| |
| 2931 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/abi.xs' */ |
| 2932 |
|
| |
| 2933 |
|
| |
| 2934 |
|
| /* INCLUDE: Including 'xs/bus.xs' from 'Hyperman.xs' */ |
| 2935 |
|
| |
| 2936 |
|
| |
| 2937 |
|
| XS_EUPXS(XS_Hyperman_bus_init); /* prototype to pass -Wmissing-prototypes */ |
| 2938 |
4 |
| XS_EUPXS(XS_Hyperman_bus_init) |
| 2939 |
|
| { |
| 2940 |
4 |
| dVAR; dXSARGS; |
| 2941 |
4 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
4 |
4 |
|
| 2942 |
0 |
| croak_xs_usage(cv, "class, ..."); |
| 2943 |
|
| { |
| 2944 |
4 |
| SV * class = ST(0) |
| 2945 |
|
| ; |
| 2946 |
|
| IV RETVAL; |
| 2947 |
4 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
4 |
0 |
4 |
|
| 2948 |
|
| #line 32 "./xs/bus.xs" |
| 2949 |
|
| { |
| 2950 |
|
| UV slots = 0, slot_size = 0, groups = 0, wakers = 0; |
| 2951 |
|
| int i, err = 0; |
| 2952 |
|
| PERL_UNUSED_VAR(class); |
| 2953 |
|
| for (i = 1; i + 1 < items; i += 2) { |
| 2954 |
|
| const char *k = SvPV_nolen(ST(i)); |
| 2955 |
|
| if (strEQ(k, "slots")) slots = SvUV(ST(i + 1)); |
| 2956 |
|
| else if (strEQ(k, "slot_size")) slot_size = SvUV(ST(i + 1)); |
| 2957 |
|
| else if (strEQ(k, "groups")) groups = SvUV(ST(i + 1)); |
| 2958 |
|
| else if (strEQ(k, "wakers")) wakers = SvUV(ST(i + 1)); |
| 2959 |
|
| } |
| 2960 |
|
| PERL_UNUSED_VAR(groups); |
| 2961 |
|
| hm_sa_open(aTHX_ NULL, 0, |
| 2962 |
|
| hm_sa_bytes(0, 0, (unsigned)slots, (unsigned)slot_size)); |
| 2963 |
|
| (void)hm_sa_bus_open((uint32_t)slots, (uint32_t)slot_size, &err); |
| 2964 |
|
| /* The wakeup descriptors go with the ring and for the same reason: |
| 2965 |
|
| * made before any fork, or a worker's poke reaches nobody. run() |
| 2966 |
|
| * sizes this from the worker count. */ |
| 2967 |
|
| (void)hm_sa_bus_wake_init((uint32_t)(wakers ? wakers : 8)); |
| 2968 |
|
| RETVAL = hm_sa_bus_live() ? 1 : 0; /* # uncoverable condition left count:1 class:ignore_covered_err */ |
| 2969 |
|
| } |
| 2970 |
|
| #line 2971 "Hyperman.c" |
| 2971 |
4 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
4 |
4 |
|
| 2972 |
4 |
| ST(0) = TARG; |
| 2973 |
|
| } |
| 2974 |
4 |
| XSRETURN(1); |
| 2975 |
|
| } |
| 2976 |
|
| |
| 2977 |
|
| |
| 2978 |
|
| XS_EUPXS(XS_Hyperman_bus_live); /* prototype to pass -Wmissing-prototypes */ |
| 2979 |
1 |
| XS_EUPXS(XS_Hyperman_bus_live) |
| 2980 |
|
| { |
| 2981 |
1 |
| dVAR; dXSARGS; |
| 2982 |
1 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
1 |
0 |
1 |
| if (items < 0 || items > 1) |
0 |
1 |
1 |
|
| 2983 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 2984 |
|
| { |
| 2985 |
|
| SV * class; |
| 2986 |
|
| IV RETVAL; |
| 2987 |
1 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
1 |
0 |
1 |
|
| 2988 |
|
| |
| 2989 |
1 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
1 |
1 |
|
| 2990 |
0 |
| class = &PL_sv_undef; |
| 2991 |
|
| else { |
| 2992 |
1 |
| class = ST(0) |
| 2993 |
|
| ; |
| 2994 |
|
| } |
| 2995 |
|
| #line 68 "./xs/bus.xs" |
| 2996 |
|
| PERL_UNUSED_VAR(class); |
| 2997 |
|
| RETVAL = hm_sa_bus_live() ? 1 : 0; /* # uncoverable condition left count:1 class:ignore_covered_err */ |
| 2998 |
|
| #line 2999 "Hyperman.c" |
| 2999 |
1 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
1 |
1 |
|
| 3000 |
1 |
| ST(0) = TARG; |
| 3001 |
|
| } |
| 3002 |
1 |
| XSRETURN(1); |
| 3003 |
|
| } |
| 3004 |
|
| |
| 3005 |
|
| |
| 3006 |
|
| XS_EUPXS(XS_Hyperman_publish); /* prototype to pass -Wmissing-prototypes */ |
| 3007 |
21503 |
| XS_EUPXS(XS_Hyperman_publish) |
| 3008 |
|
| { |
| 3009 |
21503 |
| dVAR; dXSARGS; |
| 3010 |
21503 |
▶ | if (items != 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 3) |
0 |
21503 |
21503 |
|
| 3011 |
0 |
| croak_xs_usage(cv, "class, topic, payload"); |
| 3012 |
|
| { |
| 3013 |
21503 |
| SV * class = ST(0) |
| 3014 |
|
| ; |
| 3015 |
21503 |
| SV * topic = ST(1) |
| 3016 |
|
| ; |
| 3017 |
21503 |
| SV * payload = ST(2) |
| 3018 |
|
| ; |
| 3019 |
|
| IV RETVAL; |
| 3020 |
21503 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
21503 |
0 |
21503 |
|
| 3021 |
|
| #line 93 "./xs/bus.xs" |
| 3022 |
|
| { |
| 3023 |
|
| STRLEN tl, pl; |
| 3024 |
|
| const char *t = SvPV_const(topic, tl); |
| 3025 |
|
| const char *p = SvPV_const(payload, pl); |
| 3026 |
|
| int r = hm_sa_bus_publish(t, (uint32_t)tl, p, (uint32_t)pl); |
| 3027 |
|
| PERL_UNUSED_VAR(class); |
| 3028 |
|
| RETVAL = (r == HM_BUS_OK) ? 1 : (r == HM_BUS_LOCAL) ? 0 : -1; /* # uncoverable condition left count:2 class:ignore_covered_err */ |
| 3029 |
|
| } |
| 3030 |
|
| #line 3031 "Hyperman.c" |
| 3031 |
21503 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
21474 |
29 |
21503 |
|
| 3032 |
21503 |
| ST(0) = TARG; |
| 3033 |
|
| } |
| 3034 |
21503 |
| XSRETURN(1); |
| 3035 |
|
| } |
| 3036 |
|
| |
| 3037 |
|
| |
| 3038 |
|
| XS_EUPXS(XS_Hyperman_bus_reset); /* prototype to pass -Wmissing-prototypes */ |
| 3039 |
5 |
| XS_EUPXS(XS_Hyperman_bus_reset) |
| 3040 |
|
| { |
| 3041 |
5 |
| dVAR; dXSARGS; |
| 3042 |
5 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
5 |
0 |
5 |
| if (items < 0 || items > 1) |
0 |
5 |
5 |
|
| 3043 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 3044 |
|
| { |
| 3045 |
|
| SV * class; |
| 3046 |
|
| IV RETVAL; |
| 3047 |
5 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
5 |
0 |
5 |
|
| 3048 |
|
| |
| 3049 |
5 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
5 |
5 |
|
| 3050 |
0 |
| class = &PL_sv_undef; |
| 3051 |
|
| else { |
| 3052 |
5 |
| class = ST(0) |
| 3053 |
|
| ; |
| 3054 |
|
| } |
| 3055 |
|
| #line 119 "./xs/bus.xs" |
| 3056 |
|
| PERL_UNUSED_VAR(class); |
| 3057 |
|
| hm_sa_bus_reset_cursors(); |
| 3058 |
|
| RETVAL = (IV)hm_sa_bus_seq(); |
| 3059 |
|
| #line 3060 "Hyperman.c" |
| 3060 |
5 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
5 |
5 |
|
| 3061 |
5 |
| ST(0) = TARG; |
| 3062 |
|
| } |
| 3063 |
5 |
| XSRETURN(1); |
| 3064 |
|
| } |
| 3065 |
|
| |
| 3066 |
|
| |
| 3067 |
|
| XS_EUPXS(XS_Hyperman_receive); /* prototype to pass -Wmissing-prototypes */ |
| 3068 |
6 |
| XS_EUPXS(XS_Hyperman_receive) |
| 3069 |
|
| { |
| 3070 |
6 |
| dVAR; dXSARGS; |
| 3071 |
6 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
6 |
0 |
6 |
| if (items < 0 || items > 1) |
0 |
6 |
6 |
|
| 3072 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 3073 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 3074 |
6 |
| SP -= items; |
| 3075 |
|
| { |
| 3076 |
|
| SV * class; |
| 3077 |
|
| |
| 3078 |
6 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
6 |
6 |
|
| 3079 |
0 |
| class = &PL_sv_undef; |
| 3080 |
|
| else { |
| 3081 |
6 |
| class = ST(0) |
| 3082 |
|
| ; |
| 3083 |
|
| } |
| 3084 |
|
| #line 136 "./xs/bus.xs" |
| 3085 |
|
| { |
| 3086 |
|
| AV *out = (AV *)sv_2mortal((SV *)newAV()); |
| 3087 |
|
| SSize_t i, n; |
| 3088 |
|
| PERL_UNUSED_VAR(class); |
| 3089 |
|
| (void)hm_sa_bus_drain(&hm_sa_recv_cur, hm_bus_perl_collect, out); |
| 3090 |
|
| n = av_len(out) + 1; |
| 3091 |
|
| EXTEND(SP, n); |
| 3092 |
|
| for (i = 0; i < n; i++) { |
| 3093 |
|
| SV **e = av_fetch(out, i, 0); |
| 3094 |
|
| PUSHs(e && *e ? sv_2mortal(newSVsv(*e)) : &PL_sv_undef); |
| 3095 |
|
| } |
| 3096 |
|
| } |
| 3097 |
|
| #line 3098 "Hyperman.c" |
| 3098 |
6 |
| PUTBACK; |
| 3099 |
6 |
| return; |
| 3100 |
|
| } |
| 3101 |
|
| } |
| 3102 |
|
| |
| 3103 |
|
| |
| 3104 |
|
| XS_EUPXS(XS_Hyperman_bus_gaps); /* prototype to pass -Wmissing-prototypes */ |
| 3105 |
3 |
| XS_EUPXS(XS_Hyperman_bus_gaps) |
| 3106 |
|
| { |
| 3107 |
3 |
| dVAR; dXSARGS; |
| 3108 |
3 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
3 |
0 |
3 |
| if (items < 0 || items > 1) |
0 |
3 |
3 |
|
| 3109 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 3110 |
|
| { |
| 3111 |
|
| SV * class; |
| 3112 |
|
| IV RETVAL; |
| 3113 |
3 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
3 |
0 |
3 |
|
| 3114 |
|
| |
| 3115 |
3 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
3 |
3 |
|
| 3116 |
0 |
| class = &PL_sv_undef; |
| 3117 |
|
| else { |
| 3118 |
3 |
| class = ST(0) |
| 3119 |
|
| ; |
| 3120 |
|
| } |
| 3121 |
|
| #line 169 "./xs/bus.xs" |
| 3122 |
|
| PERL_UNUSED_VAR(class); |
| 3123 |
|
| RETVAL = (IV)(hm_sa_bus_gaps_of(hm_sa_recv_cur) |
| 3124 |
|
| + hm_sa_bus_gaps_of(hm_sa_disp_cur)); |
| 3125 |
|
| #line 3126 "Hyperman.c" |
| 3126 |
3 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
3 |
3 |
|
| 3127 |
3 |
| ST(0) = TARG; |
| 3128 |
|
| } |
| 3129 |
3 |
| XSRETURN(1); |
| 3130 |
|
| } |
| 3131 |
|
| |
| 3132 |
|
| |
| 3133 |
|
| XS_EUPXS(XS_Hyperman_claim); /* prototype to pass -Wmissing-prototypes */ |
| 3134 |
7 |
| XS_EUPXS(XS_Hyperman_claim) |
| 3135 |
|
| { |
| 3136 |
7 |
| dVAR; dXSARGS; |
| 3137 |
7 |
▶ | if (items < 2 || items > 3) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 2 || items > 3) |
7 |
0 |
7 |
| if (items < 2 || items > 3) |
0 |
7 |
7 |
|
| 3138 |
0 |
| croak_xs_usage(cv, "class, topic, group = &PL_sv_undef"); |
| 3139 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 3140 |
7 |
| SP -= items; |
| 3141 |
|
| { |
| 3142 |
7 |
| SV * class = ST(0) |
| 3143 |
|
| ; |
| 3144 |
7 |
| SV * topic = ST(1) |
| 3145 |
|
| ; |
| 3146 |
|
| SV * group; |
| 3147 |
|
| |
| 3148 |
7 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
7 |
7 |
|
| 3149 |
0 |
| group = &PL_sv_undef; |
| 3150 |
|
| else { |
| 3151 |
7 |
| group = ST(2) |
| 3152 |
|
| ; |
| 3153 |
|
| } |
| 3154 |
|
| #line 202 "./xs/bus.xs" |
| 3155 |
|
| { |
| 3156 |
|
| AV *out = (AV *)sv_2mortal((SV *)newAV()); |
| 3157 |
|
| STRLEN tl, gl; |
| 3158 |
|
| const char *t = SvPV_const(topic, tl); |
| 3159 |
|
| const char *g = SvOK(group) ? SvPV_const(group, gl) : (gl = tl, t); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 3160 |
|
| sa_group_h *gh = hm_sa_bus_group(t, (uint32_t)tl, g, (uint32_t)gl); |
| 3161 |
|
| SSize_t i, n; |
| 3162 |
|
| PERL_UNUSED_VAR(class); |
| 3163 |
|
| if (!gh) XSRETURN_EMPTY; /* no ring, or the table is full */ |
| 3164 |
|
| (void)hm_sa_bus_claim(gh, hm_bus_perl_collect, out); |
| 3165 |
|
| n = av_len(out) + 1; |
| 3166 |
|
| EXTEND(SP, n); |
| 3167 |
|
| for (i = 0; i < n; i++) { |
| 3168 |
|
| SV **e = av_fetch(out, i, 0); |
| 3169 |
|
| PUSHs(e && *e ? sv_2mortal(newSVsv(*e)) : &PL_sv_undef); |
| 3170 |
|
| } |
| 3171 |
|
| } |
| 3172 |
|
| #line 3173 "Hyperman.c" |
| 3173 |
7 |
| PUTBACK; |
| 3174 |
7 |
| return; |
| 3175 |
|
| } |
| 3176 |
|
| } |
| 3177 |
|
| |
| 3178 |
|
| |
| 3179 |
|
| XS_EUPXS(XS_Hyperman_subscribe); /* prototype to pass -Wmissing-prototypes */ |
| 3180 |
10 |
| XS_EUPXS(XS_Hyperman_subscribe) |
| 3181 |
|
| { |
| 3182 |
10 |
| dVAR; dXSARGS; |
| 3183 |
10 |
▶ | if (items < 3) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 3) |
0 |
10 |
10 |
|
| 3184 |
0 |
| croak_xs_usage(cv, "class, topic, cb, ..."); |
| 3185 |
|
| { |
| 3186 |
10 |
| SV * class = ST(0) |
| 3187 |
|
| ; |
| 3188 |
10 |
| SV * topic = ST(1) |
| 3189 |
|
| ; |
| 3190 |
10 |
| SV * cb = ST(2) |
| 3191 |
|
| ; |
| 3192 |
|
| IV RETVAL; |
| 3193 |
10 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
10 |
0 |
10 |
|
| 3194 |
|
| #line 245 "./xs/bus.xs" |
| 3195 |
|
| { |
| 3196 |
|
| STRLEN tl, gl = 0; |
| 3197 |
|
| const char *t = SvPV_const(topic, tl); |
| 3198 |
|
| const char *g = NULL; |
| 3199 |
|
| int i, id; |
| 3200 |
|
| PERL_UNUSED_VAR(class); |
| 3201 |
|
| if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) /* # uncoverable condition left count:2 class:ignore_covered_err */ |
| 3202 |
|
| croak("Hyperman->subscribe: need a code reference"); |
| 3203 |
|
| for (i = 3; i + 1 < items; i += 2) { |
| 3204 |
|
| const char *k = SvPV_nolen(ST(i)); |
| 3205 |
|
| if (strEQ(k, "group") && SvOK(ST(i + 1))) |
| 3206 |
|
| g = SvPV_const(ST(i + 1), gl); |
| 3207 |
|
| } |
| 3208 |
|
| id = hm_sa_bus_subscribe(t, (uint32_t)tl, g, (uint32_t)gl, |
| 3209 |
|
| hm_bus_perl_deliver, NULL); |
| 3210 |
|
| if (id < 0) XSRETURN_IV(-1); |
| 3211 |
|
| if (hm_bus_perl_subs[id]) SvREFCNT_dec(hm_bus_perl_subs[id]); |
| 3212 |
|
| hm_bus_perl_subs[id] = newSVsv(cb); |
| 3213 |
|
| hm_bus_subs[id].ud = (void *)hm_bus_perl_subs[id]; |
| 3214 |
|
| RETVAL = id; |
| 3215 |
|
| } |
| 3216 |
|
| #line 3217 "Hyperman.c" |
| 3217 |
9 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
9 |
9 |
|
| 3218 |
9 |
| ST(0) = TARG; |
| 3219 |
|
| } |
| 3220 |
9 |
| XSRETURN(1); |
| 3221 |
|
| } |
| 3222 |
|
| |
| 3223 |
|
| |
| 3224 |
|
| XS_EUPXS(XS_Hyperman_unsubscribe); /* prototype to pass -Wmissing-prototypes */ |
| 3225 |
6 |
| XS_EUPXS(XS_Hyperman_unsubscribe) |
| 3226 |
|
| { |
| 3227 |
6 |
| dVAR; dXSARGS; |
| 3228 |
6 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
6 |
6 |
|
| 3229 |
0 |
| croak_xs_usage(cv, "class, id"); |
| 3230 |
|
| { |
| 3231 |
6 |
| SV * class = ST(0) |
| 3232 |
|
| ; |
| 3233 |
6 |
| IV id = (IV)SvIV(ST(1)) |
| 3234 |
|
| ; |
| 3235 |
|
| IV RETVAL; |
| 3236 |
6 |
▶ | dXSTARG; |
Branch: 2 branches
| Branch | True | False | Total |
| dXSTARG; |
6 |
0 |
6 |
| dXSTARG; |
6 |
0 |
6 |
|
| 3237 |
|
| #line 282 "./xs/bus.xs" |
| 3238 |
|
| { |
| 3239 |
|
| PERL_UNUSED_VAR(class); |
| 3240 |
|
| if (id >= 0 && id < HM_BUS_SUBS && hm_bus_perl_subs[id]) { |
| 3241 |
|
| SvREFCNT_dec(hm_bus_perl_subs[id]); |
| 3242 |
|
| hm_bus_perl_subs[id] = NULL; |
| 3243 |
|
| } |
| 3244 |
|
| RETVAL = hm_sa_bus_unsubscribe((int)id); |
| 3245 |
|
| } |
| 3246 |
|
| #line 3247 "Hyperman.c" |
| 3247 |
6 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
2 |
4 |
6 |
|
| 3248 |
6 |
| ST(0) = TARG; |
| 3249 |
|
| } |
| 3250 |
6 |
| XSRETURN(1); |
| 3251 |
|
| } |
| 3252 |
|
| |
| 3253 |
|
| |
| 3254 |
|
| XS_EUPXS(XS_Hyperman_dispatch); /* prototype to pass -Wmissing-prototypes */ |
| 3255 |
6 |
| XS_EUPXS(XS_Hyperman_dispatch) |
| 3256 |
|
| { |
| 3257 |
6 |
| dVAR; dXSARGS; |
| 3258 |
6 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
6 |
0 |
6 |
| if (items < 0 || items > 1) |
0 |
6 |
6 |
|
| 3259 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 3260 |
|
| { |
| 3261 |
|
| SV * class; |
| 3262 |
|
| IV RETVAL; |
| 3263 |
6 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
6 |
0 |
6 |
|
| 3264 |
|
| |
| 3265 |
6 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
6 |
6 |
|
| 3266 |
0 |
| class = &PL_sv_undef; |
| 3267 |
|
| else { |
| 3268 |
6 |
| class = ST(0) |
| 3269 |
|
| ; |
| 3270 |
|
| } |
| 3271 |
|
| #line 307 "./xs/bus.xs" |
| 3272 |
|
| PERL_UNUSED_VAR(class); |
| 3273 |
|
| RETVAL = (IV)hm_sa_bus_dispatch(); |
| 3274 |
|
| #line 3275 "Hyperman.c" |
| 3275 |
6 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
6 |
6 |
|
| 3276 |
6 |
| ST(0) = TARG; |
| 3277 |
|
| } |
| 3278 |
6 |
| XSRETURN(1); |
| 3279 |
|
| } |
| 3280 |
|
| |
| 3281 |
|
| |
| 3282 |
|
| XS_EUPXS(XS_Hyperman_bus_waker_take); /* prototype to pass -Wmissing-prototypes */ |
| 3283 |
1 |
| XS_EUPXS(XS_Hyperman_bus_waker_take) |
| 3284 |
|
| { |
| 3285 |
1 |
| dVAR; dXSARGS; |
| 3286 |
1 |
▶ | if (items != 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 2) |
0 |
1 |
1 |
|
| 3287 |
0 |
| croak_xs_usage(cv, "class, idx"); |
| 3288 |
|
| { |
| 3289 |
1 |
| SV * class = ST(0) |
| 3290 |
|
| ; |
| 3291 |
1 |
| IV idx = (IV)SvIV(ST(1)) |
| 3292 |
|
| ; |
| 3293 |
|
| IV RETVAL; |
| 3294 |
1 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
1 |
0 |
1 |
|
| 3295 |
|
| #line 323 "./xs/bus.xs" |
| 3296 |
|
| PERL_UNUSED_VAR(class); |
| 3297 |
|
| RETVAL = hm_sa_bus_waker_take((int)idx); |
| 3298 |
|
| #line 3299 "Hyperman.c" |
| 3299 |
1 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
1 |
1 |
|
| 3300 |
1 |
| ST(0) = TARG; |
| 3301 |
|
| } |
| 3302 |
1 |
| XSRETURN(1); |
| 3303 |
|
| } |
| 3304 |
|
| |
| 3305 |
|
| |
| 3306 |
|
| XS_EUPXS(XS_Hyperman_bus_waker_drained); /* prototype to pass -Wmissing-prototypes */ |
| 3307 |
1 |
| XS_EUPXS(XS_Hyperman_bus_waker_drained) |
| 3308 |
|
| { |
| 3309 |
1 |
| dVAR; dXSARGS; |
| 3310 |
1 |
▶ | if (items < 0 || items > 1) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 0 || items > 1) |
1 |
0 |
1 |
| if (items < 0 || items > 1) |
0 |
1 |
1 |
|
| 3311 |
0 |
| croak_xs_usage(cv, "class = &PL_sv_undef"); |
| 3312 |
|
| { |
| 3313 |
|
| SV * class; |
| 3314 |
|
| |
| 3315 |
1 |
▶ | if (items < 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 1) |
0 |
1 |
1 |
|
| 3316 |
0 |
| class = &PL_sv_undef; |
| 3317 |
|
| else { |
| 3318 |
1 |
| class = ST(0) |
| 3319 |
|
| ; |
| 3320 |
|
| } |
| 3321 |
|
| #line 335 "./xs/bus.xs" |
| 3322 |
|
| PERL_UNUSED_VAR(class); |
| 3323 |
|
| hm_sa_bus_waker_drained(); |
| 3324 |
|
| #line 3325 "Hyperman.c" |
| 3325 |
|
| } |
| 3326 |
1 |
| XSRETURN_EMPTY; |
| 3327 |
|
| } |
| 3328 |
|
| |
| 3329 |
|
| |
| 3330 |
|
| XS_EUPXS(XS_Hyperman_bus_stats); /* prototype to pass -Wmissing-prototypes */ |
| 3331 |
5 |
| XS_EUPXS(XS_Hyperman_bus_stats) |
| 3332 |
|
| { |
| 3333 |
5 |
| dVAR; dXSARGS; |
| 3334 |
5 |
▶ | if (items < 1 || items > 2) |
Branch: 2 branches
| Branch | True | False | Total |
| if (items < 1 || items > 2) |
5 |
0 |
5 |
| if (items < 1 || items > 2) |
0 |
5 |
5 |
|
| 3335 |
0 |
| croak_xs_usage(cv, "class, group = &PL_sv_undef"); |
| 3336 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 3337 |
5 |
| SP -= items; |
| 3338 |
|
| { |
| 3339 |
5 |
| SV * class = ST(0) |
| 3340 |
|
| ; |
| 3341 |
|
| SV * group; |
| 3342 |
|
| |
| 3343 |
5 |
▶ | if (items < 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items < 2) |
2 |
3 |
5 |
|
| 3344 |
2 |
| group = &PL_sv_undef; |
| 3345 |
|
| else { |
| 3346 |
3 |
| group = ST(1) |
| 3347 |
|
| ; |
| 3348 |
|
| } |
| 3349 |
|
| #line 349 "./xs/bus.xs" |
| 3350 |
|
| { |
| 3351 |
|
| PERL_UNUSED_VAR(class); |
| 3352 |
|
| EXTEND(SP, 6); |
| 3353 |
|
| mPUSHp("published", 9); mPUSHu((UV)hm_sa_bus_published()); |
| 3354 |
|
| /* Both cursors, for the reason bus_gaps says. */ |
| 3355 |
|
| mPUSHp("gaps", 4); mPUSHu((UV)(hm_sa_bus_gaps_of(hm_sa_recv_cur) |
| 3356 |
|
| + hm_sa_bus_gaps_of(hm_sa_disp_cur))); |
| 3357 |
|
| if (SvOK(group)) { |
| 3358 |
|
| STRLEN gl; |
| 3359 |
|
| const char *g = SvPV_const(group, gl); |
| 3360 |
|
| sa_group_h *gh = hm_sa_bus_group(g, (uint32_t)gl, g, (uint32_t)gl); |
| 3361 |
|
| mPUSHp("group_gaps", 10); |
| 3362 |
|
| mPUSHu(gh ? (UV)hm_sa_bus_group_gaps(gh) : 0); /* # uncoverable condition right count:1 class:ignore_covered_err */ |
| 3363 |
|
| } |
| 3364 |
|
| } |
| 3365 |
|
| #line 3366 "Hyperman.c" |
| 3366 |
5 |
| PUTBACK; |
| 3367 |
5 |
| return; |
| 3368 |
|
| } |
| 3369 |
|
| } |
| 3370 |
|
| |
| 3371 |
|
| |
| 3372 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/bus.xs' */ |
| 3373 |
|
| |
| 3374 |
|
| |
| 3375 |
|
| /* INCLUDE: Including 'xs/quic.xs' from 'Hyperman.xs' */ |
| 3376 |
|
| |
| 3377 |
|
| |
| 3378 |
|
| XS_EUPXS(XS_Hyperman__quic_cid_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 3379 |
0 |
| XS_EUPXS(XS_Hyperman__quic_cid_selftest) |
| 3380 |
|
| { |
| 3381 |
0 |
| dVAR; dXSARGS; |
| 3382 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 3383 |
0 |
| croak_xs_usage(cv, ""); |
| 3384 |
|
| { |
| 3385 |
|
| IV RETVAL; |
| 3386 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 3387 |
|
| #line 18 "./xs/quic.xs" |
| 3388 |
|
| RETVAL = hm_quic_cid_selftest(); /* # uncoverable statement class:ignore_covered_err */ |
| 3389 |
|
| #line 3390 "Hyperman.c" |
| 3390 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 3391 |
0 |
| ST(0) = TARG; |
| 3392 |
|
| } |
| 3393 |
0 |
| XSRETURN(1); |
| 3394 |
|
| } |
| 3395 |
|
| |
| 3396 |
|
| |
| 3397 |
|
| XS_EUPXS(XS_Hyperman__quic_heap_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 3398 |
0 |
| XS_EUPXS(XS_Hyperman__quic_heap_selftest) |
| 3399 |
|
| { |
| 3400 |
0 |
| dVAR; dXSARGS; |
| 3401 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 3402 |
0 |
| croak_xs_usage(cv, ""); |
| 3403 |
|
| { |
| 3404 |
|
| IV RETVAL; |
| 3405 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 3406 |
|
| #line 32 "./xs/quic.xs" |
| 3407 |
|
| RETVAL = hm_quic_heap_selftest(); /* # uncoverable statement class:ignore_covered_err */ |
| 3408 |
|
| #line 3409 "Hyperman.c" |
| 3409 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 3410 |
0 |
| ST(0) = TARG; |
| 3411 |
|
| } |
| 3412 |
0 |
| XSRETURN(1); |
| 3413 |
|
| } |
| 3414 |
|
| |
| 3415 |
|
| |
| 3416 |
|
| XS_EUPXS(XS_Hyperman__quic_src_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 3417 |
0 |
| XS_EUPXS(XS_Hyperman__quic_src_selftest) |
| 3418 |
|
| { |
| 3419 |
0 |
| dVAR; dXSARGS; |
| 3420 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 3421 |
0 |
| croak_xs_usage(cv, ""); |
| 3422 |
|
| { |
| 3423 |
|
| IV RETVAL; |
| 3424 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 3425 |
|
| #line 43 "./xs/quic.xs" |
| 3426 |
|
| RETVAL = hm_quic_src_selftest(); /* # uncoverable statement class:ignore_covered_err */ |
| 3427 |
|
| #line 3428 "Hyperman.c" |
| 3428 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 3429 |
0 |
| ST(0) = TARG; |
| 3430 |
|
| } |
| 3431 |
0 |
| XSRETURN(1); |
| 3432 |
|
| } |
| 3433 |
|
| |
| 3434 |
|
| |
| 3435 |
|
| XS_EUPXS(XS_Hyperman__quic_token_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 3436 |
0 |
| XS_EUPXS(XS_Hyperman__quic_token_selftest) |
| 3437 |
|
| { |
| 3438 |
0 |
| dVAR; dXSARGS; |
| 3439 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 3440 |
0 |
| croak_xs_usage(cv, ""); |
| 3441 |
|
| { |
| 3442 |
|
| IV RETVAL; |
| 3443 |
0 |
▶ | dXSTARG; |
Branch: 1 branch
| Branch | True | False | Total |
| dXSTARG; |
0 |
0 |
0 |
|
| 3444 |
|
| #line 55 "./xs/quic.xs" |
| 3445 |
|
| RETVAL = hm_quic_token_selftest(); /* # uncoverable statement class:ignore_covered_err */ |
| 3446 |
|
| #line 3447 "Hyperman.c" |
| 3447 |
0 |
▶ | TARGi((IV)RETVAL, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| TARGi((IV)RETVAL, 1); |
0 |
0 |
0 |
|
| 3448 |
0 |
| ST(0) = TARG; |
| 3449 |
|
| } |
| 3450 |
0 |
| XSRETURN(1); |
| 3451 |
|
| } |
| 3452 |
|
| |
| 3453 |
|
| |
| 3454 |
|
| XS_EUPXS(XS_Hyperman__quic_decode_selftest); /* prototype to pass -Wmissing-prototypes */ |
| 3455 |
0 |
| XS_EUPXS(XS_Hyperman__quic_decode_selftest) |
| 3456 |
|
| { |
| 3457 |
0 |
| dVAR; dXSARGS; |
| 3458 |
0 |
▶ | if (items != 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 1) |
0 |
0 |
0 |
|
| 3459 |
0 |
| croak_xs_usage(cv, "pkt"); |
| 3460 |
|
| PERL_UNUSED_VAR(ax); /* -Wall */ |
| 3461 |
0 |
| SP -= items; |
| 3462 |
|
| { |
| 3463 |
0 |
| SV * pkt = ST(0) |
| 3464 |
|
| ; |
| 3465 |
|
| #line 69 "./xs/quic.xs" |
| 3466 |
|
| STRLEN len; |
| 3467 |
|
| const unsigned char *p; |
| 3468 |
|
| int rv = -1; /* # uncoverable statement class:ignore_covered_err */ |
| 3469 |
|
| uint32_t ver = 0; /* # uncoverable statement class:ignore_covered_err */ |
| 3470 |
|
| size_t dlen = 0, slen = 0; /* # uncoverable statement class:ignore_covered_err */ |
| 3471 |
|
| #line 3472 "Hyperman.c" |
| 3472 |
|
| #line 75 "./xs/quic.xs" |
| 3473 |
|
| p = (const unsigned char *)SvPV(pkt, len); /* # uncoverable statement class:ignore_covered_err */ |
| 3474 |
|
| hm_quic_decode_probe(p, (size_t)len, &rv, &ver, &dlen, &slen); /* # uncoverable statement class:ignore_covered_err */ |
| 3475 |
|
| EXTEND(SP, 4); /* # uncoverable statement class:ignore_covered_err */ |
| 3476 |
|
| mPUSHi(rv); /* # uncoverable statement class:ignore_covered_err */ |
| 3477 |
|
| mPUSHu(ver); /* # uncoverable statement class:ignore_covered_err */ |
| 3478 |
|
| mPUSHu((UV)dlen); /* # uncoverable statement class:ignore_covered_err */ |
| 3479 |
|
| mPUSHu((UV)slen); /* # uncoverable statement class:ignore_covered_err */ |
| 3480 |
|
| #line 3481 "Hyperman.c" |
| 3481 |
0 |
| PUTBACK; |
| 3482 |
0 |
| return; |
| 3483 |
|
| } |
| 3484 |
|
| } |
| 3485 |
|
| |
| 3486 |
|
| |
| 3487 |
|
| /* INCLUDE: Returning to 'Hyperman.xs' from 'xs/quic.xs' */ |
| 3488 |
|
| |
| 3489 |
|
| #ifdef __cplusplus |
| 3490 |
|
| extern "C" { |
| 3491 |
|
| #endif |
| 3492 |
|
| XS_EXTERNAL(boot_Hyperman); /* prototype to pass -Wmissing-prototypes */ |
| 3493 |
148 |
| XS_EXTERNAL(boot_Hyperman) |
| 3494 |
|
| { |
| 3495 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 3496 |
|
| dVAR; dXSARGS; |
| 3497 |
|
| #else |
| 3498 |
148 |
| dVAR; dXSBOOTARGSXSAPIVERCHK; |
| 3499 |
|
| #endif |
| 3500 |
|
| #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ |
| 3501 |
|
| char* file = __FILE__; |
| 3502 |
|
| #else |
| 3503 |
148 |
| const char* file = __FILE__; |
| 3504 |
|
| #endif |
| 3505 |
|
| |
| 3506 |
|
| PERL_UNUSED_VAR(file); |
| 3507 |
|
| |
| 3508 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 3509 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 3510 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 3511 |
|
| XS_VERSION_BOOTCHECK; |
| 3512 |
|
| # ifdef XS_APIVERSION_BOOTCHECK |
| 3513 |
|
| XS_APIVERSION_BOOTCHECK; |
| 3514 |
|
| # endif |
| 3515 |
|
| #endif |
| 3516 |
|
| |
| 3517 |
|
| { |
| 3518 |
|
| CV * cv; |
| 3519 |
|
| |
| 3520 |
148 |
| newXS_deffile("Hyperman::run", XS_Hyperman_run); |
| 3521 |
148 |
| newXS_deffile("Hyperman::timer", XS_Hyperman_timer); |
| 3522 |
148 |
| newXS_deffile("Hyperman::io_ready", XS_Hyperman_io_ready); |
| 3523 |
148 |
| newXS_deffile("Hyperman::stats", XS_Hyperman_stats); |
| 3524 |
148 |
| newXS_deffile("Hyperman::has_http2", XS_Hyperman_has_http2); |
| 3525 |
148 |
| newXS_deffile("Hyperman::has_http3", XS_Hyperman_has_http3); |
| 3526 |
148 |
| newXS_deffile("Hyperman::quic_library", XS_Hyperman_quic_library); |
| 3527 |
148 |
| newXS_deffile("Hyperman::_accepts_gzip", XS_Hyperman__accepts_gzip); |
| 3528 |
148 |
| newXS_deffile("Hyperman::_gzip", XS_Hyperman__gzip); |
| 3529 |
148 |
| newXS_deffile("Hyperman::has_compression", XS_Hyperman_has_compression); |
| 3530 |
148 |
| newXS_deffile("Hyperman::has_tls", XS_Hyperman_has_tls); |
| 3531 |
148 |
| newXS_deffile("Hyperman::has_ktls", XS_Hyperman_has_ktls); |
| 3532 |
148 |
| newXS_deffile("Hyperman::tls_library", XS_Hyperman_tls_library); |
| 3533 |
148 |
| newXS_deffile("Hyperman::tls_reload", XS_Hyperman_tls_reload); |
| 3534 |
148 |
| newXS_deffile("Hyperman::loop", XS_Hyperman_loop); |
| 3535 |
148 |
| newXS_deffile("Hyperman::detach", XS_Hyperman_detach); |
| 3536 |
148 |
| newXS_deffile("Hyperman::stream", XS_Hyperman_stream); |
| 3537 |
148 |
| newXS_deffile("Hyperman::deny_add", XS_Hyperman_deny_add); |
| 3538 |
148 |
| newXS_deffile("Hyperman::deny_remove", XS_Hyperman_deny_remove); |
| 3539 |
148 |
| newXS_deffile("Hyperman::pool_stats", XS_Hyperman_pool_stats); |
| 3540 |
148 |
| newXS_deffile("Hyperman::leader", XS_Hyperman_leader); |
| 3541 |
148 |
| newXS_deffile("Hyperman::distinct_clients", XS_Hyperman_distinct_clients); |
| 3542 |
148 |
| newXS_deffile("Hyperman::arena", XS_Hyperman_arena); |
| 3543 |
148 |
| newXS_deffile("Hyperman::deny_check", XS_Hyperman_deny_check); |
| 3544 |
148 |
| newXS_deffile("Hyperman::ratelimit_hit", XS_Hyperman_ratelimit_hit); |
| 3545 |
148 |
| newXS_deffile("Hyperman::on_worker_start", XS_Hyperman_on_worker_start); |
| 3546 |
148 |
| newXS_deffile("Hyperman::_proxy_selftest", XS_Hyperman__proxy_selftest); |
| 3547 |
148 |
| newXS_deffile("Hyperman::_croak_sv_selftest", XS_Hyperman__croak_sv_selftest); |
| 3548 |
148 |
| newXS_deffile("Hyperman::Future::new", XS_Hyperman__Future_new); |
| 3549 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_DONE", XS_Hyperman__Future_done); |
| 3550 |
148 |
| XSANY.any_i32 = 1; |
| 3551 |
148 |
| cv = newXS_deffile("Hyperman::Future::done", XS_Hyperman__Future_done); |
| 3552 |
148 |
| XSANY.any_i32 = 0; |
| 3553 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_FAIL", XS_Hyperman__Future_fail); |
| 3554 |
148 |
| XSANY.any_i32 = 1; |
| 3555 |
148 |
| cv = newXS_deffile("Hyperman::Future::fail", XS_Hyperman__Future_fail); |
| 3556 |
148 |
| XSANY.any_i32 = 0; |
| 3557 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_NEW_DONE", XS_Hyperman__Future_done_future); |
| 3558 |
148 |
| XSANY.any_i32 = 1; |
| 3559 |
148 |
| cv = newXS_deffile("Hyperman::Future::done_future", XS_Hyperman__Future_done_future); |
| 3560 |
148 |
| XSANY.any_i32 = 0; |
| 3561 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_NEW_FAIL", XS_Hyperman__Future_fail_future); |
| 3562 |
148 |
| XSANY.any_i32 = 1; |
| 3563 |
148 |
| cv = newXS_deffile("Hyperman::Future::fail_future", XS_Hyperman__Future_fail_future); |
| 3564 |
148 |
| XSANY.any_i32 = 0; |
| 3565 |
148 |
| newXS_deffile("Hyperman::Future::cancel", XS_Hyperman__Future_cancel); |
| 3566 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_IS_READY", XS_Hyperman__Future_is_ready); |
| 3567 |
148 |
| XSANY.any_i32 = 1; |
| 3568 |
148 |
| cv = newXS_deffile("Hyperman::Future::is_ready", XS_Hyperman__Future_is_ready); |
| 3569 |
148 |
| XSANY.any_i32 = 0; |
| 3570 |
148 |
| newXS_deffile("Hyperman::Future::is_done", XS_Hyperman__Future_is_done); |
| 3571 |
148 |
| newXS_deffile("Hyperman::Future::is_failed", XS_Hyperman__Future_is_failed); |
| 3572 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_IS_CANCELLED", XS_Hyperman__Future_is_cancelled); |
| 3573 |
148 |
| XSANY.any_i32 = 1; |
| 3574 |
148 |
| cv = newXS_deffile("Hyperman::Future::is_cancelled", XS_Hyperman__Future_is_cancelled); |
| 3575 |
148 |
| XSANY.any_i32 = 0; |
| 3576 |
148 |
| newXS_deffile("Hyperman::Future::AWAIT_CLONE", XS_Hyperman__Future_AWAIT_CLONE); |
| 3577 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_ON_READY", XS_Hyperman__Future_on_ready); |
| 3578 |
148 |
| XSANY.any_i32 = 1; |
| 3579 |
148 |
| cv = newXS_deffile("Hyperman::Future::on_ready", XS_Hyperman__Future_on_ready); |
| 3580 |
148 |
| XSANY.any_i32 = 0; |
| 3581 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_CHAIN_CANCEL", XS_Hyperman__Future_on_cancel); |
| 3582 |
148 |
| XSANY.any_i32 = 2; |
| 3583 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_ON_CANCEL", XS_Hyperman__Future_on_cancel); |
| 3584 |
148 |
| XSANY.any_i32 = 1; |
| 3585 |
148 |
| cv = newXS_deffile("Hyperman::Future::on_cancel", XS_Hyperman__Future_on_cancel); |
| 3586 |
148 |
| XSANY.any_i32 = 0; |
| 3587 |
148 |
| cv = newXS_deffile("Hyperman::Future::on_done", XS_Hyperman__Future_on_done); |
| 3588 |
148 |
| XSANY.any_i32 = 0; |
| 3589 |
148 |
| cv = newXS_deffile("Hyperman::Future::on_fail", XS_Hyperman__Future_on_done); |
| 3590 |
148 |
| XSANY.any_i32 = 1; |
| 3591 |
148 |
| newXS_deffile("Hyperman::Future::await", XS_Hyperman__Future_await); |
| 3592 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_GET", XS_Hyperman__Future_get); |
| 3593 |
148 |
| XSANY.any_i32 = 3; |
| 3594 |
148 |
| cv = newXS_deffile("Hyperman::Future::AWAIT_WAIT", XS_Hyperman__Future_get); |
| 3595 |
148 |
| XSANY.any_i32 = 2; |
| 3596 |
148 |
| cv = newXS_deffile("Hyperman::Future::get", XS_Hyperman__Future_get); |
| 3597 |
148 |
| XSANY.any_i32 = 0; |
| 3598 |
148 |
| cv = newXS_deffile("Hyperman::Future::result", XS_Hyperman__Future_get); |
| 3599 |
148 |
| XSANY.any_i32 = 1; |
| 3600 |
148 |
| newXS_deffile("Hyperman::Future::failure", XS_Hyperman__Future_failure); |
| 3601 |
148 |
| newXS_deffile("Hyperman::Future::_values", XS_Hyperman__Future__values); |
| 3602 |
148 |
| cv = newXS_deffile("Hyperman::Future::else", XS_Hyperman__Future_then); |
| 3603 |
148 |
| XSANY.any_i32 = 1; |
| 3604 |
148 |
| cv = newXS_deffile("Hyperman::Future::then", XS_Hyperman__Future_then); |
| 3605 |
148 |
| XSANY.any_i32 = 0; |
| 3606 |
148 |
| newXS_deffile("Hyperman::Future::followed_by", XS_Hyperman__Future_followed_by); |
| 3607 |
148 |
| newXS_deffile("Hyperman::Future::transform", XS_Hyperman__Future_transform); |
| 3608 |
148 |
| newXS_deffile("Hyperman::Future::_set_upstream", XS_Hyperman__Future__set_upstream); |
| 3609 |
148 |
| cv = newXS_deffile("Hyperman::Future::needs_all", XS_Hyperman__Future_wait_all); |
| 3610 |
148 |
| XSANY.any_i32 = 2; |
| 3611 |
148 |
| cv = newXS_deffile("Hyperman::Future::needs_any", XS_Hyperman__Future_wait_all); |
| 3612 |
148 |
| XSANY.any_i32 = 3; |
| 3613 |
148 |
| cv = newXS_deffile("Hyperman::Future::wait_all", XS_Hyperman__Future_wait_all); |
| 3614 |
148 |
| XSANY.any_i32 = 0; |
| 3615 |
148 |
| cv = newXS_deffile("Hyperman::Future::wait_any", XS_Hyperman__Future_wait_all); |
| 3616 |
148 |
| XSANY.any_i32 = 1; |
| 3617 |
148 |
| newXS_deffile("Hyperman::Future::as_cpan_future", XS_Hyperman__Future_as_cpan_future); |
| 3618 |
148 |
| newXS_deffile("Hyperman::Future::from_future", XS_Hyperman__Future_from_future); |
| 3619 |
148 |
| newXS_deffile("Hyperman::Loop::new", XS_Hyperman__Loop_new); |
| 3620 |
148 |
| newXS_deffile("Hyperman::Loop::run", XS_Hyperman__Loop_run); |
| 3621 |
148 |
| newXS_deffile("Hyperman::Loop::run_until", XS_Hyperman__Loop_run_until); |
| 3622 |
148 |
| newXS_deffile("Hyperman::Loop::stop", XS_Hyperman__Loop_stop); |
| 3623 |
148 |
| newXS_deffile("Hyperman::Loop::watch_io", XS_Hyperman__Loop_watch_io); |
| 3624 |
148 |
| newXS_deffile("Hyperman::Loop::unwatch_io", XS_Hyperman__Loop_unwatch_io); |
| 3625 |
148 |
| newXS_deffile("Hyperman::Loop::timer", XS_Hyperman__Loop_timer); |
| 3626 |
148 |
| newXS_deffile("Hyperman::Loop::timer_f", XS_Hyperman__Loop_timer_f); |
| 3627 |
148 |
| cv = newXS_deffile("Hyperman::Loop::readable_f", XS_Hyperman__Loop_readable_f); |
| 3628 |
148 |
| XSANY.any_i32 = 0; |
| 3629 |
148 |
| cv = newXS_deffile("Hyperman::Loop::writable_f", XS_Hyperman__Loop_readable_f); |
| 3630 |
148 |
| XSANY.any_i32 = 1; |
| 3631 |
148 |
| newXS_deffile("Hyperman::Loop::defer", XS_Hyperman__Loop_defer); |
| 3632 |
148 |
| newXS_deffile("Hyperman::Loop::install_await", XS_Hyperman__Loop_install_await); |
| 3633 |
148 |
| newXS_deffile("Hyperman::Loop::backend", XS_Hyperman__Loop_backend); |
| 3634 |
148 |
| newXS_deffile("Hyperman::Loop::DESTROY", XS_Hyperman__Loop_DESTROY); |
| 3635 |
148 |
| newXS_deffile("Hyperman::Writer::write", XS_Hyperman__Writer_write); |
| 3636 |
148 |
| newXS_deffile("Hyperman::Writer::DESTROY", XS_Hyperman__Writer_DESTROY); |
| 3637 |
148 |
| newXS_deffile("Hyperman::Writer::close", XS_Hyperman__Writer_close); |
| 3638 |
148 |
| newXS_deffile("Hyperman::Writer::abort", XS_Hyperman__Writer_abort); |
| 3639 |
148 |
| newXS_deffile("Hyperman::Event::Kqueue::available", XS_Hyperman__Event__Kqueue_available); |
| 3640 |
148 |
| newXS_deffile("Hyperman::Event::Epoll::available", XS_Hyperman__Event__Epoll_available); |
| 3641 |
148 |
| newXS_deffile("Hyperman::Event::Poll::available", XS_Hyperman__Event__Poll_available); |
| 3642 |
148 |
| newXS_deffile("Hyperman::Event::IOUring::available", XS_Hyperman__Event__IOUring_available); |
| 3643 |
148 |
| newXS_deffile("Hyperman::_abi_ptr", XS_Hyperman__abi_ptr); |
| 3644 |
148 |
| newXS_deffile("Hyperman::_abi_selftest", XS_Hyperman__abi_selftest); |
| 3645 |
148 |
| newXS_deffile("Hyperman::_abi_version", XS_Hyperman__abi_version); |
| 3646 |
148 |
| newXS_deffile("Hyperman::_abi_worker_hook_install", XS_Hyperman__abi_worker_hook_install); |
| 3647 |
148 |
| newXS_deffile("Hyperman::_abi_worker_hook_state", XS_Hyperman__abi_worker_hook_state); |
| 3648 |
148 |
| newXS_deffile("Hyperman::_abi_stream_open", XS_Hyperman__abi_stream_open); |
| 3649 |
148 |
| newXS_deffile("Hyperman::_abi_stream_write", XS_Hyperman__abi_stream_write); |
| 3650 |
148 |
| newXS_deffile("Hyperman::_abi_stream_close", XS_Hyperman__abi_stream_close); |
| 3651 |
148 |
| newXS_deffile("Hyperman::_abi_stream_abort", XS_Hyperman__abi_stream_abort); |
| 3652 |
148 |
| newXS_deffile("Hyperman::_abi_stream_read", XS_Hyperman__abi_stream_read); |
| 3653 |
148 |
| newXS_deffile("Hyperman::_abi_stream_rx", XS_Hyperman__abi_stream_rx); |
| 3654 |
148 |
| newXS_deffile("Hyperman::_abi_stream_produce", XS_Hyperman__abi_stream_produce); |
| 3655 |
148 |
| newXS_deffile("Hyperman::_abi_stream_state", XS_Hyperman__abi_stream_state); |
| 3656 |
148 |
| newXS_deffile("Hyperman::bus_init", XS_Hyperman_bus_init); |
| 3657 |
148 |
| newXS_deffile("Hyperman::bus_live", XS_Hyperman_bus_live); |
| 3658 |
148 |
| newXS_deffile("Hyperman::publish", XS_Hyperman_publish); |
| 3659 |
148 |
| newXS_deffile("Hyperman::bus_reset", XS_Hyperman_bus_reset); |
| 3660 |
148 |
| newXS_deffile("Hyperman::receive", XS_Hyperman_receive); |
| 3661 |
148 |
| newXS_deffile("Hyperman::bus_gaps", XS_Hyperman_bus_gaps); |
| 3662 |
148 |
| newXS_deffile("Hyperman::claim", XS_Hyperman_claim); |
| 3663 |
148 |
| newXS_deffile("Hyperman::subscribe", XS_Hyperman_subscribe); |
| 3664 |
148 |
| newXS_deffile("Hyperman::unsubscribe", XS_Hyperman_unsubscribe); |
| 3665 |
148 |
| newXS_deffile("Hyperman::dispatch", XS_Hyperman_dispatch); |
| 3666 |
148 |
| newXS_deffile("Hyperman::bus_waker_take", XS_Hyperman_bus_waker_take); |
| 3667 |
148 |
| newXS_deffile("Hyperman::bus_waker_drained", XS_Hyperman_bus_waker_drained); |
| 3668 |
148 |
| newXS_deffile("Hyperman::bus_stats", XS_Hyperman_bus_stats); |
| 3669 |
148 |
| newXS_deffile("Hyperman::_quic_cid_selftest", XS_Hyperman__quic_cid_selftest); |
| 3670 |
148 |
| newXS_deffile("Hyperman::_quic_heap_selftest", XS_Hyperman__quic_heap_selftest); |
| 3671 |
148 |
| newXS_deffile("Hyperman::_quic_src_selftest", XS_Hyperman__quic_src_selftest); |
| 3672 |
148 |
| newXS_deffile("Hyperman::_quic_token_selftest", XS_Hyperman__quic_token_selftest); |
| 3673 |
148 |
| newXS_deffile("Hyperman::_quic_decode_selftest", XS_Hyperman__quic_decode_selftest); |
| 3674 |
|
| } |
| 3675 |
|
| |
| 3676 |
|
| /* Initialisation Section */ |
| 3677 |
|
| |
| 3678 |
|
| #line 6 "./xs/hyperman.xs" |
| 3679 |
|
| hm_fq = newAV(); |
| 3680 |
|
| hm_boot_argv_save(aTHX); |
| 3681 |
|
| /* Shared::Arena's table, once. NULL when it is absent or too old, and |
| 3682 |
|
| * every arena door then fails open. */ |
| 3683 |
|
| hm_sa_resolve(aTHX); |
| 3684 |
|
| |
| 3685 |
|
| #line 3686 "Hyperman.c" |
| 3686 |
|
| |
| 3687 |
|
| /* End of Initialisation Section */ |
| 3688 |
|
| |
| 3689 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 3690 |
|
| # if PERL_VERSION_GE(5, 9, 0) |
| 3691 |
|
| if (PL_unitcheckav) |
| 3692 |
|
| call_list(PL_scopestack_ix, PL_unitcheckav); |
| 3693 |
|
| # endif |
| 3694 |
|
| XSRETURN_YES; |
| 3695 |
|
| #else |
| 3696 |
148 |
| Perl_xs_boot_epilog(aTHX_ ax); |
| 3697 |
|
| #endif |
| 3698 |
148 |
| } |
| 3699 |
|
| |
| 3700 |
|
| #ifdef __cplusplus |
| 3701 |
|
| } |
| 3702 |
|
| #endif |