From 36f1e9d38c3b697ca38f405df666929bcd483034 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 29 Dec 2025 15:26:22 +0000 Subject: [PATCH] amdgpu: use fseeko with large-file support instead of fseeko64 As of Alpine Linux 3.19, musl libc no longer contains separate fopen64(), fseeko64(), or ftello64() functions. This causes building CRIU with amdgpu plugin to fail with the following error: amdgpu_plugin.c: In function 'parallel_restore_bo_contents': amdgpu_plugin.c:2286:17: error: implicit declaration of function 'fseeko64'; did you mean 'fseeko'? [-Wimplicit-function-declaration] 2286 | fseeko64(bo_contents_fp, entry->read_offset + offset, SEEK_SET); | ^~~~~~~~ | fseeko make[2]: *** [Makefile:31: amdgpu_plugin.so] Error 1 make[1]: *** [Makefile:363: amdgpu_plugin] Error 2 To fix this, add the missing $(DEFINES) to plugin builds, and since we always compile with _FILE_OFFSET_BITS=64, we don't need the 64 suffix. Fixes: #2826 Suggested-by: Andrei Vagin Signed-off-by: Radostin Stoyanov --- plugins/amdgpu/Makefile | 2 +- plugins/amdgpu/amdgpu_plugin.c | 2 +- plugins/cuda/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile index 31e177e4a..250e7b0e7 100644 --- a/plugins/amdgpu/Makefile +++ b/plugins/amdgpu/Makefile @@ -28,7 +28,7 @@ criu-amdgpu.pb-c.c: criu-amdgpu.proto protoc --proto_path=. --c_out=. criu-amdgpu.proto amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_dmabuf.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c amdgpu_socket_utils.c - $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) + $(CC) $(PLUGIN_CFLAGS) $(DEFINES) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) amdgpu_plugin_clean: $(call msg-clean, $@) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 574d7b829..ee55bde0a 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -2283,7 +2283,7 @@ void *parallel_restore_bo_contents(void *_thread_data) continue; entry = &restore_cmd->entries[i]; - fseeko64(bo_contents_fp, entry->read_offset + offset, SEEK_SET); + fseeko(bo_contents_fp, entry->read_offset + offset, SEEK_SET); ret = sdma_copy_bo(restore_cmd->fds_write[entry->write_id], entry->size, bo_contents_fp, buffer, buffer_size, h_dev, max_copy_size, SDMA_OP_VRAM_WRITE, false); diff --git a/plugins/cuda/Makefile b/plugins/cuda/Makefile index cc3d98ac9..2c1944a34 100644 --- a/plugins/cuda/Makefile +++ b/plugins/cuda/Makefile @@ -19,7 +19,7 @@ all: $(DEPS_CUDA) cuda_plugin.so: cuda_plugin.c $(call msg-gen, $@) - $(Q) $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) + $(Q) $(CC) $(PLUGIN_CFLAGS) $(DEFINES) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) clean: $(call msg-clean, $@)