1
2
3 package schema
4
5 import (
6 "os"
7 "syscall"
8 )
9
10 func init() {
11 populateSchemaStat = append(populateSchemaStat, populateSchemaUnix)
12 }
13
14 func populateSchemaUnix(m map[string]interface{}, fi os.FileInfo) {
15 st, ok := fi.Sys().(*syscall.Stat_t)
16 if !ok {
17 return
18 }
19 m["unixOwnerId"] = st.Uid
20 if user := getUserFromUid(int(st.Uid)); user != "" {
21 m["unixOwner"] = user
22 }
23 m["unixGroupId"] = st.Gid
24 if group := getGroupFromGid(int(st.Gid)); group != "" {
25 m["unixGroup"] = group
26 }
27 }