xref: /titanic_50/usr/src/cmd/perl/contrib/Sun/Solaris/Task/Task.xs (revision 09a7bdb93cbf401ff747159a689c4eb367d01dba)
1 /*
2  * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
3  */
4 /*
5  * Task.xs contains XS wrappers for the task maniplulation functions.
6  */
7 
8 /* Solaris includes. */
9 #include <sys/task.h>
10 
11 /* Perl includes. */
12 #include "EXTERN.h"
13 #if __GNUC__ >= 5
14 #include "perl.h"
15 #else
16 #define _Thread_local
17 #include "perl.h"
18 #undef _Thread_local
19 #undef PERL_GET_CONTEXT
20 #undef PERL_SET_CONTEXT
21 #define PERL_GET_CONTEXT	PTHREAD_GETSPECIFIC(PL_thr_key)
22 #define PERL_SET_CONTEXT(t)	Perl_set_context((void*)t)
23 #endif
24 #include "XSUB.h"
25 
26 /*
27  * The XS code exported to perl is below here.  Note that the XS preprocessor
28  * has its own commenting syntax, so all comments from this point on are in
29  * that form.
30  */
31 
32 MODULE = Sun::Solaris::Task PACKAGE = Sun::Solaris::Task
33 PROTOTYPES: ENABLE
34 
35  #
36  # Define any constants that need to be exported.  By doing it this way we can
37  # avoid the overhead of using the DynaLoader package, and in addition constants
38  # defined using this mechanism are eligible for inlining by the perl
39  # interpreter at compile time.
40  #
41 BOOT:
42 	{
43 	HV *stash;
44 
45 	stash = gv_stashpv("Sun::Solaris::Task", TRUE);
46 	newCONSTSUB(stash, "TASK_NORMAL", newSViv(TASK_NORMAL));
47 	newCONSTSUB(stash, "TASK_FINAL", newSViv(TASK_FINAL));
48 	newCONSTSUB(stash, "TASK_PROJ_PURGE", newSViv(TASK_PROJ_PURGE));
49 	}
50 
51 taskid_t
52 settaskid(project, flags)
53 	projid_t	project
54 	int		flags
55 
56 taskid_t
57 gettaskid()
58 
59