// GetTiDBInfo returns the git hash and build time of this tidb-server binary.
4011
func GetTiDBInfo() string {
	return fmt.Sprintf("Release Version: %s\n"+
		"Git Commit Hash: %s\n"+
		"Git Branch: %s\n"+
		"UTC Build Time: %s\n"+
		"GoVersion: %s\n"+
		"Race Enabled: %v\n"+
		"TiKV Min Version: %s\n"+
		"Check Table Before Drop: %v",
		mysql.TiDBReleaseVersion,
		TiDBGitHash,
		TiDBGitBranch,
		TiDBBuildTS,
		GoVersion,
		israce.RaceEnabled,
		TiKVMinVersion,
		config.CheckTableBeforeDrop)
}
1355643
func (c *Connect) GetNodeInfo() (*NodeInfo, error) {
	var cinfo C.virNodeInfo
	var err C.virError
	result := C.virNodeGetInfoWrapper(c.ptr, &cinfo, &err)
	if result == -1 {
		return nil, makeError(&err)
	}
	return &NodeInfo{
		Model:   C.GoString((*C.char)(unsafe.Pointer(&cinfo.model[0]))),
		Memory:  uint64(cinfo.memory),
		Cpus:    uint(cinfo.cpus),
		MHz:     uint(cinfo.mhz),
		Nodes:   uint32(cinfo.nodes),
		Sockets: uint32(cinfo.sockets),
		Cores:   uint32(cinfo.cores),
		Threads: uint32(cinfo.threads),
	}, nil
}
126351
func GetRBDInfo(
	ctx types.Context,
	pool *string,
	name *string) (*RBDInfo, error) {

	ignoreCode := 2

	cmd := exec.Command(
		rbdCmd, "info", "-p", *pool, *name, formatOpt, jsonArg)
	out, status, err := RunCommand(ctx, cmd, ignoreCode)
	if err != nil {
		if status == ignoreCode {
			// image does not exist
			return nil, nil
		}
		return nil, goof.WithError("unable to get rbd info", err)
	}

	info := &RBDInfo{}

	err = json.Unmarshal(out, info)
	if err != nil {
		return nil, goof.WithError(
			"Unable to parse rbd info", err)
	}

	info.Pool = *pool

	return info, nil
}
868982
func getServerInfo(id string) *ServerInfo {
	cfg := config.GetGlobalConfig()
	info := &ServerInfo{
		ID:         id,
		IP:         cfg.AdvertiseAddress,
		Port:       cfg.Port,
		StatusPort: cfg.Status.StatusPort,
		Lease:      cfg.Lease,
	}
	info.Version = mysql.ServerVersion
	info.GitHash = printer.TiDBGitHash
	return info
}
198477
func (dd *DirData) GetIndirectDirBlockInfos(ctx context.Context) (
	[]BlockInfo, error) {
	return dd.tree.getIndirectBlockInfos(ctx)
}
1170458
func (a *aggregator) instInfo(id instance.Id, inst instances.Instance) (instanceInfo, error) {
	if inst == nil {
		return instanceInfo{}, errors.NotFoundf("instance %v", id)
	}
	addr, err := inst.Addresses(a.callContext)
	if err != nil {
		return instanceInfo{}, err
	}
	return instanceInfo{
		addr,
		inst.Status(a.callContext),
	}, nil
}
972311
func (client *Client) GetInfo() (Info, ResourceLinks, Warnings, error) {
	rootResponse, warnings, err := client.rootResponse()
	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	request, err := client.newHTTPRequest(requestOptions{
		Method: http.MethodGet,
		URL:    rootResponse.ccV3Link(),
	})
	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	info := ResourceLinks{} // Explicitly initializing
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &info,
	}

	err = client.connection.Make(request, &response)
	warnings = append(warnings, response.Warnings...)

	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	return rootResponse, info, warnings, nil
}
751189
func (util *RBDUtil) rbdInfo(b *rbdMounter) (int, error) {
	var err error
	var output []byte

	// If we don't have admin id/secret (e.g. attaching), fallback to user id/secret.
	id := b.adminId
	secret := b.adminSecret
	if id == "" {
		id = b.Id
		secret = b.Secret
	}

	mon := util.kernelRBDMonitorsOpt(b.Mon)
	// cmd "rbd info" get the image info with the following output:
	//
	// # image exists (exit=0)
	// rbd info volume-4a5bcc8b-2b55-46da-ba04-0d3dc5227f08
	//    size 1024 MB in 256 objects
	//    order 22 (4096 kB objects)
	// 	  block_name_prefix: rbd_data.1253ac238e1f29
	//    format: 2
	//    ...
	//
	//  rbd info volume-4a5bcc8b-2b55-46da-ba04-0d3dc5227f08 --format json
	// {"name":"volume-4a5bcc8b-2b55-46da-ba04-0d3dc5227f08","size":1073741824,"objects":256,"order":22,"object_size":4194304,"block_name_prefix":"rbd_data.1253ac238e1f29","format":2,"features":["layering","exclusive-lock","object-map","fast-diff","deep-flatten"],"flags":[]}
	//
	//
	// # image does not exist (exit=2)
	// rbd: error opening image 1234: (2) No such file or directory
	//
	klog.V(4).Infof("rbd: info %s using mon %s, pool %s id %s key %s", b.Image, mon, b.Pool, id, secret)
	output, err = b.exec.Run("rbd",
		"info", b.Image, "--pool", b.Pool, "-m", mon, "--id", id, "--key="+secret, "--format=json")

	if err, ok := err.(*exec.Error); ok {
		if err.Err == exec.ErrNotFound {
			klog.Errorf("rbd cmd not found")
			// fail fast if rbd command is not found.
			return 0, err
		}
	}

	// If command never succeed, returns its last error.
	if err != nil {
		return 0, err
	}

	if len(output) == 0 {
		return 0, fmt.Errorf("can not get image size info %s: %s", b.Image, string(output))
	}

	return getRbdImageSize(output)
}
236210
func (d *database) Info(ctx context.Context) (DatabaseInfo, error) {
	req, err := d.conn.NewRequest("GET", path.Join(d.relPath(), "_api/database/current"))
	if err != nil {
		return DatabaseInfo{}, WithStack(err)
	}
	applyContextSettings(ctx, req)
	resp, err := d.conn.Do(ctx, req)
	if err != nil {
		return DatabaseInfo{}, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return DatabaseInfo{}, WithStack(err)
	}
	var data DatabaseInfo
	if err := resp.ParseBody("result", &data); err != nil {
		return DatabaseInfo{}, WithStack(err)
	}
	return data, nil
}
487056
func (db *TowerDB) GetSessionInfo(id *wtdb.SessionID) (*wtdb.SessionInfo, error) {
	db.mu.Lock()
	defer db.mu.Unlock()

	if info, ok := db.sessions[*id]; ok {
		return info, nil
	}

	return nil, wtdb.ErrSessionNotFound
}
1169332
func Get() Info {
	// These variables typically come from -ldflags settings and in
	// their absence fallback to the settings in pkg/version/base.go
	return Info{
		Major:        gitMajor,
		Minor:        gitMinor,
		GitVersion:   gitVersion,
		GitCommit:    gitCommit,
		GitTreeState: gitTreeState,
	}
}
1235457
func Get() *Info {
	ver := Info{}
	ver.GitCommit = gitCommit
	ver.Version = version
	ver.BuildTime = buildTime

	return &ver
}
223535
func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoRequest_Swarming,
	projectHint string) (*milo.BuildInfoResponse, error) {

	// Load the Swarming task (no log content).
	sf, err := p.newSwarmingService(c, req.Host)
	if err != nil {
		logging.WithError(err).Errorf(c, "Failed to create Swarming fetcher.")
		return nil, grpcutil.Internal
	}

	// Use default Swarming host.
	host := sf.GetHost()
	logging.Infof(c, "Loading build info for Swarming host %s, task %s.", host, req.Task)

	fr, err := swarmingFetch(c, sf, req.Task, swarmingFetchParams{})
	if err != nil {
		if err == ErrNotMiloJob {
			logging.Warningf(c, "User requested nonexistent task or does not have permissions.")
			return nil, grpcutil.NotFound
		}

		logging.WithError(err).Errorf(c, "Failed to load Swarming task.")
		return nil, grpcutil.Internal
	}

	// Determine the LogDog annotation stream path for this Swarming task.
	//
	// On failure, will return a gRPC error.
	stream, err := resolveLogDogAnnotations(c, fr.res.Tags)
	if err != nil {
		logging.WithError(err).Warningf(c, "Failed to get annotation stream parameters.")
		return nil, err
	}

	logging.Fields{
		"host":    stream.Host,
		"project": stream.Project,
		"path":    stream.Path,
	}.Infof(c, "Resolved LogDog annotation stream.")

	step, err := rawpresentation.ReadAnnotations(c, stream)
	if err != nil {
		return nil, errors.Annotate(err, "failed to read annotations").Err()
	}

	// Add Swarming task parameters to the Milo step.
	if err := addTaskToMiloStep(c, sf.GetHost(), fr.res, step); err != nil {
		return nil, err
	}

	prefix, name := stream.Path.Split()
	return &milo.BuildInfoResponse{
		Project: string(stream.Project),
		Step:    step,
		AnnotationStream: &miloProto.LogdogStream{
			Server: stream.Host,
			Prefix: string(prefix),
			Name:   string(name),
		},
	}, nil
}
1164012
func (d *Domain) GetFSInfo(flags uint32) ([]DomainFSInfo, error) {
	if C.LIBVIR_VERSION_NUMBER < 1002011 {
		return []DomainFSInfo{}, makeNotImplementedError("virDomainGetFSInfo")
	}
	var cfsinfolist **C.virDomainFSInfo

	var err C.virError
	ret := C.virDomainGetFSInfoWrapper(d.ptr, (**C.virDomainFSInfoPtr)(unsafe.Pointer(&cfsinfolist)), C.uint(flags), &err)
	if ret == -1 {
		return []DomainFSInfo{}, makeError(&err)
	}

	fsinfo := make([]DomainFSInfo, int(ret))

	for i := 0; i < int(ret); i++ {
		cfsinfo := (*C.virDomainFSInfo)(*(**C.virDomainFSInfo)(unsafe.Pointer(uintptr(unsafe.Pointer(cfsinfolist)) + (unsafe.Sizeof(*cfsinfolist) * uintptr(i)))))

		aliases := make([]string, int(cfsinfo.ndevAlias))
		for j := 0; j < int(cfsinfo.ndevAlias); j++ {
			calias := (*C.char)(*(**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cfsinfo.devAlias)) + (unsafe.Sizeof(*cfsinfo) * uintptr(j)))))
			aliases[j] = C.GoString(calias)
		}
		fsinfo[i] = DomainFSInfo{
			MountPoint: C.GoString(cfsinfo.mountpoint),
			Name:       C.GoString(cfsinfo.name),
			FSType:     C.GoString(cfsinfo.fstype),
			DevAlias:   aliases,
		}

		C.virDomainFSInfoFreeWrapper(cfsinfo)
	}
	C.free(unsafe.Pointer(cfsinfolist))

	return fsinfo, nil
}
475747
func GetFdInfo(in interface{}) (uintptr, bool) {
	var inFd uintptr
	var isTerminalIn bool
	if file, ok := in.(*os.File); ok {
		inFd = file.Fd()
		isTerminalIn = IsTerminal(inFd)
	}
	return inFd, isTerminalIn
}
791836
func (t *Torrent) GotInfo() <-chan struct{} {
	t.cl.lock()
	defer t.cl.unlock()
	return t.gotMetainfo.C()
}
1301496
func (t *TowerDB) GetSessionInfo(id *SessionID) (*SessionInfo, error) {
	var session *SessionInfo
	err := t.db.View(func(tx *bbolt.Tx) error {
		sessions := tx.Bucket(sessionsBkt)
		if sessions == nil {
			return ErrUninitializedDB
		}

		var err error
		session, err = getSession(sessions, id[:])
		return err
	})
	if err != nil {
		return nil, err
	}

	return session, nil
}