// GetNoScriptSigCtx retrieves the ctxNoScriptSig data ("noScriptSig") from the
// request context. If not set, the return value is false.
179021
func GetNoScriptSigCtx(r *http.Request) bool {
	noScriptSig, ok := r.Context().Value(ctxNoScriptSig).(bool)
	if !ok {
		return false
	}
	return noScriptSig
}
127237
func (a *Client) GetCatalogsIdentifier(params *GetCatalogsIdentifierParams, authInfo runtime.ClientAuthInfoWriter) (*GetCatalogsIdentifierOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetCatalogsIdentifierParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetCatalogsIdentifier",
		Method:             "GET",
		PathPattern:        "/catalogs/{identifier}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetCatalogsIdentifierReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetCatalogsIdentifierOK), nil
}
112982
func GetMCtx(r *http.Request) int {
	M, ok := r.Context().Value(ctxM).(int)
	if !ok {
		apiLog.Trace("M is not set or is not an int")
		return -1
	}
	return M
}
595301
func (w *Window) GetGLXContext() C.GLXContext {
	ret := C.glfwGetGLXContext(w.data)
	panicError()
	return ret
}
861847
func (c *Debugger) GetScriptSource(scriptId string) (string, error) {
	var v DebuggerGetScriptSourceParams
	v.ScriptId = scriptId
	return c.GetScriptSourceWithParams(&v)
}
119506
func trapSignalsPosix() {
	go func() {
		sigchan := make(chan os.Signal, 1)
		signal.Notify(sigchan, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)

		for sig := range sigchan {
			switch sig {
			case syscall.SIGQUIT:
				log.Println("[INFO] SIGQUIT: Quitting process immediately")
				for _, f := range OnProcessExit {
					f() // only perform important cleanup actions
				}
				os.Exit(0)

			case syscall.SIGTERM:
				log.Println("[INFO] SIGTERM: Shutting down servers then terminating")
				exitCode := executeShutdownCallbacks("SIGTERM")
				for _, f := range OnProcessExit {
					f() // only perform important cleanup actions
				}
				err := Stop()
				if err != nil {
					log.Printf("[ERROR] SIGTERM stop: %v", err)
					exitCode = 3
				}

				telemetry.AppendUnique("sigtrap", "SIGTERM")
				go telemetry.StopEmitting() // won't finish in time, but that's OK - just don't block

				os.Exit(exitCode)

			case syscall.SIGUSR1:
				log.Println("[INFO] SIGUSR1: Reloading")
				go telemetry.AppendUnique("sigtrap", "SIGUSR1")

				// Start with the existing Caddyfile
				caddyfileToUse, inst, err := getCurrentCaddyfile()
				if err != nil {
					log.Printf("[ERROR] SIGUSR1: %v", err)
					continue
				}
				if loaderUsed.loader == nil {
					// This also should never happen
					log.Println("[ERROR] SIGUSR1: no Caddyfile loader with which to reload Caddyfile")
					continue
				}

				// Load the updated Caddyfile
				newCaddyfile, err := loaderUsed.loader.Load(inst.serverType)
				if err != nil {
					log.Printf("[ERROR] SIGUSR1: loading updated Caddyfile: %v", err)
					continue
				}
				if newCaddyfile != nil {
					caddyfileToUse = newCaddyfile
				}

				// Backup old event hooks
				oldEventHooks := cloneEventHooks()

				// Purge the old event hooks
				purgeEventHooks()

				// Kick off the restart; our work is done
				EmitEvent(InstanceRestartEvent, nil)
				_, err = inst.Restart(caddyfileToUse)
				if err != nil {
					restoreEventHooks(oldEventHooks)

					log.Printf("[ERROR] SIGUSR1: %v", err)
				}

			case syscall.SIGUSR2:
				log.Println("[INFO] SIGUSR2: Upgrading")
				go telemetry.AppendUnique("sigtrap", "SIGUSR2")
				if err := Upgrade(); err != nil {
					log.Printf("[ERROR] SIGUSR2: upgrading: %v", err)
				}

			case syscall.SIGHUP:
				// ignore; this signal is sometimes sent outside of the user's control
				go telemetry.AppendUnique("sigtrap", "SIGHUP")
			}
		}
	}()
}
772353
func GetLastConfigIndexFromBlockOrPanic(block *cb.Block) uint64 {
	index, err := GetLastConfigIndexFromBlock(block)
	if err != nil {
		panic(err)
	}
	return index
}
799171
func (h *Handle) getNetNsId(attrType int, val uint32) (int, error) {
	req := h.newNetlinkRequest(unix.RTM_GETNSID, unix.NLM_F_REQUEST)

	rtgen := nl.NewRtGenMsg()
	req.AddData(rtgen)

	b := make([]byte, 4, 4)
	native.PutUint32(b, val)
	attr := nl.NewRtAttr(attrType, b)
	req.AddData(attr)

	msgs, err := req.Execute(unix.NETLINK_ROUTE, unix.RTM_NEWNSID)

	if err != nil {
		return 0, err
	}

	for _, m := range msgs {
		msg := nl.DeserializeRtGenMsg(m)

		attrs, err := nl.ParseRouteAttr(m[msg.Len():])
		if err != nil {
			return 0, err
		}

		for _, attr := range attrs {
			switch attr.Attr.Type {
			case NETNSA_NSID:
				return int(int32(native.Uint32(attr.Value))), nil
			}
		}
	}

	return 0, fmt.Errorf("unexpected empty result")
}
1022699
func GetFromCtx(r *http.Request) int64 {
	from, ok := r.Context().Value(ctxFrom).(int)
	if !ok {
		return int64(0)
	}
	return int64(from)
}
268470
func (t *Tab) GetScriptSource(scriptId string) (string, error) {
	return t.Debugger.GetScriptSource(scriptId)
}
904811
func requestToMsgGet(req *http.Request) (*dns.Msg, error) {
	values := req.URL.Query()
	b64, ok := values["dns"]
	if !ok {
		return nil, fmt.Errorf("no 'dns' query parameter found")
	}
	if len(b64) != 1 {
		return nil, fmt.Errorf("multiple 'dns' query values found")
	}
	return base64ToMsg(b64[0])
}
404953
func DCNGettext(domainname string, msgid string, msgidPlural string, n uint64, category uint) string {
	cdomainname := cDomainName(domainname)
	cmsgid := C.CString(msgid)
	cmsgidPlural := C.CString(msgidPlural)

	defer func() {
		C.free(unsafe.Pointer(cdomainname))
		C.free(unsafe.Pointer(cmsgid))
		C.free(unsafe.Pointer(cmsgidPlural))
	}()

	return C.GoString(C.dcngettext(cdomainname, cmsgid, cmsgidPlural, C.ulong(n), C.int(category)))
}
49014
func GetSysctl(sysctl string) (int, error) {
	data, err := ioutil.ReadFile(path.Join(sysctlBase, sysctl))
	if err != nil {
		return -1, err
	}
	val, err := strconv.Atoi(strings.Trim(string(data), " \n"))
	if err != nil {
		return -1, err
	}
	return val, nil
}
377021
func GetNSFunc(nsListerDeleter NamespaceListerDeleter, err error) func(*KubeConfig) (NamespaceListerDeleter, error) {
	return func(*KubeConfig) (NamespaceListerDeleter, error) {
		return nsListerDeleter, err
	}
}
733827
func (a *VppAdapter) GetMsgID(msgName string, msgCrc string) (uint16, error) {
	switch msgName {
	case "control_ping":
		return 100, nil
	case "control_ping_reply":
		return 101, nil
	case "sw_interface_dump":
		return 200, nil
	case "sw_interface_details":
		return 201, nil
	}

	a.access.Lock()
	defer a.access.Unlock()

	msgID, found := a.msgNameToIds[msgName]
	if found {
		return msgID, nil
	}

	a.msgIDSeq++
	msgID = a.msgIDSeq
	a.msgNameToIds[msgName] = msgID
	a.msgIDsToName[msgID] = msgName

	return msgID, nil
}
778339
func (ctx *Context) GETKeysBytes() [][]byte {
	var res [][]byte
	ctx.Request.URI().QueryArgs().VisitAll(func(key, value []byte) {
		res = append(res, key)
	})
	return res
}
597522
func GetChartGroupingCtx(r *http.Request) string {
	chartType, ok := r.Context().Value(ctxChartGrouping).(string)
	if !ok {
		apiLog.Trace("chart grouping not set")
		return ""
	}
	return chartType
}