2023-12-31 16:39:29 +00:00
|
|
|
//go:build linux || darwin || netbsd || freebsd || openbsd
|
2012-04-14 01:40:59 +00:00
|
|
|
|
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
populateSchemaStat = append(populateSchemaStat, populateSchemaUnix)
|
|
|
|
}
|
|
|
|
|
2013-01-22 04:56:12 +00:00
|
|
|
func populateSchemaUnix(m map[string]interface{}, fi os.FileInfo) {
|
2012-04-14 01:40:59 +00:00
|
|
|
st, ok := fi.Sys().(*syscall.Stat_t)
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
m["unixOwnerId"] = st.Uid
|
|
|
|
if user := getUserFromUid(int(st.Uid)); user != "" {
|
|
|
|
m["unixOwner"] = user
|
|
|
|
}
|
|
|
|
m["unixGroupId"] = st.Gid
|
|
|
|
if group := getGroupFromGid(int(st.Gid)); group != "" {
|
|
|
|
m["unixGroup"] = group
|
|
|
|
}
|
|
|
|
}
|