-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Export zend_accel_shared_globals
#15543
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
Export zend_accel_shared_globals
#15543
Conversation
Did you try |
@cmb69 ZSMMG() isn't shared either. But yes, it would make more sense to expose that one instead. |
@realFlowControl Any reason you create an extra function instead of just exporting the global? |
Hmm, php-src/ext/opcache/ZendAccelerator.h Line 295 in 6a51062
|
That is because it is declared here, but defined somewhere else. The definition is here: php-src/ext/opcache/ZendAccelerator.c Line 112 in 6a51062
|
Wouldn't |
776f6ae
to
099b6b9
Compare
Jup, thanks @bwoebi and @cmb69. I updated the PR. zend_smm_shared_globals **smm_shared_globals;
smm_shared_globals = dlsym(opcache_handle, "smm_shared_globals");
zend_accel_shared_globals * accel_shared_globals = (zend_accel_shared_globals *)(*smm_shared_globals)->app_shared_globals;
if (accel_shared_globals)
printf("restart pending: %d\n", accel_shared_globals->restart_pending); Is working and gets me the data I need 😄 Update: looks like Windows want's the |
099b6b9
to
a97730d
Compare
Looks good to me, but could we possibly expose more information via |
Hey @arnaud-lb,
Actually I'd like to add an observer API to the opcache so that you are able to observe certain events when they happen, but I won't be able to in time for 8.4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm against this change. This is not an universal solution.
It won't work on Windows, except you link your observer with opcache, but then it won't wok without opcache.
@dstogov Why won't it work on Windows to use DL_FETCH_SYMBOL() there? |
I didn't try |
@dstogov We've definitely been successfully using DL_FETCH_SYMBOL on windows with the other ZEND_EXT_API symbols opcache exports (jit functions). So at least under that aspect it would be an universal solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I don't care.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
This reverts commit b9b317a. We don't need it and the use of ZEND_EXT_API would require us to include ZendAccelerator.h.
Hey folks 👋
I could not find any other way to access this information from an extension:
php-src/ext/opcache/ZendAccelerator.h
Lines 244 to 284 in 35fbb00
There is a user land function
opcache_get_status()
but this does way more, especially unnecessary things when not using the data in PHP, but in another C/Rust extension.I'd like to add a bit more observability to the OPcache. IIRC @arnaud-lb is working on OPcache, is that right?