aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/elastic/gosigar/sigar_util.go
blob: bf93b02b247f90eb793d29fbbe49a315ab286978 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2012 VMware, Inc.

package gosigar

import (
    "unsafe"
)

func bytePtrToString(ptr *int8) string {
    bytes := (*[10000]byte)(unsafe.Pointer(ptr))

    n := 0
    for bytes[n] != 0 {
        n++
    }

    return string(bytes[0:n])
}

func chop(buf []byte) []byte {
    return buf[0 : len(buf)-1]
}