Skip to content

Plan 9 Support #52

Open
Open
@henesy

Description

@henesy

Getting Billy (osfs) to build on Plan 9 is possible by adding the following:

osfs/os_plan9.go

// +build plan9

package osfs

import (
	"os"
)

func (f *file) Lock() error {
	f.m.Lock()
	defer f.m.Unlock()

	s, err := f.Stat()
	if(err != nil) {
		return err
	}

	// Add exclusive bit
	return (f.File).Chmod(s.Mode() | os.ModeExclusive)
}

func (f *file) Unlock() error {
	f.m.Lock()
	defer f.m.Unlock()

	s, err := f.Stat()
	if(err != nil) {
		return err
	}

	// Remove exclusive bit
	return (f.File).Chmod(s.Mode() & ^os.ModeExclusive)
}

I changed osfs/os_posix.go's build header to the following, but I'm not sure it's necessary:

// +build !windows,!plan9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions