Documentation ¶
Overview ¶
dirEntryArr is utility for sorting directory listings
Module created for easier unit testing ¶
not all distros have support for /dev/serial actual device file is key by-id or by-path
checking what files are open by specific pid and what pids are using specific file
Index ¶
- Constants
- func FileIsInUseByPids(filename string) ([]int64, bool, error)
- func ListByDev() ([]string, error)
- func ListById() (map[string]string, error)
- func ListByPath() (map[string]string, error)
- func ListOfSerialTTYDriverPrefixes() ([]string, error)
- func ListOpenFilesByPid(pid int64) ([]string, error)
- type ByDeviceName
- type DirEntryArr
- type Entry
- type FilepathLinkEvaluator
- type SymlinkEvaluator
Constants ¶
View Source
const ( NOTINUSEPID = -1 //port is free UNCERTAINPID = -2 //can not determine is port free or not (missing rights, non root user) )
Special PID return values
Variables ¶
This section is empty.
Functions ¶
func ListByDev ¶
ListDev lists serial ports named directly under /dev/ old fashioned (or minimal system)
func ListByPath ¶
func ListOpenFilesByPid ¶
Types ¶
type ByDeviceName ¶
type ByDeviceName []Entry
ByDeviceName is type for sorting
func (ByDeviceName) Len ¶
func (a ByDeviceName) Len() int
func (ByDeviceName) Less ¶
func (a ByDeviceName) Less(i, j int) bool
func (ByDeviceName) Swap ¶
func (a ByDeviceName) Swap(i, j int)
type DirEntryArr ¶
func ReadDirEntryArr ¶
func ReadDirEntryArr(filesys fs.FS, name string) (DirEntryArr, error)
func (*DirEntryArr) DirsOnly ¶
func (p *DirEntryArr) DirsOnly(addPath string) []string
func (*DirEntryArr) FilesOnly ¶
func (p *DirEntryArr) FilesOnly(addPath string) []string
func (*DirEntryArr) NumberFiles ¶
func (p *DirEntryArr) NumberFiles() []int64
func (*DirEntryArr) ResolvedNames ¶
func (p *DirEntryArr) ResolvedNames(pathname string, skipUnresolved bool) ([]string, []error)
type Entry ¶
type Entry struct { DeviceFile string //With complete path UsedByPids []int64 //In case of conflict, file is open by multiple pids Certain bool DeviceByID string DeviceByPath string }
Entry collects final result of serial port status
func NewEntries ¶
NewEntries lists really new entries
func (*Entry) ToPrintoutFormat ¶
ToPrintoutFormat for formatting command line printout
type FilepathLinkEvaluator ¶
type FilepathLinkEvaluator struct{}
type SymlinkEvaluator ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.