OpenBSD::Pledge(3p)

OpenBSD::Pledge3p

Perl interface to openbsd pledge(2)

Usage

  use OpenBSD::Pledge;
  my $file = "/usr/share/dict/words";
  pledge( qw( rpath ) ) || die "Unable to pledge: $!";
  open my $fh, '<', $file or die "Unable to open $file: $!";
  pledge() || die "Unable to pledge again: $!";
  print grep { /pledge/i } readline($fh);
  close $fh;

Overview

This module provides a perl interface to OpenBSD's pledge(2) syscall(2).

Once you promise that your program will only use certain syscalls the kernel will kill the program if it attempts to call any other interfaces.

Export

Exports "pledge" by default.

Functions

pledge

Perl interface to pledge(2).

        pledge(@promises)

The "stdio" promise is always implied, as perl(1) itself is useless without it.

Returns true on success, returns false and sets $! on failure

Bugs and limitations

Perl is particularly fond of "stdio" so that promise is always added by "pledge".

Releases

23 releases since OpenBSD 5.9; the text changed 17 times.

  1. 5.9
  2. 6.0
  3. 6.1
  4. 6.2
  5. 6.3–6.4
  6. 6.5
  7. 6.6
  8. 6.7
  9. 6.8
  10. 6.9
  11. 7.0–7.2
  12. 7.3
  13. 7.4
  14. 7.5
  15. 7.6
  16. 7.7–7.8
  17. 7.9
  18. 8.0

Author

Andrew Hewus Fresh, <[email protected]>

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's man source.