This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add probes for prctl () and prctl (PR_SET_NAME, ...)
authorH.Merijn Brand <merijn@nb09.procura.nl>
Mon, 29 Mar 2010 07:13:13 +0000 (09:13 +0200)
committerH.Merijn Brand <merijn@nb09.procura.nl>
Mon, 29 Mar 2010 07:13:13 +0000 (09:13 +0200)
U/perl/d_prctl.U [new file with mode: 0644]

diff --git a/U/perl/d_prctl.U b/U/perl/d_prctl.U
new file mode 100644 (file)
index 0000000..721740a
--- /dev/null
@@ -0,0 +1,55 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 2010 H.Merijn Brand
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?MAKE:d_prctl d_prctl_set_name: Inlibc cat Compile run rm_try
+?MAKE: -pick add $@ %<
+?S:d_prctl:
+?S:    This variable conditionally defines the HAS_PRCTL symbol, which
+?S:    indicates to the C program that the prctl() routine is available.
+?S:.
+?S:d_prctl_set_name:
+?S:    This variable conditionally defines the HAS_PRCTL symbol, which
+?S:    indicates to the C program that the prctl() routine is available.
+?S:.
+?C:HAS_PRCTL:
+?C:    This symbol, if defined, indicates that the prctl routine is
+?C:    available to set process title.
+?C:.
+?C:HAS_PRCTL_SET_NAME:
+?C:    This symbol, if defined, indicates that the prctl routine is
+?C:    available to set process title and supports PR_SET_NAME.
+?C:.
+?H:#$d_prctl HAS_PRCTL         /**/
+?H:#$d_prctl_set_name HAS_PRCTL_SET_NAME               /**/
+?H:.
+?F:!try
+?LINT:set d_prctl
+: see if prctl exists
+set prctl d_prctl
+eval $inlibc
+
+: see if prctl supports PR_SET_NAME
+d_prctl_set_name=$undef
+case $d_prctl in
+    $define)
+       $cat >try.c <<EOM
+#include <sys/prctl.h>
+
+int main (int argc, char *argv[])
+{
+    return (prctl (PR_SET_NAME, "Test"));
+    } /* main */
+EOM
+       set try
+       if eval $compile_ok && $run ./try; then
+           echo "Your prctl (PR_SET_NAME, ...) works"
+           d_prctl_set_name=$define
+           fi
+       $rm_try
+       ;;
+    esac
+