RPCSX / rpcsx

GNU General Public License v2.0
1.26k stars 60 forks source link

[rpcsx-os] sys_sysctl: use enum classes for names to better type safety #57

Closed viniciuslrangel closed 11 months ago

viniciuslrangel commented 11 months ago

Just saying hello to the project while I read the source

DHrpcs3 commented 11 months ago

Thank you for commit, but those enums are declared inside function, it is already best possible safety

viniciuslrangel commented 11 months ago

What about adding the sysctl name instead of unspec?

DHrpcs3 commented 11 months ago

unspec is not random name, see sys___sysctl implementation in the FreeBSD

viniciuslrangel commented 11 months ago

https://github.com/freebsd/freebsd-src/blob/main/sys/sys/sysctl.h#L936

I can't find the unspec, it took me several minutes until I found the source and I was a little frustrated. It was what motivated me to do this commit

DHrpcs3 commented 11 months ago

OS of PS4 is based on FreeBSD 9.1 https://github.com/freebsd/freebsd-src/blob/releng/9.1/sys/sys/sysctl.h#L421

viniciuslrangel commented 11 months ago

Oh, I actually forgot to check that. It makes a ton of sense. Thank you for clarifying