From: Manolo de Medici <manolodemedici@gmail.com>
The Hurd currently doesn't have any TPM driver, compilation fails
for missing symbols unless these are left undefined.
Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
---
backends/tpm/tpm_ioctl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index ee2dd15d35..e466311455 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
#define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
#define PTM_CAP_LOCK_STORAGE (1 << 16)
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__GNU__)
enum {
PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
PTM_INIT = _IOWR('P', 1, ptm_init),
--
2.51.0
On 1/30/26 04:20, Damien Zammit wrote:
> From: Manolo de Medici <manolodemedici@gmail.com>
>
> The Hurd currently doesn't have any TPM driver, compilation fails
> for missing symbols unless these are left undefined.
This is due to the missing _IO* symbols, not the TPM driver.
Fortunately, these are unused and the whole enum can be removed. Please
check if it's also possible to remove
#ifndef _WIN32
#include <sys/uio.h>
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
at the top of the file.
Paolo
> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> ---
> backends/tpm/tpm_ioctl.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
> index ee2dd15d35..e466311455 100644
> --- a/backends/tpm/tpm_ioctl.h
> +++ b/backends/tpm/tpm_ioctl.h
> @@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
> #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
> #define PTM_CAP_LOCK_STORAGE (1 << 16)
>
> -#ifndef _WIN32
> +#if !defined(_WIN32) && !defined(__GNU__)
> enum {
> PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
> PTM_INIT = _IOWR('P', 1, ptm_init),
On 1/30/26 3:27 AM, Paolo Bonzini wrote:
> On 1/30/26 04:20, Damien Zammit wrote:
>> From: Manolo de Medici <manolodemedici@gmail.com>
>>
>> The Hurd currently doesn't have any TPM driver, compilation fails
>> for missing symbols unless these are left undefined.
>
> This is due to the missing _IO* symbols, not the TPM driver.
>
> Fortunately, these are unused and the whole enum can be removed. Please
> check if it's also possible to remove
>
> #ifndef _WIN32
> #include <sys/uio.h>
> #include <sys/ioctl.h>
> #endif
>
> #ifdef HAVE_SYS_IOCCOM_H
> #include <sys/ioccom.h>
> #endif
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),
>
> at the top of the file.
>
> Paolo
>
>> Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
>> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
>> ---
>> backends/tpm/tpm_ioctl.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
>> index ee2dd15d35..e466311455 100644
>> --- a/backends/tpm/tpm_ioctl.h
>> +++ b/backends/tpm/tpm_ioctl.h
>> @@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
>> #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
>> #define PTM_CAP_LOCK_STORAGE (1 << 16)
>> -#ifndef _WIN32
>> +#if !defined(_WIN32) && !defined(__GNU__)
>> enum {
>> PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
>> PTM_INIT = _IOWR('P', 1, ptm_init),
>
>
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),
| ^~~~
../backends/tpm/tpm_ioctl.h:291:30: error: ‘_IOT__IOTBASE_ptm_init’
undeclared here (not in a function)
291 | PTM_INIT = _IOWR('P', 1, ptm_init),
| ^~~~~
../backends/tpm/tpm_ioctl.h:292:30: error: ‘_IOT__IOTBASE_ptm_res’
undeclared here (not in a function)
292 | PTM_SHUTDOWN = _IOR('P', 2, ptm_res),
| ^~~~
../backends/tpm/tpm_ioctl.h:293:30: error: ‘_IOT__IOTBASE_ptm_est’
undeclared here (not in a function)
293 | PTM_GET_TPMESTABLISHED = _IOR('P', 3, ptm_est),
| ^~~~
../backends/tpm/tpm_ioctl.h:294:30: error: ‘_IOT__IOTBASE_ptm_loc’
undeclared here (not in a function)
294 | PTM_SET_LOCALITY = _IOWR('P', 4, ptm_loc),
| ^~~~~
../backends/tpm/tpm_ioctl.h:296:30: error: ‘_IOT__IOTBASE_ptm_hdata’
undeclared here (not in a function)
296 | PTM_HASH_DATA = _IOWR('P', 6, ptm_hdata),
| ^~~~~
../backends/tpm/tpm_ioctl.h:300:32: error: ‘_IOT__IOTBASE_ptm_reset_est’
undeclared here (not in a function)
300 | PTM_RESET_TPMESTABLISHED = _IOWR('P', 10, ptm_reset_est),
| ^~~~~
../backends/tpm/tpm_ioctl.h:301:30: error: ‘_IOT__IOTBASE_ptm_getstate’
undeclared here (not in a function)
301 | PTM_GET_STATEBLOB = _IOWR('P', 11, ptm_getstate),
| ^~~~~
../backends/tpm/tpm_ioctl.h:302:30: error: ‘_IOT__IOTBASE_ptm_setstate’
undeclared here (not in a function)
302 | PTM_SET_STATEBLOB = _IOWR('P', 12, ptm_setstate),
| ^~~~~
../backends/tpm/tpm_ioctl.h:304:30: error: ‘_IOT__IOTBASE_ptm_getconfig’
undeclared here (not in a function)
304 | PTM_GET_CONFIG = _IOR('P', 14, ptm_getconfig),
| ^~~~
../backends/tpm/tpm_ioctl.h:306:30: error:
‘_IOT__IOTBASE_ptm_setbuffersize’ undeclared here (not in a function)
306 | PTM_SET_BUFFERSIZE = _IOWR('P', 16, ptm_setbuffersize),
| ^~~~~
../backends/tpm/tpm_ioctl.h:307:30: error: ‘_IOT__IOTBASE_ptm_getinfo’
undeclared here (not in a function)
307 | PTM_GET_INFO = _IOWR('P', 17, ptm_getinfo),
| ^~~~~
../backends/tpm/tpm_ioctl.h:308:30: error:
‘_IOT__IOTBASE_ptm_lockstorage’ undeclared here (not in a function)
308 | PTM_LOCK_STORAGE = _IOWR('P', 18, ptm_lockstorage),
If you want to preserve the enum, I am happy to put an ifdef instead of
removing it.
That would be exactly what we had in v3 3/4.
Damien
© 2016 - 2026 Red Hat, Inc.