1 /* 2 * This file was generated automatically by ExtUtils::ParseXS version 3.45 from the 3 * contents of Task.xs. Do not edit this file, edit Task.xs instead. 4 * 5 * ANY CHANGES MADE HERE WILL BE LOST! 6 * 7 */ 8 9 #line 1 "Task.xs" 10 /* 11 * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. 12 */ 13 /* 14 * Task.xs contains XS wrappers for the task maniplulation functions. 15 */ 16 17 /* Solaris includes. */ 18 #include <sys/task.h> 19 20 /* Perl includes. */ 21 #include "EXTERN.h" 22 #if __GNUC__ >= 5 23 #include "perl.h" 24 #else 25 #define _Thread_local 26 #include "perl.h" 27 #undef _Thread_local 28 #undef PERL_GET_CONTEXT 29 #undef PERL_SET_CONTEXT 30 #define PERL_GET_CONTEXT PTHREAD_GETSPECIFIC(PL_thr_key) 31 #define PERL_SET_CONTEXT(t) Perl_set_context((void*)t) 32 #endif 33 #include "XSUB.h" 34 35 /* 36 * The XS code exported to perl is below here. Note that the XS preprocessor 37 * has its own commenting syntax, so all comments from this point on are in 38 * that form. 39 */ 40 41 #line 42 "Task.c" 42 #ifndef PERL_UNUSED_VAR 43 # define PERL_UNUSED_VAR(var) if (0) var = var 44 #endif 45 46 #ifndef dVAR 47 # define dVAR dNOOP 48 #endif 49 50 51 /* This stuff is not part of the API! You have been warned. */ 52 #ifndef PERL_VERSION_DECIMAL 53 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) 54 #endif 55 #ifndef PERL_DECIMAL_VERSION 56 # define PERL_DECIMAL_VERSION \ 57 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) 58 #endif 59 #ifndef PERL_VERSION_GE 60 # define PERL_VERSION_GE(r,v,s) \ 61 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) 62 #endif 63 #ifndef PERL_VERSION_LE 64 # define PERL_VERSION_LE(r,v,s) \ 65 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) 66 #endif 67 68 /* XS_INTERNAL is the explicit static-linkage variant of the default 69 * XS macro. 70 * 71 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include 72 * "STATIC", ie. it exports XSUB symbols. You probably don't want that 73 * for anything but the BOOT XSUB. 74 * 75 * See XSUB.h in core! 76 */ 77 78 79 /* TODO: This might be compatible further back than 5.10.0. */ 80 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) 81 # undef XS_EXTERNAL 82 # undef XS_INTERNAL 83 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) 84 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) 85 # define XS_INTERNAL(name) STATIC XSPROTO(name) 86 # endif 87 # if defined(__SYMBIAN32__) 88 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) 89 # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) 90 # endif 91 # ifndef XS_EXTERNAL 92 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) 93 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) 94 # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) 95 # else 96 # ifdef __cplusplus 97 # define XS_EXTERNAL(name) extern "C" XSPROTO(name) 98 # define XS_INTERNAL(name) static XSPROTO(name) 99 # else 100 # define XS_EXTERNAL(name) XSPROTO(name) 101 # define XS_INTERNAL(name) STATIC XSPROTO(name) 102 # endif 103 # endif 104 # endif 105 #endif 106 107 /* perl >= 5.10.0 && perl <= 5.15.1 */ 108 109 110 /* The XS_EXTERNAL macro is used for functions that must not be static 111 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL 112 * macro defined, the best we can do is assume XS is the same. 113 * Dito for XS_INTERNAL. 114 */ 115 #ifndef XS_EXTERNAL 116 # define XS_EXTERNAL(name) XS(name) 117 #endif 118 #ifndef XS_INTERNAL 119 # define XS_INTERNAL(name) XS(name) 120 #endif 121 122 /* Now, finally, after all this mess, we want an ExtUtils::ParseXS 123 * internal macro that we're free to redefine for varying linkage due 124 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use 125 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! 126 */ 127 128 #undef XS_EUPXS 129 #if defined(PERL_EUPXS_ALWAYS_EXPORT) 130 # define XS_EUPXS(name) XS_EXTERNAL(name) 131 #else 132 /* default to internal */ 133 # define XS_EUPXS(name) XS_INTERNAL(name) 134 #endif 135 136 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE 137 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) 138 139 /* prototype to pass -Wmissing-prototypes */ 140 STATIC void 141 S_croak_xs_usage(const CV *const cv, const char *const params); 142 143 STATIC void 144 S_croak_xs_usage(const CV *const cv, const char *const params) 145 { 146 const GV *const gv = CvGV(cv); 147 148 PERL_ARGS_ASSERT_CROAK_XS_USAGE; 149 150 if (gv) { 151 const char *const gvname = GvNAME(gv); 152 const HV *const stash = GvSTASH(gv); 153 const char *const hvname = stash ? HvNAME(stash) : NULL; 154 155 if (hvname) 156 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); 157 else 158 Perl_croak_nocontext("Usage: %s(%s)", gvname, params); 159 } else { 160 /* Pants. I don't think that it should be possible to get here. */ 161 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); 162 } 163 } 164 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE 165 166 #define croak_xs_usage S_croak_xs_usage 167 168 #endif 169 170 /* NOTE: the prototype of newXSproto() is different in versions of perls, 171 * so we define a portable version of newXSproto() 172 */ 173 #ifdef newXS_flags 174 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) 175 #else 176 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) 177 #endif /* !defined(newXS_flags) */ 178 179 #if PERL_VERSION_LE(5, 21, 5) 180 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) 181 #else 182 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) 183 #endif 184 185 #line 186 "Task.c" 186 187 XS_EUPXS(XS_Sun__Solaris__Task_settaskid); /* prototype to pass -Wmissing-prototypes */ 188 XS_EUPXS(XS_Sun__Solaris__Task_settaskid) 189 { 190 dVAR; dXSARGS; 191 if (items != 2) 192 croak_xs_usage(cv, "project, flags"); 193 { 194 projid_t project = (projid_t)SvIV(ST(0)) 195 ; 196 int flags = (int)SvIV(ST(1)) 197 ; 198 taskid_t RETVAL; 199 dXSTARG; 200 201 RETVAL = settaskid(project, flags); 202 XSprePUSH; 203 PUSHi((IV)RETVAL); 204 } 205 XSRETURN(1); 206 } 207 208 209 XS_EUPXS(XS_Sun__Solaris__Task_gettaskid); /* prototype to pass -Wmissing-prototypes */ 210 XS_EUPXS(XS_Sun__Solaris__Task_gettaskid) 211 { 212 dVAR; dXSARGS; 213 if (items != 0) 214 croak_xs_usage(cv, ""); 215 { 216 taskid_t RETVAL; 217 dXSTARG; 218 219 RETVAL = gettaskid(); 220 XSprePUSH; 221 PUSHi((IV)RETVAL); 222 } 223 XSRETURN(1); 224 } 225 226 #ifdef __cplusplus 227 extern "C" 228 #endif 229 XS_EXTERNAL(boot_Sun__Solaris__Task); /* prototype to pass -Wmissing-prototypes */ 230 XS_EXTERNAL(boot_Sun__Solaris__Task) 231 { 232 #if PERL_VERSION_LE(5, 21, 5) 233 dVAR; dXSARGS; 234 #else 235 dVAR; dXSBOOTARGSXSAPIVERCHK; 236 #endif 237 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ 238 char* file = __FILE__; 239 #else 240 const char* file = __FILE__; 241 #endif 242 243 PERL_UNUSED_VAR(file); 244 245 PERL_UNUSED_VAR(cv); /* -W */ 246 PERL_UNUSED_VAR(items); /* -W */ 247 #if PERL_VERSION_LE(5, 21, 5) 248 XS_VERSION_BOOTCHECK; 249 # ifdef XS_APIVERSION_BOOTCHECK 250 XS_APIVERSION_BOOTCHECK; 251 # endif 252 #endif 253 254 (void)newXSproto_portable("Sun::Solaris::Task::settaskid", XS_Sun__Solaris__Task_settaskid, file, "$$"); 255 (void)newXSproto_portable("Sun::Solaris::Task::gettaskid", XS_Sun__Solaris__Task_gettaskid, file, ""); 256 257 /* Initialisation Section */ 258 259 #line 42 "Task.xs" 260 { 261 HV *stash; 262 263 stash = gv_stashpv("Sun::Solaris::Task", TRUE); 264 newCONSTSUB(stash, "TASK_NORMAL", newSViv(TASK_NORMAL)); 265 newCONSTSUB(stash, "TASK_FINAL", newSViv(TASK_FINAL)); 266 newCONSTSUB(stash, "TASK_PROJ_PURGE", newSViv(TASK_PROJ_PURGE)); 267 } 268 269 #line 270 "Task.c" 270 271 /* End of Initialisation Section */ 272 273 #if PERL_VERSION_LE(5, 21, 5) 274 # if PERL_VERSION_GE(5, 9, 0) 275 if (PL_unitcheckav) 276 call_list(PL_scopestack_ix, PL_unitcheckav); 277 # endif 278 XSRETURN_YES; 279 #else 280 Perl_xs_boot_epilog(aTHX_ ax); 281 #endif 282 } 283 284