1 /*
2  * This file was generated automatically by ExtUtils::ParseXS version 3.45 from the
3  * contents of Project.xs. Do not edit this file, edit Project.xs instead.
4  *
5  *    ANY CHANGES MADE HERE WILL BE LOST!
6  *
7  */
8 
9 #line 1 "Project.xs"
10 /*
11  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
12  * Copyright (c) 2014 Racktop Systems.
13  */
14 /*
15  * Project.xs contains XS wrappers for the project database maniplulation
16  * functions as provided by libproject and described in getprojent(3EXACCT).
17  */
18 
19 /* Solaris includes. */
20 #include <zone.h>
21 #include <project.h>
22 #include <pool.h>
23 #include <sys/pool_impl.h>
24 #include <rctl.h>
25 #include <stdio.h>
26 
27 /* Perl includes. */
28 #include "EXTERN.h"
29 #if __GNUC__ >= 5
30 #include "perl.h"
31 #else
32 #define _Thread_local
33 #include "perl.h"
34 #undef _Thread_local
35 #undef PERL_GET_CONTEXT
36 #undef PERL_SET_CONTEXT
37 #define PERL_GET_CONTEXT	PTHREAD_GETSPECIFIC(PL_thr_key)
38 #define PERL_SET_CONTEXT(t)	Perl_set_context((void*)t)
39 #endif
40 #include "XSUB.h"
41 
42 /*
43  * Convert and save a struct project on the perl XS return stack.
44  * In a void context it returns nothing, in a scalar context it returns just
45  * the name of the project and in a list context it returns a 6-element list
46  * consisting of (name, projid, comment, users, groups, attr), where users and
47  * groups are references to arrays containing the appropriate lists.
48  */
49 static int
50 pushret_project(const struct project *proj)
51 {
52 	char	**cp;
53 	AV	*ary;
54 
55 	dSP;
56 	if (GIMME_V == G_SCALAR) {
57 		EXTEND(SP, 1);
58 		PUSHs(sv_2mortal(newSVpv(proj->pj_name, 0)));
59 		PUTBACK;
60 		return (1);
61 	} else if (GIMME_V == G_ARRAY) {
62 		EXTEND(SP, 6);
63 		PUSHs(sv_2mortal(newSVpv(proj->pj_name, 0)));
64 		PUSHs(sv_2mortal(newSViv(proj->pj_projid)));
65 		PUSHs(sv_2mortal(newSVpv(proj->pj_comment, 0)));
66 		ary = newAV();
67 		for (cp = proj->pj_users; *cp != NULL; cp++) {
68 			av_push(ary, newSVpv(*cp, 0));
69 		}
70 		PUSHs(sv_2mortal(newRV_noinc((SV *)ary)));
71 		ary = newAV();
72 		for (cp = proj->pj_groups; *cp != NULL; cp++) {
73 			av_push(ary, newSVpv(*cp, 0));
74 		}
75 		PUSHs(sv_2mortal(newRV_noinc((SV *)ary)));
76 		PUSHs(sv_2mortal(newSVpv(proj->pj_attr, 0)));
77 		PUTBACK;
78 		return (6);
79 	} else {
80 		return (0);
81 	}
82 }
83 
84 static int
85 pwalk_cb(const projid_t project, void *walk_data)
86 {
87 	int *nitemsp;
88 
89 	dSP;
90 	nitemsp = (int *) walk_data;
91 	EXTEND(SP, 1);
92 	PUSHs(sv_2mortal(newSViv(project)));
93 	(*nitemsp)++;
94 	PUTBACK;
95 	return (0);
96 }
97 
98 /*
99  * The XS code exported to perl is below here.  Note that the XS preprocessor
100  * has its own commenting syntax, so all comments from this point on are in
101  * that form.  Note also that the PUTBACK; lines are necessary to synchronise
102  * the local and global views of the perl stack before calling pushret_project,
103  * as the code generated by the perl XS compiler twiddles with the stack on
104  * entry to an XSUB.
105  */
106 
107 #line 108 "Project.c"
108 #ifndef PERL_UNUSED_VAR
109 #  define PERL_UNUSED_VAR(var) if (0) var = var
110 #endif
111 
112 #ifndef dVAR
113 #  define dVAR		dNOOP
114 #endif
115 
116 
117 /* This stuff is not part of the API! You have been warned. */
118 #ifndef PERL_VERSION_DECIMAL
119 #  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
120 #endif
121 #ifndef PERL_DECIMAL_VERSION
122 #  define PERL_DECIMAL_VERSION \
123 	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
124 #endif
125 #ifndef PERL_VERSION_GE
126 #  define PERL_VERSION_GE(r,v,s) \
127 	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
128 #endif
129 #ifndef PERL_VERSION_LE
130 #  define PERL_VERSION_LE(r,v,s) \
131 	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
132 #endif
133 
134 /* XS_INTERNAL is the explicit static-linkage variant of the default
135  * XS macro.
136  *
137  * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
138  * "STATIC", ie. it exports XSUB symbols. You probably don't want that
139  * for anything but the BOOT XSUB.
140  *
141  * See XSUB.h in core!
142  */
143 
144 
145 /* TODO: This might be compatible further back than 5.10.0. */
146 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
147 #  undef XS_EXTERNAL
148 #  undef XS_INTERNAL
149 #  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
150 #    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
151 #    define XS_INTERNAL(name) STATIC XSPROTO(name)
152 #  endif
153 #  if defined(__SYMBIAN32__)
154 #    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
155 #    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
156 #  endif
157 #  ifndef XS_EXTERNAL
158 #    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
159 #      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
160 #      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
161 #    else
162 #      ifdef __cplusplus
163 #        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
164 #        define XS_INTERNAL(name) static XSPROTO(name)
165 #      else
166 #        define XS_EXTERNAL(name) XSPROTO(name)
167 #        define XS_INTERNAL(name) STATIC XSPROTO(name)
168 #      endif
169 #    endif
170 #  endif
171 #endif
172 
173 /* perl >= 5.10.0 && perl <= 5.15.1 */
174 
175 
176 /* The XS_EXTERNAL macro is used for functions that must not be static
177  * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
178  * macro defined, the best we can do is assume XS is the same.
179  * Dito for XS_INTERNAL.
180  */
181 #ifndef XS_EXTERNAL
182 #  define XS_EXTERNAL(name) XS(name)
183 #endif
184 #ifndef XS_INTERNAL
185 #  define XS_INTERNAL(name) XS(name)
186 #endif
187 
188 /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
189  * internal macro that we're free to redefine for varying linkage due
190  * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
191  * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
192  */
193 
194 #undef XS_EUPXS
195 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
196 #  define XS_EUPXS(name) XS_EXTERNAL(name)
197 #else
198    /* default to internal */
199 #  define XS_EUPXS(name) XS_INTERNAL(name)
200 #endif
201 
202 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
203 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
204 
205 /* prototype to pass -Wmissing-prototypes */
206 STATIC void
207 S_croak_xs_usage(const CV *const cv, const char *const params);
208 
209 STATIC void
210 S_croak_xs_usage(const CV *const cv, const char *const params)
211 {
212     const GV *const gv = CvGV(cv);
213 
214     PERL_ARGS_ASSERT_CROAK_XS_USAGE;
215 
216     if (gv) {
217         const char *const gvname = GvNAME(gv);
218         const HV *const stash = GvSTASH(gv);
219         const char *const hvname = stash ? HvNAME(stash) : NULL;
220 
221         if (hvname)
222 	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
223         else
224 	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
225     } else {
226         /* Pants. I don't think that it should be possible to get here. */
227 	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
228     }
229 }
230 #undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
231 
232 #define croak_xs_usage        S_croak_xs_usage
233 
234 #endif
235 
236 /* NOTE: the prototype of newXSproto() is different in versions of perls,
237  * so we define a portable version of newXSproto()
238  */
239 #ifdef newXS_flags
240 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
241 #else
242 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
243 #endif /* !defined(newXS_flags) */
244 
245 #if PERL_VERSION_LE(5, 21, 5)
246 #  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
247 #else
248 #  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
249 #endif
250 
251 #line 252 "Project.c"
252 
253 XS_EUPXS(XS_Sun__Solaris__Project_getprojid); /* prototype to pass -Wmissing-prototypes */
254 XS_EUPXS(XS_Sun__Solaris__Project_getprojid)
255 {
256     dVAR; dXSARGS;
257     if (items != 0)
258        croak_xs_usage(cv,  "");
259     {
260 	projid_t	RETVAL;
261 	dXSTARG;
262 
263 	RETVAL = getprojid();
264 	XSprePUSH;
265 	PUSHi((IV)RETVAL);
266     }
267     XSRETURN(1);
268 }
269 
270 
271 XS_EUPXS(XS_Sun__Solaris__Project_setproject); /* prototype to pass -Wmissing-prototypes */
272 XS_EUPXS(XS_Sun__Solaris__Project_setproject)
273 {
274     dVAR; dXSARGS;
275     if (items != 3)
276        croak_xs_usage(cv,  "name, user_name, flags");
277     {
278 	const char *	name = (const char *)SvPV_nolen(ST(0))
279 ;
280 	const char *	user_name = (const char *)SvPV_nolen(ST(1))
281 ;
282 	uint_t	flags = (uint_t)SvUV(ST(2))
283 ;
284 	int	RETVAL;
285 	dXSTARG;
286 
287 	RETVAL = setproject(name, user_name, flags);
288 	XSprePUSH;
289 	PUSHi((IV)RETVAL);
290     }
291     XSRETURN(1);
292 }
293 
294 
295 XS_EUPXS(XS_Sun__Solaris__Project_activeprojects); /* prototype to pass -Wmissing-prototypes */
296 XS_EUPXS(XS_Sun__Solaris__Project_activeprojects)
297 {
298     dVAR; dXSARGS;
299     if (items != 0)
300        croak_xs_usage(cv,  "");
301     PERL_UNUSED_VAR(ax); /* -Wall */
302     SP -= items;
303     {
304 #line 160 "Project.xs"
305 	int	nitems;
306 #line 307 "Project.c"
307 #line 162 "Project.xs"
308 	PUTBACK;
309 	nitems = 0;
310 	project_walk(&pwalk_cb, (void*)&nitems);
311 	XSRETURN(nitems);
312 #line 313 "Project.c"
313 	PUTBACK;
314 	return;
315     }
316 }
317 
318 
319 XS_EUPXS(XS_Sun__Solaris__Project_getprojent); /* prototype to pass -Wmissing-prototypes */
320 XS_EUPXS(XS_Sun__Solaris__Project_getprojent)
321 {
322     dVAR; dXSARGS;
323     if (items != 0)
324        croak_xs_usage(cv,  "");
325     PERL_UNUSED_VAR(ax); /* -Wall */
326     SP -= items;
327     {
328 #line 170 "Project.xs"
329 	struct project	proj, *projp;
330 	char		buf[PROJECT_BUFSZ];
331 #line 332 "Project.c"
332 #line 173 "Project.xs"
333 	PUTBACK;
334 	if ((projp = getprojent(&proj, buf, sizeof (buf)))) {
335 		XSRETURN(pushret_project(projp));
336 	} else {
337 		XSRETURN_EMPTY;
338 	}
339 #line 340 "Project.c"
340 	PUTBACK;
341 	return;
342     }
343 }
344 
345 
346 XS_EUPXS(XS_Sun__Solaris__Project_setprojent); /* prototype to pass -Wmissing-prototypes */
347 XS_EUPXS(XS_Sun__Solaris__Project_setprojent)
348 {
349     dVAR; dXSARGS;
350     if (items != 0)
351        croak_xs_usage(cv,  "");
352     {
353 
354 	setprojent();
355     }
356     XSRETURN_EMPTY;
357 }
358 
359 
360 XS_EUPXS(XS_Sun__Solaris__Project_endprojent); /* prototype to pass -Wmissing-prototypes */
361 XS_EUPXS(XS_Sun__Solaris__Project_endprojent)
362 {
363     dVAR; dXSARGS;
364     if (items != 0)
365        croak_xs_usage(cv,  "");
366     {
367 
368 	endprojent();
369     }
370     XSRETURN_EMPTY;
371 }
372 
373 
374 XS_EUPXS(XS_Sun__Solaris__Project_getprojbyname); /* prototype to pass -Wmissing-prototypes */
375 XS_EUPXS(XS_Sun__Solaris__Project_getprojbyname)
376 {
377     dVAR; dXSARGS;
378     if (items != 1)
379        croak_xs_usage(cv,  "name");
380     PERL_UNUSED_VAR(ax); /* -Wall */
381     SP -= items;
382     {
383 	char *	name = (char *)SvPV_nolen(ST(0))
384 ;
385 #line 190 "Project.xs"
386 	struct project	proj, *projp;
387 	char		buf[PROJECT_BUFSZ];
388 #line 389 "Project.c"
389 #line 193 "Project.xs"
390 	PUTBACK;
391 	if ((projp = getprojbyname(name, &proj, buf, sizeof (buf)))) {
392 		XSRETURN(pushret_project(projp));
393 	} else {
394 		XSRETURN_EMPTY;
395 	}
396 #line 397 "Project.c"
397 	PUTBACK;
398 	return;
399     }
400 }
401 
402 
403 XS_EUPXS(XS_Sun__Solaris__Project_getprojbyid); /* prototype to pass -Wmissing-prototypes */
404 XS_EUPXS(XS_Sun__Solaris__Project_getprojbyid)
405 {
406     dVAR; dXSARGS;
407     if (items != 1)
408        croak_xs_usage(cv,  "id");
409     PERL_UNUSED_VAR(ax); /* -Wall */
410     SP -= items;
411     {
412 	projid_t	id = (projid_t)SvIV(ST(0))
413 ;
414 #line 204 "Project.xs"
415 	struct project	proj, *projp;
416 	char		buf[PROJECT_BUFSZ];
417 #line 418 "Project.c"
418 #line 207 "Project.xs"
419 	PUTBACK;
420 	if ((projp = getprojbyid(id, &proj, buf, sizeof (buf)))) {
421 		XSRETURN(pushret_project(projp));
422 	} else {
423 		XSRETURN_EMPTY;
424 	}
425 #line 426 "Project.c"
426 	PUTBACK;
427 	return;
428     }
429 }
430 
431 
432 XS_EUPXS(XS_Sun__Solaris__Project_getdefaultproj); /* prototype to pass -Wmissing-prototypes */
433 XS_EUPXS(XS_Sun__Solaris__Project_getdefaultproj)
434 {
435     dVAR; dXSARGS;
436     if (items != 1)
437        croak_xs_usage(cv,  "user");
438     PERL_UNUSED_VAR(ax); /* -Wall */
439     SP -= items;
440     {
441 	char *	user = (char *)SvPV_nolen(ST(0))
442 ;
443 #line 218 "Project.xs"
444 	struct project	proj, *projp;
445 	char		buf[PROJECT_BUFSZ];
446 #line 447 "Project.c"
447 #line 221 "Project.xs"
448 	PUTBACK;
449 	if ((projp = getdefaultproj(user, &proj, buf, sizeof (buf)))) {
450 		XSRETURN(pushret_project(projp));
451 	} else {
452 		XSRETURN_EMPTY;
453 	}
454 #line 455 "Project.c"
455 	PUTBACK;
456 	return;
457     }
458 }
459 
460 
461 XS_EUPXS(XS_Sun__Solaris__Project_fgetprojent); /* prototype to pass -Wmissing-prototypes */
462 XS_EUPXS(XS_Sun__Solaris__Project_fgetprojent)
463 {
464     dVAR; dXSARGS;
465     if (items != 1)
466        croak_xs_usage(cv,  "fh");
467     PERL_UNUSED_VAR(ax); /* -Wall */
468     SP -= items;
469     {
470 	FILE *	fh = PerlIO_findFILE(IoIFP(sv_2io(ST(0))))
471 ;
472 #line 232 "Project.xs"
473 	struct project	proj, *projp;
474 	char		buf[PROJECT_BUFSZ];
475 #line 476 "Project.c"
476 #line 235 "Project.xs"
477 	PUTBACK;
478 	if ((projp = fgetprojent(fh, &proj, buf, sizeof (buf)))) {
479 		XSRETURN(pushret_project(projp));
480 	} else {
481 		XSRETURN_EMPTY;
482 	}
483 #line 484 "Project.c"
484 	PUTBACK;
485 	return;
486     }
487 }
488 
489 
490 XS_EUPXS(XS_Sun__Solaris__Project_inproj); /* prototype to pass -Wmissing-prototypes */
491 XS_EUPXS(XS_Sun__Solaris__Project_inproj)
492 {
493     dVAR; dXSARGS;
494     if (items != 2)
495        croak_xs_usage(cv,  "user, proj");
496     {
497 	char *	user = (char *)SvPV_nolen(ST(0))
498 ;
499 	char *	proj = (char *)SvPV_nolen(ST(1))
500 ;
501 #line 247 "Project.xs"
502 	char	buf[PROJECT_BUFSZ];
503 #line 504 "Project.c"
504 	bool	RETVAL;
505 #line 249 "Project.xs"
506 	RETVAL = inproj(user, proj, buf, sizeof (buf));
507 #line 508 "Project.c"
508 	ST(0) = boolSV(RETVAL);
509     }
510     XSRETURN(1);
511 }
512 
513 
514 XS_EUPXS(XS_Sun__Solaris__Project_getprojidbyname); /* prototype to pass -Wmissing-prototypes */
515 XS_EUPXS(XS_Sun__Solaris__Project_getprojidbyname)
516 {
517     dVAR; dXSARGS;
518     if (items != 1)
519        croak_xs_usage(cv,  "proj");
520     PERL_UNUSED_VAR(ax); /* -Wall */
521     SP -= items;
522     {
523 	char *	proj = (char *)SvPV_nolen(ST(0))
524 ;
525 #line 258 "Project.xs"
526 	int	id;
527 #line 528 "Project.c"
528 	int	RETVAL;
529 	dXSTARG;
530 #line 260 "Project.xs"
531 	if ((id = getprojidbyname(proj)) == -1) {
532 		XSRETURN_UNDEF;
533 	} else {
534 		XSRETURN_IV(id);
535 	}
536 #line 537 "Project.c"
537 	PUTBACK;
538 	return;
539     }
540 }
541 
542 
543 XS_EUPXS(XS_Sun__Solaris__Project_rctl_get_info); /* prototype to pass -Wmissing-prototypes */
544 XS_EUPXS(XS_Sun__Solaris__Project_rctl_get_info)
545 {
546     dVAR; dXSARGS;
547     if (items != 1)
548        croak_xs_usage(cv,  "name");
549     PERL_UNUSED_VAR(ax); /* -Wall */
550     SP -= items;
551     {
552 	char *	name = (char *)SvPV_nolen(ST(0))
553 ;
554 #line 279 "Project.xs"
555 	rctlblk_t *blk1 = NULL;
556 	rctlblk_t *blk2 = NULL;
557 	rctlblk_t *tmp = NULL;
558 	rctl_priv_t priv;
559 	rctl_qty_t value;
560 	int flags = 0;
561 	int ret;
562 	int err = 0;
563 	char string[24];	/* 24 will always hold a uint64_t */
564 #line 565 "Project.c"
565 #line 289 "Project.xs"
566 	Newc(0, blk1, rctlblk_size(), char, rctlblk_t);
567 	if (blk1 == NULL) {
568 		err = 1;
569 		goto out;
570 	}
571 	Newc(1, blk2, rctlblk_size(), char, rctlblk_t);
572 	if (blk2 == NULL) {
573 		err = 1;
574 		goto out;
575 	}
576 	ret = getrctl(name, NULL, blk1, RCTL_FIRST);
577 	if (ret != 0) {
578 		err = 1;
579 		goto out;
580 	}
581 	priv = rctlblk_get_privilege(blk1);
582 	while (priv != RCPRIV_SYSTEM) {
583 		tmp = blk2;
584 		blk2 = blk1;
585 		blk1 = tmp;
586 		ret = getrctl(name, blk2, blk1, RCTL_NEXT);
587 		if (ret != 0) {
588 			err = 1;
589 			goto out;
590 		}
591 		priv = rctlblk_get_privilege(blk1);
592 	}
593 	value = rctlblk_get_value(blk1);
594 	flags = rctlblk_get_global_flags(blk1);
595 	ret = sprintf(string, "%llu", value);
596 	if (ret <= 0) {
597 		err = 1;
598 	}
599 	out:
600 	if (blk1)
601 		Safefree(blk1);
602 	if (blk2)
603 		Safefree(blk2);
604 	if (err)
605 		XSRETURN(0);
606 
607 	XPUSHs(sv_2mortal(newSVpv(string, 0)));
608 	XPUSHs(sv_2mortal(newSViv(flags)));
609 	XSRETURN(2);
610 #line 611 "Project.c"
611 	PUTBACK;
612 	return;
613     }
614 }
615 
616 
617 XS_EUPXS(XS_Sun__Solaris__Project_pool_exists); /* prototype to pass -Wmissing-prototypes */
618 XS_EUPXS(XS_Sun__Solaris__Project_pool_exists)
619 {
620     dVAR; dXSARGS;
621     if (items != 1)
622        croak_xs_usage(cv,  "name");
623     PERL_UNUSED_VAR(ax); /* -Wall */
624     SP -= items;
625     {
626 	char *	name = (char *)SvPV_nolen(ST(0))
627 ;
628 #line 347 "Project.xs"
629 	pool_conf_t *conf;
630 	pool_t *pool;
631 	pool_status_t status;
632 	int fd;
633 #line 634 "Project.c"
634 #line 353 "Project.xs"
635 	/*
636 	 * Determine if pools are enabled using /dev/pool directly, as
637 	 * libpool may not be present.
638 	 */
639 	if (getzoneid() != GLOBAL_ZONEID) {
640 		XSRETURN_IV(1);
641 	}
642 	if ((fd = open("/dev/pool", O_RDONLY)) < 0) {
643 		XSRETURN_IV(1);
644 	}
645 	if (ioctl(fd, POOL_STATUSQ, &status) < 0) {
646 		(void) close(fd);
647 		XSRETURN_IV(1);
648 	}
649 	close(fd);
650 	if (status.ps_io_state != 1) {
651 		XSRETURN_IV(1);
652 	}
653 
654 	/*
655 	 * If pools are enabled, assume libpool is present.
656 	 */
657 	conf = pool_conf_alloc();
658 	if (conf == NULL) {
659 		XSRETURN_IV(1);
660 	}
661 	if (pool_conf_open(conf, pool_dynamic_location(), PO_RDONLY)) {
662 		pool_conf_free(conf);
663 		XSRETURN_IV(1);
664 	}
665 	pool = pool_get_pool(conf, name);
666 	if (pool == NULL) {
667 		pool_conf_close(conf);
668 		pool_conf_free(conf);
669 		XSRETURN_IV(1);
670 	}
671 	pool_conf_close(conf);
672 	pool_conf_free(conf);
673 	XSRETURN_IV(0);
674 #line 675 "Project.c"
675 	PUTBACK;
676 	return;
677     }
678 }
679 
680 #ifdef __cplusplus
681 extern "C"
682 #endif
683 XS_EXTERNAL(boot_Sun__Solaris__Project); /* prototype to pass -Wmissing-prototypes */
684 XS_EXTERNAL(boot_Sun__Solaris__Project)
685 {
686 #if PERL_VERSION_LE(5, 21, 5)
687     dVAR; dXSARGS;
688 #else
689     dVAR; dXSBOOTARGSXSAPIVERCHK;
690 #endif
691 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
692     char* file = __FILE__;
693 #else
694     const char* file = __FILE__;
695 #endif
696 
697     PERL_UNUSED_VAR(file);
698 
699     PERL_UNUSED_VAR(cv); /* -W */
700     PERL_UNUSED_VAR(items); /* -W */
701 #if PERL_VERSION_LE(5, 21, 5)
702     XS_VERSION_BOOTCHECK;
703 #  ifdef XS_APIVERSION_BOOTCHECK
704     XS_APIVERSION_BOOTCHECK;
705 #  endif
706 #endif
707 
708         (void)newXSproto_portable("Sun::Solaris::Project::getprojid", XS_Sun__Solaris__Project_getprojid, file, "");
709         (void)newXSproto_portable("Sun::Solaris::Project::setproject", XS_Sun__Solaris__Project_setproject, file, "$$$");
710         (void)newXSproto_portable("Sun::Solaris::Project::activeprojects", XS_Sun__Solaris__Project_activeprojects, file, "");
711         (void)newXSproto_portable("Sun::Solaris::Project::getprojent", XS_Sun__Solaris__Project_getprojent, file, "");
712         (void)newXSproto_portable("Sun::Solaris::Project::setprojent", XS_Sun__Solaris__Project_setprojent, file, "");
713         (void)newXSproto_portable("Sun::Solaris::Project::endprojent", XS_Sun__Solaris__Project_endprojent, file, "");
714         (void)newXSproto_portable("Sun::Solaris::Project::getprojbyname", XS_Sun__Solaris__Project_getprojbyname, file, "$");
715         (void)newXSproto_portable("Sun::Solaris::Project::getprojbyid", XS_Sun__Solaris__Project_getprojbyid, file, "$");
716         (void)newXSproto_portable("Sun::Solaris::Project::getdefaultproj", XS_Sun__Solaris__Project_getdefaultproj, file, "$");
717         (void)newXSproto_portable("Sun::Solaris::Project::fgetprojent", XS_Sun__Solaris__Project_fgetprojent, file, "$");
718         (void)newXSproto_portable("Sun::Solaris::Project::inproj", XS_Sun__Solaris__Project_inproj, file, "$$");
719         (void)newXSproto_portable("Sun::Solaris::Project::getprojidbyname", XS_Sun__Solaris__Project_getprojidbyname, file, "$");
720         (void)newXSproto_portable("Sun::Solaris::Project::rctl_get_info", XS_Sun__Solaris__Project_rctl_get_info, file, "$");
721         (void)newXSproto_portable("Sun::Solaris::Project::pool_exists", XS_Sun__Solaris__Project_pool_exists, file, "$");
722 
723     /* Initialisation Section */
724 
725 #line 108 "Project.xs"
726 	{
727 	HV *stash;
728 	char buf[128];
729 	stash = gv_stashpv("Sun::Solaris::Project", TRUE);
730 	newCONSTSUB(stash, "MAXPROJID", newSViv(MAXPROJID));
731 	newCONSTSUB(stash, "PROJNAME_MAX", newSViv(PROJNAME_MAX));
732 	newCONSTSUB(stash, "PROJF_PATH",
733 	    newSVpv(PROJF_PATH, sizeof (PROJF_PATH) - 1));
734 	newCONSTSUB(stash, "PROJECT_BUFSZ", newSViv(PROJECT_BUFSZ));
735 	newCONSTSUB(stash, "SETPROJ_ERR_TASK", newSViv(SETPROJ_ERR_TASK));
736 	newCONSTSUB(stash, "SETPROJ_ERR_POOL", newSViv(SETPROJ_ERR_POOL));
737 	newCONSTSUB(stash, "RCTL_GLOBAL_NOBASIC",
738 		newSViv(RCTL_GLOBAL_NOBASIC));
739 	newCONSTSUB(stash, "RCTL_GLOBAL_LOWERABLE",
740 		newSViv(RCTL_GLOBAL_LOWERABLE));
741 	newCONSTSUB(stash, "RCTL_GLOBAL_DENY_ALWAYS",
742 		newSViv(RCTL_GLOBAL_DENY_ALWAYS));
743 	newCONSTSUB(stash, "RCTL_GLOBAL_DENY_NEVER",
744 		newSViv(RCTL_GLOBAL_DENY_NEVER));
745 	newCONSTSUB(stash, "RCTL_GLOBAL_FILE_SIZE",
746 		newSViv(RCTL_GLOBAL_FILE_SIZE));
747 	newCONSTSUB(stash, "RCTL_GLOBAL_CPU_TIME",
748 		newSViv(RCTL_GLOBAL_CPU_TIME));
749 	newCONSTSUB(stash, "RCTL_GLOBAL_SIGNAL_NEVER",
750 		newSViv(RCTL_GLOBAL_SIGNAL_NEVER));
751 	newCONSTSUB(stash, "RCTL_GLOBAL_INFINITE",
752 		newSViv(RCTL_GLOBAL_INFINITE));
753 	newCONSTSUB(stash, "RCTL_GLOBAL_UNOBSERVABLE",
754 		newSViv(RCTL_GLOBAL_UNOBSERVABLE));
755 	newCONSTSUB(stash, "RCTL_GLOBAL_BYTES",
756 		newSViv(RCTL_GLOBAL_BYTES));
757 	newCONSTSUB(stash, "RCTL_GLOBAL_SECONDS",
758 		newSViv(RCTL_GLOBAL_SECONDS));
759 	newCONSTSUB(stash, "RCTL_GLOBAL_COUNT",
760 		newSViv(RCTL_GLOBAL_COUNT));
761 	sprintf(buf, "%llu", UINT64_MAX);
762 	newCONSTSUB(stash, "RCTL_MAX_VALUE",
763 		newSVpv(buf, strlen(buf)));
764 	}
765 
766 #line 767 "Project.c"
767 
768     /* End of Initialisation Section */
769 
770 #if PERL_VERSION_LE(5, 21, 5)
771 #  if PERL_VERSION_GE(5, 9, 0)
772     if (PL_unitcheckav)
773         call_list(PL_scopestack_ix, PL_unitcheckav);
774 #  endif
775     XSRETURN_YES;
776 #else
777     Perl_xs_boot_epilog(aTHX_ ax);
778 #endif
779 }
780 
781