github.com/tetratelabs/wazero@v1.2.1/internal/sysfs/chown.go (about)

     1  package sysfs
     2  
     3  import (
     4  	"os"
     5  	"syscall"
     6  
     7  	"github.com/tetratelabs/wazero/internal/platform"
     8  )
     9  
    10  // Chown is like os.Chown, except it returns a syscall.Errno, not a
    11  // fs.PathError. For example, this returns syscall.ENOENT if the path doesn't
    12  // exist. A syscall.Errno of zero is success.
    13  //
    14  // Note: This always returns syscall.ENOSYS on windows.
    15  // See https://linux.die.net/man/3/chown
    16  func Chown(path string, uid, gid int) syscall.Errno {
    17  	err := os.Chown(path, uid, gid)
    18  	return platform.UnwrapOSError(err)
    19  }
    20  
    21  // Lchown is like os.Lchown, except it returns a syscall.Errno, not a
    22  // fs.PathError. For example, this returns syscall.ENOENT if the path doesn't
    23  // exist. A syscall.Errno of zero is success.
    24  //
    25  // Note: This always returns syscall.ENOSYS on windows.
    26  // See https://linux.die.net/man/3/lchown
    27  func Lchown(path string, uid, gid int) syscall.Errno {
    28  	err := os.Lchown(path, uid, gid)
    29  	return platform.UnwrapOSError(err)
    30  }