• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ proc_create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中proc_create函数的典型用法代码示例。如果您正苦于以下问题:C++ proc_create函数的具体用法?C++ proc_create怎么用?C++ proc_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了proc_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: co_os_manager_init

co_rc_t co_os_manager_init(co_manager_t *manager, co_osdep_manager_t *osdep)
{
	co_rc_t rc = CO_RC(OK);
	co_osdep_manager_t dep;

	*osdep = dep = co_os_malloc(sizeof(*dep));
	if (dep == NULL)
		return CO_RC(OUT_OF_MEMORY);

	memset(dep, 0, sizeof(*dep));

	dep->proc_root = proc_mkdir("colinux", CO_PROC_ROOT_PTR);
	if (dep->proc_root == NULL) {
		rc = CO_RC(ERROR);
		goto error;
	}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
	dep->proc_root->owner = THIS_MODULE;
#endif
	dep->proc_ioctl = proc_create("ioctl",  S_IFREG|S_IRUSR|S_IWUSR, dep->proc_root, &manager_fileops);
	if (!dep->proc_ioctl) {
		rc = CO_RC(ERROR);
		goto error_root;
	}

	//dep->proc_ioctl->proc_fops = &manager_fileops;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
	dep->proc_ioctl->owner = THIS_MODULE;
#endif
	return rc;

error_root:
	remove_proc_entry("colinux", CO_PROC_ROOT_PTR);

error:
	co_os_free(dep);
	return rc;
}
开发者ID:matt81093,项目名称:Original-Colinux,代码行数:38,代码来源:manager.c


示例2: proc_fork

/*
 * Clone the current process.
 *
 * The new thread is given a copy of the caller's file handles if RET
 * is not null. (If RET is null, what we're creating is a kernel-only
 * thread and it doesn't need an address space or file handles.)
 * However, the new thread always inherits its current working
 * directory from the caller. The new thread is given no address space
 * (the caller decides that).
 */
int
proc_fork(struct proc **ret)
{
	struct proc *proc;
	struct filetable *tbl;
	int result;

	proc = proc_create(curproc->p_name);
	if (proc == NULL) {
		return ENOMEM;
	}

	/* VM fields */
	/* do not clone address space -- let caller decide on that */

	/* VFS fields */
	tbl = curproc->p_filetable;
	if (tbl != NULL) {
		result = filetable_copy(tbl, &proc->p_filetable);
		if (result) {
			as_destroy(proc->p_addrspace);
			proc->p_addrspace = NULL;
			proc_destroy(proc);
			return result;
		}
	}

	spinlock_acquire(&curproc->p_lock);
	/* we don't need to lock proc->p_lock as we have the only reference */
	if (curproc->p_cwd != NULL) {
		VOP_INCREF(curproc->p_cwd);
		proc->p_cwd = curproc->p_cwd;
	}
	spinlock_release(&curproc->p_lock);

	*ret = proc;
	return 0;
}
开发者ID:carol975,项目名称:CPEN331SRC,代码行数:48,代码来源:proc.c


示例3: bootstrap

/**
 * This function is called from kmain, however it is not running in a
 * thread context yet. It should create the idle process which will
 * start executing idleproc_run() in a real thread context.  To start
 * executing in the new process's context call context_make_active(),
 * passing in the appropriate context. This function should _NOT_
 * return.
 *
 * Note: Don't forget to set curproc and curthr appropriately.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
bootstrap(int arg1, void *arg2)
{

        /* If the next line is removed/altered in your submission, 20 points will be deducted. */
        dbgq(DBG_CORE, "SIGNATURE: 53616c7465645f5f75d4d6807cbe46557c5894883e55a7be357a5954568eccfc0c1d901bcc73a4409c500b4c2ad2554d\n");
        /* necessary to finalize page table information */
        pt_template_init();    
        
        curproc = proc_create("IDLE");
        KASSERT(NULL != curproc);
        dbg(DBG_PRINT," (GRADING1A 1.a) successfully created IDLE process with process id %d\n",curproc->p_pid);
        KASSERT(PID_IDLE == curproc->p_pid);
        dbg(DBG_PRINT," (GRADING1A 1.a) PID_IDLE value is %d and it matches with the idle process id %d\n",PID_IDLE,curproc->p_pid);
        curthr = kthread_create(curproc,idleproc_run,0,NULL);
        KASSERT(NULL != curthr);
        dbg(DBG_PRINT," (GRADING1A 1.a) thread for the idle process has been created successfully!!\n");
        
        context_make_active(&curthr->kt_ctx);

        /*panic("weenix returned to bootstrap()!!! BAD!!!\n");*/
        return NULL;
}
开发者ID:rvsharath91,项目名称:Projects,代码行数:36,代码来源:kmain.c


示例4: initproc_create

/**
 * This function, called by the idle process (within 'idleproc_run'), creates the
 * process commonly refered to as the "init" process, which should have PID 1.
 *
 * The init process should contain a thread which begins execution in
 * initproc_run().
 *
 * @return a pointer to a newly created thread which will execute
 * initproc_run when it begins executing
 */
static kthread_t *
initproc_create(void)
{
        proc_t* init_p;
        kthread_t* init_t; 
        init_p = proc_create("init");

        KASSERT(NULL!=init_p);
        dbg(DBG_PRINT, "(GRADING1A 1.b)\n");

        KASSERT(PID_INIT==init_p->p_pid);
        dbg(DBG_PRINT, "(GRADING1A 1.b)\n");

        init_t = kthread_create(init_p, initproc_run, 0, NULL);
       
        KASSERT(init_t != NULL);
        dbg(DBG_PRINT, "(GRADING1A 1.b)\n");

        return init_t; 

     /*  NOT_YET_IMPLEMENTED("PROCS: initproc_create");
         return NULL; */
}
开发者ID:BarFox,项目名称:gitDir,代码行数:33,代码来源:kmain.c


示例5: scanlog_init

static int __init scanlog_init(void)
{
	struct proc_dir_entry *ent;
	int err = -ENOMEM;

	ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
	if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE)
		return -ENODEV;

	/* Ideally we could allocate a buffer < 4G */
	scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
	if (!scanlog_buffer)
		goto err;

	ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
			  &scanlog_fops);
	if (!ent)
		goto err;
	return 0;
err:
	kfree(scanlog_buffer);
	return err;
}
开发者ID:KutuSystems,项目名称:kutu_linux,代码行数:23,代码来源:scanlog.c


示例6: init_fifoproc_module

/* Funciones de inicialización y descarga del módulo */
int init_fifoproc_module(void){
	int ret;
	ret = kfifo_alloc(&fifobuff, MAX_ITEMS_FIFO, GFP_KERNEL);

	if (ret) {
		printk(KERN_ERR "error al reservar espacio para kfifo\n");
		return ret;
	}

	sema_init(&mtx, 1);
	sema_init(&sem_prod, 0);
	sema_init(&sem_cons, 0);

	proc_entry = proc_create("modfifo",0666, NULL, &proc_entry_fops);
	if (proc_entry == NULL) {
		kfifo_free(&fifobuff);
		return -ENOMEM;
	}

	printk(KERN_INFO "modfifo: Module loaded.\n");

	return 0;
}
开发者ID:hecoding,项目名称:Linux-and-Android-internals,代码行数:24,代码来源:fifoproc.c


示例7: TGesture_probe

static int TGesture_probe(struct platform_device *pdev) 
{
        int err;
	APS_FUN();  
	
	printk("==============TGesture==================\n");
	if((err = TGesture_create_attr(&TGesture_driver.driver)))
	{
		printk("create attribute err = %d\n", err);
		return 0;
	}
    // Create proc file system
       tgesture_config_proc = proc_create(TGesture_CONFIG_PROC_FILE, 0666, NULL, &config_proc_ops);
     if (tgesture_config_proc == NULL)
    {
        TGESTURE_DEBUG_FUNC("create_proc_entry %s failed\n", TGesture_CONFIG_PROC_FILE);
     }
    else
    {
        TGESTURE_DEBUG_FUNC("create proc entry %s success", TGesture_CONFIG_PROC_FILE);
    }
	return 0;
}
开发者ID:resbeut,项目名称:S5501-3.10,代码行数:23,代码来源:tgesture.c


示例8: procfs_test2_init

static int __init procfs_test2_init(void)
{
    mm_proc_dir = 0;
    mm_proc_mem = 0;

    //create a directory under /proc
    mm_proc_dir = proc_mkdir("gdl", 0);
    if (mm_proc_dir == 0) {
        printk(KERN_ERR "/proc/gdl/ creation failed\n");
	return -1;
    }

    //create /proc/gdl/memory file
    mm_proc_mem = proc_create("memory", S_IFREG|S_IRWXU|S_IRWXG|S_IRWXO, mm_proc_dir, &procfs_test2_fops);
    if (mm_proc_mem == 0) {
        printk(KERN_ERR "/proc/gdl/memory creation failed\n");
        proc_remove(mm_proc_dir);
        mm_proc_dir = 0;
        return -1;
    }

    return 0;
}
开发者ID:fuyajun1983cn,项目名称:ldd3,代码行数:23,代码来源:procfs_test2.c


示例9: init_clipboard_module

int init_clipboard_module( void )
{
  int ret = 0;
  clipboard = (char *)vmalloc( BUFFER_LENGTH );

  if (!clipboard) {
    ret = -ENOMEM;
  } else {

    memset( clipboard, 0, BUFFER_LENGTH );
    proc_entry = proc_create( "clipboard", 0666, NULL, &proc_entry_fops);
    if (proc_entry == NULL) {
      ret = -ENOMEM;
      vfree(clipboard);
      printk(KERN_INFO "Clipboard: Can't create /proc entry\n");
    } else {
      printk(KERN_INFO "Clipboard: Module loaded\n");
    }
  }

  return ret;

}
开发者ID:mappolo,项目名称:LIN-UCM,代码行数:23,代码来源:clipboard.c


示例10: gt1x_init_tool_node

int gt1x_init_tool_node(void)
{
    memset(&cmd_head, 0, sizeof(cmd_head));
    cmd_head.wr = 1;	//if the first operation is read, will return fail.
    cmd_head.data = kzalloc(DATA_LENGTH_UINT, GFP_KERNEL);
    if (NULL == cmd_head.data) {
        GTP_ERROR("Apply for memory failed.");
        return -1;
    }
    GTP_INFO("Applied memory size:%d.", DATA_LENGTH_UINT);
    DATA_LENGTH = DATA_LENGTH_UINT - GTP_ADDR_LENGTH;

    set_tool_node_name(procname);

    gt1x_tool_proc_entry = proc_create(procname, 0666, NULL, &gt1x_tool_fops);
    if (gt1x_tool_proc_entry == NULL) {
        GTP_ERROR("Couldn't create proc entry!");
        return -1;
    } else {
        GTP_INFO("Create proc entry success!");
    }
    return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:23,代码来源:gt1x_tools.c


示例11: mon_execute

/*
 * mon_execute executes a user program. It gets the index of a user program
 * and executes it.
 */
int mon_execute(int argc, char **argv)
{
	struct Process *proc = NULL;
	int program_index = 0;
	bool loaded = false;

	if (argc < 2) {
		kprintf("execute requires at least one argument.\n");
		return -1;
	}

	program_index = argv[1][0] - '0';
	proc = proc_create();
	loaded = proc_load_program(proc, program_index);

	if (loaded)
		schedule();
	else {
		kprintf("couldn't load the process.\n");
	}

	return 0;
}
开发者ID:Machiry,项目名称:arunos,代码行数:27,代码来源:mon_execute.c


示例12: bootstrap

/**
 * This function is called from kmain, however it is not running in a
 * thread context yet. It should create the idle process which will
 * start executing idleproc_run() in a real thread context.  To start
 * executing in the new process's context call context_make_active(),
 * passing in the appropriate context. This function should _NOT_
 * return.
 *
 * Note: Don't forget to set curproc and curthr appropriately.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
bootstrap(int arg1, void *arg2)
{
        /* necessary to finalize page table information */
        pt_template_init();

        /* PROCS {{{ */
        /* Set up our initial process and jump into it */
        curproc = proc_create("idle");
        KASSERT(NULL != curproc);
        KASSERT(PID_IDLE == curproc->p_pid);

        curthr = kthread_create(curproc, idleproc_run, 0, NULL);
        KASSERT(NULL != curthr);

        dbg(DBG_INIT, "Starting idle proc\n");
        context_make_active(&curthr->kt_ctx);

        /* PROCS }}} */

        panic("weenix returned to bootstrap()!!! BAD!!!\n");
        return NULL;
}
开发者ID:lygood2007,项目名称:Weenix,代码行数:36,代码来源:kmain.c


示例13: bootstrap

/**
 * This function is called from kmain, however it is not running in a
 * thread context yet. It should create the idle process which will
 * start executing idleproc_run() in a real thread context.  To start
 * executing in the new process's context call context_make_active(),
 * passing in the appropriate context. This function should _NOT_
 * return.
 *
 * Note: Don't forget to set curproc and curthr appropriately.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
bootstrap(int arg1, void *arg2)
{
	dbg(DBG_CORE, "bootstrapping\n");

        /* necessary to finalize page table information */
        pt_template_init();

	/* Create a process with pid 0 */
	proc_t *p = proc_create("process 0");
	kthread_t *kt = kthread_create(p, idleproc_run, arg1, arg2);

	KASSERT(p && (p->p_pid == 0));
	KASSERT(kt);

	curproc = p;
	curthr = kt;

	context_make_active(&kt->kt_ctx);

        panic("weenix returned to bootstrap()!!! BAD!!!\n");
        return NULL;
}
开发者ID:lee4sj,项目名称:brown,代码行数:36,代码来源:kmain.c


示例14: example_init

static __init int example_init(void)
{
		int result;

		/*
		 * Register your major, and accept a dynamic number
		 */
		result = register_chrdev(example_major, "example", &example_fops);
		if (result < 0) {
				printk(KERN_WARNING "example: can't get major %d\n",example_major);
				return result;
		}
		if (example_major == 0) example_major = result; /* dynamic */
		printk("<1> example device driver version 4: loaded at major number %d\n", example_major);

		example_device_stats = (example_stats *) kmalloc(sizeof(example_stats),GFP_KERNEL);
		if (!example_device_stats) {
				result = -ENOMEM;
				goto fail_malloc;
		}
		init_example_device_stats();

		/* We assume that the /proc/driver exists. Otherwise we need to use proc_mkdir to
		 * create it as follows: proc_mkdir("driver", NULL);
		 */
		example_proc_file = proc_create("driver/example", 0, NULL, &example_proc_fops);
		if (!example_proc_file)  {
				result = -ENOMEM;
				goto fail_malloc;
		}

		return 0;

fail_malloc:
		unregister_chrdev(example_major, "example");
		return  result;
}
开发者ID:BoiseState,项目名称:CS453-resources,代码行数:37,代码来源:example.c


示例15: mtktspa_init

static int __init mtktspa_init(void)
{
	int err = 0;
	struct proc_dir_entry *entry = NULL;
	struct proc_dir_entry *mtktspa_dir = NULL;

	mtktspa_dprintk("[%s]\n", __func__);

	err = mtktspa_register_cooler();
	if (err)
		return err;

	err = mtktspa_register_thermal();
	if (err)
		goto err_unreg;

	mtktspa_dir = mtk_thermal_get_proc_drv_therm_dir_entry();
	if (!mtktspa_dir) {
		mtktspa_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__);
	} else {
		entry =
		    proc_create("tzpa", S_IRUGO | S_IWUSR | S_IWGRP, mtktspa_dir, &mtktspa_fops);
		if (entry) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
			proc_set_user(entry, 0, 1000);
#else
			entry->gid = 1000;
#endif
		}
	}

	return 0;

err_unreg:
	mtktspa_unregister_cooler();
	return err;
}
开发者ID:John677,项目名称:Kernal_k3note,代码行数:37,代码来源:mtk_ts_pa.c


示例16: ppm_thermal_policy_init

static int __init ppm_thermal_policy_init(void)
{
	int i, ret = 0;

	struct pentry {
		const char *name;
		const struct file_operations *fops;
	};

	const struct pentry entries[] = {
		PROC_ENTRY(thermal_limit),
	};

	FUNC_ENTER(FUNC_LV_POLICY);

	/* create procfs */
	for (i = 0; i < ARRAY_SIZE(entries); i++) {
		if (!proc_create(entries[i].name, S_IRUGO | S_IWUSR | S_IWGRP, policy_dir, entries[i].fops)) {
			ppm_err("%s(), create /proc/ppm/policy/%s failed\n", __func__, entries[i].name);
			ret = -EINVAL;
			goto out;
		}
	}

	if (ppm_main_register_policy(&thermal_policy)) {
		ppm_err("@%s: thermal policy register failed\n", __func__);
		ret = -EINVAL;
		goto out;
	}

	ppm_info("@%s: register %s done!\n", __func__, thermal_policy.name);

out:
	FUNC_EXIT(FUNC_LV_POLICY);

	return ret;
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:37,代码来源:mt_ppm_policy_thermal.c


示例17: fts_create_apk_debug_channel

/************************************************************************
* Name: fts_create_apk_debug_channel
* Brief:  create apk debug channel
* Input: i2c info
* Output: no
* Return: success =0
***********************************************************************/
int fts_create_apk_debug_channel(struct i2c_client * client)
{	
	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
		fts_proc_entry = proc_create(PROC_NAME, 0777, NULL, &fts_proc_fops);		
	#else
		fts_proc_entry = create_proc_entry(PROC_NAME, 0777, NULL);
	#endif
	if (NULL == fts_proc_entry) 
	{
		dev_err(&client->dev, "Couldn't create proc entry!\n");
		
		return -ENOMEM;
	} 
	else 
	{
		dev_info(&client->dev, "Create proc entry success!\n");
		
		#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
			fts_proc_entry->write_proc = fts_debug_write;
			fts_proc_entry->read_proc = fts_debug_read;
		#endif
	}
	return 0;
}
开发者ID:EvlisChen,项目名称:git_test,代码行数:31,代码来源:focaltech_ex_fun.c


示例18: bootstrap

/**
 * This function is called from kmain, however it is not running in a
 * thread context yet. It should create the idle process which will
 * start executing idleproc_run() in a real thread context.  To start
 * executing in the new process's context call context_make_active(),
 * passing in the appropriate context. This function should _NOT_
 * return.
 *
 * Note: Don't forget to set curproc and curthr appropriately.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
bootstrap(int arg1, void *arg2)
{
        /* necessary to finalize page table information */

        dbg(DBG_PROC, "Function: bootstrap\n");
        pt_template_init();

        /*NOT_YET_IMPLEMENTED("PROCS: bootstrap");*/
        proc_t *p_idle=proc_create("Idle procss");
        curproc=p_idle;
        KASSERT(NULL != curproc);
        dbg(DBG_PRINT,"GRADING1A 1.a-1\n");
        KASSERT(PID_IDLE == curproc->p_pid);
        dbg(DBG_PRINT,"GRADING1A 1.a-2\n");
        kthread_t *thr_idle=kthread_create(p_idle,idleproc_run,0,NULL);
        curthr=thr_idle;
        KASSERT(NULL != curthr);
        dbg(DBG_PRINT,"GRADING1A 1.a-3\n");
        context_make_active(&curthr->kt_ctx);

        /*panic("weenix returned to bootstrap()!!! BAD!!!\n");*/
        return NULL;
}
开发者ID:Alicehang,项目名称:bubble,代码行数:37,代码来源:kmain.c


示例19: proc_file_create

int
proc_file_create (void)
{
    int ii = 0;
    char device_name[LOCAL_BUF_SZ + 1];

    do {
        proc_dir = proc_mkdir("CDD", 0);
        for (ii = 0; ii < CDDNUMDEVS; ii++) {
            snprintf(device_name, LOCAL_BUF_SZ, "CDD%d", buf_type[ii]);
            proc_stats[ii] = proc_create(device_name, 0777, proc_dir, &proc_fops[ii]);
        }

        display_buffer.buf = vmalloc ((BUF_SZ + 1) * sizeof (char));
        if (display_buffer.buf == NULL) {
            printk(KERN_ALERT "Cannot allocate memory !!!");
            break;
        } else {
            display_buffer.size = BUF_SZ;
        }

    } while (0);
    return 0;
}
开发者ID:andrewma83,项目名称:UCSCEX,代码行数:24,代码来源:proc.c


示例20: mydrv_init

static int __init
mydrv_init(void)
{
 

  int i;
  
 /*
  entry = create_proc_entry("readme", S_IRUSR, NULL);
  if (entry) {
   
   entry->proc_fops = &mydrv_proc_fops; 
  }
  else 
  {
	return -EINVAL;
  }
  */
  entry = proc_create("readme", S_IRUSR, NULL, &mydrv_proc_fops);
 

  printk("we are in init function of the module\n");  //2
  return 0;
}
开发者ID:satyanarayanMindtree,项目名称:minimal_os_driver,代码行数:24,代码来源:proc_seq_example2.c



注:本文中的proc_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ proc_dointvec函数代码示例发布时间:2022-05-30
下一篇:
C++ proc_calc_metrics函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap