Skip to content

ext/pcntl: cpu affinity api introduction. #13893

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

Closed
wants to merge 3 commits into from

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Apr 5, 2024

For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD. Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids assigned to a given process.

pcntl_setaffinity inserts valid unique cpu ids (within the range of available
cpus).

For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD.
Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids
assigned to a given process.

pcntl_setaffinity inserts valid unique cpu ids (within the range of available
cpus).
@devnexen devnexen force-pushed the pcntl_cpuaffinity branch from fa2077b to 5f7e7ba Compare April 6, 2024 12:23
@devnexen devnexen marked this pull request as ready for review April 6, 2024 13:05
@devnexen devnexen requested a review from kocsismate as a code owner April 6, 2024 13:05
@devnexen devnexen force-pushed the pcntl_cpuaffinity branch 6 times, most recently from afed2bf to 7b9d1d9 Compare April 6, 2024 16:42
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, here's another review round.

@devnexen devnexen force-pushed the pcntl_cpuaffinity branch from 7b9d1d9 to d1bce65 Compare April 6, 2024 20:12
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Looks almost good, final nits.

@devnexen devnexen force-pushed the pcntl_cpuaffinity branch from 6cd94c1 to b7e805a Compare April 6, 2024 23:31
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

if (Z_TYPE_P(ncpu) == IS_STRING) {
zend_ulong tmp;
if (!ZEND_HANDLE_NUMERIC(Z_STR_P(ncpu), tmp)) {
zend_argument_value_error(2, "cpu id invalid type (%s)", ZSTR_VAL(Z_STR_P(ncpu)));
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the wording could be a bit better because now it sounds like the type is the value of the string, but this works too and does not block the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your review !

@devnexen devnexen force-pushed the pcntl_cpuaffinity branch from b7e805a to 866fbc2 Compare April 6, 2024 23:44
@devnexen devnexen closed this in 1cf8291 Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants