LIBMUSLGLUE_SRCS-y += $(LIBMUSL_BASE)/__uk_unmapself.c
LIBMUSLGLUE_SRCS-y += $(LIBMUSL_BASE)/__set_thread_area.c
LIBMUSLGLUE_SRCS-y += $(LIBMUSL_BASE)/arch/$(CONFIG_UK_ARCH)/__clone.S
+LIBMUSLGLUE_SRCS-$(CONFIG_LIBPOSIX_PROCESS_VFORK) += $(LIBMUSL_BASE)/arch/$(CONFIG_UK_ARCH)/vfork.S
LIBMUSLGLUE_COMPFLAGS-y += -I$(LIBMUSL)/src/include
LIBMUSLGLUE_COMPFLAGS-y += -I$(LIBMUSL)/src/internal
LIBMUSLGLUE_CINCLUDES += -I$(LIBMUSL)/src/internal
LIBMUSL_PROCESS_SRCS-y += $(LIBMUSL)/src/process/waitid.c
LIBMUSL_PROCESS_SRCS-y += $(LIBMUSL)/src/process/waitpid.c
-ifeq (x86_32,$(CONFIG_UK_ARCH))
-LIBMUSL_PROCESS_SRCS-y += $(LIBMUSL)/src/process/i386/vfork.s|i386
-else ifeq (x86_64,$(CONFIG_UK_ARCH))
-LIBMUSL_PROCESS_SRCS-y += $(LIBMUSL)/src/process/x86_64/vfork.s|x86_64
-else
-LIBMUSL_PROCESS_SRCS-y += $(LIBMUSL)/src/process/vfork.c
-endif
-
-
$(eval $(call _libmusl_import_lib,process,$(LIBMUSL_PROCESS_HDRS-y),$(LIBMUSL_PROCESS_SRCS-y)))
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) 2025, Unikraft GmbH and The Unikraft Authors.
+ * Licensed under the BSD-3-Clause License (the "License").
+ * You may not use this file except in compliance with the License.
+ */
+
+/*
+ * NOTE: This code here is replicated from the core Unikraft repository,
+ * since we can't use musl's vfork wrapper.
+ */
+.global vfork
+vfork:
+ b uk_syscall_e_vfork
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause */
+/* Copyright (c) 2025, Unikraft GmbH and The Unikraft Authors.
+ * Licensed under the BSD-3-Clause License (the "License").
+ * You may not use this file except in compliance with the License.
+ */
+
+/*
+ * NOTE: This code here is replicated from the core Unikraft repository,
+ * since we can't use musl's vfork wrapper.
+ */
+.global vfork
+vfork:
+ jmp uk_syscall_e_vfork