private static error @lock(File f, lockType lt) { // Per https://golang.org/issue/19098, “Programs currently expect the Fd // method to return a handle that uses ordinary synchronous I/O.” // However, LockFileEx still requires an OVERLAPPED structure, // which contains the file offset of the beginning of the lock range. // We want to lock the entire file, so we leave the offset as zero. ptr <object> ol = @new <syscall.Overlapped>(); var err = windows.LockFileEx(syscall.Handle(f.Fd()), uint32(lt), reserved, allBytes, allBytes, ol); if (err != null) { return(error.As(addr(new os.PathError(Op: lt.String(), Path: f.Name(), Err: err, )) !) !); } return(error.As(null !) !); }
private static error @lock(File f, lockType lt) { return(error.As(addr(new os.PathError(Op: lt.String(), Path: f.Name(), Err: ErrNotSupported, )) !) !); }