Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/sysPublic

Commita7f19e9

Browse files
tklausergopherbot
authored andcommitted
unix: add Dup3 on dragonfly
Use the same implementation as on freebsd which is also what thedragonfly libc uses.Change-Id: I0ed513ae15fcb6dac77b2fc76f662723d66b75c6Reviewed-on:https://go-review.googlesource.com/c/sys/+/636435Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>Reviewed-by: Ian Lance Taylor <iant@google.com>Reviewed-by: Carlos Amedee <carlos@golang.org>LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>TryBot-Result: Gopher Robot <gobot@golang.org>
1 parentfe16172 commita7f19e9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎unix/dup3_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build freebsd || linux || netbsd || openbsd
5+
//go:builddragonfly ||freebsd || linux || netbsd || openbsd
66

77
package unix_test
88

@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
funcTestDup3(t*testing.T) {
19-
tempFile,err:=os.Create(filepath.Join(t.TempDir(),"TestDup"))
19+
tempFile,err:=os.Create(filepath.Join(t.TempDir(),"TestDup3"))
2020
iferr!=nil {
2121
t.Fatal(err)
2222
}

‎unix/syscall_dragonfly.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
246246
returnsendfile(outfd,infd,offset,count)
247247
}
248248

249+
funcDup3(oldfd,newfd,flagsint)error {
250+
ifoldfd==newfd||flags&^O_CLOEXEC!=0 {
251+
returnEINVAL
252+
}
253+
how:=F_DUP2FD
254+
ifflags&O_CLOEXEC!=0 {
255+
how=F_DUP2FD_CLOEXEC
256+
}
257+
_,err:=fcntl(oldfd,how,newfd)
258+
returnerr
259+
}
260+
249261
/*
250262
* Exposed directly
251263
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp