Update vendoring (#801)
* Update vendor github.com/godbus/dbus@v4.1.0 * Update vendor github.com/golang/protobuf/proto * Update vendor github.com/mdlayher/netlink/... * Update vendor github.com/prometheus/client_golang/prometheus/... * Update vendor github.com/prometheus/client_model/go * Update vendor github.com/prometheus/common/... * Update vendor github.com/prometheus/procfs/... * Update vendor github.com/sirupsen/logrus@v1.0.4 * Update vendor golang.org/x/... * Update vendor gopkg.in/alecthomas/kingpin.v2 * Remove obsolete vendor github.com/mdlayher/netlink/genetlinkpull/805/head
parent
4ed49e73fb
commit
f9e91156d0
29
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
generated
vendored
29
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
generated
vendored
155
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
generated
vendored
155
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
generated
vendored
@ -0,0 +1,46 @@ |
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package util |
||||
|
||||
import "strconv" |
||||
|
||||
// ParseUint32s parses a slice of strings into a slice of uint32s.
|
||||
func ParseUint32s(ss []string) ([]uint32, error) { |
||||
us := make([]uint32, 0, len(ss)) |
||||
for _, s := range ss { |
||||
u, err := strconv.ParseUint(s, 10, 32) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
us = append(us, uint32(u)) |
||||
} |
||||
|
||||
return us, nil |
||||
} |
||||
|
||||
// ParseUint64s parses a slice of strings into a slice of uint64s.
|
||||
func ParseUint64s(ss []string) ([]uint64, error) { |
||||
us := make([]uint64, 0, len(ss)) |
||||
for _, s := range ss { |
||||
u, err := strconv.ParseUint(s, 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
us = append(us, u) |
||||
} |
||||
|
||||
return us, nil |
||||
} |
||||
@ -0,0 +1,203 @@ |
||||
package procfs |
||||
|
||||
import ( |
||||
"bufio" |
||||
"errors" |
||||
"os" |
||||
"sort" |
||||
"strconv" |
||||
"strings" |
||||
) |
||||
|
||||
// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.
|
||||
type NetDevLine struct { |
||||
Name string `json:"name"` // The name of the interface.
|
||||
RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received.
|
||||
RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received.
|
||||
RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered.
|
||||
RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving.
|
||||
RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors.
|
||||
RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors.
|
||||
RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
|
||||
RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver.
|
||||
TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted.
|
||||
TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted.
|
||||
TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered.
|
||||
TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting.
|
||||
TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors.
|
||||
TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
|
||||
TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver.
|
||||
TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
|
||||
} |
||||
|
||||
// NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys
|
||||
// are interface names.
|
||||
type NetDev map[string]NetDevLine |
||||
|
||||
// NewNetDev returns kernel/system statistics read from /proc/net/dev.
|
||||
func NewNetDev() (NetDev, error) { |
||||
fs, err := NewFS(DefaultMountPoint) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
return fs.NewNetDev() |
||||
} |
||||
|
||||
// NewNetDev returns kernel/system statistics read from /proc/net/dev.
|
||||
func (fs FS) NewNetDev() (NetDev, error) { |
||||
return newNetDev(fs.Path("net/dev")) |
||||
} |
||||
|
||||
// NewNetDev returns kernel/system statistics read from /proc/[pid]/net/dev.
|
||||
func (p Proc) NewNetDev() (NetDev, error) { |
||||
return newNetDev(p.path("net/dev")) |
||||
} |
||||
|
||||
// newNetDev creates a new NetDev from the contents of the given file.
|
||||
func newNetDev(file string) (NetDev, error) { |
||||
f, err := os.Open(file) |
||||
if err != nil { |
||||
return NetDev{}, err |
||||
} |
||||
defer f.Close() |
||||
|
||||
nd := NetDev{} |
||||
s := bufio.NewScanner(f) |
||||
for n := 0; s.Scan(); n++ { |
||||
// Skip the 2 header lines.
|
||||
if n < 2 { |
||||
continue |
||||
} |
||||
|
||||
line, err := nd.parseLine(s.Text()) |
||||
if err != nil { |
||||
return nd, err |
||||
} |
||||
|
||||
nd[line.Name] = *line |
||||
} |
||||
|
||||
return nd, s.Err() |
||||
} |
||||
|
||||
// parseLine parses a single line from the /proc/net/dev file. Header lines
|
||||
// must be filtered prior to calling this method.
|
||||
func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { |
||||
parts := strings.SplitN(rawLine, ":", 2) |
||||
if len(parts) != 2 { |
||||
return nil, errors.New("invalid net/dev line, missing colon") |
||||
} |
||||
fields := strings.Fields(strings.TrimSpace(parts[1])) |
||||
|
||||
var err error |
||||
line := &NetDevLine{} |
||||
|
||||
// Interface Name
|
||||
line.Name = strings.TrimSpace(parts[0]) |
||||
if line.Name == "" { |
||||
return nil, errors.New("invalid net/dev line, empty interface name") |
||||
} |
||||
|
||||
// RX
|
||||
line.RxBytes, err = strconv.ParseUint(fields[0], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxPackets, err = strconv.ParseUint(fields[1], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxErrors, err = strconv.ParseUint(fields[2], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxDropped, err = strconv.ParseUint(fields[3], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxFIFO, err = strconv.ParseUint(fields[4], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxFrame, err = strconv.ParseUint(fields[5], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxCompressed, err = strconv.ParseUint(fields[6], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.RxMulticast, err = strconv.ParseUint(fields[7], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
// TX
|
||||
line.TxBytes, err = strconv.ParseUint(fields[8], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxPackets, err = strconv.ParseUint(fields[9], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxErrors, err = strconv.ParseUint(fields[10], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxDropped, err = strconv.ParseUint(fields[11], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxFIFO, err = strconv.ParseUint(fields[12], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxCollisions, err = strconv.ParseUint(fields[13], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxCarrier, err = strconv.ParseUint(fields[14], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
line.TxCompressed, err = strconv.ParseUint(fields[15], 10, 64) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
return line, nil |
||||
} |
||||
|
||||
// Total aggregates the values across interfaces and returns a new NetDevLine.
|
||||
// The Name field will be a sorted comma seperated list of interface names.
|
||||
func (nd NetDev) Total() NetDevLine { |
||||
total := NetDevLine{} |
||||
|
||||
names := make([]string, 0, len(nd)) |
||||
for _, ifc := range nd { |
||||
names = append(names, ifc.Name) |
||||
total.RxBytes += ifc.RxBytes |
||||
total.RxPackets += ifc.RxPackets |
||||
total.RxPackets += ifc.RxPackets |
||||
total.RxErrors += ifc.RxErrors |
||||
total.RxDropped += ifc.RxDropped |
||||
total.RxFIFO += ifc.RxFIFO |
||||
total.RxFrame += ifc.RxFrame |
||||
total.RxCompressed += ifc.RxCompressed |
||||
total.RxMulticast += ifc.RxMulticast |
||||
total.TxBytes += ifc.TxBytes |
||||
total.TxPackets += ifc.TxPackets |
||||
total.TxErrors += ifc.TxErrors |
||||
total.TxDropped += ifc.TxDropped |
||||
total.TxFIFO += ifc.TxFIFO |
||||
total.TxCollisions += ifc.TxCollisions |
||||
total.TxCarrier += ifc.TxCarrier |
||||
total.TxCompressed += ifc.TxCompressed |
||||
} |
||||
sort.Strings(names) |
||||
total.Name = strings.Join(names, ", ") |
||||
|
||||
return total |
||||
} |
||||
@ -0,0 +1,263 @@ |
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package nfsd implements parsing of /proc/net/rpc/nfsd.
|
||||
// Fields are documented in https://www.svennd.be/nfsd-stats-explained-procnetrpcnfsd/
|
||||
package nfs |
||||
|
||||
// ReplyCache models the "rc" line.
|
||||
type ReplyCache struct { |
||||
Hits uint64 |
||||
Misses uint64 |
||||
NoCache uint64 |
||||
} |
||||
|
||||
// FileHandles models the "fh" line.
|
||||
type FileHandles struct { |
||||
Stale uint64 |
||||
TotalLookups uint64 |
||||
AnonLookups uint64 |
||||
DirNoCache uint64 |
||||
NoDirNoCache uint64 |
||||
} |
||||
|
||||
// InputOutput models the "io" line.
|
||||
type InputOutput struct { |
||||
Read uint64 |
||||
Write uint64 |
||||
} |
||||
|
||||
// Threads models the "th" line.
|
||||
type Threads struct { |
||||
Threads uint64 |
||||
FullCnt uint64 |
||||
} |
||||
|
||||
// ReadAheadCache models the "ra" line.
|
||||
type ReadAheadCache struct { |
||||
CacheSize uint64 |
||||
CacheHistogram []uint64 |
||||
NotFound uint64 |
||||
} |
||||
|
||||
// Network models the "net" line.
|
||||
type Network struct { |
||||
NetCount uint64 |
||||
UDPCount uint64 |
||||
TCPCount uint64 |
||||
TCPConnect uint64 |
||||
} |
||||
|
||||
// ClientRPC models the nfs "rpc" line.
|
||||
type ClientRPC struct { |
||||
RPCCount uint64 |
||||
Retransmissions uint64 |
||||
AuthRefreshes uint64 |
||||
} |
||||
|
||||
// ServerRPC models the nfsd "rpc" line.
|
||||
type ServerRPC struct { |
||||
RPCCount uint64 |
||||
BadCnt uint64 |
||||
BadFmt uint64 |
||||
BadAuth uint64 |
||||
BadcInt uint64 |
||||
} |
||||
|
||||
// V2Stats models the "proc2" line.
|
||||
type V2Stats struct { |
||||
Null uint64 |
||||
GetAttr uint64 |
||||
SetAttr uint64 |
||||
Root uint64 |
||||
Lookup uint64 |
||||
ReadLink uint64 |
||||
Read uint64 |
||||
WrCache uint64 |
||||
Write uint64 |
||||
Create uint64 |
||||
Remove uint64 |
||||
Rename uint64 |
||||
Link uint64 |
||||
SymLink uint64 |
||||
MkDir uint64 |
||||
RmDir uint64 |
||||
ReadDir uint64 |
||||
FsStat uint64 |
||||
} |
||||
|
||||
// V3Stats models the "proc3" line.
|
||||
type V3Stats struct { |
||||
Null uint64 |
||||
GetAttr uint64 |
||||
SetAttr uint64 |
||||
Lookup uint64 |
||||
Access uint64 |
||||
ReadLink uint64 |
||||
Read uint64 |
||||
Write uint64 |
||||
Create uint64 |
||||
MkDir uint64 |
||||
SymLink uint64 |
||||
MkNod uint64 |
||||
Remove uint64 |
||||
RmDir uint64 |
||||
Rename uint64 |
||||
Link uint64 |
||||
ReadDir uint64 |
||||
ReadDirPlus uint64 |
||||
FsStat uint64 |
||||
FsInfo uint64 |
||||
PathConf uint64 |
||||
Commit uint64 |
||||
} |
||||
|
||||
// ClientV4Stats models the nfs "proc4" line.
|
||||
type ClientV4Stats struct { |
||||
Null uint64 |
||||
Read uint64 |
||||
Write uint64 |
||||
Commit uint64 |
||||
Open uint64 |
||||
OpenConfirm uint64 |
||||
OpenNoattr uint64 |
||||
OpenDowngrade uint64 |
||||
Close uint64 |
||||
Setattr uint64 |
||||
FsInfo uint64 |
||||
Renew uint64 |
||||
SetClientId uint64 |
||||
SetClientIdConfirm uint64 |
||||
Lock uint64 |
||||
Lockt uint64 |
||||
Locku uint64 |
||||
Access uint64 |
||||
Getattr uint64 |
||||
Lookup uint64 |
||||
LookupRoot uint64 |
||||
Remove uint64 |
||||
Rename uint64 |
||||
Link uint64 |
||||
Symlink uint64 |
||||
Create uint64 |
||||
Pathconf uint64 |
||||
StatFs uint64 |
||||
ReadLink uint64 |
||||
ReadDir uint64 |
||||
ServerCaps uint64 |
||||
DelegReturn uint64 |
||||
GetAcl uint64 |
||||
SetAcl uint64 |
||||
FsLocations uint64 |
||||
ReleaseLockowner uint64 |
||||
Secinfo uint64 |
||||
FsidPresent uint64 |
||||
ExchangeId uint64 |
||||
CreateSession uint64 |
||||
DestroySession uint64 |
||||
Sequence uint64 |
||||
GetLeaseTime uint64 |
||||
ReclaimComplete uint64 |
||||
LayoutGet uint64 |
||||
GetDeviceInfo uint64 |
||||
LayoutCommit uint64 |
||||
LayoutReturn uint64 |
||||
SecinfoNoName uint64 |
||||
TestStateId uint64 |
||||
FreeStateId uint64 |
||||
GetDeviceList uint64 |
||||
BindConnToSession uint64 |
||||
DestroyClientId uint64 |
||||
Seek uint64 |
||||
Allocate uint64 |
||||
DeAllocate uint64 |
||||
LayoutStats uint64 |
||||
Clone uint64 |
||||
} |
||||
|
||||
// ServerV4Stats models the nfsd "proc4" line.
|
||||
type ServerV4Stats struct { |
||||
Null uint64 |
||||
Compound uint64 |
||||
} |
||||
|
||||
// V4Ops models the "proc4ops" line: NFSv4 operations
|
||||
// Variable list, see:
|
||||
// v4.0 https://tools.ietf.org/html/rfc3010 (38 operations)
|
||||
// v4.1 https://tools.ietf.org/html/rfc5661 (58 operations)
|
||||
// v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations)
|
||||
type V4Ops struct { |
||||
//Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct?
|
||||
Op0Unused uint64 |
||||
Op1Unused uint64 |
||||
Op2Future uint64 |
||||
Access uint64 |
||||
Close uint64 |
||||
Commit uint64 |
||||
Create uint64 |
||||
DelegPurge uint64 |
||||
DelegReturn uint64 |
||||
GetAttr uint64 |
||||
GetFH uint64 |
||||
Link uint64 |
||||
Lock uint64 |
||||
Lockt uint64 |
||||
Locku uint64 |
||||
Lookup uint64 |
||||
LookupRoot uint64 |
||||
Nverify uint64 |
||||
Open uint64 |
||||
OpenAttr uint64 |
||||
OpenConfirm uint64 |
||||
OpenDgrd uint64 |
||||
PutFH uint64 |
||||
PutPubFH uint64 |
||||
PutRootFH uint64 |
||||
Read uint64 |
||||
ReadDir uint64 |
||||
ReadLink uint64 |
||||
Remove uint64 |
||||
Rename uint64 |
||||
Renew uint64 |
||||
RestoreFH uint64 |
||||
SaveFH uint64 |
||||
SecInfo uint64 |
||||
SetAttr uint64 |
||||
Verify uint64 |
||||
Write uint64 |
||||
RelLockOwner uint64 |
||||
} |
||||
|
||||
// RPCStats models all stats from /proc/net/rpc/nfs.
|
||||
type ClientRPCStats struct { |
||||
Network Network |
||||
ClientRPC ClientRPC |
||||
V2Stats V2Stats |
||||
V3Stats V3Stats |
||||
ClientV4Stats ClientV4Stats |
||||
} |
||||
|
||||
// ServerRPCStats models all stats from /proc/net/rpc/nfsd.
|
||||
type ServerRPCStats struct { |
||||
ReplyCache ReplyCache |
||||
FileHandles FileHandles |
||||
InputOutput InputOutput |
||||
Threads Threads |
||||
ReadAheadCache ReadAheadCache |
||||
Network Network |
||||
ServerRPC ServerRPC |
||||
V2Stats V2Stats |
||||
V3Stats V3Stats |
||||
ServerV4Stats ServerV4Stats |
||||
V4Ops V4Ops |
||||
} |
||||
@ -0,0 +1,308 @@ |
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nfs |
||||
|
||||
import ( |
||||
"fmt" |
||||
) |
||||
|
||||
func parseReplyCache(v []uint64) (ReplyCache, error) { |
||||
if len(v) != 3 { |
||||
return ReplyCache{}, fmt.Errorf("invalid ReplyCache line %q", v) |
||||
} |
||||
|
||||
return ReplyCache{ |
||||
Hits: v[0], |
||||
Misses: v[1], |
||||
NoCache: v[2], |
||||
}, nil |
||||
} |
||||
|
||||
func parseFileHandles(v []uint64) (FileHandles, error) { |
||||
if len(v) != 5 { |
||||
return FileHandles{}, fmt.Errorf("invalid FileHandles, line %q", v) |
||||
} |
||||
|
||||
return FileHandles{ |
||||
Stale: v[0], |
||||
TotalLookups: v[1], |
||||
AnonLookups: v[2], |
||||
DirNoCache: v[3], |
||||
NoDirNoCache: v[4], |
||||
}, nil |
||||
} |
||||
|
||||
func parseInputOutput(v []uint64) (InputOutput, error) { |
||||
if len(v) != 2 { |
||||
return InputOutput{}, fmt.Errorf("invalid InputOutput line %q", v) |
||||
} |
||||
|
||||
return InputOutput{ |
||||
Read: v[0], |
||||
Write: v[1], |
||||
}, nil |
||||
} |
||||
|
||||
func parseThreads(v []uint64) (Threads, error) { |
||||
if len(v) != 2 { |
||||
return Threads{}, fmt.Errorf("invalid Threads line %q", v) |
||||
} |
||||
|
||||
return Threads{ |
||||
Threads: v[0], |
||||
FullCnt: v[1], |
||||
}, nil |
||||
} |
||||
|
||||
func parseReadAheadCache(v []uint64) (ReadAheadCache, error) { |
||||
if len(v) != 12 { |
||||
return ReadAheadCache{}, fmt.Errorf("invalid ReadAheadCache line %q", v) |
||||
} |
||||
|
||||
return ReadAheadCache{ |
||||
CacheSize: v[0], |
||||
CacheHistogram: v[1:11], |
||||
NotFound: v[11], |
||||
}, nil |
||||
} |
||||
|
||||
func parseNetwork(v []uint64) (Network, error) { |
||||
if len(v) != 4 { |
||||
return Network{}, fmt.Errorf("invalid Network line %q", v) |
||||
} |
||||
|
||||
return Network{ |
||||
NetCount: v[0], |
||||
UDPCount: v[1], |
||||
TCPCount: v[2], |
||||
TCPConnect: v[3], |
||||
}, nil |
||||
} |
||||
|
||||
func parseServerRPC(v []uint64) (ServerRPC, error) { |
||||
if len(v) != 5 { |
||||
return ServerRPC{}, fmt.Errorf("invalid RPC line %q", v) |
||||
} |
||||
|
||||
return ServerRPC{ |
||||
RPCCount: v[0], |
||||
BadCnt: v[1], |
||||
BadFmt: v[2], |
||||
BadAuth: v[3], |
||||
BadcInt: v[4], |
||||
}, nil |
||||
} |
||||
|
||||
func parseClientRPC(v []uint64) (ClientRPC, error) { |
||||
if len(v) != 3 { |
||||
return ClientRPC{}, fmt.Errorf("invalid RPC line %q", v) |
||||
} |
||||
|
||||
return ClientRPC{ |
||||
RPCCount: v[0], |
||||
Retransmissions: v[1], |
||||
AuthRefreshes: v[2], |
||||
}, nil |
||||
} |
||||
|
||||
func parseV2Stats(v []uint64) (V2Stats, error) { |
||||
values := int(v[0]) |
||||
if len(v[1:]) != values || values != 18 { |
||||
return V2Stats{}, fmt.Errorf("invalid V2Stats line %q", v) |
||||
} |
||||
|
||||
return V2Stats{ |
||||
Null: v[1], |
||||
GetAttr: v[2], |
||||
SetAttr: v[3], |
||||
Root: v[4], |
||||
Lookup: v[5], |
||||
ReadLink: v[6], |
||||
Read: v[7], |
||||
WrCache: v[8], |
||||
Write: v[9], |
||||
Create: v[10], |
||||
Remove: v[11], |
||||
Rename: v[12], |
||||
Link: v[13], |
||||
SymLink: v[14], |
||||
MkDir: v[15], |
||||
RmDir: v[16], |
||||
ReadDir: v[17], |
||||
FsStat: v[18], |
||||
}, nil |
||||
} |
||||
|
||||
func parseV3Stats(v []uint64) (V3Stats, error) { |
||||
values := int(v[0]) |
||||
if len(v[1:]) != values || values != 22 { |
||||
return V3Stats{}, fmt.Errorf("invalid V3Stats line %q", v) |
||||
} |
||||
|
||||
return V3Stats{ |
||||
Null: v[1], |
||||
GetAttr: v[2], |
||||
SetAttr: v[3], |
||||
Lookup: v[4], |
||||
Access: v[5], |
||||
ReadLink: v[6], |
||||
Read: v[7], |
||||
Write: v[8], |
||||
Create: v[9], |
||||
MkDir: v[10], |
||||
SymLink: v[11], |
||||
MkNod: v[12], |
||||
Remove: v[13], |
||||
RmDir: v[14], |
||||
Rename: v[15], |
||||
Link: v[16], |
||||
ReadDir: v[17], |
||||
ReadDirPlus: v[18], |
||||
FsStat: v[19], |
||||
FsInfo: v[20], |
||||
PathConf: v[21], |
||||
Commit: v[22], |
||||
}, nil |
||||
} |
||||
|
||||
func parseClientV4Stats(v []uint64) (ClientV4Stats, error) { |
||||
values := int(v[0]) |
||||
if len(v[1:]) != values || values < 59 { |
||||
return ClientV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v) |
||||
} |
||||
|
||||
return ClientV4Stats{ |
||||
Null: v[1], |
||||
Read: v[2], |
||||
Write: v[3], |
||||
Commit: v[4], |
||||
Open: v[5], |
||||
OpenConfirm: v[6], |
||||
OpenNoattr: v[7], |
||||
OpenDowngrade: v[8], |
||||
Close: v[9], |
||||
Setattr: v[10], |
||||
FsInfo: v[11], |
||||
Renew: v[12], |
||||
SetClientId: v[13], |
||||
SetClientIdConfirm: v[14], |
||||
Lock: v[15], |
||||
Lockt: v[16], |
||||
Locku: v[17], |
||||
Access: v[18], |
||||
Getattr: v[19], |
||||
Lookup: v[20], |
||||
LookupRoot: v[21], |
||||
Remove: v[22], |
||||
Rename: v[23], |
||||
Link: v[24], |
||||
Symlink: v[25], |
||||
Create: v[26], |
||||
Pathconf: v[27], |
||||
StatFs: v[28], |
||||
ReadLink: v[29], |
||||
ReadDir: v[30], |
||||
ServerCaps: v[31], |
||||
DelegReturn: v[32], |
||||
GetAcl: v[33], |
||||
SetAcl: v[34], |
||||
FsLocations: v[35], |
||||
ReleaseLockowner: v[36], |
||||
Secinfo: v[37], |
||||
FsidPresent: v[38], |
||||
ExchangeId: v[39], |
||||
CreateSession: v[40], |
||||
DestroySession: v[41], |
||||
Sequence: v[42], |
||||
GetLeaseTime: v[43], |
||||
ReclaimComplete: v[44], |
||||
LayoutGet: v[45], |
||||
GetDeviceInfo: v[46], |
||||
LayoutCommit: v[47], |
||||
LayoutReturn: v[48], |
||||
SecinfoNoName: v[49], |
||||
TestStateId: v[50], |
||||
FreeStateId: v[51], |
||||
GetDeviceList: v[52], |
||||
BindConnToSession: v[53], |
||||
DestroyClientId: v[54], |
||||
Seek: v[55], |
||||
Allocate: v[56], |
||||
DeAllocate: v[57], |
||||
LayoutStats: v[58], |
||||
Clone: v[59], |
||||
}, nil |
||||
} |
||||
|
||||
func parseServerV4Stats(v []uint64) (ServerV4Stats, error) { |
||||
values := int(v[0]) |
||||
if len(v[1:]) != values || values != 2 { |
||||
return ServerV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v) |
||||
} |
||||
|
||||
return ServerV4Stats{ |
||||
Null: v[1], |
||||
Compound: v[2], |
||||
}, nil |
||||
} |
||||
|
||||
func parseV4Ops(v []uint64) (V4Ops, error) { |
||||
values := int(v[0]) |
||||
if len(v[1:]) != values || values < 39 { |
||||
return V4Ops{}, fmt.Errorf("invalid V4Ops line %q", v) |
||||
} |
||||
|
||||
stats := V4Ops{ |
||||
Op0Unused: v[1], |
||||
Op1Unused: v[2], |
||||
Op2Future: v[3], |
||||
Access: v[4], |
||||
Close: v[5], |
||||
Commit: v[6], |
||||
Create: v[7], |
||||
DelegPurge: v[8], |
||||
DelegReturn: v[9], |
||||
GetAttr: v[10], |
||||
GetFH: v[11], |
||||
Link: v[12], |
||||
Lock: v[13], |
||||
Lockt: v[14], |
||||
Locku: v[15], |
||||
Lookup: v[16], |
||||
LookupRoot: v[17], |
||||
Nverify: v[18], |
||||
Open: v[19], |
||||
OpenAttr: v[20], |
||||
OpenConfirm: v[21], |
||||
OpenDgrd: v[22], |
||||
PutFH: v[23], |
||||
PutPubFH: v[24], |
||||
PutRootFH: v[25], |
||||
Read: v[26], |
||||
ReadDir: v[27], |
||||
ReadLink: v[28], |
||||
Remove: v[29], |
||||
Rename: v[30], |
||||
Renew: v[31], |
||||
RestoreFH: v[32], |
||||
SaveFH: v[33], |
||||
SecInfo: v[34], |
||||
SetAttr: v[35], |
||||
Verify: v[36], |
||||
Write: v[37], |
||||
RelLockOwner: v[38], |
||||
} |
||||
|
||||
return stats, nil |
||||
} |
||||
@ -0,0 +1,67 @@ |
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nfs |
||||
|
||||
import ( |
||||
"bufio" |
||||
"fmt" |
||||
"io" |
||||
"strings" |
||||
|
||||
"github.com/prometheus/procfs/internal/util" |
||||
) |
||||
|
||||
// ParseClientRPCStats returns stats read from /proc/net/rpc/nfs
|
||||
func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) { |
||||
stats := &ClientRPCStats{} |
||||
|
||||
scanner := bufio.NewScanner(r) |
||||
for scanner.Scan() { |
||||
line := scanner.Text() |
||||
parts := strings.Fields(scanner.Text()) |
||||
// require at least <key> <value>
|
||||
if len(parts) < 2 { |
||||
return nil, fmt.Errorf("invalid NFSd metric line %q", line) |
||||
} |
||||
|
||||
values, err := util.ParseUint64s(parts[1:]) |
||||
if err != nil { |
||||
return nil, fmt.Errorf("error parsing NFSd metric line: %s", err) |
||||
} |
||||
|
||||
switch metricLine := parts[0]; metricLine { |
||||
case "net": |
||||
stats.Network, err = parseNetwork(values) |
||||
case "rpc": |
||||
stats.ClientRPC, err = parseClientRPC(values) |
||||
case "proc2": |
||||
stats.V2Stats, err = parseV2Stats(values) |
||||
case "proc3": |
||||
stats.V3Stats, err = parseV3Stats(values) |
||||
case "proc4": |
||||
stats.ClientV4Stats, err = parseClientV4Stats(values) |
||||
default: |
||||
return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) |
||||
} |
||||
if err != nil { |
||||
return nil, fmt.Errorf("errors parsing NFSd metric line: %s", err) |
||||
} |
||||
} |
||||
|
||||
if err := scanner.Err(); err != nil { |
||||
return nil, fmt.Errorf("error scanning NFSd file: %s", err) |
||||
} |
||||
|
||||
return stats, nil |
||||
} |
||||
@ -0,0 +1,89 @@ |
||||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package nfs |
||||
|
||||
import ( |
||||
"bufio" |
||||
"fmt" |
||||
"io" |
||||
"strings" |
||||
|
||||
"github.com/prometheus/procfs/internal/util" |
||||
) |
||||
|
||||
// ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd
|
||||
func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) { |
||||
stats := &ServerRPCStats{} |
||||
|
||||
scanner := bufio.NewScanner(r) |
||||
for scanner.Scan() { |
||||
line := scanner.Text() |
||||
parts := strings.Fields(scanner.Text()) |
||||
// require at least <key> <value>
|
||||
if len(parts) < 2 { |
||||
return nil, fmt.Errorf("invalid NFSd metric line %q", line) |
||||
} |
||||
label := parts[0] |
||||
|
||||
var values []uint64 |
||||
var err error |
||||
if label == "th" { |
||||
if len(parts) < 3 { |
||||
return nil, fmt.Errorf("invalid NFSd th metric line %q", line) |
||||
} |
||||
values, err = util.ParseUint64s(parts[1:3]) |
||||
} else { |
||||
values, err = util.ParseUint64s(parts[1:]) |
||||
} |
||||
if err != nil { |
||||
return nil, fmt.Errorf("error parsing NFSd metric line: %s", err) |
||||
} |
||||
|
||||
switch metricLine := parts[0]; metricLine { |
||||
case "rc": |
||||
stats.ReplyCache, err = parseReplyCache(values) |
||||
case "fh": |
||||
stats.FileHandles, err = parseFileHandles(values) |
||||
case "io": |
||||
stats.InputOutput, err = parseInputOutput(values) |
||||
case "th": |
||||
stats.Threads, err = parseThreads(values) |
||||
case "ra": |
||||
stats.ReadAheadCache, err = parseReadAheadCache(values) |
||||
case "net": |
||||
stats.Network, err = parseNetwork(values) |
||||
case "rpc": |
||||
stats.ServerRPC, err = parseServerRPC(values) |
||||
case "proc2": |
||||
stats.V2Stats, err = parseV2Stats(values) |
||||
case "proc3": |
||||
stats.V3Stats, err = parseV3Stats(values) |
||||
case "proc4": |
||||
stats.ServerV4Stats, err = parseServerV4Stats(values) |
||||
case "proc4ops": |
||||
stats.V4Ops, err = parseV4Ops(values) |
||||
default: |
||||
return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) |
||||
} |
||||
if err != nil { |
||||
return nil, fmt.Errorf("errors parsing NFSd metric line: %s", err) |
||||
} |
||||
} |
||||
|
||||
if err := scanner.Err(); err != nil { |
||||
return nil, fmt.Errorf("error scanning NFSd file: %s", err) |
||||
} |
||||
|
||||
return stats, nil |
||||
} |
||||
@ -0,0 +1,55 @@ |
||||
package procfs |
||||
|
||||
import ( |
||||
"fmt" |
||||
"os" |
||||
"strconv" |
||||
"strings" |
||||
) |
||||
|
||||
// Namespace represents a single namespace of a process.
|
||||
type Namespace struct { |
||||
Type string // Namespace type.
|
||||
Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match.
|
||||
} |
||||
|
||||
// Namespaces contains all of the namespaces that the process is contained in.
|
||||
type Namespaces map[string]Namespace |
||||
|
||||
// NewNamespaces reads from /proc/[pid/ns/* to get the namespaces of which the
|
||||
// process is a member.
|
||||
func (p Proc) NewNamespaces() (Namespaces, error) { |
||||
d, err := os.Open(p.path("ns")) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
defer d.Close() |
||||
|
||||
names, err := d.Readdirnames(-1) |
||||
if err != nil { |
||||
return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) |
||||
} |
||||
|
||||
ns := make(Namespaces, len(names)) |
||||
for _, name := range names { |
||||
target, err := os.Readlink(p.path("ns", name)) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
|
||||
fields := strings.SplitN(target, ":", 2) |
||||
if len(fields) != 2 { |
||||
return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) |
||||
} |
||||
|
||||
typ := fields[0] |
||||
inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) |
||||
if err != nil { |
||||
return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) |
||||
} |
||||
|
||||
ns[name] = Namespace{typ, uint32(inode)} |
||||
} |
||||
|
||||
return ns, nil |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
// +build appengine
|
||||
|
||||
package logrus |
||||
|
||||
import ( |
||||
"io" |
||||
) |
||||
|
||||
func checkIfTerminal(w io.Writer) bool { |
||||
return true |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
// +build !appengine
|
||||
|
||||
package logrus |
||||
|
||||
import ( |
||||
"io" |
||||
"os" |
||||
|
||||
"golang.org/x/crypto/ssh/terminal" |
||||
) |
||||
|
||||
func checkIfTerminal(w io.Writer) bool { |
||||
switch v := w.(type) { |
||||
case *os.File: |
||||
return terminal.IsTerminal(int(v.Fd())) |
||||
default: |
||||
return false |
||||
} |
||||
} |
||||
@ -0,0 +1,61 @@ |
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_darwin.go
|
||||
|
||||
package socket |
||||
|
||||
const ( |
||||
sysAF_UNSPEC = 0x0 |
||||
sysAF_INET = 0x2 |
||||
sysAF_INET6 = 0x1e |
||||
|
||||
sysSOCK_RAW = 0x3 |
||||
) |
||||
|
||||
type iovec struct { |
||||
Base *byte |
||||
Len uint64 |
||||
} |
||||
|
||||
type msghdr struct { |
||||
Name *byte |
||||
Namelen uint32 |
||||
Pad_cgo_0 [4]byte |
||||
Iov *iovec |
||||
Iovlen int32 |
||||
Pad_cgo_1 [4]byte |
||||
Control *byte |
||||
Controllen uint32 |
||||
Flags int32 |
||||
} |
||||
|
||||
type cmsghdr struct { |
||||
Len uint32 |
||||
Level int32 |
||||
Type int32 |
||||
} |
||||
|
||||
type sockaddrInet struct { |
||||
Len uint8 |
||||
Family uint8 |
||||
Port uint16 |
||||
Addr [4]byte /* in_addr */ |
||||
Zero [8]int8 |
||||
} |
||||
|
||||
type sockaddrInet6 struct { |
||||
Len uint8 |
||||
Family uint8 |
||||
Port uint16 |
||||
Flowinfo uint32 |
||||
Addr [16]byte /* in6_addr */ |
||||
Scope_id uint32 |
||||
} |
||||
|
||||
const ( |
||||
sizeofIovec = 0x10 |
||||
sizeofMsghdr = 0x30 |
||||
sizeofCmsghdr = 0xc |
||||
|
||||
sizeofSockaddrInet = 0x10 |
||||
sizeofSockaddrInet6 = 0x1c |
||||
) |
||||
@ -0,0 +1,124 @@ |
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// CPU affinity functions
|
||||
|
||||
package unix |
||||
|
||||
import ( |
||||
"unsafe" |
||||
) |
||||
|
||||
const cpuSetSize = _CPU_SETSIZE / _NCPUBITS |
||||
|
||||
// CPUSet represents a CPU affinity mask.
|
||||
type CPUSet [cpuSetSize]cpuMask |
||||
|
||||
func schedAffinity(trap uintptr, pid int, set *CPUSet) error { |
||||
_, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(set)), uintptr(unsafe.Pointer(set))) |
||||
if e != 0 { |
||||
return errnoErr(e) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
|
||||
// If pid is 0 the calling thread is used.
|
||||
func SchedGetaffinity(pid int, set *CPUSet) error { |
||||
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set) |
||||
} |
||||
|
||||
// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
|
||||
// If pid is 0 the calling thread is used.
|
||||
func SchedSetaffinity(pid int, set *CPUSet) error { |
||||
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set) |
||||
} |
||||
|
||||
// Zero clears the set s, so that it contains no CPUs.
|
||||
func (s *CPUSet) Zero() { |
||||
for i := range s { |
||||
s[i] = 0 |
||||
} |
||||
} |
||||
|
||||
func cpuBitsIndex(cpu int) int { |
||||
return cpu / _NCPUBITS |
||||
} |
||||
|
||||
func cpuBitsMask(cpu int) cpuMask { |
||||
return cpuMask(1 << (uint(cpu) % _NCPUBITS)) |
||||
} |
||||
|
||||
// Set adds cpu to the set s.
|
||||
func (s *CPUSet) Set(cpu int) { |
||||
i := cpuBitsIndex(cpu) |
||||
if i < len(s) { |
||||
s[i] |= cpuBitsMask(cpu) |
||||
} |
||||
} |
||||
|
||||
// Clear removes cpu from the set s.
|
||||
func (s *CPUSet) Clear(cpu int) { |
||||
i := cpuBitsIndex(cpu) |
||||
if i < len(s) { |
||||
s[i] &^= cpuBitsMask(cpu) |
||||
} |
||||
} |
||||
|
||||
// IsSet reports whether cpu is in the set s.
|
||||
func (s *CPUSet) IsSet(cpu int) bool { |
||||
i := cpuBitsIndex(cpu) |
||||
if i < len(s) { |
||||
return s[i]&cpuBitsMask(cpu) != 0 |
||||
} |
||||
return false |
||||
} |
||||
|
||||
// Count returns the number of CPUs in the set s.
|
||||
func (s *CPUSet) Count() int { |
||||
c := 0 |
||||
for _, b := range s { |
||||
c += onesCount64(uint64(b)) |
||||
} |
||||
return c |
||||
} |
||||
|
||||
// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64.
|
||||
// Once this package can require Go 1.9, we can delete this
|
||||
// and update the caller to use bits.OnesCount64.
|
||||
func onesCount64(x uint64) int { |
||||
const m0 = 0x5555555555555555 // 01010101 ...
|
||||
const m1 = 0x3333333333333333 // 00110011 ...
|
||||
const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ...
|
||||
const m3 = 0x00ff00ff00ff00ff // etc.
|
||||
const m4 = 0x0000ffff0000ffff |
||||
|
||||
// Implementation: Parallel summing of adjacent bits.
|
||||
// See "Hacker's Delight", Chap. 5: Counting Bits.
|
||||
// The following pattern shows the general approach:
|
||||
//
|
||||
// x = x>>1&(m0&m) + x&(m0&m)
|
||||
// x = x>>2&(m1&m) + x&(m1&m)
|
||||
// x = x>>4&(m2&m) + x&(m2&m)
|
||||
// x = x>>8&(m3&m) + x&(m3&m)
|
||||
// x = x>>16&(m4&m) + x&(m4&m)
|
||||
// x = x>>32&(m5&m) + x&(m5&m)
|
||||
// return int(x)
|
||||
//
|
||||
// Masking (& operations) can be left away when there's no
|
||||
// danger that a field's sum will carry over into the next
|
||||
// field: Since the result cannot be > 64, 8 bits is enough
|
||||
// and we can ignore the masks for the shifts by 8 and up.
|
||||
// Per "Hacker's Delight", the first line can be simplified
|
||||
// more, but it saves at best one instruction, so we leave
|
||||
// it alone for clarity.
|
||||
const m = 1<<64 - 1 |
||||
x = x>>1&(m0&m) + x&(m0&m) |
||||
x = x>>2&(m1&m) + x&(m1&m) |
||||
x = (x>>4 + x) & (m2 & m) |
||||
x += x >> 8 |
||||
x += x >> 16 |
||||
x += x >> 32 |
||||
return int(x) & (1<<7 - 1) |
||||
} |
||||
@ -1,14 +0,0 @@ |
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.4
|
||||
|
||||
package unix |
||||
|
||||
import "syscall" |
||||
|
||||
func Unsetenv(key string) error { |
||||
// This was added in Go 1.4.
|
||||
return syscall.Unsetenv(key) |
||||
} |
||||
@ -1,27 +0,0 @@ |
||||
// Copyright 2017 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package unix |
||||
|
||||
import ( |
||||
"os" |
||||
"syscall" |
||||
) |
||||
|
||||
// FIXME: unexported function from os
|
||||
// syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
|
||||
func syscallMode(i os.FileMode) (o uint32) { |
||||
o |= uint32(i.Perm()) |
||||
if i&os.ModeSetuid != 0 { |
||||
o |= syscall.S_ISUID |
||||
} |
||||
if i&os.ModeSetgid != 0 { |
||||
o |= syscall.S_ISGID |
||||
} |
||||
if i&os.ModeSticky != 0 { |
||||
o |= syscall.S_ISVTX |
||||
} |
||||
// No mapping for Go's ModeTemporary (plan9 only).
|
||||
return |
||||
} |
||||
@ -1,11 +0,0 @@ |
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build dragonfly freebsd netbsd openbsd
|
||||
|
||||
package unix |
||||
|
||||
const ImplementsGetwd = false |
||||
|
||||
func Getwd() (string, error) { return "", ENOTSUP } |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue