library os: openFileNolog
This commit is contained in:
15
internal/lib/internal/syscall/unix/nonblocking_js.go
Normal file
15
internal/lib/internal/syscall/unix/nonblocking_js.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build js && wasm
|
||||
|
||||
package unix
|
||||
|
||||
func IsNonblock(fd int) (nonblocking bool, err error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func HasNonblockFlag(flag int) bool {
|
||||
return false
|
||||
}
|
||||
23
internal/lib/internal/syscall/unix/nonblocking_unix.go
Normal file
23
internal/lib/internal/syscall/unix/nonblocking_unix.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build unix
|
||||
|
||||
package unix
|
||||
|
||||
import "github.com/goplus/llgo/c/syscall"
|
||||
|
||||
/* TODO(xsw):
|
||||
func IsNonblock(fd int) (nonblocking bool, err error) {
|
||||
flag, e1 := Fcntl(fd, syscall.F_GETFL, 0)
|
||||
if e1 != nil {
|
||||
return false, e1
|
||||
}
|
||||
return flag&syscall.O_NONBLOCK != 0, nil
|
||||
}
|
||||
*/
|
||||
|
||||
func HasNonblockFlag(flag int) bool {
|
||||
return flag&syscall.O_NONBLOCK != 0
|
||||
}
|
||||
37
internal/lib/internal/syscall/unix/nonblocking_wasip1.go
Normal file
37
internal/lib/internal/syscall/unix/nonblocking_wasip1.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build wasip1
|
||||
|
||||
package unix
|
||||
|
||||
import "github.com/goplus/llgo/c/syscall"
|
||||
|
||||
/* TODO(xsw):
|
||||
import (
|
||||
"syscall"
|
||||
_ "unsafe" // for go:linkname
|
||||
)
|
||||
|
||||
func IsNonblock(fd int) (nonblocking bool, err error) {
|
||||
flags, e1 := fd_fdstat_get_flags(fd)
|
||||
if e1 != nil {
|
||||
return false, e1
|
||||
}
|
||||
return flags&syscall.FDFLAG_NONBLOCK != 0, nil
|
||||
}
|
||||
*/
|
||||
|
||||
func HasNonblockFlag(flag int) bool {
|
||||
return flag&syscall.FDFLAG_NONBLOCK != 0
|
||||
}
|
||||
|
||||
/* TODO(xsw):
|
||||
// This helper is implemented in the syscall package. It means we don't have
|
||||
// to redefine the fd_fdstat_get host import or the fdstat struct it
|
||||
// populates.
|
||||
//
|
||||
//-go:linkname fd_fdstat_get_flags syscall.fd_fdstat_get_flags
|
||||
func fd_fdstat_get_flags(fd int) (uint32, error)
|
||||
*/
|
||||
22
internal/lib/internal/syscall/unix/unix.go
Normal file
22
internal/lib/internal/syscall/unix/unix.go
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package unix
|
||||
|
||||
// llgo:skipall
|
||||
import (
|
||||
_ "unsafe"
|
||||
)
|
||||
Reference in New Issue
Block a user