getpgid未使用valgrind实现

rSi*_*Sim 7 c unix macos valgrind

考虑这个例子:

#include <stdio.h>
#include <unistd.h>

int     main()
{
    int pgid;

    if ((pgid = getpgid(0)) == -1)
        perror("getpgid");
    else
        printf("pgid : %d\n", pgid);
}
Run Code Online (Sandbox Code Playgroud)

当我在不使用valgrind的情况下运行此程序时,一切都进行正确,并打印了pgid。每当我使用valgrind时,perror都会打印getpgid: Function not implemented

  • 它是正常的,getpgid没有根据的valgrind可用

  • 是否有其他方法可以获取特定pid的pgid(不包括 getpgrp)?

我正在使用macOS Sierra 10.12.6和valgrind-3.15.0。

rSi*_*Sim 1

看来 valgrind 在执行某些系统调用时可能会遇到一些麻烦。

在 valgrind 跟踪中,我有:

--17135-- WARNING: unhandled amd64-darwin syscall: unix:151
--17135-- You may be able to write your own handler.
--17135-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--17135-- Nevertheless we consider this a bug.  Please report
--17135-- it at http://valgrind.org/support/bug_reports.html.
Run Code Online (Sandbox Code Playgroud)

所以我需要为该函数创建一个包装器,它应该可以工作。我会将错误报告给支持人员。