20190926 - macOS 下查看进程路径
2024-09-04 00:14:35
首先,从 Activity Monitor 中查看进程 PID,然后使用以下命令查看。
ps xuwww -p PID
另一个办法是,使用系统调用 proc_pidpath 。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <libproc.h> int main (int argc, char* argv[])
{
pid_t pid; int ret;
char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; if ( argc > ) {
pid = (pid_t) atoi(argv[]);
ret = proc_pidpath (pid, pathbuf, sizeof(pathbuf));
if ( ret <= ) {
fprintf(stderr, "PID %d: proc_pidpath ();\n", pid);
fprintf(stderr, " %s\n", strerror(errno));
} else {
printf("proc %d: %s\n", pid, pathbuf);
}
} return ;
}
最新文章
- 学习IT资源分享,欢迎各位知道的学习IT资源前来分享
- 在Fedora 20下使用TexturePacker
- Windows phone 中一些实用的控件
- 添加数据时候获取自增的ID
- scaleform mobile sdk for android 多点触摸 修正
- linux网络编程:select()函数以及FD_ZERO、FD_SET、FD_CLR、FD_ISSET(转)
- c# 字符串切割 split
- 谈谈字符集编码及gb2312、utf-8编码原理
- C# TreeGridView 实现进程列表
- SpringCloud(1)---基于RestTemplate微服务项目案例
- Linux-负载均衡LVS
- atmega16功耗实测
- django用MySQL数据库链接
- html,css学习实践总结
- python之旅第八篇--异常
- ubuntu下chrome浏览器安装flash插件(pepperflashplugin-nonfree)
- android中通过intent传递复杂数据
- web api 跨域访问
- Linux基础命令---显示登录用户logname
- Task Parallel Library02,更进一步
热门文章
- CVE-2018-10933 LibSSH auth bypass
- UVa1048 Low Cost Air Travel——最短路
- mysql_config_editor设置
- 第一份c语言作业
- BZOJ 4009: [HNOI2015]接水果 (整体二分+扫描线 树状数组)
- ORM高阶补充:only, defer,select_related
- SQL Server 基础之《学生表-教师表-课程表-选课表》(一)
- luogu P4194 矩阵
- Codevs 1298 凸包周长
- Solr6.0创建新的core