// postprocessProtoBlock updates the proto block's validation flags (in metadata) by the results of validation process
962111
func postprocessProtoBlock(block *common.Block, validatedBlock *internal.Block) {
	txsFilter := util.TxValidationFlags(block.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER])
	for _, tx := range validatedBlock.Txs {
		txsFilter.SetFlag(tx.IndexInBlock, tx.ValidationCode)
	}
	block.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER] = txsFilter
}
637426
func (a *ArchiveOptions) PostProcess(cwd string) {
	// Set default blacklist only if none is set.
	if len(a.Blacklist) == 0 {
		// This cannot be generalized as ".*" as there is known use that require
		// a ".pki" directory to be mapped.
		a.Blacklist = stringlistflag.Flag{
			// Temporary python files.
			"*.pyc",
			// Temporary vim files.
			"*.swp",
			".git",
			".hg",
			".svn",
		}
	}
	if !filepath.IsAbs(a.Isolate) {
		a.Isolate = filepath.Join(cwd, a.Isolate)
	}
	a.Isolate = filepath.Clean(a.Isolate)

	if !filepath.IsAbs(a.Isolated) {
		a.Isolated = filepath.Join(cwd, a.Isolated)
	}
	a.Isolated = filepath.Clean(a.Isolated)

	for k, v := range a.PathVariables {
		// This is due to a Windows + GYP specific issue, where double-quoted paths
		// would get mangled in a way that cannot be resolved unless a space is
		// injected.
		a.PathVariables[k] = strings.TrimSpace(v)
	}
}
780363
func (apiDef *APIDefinition) PostProcess(workDir, fileName string) error {
	apiDef.Filename = path.Join(workDir, fileName)
	// libraries
	apiDef.Libraries = map[string]*Library{}

	if !isURL(fileName) {
		workDir = filepath.Join(workDir, filepath.Dir(fileName))
	}

	for name, path := range apiDef.Uses {
		lib := &Library{Filename: path}
		if _, err := ParseReadFile(workDir, path, lib); err != nil {
			return fmt.Errorf("apiDef.PostProcess() failed to parse library	name=%v, path=%v\n\terr=%v",
				name, path, err)
		}
		apiDef.Libraries[name] = lib
	}

	// traits
	for name, t := range apiDef.Traits {
		t.postProcess(name)
		apiDef.Traits[name] = t
	}

	// resource types
	for name, rt := range apiDef.ResourceTypes {
		rt.postProcess(name, apiDef.Traits, apiDef)
		apiDef.ResourceTypes[name] = rt
	}

	// types
	for name, t := range apiDef.Types {
		t.postProcess(name, apiDef)
		apiDef.Types[name] = t
	}

	// resources
	for k := range apiDef.Resources {
		r := apiDef.Resources[k]
		rts := apiDef.allResourceTypes(apiDef.ResourceTypes, apiDef.Libraries)
		trts := apiDef.allTraits(apiDef.Traits, apiDef.Libraries)
		if err := r.postProcess(k, nil, rts, trts, apiDef); err != nil {
			return err
		}
		apiDef.Resources[k] = r
	}
	return nil
}
307100
func ProcessBlockedError(err error, block Block) error {
	if err == nil {
		return nil
	}
	if params.IsCodeOperationBlocked(err) {
		msg := fmt.Sprintf("%v\n%v", err, blockedMessages[block])
		logger.Infof(msg)
		return errors.Errorf(msg)
	}
	return err
}
1046939
func (c *config) LoadPostProcessor(name string) (packer.PostProcessor, error) {
	log.Printf("Loading post-processor: %s", name)
	bin, ok := c.PostProcessors[name]
	if !ok {
		log.Printf("Post-processor not found: %s", name)
		return nil, nil
	}

	return c.pluginClient(bin).PostProcessor()
}
478135
func (l *HostStateListener) PostProcess(p map[string]struct{}) {
	// We are running all of the containers we are supposed to, now
	// shut down any containers we are not supposed to be running
	l.mu.Lock()
	defer l.mu.Unlock()
	stateIDs := l.getExistingThreadStateIDs()
	var orphanedStates []string
	for _, s := range stateIDs {
		if _, ok := p[s]; !ok {
			orphanedStates = append(orphanedStates, s)
			plog.WithField("stateid", s).Info("Detected orphaned container")
		}
	}

	if len(orphanedStates) > 0 {
		l.cleanUpContainers(orphanedStates, false)
		plog.WithField("count", len(orphanedStates)).Info("Cleaned up all orphaned containers")
	}
}
846753
func (bt *blockTree) processGetBlocksTask(ctx context.Context,
	wg *sync.WaitGroup, wp *workerpool.WorkerPool,
	job getBlocksForOffsetRangeTask,
	results chan<- getBlocksForOffsetRangeResult) {
	defer wg.Done()

	select {
	case <-ctx.Done():
		results <- getBlocksForOffsetRangeResult{err: ctx.Err()}
		return
	default:
	}

	// We may have been passed just a pointer and need to fetch the block here.
	var pblock BlockWithPtrs
	if job.pblock == nil {
		var err error
		pblock, _, err = bt.getter(ctx, bt.kmd, job.ptr, bt.file, BlockReadParallel)
		if err != nil {
			results <- getBlocksForOffsetRangeResult{
				firstBlock: job.firstBlock,
				err:        err,
			}
			return
		}
	} else {
		pblock = job.pblock
	}

	if !pblock.IsIndirect() {
		// Return this block, under the assumption that the
		// caller already checked the range for this block.
		if job.getDirect {
			results <- getBlocksForOffsetRangeResult{
				pathFromRoot:    job.pathPrefix,
				ptr:             job.ptr,
				block:           pblock,
				nextBlockOffset: nil,
				firstBlock:      job.firstBlock,
				err:             nil,
			}
		}
		return
	}

	// Search all of the in-range child blocks, and their child
	// blocks, etc, in parallel.
	childIsFirstBlock := job.firstBlock
	for i := 0; i < pblock.NumIndirectPtrs(); i++ {
		info, iptrOff := pblock.IndirectPtr(i)
		// Some byte of this block is included in the left side of the
		// range if `job.startOff` is less than the largest byte offset in
		// the block.
		inRangeLeft := true
		if i < pblock.NumIndirectPtrs()-1 {
			_, off := pblock.IndirectPtr(i + 1)
			inRangeLeft = job.startOff.Less(off)
		}
		if !inRangeLeft {
			continue
		}
		// Some byte of this block is included in the right side of
		// the range if `job.endOff` is bigger than the smallest byte
		// offset in the block (or if we're explicitly reading all the
		// data to the end).
		inRangeRight := job.endOff == nil || iptrOff.Less(job.endOff)
		if !inRangeRight {
			// This block is the first one past the offset range
			// amount the children.
			results <- getBlocksForOffsetRangeResult{nextBlockOffset: iptrOff}
			return
		}

		childPtr := info.BlockPointer
		childIndex := i

		childPath := make([]ParentBlockAndChildIndex, len(job.pathPrefix)+1)
		copy(childPath, job.pathPrefix)
		childPath[len(childPath)-1] = ParentBlockAndChildIndex{
			pblock:     pblock,
			childIndex: childIndex,
		}

		// We only need to fetch direct blocks if we've been asked
		// to do so.  If the direct type of the pointer is
		// unknown, we can assume all the children are direct
		// blocks, since there weren't multiple levels of
		// indirection before the introduction of the flag.
		if job.getDirect || childPtr.DirectType == IndirectBlock {
			subTask := job.subTask(childPtr, childPath, childIsFirstBlock)

			// Enqueue the subTask with the WorkerPool.
			wg.Add(1)
			wp.Submit(func() {
				bt.processGetBlocksTask(ctx, wg, wp, subTask, results)
			})
		} else {
			results <- getBlocksForOffsetRangeResult{
				pathFromRoot: childPath,
				firstBlock:   childIsFirstBlock,
			}
		}
		childIsFirstBlock = false
	}
}
428455
func validateProcessInfo(p *ProcessInfo) error {
	if p == nil {
		return fmt.Errorf("ProcessInfo must be set")
	} else if p.Name == "" {
		return fmt.Errorf("ProcessInfo name must be set")
	} else if p.Namespace == "" {
		return fmt.Errorf("ProcessInfo namespace must be set")
	}
	return nil
}
530952
func (smb SMBus) Block_process_call(cmd byte, buf []byte) ([]byte, error) {
	smb.Set_addr(smb.addr)
	ret, err := C.i2c_smbus_block_process_call(C.int(smb.bus.Fd()), C.__u8(cmd), C.__u8(len(buf)), ((*C.__u8)(&buf[0])))
	if err != nil {
		return nil, err
	} else {
		return buf[:ret], nil
	}
}
92207
func (b *rpcSyncMgr) SubmitBlock(block *btcutil.Block, flags blockchain.BehaviorFlags) (bool, error) {
	return b.syncMgr.ProcessBlock(block, flags)
}
242879
func NewPostLock() echo.HandlerFunc {

	// swagger:route POST /me/posts/{pid}/locks me post vote NewMePostLock
	//
	// Adds a new lock on the current post
	//
	// Consumes:
	// - application/json
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_messages:write
	//
	//	Responses:
	//		default: MePostsPidLocks

	return func(c echo.Context) error {
		return user.NewPostLock()(c)
	}
}
723857
func PostProcessRecordMatchResponse() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		logger.Log.Info("PostProcessRecordMatchResponse: Before calling handler")
		ctx.Next()
		resourceType, _ := ctx.Get("Resource")

		logger.Log.WithFields(logrus.Fields{"action": "check resource type exists",
			"method":       ctx.Request.Method,
			"query":        ctx.Request.RequestURI,
			"resourceType": resourceType}).Info("PostProcessRecordMatchResponse")

		if resourceType.(string) == "Bundle" &&
			ctx.Request.Method == "PUT" || ctx.Request.Method == "POST" {
			resource, _ := ctx.Get(resourceType.(string))
			// Need to access Database via global variable 'cuz DB not initializaed when middlewhare is configured
			updateRecordMatchRun(fhir_svr.Database, resource.(*fhir_models.Bundle))
		}
	}

}
260539
func ValidateOriginProcess(pid string) (string, error) {

	pidNumber, err := strconv.Atoi(pid)
	if err != nil {
		return "", fmt.Errorf("Invalid PID %s", pid)
	}
	process, err := process.NewProcess(int32(pidNumber))
	if err != nil {
		return "", fmt.Errorf("Process not found: %s", err)
	}
	ppid, err := process.Ppid()
	if err != nil {
		return "", fmt.Errorf("Parent process not found: %s", err)
	}
	parentPidCgroup, err := processCgroups(strconv.Itoa(int(ppid)), "net_cls,net_prio")
	if err != nil {
		return "", fmt.Errorf("Parent cgroup not found: %s", err)
	}
	if parentPidCgroup != "/" {
		return "", fmt.Errorf("Parent is not root cgroup - authorization fail")
	}
	return findParentCgroup(pid)
}
271893
func (c *Container) ExecdProcesses() (o []rproc.Process) {
	c.mu.Lock()
	defer c.mu.Unlock()
	for _, p := range c.processes {
		o = append(o, p)
	}
	return o
}
590362
func processRemoteEpState(netPlugin *plugin.NetPlugin, opts core.InstanceInfo, epCfg *mastercfg.CfgEndpointState, isDelete bool) error {
	if !checkRemoteHost(epCfg.VtepIP, epCfg.HomingHost, opts.HostLabel) {
		// Skip local endpoint update, as they are handled directly in dockplugin
		return nil
	}

	if isDelete {
		// Delete remote endpoint
		err := netPlugin.DeleteRemoteEndpoint(epCfg.ID)
		if err != nil {
			log.Errorf("Endpoint %s delete operation failed. Error: %s", epCfg.ID, err)
			return err
		}
		log.Infof("Endpoint %s delete operation succeeded", epCfg.ID)
	} else {
		// Create remote endpoint
		err := netPlugin.CreateRemoteEndpoint(epCfg.ID)
		if err != nil {
			log.Errorf("Endpoint %s create operation failed. Error: %s", epCfg.ID, err)
			return err
		}
		log.Infof("Endpoint %s create operation succeeded", epCfg.ID)
	}

	return nil
}
117922
func (l *Library) PostProcess(workDir, fileName string) error {
	// libraries
	if !isURL(fileName) {
		workDir = filepath.Join(workDir, filepath.Dir(fileName))
	}
	l.Libraries = map[string]*Library{}
	for name, path := range l.Uses {
		lib := &Library{Filename: path}
		if _, err := ParseReadFile(workDir, path, lib); err != nil {
			return fmt.Errorf("l.PostProcess() failed to parse library	name=%v, path=%v, err=%v",
				name, path, err)
		}
		l.Libraries[name] = lib

	}

	// traits
	for name, t := range l.Traits {
		t.postProcess(name)
		l.Traits[name] = t
	}

	// resource types
	for name, rt := range l.ResourceTypes {
		rt.postProcess(name, l.Traits, nil)
		l.ResourceTypes[name] = rt
	}
	return nil
}
901530
func (nc *Conn) processPermissionsViolation(err string) {
	nc.mu.Lock()
	// create error here so we can pass it as a closure to the async cb dispatcher.
	e := errors.New("nats: " + err)
	nc.err = e
	if nc.Opts.AsyncErrorCB != nil {
		nc.ach.push(func() { nc.Opts.AsyncErrorCB(nc, nil, e) })
	}
	nc.mu.Unlock()
}