[PATCH-V4] xserver: Optional backtrace handler

Alan Coopersmith alan.coopersmith at oracle.com
Wed Oct 12 18:12:35 PDT 2011


On 10/12/11 10:50 AM, Keith Packard wrote:
>   2. I'd love to figure out how to fork at the time of the error; this
>      would encourage people to actually use this option regularly.
>
>      posix threads makes the usual libc fork() function take the malloc
>      mutex across its operations, but I wonder if syscall(SYS_fork) is
>      portable enough to be used instead?

As discussed on IRC, no, syscall() is not portable, but the libc fork() issue
seems to be a linux problem, as SUSv2/Unix98 documents fork() as safe to use
in a signal handler, but glibc does not.   posix_spawn() may also be a more
portable option.

The existing Solaris xorg_backtrace_pstack() in Xorg's os/backtrace.c has
been forking in the signal handler for a couple years now - ideally we'd
be able to mostly share the code across platforms, but I've not looked into
that.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list