On 2/7/26 11:03 PM, Damien Zammit wrote:
Hi Stefan,

On 2/4/26 2:21 AM, Stefan Berger wrote:
So this file comes originally from swtpm here:
https://github.com/stefanberger/swtpm/blob/master/include/swtpm/tpm_ioctl.h

To keep them in sync as much as possible -- would this here work?

#ifndef _WIN32
#include <sys/uio.h>
#include <sys/ioctl.h>
#endif

#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif

#ifdef __gnu_hurd__
#include <mach/x86_64/ioccom.h>
#endif

and then keep this as-is?

#if !defined(_WIN32)
enum {
       PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
       PTM_INIT               = _IOWR('P', 1, ptm_init),
       PTM_SHUTDOWN           = _IOR('P', 2, ptm_res),

No, this wont work because the _IOT__IOTBASE_* symbols are missing for
the tpm structs on GNU platform:


In file included from /usr/include/x86_64-gnu/sys/ioctl.h:26,
                   from ../backends/tpm/tpm_ioctl.h:17,
                   from ../backends/tpm/tpm_emulator.c:39:
../backends/tpm/tpm_ioctl.h:290:30: error: ‘_IOT__IOTBASE_ptm_cap’
undeclared here (not in a function)
    290 |     PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
        |                              ^~~~

I have it compile because I added this here (above):

#ifdef __gnu_hurd__
#include <mach/x86_64/ioccom.h>
#endif

Without this header I do see these errors as well. Either way, am fine with your suggestion in v5.

 Stefan



Reply via email to