Project

General

Profile

Actions

Bug #4202

open

dtrace: invalid errno value in pid provider

Added by Marcel Telka almost 9 years ago. Updated almost 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
DTrace
Start date:
2013-10-12
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

The pid provider does not have access to the correct value of errno:

# cat a.c
#include <stdio.h>
#include <errno.h>

int
main(void)
{
        if (fopen("file", "r") == NULL)
                printf("errno: %d\\n", errno);

        return 0;
}
# gcc a.c
# dtrace -n '
    pid$target::fopen:return
        {trace(arg1);trace(errno);trace(execname)}
    syscall::open:return /errno!=0&&execname=="a.out"/
        {trace(errno); trace(execname)}' -c ./a.out
dtrace: description '
    pid$target::fopen:return
        ' matched 2 probes
errno: 2
dtrace: pid 1176 has exited
CPU     ID                    FUNCTION:NAME
  1   6874                      open:return         2  a.out
  1  73290                     fopen:return                 0        0  a.out

# ls file
ls: cannot access file: No such file or directory
#

Apparently, the errno value is 2, but the pid provider shows 0.


Related issues

Related to illumos gate - Bug #5085: errno clobbering in libdtraceNew2014-08-13

Actions
Actions

Also available in: Atom PDF