SF.net SVN: gar:[24738] csw/mgar/pkg/lang-python/python/branches

cgrzemba at users.sourceforge.net cgrzemba at users.sourceforge.net
Sat Mar 21 14:23:56 CET 2015


Revision: 24738
          http://sourceforge.net/p/gar/code/24738
Author:   cgrzemba
Date:     2015-03-21 13:23:55 +0000 (Sat, 21 Mar 2015)
Log Message:
-----------
lang-python/python/branches/python-2.7-dtrace: attempt to build Python with dtrace probes

Modified Paths:
--------------
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/Makefile

Added Paths:
-----------
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/00-bits.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/04-solaris-64-bit.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/05-dtrace.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/11-closerange.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/13-pic-compile.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/14-py_db.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/15-get_wch.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/16-ossaudiodev.patch
    csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/18-osconf-long.patch

Modified: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/Makefile
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7/Makefile	2014-11-07 06:45:34 UTC (rev 24291)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/Makefile	2015-03-21 13:23:55 UTC (rev 24738)
@@ -34,7 +34,7 @@
 UPSTREAM_MASTER_SITES = http://python.org/ftp/python/
 UFILES_REGEX = $(VER)\.\d+
 
-PACKAGING_PLATFORMS = solaris9-i386 solaris9-sparc
+# PACKAGING_PLATFORMS = solaris9-i386 solaris9-sparc
 PACKAGING_PLATFORMS += solaris10-i386 solaris10-sparc
 
 DISTFILES  = $(DISTNAME).tar.xz
@@ -42,7 +42,7 @@
 
 # The test for sunaudiodev fails.  Not that it's a good practice to skip
 # tests.
-SKIPTEST_5.9 = 1
+# SKIPTEST_5.9 = 1
 SKIPTEST = $(SKIPTEST_$(GAROSREL))
 TEST_SCRIPTS = custom
 
@@ -52,8 +52,40 @@
 # A possible fix is to rename plat-linux to plat-<multiarch-tuple>
 # BUILD64 = 1
 
-GARCOMPILER	=	GNU
+# GARCOMPILER	=	GNU
+# if change this take note of CONFIGURE_ARGS += --without-gcc
+GARCOMPILER	=	SOS12U3
 # GARFLAVOR = DBG
+# remove fPIC for Studio compiler
+PATCHFILES += 00-bits.patch
+PATCHFILES += 04-solaris-64-bit.patch
+# This patch adds Python dtrace support.  Note it is necessary to modify
+# test_sys.py to add an integer to the frameobject structure size since this
+# patch adds "int f_calllineno" to the structure, so this test does not fail.
+# The patch comes from upstream:
+# http://www.jcea.es/artic/python_dtrace-2_7_7_af8ecf2352e1.txt
+# http://www.jcea.es/artic/python_dtrace.htm
+# Follow http://bugs.python.org/issue13405 for plans to get it
+# integrated into the main tree.
+PATCHFILES += 05-dtrace.patch
+# This patch uses fdwalk(3c) to close file descriptors; as that function is not
+# widely implemented, this is unsuitable for upstream.
+PATCHFILES += 11-closerange.patch 
+PATCHFILES += 13-pic-compile.patch
+# This patch adds Python debugger support.  It may be contributed upstream at
+# some point, but the suitability (or lack thereof) has not yet been determined.
+PATCHFILES += 14-py_db.patch 
+# This patch adds wget_wch support to the curses module.  It may be contributed
+# upstream at some point, but the suitability (or lack thereof) has not yet
+# been determined.
+PATCHFILES += 15-get_wch.patch
+# This patch is needed to make Python understand it can build the OSS plugin.  
+# Some OSS ioctls are not supported on Solaris, so they are ifdef'f out.  As
+# the patch is Solaris-specific, it is not suitable for upstream.
+PATCHFILES += 16-ossaudiodev.patch
+# http://bugs.python.org/issue17964 was fixed in 3.4 but not back-ported so we
+# need this patch for 2.7 .
+PATCHFILES += 18-osconf-long.patch
 
 EXTRA_INC += $(prefix)/bdb48/include
 EXTRA_LIB += $(prefix)/bdb48/lib
@@ -73,6 +105,7 @@
 LINKER_IGNORE =
 NOISALIST = 1
 CONFIGURE_ARGS  = $(DIRPATHS)
+CONFIGURE_ARGS += --without-gcc
 CONFIGURE_ARGS += --enable-shared
 CONFIGURE_ARGS += --enable-ipv6
 CONFIGURE_ARGS += --enable-unicode=ucs4

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/00-bits.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/00-bits.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/00-bits.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,28 @@
+#
+# This patch makes the pyconfig.h header file 32/64 bit friendly.
+# As it is Solaris-specific, it is not suitable for upstream.
+#
+--- Python-2.7.8/configure.ac.~1~	2014-06-29 19:05:48.000000000 -0700
++++ Python-2.7.8/configure.ac	2014-07-17 20:31:45.866247571 -0700
+@@ -5,7 +5,7 @@
+ # Set VERSION so we only need to edit in one place (i.e., here)
+ m4_define(PYTHON_VERSION, 2.7)
+ 
+-AC_PREREQ(2.65)
++AC_PREREQ(2.68)
+ 
+ AC_REVISION($Revision$)
+ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
+@@ -2092,12 +2092,6 @@
+ if test -z "$CCSHARED"
+ then
+ 	case $ac_sys_system/$ac_sys_release in
+-	SunOS*) if test "$GCC" = yes;
+-		then CCSHARED="-fPIC";
+-		elif test `uname -p` = sparc;
+-		then CCSHARED="-xcode=pic32";
+-		else CCSHARED="-Kpic";
+-		fi;;
+ 	hp*|HP*) if test "$GCC" = yes;
+ 		 then CCSHARED="-fPIC";
+ 		 else CCSHARED="+z";

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/04-solaris-64-bit.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/04-solaris-64-bit.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/04-solaris-64-bit.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,166 @@
+This patch ensures that 64-bit shared objects are in a subdirectory named
+"64".  Note that changes to the Lib/distutils/tests/test_build.py and
+Lib/distutils/tests/test_install.py avoid running tests that fail due to
+this patch.  As this is Solaris-specific, it is not suitable for upstream.
+
+--- Python-2.7.6/Lib/distutils/command/build_ext.py.~1~	2013-11-09 23:36:40.000000000 -0800
++++ Python-2.7.6/Lib/distutils/command/build_ext.py	2014-05-14 12:47:04.342901439 -0700
+@@ -634,6 +634,10 @@
+         filename = self.get_ext_filename(ext_name)
+         filename = os.path.split(filename)[-1]
+ 
++        # on Solaris we put 64-bit python objects under .../64
++        if sys.maxint != 2147483647L:
++            filename = os.path.join("64", filename)
++
+         if not self.inplace:
+             # no further work needed
+             # returning :
+@@ -674,7 +678,14 @@
+         so_ext = get_config_var('SO')
+         if os.name == 'nt' and self.debug:
+             return os.path.join(*ext_path) + '_d' + so_ext
+-        return os.path.join(*ext_path) + so_ext
++        #return os.path.join(*ext_path) + so_ext
++	# .so extensions are word-size specific
++        path = apply(os.path.join, ext_path)
++        if sys.maxint == 2147483647L:
++            return path + so_ext
++        dirname = os.path.dirname(path);
++        basename = os.path.basename(path);
++        return os.path.join(dirname, "64", basename + so_ext)
+ 
+     def get_export_symbols (self, ext):
+         """Return the list of symbols that a shared extension has to
+--- Python-2.7.6/Python/import.c.~1~	2013-11-09 23:36:41.000000000 -0800
++++ Python-2.7.6/Python/import.c	2014-05-14 12:53:34.233016586 -0700
+@@ -1288,6 +1288,57 @@
+ static int find_init_module(char *); /* Forward */
+ static struct filedescr importhookdescr = {"", "", IMP_HOOK};
+ 
++#ifdef HAVE_STAT
++static char *
++insert_64dir(char *buf, size_t buflen)
++{
++       char *base;
++       char *cp;
++       size_t blen;
++
++       if ((blen = strlen(buf)) == 0)
++               return (NULL);
++
++       cp = &buf[blen - 1];
++       while (cp != buf && *cp != SEP)
++               cp--;
++
++       if (cp != buf)
++               cp++;
++
++       if (blen + strlen("64/") + 1 >= buflen)
++               return NULL;
++
++       base = strdup(cp);
++       sprintf(cp, "64%c%s", SEP, base);
++       free(base);
++
++       return buf;
++}
++
++/*
++ * If we're on a 64-bit platform, modify lookups for shared object files.
++ */
++static size_t modify_path(struct filedescr *fdp, char *buf, size_t buflen)
++{
++       struct stat statbuf;
++
++       if (sizeof(void *) != 8)
++               return 0;
++
++       if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
++               return 0;
++
++       if (fdp->type != C_EXTENSION)
++               return 0;
++
++       if (insert_64dir(buf, buflen) == NULL)
++               return 0;
++
++       return strlen("64/");
++}
++#endif
++
+ static struct filedescr *
+ find_module(char *fullname, char *subname, PyObject *path, char *buf,
+             size_t buflen, FILE **p_fp, PyObject **p_loader)
+@@ -1302,11 +1353,10 @@
+     static struct filedescr fd_builtin = {"", "", C_BUILTIN};
+     static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
+     char *name;
+-#if defined(PYOS_OS2)
+     size_t saved_len;
+     size_t saved_namelen;
+     char *saved_buf = NULL;
+-#endif
++
+     if (p_loader != NULL)
+         *p_loader = NULL;
+ 
+@@ -1513,15 +1563,17 @@
+                 }
+             }
+         }
+-#if defined(PYOS_OS2)
+         /* take a snapshot of the module spec for restoration
+          * after the 8 character DLL hackery
+          */
+         saved_buf = strdup(buf);
+         saved_len = len;
+         saved_namelen = namelen;
+-#endif /* PYOS_OS2 */
++
+         for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
++#ifdef HAVE_STAT
++            len += modify_path(fdp, buf, buflen);
++#endif
+ #if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
+             /* OS/2 limits DLLs to 8 character names (w/o
+                extension)
+@@ -1562,21 +1614,20 @@
+                     fp = NULL;
+                 }
+             }
+-#if defined(PYOS_OS2)
++
+             /* restore the saved snapshot */
+             strcpy(buf, saved_buf);
+             len = saved_len;
+             namelen = saved_namelen;
+-#endif
+         }
+-#if defined(PYOS_OS2)
++
+         /* don't need/want the module name snapshot anymore */
+         if (saved_buf)
+         {
+             free(saved_buf);
+             saved_buf = NULL;
+         }
+-#endif
++
+         Py_XDECREF(copy);
+         if (fp != NULL)
+             break;
+--- Python-2.7.1/Python/importdl.h.orig	Fri Jul 15 15:48:16 2011
++++ Python-2.7.1/Python/importdl.h	Fri Jul 15 15:49:10 2011
+@@ -31,8 +31,9 @@
+ extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
+                                              FILE *);
+ 
+-/* Max length of module suffix searched for -- accommodates "module.slb" */
+-#define MAXSUFFIXSIZE 12
++/* Max length of module suffix searched for -- accommodates "module.slb"
++   and '64/' */
++#define MAXSUFFIXSIZE 15
+ 
+ #ifdef MS_WINDOWS
+ #include <windows.h>

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/05-dtrace.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/05-dtrace.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/05-dtrace.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,421 @@
+--- Python-2.7.6/Makefile.pre.in.~1~	2013-11-09 23:36:41.000000000 -0800
++++ Python-2.7.6/Makefile.pre.in	2014-05-14 12:54:43.824219677 -0700
+@@ -218,6 +218,7 @@
+ # Used of signalmodule.o is not available
+ SIGNAL_OBJS=	@SIGNAL_OBJS@
+ 
++DTRACE_OBJS=Python/dtrace.o Python/phelper.o
+ 
+ ##########################################################################
+ # Grammar
+@@ -341,6 +342,7 @@
+ 		Python/formatter_unicode.o \
+ 		Python/formatter_string.o \
+ 		Python/$(DYNLOADFILE) \
++		$(DTRACE_OBJS) \
+ 		$(LIBOBJS) \
+ 		$(MACHDEP_OBJS) \
+ 		$(THREADOBJ)
+@@ -664,6 +666,18 @@
+ Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
+ 				$(STRINGLIB_HEADERS)
+ 
++Python/phelper.o: $(srcdir)/Python/phelper.d
++	dtrace -o $@ -DPHELPER $(DFLAGS) $(CPPFLAGS) -C -G -s $(srcdir)/Python/phelper.d
++
++Python/python.h: $(srcdir)/Python/python.d
++	dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Python/python.d
++
++Python/ceval.o: Python/ceval.c Python/python.h
++	$(CC) -c -I. -IPython $(BASECFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) $(CFLAGS) -DPy_BUILD_CORE -o $@ $<
++
++Python/dtrace.o: $(srcdir)/Python/python.d Python/ceval.o
++	dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Python/python.d Python/ceval.o
++
+ ############################################################################
+ # Header files
+ 
+--- Python-2.7.6/Include/frameobject.h.~1~	2013-11-09 23:36:39.000000000 -0800
++++ Python-2.7.6/Include/frameobject.h	2014-05-14 13:03:19.938777249 -0700
+@@ -44,6 +44,7 @@
+        PyCode_Addr2Line to calculate the line from the current
+        bytecode index. */
+     int f_lineno;		/* Current line number */
++    int f_calllineno;		/* line number of call site */
+     int f_iblock;		/* index in f_blockstack */
+     PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+     PyObject *f_localsplus[1];	/* locals+stack, dynamically sized */
+--- Python-2.7.6/Objects/frameobject.c.~1~	2013-11-09 23:36:41.000000000 -0800
++++ Python-2.7.6/Objects/frameobject.c	2014-05-14 12:56:06.970076859 -0700
+@@ -738,6 +738,7 @@
+     f->f_tstate = tstate;
+ 
+     f->f_lasti = -1;
++    f->f_calllineno = code->co_firstlineno;
+     f->f_lineno = code->co_firstlineno;
+     f->f_iblock = 0;
+ 
+--- Python-2.7.8/Python/ceval.c.~1~	2014-06-29 19:05:46.000000000 -0700
++++ Python-2.7.8/Python/ceval.c	2014-07-17 20:39:49.843868592 -0700
+@@ -19,6 +19,11 @@
+ 
+ #include <ctype.h>
+ 
++#define HAVE_DTRACE
++#ifdef HAVE_DTRACE
++#include "python.h"
++#endif
++
+ #ifndef WITH_TSC
+ 
+ #define READ_TIMESTAMP(var)
+@@ -678,6 +683,55 @@
+                       NULL);
+ }
+ 
++#ifdef HAVE_DTRACE
++static void
++dtrace_entry(PyFrameObject *f)
++{
++	const char *filename;
++	const char *fname;
++	int lineno;
++	
++	filename = PyString_AsString(f->f_code->co_filename);
++	fname = PyString_AsString(f->f_code->co_name);
++	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
++
++	PYTHON_FUNCTION_ENTRY((char *)filename, (char *)fname, lineno);
++
++	/*
++	 * Currently a USDT tail-call will not receive the correct arguments.
++	 * Disable the tail call here.
++	 */
++#if defined(__sparc)
++	asm("nop");
++#endif
++}
++
++static void
++dtrace_return(PyFrameObject *f)
++{
++	const char *filename;
++	const char *fname;
++	int lineno;
++	
++	filename = PyString_AsString(f->f_code->co_filename);
++	fname = PyString_AsString(f->f_code->co_name);
++	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
++	PYTHON_FUNCTION_RETURN((char *)filename, (char *)fname, lineno);
++
++	/*
++	 * Currently a USDT tail-call will not receive the correct arguments.
++	 * Disable the tail call here.
++	 */
++#if defined(__sparc)
++	asm("nop");
++#endif
++}
++#else
++#define	PYTHON_FUNCTION_ENTRY_ENABLED 0
++#define	PYTHON_FUNCTION_RETURN_ENABLED 0
++#define	dtrace_entry()
++#define	dtrace_return()
++#endif
+ 
+ /* Interpreter main loop */
+ 
+@@ -689,9 +743,84 @@
+     return PyEval_EvalFrameEx(f, 0);
+ }
+ 
++/*
++ * These shenanigans look like utter madness, but what we're actually doing is
++ * making sure that the ustack helper will see the PyFrameObject pointer on the
++ * stack. We have two tricky cases:
++ *
++ * amd64
++ *
++ * We use up the six registers for passing arguments, meaning the call can't
++ * use a register for passing 'f', and has to push it onto the stack in a known
++ * location.
++ *
++ * And how does "throwflag" figure in to this? -PN
++ *
++ * SPARC
++ *
++ * Here the problem is that (on 32-bit) the compiler is re-using %i0 before
++ * some calls inside PyEval_EvalFrameReal(), which means that when it's saved,
++ * it's just some junk value rather than the real first argument. So, instead,
++ * we trace our proxy PyEval_EvalFrame(), where we 'know' the compiler won't
++ * decide to re-use %i0. We also need to defeat optimization of our proxy.
++ */
++
++#if defined(HAVE_DTRACE)
++
++#if defined(__amd64)
++PyObject *PyEval_EvalFrameExReal(long, long, long, long, long, long,
++    PyFrameObject *, int throwflag);
++
++
++
++PyObject *
++PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
++{
++	volatile PyObject *f2;
++	f2 = PyEval_EvalFrameExReal(0, 0, 0, 0, 0, 0, f, throwflag);
++	return (PyObject *)f2;
++}
++
++PyObject *
++PyEval_EvalFrameExReal(long a1, long a2, long a3, long a4, long a5, long a6,
++    PyFrameObject *f, int throwflag)
++{
++
++#elif defined(__sparc)
++
++PyObject *PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag);
++
++volatile int dummy;
++
++PyObject *
++PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
++{
++	volatile PyObject *f2;
++	f2 = PyEval_EvalFrameExReal(f, throwflag);
++	dummy = f->ob_refcnt;
++	return (PyObject *)f2;
++}
++
++PyObject *
++PyEval_EvalFrameExReal(PyFrameObject *f, int throwflag)
++{
++
++#else /* __amd64 || __sparc */
++
+ PyObject *
+ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
+ {
++
++#endif /* __amd64 || __sparc */
++
++#else /* don't HAVE_DTRACE */
++
++PyObject *
++PyEval_EvalFrameexEx(PyFrameObject *f, int throwflag))
++{
++
++#endif /* HAVE_DTRACE */
++
+ #ifdef DXPAIRS
+     int lastopcode = 0;
+ #endif
+@@ -916,6 +1045,11 @@
+         }
+     }
+ 
++#ifdef HAVE_DTRACE
++    if (PYTHON_FUNCTION_ENTRY_ENABLED())
++        dtrace_entry(f);
++#endif
++
+     co = f->f_code;
+     names = co->co_names;
+     consts = co->co_consts;
+@@ -2673,6 +2807,9 @@
+             PyObject **sp;
+             PCALL(PCALL_ALL);
+             sp = stack_pointer;
++#ifdef HAVE_DTRACE
++            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
++#endif
+ #ifdef WITH_TSC
+             x = call_function(&sp, oparg, &intr0, &intr1);
+ #else
+@@ -2714,6 +2851,9 @@
+             } else
+                 Py_INCREF(func);
+             sp = stack_pointer;
++#ifdef HAVE_DTRACE
++            f->f_calllineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
++#endif
+             READ_TIMESTAMP(intr0);
+             x = ext_do_call(func, &sp, flags, na, nk);
+             READ_TIMESTAMP(intr1);
+@@ -3014,6 +3154,10 @@
+ 
+     /* pop frame */
+ exit_eval_frame:
++#ifdef HAVE_DTRACE
++    if (PYTHON_FUNCTION_RETURN_ENABLED())
++        dtrace_return(f);
++#endif
+     Py_LeaveRecursiveCall();
+     tstate->frame = f->f_back;
+ 
+--- /dev/null
++++ Python-2.6.4/Python/phelper.d
+@@ -0,0 +1,139 @@
++
++/*
++ * Python ustack helper.  This relies on the first argument (PyFrame *) being
++ * on the stack; see Python/ceval.c for the contortions we go through to ensure
++ * this is the case.
++ *
++ * On x86, the PyFrame * is two slots up from the frame pointer; on SPARC, it's
++ * eight.
++ */
++
++/*
++ * Yes, this is as gross as it looks. DTrace cannot handle static functions,
++ * and our stat_impl.h has them in ILP32.
++ */
++#define _SYS_STAT_H
++
++#include <stdio.h>
++#include <sys/types.h>
++
++#include "pyport.h"
++#include "object.h"
++#include "pystate.h"
++#include "pyarena.h"
++#include "pythonrun.h"
++#include "compile.h"
++#include "frameobject.h"
++#include "stringobject.h"
++
++#if defined(__i386)
++#define	startframe PyEval_EvalFrameEx
++#define	endframe PyEval_EvalCodeEx
++#elif defined(__amd64)
++#define	PyEval_EvalFrameEx PyEval_EvalFrameExReal
++#define	startframe PyEval_EvalFrameExReal
++#define	endframe PyEval_EvalCodeEx
++#elif defined(__sparc)
++#define	PyEval_EvalFrameEx PyEval_EvalFrameExReal
++#define	startframe PyEval_EvalFrameEx
++#define	endframe PyEval_EvalFrameExReal
++#endif
++
++#ifdef __sparcv9
++#define	STACK_BIAS (2048-1)
++#else
++#define	STACK_BIAS 0
++#endif
++
++/*
++ * Not defining PHELPER lets us test this code as a normal D script.
++ */
++#ifdef PHELPER
++
++#define	at_evalframe(addr) \
++    ((uintptr_t)addr >= ((uintptr_t)&``startframe) && \
++     (uintptr_t)addr < ((uintptr_t)&``endframe))
++#define	probe dtrace:helper:ustack:
++#define	print_result(r) (r)
++
++#if defined(__i386) || defined(__amd64)
++#define	frame_ptr_addr ((uintptr_t)arg1 + sizeof(uintptr_t) * 2)
++#elif defined(__sparc)
++#define	frame_ptr_addr ((uintptr_t)arg1 + STACK_BIAS + sizeof(uintptr_t) * 8)
++#else
++#error unknown architecture
++#endif
++
++#else /* PHELPER */
++
++#define	at_evalframe(addr) (1)
++#define	probe pid$target::PyEval_EvalFrame:entry
++#define print_result(r) (trace(r))
++
++#if defined(__i386) || defined(__amd64)
++#define	frame_ptr_addr ((uintptr_t)uregs[R_SP] + sizeof(uintptr_t))
++#elif defined(__sparc)
++/*
++ * Not implemented: we could just use R_I0, but what's the point?
++ */
++#else
++#error unknown architecture
++#endif
++
++#endif /* PHELPER */
++
++extern uintptr_t PyEval_EvalFrameEx;
++extern uintptr_t PyEval_EvalCodeEx;
++
++#define	copyin_obj(addr, obj) ((obj *)copyin((uintptr_t)addr, sizeof(obj)))
++#define	pystr_addr(addr) ((char *)addr + offsetof(PyStringObject, ob_sval))
++#define	copyin_str(dest, addr, obj) \
++    (copyinto((uintptr_t)pystr_addr(addr), obj->ob_size, (dest)))
++#define	add_str(addr, obj) \
++    copyin_str(this->result + this->pos, addr, obj); \
++    this->pos += obj->ob_size; \
++    this->result[this->pos] = '\0';
++#define	add_digit(nr, div) ((nr / div) ? \
++    (this->result[this->pos++] = '0' + ((nr / div) % 10)) : \
++    (this->result[this->pos] = '\0'))
++#define	add_char(c) (this->result[this->pos++] = c)
++
++probe /at_evalframe(arg0)/ 
++{
++	this->framep = *(uintptr_t *)copyin(frame_ptr_addr, sizeof(uintptr_t));
++	this->frameo = copyin_obj(this->framep, PyFrameObject);
++	this->codep = this->frameo->f_code;
++	this->lineno = this->frameo->f_calllineno;
++	this->codeo = copyin_obj(this->codep, PyCodeObject);
++	this->filenamep = this->codeo->co_filename;
++	this->fnamep = this->codeo->co_name;
++	this->filenameo = copyin_obj(this->filenamep, PyStringObject);
++	this->fnameo = copyin_obj(this->fnamep, PyStringObject);
++
++	this->len = 1 + this->filenameo->ob_size + 1 + 5 + 2 +
++	    this->fnameo->ob_size + 1 + 1;
++
++	this->result = (char *)alloca(this->len);
++	this->pos = 0;
++
++	add_char('@');
++	add_str(this->filenamep, this->filenameo);
++	add_char(':');
++	add_digit(this->lineno, 10000);
++	add_digit(this->lineno, 1000);
++	add_digit(this->lineno, 100);
++	add_digit(this->lineno, 10);
++	add_digit(this->lineno, 1);
++	add_char(' ');
++	add_char('(');
++	add_str(this->fnamep, this->fnameo);
++	add_char(')');
++	this->result[this->pos] = '\0';
++
++	print_result(stringof(this->result));
++}
++
++probe /!at_evalframe(arg0)/
++{
++	NULL;
++}
+--- /dev/null
++++ Python-2.6.4/Python/python.d
+@@ -0,0 +1,10 @@
++provider python {
++	probe function__entry(const char *, const char *, int);
++	probe function__return(const char *, const char *, int);
++};
++
++#pragma D attributes Evolving/Evolving/Common provider python provider
++#pragma D attributes Private/Private/Common provider python module
++#pragma D attributes Private/Private/Common provider python function
++#pragma D attributes Evolving/Evolving/Common provider python name
++#pragma D attributes Evolving/Evolving/Common provider python args
+--- Python-2.7.7/Lib/test/test_sys.py.~1~	2014-05-31 11:58:39.000000000 -0700
++++ Python-2.7.7/Lib/test/test_sys.py	2014-06-02 10:44:39.318709539 -0700
+@@ -594,7 +594,7 @@
+         nfrees = len(x.f_code.co_freevars)
+         extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
+                  ncells + nfrees - 1
+-        check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
++        check(x, vsize('12P4i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
+         # function
+         def func(): pass
+         check(func, size('9P'))

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/11-closerange.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/11-closerange.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/11-closerange.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,40 @@
+--- Python-2.7.7/Modules/posixmodule.c.~1~	2014-05-31 11:58:40.000000000 -0700
++++ Python-2.7.7/Modules/posixmodule.c	2014-06-02 10:49:30.052826955 -0700
+@@ -6607,16 +6607,34 @@
+ "closerange(fd_low, fd_high)\n\n\
+ Closes all file descriptors in [fd_low, fd_high), ignoring errors.");
+ 
++static int
++close_func(void *lohi, int fd)
++{
++    int lo = ((int *)lohi)[0];
++    int hi = ((int *)lohi)[1];
++
++    if (fd >= hi)
++        return (1);
++    else if (fd >= lo)
++        close(fd);
++
++    return (0);
++}
++
+ static PyObject *
+ posix_closerange(PyObject *self, PyObject *args)
+ {
+     int fd_from, fd_to, i;
++    int lohi[2];
++
+     if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to))
+         return NULL;
+     Py_BEGIN_ALLOW_THREADS
+-    for (i = fd_from; i < fd_to; i++)
+-        if (_PyVerify_fd(i))
+-            close(i);
++
++    lohi[0] = fd_from;
++    lohi[1] = fd_to;
++    fdwalk(close_func, lohi);
++
+     Py_END_ALLOW_THREADS
+     Py_RETURN_NONE;
+ }

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/13-pic-compile.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/13-pic-compile.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/13-pic-compile.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,18 @@
+--- Python-2.7.6/Lib/distutils/sysconfig.py.~1~	2013-11-09 23:36:40.000000000 -0800
++++ Python-2.7.6/Lib/distutils/sysconfig.py	2014-05-14 13:33:21.453593946 -0700
+@@ -208,6 +208,15 @@
+         else:
+             archiver = ar + ' ' + ar_flags
+ 
++        # Force PIC compilation. Determine if GNU compiler or otherwise
++        # and set the PIC flag(s) accordingly. Defaults to Studio compiler.
++        out = os.popen(cc + ' --version 2>/dev/null', 'r')
++        out_string = out.read()
++        out.close()
++        result = re.search(' (\d+\.\d+(\.\d+)*)', out_string)
++        kpic_flags = "-fPIC -DPIC" if result else "-KPIC -DPIC"
++        cflags += ' ' + kpic_flags
++
+         cc_cmd = cc + ' ' + cflags
+         compiler.set_executables(
+             preprocessor=cpp,

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/14-py_db.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/14-py_db.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/14-py_db.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,1029 @@
+--- Python-2.7.7/Makefile.pre.in.~3~	2014-06-02 10:54:32.421086337 -0700
++++ Python-2.7.7/Makefile.pre.in	2014-06-02 10:54:32.438134113 -0700
+@@ -407,7 +407,7 @@
+ 
+ # Default target
+ all:		build_all
+-build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
++build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks build-py_db
+ 
+ # Compile a binary with gcc profile guided optimization.
+ profile-opt:
+@@ -778,6 +778,19 @@
+ 
+ $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
+ 
++SHLIB_FLAGS = -shared -fpic
++
++libpython2.7_db.so.1.0:        $(srcdir)/py_db/libpython27_db.c
++	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
++
++check_offset:  $(srcdir)/py_db/check_offsets.c
++	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $<
++
++build-py_db:   libpython2.7_db.so.1.0 check_offset
++
++install-py_db: libpython2.7_db.so.1.0 check_offset
++	$(INSTALL_SHARED) libpython2.7_db.so.1.0 $(DESTDIR)$(LIBDIR)
++	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
+ 
+ ######################################################################
+ 
+@@ -842,7 +855,7 @@
+ 		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
+ 
+ # Install everything
+-install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
++install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-py_db
+ 
+ # Install almost everything without disturbing previous versions
+ altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall \
+--- /dev/null
++++ Python-2.7.1/py_db/check_offsets.c
+@@ -0,0 +1,87 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++/*
++ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
++#include <stdio.h>
++
++#include <Python.h>
++#include <frameobject.h>
++
++#include "libpython27_db_32.h"
++
++#if 0
++#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
++#endif
++
++int
++main(void)
++{
++/*
++ * PyCodeObject co_name
++ * PyCodeObject co_filename
++ * PyCodeObject co_lnotab
++ * PyFrameObject f_back
++ * PyFrameObject f_code
++ * PyFrameObject f_lasti
++ * PyInterpreterState next
++ * PyInterpreterState tstate_head
++ * PyStringObject ob_sval
++ * PyStringObject ob_size
++ * PyThreadState frame
++ * PyThreadState next
++ */
++
++	printf("struct member: native 32\n");
++	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
++	    offsetof(PyCodeObject32, co_name));
++	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
++	    co_filename), offsetof(PyCodeObject32, co_filename));
++	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
++	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
++	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
++	    offsetof(PyFrameObject32, f_back));
++	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
++	    offsetof(PyFrameObject32, f_code));
++	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
++	    f_lasti), offsetof(PyFrameObject32, f_lasti));
++	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
++	    next), offsetof(PyInterpreterState32, next));
++	printf("PyInterpreterState tstate_head: %d %d\n",
++	    offsetof(PyInterpreterState, tstate_head),
++	    offsetof(PyInterpreterState32, tstate_head));
++	printf("PyStringObject ob_sval: %d %d\n", offsetof(PyStringObject,
++	    ob_sval), offsetof(PyStringObject32, ob_sval));
++	printf("PyStringObject ob_size: %d %d\n", offsetof(PyStringObject,
++	    ob_size), offsetof(PyStringObject32, ob_size));
++	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
++	    offsetof(PyThreadState32, frame));
++	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
++	    offsetof(PyThreadState32, next));
++
++	printf("\nObject sizes\n");
++	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
++	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
++	    sizeof (PyVarObject32));
++
++	return (0);
++}
+--- /dev/null
++++ Python-2.7.1/py_db/libpython27_db.c
+@@ -0,0 +1,654 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++/*
++ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++#include <gelf.h>
++
++#include <Python.h>
++#include <frameobject.h>
++
++#include "libpython27_db.h"
++#if defined(_LP64)
++#include "libpython27_db_32.h"
++#endif /* _LP64 */
++
++/*
++ * Because MDB always runs the debugger in the same datamodel as the target,
++ * only functions that are used by the procfs part of this interface (or shared
++ * between the two) are written as 64->32 aware.
++ */
++typedef struct pydb_arch_ops {
++	ssize_t	(*strobj_readdata)(pydb_agent_t *, uintptr_t, unsigned char *,
++	    size_t);
++	int	(*frameinfo)(pydb_agent_t *, uintptr_t, char *,
++	    size_t, char *, size_t, int *);
++} pydb_arch_ops_t;
++
++struct pydb_agent {
++	struct ps_prochandle *pdb_ph;
++	int pdb_vers;
++	int pdb_is_64bit;
++	int pdb_datamodel;
++	const pydb_arch_ops_t *pdb_ops;
++};
++
++typedef uintptr_t (*pdi_next_cb_t)(pydb_iter_t *);
++
++struct pydb_iter {
++	struct ps_prochandle *pdi_ph;
++	uintptr_t pdi_current;
++	pdi_next_cb_t pdi_nextf;
++};
++
++#define	LIBPYTHON	"libpython2.7.so"
++
++#define	MIN(x, y)	(((x) < (y)) ? (x) : (y))
++
++/* Generic interface to helper functions */
++static ssize_t pydb_strobj_readdata(pydb_agent_t *py, uintptr_t addr,
++    unsigned char *buf, size_t buf_len);
++static int pydb_getlno(pydb_agent_t *py, uintptr_t lnotab_addr, int firstline,
++    int lastinst);
++static int pydb_frameinfo(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno);
++
++/* datamodel specific implementation of helper functions */
++static ssize_t pydb_strobj_readdata_native(pydb_agent_t *py, uintptr_t addr,
++    unsigned char *buf, size_t buf_len);
++static int pydb_frameinfo_native(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno);
++
++#if defined (_LP64)
++static ssize_t pydb_strobj_readdata_32(pydb_agent_t *py, uintptr_t addr,
++    unsigned char *buf, size_t buf_len);
++static int pydb_frameinfo_32(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno);
++#endif /* _LP64 */
++
++static ssize_t pydb_strobj_readstr(pydb_agent_t *py, uintptr_t addr, char *buf,
++    size_t len);
++
++/* Iterator function next routines.  Plugable, configured by iterator init */
++static uintptr_t pydb_frame_iter_next(pydb_iter_t *iter);
++static uintptr_t pydb_interp_iter_next(pydb_iter_t *iter);
++static uintptr_t pydb_thread_iter_next(pydb_iter_t *iter);
++
++static const char *strbasename(const char *s);
++
++static const pydb_arch_ops_t arch_ops_native = {
++	.frameinfo = pydb_frameinfo_native,
++	.strobj_readdata = pydb_strobj_readdata_native,
++};
++
++#if defined (_LP64)
++static const pydb_arch_ops_t arch_ops_32 = {
++	.frameinfo = pydb_frameinfo_32,
++	.strobj_readdata = pydb_strobj_readdata_32,
++};
++#endif /* _LP64 */
++
++static const char *
++strbasename(const char *s)
++{
++	const char *p = strrchr(s, '/');
++
++	if (p == NULL)
++		return (s);
++
++	return (++p);
++}
++
++/* Agent creation / destruction routines */
++
++pydb_agent_t *
++pydb_agent_create(struct ps_prochandle *P, int vers)
++{
++	pydb_agent_t *py;
++	int datamodel;
++
++	if (vers != PYDB_VERSION) {
++		errno = ENOTSUP;
++		return (NULL);
++	}
++
++	if (ps_pdmodel(P, &datamodel) != PS_OK) {
++		return (NULL);
++	}
++
++	py = (pydb_agent_t *)malloc(sizeof (pydb_agent_t));
++	if (py == NULL) {
++		return (NULL);
++	}
++
++	py->pdb_ph = P;
++	py->pdb_vers = vers;
++	py->pdb_datamodel = datamodel;
++	py->pdb_is_64bit = 0;
++	py->pdb_ops = &arch_ops_native;
++
++#if defined (_LP64)
++	py->pdb_is_64bit = (datamodel == PR_MODEL_LP64);
++	if (!py->pdb_is_64bit) {
++		py->pdb_ops = &arch_ops_32;
++	}
++#endif /* _LP64 */
++
++	return (py);
++}
++
++void
++pydb_agent_destroy(pydb_agent_t *py)
++{
++	if (py == NULL) {
++		return;
++	}
++
++	free(py);
++}
++
++/* Helper functions */
++static int
++pydb_getlno(pydb_agent_t *py, uintptr_t lnotab_addr, int firstline,
++    int lastinst)
++{
++	unsigned char lnotab[4096];
++	ssize_t lnotab_len;
++	int addr, line;
++	int i;
++
++	lnotab_len = pydb_strobj_readdata(py, lnotab_addr, lnotab,
++	    sizeof (lnotab));
++	if (lnotab_len < 0) {
++		return (-1);
++	}
++
++	/*
++	 * Python's line number algorithm is arcane. See here for details:
++	 * http://svn.python.org/projects/python/trunk/Objects/lnotab_notes.txt
++	 */
++
++	line = firstline;
++	for (addr = i = 0; i < lnotab_len; i += 2) {
++		if (addr + lnotab[i] > lastinst) {
++			break;
++		}
++		addr += lnotab[i];
++		line += lnotab[i + 1];
++	}
++
++	return (line);
++}
++
++static ssize_t
++pydb_strobj_readdata(pydb_agent_t *py, uintptr_t addr, unsigned char *buf,
++    size_t buf_len)
++{
++	return (py->pdb_ops->strobj_readdata(py, addr, buf, buf_len));
++}
++
++static ssize_t
++pydb_strobj_readdata_native(pydb_agent_t *py, uintptr_t addr,
++    unsigned char *buf, size_t buf_len)
++{
++	PyStringObject sobj;
++	ssize_t obj_sz;
++	ssize_t read_sz;
++	psaddr_t straddr;
++
++	/*
++	 * PyStringObjects are variable size.  The size of the PyStringObject
++	 * struct is fixed, and known at compile time; however, the size of the
++	 * associated buffer is variable.  The char[1] element at the end of the
++	 * structure contains the string, and the ob_size of the PyStringObject
++	 * indicates how much extra space was allocated to contain the string
++	 * buffer at the object's tail.  Read in the fixed size portion of the
++	 * object first, and then read the contents of the data buffer into the
++	 * buffer passed by the caller.
++	 */
++
++	if (ps_pread(py->pdb_ph, addr, &sobj, sizeof (PyStringObject))
++	    != PS_OK) {
++		return (-1);
++	}
++
++	obj_sz = (ssize_t)PyString_GET_SIZE(&sobj);
++
++	read_sz = MIN(obj_sz, (ssize_t)buf_len);
++	straddr = (psaddr_t)(addr + offsetof(PyStringObject, ob_sval));
++
++	if (ps_pread(py->pdb_ph, straddr, buf, (size_t)read_sz) != PS_OK) {
++		return (-1);
++	}
++
++	return (read_sz);
++}
++
++#if defined(_LP64)
++static ssize_t
++pydb_strobj_readdata_32(pydb_agent_t *py, uintptr_t addr,
++    unsigned char *buf, size_t buf_len)
++{
++	PyStringObject32 sobj;
++	ssize_t obj_sz;
++	ssize_t read_sz;
++	psaddr_t straddr;
++
++	/*
++	 * PyStringObjects are variable size.  The size of the PyStringObject
++	 * struct is fixed, and known at compile time; however, the size of the
++	 * associated buffer is variable.  The char[1] element at the end of the
++	 * structure contains the string, and the ob_size of the PyStringObject
++	 * indicates how much extra space was allocated to contain the string
++	 * buffer at the object's tail.  Read in the fixed size portion of the
++	 * object first, and then read the contents of the data buffer into the
++	 * buffer passed by the caller.
++	 */
++
++	if (ps_pread(py->pdb_ph, addr, &sobj, sizeof (PyStringObject32))
++	    != PS_OK) {
++		return (-1);
++	}
++
++	obj_sz = (ssize_t)PyString_GET_SIZE32(&sobj);
++
++	read_sz = MIN(obj_sz, (ssize_t)buf_len);
++	straddr = (psaddr_t)(addr + offsetof(PyStringObject32, ob_sval));
++
++	if (ps_pread(py->pdb_ph, straddr, buf, (size_t)read_sz) != PS_OK) {
++		return (-1);
++	}
++
++	return (read_sz);
++}
++#endif /* _LP64 */
++
++/*
++ * Most Python PyStringObjects contain strings, as one would expect.  However,
++ * due to some sleazy hackery in parts of the Python code, some string objects
++ * are used as buffers for binary data.  In the general case,
++ * pydb_strobj_readstr() should be used to read strings out of string objects.
++ * It wraps pydb_strobj_readdata(), which should be used by callers only when
++ * trying to retrieve binary data.  (This routine does some string cleanup).
++ */
++static ssize_t
++pydb_strobj_readstr(pydb_agent_t *py, uintptr_t addr, char *buf,
++    size_t buf_len)
++{
++	ssize_t read_sz;
++
++	read_sz = pydb_strobj_readdata(py, addr, (unsigned char *)buf, buf_len);
++
++	if (read_sz >= 0) {
++		if (read_sz >= buf_len) {
++			read_sz = buf_len - 1;
++		}
++
++		buf[read_sz] = '\0';
++	}
++
++	return (read_sz);
++}
++
++
++static int
++pydb_frameinfo(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno)
++{
++	return (py->pdb_ops->frameinfo(py, addr, funcnm, funcnm_sz,
++	    filenm, filenm_sz, lineno));
++}
++
++static int
++pydb_frameinfo_native(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno)
++{
++	PyFrameObject fo;
++	PyCodeObject co;
++	ssize_t rc;
++
++	if (ps_pread(py->pdb_ph, addr, &fo, sizeof (PyFrameObject))
++	    != PS_OK) {
++		return (-1);
++	}
++
++	if (ps_pread(py->pdb_ph, (uintptr_t)fo.f_code, &co,
++	    sizeof (PyCodeObject)) != PS_OK) {
++		return (-1);
++	}
++
++	rc = pydb_strobj_readstr(py, (uintptr_t)co.co_name, funcnm, funcnm_sz);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	rc = pydb_strobj_readstr(py, (uintptr_t)co.co_filename, filenm,
++	    filenm_sz);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	*lineno = pydb_getlno(py, (uintptr_t)co.co_lnotab, co.co_firstlineno,
++	    fo.f_lasti);
++	if (*lineno < 0) {
++		return (-1);
++	}
++
++	return (0);
++}
++
++#if defined (_LP64)
++static int
++pydb_frameinfo_32(pydb_agent_t *py, uintptr_t addr, char *funcnm,
++    size_t funcnm_sz, char *filenm, size_t filenm_sz, int *lineno)
++{
++	PyFrameObject32 fo;
++	PyCodeObject32 co;
++	ssize_t rc;
++
++	if (ps_pread(py->pdb_ph, addr, &fo, sizeof (PyFrameObject32))
++	    != PS_OK) {
++		return (-1);
++	}
++
++	if (ps_pread(py->pdb_ph, (uintptr_t)fo.f_code, &co,
++	    sizeof (PyCodeObject32)) != PS_OK) {
++		return (-1);
++	}
++
++	rc = pydb_strobj_readstr(py, (uintptr_t)co.co_name, funcnm, funcnm_sz);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	rc = pydb_strobj_readstr(py, (uintptr_t)co.co_filename, filenm,
++	    filenm_sz);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	*lineno = pydb_getlno(py, (uintptr_t)co.co_lnotab, co.co_firstlineno,
++	    fo.f_lasti);
++	if (*lineno < 0) {
++		return (-1);
++	}
++
++	return (0);
++}
++
++#endif /* _LP64 */
++
++/* Functions that are part of the library's interface */
++
++/*
++ * Given the address of a PyFrameObject, and a buffer of a known size,
++ * fill the buffer with a description of the frame.
++ */
++int
++pydb_get_frameinfo(pydb_agent_t *py, uintptr_t frame_addr, char *fbuf,
++    size_t bufsz, int verbose)
++{
++	char funcname[1024];
++	char filename[1024];
++	char *fn;
++	int lineno;
++	int length = (py->pdb_is_64bit ? 16 : 8);
++	int rc;
++
++	rc = pydb_frameinfo(py, frame_addr, funcname, sizeof (funcname),
++	    filename, sizeof (filename), &lineno);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	if (!verbose) {
++		fn = (char *)strbasename(filename);
++	} else {
++		fn = filename;
++	}
++
++	(void) snprintf(fbuf, bufsz, "%0.*lx %s:%d %s()\n", length,
++	    frame_addr, fn, lineno, funcname);
++
++	return (0);
++}
++
++/*
++ * Return a description about a PyFrameObject, if the object is
++ * actually a PyFrameObject.  In this case, the pc argument is checked
++ * to make sure that it came from a function that takes a PyFrameObject
++ * as its first (argv[0]) argument.
++ */
++int
++pydb_pc_frameinfo(pydb_agent_t *py, uintptr_t pc, uintptr_t frame_addr,
++    char *fbuf, size_t bufsz)
++{
++	char funcname[1024];
++	char filename[1024];
++	int lineno;
++	int rc;
++	ps_sym_t psym;
++
++	/*
++	 * If PC doesn't match PyEval_EvalFrameEx in either libpython
++	 * or the executable, don't decode it.
++	 */
++	if (ps_pglobal_sym(py->pdb_ph, LIBPYTHON, "PyEval_EvalFrameEx", &psym)
++	    != PS_OK) {
++		return (-1);
++	}
++
++	/* If symbol found, ensure that PC falls within PyEval_EvalFrameEx. */
++	if (pc < psym.st_value || pc > psym.st_value + psym.st_size) {
++		return (-1);
++	}
++
++	rc = pydb_frameinfo(py, frame_addr, funcname, sizeof (funcname),
++	    filename, sizeof (filename), &lineno);
++	if (rc < 0) {
++		return (-1);
++	}
++
++	(void) snprintf(fbuf, bufsz, "[ %s:%d (%s) ]\n", filename, lineno,
++	    funcname);
++
++	return (0);
++}
++
++/*
++ * Walks the list of PyInterpreterState objects.  If caller doesn't
++ * supply address of list, this method will look it up.
++ */
++pydb_iter_t *
++pydb_interp_iter_init(pydb_agent_t *py, uintptr_t addr)
++{
++	pydb_iter_t *itr;
++	uintptr_t i_addr;
++	int rc;
++
++	if (addr == 0) {
++		rc = ps_pglobal_lookup(py->pdb_ph, LIBPYTHON, "interp_head",
++		    (psaddr_t *)&addr);
++		if (rc != PS_OK) {
++			return (NULL);
++		}
++	}
++
++	if (ps_pread(py->pdb_ph, (uintptr_t)addr, &i_addr, sizeof (uintptr_t))
++	    != PS_OK) {
++		return (NULL);
++	}
++
++	itr = malloc(sizeof (pydb_iter_t));
++	if (itr == NULL) {
++		return (NULL);
++	}
++
++	itr->pdi_ph = py->pdb_ph;
++	itr->pdi_current = i_addr;
++	itr->pdi_nextf = pydb_interp_iter_next;
++
++	return (itr);
++}
++
++static uintptr_t
++pydb_interp_iter_next(pydb_iter_t *iter)
++{
++	PyInterpreterState st;
++	uintptr_t cur;
++
++	cur = iter->pdi_current;
++
++	if (cur == 0) {
++		return (cur);
++	}
++
++	if (ps_pread(iter->pdi_ph, cur, &st, sizeof (PyInterpreterState))
++	    != PS_OK) {
++		iter->pdi_current = 0;
++		return (0);
++	}
++
++	iter->pdi_current = (uintptr_t)st.next;
++
++	return (cur);
++}
++
++/*
++ * Walk a list of Python PyFrameObjects.  The addr argument must be
++ * the address of a valid PyThreadState object.
++ */
++pydb_iter_t *
++pydb_frame_iter_init(pydb_agent_t *py, uintptr_t addr)
++{
++	pydb_iter_t *itr;
++	PyThreadState ts;
++
++	if (ps_pread(py->pdb_ph, (uintptr_t)addr, &ts, sizeof (PyThreadState))
++	    != PS_OK) {
++		return (NULL);
++	}
++
++	itr = malloc(sizeof (pydb_iter_t));
++	if (itr == NULL) {
++		return (NULL);
++	}
++
++	itr->pdi_ph = py->pdb_ph;
++	itr->pdi_current = (uintptr_t)ts.frame;
++	itr->pdi_nextf = pydb_frame_iter_next;
++
++	return (itr);
++}
++
++static uintptr_t
++pydb_frame_iter_next(pydb_iter_t *iter)
++{
++	PyFrameObject fo;
++	uintptr_t cur;
++
++	cur = iter->pdi_current;
++
++	if (cur == 0) {
++		return (cur);
++	}
++
++	if (ps_pread(iter->pdi_ph, cur, &fo, sizeof (PyFrameObject))
++	    != PS_OK) {
++		iter->pdi_current = 0;
++		return (0);
++	}
++
++	iter->pdi_current = (uintptr_t)fo.f_back;
++
++	return (cur);
++}
++
++/*
++ * Walk a list of Python PyThreadState objects.  The addr argument must be
++ * the address of a valid PyInterpreterState object.
++ */
++pydb_iter_t *
++pydb_thread_iter_init(pydb_agent_t *py, uintptr_t addr)
++{
++	pydb_iter_t *itr;
++	PyInterpreterState is;
++
++	if (ps_pread(py->pdb_ph, (uintptr_t)addr, &is,
++	    sizeof (PyInterpreterState)) != PS_OK) {
++		return (NULL);
++	}
++
++	itr = malloc(sizeof (pydb_iter_t));
++	if (itr == NULL) {
++		return (NULL);
++	}
++
++	itr->pdi_ph = py->pdb_ph;
++	itr->pdi_current = (uintptr_t)is.tstate_head;
++	itr->pdi_nextf = pydb_thread_iter_next;
++
++	return (itr);
++}
++
++static uintptr_t
++pydb_thread_iter_next(pydb_iter_t *iter)
++{
++	PyThreadState ts;
++	uintptr_t cur;
++
++	cur = iter->pdi_current;
++
++	if (cur == 0) {
++		return (cur);
++	}
++
++	if (ps_pread(iter->pdi_ph, cur, &ts, sizeof (PyThreadState)) != PS_OK) {
++		iter->pdi_current = 0;
++		return (0);
++	}
++
++	iter->pdi_current = (uintptr_t)ts.next;
++
++	return (cur);
++}
++
++
++uintptr_t
++pydb_iter_next(pydb_iter_t *iter)
++{
++	return (iter->pdi_nextf(iter));
++}
++
++void
++pydb_iter_fini(pydb_iter_t *iter)
++{
++	if (iter == NULL) {
++		return;
++	}
++
++	free(iter);
++}
+--- /dev/null
++++ Python-2.7.1/py_db/libpython27_db.h
+@@ -0,0 +1,73 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++/*
++ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
++#ifndef	_LIBPYTHON27_DB_H
++#define	_LIBPYTHON27_DB_H
++
++#include <proc_service.h>
++
++#ifdef	__cplusplus
++extern "C" {
++#endif
++
++/* Agent is opaque to library's consumers.  */
++typedef struct pydb_agent pydb_agent_t;
++
++/*
++ * Library's debug version is 1.  Changes to interface should increase this
++ * number.
++ */
++#define	PYDB_VERSION	1
++
++/* Agent creation/destruction routines */
++extern	pydb_agent_t	*pydb_agent_create(struct ps_prochandle *P, int vers);
++extern	void		pydb_agent_destroy(pydb_agent_t *py);
++
++/* Used by callers that know they are looking at a PyFrameObject */
++extern	int	pydb_get_frameinfo(pydb_agent_t *py, uintptr_t frame_addr,
++    char *fbuf, size_t bufsz, int verbose);
++
++/*
++ * Used by callers that don't know if they're looking at PyFrameObject.
++ * Checks PC for traceable functions.
++ */
++extern	int	pydb_pc_frameinfo(pydb_agent_t *py, uintptr_t pc,
++    uintptr_t frame_addr, char *fbuf, size_t bufsz);
++
++/* Iterator functions */
++typedef struct pydb_iter pydb_iter_t;
++
++extern	pydb_iter_t	*pydb_frame_iter_init(pydb_agent_t *py, uintptr_t addr);
++extern	pydb_iter_t	*pydb_interp_iter_init(pydb_agent_t *py,
++    uintptr_t addr);
++extern	pydb_iter_t	*pydb_thread_iter_init(pydb_agent_t *py,
++    uintptr_t addr);
++extern	void		pydb_iter_fini(pydb_iter_t *iter);
++extern	uintptr_t	pydb_iter_next(pydb_iter_t *iter);
++
++#ifdef	__cplusplus
++}
++#endif
++
++#endif	/* _LIBPYTHON27_DB_H */
+--- /dev/null
++++ Python-2.7.1/py_db/libpython27_db_32.h
+@@ -0,0 +1,121 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++/*
++ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
++#ifndef	_LIBPYTHON27_DB_32_H
++#define	_LIBPYTHON27_DB_32_H
++
++#ifdef	__cplusplus
++extern "C" {
++#endif
++
++#include <sys/types.h>
++
++/*
++ * Define 32-bit Python data structures for use by the 64-bit debugger.  This
++ * is so that a 64-bit debugger may properly examine a 32-bit process.
++ *
++ * In many cases, the debug library is only concerned with a few fields in the
++ * Python structure.  In that case, the other ancillary fields are elided.
++ */
++
++typedef uint32_t uintptr32_t;
++typedef int32_t Py_ssize32_t;
++
++typedef struct _is32 {
++	uintptr32_t	next;
++	uintptr32_t	tstate_head;
++} PyInterpreterState32;
++
++typedef struct _ts32 {
++	uintptr32_t	next;
++	uintptr32_t	interp;
++	uintptr32_t	frame;
++} PyThreadState32;
++
++#define	PyObject_HEAD32			\
++	Py_ssize32_t	ob_refcnt;	\
++	uintptr32_t	ob_type;
++
++#define	PyObject_VAR_HEAD32		\
++	PyObject_HEAD32			\
++	Py_ssize32_t	ob_size;
++
++typedef struct {
++	PyObject_HEAD32
++} PyObject32;
++
++typedef struct {
++	PyObject_VAR_HEAD32
++} PyVarObject32;
++
++typedef struct {
++	PyObject_VAR_HEAD32
++	int32_t		ob_shash;
++	int		ob_sstate;
++	char		ob_sval[1];
++} PyStringObject32;
++
++#define	Py_SIZE32(ob)			(((PyVarObject32*)(ob))->ob_size)
++#define	PyString_GET_SIZE32(op)		Py_SIZE32(op)
++#define	PyString_AS_STRING32(op)	(((PyStringObject32 *)(op))->ob_sval)
++
++typedef struct {
++	PyObject_VAR_HEAD32
++	uintptr32_t	f_back;
++	uintptr32_t	f_code;
++	uintptr32_t	f_builtins;
++	uintptr32_t	f_globals;
++	uintptr32_t	f_locals;
++	uintptr32_t	f_valuestack;
++	uintptr32_t	f_stacktop;
++	uintptr32_t	f_trace;
++	uintptr32_t	f_exc_typpe, f_exc_value, f_exc_traceback;
++	uintptr32_t	f_tstate;
++	int		f_lasti;
++	int		f_lineno;
++} PyFrameObject32;
++
++typedef struct {
++	PyObject_HEAD32
++	int		co_argcount;
++	int		co_nlocals;
++	int		co_stacksize;
++	int		co_flags;
++	uintptr32_t	co_code;
++	uintptr32_t	co_consts;
++	uintptr32_t	co_names;
++	uintptr32_t	co_varnames;
++	uintptr32_t	co_freevars;
++	uintptr32_t	co_cellvars;
++	uintptr32_t	co_filename;
++	uintptr32_t	co_name;
++	int		co_firstlineno;
++	uintptr32_t	co_lnotab;
++} PyCodeObject32;
++
++#ifdef	__cplusplus
++}
++#endif
++
++#endif	/* _LIBPYTHON27_DB_32_H */
+--- /dev/null
++++ Python-2.7.1/py_db/mapfile-vers
+@@ -0,0 +1,39 @@
++#
++# CDDL HEADER START
++#
++# The contents of this file are subject to the terms of the
++# Common Development and Distribution License (the "License").
++# You may not use this file except in compliance with the License.
++#
++# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++# or http://www.opensolaris.org/os/licensing.
++# See the License for the specific language governing permissions
++# and limitations under the License.
++#
++# When distributing Covered Code, include this CDDL HEADER in each
++# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++# If applicable, add the following below this CDDL HEADER, with the
++# fields enclosed by brackets "[]" replaced with your own identifying
++# information: Portions Copyright [yyyy] [name of copyright owner]
++#
++# CDDL HEADER END
++#
++
++#
++# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++#
++
++SUNWprivate_1.1 {
++    global:
++	pydb_agent_create;
++	pydb_agent_destroy;
++	pydb_frame_iter_init;
++	pydb_get_frameinfo;
++	pydb_pc_frameinfo;
++	pydb_interp_iter_init;
++	pydb_thread_iter_init;
++	pydb_iter_fini;
++	pydb_iter_next;
++    local:
++	*;
++};

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/15-get_wch.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/15-get_wch.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/15-get_wch.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,48 @@
+--- Python-2.7.6/Modules/_cursesmodule.c.~1~	2013-11-09 23:36:41.000000000 -0800
++++ Python-2.7.6/Modules/_cursesmodule.c	2014-05-14 13:36:59.388642793 -0700
+@@ -861,6 +861,37 @@
+ }
+ 
+ static PyObject *
++PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
++{
++    int x, y;
++    int ct;
++    wint_t rtn;
++
++    switch (PyTuple_Size(args)) {
++    case 0:
++        Py_BEGIN_ALLOW_THREADS
++        ct = wget_wch(self->win,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    case 2:
++        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
++            return NULL;
++        Py_BEGIN_ALLOW_THREADS
++        ct = mvwget_wch(self->win,y,x,&rtn);
++        Py_END_ALLOW_THREADS
++        break;
++    default:
++        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
++        return NULL;
++    }
++    if (ct == ERR) {
++        PyErr_SetString(PyCursesError, "get_wch failed");
++        return NULL;
++    }
++    return PyInt_FromLong((long)rtn);
++}
++
++static PyObject *
+ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
+ {
+     int x, y;
+@@ -1572,6 +1603,7 @@
+     {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
+     {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
+     {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
++    {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
+     {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
+     {"getmaxyx",        (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
+     {"getparyx",        (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/16-ossaudiodev.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/16-ossaudiodev.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/16-ossaudiodev.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,58 @@
+--- Python-2.7.7/Modules/ossaudiodev.c.~1~	2014-05-31 11:58:40.000000000 -0700
++++ Python-2.7.7/Modules/ossaudiodev.c	2014-06-02 10:58:12.132478970 -0700
+@@ -1037,6 +1037,7 @@
+     _EXPORT_INT(m, SOUND_MIXER_MONITOR);
+ #endif
+ 
++#ifndef __sun
+     /* Expose all the ioctl numbers for masochists who like to do this
+        stuff directly. */
+     _EXPORT_INT(m, SNDCTL_COPR_HALT);
+@@ -1049,6 +1050,7 @@
+     _EXPORT_INT(m, SNDCTL_COPR_SENDMSG);
+     _EXPORT_INT(m, SNDCTL_COPR_WCODE);
+     _EXPORT_INT(m, SNDCTL_COPR_WDATA);
++#endif
+ #ifdef SNDCTL_DSP_BIND_CHANNEL
+     _EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL);
+ #endif
+@@ -1070,8 +1072,12 @@
+     _EXPORT_INT(m, SNDCTL_DSP_GETSPDIF);
+ #endif
+     _EXPORT_INT(m, SNDCTL_DSP_GETTRIGGER);
++#ifdef SNDCTL_DSP_MAPINBUF
+     _EXPORT_INT(m, SNDCTL_DSP_MAPINBUF);
++#endif
++#ifdef SNDCTL_DSP_MAPOUTBUF
+     _EXPORT_INT(m, SNDCTL_DSP_MAPOUTBUF);
++#endif
+     _EXPORT_INT(m, SNDCTL_DSP_NONBLOCK);
+     _EXPORT_INT(m, SNDCTL_DSP_POST);
+ #ifdef SNDCTL_DSP_PROFILE
+@@ -1091,6 +1097,7 @@
+     _EXPORT_INT(m, SNDCTL_DSP_STEREO);
+     _EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE);
+     _EXPORT_INT(m, SNDCTL_DSP_SYNC);
++#ifndef __sun
+     _EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE);
+     _EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR);
+     _EXPORT_INT(m, SNDCTL_MIDI_INFO);
+@@ -1132,4 +1139,5 @@
+     _EXPORT_INT(m, SNDCTL_TMR_STOP);
+     _EXPORT_INT(m, SNDCTL_TMR_TEMPO);
+     _EXPORT_INT(m, SNDCTL_TMR_TIMEBASE);
++#endif
+ }
+--- Python-2.7.8/setup.py.~5~	2014-07-17 20:47:50.251398063 -0700
++++ Python-2.7.8/setup.py	2014-07-17 20:47:50.359537973 -0700
+@@ -1638,8 +1638,8 @@
+         else:
+             missing.append('linuxaudiodev')
+ 
+-        if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
+-                        'freebsd7', 'freebsd8')
++        if (host_platform in ('sunos5', 'linux2', 'freebsd4', 'freebsd5',
++                        'freebsd6', 'freebsd7', 'freebsd8')
+             or host_platform.startswith("gnukfreebsd")):
+             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
+         else:

Added: csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/18-osconf-long.patch
===================================================================
--- csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/18-osconf-long.patch	                        (rev 0)
+++ csw/mgar/pkg/lang-python/python/branches/python-2.7-dtrace/files/18-osconf-long.patch	2015-03-21 13:23:55 UTC (rev 24738)
@@ -0,0 +1,11 @@
+--- Python-2.7.7/Modules/posixmodule.c.~2~	2014-06-02 11:01:10.919544709 -0700
++++ Python-2.7.7/Modules/posixmodule.c	2014-06-02 11:01:11.009553336 -0700
+@@ -8499,7 +8499,7 @@
+     int name;
+ 
+     if (PyArg_ParseTuple(args, "O&:sysconf", conv_sysconf_confname, &name)) {
+-        int value;
++        long value;
+ 
+         errno = 0;
+         value = sysconf(name);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list