Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retrieving process name on macOS #588

Merged
merged 1 commit into from
Mar 31, 2023
Merged

fix: retrieving process name on macOS #588

merged 1 commit into from
Mar 31, 2023

Conversation

deepak1556
Copy link
Contributor

@deepak1556 deepak1556 requested a review from Tyriar March 31, 2023 08:57
@deepak1556 deepak1556 self-assigned this Mar 31, 2023
@deepak1556 deepak1556 added this to the 1.0.0 milestone Mar 31, 2023
Comment on lines +680 to +686
pty_getproc(int pid) {
char pname[MAXCOMLEN + 1];
if (!proc_name(pid, pname, sizeof(pname))) {
return NULL;
}

return strdup(kp.kp_proc.p_comm);
return strdup(pname);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is similar to tmux's technique, are we going to regress anywhere by doing it this way? I don't understand how it worked before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went based on the implementation of proc_name which is used in much widely across the kernel code https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/kern/kern_proc.c#L1029-L1044 and it seems reliable.

@Tyriar Tyriar merged commit 2978b1e into main Mar 31, 2023
@Tyriar Tyriar deleted the robo/fix_proc_name branch March 31, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants