On 10/28/24 2:36 AM, Sergey Bugaev wrote:
But the important point is that on
the client side, glibc doesn't use the generated C function to invoke
the routine, and instead does things based on the ioctl number, so
it's crucial that the definition of RTC_RD_TIME constant matches the
signature of the MIG routine.

On Linux, RTC_RD_TIME is defined as _IOR('p', 0x09, struct rtc_time),
and IIUC you plan to keep the same definition. _IOR (..., ..., type)
means an RPC that has a single out-parameter of the given type, so
that's what your MIG routine should be defined as. You'll also have to
define _IOT_rtc_time in a C header (rtc.h) next to the struct rtc_time
definition, using the _IOT macro.
I see, so _IOR is a wrapper of _IOC for calculating an ioctl number. This ioctl number is used for invoking the routine in the rtc server. We need to define _IOT_rtc_time because calculating RTC_RD_TIME requires the ioctl number of rtc, _IOT_rtc_time (like what's mentioned in ioctls.h in glibc).

Please tell me if this all makes sense, and if I need to rephrase /
expand on something.
It's very clear, thank you.

--
Zhaoming Luo <zhaoming1...@qq.com>



Reply via email to