看板 FB_hackers 關於我們 聯絡資訊
> Is there any way to get argv[0] for [a particular] process without being root? After more digging I see sysctl seems to be the way to do this but can I get the full path to the executable form kinfo_proc? How does ps do this? static const char * getcmdline(pid_t pid) { static struct kinfo_proc ki_proc; int mib[4], len; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = pid; len = sizeof(struct kinfo_proc); if (sysctl(mib, 4, &ki_proc, &len, NULL, 0) == -1) return NULL; return ki_proc.ki_??? } Mike _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"