errno#

errno as the last C call through Peta::FFI left it.

Synopsis#

my $fd = Peta::FFI::call($libc, "open", "(pi;u32)i", $path, 0x40, 0644);
if ($fd < 0) {
    local $! = Peta::FFI::errno();
    die "open $path: $!";
}

What you get back#

An integer: the value errno had the moment the C function returned, read before Perl could change it. As in C, it means something only when the function reported a failure. Assigning it to $! gives its message.