Documentation ¶
Overview ¶
Package filesystem provides functions and types to interact with the filesystem
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
FileExists returns true if a file exists and is accessible, false otherwise
func GetFileModTime ¶ added in v0.52.0
GetFileModTime gets the modification time
func GetFileSize ¶ added in v0.52.0
GetFileSize gets the file size
func OpenShared ¶
OpenShared reimplements the os.Open function for Windows because the default implementation opens files without the FILE_SHARE_DELETE flag. cf: https://github.com/golang/go/blob/release-branch.go1.11/src/syscall/syscall_windows.go#L271 Without FILE_SHARE_DELETE, other users cannot rename/remove the file while this handle is open. Adding this flag allows the agent to have the file open, while not preventing it from being rotated/deleted.
On non-Windows platforms, this calls through to os.Open directly.
Types ¶
type Permission ¶
type Permission struct{}
Permission handles permissions for Unix and Windows
func NewPermission ¶
func NewPermission() (*Permission, error)
NewPermission creates a new instance of `Permission`
func (*Permission) RemoveAccessToOtherUsers ¶
func (p *Permission) RemoveAccessToOtherUsers(path string) error
RemoveAccessToOtherUsers on Unix this calls RestrictAccessToUser and then removes all access to the file for 'group' and 'other'
func (*Permission) RestrictAccessToUser ¶
func (p *Permission) RestrictAccessToUser(path string) error
RestrictAccessToUser sets the file user and group to the same as 'dd-agent' user. If the function fails to lookup "dd-agent" user it return nil immediately.