File: ptracer.t

package info (click to toggle)
liblinux-prctl-perl 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 368 kB
  • ctags: 768
  • sloc: perl: 166; ansic: 19; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 433 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use warnings;

use Test::More tests => 2;
use Linux::Prctl qw(:constants :functions);

SKIP: {
    skip "set_ptracer not available", 2 unless Linux::Prctl->can('set_ptracer');
    skip "yama not available", 2 unless -e "/proc/sys/kernel/yama";
    is(set_ptracer(1), 0, "Setting ptracer to 1 (init)");
    my $pid = fork or exit;
    waitpid $pid, 0;
    is(set_ptracer($pid), -1, "Setting ptracer to an invalid pid");
}