From 46e1bf79a62e6d9b08081b0c5f98ec7dd4f9f689 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 6 Nov 2024 11:57:06 +0800 Subject: [PATCH] chore(core): more concise on build constraints --- ..._log_unix.go => open_out_log_dup2_unix.go} | 6 ++--- ...inux_dup3.go => open_out_log_dup3_unix.go} | 7 +++--- core/open_out_log_linux_loong64.go | 23 ------------------- 3 files changed, 5 insertions(+), 31 deletions(-) rename core/{open_out_log_unix.go => open_out_log_dup2_unix.go} (82%) rename core/{open_out_log_linux_dup3.go => open_out_log_dup3_unix.go} (81%) delete mode 100644 core/open_out_log_linux_loong64.go diff --git a/core/open_out_log_unix.go b/core/open_out_log_dup2_unix.go similarity index 82% rename from core/open_out_log_unix.go rename to core/open_out_log_dup2_unix.go index 68d632f5..00dd5159 100644 --- a/core/open_out_log_unix.go +++ b/core/open_out_log_dup2_unix.go @@ -1,7 +1,5 @@ -//go:build !windows && !(linux && arm64) && !(linux && loong64) -// +build !windows -// +build !linux !arm64 -// +build !linux !loong64 +//go:build !arm64 && !loong64 && !riscv64 +// +build !arm64,!loong64,!riscv64 // Copyright 2017 LinkedIn Corp. Licensed under the Apache License, Version // 2.0 (the "License"); you may not use this file except in compliance with diff --git a/core/open_out_log_linux_dup3.go b/core/open_out_log_dup3_unix.go similarity index 81% rename from core/open_out_log_linux_dup3.go rename to core/open_out_log_dup3_unix.go index 9243815b..ec54e71e 100644 --- a/core/open_out_log_linux_dup3.go +++ b/core/open_out_log_dup3_unix.go @@ -1,6 +1,5 @@ -//go:build linux && (arm64 || riscv64) -// +build linux -// +build arm64 riscv64 +//go:build arm64 || riscv64 || loong64 +// +build arm64 riscv64 loong64 // Copyright 2017 LinkedIn Corp. Licensed under the Apache License, Version // 2.0 (the "License"); you may not use this file except in compliance with @@ -17,7 +16,7 @@ import ( "syscall" ) -// linux_arm64 and linux_riscv64 doesn't have syscall.Dup2, so use +// linux/arm64, linux/riscv64, linux/loong64 doesn't have syscall.Dup2, so use // the nearly identical syscall.Dup3 instead func internalDup2(oldfd uintptr, newfd uintptr) error { return syscall.Dup3(int(oldfd), int(newfd), 0) diff --git a/core/open_out_log_linux_loong64.go b/core/open_out_log_linux_loong64.go deleted file mode 100644 index 7fb618a6..00000000 --- a/core/open_out_log_linux_loong64.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build linux && loong64 -// +build linux,loong64 - -// Copyright 2017 LinkedIn Corp. Licensed under the Apache License, Version -// 2.0 (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -package core - -import ( - "syscall" -) - -// linux_loong64 doesn't have syscall.Dup2, so use -// the nearly identical syscall.Dup3 instead -func internalDup2(oldfd uintptr, newfd uintptr) error { - return syscall.Dup3(int(oldfd), int(newfd), 0) -}