On 10/1/2025 4:03 PM, Peter Xu wrote:
On Wed, Oct 01, 2025 at 03:07:23PM -0400, Steven Sistare wrote:
That does not make sense.  It already does that, which is why I used it:

util/memfd.c

int qemu_memfd_create(const char *name, size_t size, bool hugetlb,
                       uint64_t hugetlbsize, unsigned int seals, Error **errp)
{
     ...
#ifdef CONFIG_LINUX
     ...
     return mfd;
#else
     error_setg_errno(errp, ENOSYS, "failed to create memfd");
#endif
     return -1;
}

Did the windows build fail due to a different error?

https://gitlab.com/peterx/qemu/-/jobs/11566477462

See util/meson.build:

if host_os != 'windows'
   ...
   util_ss.add(files('memfd.c'))
   ...


I see.  So you were suggesting, as the minimal fix, to add ifdef CONFIG_LINUX at
the call site, not inside qemu_memfd_create, eg:

QEMUFile *cpr_exec_output(Error **errp)
{
#ifndef CONFIG_LINUX
    error_setg(errp, "qemu_memfd_create requires CONFIG_LINUX");
    return NULL;
#endif

    int mfd = qemu_memfd_create(CPR_EXEC_STATE_NAME, 0, false, 0, 0, errp);

    if (mfd < 0) {
        return NULL;
    }

    return qemu_file_new_fd_output(mfd, CPR_EXEC_STATE_NAME);
}


Do you want me to re-submit a patch, or can you add the above to your tree?
If the latter, feel free to tweak it.

- Steve

Reply via email to