id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
28,700
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
TmpVarCode
func (p *Param) TmpVarCode() string { switch { case p.Type == "bool": return p.BoolTmpVarCode() case strings.HasPrefix(p.Type, "[]"): return p.SliceTmpVarCode() default: return "" } }
go
func (p *Param) TmpVarCode() string { switch { case p.Type == "bool": return p.BoolTmpVarCode() case strings.HasPrefix(p.Type, "[]"): return p.SliceTmpVarCode() default: return "" } }
[ "func", "(", "p", "*", "Param", ")", "TmpVarCode", "(", ")", "string", "{", "switch", "{", "case", "p", ".", "Type", "==", "\"", "\"", ":", "return", "p", ".", "BoolTmpVarCode", "(", ")", "\n", "case", "strings", ".", "HasPrefix", "(", "p", ".", ...
// TmpVarCode returns source code for temp variable.
[ "TmpVarCode", "returns", "source", "code", "for", "temp", "variable", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L151-L160
28,701
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperType
func (p *Param) HelperType() string { if p.Type == "string" { return p.fn.StrconvType() } return p.Type }
go
func (p *Param) HelperType() string { if p.Type == "string" { return p.fn.StrconvType() } return p.Type }
[ "func", "(", "p", "*", "Param", ")", "HelperType", "(", ")", "string", "{", "if", "p", ".", "Type", "==", "\"", "\"", "{", "return", "p", ".", "fn", ".", "StrconvType", "(", ")", "\n", "}", "\n", "return", "p", ".", "Type", "\n", "}" ]
// HelperType returns type of parameter p used in helper function.
[ "HelperType", "returns", "type", "of", "parameter", "p", "used", "in", "helper", "function", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L198-L203
28,702
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
join
func join(ps []*Param, fn func(*Param) string, sep string) string { if len(ps) == 0 { return "" } a := make([]string, 0) for _, p := range ps { a = append(a, fn(p)) } return strings.Join(a, sep) }
go
func join(ps []*Param, fn func(*Param) string, sep string) string { if len(ps) == 0 { return "" } a := make([]string, 0) for _, p := range ps { a = append(a, fn(p)) } return strings.Join(a, sep) }
[ "func", "join", "(", "ps", "[", "]", "*", "Param", ",", "fn", "func", "(", "*", "Param", ")", "string", ",", "sep", "string", ")", "string", "{", "if", "len", "(", "ps", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "a", ":=", ...
// join concatenates parameters ps into a string with sep separator. // Each parameter is converted into string by applying fn to it // before conversion.
[ "join", "concatenates", "parameters", "ps", "into", "a", "string", "with", "sep", "separator", ".", "Each", "parameter", "is", "converted", "into", "string", "by", "applying", "fn", "to", "it", "before", "conversion", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L208-L217
28,703
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ErrorVarName
func (r *Rets) ErrorVarName() string { if r.ReturnsError { return "err" } if r.Type == "error" { return r.Name } return "" }
go
func (r *Rets) ErrorVarName() string { if r.ReturnsError { return "err" } if r.Type == "error" { return r.Name } return "" }
[ "func", "(", "r", "*", "Rets", ")", "ErrorVarName", "(", ")", "string", "{", "if", "r", ".", "ReturnsError", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "r", ".", "Type", "==", "\"", "\"", "{", "return", "r", ".", "Name", "\n", "}", "\n",...
// ErrorVarName returns error variable name for r.
[ "ErrorVarName", "returns", "error", "variable", "name", "for", "r", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L228-L236
28,704
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
List
func (r *Rets) List() string { s := join(r.ToParams(), func(p *Param) string { return p.Name + " " + p.Type }, ", ") if len(s) > 0 { s = "(" + s + ")" } return s }
go
func (r *Rets) List() string { s := join(r.ToParams(), func(p *Param) string { return p.Name + " " + p.Type }, ", ") if len(s) > 0 { s = "(" + s + ")" } return s }
[ "func", "(", "r", "*", "Rets", ")", "List", "(", ")", "string", "{", "s", ":=", "join", "(", "r", ".", "ToParams", "(", ")", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", "."...
// List returns source code of syscall return parameters.
[ "List", "returns", "source", "code", "of", "syscall", "return", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L251-L257
28,705
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
PrintList
func (r *Rets) PrintList() string { return join(r.ToParams(), func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
go
func (r *Rets) PrintList() string { return join(r.ToParams(), func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
[ "func", "(", "r", "*", "Rets", ")", "PrintList", "(", ")", "string", "{", "return", "join", "(", "r", ".", "ToParams", "(", ")", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`\"%s=\", %s, `", ",", ...
// PrintList returns source code of trace printing part correspondent // to syscall return values.
[ "PrintList", "returns", "source", "code", "of", "trace", "printing", "part", "correspondent", "to", "syscall", "return", "values", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L261-L263
28,706
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SetReturnValuesCode
func (r *Rets) SetReturnValuesCode() string { if r.Name == "" && !r.ReturnsError { return "" } retvar := "r0" if r.Name == "" { retvar = "r1" } errvar := "_" if r.ReturnsError { errvar = "e1" } return fmt.Sprintf("%s, _, %s := ", retvar, errvar) }
go
func (r *Rets) SetReturnValuesCode() string { if r.Name == "" && !r.ReturnsError { return "" } retvar := "r0" if r.Name == "" { retvar = "r1" } errvar := "_" if r.ReturnsError { errvar = "e1" } return fmt.Sprintf("%s, _, %s := ", retvar, errvar) }
[ "func", "(", "r", "*", "Rets", ")", "SetReturnValuesCode", "(", ")", "string", "{", "if", "r", ".", "Name", "==", "\"", "\"", "&&", "!", "r", ".", "ReturnsError", "{", "return", "\"", "\"", "\n", "}", "\n", "retvar", ":=", "\"", "\"", "\n", "if",...
// SetReturnValuesCode returns source code that accepts syscall return values.
[ "SetReturnValuesCode", "returns", "source", "code", "that", "accepts", "syscall", "return", "values", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L266-L279
28,707
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SetErrorCode
func (r *Rets) SetErrorCode() string { const code = `if r0 != 0 { %s = %sErrno(r0) }` if r.Name == "" && !r.ReturnsError { return "" } if r.Name == "" { return r.useLongHandleErrorCode("r1") } if r.Type == "error" { return fmt.Sprintf(code, r.Name, syscalldot()) } s := "" switch { case r.Type[0] == '...
go
func (r *Rets) SetErrorCode() string { const code = `if r0 != 0 { %s = %sErrno(r0) }` if r.Name == "" && !r.ReturnsError { return "" } if r.Name == "" { return r.useLongHandleErrorCode("r1") } if r.Type == "error" { return fmt.Sprintf(code, r.Name, syscalldot()) } s := "" switch { case r.Type[0] == '...
[ "func", "(", "r", "*", "Rets", ")", "SetErrorCode", "(", ")", "string", "{", "const", "code", "=", "`if r0 != 0 {\n\t\t%s = %sErrno(r0)\n\t}`", "\n", "if", "r", ".", "Name", "==", "\"", "\"", "&&", "!", "r", ".", "ReturnsError", "{", "return", "\"", "\""...
// SetErrorCode returns source code that sets return parameters.
[ "SetErrorCode", "returns", "source", "code", "that", "sets", "return", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L297-L323
28,708
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
extractParams
func extractParams(s string, f *Fn) ([]*Param, error) { s = trim(s) if s == "" { return nil, nil } a := strings.Split(s, ",") ps := make([]*Param, len(a)) for i := range ps { s2 := trim(a[i]) b := strings.Split(s2, " ") if len(b) != 2 { b = strings.Split(s2, "\t") if len(b) != 2 { return nil, er...
go
func extractParams(s string, f *Fn) ([]*Param, error) { s = trim(s) if s == "" { return nil, nil } a := strings.Split(s, ",") ps := make([]*Param, len(a)) for i := range ps { s2 := trim(a[i]) b := strings.Split(s2, " ") if len(b) != 2 { b = strings.Split(s2, "\t") if len(b) != 2 { return nil, er...
[ "func", "extractParams", "(", "s", "string", ",", "f", "*", "Fn", ")", "(", "[", "]", "*", "Param", ",", "error", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "nil", "\n", "}", "\n...
// extractParams parses s to extract function parameters.
[ "extractParams", "parses", "s", "to", "extract", "function", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L339-L363
28,709
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
extractSection
func extractSection(s string, start, end rune) (prefix, body, suffix string, found bool) { s = trim(s) if strings.HasPrefix(s, string(start)) { // no prefix body = s[1:] } else { a := strings.SplitN(s, string(start), 2) if len(a) != 2 { return "", "", s, false } prefix = a[0] body = a[1] } a := st...
go
func extractSection(s string, start, end rune) (prefix, body, suffix string, found bool) { s = trim(s) if strings.HasPrefix(s, string(start)) { // no prefix body = s[1:] } else { a := strings.SplitN(s, string(start), 2) if len(a) != 2 { return "", "", s, false } prefix = a[0] body = a[1] } a := st...
[ "func", "extractSection", "(", "s", "string", ",", "start", ",", "end", "rune", ")", "(", "prefix", ",", "body", ",", "suffix", "string", ",", "found", "bool", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "if", "strings", ".", "HasPrefix", "(",...
// extractSection extracts text out of string s starting after start // and ending just before end. found return value will indicate success, // and prefix, body and suffix will contain correspondent parts of string s.
[ "extractSection", "extracts", "text", "out", "of", "string", "s", "starting", "after", "start", "and", "ending", "just", "before", "end", ".", "found", "return", "value", "will", "indicate", "success", "and", "prefix", "body", "and", "suffix", "will", "contain...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L368-L386
28,710
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
newFn
func newFn(s string) (*Fn, error) { s = trim(s) f := &Fn{ Rets: &Rets{}, src: s, PrintTrace: *printTraceFlag, } // function name and args prefix, body, s, found := extractSection(s, '(', ')') if !found || prefix == "" { return nil, errors.New("Could not extract function name and parameters fr...
go
func newFn(s string) (*Fn, error) { s = trim(s) f := &Fn{ Rets: &Rets{}, src: s, PrintTrace: *printTraceFlag, } // function name and args prefix, body, s, found := extractSection(s, '(', ')') if !found || prefix == "" { return nil, errors.New("Could not extract function name and parameters fr...
[ "func", "newFn", "(", "s", "string", ")", "(", "*", "Fn", ",", "error", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "f", ":=", "&", "Fn", "{", "Rets", ":", "&", "Rets", "{", "}", ",", "src", ":", "s", ",", "PrintTrace", ":", "*", "pr...
// newFn parses string s and return created function Fn.
[ "newFn", "parses", "string", "s", "and", "return", "created", "function", "Fn", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L389-L459
28,711
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
DLLFuncName
func (f *Fn) DLLFuncName() string { if f.dllfuncname == "" { return f.Name } return f.dllfuncname }
go
func (f *Fn) DLLFuncName() string { if f.dllfuncname == "" { return f.Name } return f.dllfuncname }
[ "func", "(", "f", "*", "Fn", ")", "DLLFuncName", "(", ")", "string", "{", "if", "f", ".", "dllfuncname", "==", "\"", "\"", "{", "return", "f", ".", "Name", "\n", "}", "\n", "return", "f", ".", "dllfuncname", "\n", "}" ]
// DLLName returns DLL function name for function f.
[ "DLLName", "returns", "DLL", "function", "name", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L470-L475
28,712
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamList
func (f *Fn) ParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.Type }, ", ") }
go
func (f *Fn) ParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.Type }, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "ParamList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", ".", "Type", "}...
// ParamList returns source code for function f parameters.
[ "ParamList", "returns", "source", "code", "for", "function", "f", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L478-L480
28,713
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperParamList
func (f *Fn) HelperParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.HelperType() }, ", ") }
go
func (f *Fn) HelperParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.HelperType() }, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "HelperParamList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", ".", "Helpe...
// HelperParamList returns source code for helper function f parameters.
[ "HelperParamList", "returns", "source", "code", "for", "helper", "function", "f", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L483-L485
28,714
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamPrintList
func (f *Fn) ParamPrintList() string { return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
go
func (f *Fn) ParamPrintList() string { return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
[ "func", "(", "f", "*", "Fn", ")", "ParamPrintList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`\"%s=\", %s, `", ",", "p", ".",...
// ParamPrintList returns source code of trace printing part correspondent // to syscall input parameters.
[ "ParamPrintList", "returns", "source", "code", "of", "trace", "printing", "part", "correspondent", "to", "syscall", "input", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L489-L491
28,715
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamCount
func (f *Fn) ParamCount() int { n := 0 for _, p := range f.Params { n += len(p.SyscallArgList()) } return n }
go
func (f *Fn) ParamCount() int { n := 0 for _, p := range f.Params { n += len(p.SyscallArgList()) } return n }
[ "func", "(", "f", "*", "Fn", ")", "ParamCount", "(", ")", "int", "{", "n", ":=", "0", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "n", "+=", "len", "(", "p", ".", "SyscallArgList", "(", ")", ")", "\n", "}", "\n", "re...
// ParamCount return number of syscall parameters for function f.
[ "ParamCount", "return", "number", "of", "syscall", "parameters", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L494-L500
28,716
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
Syscall
func (f *Fn) Syscall() string { c := f.SyscallParamCount() if c == 3 { return syscalldot() + "Syscall" } return syscalldot() + "Syscall" + strconv.Itoa(c) }
go
func (f *Fn) Syscall() string { c := f.SyscallParamCount() if c == 3 { return syscalldot() + "Syscall" } return syscalldot() + "Syscall" + strconv.Itoa(c) }
[ "func", "(", "f", "*", "Fn", ")", "Syscall", "(", ")", "string", "{", "c", ":=", "f", ".", "SyscallParamCount", "(", ")", "\n", "if", "c", "==", "3", "{", "return", "syscalldot", "(", ")", "+", "\"", "\"", "\n", "}", "\n", "return", "syscalldot",...
// Syscall determines which SyscallX function to use for function f.
[ "Syscall", "determines", "which", "SyscallX", "function", "to", "use", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L523-L529
28,717
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SyscallParamList
func (f *Fn) SyscallParamList() string { a := make([]string, 0) for _, p := range f.Params { a = append(a, p.SyscallArgList()...) } for len(a) < f.SyscallParamCount() { a = append(a, "0") } return strings.Join(a, ", ") }
go
func (f *Fn) SyscallParamList() string { a := make([]string, 0) for _, p := range f.Params { a = append(a, p.SyscallArgList()...) } for len(a) < f.SyscallParamCount() { a = append(a, "0") } return strings.Join(a, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "SyscallParamList", "(", ")", "string", "{", "a", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "a", "=", "append", "(", "a", ",", ...
// SyscallParamList returns source code for SyscallX parameters for function f.
[ "SyscallParamList", "returns", "source", "code", "for", "SyscallX", "parameters", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L532-L541
28,718
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperCallParamList
func (f *Fn) HelperCallParamList() string { a := make([]string, 0, len(f.Params)) for _, p := range f.Params { s := p.Name if p.Type == "string" { s = p.tmpVar() } a = append(a, s) } return strings.Join(a, ", ") }
go
func (f *Fn) HelperCallParamList() string { a := make([]string, 0, len(f.Params)) for _, p := range f.Params { s := p.Name if p.Type == "string" { s = p.tmpVar() } a = append(a, s) } return strings.Join(a, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "HelperCallParamList", "(", ")", "string", "{", "a", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "f", ".", "Params", ")", ")", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Param...
// HelperCallParamList returns source code of call into function f helper.
[ "HelperCallParamList", "returns", "source", "code", "of", "call", "into", "function", "f", "helper", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L544-L554
28,719
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HasStringParam
func (f *Fn) HasStringParam() bool { for _, p := range f.Params { if p.Type == "string" { return true } } return false }
go
func (f *Fn) HasStringParam() bool { for _, p := range f.Params { if p.Type == "string" { return true } } return false }
[ "func", "(", "f", "*", "Fn", ")", "HasStringParam", "(", ")", "bool", "{", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "if", "p", ".", "Type", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "f...
// HasStringParam is true, if f has at least one string parameter. // Otherwise it is false.
[ "HasStringParam", "is", "true", "if", "f", "has", "at", "least", "one", "string", "parameter", ".", "Otherwise", "it", "is", "false", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L581-L588
28,720
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperName
func (f *Fn) HelperName() string { if !f.HasStringParam() { return f.Name } return "_" + f.Name }
go
func (f *Fn) HelperName() string { if !f.HasStringParam() { return f.Name } return "_" + f.Name }
[ "func", "(", "f", "*", "Fn", ")", "HelperName", "(", ")", "string", "{", "if", "!", "f", ".", "HasStringParam", "(", ")", "{", "return", "f", ".", "Name", "\n", "}", "\n", "return", "\"", "\"", "+", "f", ".", "Name", "\n", "}" ]
// HelperName returns name of function f helper.
[ "HelperName", "returns", "name", "of", "function", "f", "helper", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L591-L596
28,721
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
DLLs
func (src *Source) DLLs() []string { uniq := make(map[string]bool) r := make([]string, 0) for _, f := range src.Funcs { name := f.DLLName() if _, found := uniq[name]; !found { uniq[name] = true r = append(r, name) } } return r }
go
func (src *Source) DLLs() []string { uniq := make(map[string]bool) r := make([]string, 0) for _, f := range src.Funcs { name := f.DLLName() if _, found := uniq[name]; !found { uniq[name] = true r = append(r, name) } } return r }
[ "func", "(", "src", "*", "Source", ")", "DLLs", "(", ")", "[", "]", "string", "{", "uniq", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "r", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "f...
// DLLs return dll names for a source set src.
[ "DLLs", "return", "dll", "names", "for", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L650-L661
28,722
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParseFile
func (src *Source) ParseFile(path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() s := bufio.NewScanner(file) for s.Scan() { t := trim(s.Text()) if len(t) < 7 { continue } if !strings.HasPrefix(t, "//sys") { continue } t = t[5:] if !(t[0] == ' ' ||...
go
func (src *Source) ParseFile(path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() s := bufio.NewScanner(file) for s.Scan() { t := trim(s.Text()) if len(t) < 7 { continue } if !strings.HasPrefix(t, "//sys") { continue } t = t[5:] if !(t[0] == ' ' ||...
[ "func", "(", "src", "*", "Source", ")", "ParseFile", "(", "path", "string", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ...
// ParseFile adds additional file path to a source set src.
[ "ParseFile", "adds", "additional", "file", "path", "to", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L664-L708
28,723
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
IsStdRepo
func (src *Source) IsStdRepo() (bool, error) { if len(src.Files) == 0 { return false, errors.New("no input files provided") } abspath, err := filepath.Abs(src.Files[0]) if err != nil { return false, err } goroot := runtime.GOROOT() if runtime.GOOS == "windows" { abspath = strings.ToLower(abspath) goroot ...
go
func (src *Source) IsStdRepo() (bool, error) { if len(src.Files) == 0 { return false, errors.New("no input files provided") } abspath, err := filepath.Abs(src.Files[0]) if err != nil { return false, err } goroot := runtime.GOROOT() if runtime.GOOS == "windows" { abspath = strings.ToLower(abspath) goroot ...
[ "func", "(", "src", "*", "Source", ")", "IsStdRepo", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "src", ".", "Files", ")", "==", "0", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n...
// IsStdRepo reports whether src is part of standard library.
[ "IsStdRepo", "reports", "whether", "src", "is", "part", "of", "standard", "library", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L711-L729
28,724
Microsoft/go-winio
file.go
makeWin32File
func makeWin32File(h syscall.Handle) (*win32File, error) { f := &win32File{handle: h} ioInitOnce.Do(initIo) _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) if err != nil { return nil, err } err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVEN...
go
func makeWin32File(h syscall.Handle) (*win32File, error) { f := &win32File{handle: h} ioInitOnce.Do(initIo) _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) if err != nil { return nil, err } err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVEN...
[ "func", "makeWin32File", "(", "h", "syscall", ".", "Handle", ")", "(", "*", "win32File", ",", "error", ")", "{", "f", ":=", "&", "win32File", "{", "handle", ":", "h", "}", "\n", "ioInitOnce", ".", "Do", "(", "initIo", ")", "\n", "_", ",", "err", ...
// makeWin32File makes a new win32File from an existing file handle
[ "makeWin32File", "makes", "a", "new", "win32File", "from", "an", "existing", "file", "handle" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L97-L111
28,725
Microsoft/go-winio
file.go
closeHandle
func (f *win32File) closeHandle() { f.wgLock.Lock() // Atomically set that we are closing, releasing the resources only once. if !f.closing.swap(true) { f.wgLock.Unlock() // cancel all IO and wait for it to complete cancelIoEx(f.handle, nil) f.wg.Wait() // at this point, no new IO can start syscall.Close...
go
func (f *win32File) closeHandle() { f.wgLock.Lock() // Atomically set that we are closing, releasing the resources only once. if !f.closing.swap(true) { f.wgLock.Unlock() // cancel all IO and wait for it to complete cancelIoEx(f.handle, nil) f.wg.Wait() // at this point, no new IO can start syscall.Close...
[ "func", "(", "f", "*", "win32File", ")", "closeHandle", "(", ")", "{", "f", ".", "wgLock", ".", "Lock", "(", ")", "\n", "// Atomically set that we are closing, releasing the resources only once.", "if", "!", "f", ".", "closing", ".", "swap", "(", "true", ")", ...
// closeHandle closes the resources associated with a Win32 handle
[ "closeHandle", "closes", "the", "resources", "associated", "with", "a", "Win32", "handle" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L118-L132
28,726
Microsoft/go-winio
file.go
ioCompletionProcessor
func ioCompletionProcessor(h syscall.Handle) { for { var bytes uint32 var key uintptr var op *ioOperation err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) if op == nil { panic(err) } op.ch <- ioResult{bytes, err} } }
go
func ioCompletionProcessor(h syscall.Handle) { for { var bytes uint32 var key uintptr var op *ioOperation err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) if op == nil { panic(err) } op.ch <- ioResult{bytes, err} } }
[ "func", "ioCompletionProcessor", "(", "h", "syscall", ".", "Handle", ")", "{", "for", "{", "var", "bytes", "uint32", "\n", "var", "key", "uintptr", "\n", "var", "op", "*", "ioOperation", "\n", "err", ":=", "getQueuedCompletionStatus", "(", "h", ",", "&", ...
// ioCompletionProcessor processes completed async IOs forever
[ "ioCompletionProcessor", "processes", "completed", "async", "IOs", "forever" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L156-L167
28,727
Microsoft/go-winio
file.go
asyncIo
func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { if err != syscall.ERROR_IO_PENDING { return int(bytes), err } if f.closing.isSet() { cancelIoEx(f.handle, &c.o) } var timeout timeoutChan if d != nil { d.channelLock.Lock() timeout = d.channel d.cha...
go
func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { if err != syscall.ERROR_IO_PENDING { return int(bytes), err } if f.closing.isSet() { cancelIoEx(f.handle, &c.o) } var timeout timeoutChan if d != nil { d.channelLock.Lock() timeout = d.channel d.cha...
[ "func", "(", "f", "*", "win32File", ")", "asyncIo", "(", "c", "*", "ioOperation", ",", "d", "*", "deadlineHandler", ",", "bytes", "uint32", ",", "err", "error", ")", "(", "int", ",", "error", ")", "{", "if", "err", "!=", "syscall", ".", "ERROR_IO_PEN...
// asyncIo processes the return value from ReadFile or WriteFile, blocking until // the operation has actually completed.
[ "asyncIo", "processes", "the", "return", "value", "from", "ReadFile", "or", "WriteFile", "blocking", "until", "the", "operation", "has", "actually", "completed", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L171-L214
28,728
Microsoft/go-winio
file.go
Read
func (f *win32File) Read(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.readDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.ReadFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.readDeadline, bytes, err) r...
go
func (f *win32File) Read(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.readDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.ReadFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.readDeadline, bytes, err) r...
[ "func", "(", "f", "*", "win32File", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "c", ",", "err", ":=", "f", ".", "prepareIo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\...
// Read reads from a file handle.
[ "Read", "reads", "from", "a", "file", "handle", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L217-L241
28,729
Microsoft/go-winio
file.go
Write
func (f *win32File) Write(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.writeDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.WriteFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.writeDeadline, bytes, err...
go
func (f *win32File) Write(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.writeDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.WriteFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.writeDeadline, bytes, err...
[ "func", "(", "f", "*", "win32File", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "c", ",", "err", ":=", "f", ".", "prepareIo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "...
// Write writes to a file handle.
[ "Write", "writes", "to", "a", "file", "handle", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L244-L260
28,730
Microsoft/go-winio
pkg/etw/eventdata.go
writeString
func (ed *eventData) writeString(data string) { ed.buffer.WriteString(data) ed.buffer.WriteByte(0) }
go
func (ed *eventData) writeString(data string) { ed.buffer.WriteString(data) ed.buffer.WriteByte(0) }
[ "func", "(", "ed", "*", "eventData", ")", "writeString", "(", "data", "string", ")", "{", "ed", ".", "buffer", ".", "WriteString", "(", "data", ")", "\n", "ed", ".", "buffer", ".", "WriteByte", "(", "0", ")", "\n", "}" ]
// writeString appends a string, including the null terminator, to the buffer.
[ "writeString", "appends", "a", "string", "including", "the", "null", "terminator", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L22-L25
28,731
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt8
func (ed *eventData) writeInt8(value int8) { ed.buffer.WriteByte(uint8(value)) }
go
func (ed *eventData) writeInt8(value int8) { ed.buffer.WriteByte(uint8(value)) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt8", "(", "value", "int8", ")", "{", "ed", ".", "buffer", ".", "WriteByte", "(", "uint8", "(", "value", ")", ")", "\n", "}" ]
// writeInt8 appends a int8 to the buffer.
[ "writeInt8", "appends", "a", "int8", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L28-L30
28,732
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt16
func (ed *eventData) writeInt16(value int16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt16(value int16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt16", "(", "value", "int16", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt16 appends a int16 to the buffer.
[ "writeInt16", "appends", "a", "int16", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L33-L35
28,733
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt32
func (ed *eventData) writeInt32(value int32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt32(value int32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt32", "(", "value", "int32", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt32 appends a int32 to the buffer.
[ "writeInt32", "appends", "a", "int32", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L38-L40
28,734
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt64
func (ed *eventData) writeInt64(value int64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt64(value int64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt64", "(", "value", "int64", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt64 appends a int64 to the buffer.
[ "writeInt64", "appends", "a", "int64", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L43-L45
28,735
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint16
func (ed *eventData) writeUint16(value uint16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint16(value uint16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint16", "(", "value", "uint16", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint16 appends a uint16 to the buffer.
[ "writeUint16", "appends", "a", "uint16", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L53-L55
28,736
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint32
func (ed *eventData) writeUint32(value uint32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint32(value uint32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint32", "(", "value", "uint32", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint32 appends a uint32 to the buffer.
[ "writeUint32", "appends", "a", "uint32", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L58-L60
28,737
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint64
func (ed *eventData) writeUint64(value uint64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint64(value uint64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint64", "(", "value", "uint64", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint64 appends a uint64 to the buffer.
[ "writeUint64", "appends", "a", "uint64", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L63-L65
28,738
Microsoft/go-winio
pkg/etw/eventopt.go
WithLevel
func WithLevel(level Level) EventOpt { return func(options *eventOptions) { options.descriptor.level = level } }
go
func WithLevel(level Level) EventOpt { return func(options *eventOptions) { options.descriptor.level = level } }
[ "func", "WithLevel", "(", "level", "Level", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "level", "=", "level", "\n", "}", "\n", "}" ]
// WithLevel specifies the level of the event to be written.
[ "WithLevel", "specifies", "the", "level", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L25-L29
28,739
Microsoft/go-winio
pkg/etw/eventopt.go
WithKeyword
func WithKeyword(keyword uint64) EventOpt { return func(options *eventOptions) { options.descriptor.keyword |= keyword } }
go
func WithKeyword(keyword uint64) EventOpt { return func(options *eventOptions) { options.descriptor.keyword |= keyword } }
[ "func", "WithKeyword", "(", "keyword", "uint64", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "keyword", "|=", "keyword", "\n", "}", "\n", "}" ]
// WithKeyword specifies the keywords of the event to be written. Multiple uses // of this option are OR'd together.
[ "WithKeyword", "specifies", "the", "keywords", "of", "the", "event", "to", "be", "written", ".", "Multiple", "uses", "of", "this", "option", "are", "OR", "d", "together", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L33-L37
28,740
Microsoft/go-winio
pkg/etw/eventopt.go
WithChannel
func WithChannel(channel Channel) EventOpt { return func(options *eventOptions) { options.descriptor.channel = channel } }
go
func WithChannel(channel Channel) EventOpt { return func(options *eventOptions) { options.descriptor.channel = channel } }
[ "func", "WithChannel", "(", "channel", "Channel", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "channel", "=", "channel", "\n", "}", "\n", "}" ]
// WithChannel specifies the channel of the event to be written.
[ "WithChannel", "specifies", "the", "channel", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L40-L44
28,741
Microsoft/go-winio
pkg/etw/eventopt.go
WithOpcode
func WithOpcode(opcode Opcode) EventOpt { return func(options *eventOptions) { options.descriptor.opcode = opcode } }
go
func WithOpcode(opcode Opcode) EventOpt { return func(options *eventOptions) { options.descriptor.opcode = opcode } }
[ "func", "WithOpcode", "(", "opcode", "Opcode", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "opcode", "=", "opcode", "\n", "}", "\n", "}" ]
// WithOpcode specifies the opcode of the event to be written.
[ "WithOpcode", "specifies", "the", "opcode", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L47-L51
28,742
Microsoft/go-winio
pkg/etw/eventopt.go
WithActivityID
func WithActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.activityID = activityID } }
go
func WithActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.activityID = activityID } }
[ "func", "WithActivityID", "(", "activityID", "*", "guid", ".", "GUID", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "activityID", "=", "activityID", "\n", "}", "\n", "}" ]
// WithActivityID specifies the activity ID of the event to be written.
[ "WithActivityID", "specifies", "the", "activity", "ID", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L62-L66
28,743
Microsoft/go-winio
pkg/etw/eventopt.go
WithRelatedActivityID
func WithRelatedActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.relatedActivityID = activityID } }
go
func WithRelatedActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.relatedActivityID = activityID } }
[ "func", "WithRelatedActivityID", "(", "activityID", "*", "guid", ".", "GUID", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "relatedActivityID", "=", "activityID", "\n", "}", "\n", "}" ]
// WithRelatedActivityID specifies the parent activity ID of the event to be written.
[ "WithRelatedActivityID", "specifies", "the", "parent", "activity", "ID", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L69-L73
28,744
Microsoft/go-winio
pkg/etw/newprovider_unsupported.go
NewProviderWithID
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { return nil, nil }
go
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { return nil, nil }
[ "func", "NewProviderWithID", "(", "name", "string", ",", "id", "*", "guid", ".", "GUID", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// NewProviderWithID returns a nil provider on unsupported platforms.
[ "NewProviderWithID", "returns", "a", "nil", "provider", "on", "unsupported", "platforms", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/newprovider_unsupported.go#L10-L12
28,745
Microsoft/go-winio
pkg/security/grantvmgroupaccess.go
generateDACLWithAcesAdded
func generateDACLWithAcesAdded(name string, isDir bool, origDACL uintptr) (uintptr, error) { // Generate pointers to the SIDs based on the string SIDs sid, err := syscall.StringToSid(sidVmGroup) if err != nil { return 0, errors.Wrapf(err, "%s syscall.StringToSid %s %s", gvmga, name, sidVmGroup) } inheritance :=...
go
func generateDACLWithAcesAdded(name string, isDir bool, origDACL uintptr) (uintptr, error) { // Generate pointers to the SIDs based on the string SIDs sid, err := syscall.StringToSid(sidVmGroup) if err != nil { return 0, errors.Wrapf(err, "%s syscall.StringToSid %s %s", gvmga, name, sidVmGroup) } inheritance :=...
[ "func", "generateDACLWithAcesAdded", "(", "name", "string", ",", "isDir", "bool", ",", "origDACL", "uintptr", ")", "(", "uintptr", ",", "error", ")", "{", "// Generate pointers to the SIDs based on the string SIDs", "sid", ",", "err", ":=", "syscall", ".", "StringTo...
// generateDACLWithAcesAdded generates a new DACL with the two needed ACEs added. // The caller is responsible for LocalFree of the returned DACL on success.
[ "generateDACLWithAcesAdded", "generates", "a", "new", "DACL", "with", "the", "two", "needed", "ACEs", "added", ".", "The", "caller", "is", "responsible", "for", "LocalFree", "of", "the", "returned", "DACL", "on", "success", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/grantvmgroupaccess.go#L128-L159
28,746
Microsoft/go-winio
pkg/etw/newprovider.go
NewProviderWithID
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { providerCallbackOnce.Do(func() { globalProviderCallback = windows.NewCallback(providerCallbackAdapter) }) provider = providers.newProvider() defer func(provider *Provider) { if err != nil { provider...
go
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { providerCallbackOnce.Do(func() { globalProviderCallback = windows.NewCallback(providerCallbackAdapter) }) provider = providers.newProvider() defer func(provider *Provider) { if err != nil { provider...
[ "func", "NewProviderWithID", "(", "name", "string", ",", "id", "*", "guid", ".", "GUID", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "providerCallbackOnce", ".", "Do", "(", "func", "(", ")", "{...
// NewProviderWithID creates and registers a new ETW provider, allowing the // provider ID to be manually specified. This is most useful when there is an // existing provider ID that must be used to conform to existing diagnostic // infrastructure.
[ "NewProviderWithID", "creates", "and", "registers", "a", "new", "ETW", "provider", "allowing", "the", "provider", "ID", "to", "be", "manually", "specified", ".", "This", "is", "most", "useful", "when", "there", "is", "an", "existing", "provider", "ID", "that",...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/newprovider.go#L18-L53
28,747
Microsoft/go-winio
pkg/etw/provider.go
NewProvider
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) { return NewProviderWithID(name, providerIDFromName(name), callback) }
go
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) { return NewProviderWithID(name, providerIDFromName(name), callback) }
[ "func", "NewProvider", "(", "name", "string", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "return", "NewProviderWithID", "(", "name", ",", "providerIDFromName", "(", "name", ")", ",", "callback", "...
// NewProvider creates and registers a new ETW provider. The provider ID is // generated based on the provider name.
[ "NewProvider", "creates", "and", "registers", "a", "new", "ETW", "provider", ".", "The", "provider", "ID", "is", "generated", "based", "on", "the", "provider", "name", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L121-L123
28,748
Microsoft/go-winio
pkg/etw/provider.go
Close
func (provider *Provider) Close() error { if provider == nil { return nil } providers.removeProvider(provider) return eventUnregister(provider.handle) }
go
func (provider *Provider) Close() error { if provider == nil { return nil } providers.removeProvider(provider) return eventUnregister(provider.handle) }
[ "func", "(", "provider", "*", "Provider", ")", "Close", "(", ")", "error", "{", "if", "provider", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "providers", ".", "removeProvider", "(", "provider", ")", "\n", "return", "eventUnregister", "(", "pro...
// Close unregisters the provider.
[ "Close", "unregisters", "the", "provider", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L126-L133
28,749
Microsoft/go-winio
pkg/etw/provider.go
IsEnabledForLevel
func (provider *Provider) IsEnabledForLevel(level Level) bool { return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0)) }
go
func (provider *Provider) IsEnabledForLevel(level Level) bool { return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0)) }
[ "func", "(", "provider", "*", "Provider", ")", "IsEnabledForLevel", "(", "level", "Level", ")", "bool", "{", "return", "provider", ".", "IsEnabledForLevelAndKeywords", "(", "level", ",", "^", "uint64", "(", "0", ")", ")", "\n", "}" ]
// IsEnabledForLevel calls IsEnabledForLevelAndKeywords with the specified level // and all keywords set.
[ "IsEnabledForLevel", "calls", "IsEnabledForLevelAndKeywords", "with", "the", "specified", "level", "and", "all", "keywords", "set", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L143-L145
28,750
Microsoft/go-winio
pkg/etw/provider.go
IsEnabledForLevelAndKeywords
func (provider *Provider) IsEnabledForLevelAndKeywords(level Level, keywords uint64) bool { if provider == nil { return false } if !provider.enabled { return false } // ETW automatically sets the level to 255 if it is specified as 0, so we // don't need to worry about the level=0 (all events) case. if leve...
go
func (provider *Provider) IsEnabledForLevelAndKeywords(level Level, keywords uint64) bool { if provider == nil { return false } if !provider.enabled { return false } // ETW automatically sets the level to 255 if it is specified as 0, so we // don't need to worry about the level=0 (all events) case. if leve...
[ "func", "(", "provider", "*", "Provider", ")", "IsEnabledForLevelAndKeywords", "(", "level", "Level", ",", "keywords", "uint64", ")", "bool", "{", "if", "provider", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "if", "!", "provider", ".", "enable...
// IsEnabledForLevelAndKeywords allows event producer code to check if there are // any event sessions that are interested in an event, based on the event level // and keywords. Although this check happens automatically in the ETW // infrastructure, it can be useful to check if an event will actually be // consumed bef...
[ "IsEnabledForLevelAndKeywords", "allows", "event", "producer", "code", "to", "check", "if", "there", "are", "any", "event", "sessions", "that", "are", "interested", "in", "an", "event", "based", "on", "the", "event", "level", "and", "keywords", ".", "Although", ...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L152-L172
28,751
Microsoft/go-winio
pkg/etw/provider.go
WriteEvent
func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpts []FieldOpt) error { if provider == nil { return nil } options := eventOptions{descriptor: newEventDescriptor()} em := &eventMetadata{} ed := &eventData{} // We need to evaluate the EventOpts first since they might change tags, a...
go
func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpts []FieldOpt) error { if provider == nil { return nil } options := eventOptions{descriptor: newEventDescriptor()} em := &eventMetadata{} ed := &eventData{} // We need to evaluate the EventOpts first since they might change tags, a...
[ "func", "(", "provider", "*", "Provider", ")", "WriteEvent", "(", "name", "string", ",", "eventOpts", "[", "]", "EventOpt", ",", "fieldOpts", "[", "]", "FieldOpt", ")", "error", "{", "if", "provider", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n...
// WriteEvent writes a single ETW event from the provider. The event is // constructed based on the EventOpt and FieldOpt values that are passed as // opts.
[ "WriteEvent", "writes", "a", "single", "ETW", "event", "from", "the", "provider", ".", "The", "event", "is", "constructed", "based", "on", "the", "EventOpt", "and", "FieldOpt", "values", "that", "are", "passed", "as", "opts", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L177-L211
28,752
Microsoft/go-winio
pkg/etw/provider.go
writeEventRaw
func (provider *Provider) writeEventRaw( descriptor *eventDescriptor, activityID *guid.GUID, relatedActivityID *guid.GUID, metadataBlobs [][]byte, dataBlobs [][]byte) error { dataDescriptorCount := uint32(1 + len(metadataBlobs) + len(dataBlobs)) dataDescriptors := make([]eventDataDescriptor, 0, dataDescriptorCo...
go
func (provider *Provider) writeEventRaw( descriptor *eventDescriptor, activityID *guid.GUID, relatedActivityID *guid.GUID, metadataBlobs [][]byte, dataBlobs [][]byte) error { dataDescriptorCount := uint32(1 + len(metadataBlobs) + len(dataBlobs)) dataDescriptors := make([]eventDataDescriptor, 0, dataDescriptorCo...
[ "func", "(", "provider", "*", "Provider", ")", "writeEventRaw", "(", "descriptor", "*", "eventDescriptor", ",", "activityID", "*", "guid", ".", "GUID", ",", "relatedActivityID", "*", "guid", ".", "GUID", ",", "metadataBlobs", "[", "]", "[", "]", "byte", ",...
// writeEventRaw writes a single ETW event from the provider. This function is // less abstracted than WriteEvent, and presents a fairly direct interface to // the event writing functionality. It expects a series of event metadata and // event data blobs to be passed in, which must conform to the TraceLogging // schema...
[ "writeEventRaw", "writes", "a", "single", "ETW", "event", "from", "the", "provider", ".", "This", "function", "is", "less", "abstracted", "than", "WriteEvent", "and", "presents", "a", "fairly", "direct", "interface", "to", "the", "event", "writing", "functionali...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L220-L239
28,753
Microsoft/go-winio
archive/tar/writer.go
formatString
func (f *formatter) formatString(b []byte, s string) { if len(s) > len(b) { f.err = ErrFieldTooLong return } ascii := toASCII(s) copy(b, ascii) if len(ascii) < len(b) { b[len(ascii)] = 0 } }
go
func (f *formatter) formatString(b []byte, s string) { if len(s) > len(b) { f.err = ErrFieldTooLong return } ascii := toASCII(s) copy(b, ascii) if len(ascii) < len(b) { b[len(ascii)] = 0 } }
[ "func", "(", "f", "*", "formatter", ")", "formatString", "(", "b", "[", "]", "byte", ",", "s", "string", ")", "{", "if", "len", "(", "s", ")", ">", "len", "(", "b", ")", "{", "f", ".", "err", "=", "ErrFieldTooLong", "\n", "return", "\n", "}", ...
// Write s into b, terminating it with a NUL if there is room.
[ "Write", "s", "into", "b", "terminating", "it", "with", "a", "NUL", "if", "there", "is", "room", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L75-L85
28,754
Microsoft/go-winio
archive/tar/writer.go
formatOctal
func (f *formatter) formatOctal(b []byte, x int64) { s := strconv.FormatInt(x, 8) // leading zeros, but leave room for a NUL. for len(s)+1 < len(b) { s = "0" + s } f.formatString(b, s) }
go
func (f *formatter) formatOctal(b []byte, x int64) { s := strconv.FormatInt(x, 8) // leading zeros, but leave room for a NUL. for len(s)+1 < len(b) { s = "0" + s } f.formatString(b, s) }
[ "func", "(", "f", "*", "formatter", ")", "formatOctal", "(", "b", "[", "]", "byte", ",", "x", "int64", ")", "{", "s", ":=", "strconv", ".", "FormatInt", "(", "x", ",", "8", ")", "\n", "// leading zeros, but leave room for a NUL.", "for", "len", "(", "s...
// Encode x as an octal ASCII string and write it into b with leading zeros.
[ "Encode", "x", "as", "an", "octal", "ASCII", "string", "and", "write", "it", "into", "b", "with", "leading", "zeros", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L88-L95
28,755
Microsoft/go-winio
archive/tar/writer.go
Write
func (tw *Writer) Write(b []byte) (n int, err error) { if tw.closed { err = ErrWriteAfterClose return } overwrite := false if int64(len(b)) > tw.nb { b = b[0:tw.nb] overwrite = true } n, err = tw.w.Write(b) tw.nb -= int64(n) if err == nil && overwrite { err = ErrWriteTooLong return } tw.err = err ...
go
func (tw *Writer) Write(b []byte) (n int, err error) { if tw.closed { err = ErrWriteAfterClose return } overwrite := false if int64(len(b)) > tw.nb { b = b[0:tw.nb] overwrite = true } n, err = tw.w.Write(b) tw.nb -= int64(n) if err == nil && overwrite { err = ErrWriteTooLong return } tw.err = err ...
[ "func", "(", "tw", "*", "Writer", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "tw", ".", "closed", "{", "err", "=", "ErrWriteAfterClose", "\n", "return", "\n", "}", "\n", "overwrite", ":=",...
// Write writes to the current entry in the tar archive. // Write returns the error ErrWriteTooLong if more than // hdr.Size bytes are written after WriteHeader.
[ "Write", "writes", "to", "the", "current", "entry", "in", "the", "tar", "archive", ".", "Write", "returns", "the", "error", "ErrWriteTooLong", "if", "more", "than", "hdr", ".", "Size", "bytes", "are", "written", "after", "WriteHeader", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L404-L422
28,756
Microsoft/go-winio
archive/tar/writer.go
Close
func (tw *Writer) Close() error { if tw.err != nil || tw.closed { return tw.err } tw.Flush() tw.closed = true if tw.err != nil { return tw.err } // trailer: two zero blocks for i := 0; i < 2; i++ { _, tw.err = tw.w.Write(zeroBlock) if tw.err != nil { break } } return tw.err }
go
func (tw *Writer) Close() error { if tw.err != nil || tw.closed { return tw.err } tw.Flush() tw.closed = true if tw.err != nil { return tw.err } // trailer: two zero blocks for i := 0; i < 2; i++ { _, tw.err = tw.w.Write(zeroBlock) if tw.err != nil { break } } return tw.err }
[ "func", "(", "tw", "*", "Writer", ")", "Close", "(", ")", "error", "{", "if", "tw", ".", "err", "!=", "nil", "||", "tw", ".", "closed", "{", "return", "tw", ".", "err", "\n", "}", "\n", "tw", ".", "Flush", "(", ")", "\n", "tw", ".", "closed",...
// Close closes the tar archive, flushing any unwritten // data to the underlying writer.
[ "Close", "closes", "the", "tar", "archive", "flushing", "any", "unwritten", "data", "to", "the", "underlying", "writer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L426-L444
28,757
Microsoft/go-winio
fileinfo.go
GetFileBasicInfo
func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { bi := &FileBasicInfo{} if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: e...
go
func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { bi := &FileBasicInfo{} if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: e...
[ "func", "GetFileBasicInfo", "(", "f", "*", "os", ".", "File", ")", "(", "*", "FileBasicInfo", ",", "error", ")", "{", "bi", ":=", "&", "FileBasicInfo", "{", "}", "\n", "if", "err", ":=", "getFileInformationByHandleEx", "(", "syscall", ".", "Handle", "(",...
// GetFileBasicInfo retrieves times and attributes for a file.
[ "GetFileBasicInfo", "retrieves", "times", "and", "attributes", "for", "a", "file", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/fileinfo.go#L28-L35
28,758
Microsoft/go-winio
pkg/etw/eventmetadata.go
bytes
func (em *eventMetadata) bytes() []byte { // Finalize the event metadata buffer by filling in the buffer length at the // beginning. binary.LittleEndian.PutUint16(em.buffer.Bytes(), uint16(em.buffer.Len())) return em.buffer.Bytes() }
go
func (em *eventMetadata) bytes() []byte { // Finalize the event metadata buffer by filling in the buffer length at the // beginning. binary.LittleEndian.PutUint16(em.buffer.Bytes(), uint16(em.buffer.Len())) return em.buffer.Bytes() }
[ "func", "(", "em", "*", "eventMetadata", ")", "bytes", "(", ")", "[", "]", "byte", "{", "// Finalize the event metadata buffer by filling in the buffer length at the", "// beginning.", "binary", ".", "LittleEndian", ".", "PutUint16", "(", "em", ".", "buffer", ".", "...
// bytes returns the raw binary data containing the event metadata. Before being // returned, the current size of the buffer is written to the start of the // buffer. The returned value is not copied from the internal buffer, so it can // be mutated by the eventMetadata object after it is returned.
[ "bytes", "returns", "the", "raw", "binary", "data", "containing", "the", "event", "metadata", ".", "Before", "being", "returned", "the", "current", "size", "of", "the", "buffer", "is", "written", "to", "the", "start", "of", "the", "buffer", ".", "The", "re...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L88-L93
28,759
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeEventHeader
func (em *eventMetadata) writeEventHeader(name string, tags uint32) { binary.Write(&em.buffer, binary.LittleEndian, uint16(0)) // Length placeholder em.writeTags(tags) em.buffer.WriteString(name) em.buffer.WriteByte(0) // Null terminator for name }
go
func (em *eventMetadata) writeEventHeader(name string, tags uint32) { binary.Write(&em.buffer, binary.LittleEndian, uint16(0)) // Length placeholder em.writeTags(tags) em.buffer.WriteString(name) em.buffer.WriteByte(0) // Null terminator for name }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeEventHeader", "(", "name", "string", ",", "tags", "uint32", ")", "{", "binary", ".", "Write", "(", "&", "em", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "uint16", "(", "0", ")", ")", "/...
// writeEventHeader writes the metadata for the start of an event to the buffer. // This specifies the event name and tags.
[ "writeEventHeader", "writes", "the", "metadata", "for", "the", "start", "of", "an", "event", "to", "the", "buffer", ".", "This", "specifies", "the", "event", "name", "and", "tags", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L97-L102
28,760
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeField
func (em *eventMetadata) writeField(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType, outType, tags, 0) }
go
func (em *eventMetadata) writeField(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType, outType, tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeField", "(", "name", "string", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType", ",", "outType", ",", "tags",...
// writeField writes the metadata for a simple field to the buffer.
[ "writeField", "writes", "the", "metadata", "for", "a", "simple", "field", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L154-L156
28,761
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeArray
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0) }
go
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeArray", "(", "name", "string", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType", "|", "inTypeArray", ",", "ou...
// writeArray writes the metadata for an array field to the buffer. The number // of elements in the array must be written as a uint16 in the event data, // immediately preceeding the event data.
[ "writeArray", "writes", "the", "metadata", "for", "an", "array", "field", "to", "the", "buffer", ".", "The", "number", "of", "elements", "in", "the", "array", "must", "be", "written", "as", "a", "uint16", "in", "the", "event", "data", "immediately", "prece...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L161-L163
28,762
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeCountedArray
func (em *eventMetadata) writeCountedArray(name string, count uint16, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeCountedArray, outType, tags, count) }
go
func (em *eventMetadata) writeCountedArray(name string, count uint16, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeCountedArray, outType, tags, count) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeCountedArray", "(", "name", "string", ",", "count", "uint16", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType",...
// writeCountedArray writes the metadata for an array field to the buffer. The // size of a counted array is fixed, and the size is written into the metadata // directly.
[ "writeCountedArray", "writes", "the", "metadata", "for", "an", "array", "field", "to", "the", "buffer", ".", "The", "size", "of", "a", "counted", "array", "is", "fixed", "and", "the", "size", "is", "written", "into", "the", "metadata", "directly", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L168-L170
28,763
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeStruct
func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) { em.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0) }
go
func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) { em.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeStruct", "(", "name", "string", ",", "fieldCount", "uint8", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inTypeStruct", ",", "outType", "(", "fieldCount", ")", ",", ...
// writeStruct writes the metadata for a nested struct to the buffer. The struct // contains the next N fields in the metadata, where N is specified by the // fieldCount argument.
[ "writeStruct", "writes", "the", "metadata", "for", "a", "nested", "struct", "to", "the", "buffer", ".", "The", "struct", "contains", "the", "next", "N", "fields", "in", "the", "metadata", "where", "N", "is", "specified", "by", "the", "fieldCount", "argument"...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L175-L177
28,764
Microsoft/go-winio
pkg/security/mksyscall_windows.go
IsNotDuplicate
func (f *Fn) IsNotDuplicate() bool { funcName := f.DLLFuncName() if uniqDllFuncName[funcName] == false { uniqDllFuncName[funcName] = true return true } return false }
go
func (f *Fn) IsNotDuplicate() bool { funcName := f.DLLFuncName() if uniqDllFuncName[funcName] == false { uniqDllFuncName[funcName] = true return true } return false }
[ "func", "(", "f", "*", "Fn", ")", "IsNotDuplicate", "(", ")", "bool", "{", "funcName", ":=", "f", ".", "DLLFuncName", "(", ")", "\n", "if", "uniqDllFuncName", "[", "funcName", "]", "==", "false", "{", "uniqDllFuncName", "[", "funcName", "]", "=", "true...
// IsNotDuplicate is true if f is not a duplicated function
[ "IsNotDuplicate", "is", "true", "if", "f", "is", "not", "a", "duplicated", "function" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/mksyscall_windows.go#L612-L619
28,765
Microsoft/go-winio
pkg/security/mksyscall_windows.go
Generate
func (src *Source) Generate(w io.Writer) error { const ( pkgStd = iota // any package in std library pkgXSysWindows // x/sys/windows package pkgOther ) isStdRepo, err := src.IsStdRepo() if err != nil { return err } var pkgtype int switch { case isStdRepo: pkgtype = pkgStd case packageN...
go
func (src *Source) Generate(w io.Writer) error { const ( pkgStd = iota // any package in std library pkgXSysWindows // x/sys/windows package pkgOther ) isStdRepo, err := src.IsStdRepo() if err != nil { return err } var pkgtype int switch { case isStdRepo: pkgtype = pkgStd case packageN...
[ "func", "(", "src", "*", "Source", ")", "Generate", "(", "w", "io", ".", "Writer", ")", "error", "{", "const", "(", "pkgStd", "=", "iota", "// any package in std library", "\n", "pkgXSysWindows", "// x/sys/windows package", "\n", "pkgOther", "\n", ")", "\n", ...
// Generate output source file from a source set src.
[ "Generate", "output", "source", "file", "from", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/mksyscall_windows.go#L750-L812
28,766
godbus/dbus
decoder.go
newDecoder
func newDecoder(in io.Reader, order binary.ByteOrder) *decoder { dec := new(decoder) dec.in = in dec.order = order return dec }
go
func newDecoder(in io.Reader, order binary.ByteOrder) *decoder { dec := new(decoder) dec.in = in dec.order = order return dec }
[ "func", "newDecoder", "(", "in", "io", ".", "Reader", ",", "order", "binary", ".", "ByteOrder", ")", "*", "decoder", "{", "dec", ":=", "new", "(", "decoder", ")", "\n", "dec", ".", "in", "=", "in", "\n", "dec", ".", "order", "=", "order", "\n", "...
// newDecoder returns a new decoder that reads values from in. The input is // expected to be in the given byte order.
[ "newDecoder", "returns", "a", "new", "decoder", "that", "reads", "values", "from", "in", ".", "The", "input", "is", "expected", "to", "be", "in", "the", "given", "byte", "order", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L17-L22
28,767
godbus/dbus
decoder.go
align
func (dec *decoder) align(n int) { if dec.pos%n != 0 { newpos := (dec.pos + n - 1) & ^(n - 1) empty := make([]byte, newpos-dec.pos) if _, err := io.ReadFull(dec.in, empty); err != nil { panic(err) } dec.pos = newpos } }
go
func (dec *decoder) align(n int) { if dec.pos%n != 0 { newpos := (dec.pos + n - 1) & ^(n - 1) empty := make([]byte, newpos-dec.pos) if _, err := io.ReadFull(dec.in, empty); err != nil { panic(err) } dec.pos = newpos } }
[ "func", "(", "dec", "*", "decoder", ")", "align", "(", "n", "int", ")", "{", "if", "dec", ".", "pos", "%", "n", "!=", "0", "{", "newpos", ":=", "(", "dec", ".", "pos", "+", "n", "-", "1", ")", "&", "^", "(", "n", "-", "1", ")", "\n", "e...
// align aligns the input to the given boundary and panics on error.
[ "align", "aligns", "the", "input", "to", "the", "given", "boundary", "and", "panics", "on", "error", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L25-L34
28,768
godbus/dbus
decoder.go
sigByteSize
func sigByteSize(sig string) int { var total int for offset := 0; offset < len(sig); { switch sig[offset] { case 'y': total += 1 offset += 1 case 'n', 'q': total += 2 offset += 1 case 'b', 'i', 'u', 'h': total += 4 offset += 1 case 'x', 't', 'd': total += 8 offset += 1 case '(': ...
go
func sigByteSize(sig string) int { var total int for offset := 0; offset < len(sig); { switch sig[offset] { case 'y': total += 1 offset += 1 case 'n', 'q': total += 2 offset += 1 case 'b', 'i', 'u', 'h': total += 4 offset += 1 case 'x', 't', 'd': total += 8 offset += 1 case '(': ...
[ "func", "sigByteSize", "(", "sig", "string", ")", "int", "{", "var", "total", "int", "\n", "for", "offset", ":=", "0", ";", "offset", "<", "len", "(", "sig", ")", ";", "{", "switch", "sig", "[", "offset", "]", "{", "case", "'y'", ":", "total", "+...
// sigByteSize tries to calculates size of the given signature in bytes. // // It returns zero when it can't, for example when it contains non-fixed size // types such as strings, maps and arrays that require reading of the transmitted // data, for that we would need to implement the unread method for Decoder first.
[ "sigByteSize", "tries", "to", "calculates", "size", "of", "the", "given", "signature", "in", "bytes", ".", "It", "returns", "zero", "when", "it", "can", "t", "for", "example", "when", "it", "contains", "non", "-", "fixed", "size", "types", "such", "as", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L241-L279
28,769
godbus/dbus
auth.go
authReadLine
func authReadLine(in *bufio.Reader) ([][]byte, error) { data, err := in.ReadBytes('\n') if err != nil { return nil, err } data = bytes.TrimSuffix(data, []byte("\r\n")) return bytes.Split(data, []byte{' '}), nil }
go
func authReadLine(in *bufio.Reader) ([][]byte, error) { data, err := in.ReadBytes('\n') if err != nil { return nil, err } data = bytes.TrimSuffix(data, []byte("\r\n")) return bytes.Split(data, []byte{' '}), nil }
[ "func", "authReadLine", "(", "in", "*", "bufio", ".", "Reader", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "data", ",", "err", ":=", "in", ".", "ReadBytes", "(", "'\\n'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "n...
// authReadLine reads a line and separates it into its fields.
[ "authReadLine", "reads", "a", "line", "and", "separates", "it", "into", "its", "fields", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/auth.go#L223-L230
28,770
godbus/dbus
sig.go
SignatureOf
func SignatureOf(vs ...interface{}) Signature { var s string for _, v := range vs { s += getSignature(reflect.TypeOf(v)) } return Signature{s} }
go
func SignatureOf(vs ...interface{}) Signature { var s string for _, v := range vs { s += getSignature(reflect.TypeOf(v)) } return Signature{s} }
[ "func", "SignatureOf", "(", "vs", "...", "interface", "{", "}", ")", "Signature", "{", "var", "s", "string", "\n", "for", "_", ",", "v", ":=", "range", "vs", "{", "s", "+=", "getSignature", "(", "reflect", ".", "TypeOf", "(", "v", ")", ")", "\n", ...
// SignatureOf returns the concatenation of all the signatures of the given // values. It panics if one of them is not representable in D-Bus.
[ "SignatureOf", "returns", "the", "concatenation", "of", "all", "the", "signatures", "of", "the", "given", "values", ".", "It", "panics", "if", "one", "of", "them", "is", "not", "representable", "in", "D", "-", "Bus", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L34-L40
28,771
godbus/dbus
sig.go
getSignature
func getSignature(t reflect.Type) string { // handle simple types first switch t.Kind() { case reflect.Uint8: return "y" case reflect.Bool: return "b" case reflect.Int16: return "n" case reflect.Uint16: return "q" case reflect.Int, reflect.Int32: if t == unixFDType { return "h" } return "i" cas...
go
func getSignature(t reflect.Type) string { // handle simple types first switch t.Kind() { case reflect.Uint8: return "y" case reflect.Bool: return "b" case reflect.Int16: return "n" case reflect.Uint16: return "q" case reflect.Int, reflect.Int32: if t == unixFDType { return "h" } return "i" cas...
[ "func", "getSignature", "(", "t", "reflect", ".", "Type", ")", "string", "{", "// handle simple types first", "switch", "t", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Uint8", ":", "return", "\"", "\"", "\n", "case", "reflect", ".", "Bool", ":"...
// getSignature returns the signature of the given type and panics on unknown types.
[ "getSignature", "returns", "the", "signature", "of", "the", "given", "type", "and", "panics", "on", "unknown", "types", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L49-L108
28,772
godbus/dbus
sig.go
ParseSignature
func ParseSignature(s string) (sig Signature, err error) { if len(s) == 0 { return } if len(s) > 255 { return Signature{""}, SignatureError{s, "too long"} } sig.str = s for err == nil && len(s) != 0 { err, s = validSingle(s, 0) } if err != nil { sig = Signature{""} } return }
go
func ParseSignature(s string) (sig Signature, err error) { if len(s) == 0 { return } if len(s) > 255 { return Signature{""}, SignatureError{s, "too long"} } sig.str = s for err == nil && len(s) != 0 { err, s = validSingle(s, 0) } if err != nil { sig = Signature{""} } return }
[ "func", "ParseSignature", "(", "s", "string", ")", "(", "sig", "Signature", ",", "err", "error", ")", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "\n", "}", "\n", "if", "len", "(", "s", ")", ">", "255", "{", "return", "Signature", ...
// ParseSignature returns the signature represented by this string, or a // SignatureError if the string is not a valid signature.
[ "ParseSignature", "returns", "the", "signature", "represented", "by", "this", "string", "or", "a", "SignatureError", "if", "the", "string", "is", "not", "a", "valid", "signature", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L112-L128
28,773
godbus/dbus
sig.go
ParseSignatureMust
func ParseSignatureMust(s string) Signature { sig, err := ParseSignature(s) if err != nil { panic(err) } return sig }
go
func ParseSignatureMust(s string) Signature { sig, err := ParseSignature(s) if err != nil { panic(err) } return sig }
[ "func", "ParseSignatureMust", "(", "s", "string", ")", "Signature", "{", "sig", ",", "err", ":=", "ParseSignature", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "sig", "\n", "}" ]
// ParseSignatureMust behaves like ParseSignature, except that it panics if s // is not valid.
[ "ParseSignatureMust", "behaves", "like", "ParseSignature", "except", "that", "it", "panics", "if", "s", "is", "not", "valid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L132-L138
28,774
godbus/dbus
sig.go
Single
func (s Signature) Single() bool { err, r := validSingle(s.str, 0) return err != nil && r == "" }
go
func (s Signature) Single() bool { err, r := validSingle(s.str, 0) return err != nil && r == "" }
[ "func", "(", "s", "Signature", ")", "Single", "(", ")", "bool", "{", "err", ",", "r", ":=", "validSingle", "(", "s", ".", "str", ",", "0", ")", "\n", "return", "err", "!=", "nil", "&&", "r", "==", "\"", "\"", "\n", "}" ]
// Single returns whether the signature represents a single, complete type.
[ "Single", "returns", "whether", "the", "signature", "represents", "a", "single", "complete", "type", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L146-L149
28,775
godbus/dbus
sig.go
validSingle
func validSingle(s string, depth int) (err error, rem string) { if s == "" { return SignatureError{Sig: s, Reason: "empty signature"}, "" } if depth > 64 { return SignatureError{Sig: s, Reason: "container nesting too deep"}, "" } switch s[0] { case 'y', 'b', 'n', 'q', 'i', 'u', 'x', 't', 'd', 's', 'g', 'o', '...
go
func validSingle(s string, depth int) (err error, rem string) { if s == "" { return SignatureError{Sig: s, Reason: "empty signature"}, "" } if depth > 64 { return SignatureError{Sig: s, Reason: "container nesting too deep"}, "" } switch s[0] { case 'y', 'b', 'n', 'q', 'i', 'u', 'x', 't', 'd', 's', 'g', 'o', '...
[ "func", "validSingle", "(", "s", "string", ",", "depth", "int", ")", "(", "err", "error", ",", "rem", "string", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "SignatureError", "{", "Sig", ":", "s", ",", "Reason", ":", "\"", "\"", "}", ","...
// Try to read a single type from this string. If it was successful, err is nil // and rem is the remaining unparsed part. Otherwise, err is a non-nil // SignatureError and rem is "". depth is the current recursion depth which may // not be greater than 64 and should be given as 0 on the first call.
[ "Try", "to", "read", "a", "single", "type", "from", "this", "string", ".", "If", "it", "was", "successful", "err", "is", "nil", "and", "rem", "is", "the", "remaining", "unparsed", "part", ".", "Otherwise", "err", "is", "a", "non", "-", "nil", "Signatur...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L171-L219
28,776
godbus/dbus
sig.go
typeFor
func typeFor(s string) (t reflect.Type) { err, _ := validSingle(s, 0) if err != nil { panic(err) } if t, ok := sigToType[s[0]]; ok { return t } switch s[0] { case 'a': if s[1] == '{' { i := strings.LastIndex(s, "}") t = reflect.MapOf(sigToType[s[2]], typeFor(s[3:i])) } else { t = reflect.SliceO...
go
func typeFor(s string) (t reflect.Type) { err, _ := validSingle(s, 0) if err != nil { panic(err) } if t, ok := sigToType[s[0]]; ok { return t } switch s[0] { case 'a': if s[1] == '{' { i := strings.LastIndex(s, "}") t = reflect.MapOf(sigToType[s[2]], typeFor(s[3:i])) } else { t = reflect.SliceO...
[ "func", "typeFor", "(", "s", "string", ")", "(", "t", "reflect", ".", "Type", ")", "{", "err", ",", "_", ":=", "validSingle", "(", "s", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "if", "t"...
// typeFor returns the type of the given signature. It ignores any left over // characters and panics if s doesn't start with a valid type signature.
[ "typeFor", "returns", "the", "type", "of", "the", "given", "signature", ".", "It", "ignores", "any", "left", "over", "characters", "and", "panics", "if", "s", "doesn", "t", "start", "with", "a", "valid", "type", "signature", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L238-L259
28,777
godbus/dbus
prop/prop.go
Export
func Export( conn *dbus.Conn, path dbus.ObjectPath, props map[string]map[string]*Prop, ) (*Properties, error) { p := &Properties{m: props, conn: conn, path: path} if err := conn.Export(p, path, "org.freedesktop.DBus.Properties"); err != nil { return nil, err } return p, nil }
go
func Export( conn *dbus.Conn, path dbus.ObjectPath, props map[string]map[string]*Prop, ) (*Properties, error) { p := &Properties{m: props, conn: conn, path: path} if err := conn.Export(p, path, "org.freedesktop.DBus.Properties"); err != nil { return nil, err } return p, nil }
[ "func", "Export", "(", "conn", "*", "dbus", ".", "Conn", ",", "path", "dbus", ".", "ObjectPath", ",", "props", "map", "[", "string", "]", "map", "[", "string", "]", "*", "Prop", ",", ")", "(", "*", "Properties", ",", "error", ")", "{", "p", ":=",...
// Export returns a new Properties structure that manages the given properties. // The key for the first-level map of props is the name of the interface; the // second-level key is the name of the property. The returned structure will be // exported as org.freedesktop.DBus.Properties on path.
[ "Export", "returns", "a", "new", "Properties", "structure", "that", "manages", "the", "given", "properties", ".", "The", "key", "for", "the", "first", "-", "level", "map", "of", "props", "is", "the", "name", "of", "the", "interface", ";", "the", "second", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L160-L168
28,778
godbus/dbus
prop/prop.go
Get
func (p *Properties) Get(iface, property string) (dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return dbus.Variant{}, ErrIfaceNotFound } prop, ok := m[property] if !ok { return dbus.Variant{}, ErrPropNotFound } return dbus.MakeVariant(prop.Value), nil }
go
func (p *Properties) Get(iface, property string) (dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return dbus.Variant{}, ErrIfaceNotFound } prop, ok := m[property] if !ok { return dbus.Variant{}, ErrPropNotFound } return dbus.MakeVariant(prop.Value), nil }
[ "func", "(", "p", "*", "Properties", ")", "Get", "(", "iface", ",", "property", "string", ")", "(", "dbus", ".", "Variant", ",", "*", "dbus", ".", "Error", ")", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", ...
// Get implements org.freedesktop.DBus.Properties.Get.
[ "Get", "implements", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "Get", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L171-L183
28,779
godbus/dbus
prop/prop.go
GetAll
func (p *Properties) GetAll(iface string) (map[string]dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return nil, ErrIfaceNotFound } rm := make(map[string]dbus.Variant, len(m)) for k, v := range m { rm[k] = dbus.MakeVariant(v.Value) } return rm, nil }
go
func (p *Properties) GetAll(iface string) (map[string]dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return nil, ErrIfaceNotFound } rm := make(map[string]dbus.Variant, len(m)) for k, v := range m { rm[k] = dbus.MakeVariant(v.Value) } return rm, nil }
[ "func", "(", "p", "*", "Properties", ")", "GetAll", "(", "iface", "string", ")", "(", "map", "[", "string", "]", "dbus", ".", "Variant", ",", "*", "dbus", ".", "Error", ")", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".",...
// GetAll implements org.freedesktop.DBus.Properties.GetAll.
[ "GetAll", "implements", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "GetAll", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L186-L198
28,780
godbus/dbus
prop/prop.go
GetMust
func (p *Properties) GetMust(iface, property string) interface{} { p.mut.RLock() defer p.mut.RUnlock() return p.m[iface][property].Value }
go
func (p *Properties) GetMust(iface, property string) interface{} { p.mut.RLock() defer p.mut.RUnlock() return p.m[iface][property].Value }
[ "func", "(", "p", "*", "Properties", ")", "GetMust", "(", "iface", ",", "property", "string", ")", "interface", "{", "}", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "RUnlock", "(", ")", "\n", "return", "p",...
// GetMust returns the value of the given property and panics if either the // interface or the property name are invalid.
[ "GetMust", "returns", "the", "value", "of", "the", "given", "property", "and", "panics", "if", "either", "the", "interface", "or", "the", "property", "name", "are", "invalid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L202-L206
28,781
godbus/dbus
prop/prop.go
Introspection
func (p *Properties) Introspection(iface string) []introspect.Property { p.mut.RLock() defer p.mut.RUnlock() m := p.m[iface] s := make([]introspect.Property, 0, len(m)) for k, v := range m { p := introspect.Property{Name: k, Type: dbus.SignatureOf(v.Value).String()} if v.Writable { p.Access = "readwrite" ...
go
func (p *Properties) Introspection(iface string) []introspect.Property { p.mut.RLock() defer p.mut.RUnlock() m := p.m[iface] s := make([]introspect.Property, 0, len(m)) for k, v := range m { p := introspect.Property{Name: k, Type: dbus.SignatureOf(v.Value).String()} if v.Writable { p.Access = "readwrite" ...
[ "func", "(", "p", "*", "Properties", ")", "Introspection", "(", "iface", "string", ")", "[", "]", "introspect", ".", "Property", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "RUnlock", "(", ")", "\n", "m", ":...
// Introspection returns the introspection data that represents the properties // of iface.
[ "Introspection", "returns", "the", "introspection", "data", "that", "represents", "the", "properties", "of", "iface", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L210-L225
28,782
godbus/dbus
prop/prop.go
set
func (p *Properties) set(iface, property string, v interface{}) error { prop := p.m[iface][property] prop.Value = v switch prop.Emit { case EmitFalse: return nil // do nothing case EmitInvalidates: return p.conn.Emit(p.path, "org.freedesktop.DBus.Properties.PropertiesChanged", iface, map[string]dbus.Variant...
go
func (p *Properties) set(iface, property string, v interface{}) error { prop := p.m[iface][property] prop.Value = v switch prop.Emit { case EmitFalse: return nil // do nothing case EmitInvalidates: return p.conn.Emit(p.path, "org.freedesktop.DBus.Properties.PropertiesChanged", iface, map[string]dbus.Variant...
[ "func", "(", "p", "*", "Properties", ")", "set", "(", "iface", ",", "property", "string", ",", "v", "interface", "{", "}", ")", "error", "{", "prop", ":=", "p", ".", "m", "[", "iface", "]", "[", "property", "]", "\n", "prop", ".", "Value", "=", ...
// set sets the given property and emits PropertyChanged if appropiate. p.mut // must already be locked.
[ "set", "sets", "the", "given", "property", "and", "emits", "PropertyChanged", "if", "appropiate", ".", "p", ".", "mut", "must", "already", "be", "locked", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L229-L245
28,783
godbus/dbus
prop/prop.go
Set
func (p *Properties) Set(iface, property string, newv dbus.Variant) *dbus.Error { p.mut.Lock() defer p.mut.Unlock() m, ok := p.m[iface] if !ok { return ErrIfaceNotFound } prop, ok := m[property] if !ok { return ErrPropNotFound } if !prop.Writable { return ErrReadOnly } if newv.Signature() != dbus.Signa...
go
func (p *Properties) Set(iface, property string, newv dbus.Variant) *dbus.Error { p.mut.Lock() defer p.mut.Unlock() m, ok := p.m[iface] if !ok { return ErrIfaceNotFound } prop, ok := m[property] if !ok { return ErrPropNotFound } if !prop.Writable { return ErrReadOnly } if newv.Signature() != dbus.Signa...
[ "func", "(", "p", "*", "Properties", ")", "Set", "(", "iface", ",", "property", "string", ",", "newv", "dbus", ".", "Variant", ")", "*", "dbus", ".", "Error", "{", "p", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "Un...
// Set implements org.freedesktop.Properties.Set.
[ "Set", "implements", "org", ".", "freedesktop", ".", "Properties", ".", "Set", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L248-L275
28,784
godbus/dbus
prop/prop.go
SetMust
func (p *Properties) SetMust(iface, property string, v interface{}) { p.mut.Lock() defer p.mut.Unlock() // unlock in case of panic if err := p.set(iface, property, v); err != nil { panic(err) } }
go
func (p *Properties) SetMust(iface, property string, v interface{}) { p.mut.Lock() defer p.mut.Unlock() // unlock in case of panic if err := p.set(iface, property, v); err != nil { panic(err) } }
[ "func", "(", "p", "*", "Properties", ")", "SetMust", "(", "iface", ",", "property", "string", ",", "v", "interface", "{", "}", ")", "{", "p", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "Unlock", "(", ")", "// unlock i...
// SetMust sets the value of the given property and panics if the interface or // the property name are invalid.
[ "SetMust", "sets", "the", "value", "of", "the", "given", "property", "and", "panics", "if", "the", "interface", "or", "the", "property", "name", "are", "invalid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L279-L285
28,785
godbus/dbus
introspect/call.go
Call
func Call(o dbus.BusObject) (*Node, error) { var xmldata string var node Node err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata) if err != nil { return nil, err } err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node) if err != nil { return nil, err } if node.Name =...
go
func Call(o dbus.BusObject) (*Node, error) { var xmldata string var node Node err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata) if err != nil { return nil, err } err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node) if err != nil { return nil, err } if node.Name =...
[ "func", "Call", "(", "o", "dbus", ".", "BusObject", ")", "(", "*", "Node", ",", "error", ")", "{", "var", "xmldata", "string", "\n", "var", "node", "Node", "\n\n", "err", ":=", "o", ".", "Call", "(", "\"", "\"", ",", "0", ")", ".", "Store", "("...
// Call calls org.freedesktop.Introspectable.Introspect on a remote object // and returns the introspection data.
[ "Call", "calls", "org", ".", "freedesktop", ".", "Introspectable", ".", "Introspect", "on", "a", "remote", "object", "and", "returns", "the", "introspection", "data", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/introspect/call.go#L11-L27
28,786
godbus/dbus
encoder.go
newEncoder
func newEncoder(out io.Writer, order binary.ByteOrder) *encoder { return newEncoderAtOffset(out, 0, order) }
go
func newEncoder(out io.Writer, order binary.ByteOrder) *encoder { return newEncoderAtOffset(out, 0, order) }
[ "func", "newEncoder", "(", "out", "io", ".", "Writer", ",", "order", "binary", ".", "ByteOrder", ")", "*", "encoder", "{", "return", "newEncoderAtOffset", "(", "out", ",", "0", ",", "order", ")", "\n", "}" ]
// NewEncoder returns a new encoder that writes to out in the given byte order.
[ "NewEncoder", "returns", "a", "new", "encoder", "that", "writes", "to", "out", "in", "the", "given", "byte", "order", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/encoder.go#L18-L20
28,787
godbus/dbus
encoder.go
newEncoderAtOffset
func newEncoderAtOffset(out io.Writer, offset int, order binary.ByteOrder) *encoder { enc := new(encoder) enc.out = out enc.order = order enc.pos = offset return enc }
go
func newEncoderAtOffset(out io.Writer, offset int, order binary.ByteOrder) *encoder { enc := new(encoder) enc.out = out enc.order = order enc.pos = offset return enc }
[ "func", "newEncoderAtOffset", "(", "out", "io", ".", "Writer", ",", "offset", "int", ",", "order", "binary", ".", "ByteOrder", ")", "*", "encoder", "{", "enc", ":=", "new", "(", "encoder", ")", "\n", "enc", ".", "out", "=", "out", "\n", "enc", ".", ...
// newEncoderAtOffset returns a new encoder that writes to out in the given // byte order. Specify the offset to initialize pos for proper alignment // computation.
[ "newEncoderAtOffset", "returns", "a", "new", "encoder", "that", "writes", "to", "out", "in", "the", "given", "byte", "order", ".", "Specify", "the", "offset", "to", "initialize", "pos", "for", "proper", "alignment", "computation", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/encoder.go#L25-L31
28,788
godbus/dbus
encoder.go
align
func (enc *encoder) align(n int) { pad := enc.padding(0, n) if pad > 0 { empty := make([]byte, pad) if _, err := enc.out.Write(empty); err != nil { panic(err) } enc.pos += pad } }
go
func (enc *encoder) align(n int) { pad := enc.padding(0, n) if pad > 0 { empty := make([]byte, pad) if _, err := enc.out.Write(empty); err != nil { panic(err) } enc.pos += pad } }
[ "func", "(", "enc", "*", "encoder", ")", "align", "(", "n", "int", ")", "{", "pad", ":=", "enc", ".", "padding", "(", "0", ",", "n", ")", "\n", "if", "pad", ">", "0", "{", "empty", ":=", "make", "(", "[", "]", "byte", ",", "pad", ")", "\n",...
// Aligns the next output to be on a multiple of n. Panics on write errors.
[ "Aligns", "the", "next", "output", "to", "be", "on", "a", "multiple", "of", "n", ".", "Panics", "on", "write", "errors", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/encoder.go#L34-L43
28,789
godbus/dbus
encoder.go
padding
func (enc *encoder) padding(offset, algn int) int { abs := enc.pos + offset if abs%algn != 0 { newabs := (abs + algn - 1) & ^(algn - 1) return newabs - abs } return 0 }
go
func (enc *encoder) padding(offset, algn int) int { abs := enc.pos + offset if abs%algn != 0 { newabs := (abs + algn - 1) & ^(algn - 1) return newabs - abs } return 0 }
[ "func", "(", "enc", "*", "encoder", ")", "padding", "(", "offset", ",", "algn", "int", ")", "int", "{", "abs", ":=", "enc", ".", "pos", "+", "offset", "\n", "if", "abs", "%", "algn", "!=", "0", "{", "newabs", ":=", "(", "abs", "+", "algn", "-",...
// pad returns the number of bytes of padding, based on current position and additional offset. // and alignment.
[ "pad", "returns", "the", "number", "of", "bytes", "of", "padding", "based", "on", "current", "position", "and", "additional", "offset", ".", "and", "alignment", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/encoder.go#L47-L54
28,790
godbus/dbus
encoder.go
Encode
func (enc *encoder) Encode(vs ...interface{}) (err error) { defer func() { err, _ = recover().(error) }() for _, v := range vs { enc.encode(reflect.ValueOf(v), 0) } return nil }
go
func (enc *encoder) Encode(vs ...interface{}) (err error) { defer func() { err, _ = recover().(error) }() for _, v := range vs { enc.encode(reflect.ValueOf(v), 0) } return nil }
[ "func", "(", "enc", "*", "encoder", ")", "Encode", "(", "vs", "...", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "err", ",", "_", "=", "recover", "(", ")", ".", "(", "error", ")", "\n", "}", "(",...
// Encode encodes the given values to the underyling reader. All written values // are aligned properly as required by the D-Bus spec.
[ "Encode", "encodes", "the", "given", "values", "to", "the", "underyling", "reader", ".", "All", "written", "values", "are", "aligned", "properly", "as", "required", "by", "the", "D", "-", "Bus", "spec", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/encoder.go#L65-L73
28,791
godbus/dbus
export.go
ExportMethodTable
func (conn *Conn) ExportMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { return conn.exportMethodTable(methods, path, iface, false) }
go
func (conn *Conn) ExportMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { return conn.exportMethodTable(methods, path, iface, false) }
[ "func", "(", "conn", "*", "Conn", ")", "ExportMethodTable", "(", "methods", "map", "[", "string", "]", "interface", "{", "}", ",", "path", "ObjectPath", ",", "iface", "string", ")", "error", "{", "return", "conn", ".", "exportMethodTable", "(", "methods", ...
// ExportMethodTable like Export registers the given methods as an object // on the message bus. Unlike Export the it uses a method table to define // the object instead of a native go object. // // The method table is a map from method name to function closure // representing the method. This allows an object exported...
[ "ExportMethodTable", "like", "Export", "registers", "the", "given", "methods", "as", "an", "object", "on", "the", "message", "bus", ".", "Unlike", "Export", "the", "it", "uses", "a", "method", "table", "to", "define", "the", "object", "instead", "of", "a", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/export.go#L292-L294
28,792
godbus/dbus
export.go
ExportSubtreeMethodTable
func (conn *Conn) ExportSubtreeMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { return conn.exportMethodTable(methods, path, iface, true) }
go
func (conn *Conn) ExportSubtreeMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { return conn.exportMethodTable(methods, path, iface, true) }
[ "func", "(", "conn", "*", "Conn", ")", "ExportSubtreeMethodTable", "(", "methods", "map", "[", "string", "]", "interface", "{", "}", ",", "path", "ObjectPath", ",", "iface", "string", ")", "error", "{", "return", "conn", ".", "exportMethodTable", "(", "met...
// Like ExportSubtree, but with the same caveats as ExportMethodTable.
[ "Like", "ExportSubtree", "but", "with", "the", "same", "caveats", "as", "ExportMethodTable", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/export.go#L297-L299
28,793
godbus/dbus
export.go
ReleaseName
func (conn *Conn) ReleaseName(name string) (ReleaseNameReply, error) { var r uint32 err := conn.busObj.Call("org.freedesktop.DBus.ReleaseName", 0, name).Store(&r) if err != nil { return 0, err } return ReleaseNameReply(r), nil }
go
func (conn *Conn) ReleaseName(name string) (ReleaseNameReply, error) { var r uint32 err := conn.busObj.Call("org.freedesktop.DBus.ReleaseName", 0, name).Store(&r) if err != nil { return 0, err } return ReleaseNameReply(r), nil }
[ "func", "(", "conn", "*", "Conn", ")", "ReleaseName", "(", "name", "string", ")", "(", "ReleaseNameReply", ",", "error", ")", "{", "var", "r", "uint32", "\n", "err", ":=", "conn", ".", "busObj", ".", "Call", "(", "\"", "\"", ",", "0", ",", "name", ...
// ReleaseName calls org.freedesktop.DBus.ReleaseName and awaits a response.
[ "ReleaseName", "calls", "org", ".", "freedesktop", ".", "DBus", ".", "ReleaseName", "and", "awaits", "a", "response", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/export.go#L367-L374
28,794
godbus/dbus
export.go
RequestName
func (conn *Conn) RequestName(name string, flags RequestNameFlags) (RequestNameReply, error) { var r uint32 err := conn.busObj.Call("org.freedesktop.DBus.RequestName", 0, name, flags).Store(&r) if err != nil { return 0, err } return RequestNameReply(r), nil }
go
func (conn *Conn) RequestName(name string, flags RequestNameFlags) (RequestNameReply, error) { var r uint32 err := conn.busObj.Call("org.freedesktop.DBus.RequestName", 0, name, flags).Store(&r) if err != nil { return 0, err } return RequestNameReply(r), nil }
[ "func", "(", "conn", "*", "Conn", ")", "RequestName", "(", "name", "string", ",", "flags", "RequestNameFlags", ")", "(", "RequestNameReply", ",", "error", ")", "{", "var", "r", "uint32", "\n", "err", ":=", "conn", ".", "busObj", ".", "Call", "(", "\"",...
// RequestName calls org.freedesktop.DBus.RequestName and awaits a response.
[ "RequestName", "calls", "org", ".", "freedesktop", ".", "DBus", ".", "RequestName", "and", "awaits", "a", "response", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/export.go#L377-L384
28,795
godbus/dbus
introspect/introspectable.go
NewIntrospectable
func NewIntrospectable(n *Node) Introspectable { found := false for _, v := range n.Interfaces { if v.Name == "org.freedesktop.DBus.Introspectable" { found = true break } } if !found { n.Interfaces = append(n.Interfaces, IntrospectData) } b, err := xml.Marshal(n) if err != nil { panic(err) } retu...
go
func NewIntrospectable(n *Node) Introspectable { found := false for _, v := range n.Interfaces { if v.Name == "org.freedesktop.DBus.Introspectable" { found = true break } } if !found { n.Interfaces = append(n.Interfaces, IntrospectData) } b, err := xml.Marshal(n) if err != nil { panic(err) } retu...
[ "func", "NewIntrospectable", "(", "n", "*", "Node", ")", "Introspectable", "{", "found", ":=", "false", "\n", "for", "_", ",", "v", ":=", "range", "n", ".", "Interfaces", "{", "if", "v", ".", "Name", "==", "\"", "\"", "{", "found", "=", "true", "\n...
// NewIntrospectable returns an Introspectable that returns the introspection // data that corresponds to the given Node. If n.Interfaces doesn't contain the // data for org.freedesktop.DBus.Introspectable, it is added automatically.
[ "NewIntrospectable", "returns", "an", "Introspectable", "that", "returns", "the", "introspection", "data", "that", "corresponds", "to", "the", "given", "Node", ".", "If", "n", ".", "Interfaces", "doesn", "t", "contain", "the", "data", "for", "org", ".", "freed...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/introspect/introspectable.go#L20-L36
28,796
godbus/dbus
introspect/introspectable.go
Methods
func Methods(v interface{}) []Method { t := reflect.TypeOf(v) ms := make([]Method, 0, t.NumMethod()) for i := 0; i < t.NumMethod(); i++ { if t.Method(i).PkgPath != "" { continue } mt := t.Method(i).Type if mt.NumOut() == 0 || mt.Out(mt.NumOut()-1) != reflect.TypeOf(&dbus.Error{}) { continue } v...
go
func Methods(v interface{}) []Method { t := reflect.TypeOf(v) ms := make([]Method, 0, t.NumMethod()) for i := 0; i < t.NumMethod(); i++ { if t.Method(i).PkgPath != "" { continue } mt := t.Method(i).Type if mt.NumOut() == 0 || mt.Out(mt.NumOut()-1) != reflect.TypeOf(&dbus.Error{}) { continue } v...
[ "func", "Methods", "(", "v", "interface", "{", "}", ")", "[", "]", "Method", "{", "t", ":=", "reflect", ".", "TypeOf", "(", "v", ")", "\n", "ms", ":=", "make", "(", "[", "]", "Method", ",", "0", ",", "t", ".", "NumMethod", "(", ")", ")", "\n"...
// Methods returns the description of the methods of v. This can be used to // create a Node which can be passed to NewIntrospectable.
[ "Methods", "returns", "the", "description", "of", "the", "methods", "of", "v", ".", "This", "can", "be", "used", "to", "create", "a", "Node", "which", "can", "be", "passed", "to", "NewIntrospectable", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/introspect/introspectable.go#L45-L76
28,797
godbus/dbus
message.go
EncodeTo
func (msg *Message) EncodeTo(out io.Writer, order binary.ByteOrder) error { if err := msg.IsValid(); err != nil { return err } var vs [7]interface{} switch order { case binary.LittleEndian: vs[0] = byte('l') case binary.BigEndian: vs[0] = byte('B') default: return errors.New("dbus: invalid byte order") ...
go
func (msg *Message) EncodeTo(out io.Writer, order binary.ByteOrder) error { if err := msg.IsValid(); err != nil { return err } var vs [7]interface{} switch order { case binary.LittleEndian: vs[0] = byte('l') case binary.BigEndian: vs[0] = byte('B') default: return errors.New("dbus: invalid byte order") ...
[ "func", "(", "msg", "*", "Message", ")", "EncodeTo", "(", "out", "io", ".", "Writer", ",", "order", "binary", ".", "ByteOrder", ")", "error", "{", "if", "err", ":=", "msg", ".", "IsValid", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", ...
// EncodeTo encodes and sends a message to the given writer. The byte order must // be either binary.LittleEndian or binary.BigEndian. If the message is not // valid or an error occurs when writing, an error is returned.
[ "EncodeTo", "encodes", "and", "sends", "a", "message", "to", "the", "given", "writer", ".", "The", "byte", "order", "must", "be", "either", "binary", ".", "LittleEndian", "or", "binary", ".", "BigEndian", ".", "If", "the", "message", "is", "not", "valid", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/message.go#L213-L253
28,798
godbus/dbus
message.go
IsValid
func (msg *Message) IsValid() error { if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected|FlagAllowInteractiveAuthorization) != 0 { return InvalidMessageError("invalid flags") } if msg.Type == 0 || msg.Type >= typeMax { return InvalidMessageError("invalid message type") } for k, v := range msg.Headers { if ...
go
func (msg *Message) IsValid() error { if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected|FlagAllowInteractiveAuthorization) != 0 { return InvalidMessageError("invalid flags") } if msg.Type == 0 || msg.Type >= typeMax { return InvalidMessageError("invalid message type") } for k, v := range msg.Headers { if ...
[ "func", "(", "msg", "*", "Message", ")", "IsValid", "(", ")", "error", "{", "if", "msg", ".", "Flags", "&", "^", "(", "FlagNoAutoStart", "|", "FlagNoReplyExpected", "|", "FlagAllowInteractiveAuthorization", ")", "!=", "0", "{", "return", "InvalidMessageError",...
// IsValid checks whether msg is a valid message and returns an // InvalidMessageError if it is not.
[ "IsValid", "checks", "whether", "msg", "is", "a", "valid", "message", "and", "returns", "an", "InvalidMessageError", "if", "it", "is", "not", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/message.go#L257-L303
28,799
godbus/dbus
message.go
String
func (msg *Message) String() string { if err := msg.IsValid(); err != nil { return "<invalid>" } s := msg.Type.String() if v, ok := msg.Headers[FieldSender]; ok { s += " from " + v.value.(string) } if v, ok := msg.Headers[FieldDestination]; ok { s += " to " + v.value.(string) } s += " serial " + strconv.F...
go
func (msg *Message) String() string { if err := msg.IsValid(); err != nil { return "<invalid>" } s := msg.Type.String() if v, ok := msg.Headers[FieldSender]; ok { s += " from " + v.value.(string) } if v, ok := msg.Headers[FieldDestination]; ok { s += " to " + v.value.(string) } s += " serial " + strconv.F...
[ "func", "(", "msg", "*", "Message", ")", "String", "(", ")", "string", "{", "if", "err", ":=", "msg", ".", "IsValid", "(", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "s", ":=", "msg", ".", "Type", ".", "String", ...
// String returns a string representation of a message similar to the format of // dbus-monitor.
[ "String", "returns", "a", "string", "representation", "of", "a", "message", "similar", "to", "the", "format", "of", "dbus", "-", "monitor", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/message.go#L313-L353