Documentation
¶
Overview ¶
Package system provides tools for safely interacting with the operating system.
Index ¶
- Constants
- Variables
- func TypeString(e Enablement) string
- type ACL
- type Criteria
- type DBus
- type Enablement
- type Enablements
- type Hardlink
- type I
- func (sys *I) ChangeHosts(username string) *I
- func (sys *I) Commit(ctx context.Context) error
- func (sys *I) CopyFile(payload *[]byte, src string, cap int, n int64) *I
- func (sys *I) Ensure(name string, perm os.FileMode) *I
- func (sys *I) Ephemeral(et Enablement, name string, perm os.FileMode) *I
- func (sys *I) Equal(v *I) bool
- func (sys *I) Link(oldname, newname string) *I
- func (sys *I) LinkFileType(et Enablement, oldname, newname string) *I
- func (sys *I) MustProxyDBus(sessionPath string, session *dbus.Config, systemPath string, ...) *I
- func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath string) (func(), error)
- func (sys *I) Revert(ec *Criteria) error
- func (sys *I) UID() int
- func (sys *I) UpdatePerm(path string, perms ...acl.Perm) *I
- func (sys *I) UpdatePermType(et Enablement, path string, perms ...acl.Perm) *I
- func (sys *I) Wayland(syncFd **os.File, dst, src, appID, instanceID string) *I
- type Mkdir
- type Op
- type Tmpfile
- type Wayland
- type XHost
Constants ¶
const ( // User type is reverted at final launcher exit. User = Enablement(ELen) // Process type is unconditionally reverted on exit. Process = Enablement(ELen + 1) )
const ELen = len(enablementString)
Variables ¶
var (
ErrDBusConfig = errors.New("dbus config not supplied")
)
Functions ¶
func TypeString ¶
func TypeString(e Enablement) string
TypeString returns the string representation of a type stored as an Enablement.
Types ¶
type ACL ¶
type ACL struct {
// contains filtered or unexported fields
}
func (*ACL) Type ¶
func (a *ACL) Type() Enablement
type DBus ¶
type DBus struct {
// contains filtered or unexported fields
}
func (*DBus) Type ¶
func (d *DBus) Type() Enablement
type Enablement ¶
type Enablement uint8
Enablement represents an optional system resource
const ( EWayland Enablement = iota EX11 EDBus EPulse )
func (Enablement) Mask ¶
func (e Enablement) Mask() Enablements
func (Enablement) String ¶
func (e Enablement) String() string
type Enablements ¶
type Enablements uint64
Enablements represents optional system resources to share
func (*Enablements) Has ¶
func (es *Enablements) Has(e Enablement) bool
Has returns whether a feature is enabled
func (*Enablements) String ¶
func (es *Enablements) String() string
type Hardlink ¶
type Hardlink struct {
// contains filtered or unexported fields
}
func (*Hardlink) Type ¶
func (l *Hardlink) Type() Enablement
type I ¶
type I struct { IsVerbose func() bool Verbose func(v ...any) Verbosef func(format string, v ...any) WrapErr func(err error, a ...any) error // contains filtered or unexported fields }
An I provides indirect bulk operating system interaction. I must not be copied.
func (*I) ChangeHosts ¶
ChangeHosts appends an X11 ChangeHosts command Op.
func (*I) Commit ¶
Commit applies all Op held by I and reverts successful Op on first error encountered. Commit must not be called more than once.
func (*I) CopyFile ¶
CopyFile registers an Op that copies from src. A buffer is initialised with size cap and the Op faults if bytes read exceed n.
func (*I) Ephemeral ¶
Ephemeral ensures the temporary existence and mode of a directory through the life of et.
func (*I) LinkFileType ¶
func (sys *I) LinkFileType(et Enablement, oldname, newname string) *I
LinkFileType registers a file linking Op labelled with type et.
func (*I) MustProxyDBus ¶
func (*I) UpdatePerm ¶
UpdatePerm appends an ephemeral acl update Op.
func (*I) UpdatePermType ¶
UpdatePermType appends an acl update Op.
type Mkdir ¶
type Mkdir struct {
// contains filtered or unexported fields
}
func (*Mkdir) Type ¶
func (m *Mkdir) Type() Enablement
type Op ¶
type Op interface { // Type returns Op's enablement type. Type() Enablement Is(o Op) bool Path() string String() string // contains filtered or unexported methods }
Op is a reversible system operation.
type Tmpfile ¶
type Tmpfile struct {
// contains filtered or unexported fields
}
func (*Tmpfile) Type ¶
func (t *Tmpfile) Type() Enablement