您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unlock_system_sleep函数代码示例

51自学网 2021-06-03 09:11:11
  C++
这篇教程C++ unlock_system_sleep函数代码示例写得很实用,希望能帮到您。

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

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

示例1: snapshot_write

static ssize_t snapshot_write(struct file *filp, const char __user *buf,                              size_t count, loff_t *offp){	struct snapshot_data *data;	ssize_t res;	loff_t pg_offp = *offp & ~PAGE_MASK;	lock_system_sleep();	data = filp->private_data;	if (!pg_offp) {		res = snapshot_write_next(&data->handle);		if (res <= 0)			goto unlock;	} else {		res = PAGE_SIZE - pg_offp;	}	res = simple_write_to_buffer(data_of(data->handle), res, &pg_offp,			buf, count);	if (res > 0)		*offp += res;unlock:	unlock_system_sleep();	return res;}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:28,


示例2: snapshot_read

static ssize_t snapshot_read(struct file *filp, char __user *buf,                             size_t count, loff_t *offp){	struct snapshot_data *data;	ssize_t res;	loff_t pg_offp = *offp & ~PAGE_MASK;	lock_system_sleep();	data = filp->private_data;	if (!data->ready) {		res = -ENODATA;		goto Unlock;	}	if (!pg_offp) { /* on page boundary? */		res = snapshot_read_next(&data->handle);		if (res <= 0)			goto Unlock;	} else {		res = PAGE_SIZE - pg_offp;	}	res = simple_read_from_buffer(buf, count, &pg_offp,			data_of(data->handle), res);	if (res > 0)		*offp += res; Unlock:	unlock_system_sleep();	return res;}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:32,


示例3: fuse_change_attributes

void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,			    u64 attr_valid, u64 attr_version){	struct fuse_conn *fc = get_fuse_conn(inode);	struct fuse_inode *fi = get_fuse_inode(inode);	loff_t oldsize;	spin_lock(&fc->lock);	if (attr_version != 0 && fi->attr_version > attr_version) {		spin_unlock(&fc->lock);		return;	}	fuse_change_attributes_common(inode, attr, attr_valid);	oldsize = inode->i_size;	i_size_write(inode, attr->size);	spin_unlock(&fc->lock);	if (S_ISREG(inode->i_mode) && oldsize != attr->size) {		lock_system_sleep();		truncate_pagecache(inode, oldsize, attr->size);		invalidate_inode_pages2(inode->i_mapping);		unlock_system_sleep();	}}
开发者ID:Red680812,项目名称:DNA_kitkat,代码行数:26,


示例4: pm_test_store

static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr,				const char *buf, size_t n){	const char * const *s;	int level;	char *p;	int len;	int error = -EINVAL;	p = memchr(buf, '/n', n);	len = p ? p - buf : n;	lock_system_sleep();	level = TEST_FIRST;	for (s = &pm_tests[level]; level <= TEST_MAX; s++, level++)		if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) {			pm_test_level = level;			error = 0;			break;		}	unlock_system_sleep();	return error ? error : n;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:26,


示例5: resume_store

static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,			    const char *buf, size_t n){	dev_t res;	int len = n;	char *name;	if (len && buf[len-1] == '/n')		len--;	name = kstrndup(buf, len, GFP_KERNEL);	if (!name)		return -ENOMEM;	res = name_to_dev_t(name);	kfree(name);	if (!res)		return -EINVAL;	lock_system_sleep();	swsusp_resume_device = res;	unlock_system_sleep();	pr_info("Starting manual resume from disk/n");	noresume = 0;	software_resume();	return n;}
开发者ID:mdamt,项目名称:linux,代码行数:26,


示例6: snapshot_open

static int snapshot_open(struct inode *inode, struct file *filp){	struct snapshot_data *data;	int error;	lock_system_sleep();	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {		error = -EBUSY;		goto Unlock;	}	if ((filp->f_flags & O_ACCMODE) == O_RDWR) {		atomic_inc(&snapshot_device_available);		error = -ENOSYS;		goto Unlock;	}	if(create_basic_memory_bitmaps()) {		atomic_inc(&snapshot_device_available);		error = -ENOMEM;		goto Unlock;	}	nonseekable_open(inode, filp);	data = &snapshot_state;	filp->private_data = data;	memset(&data->handle, 0, sizeof(struct snapshot_handle));	if ((filp->f_flags & O_ACCMODE) == O_RDONLY) {		/* Hibernating.  The image device should be accessible. */		data->swap = swsusp_resume_device ?			swap_type_of(swsusp_resume_device, 0, NULL) : -1;		data->mode = O_RDONLY;		error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);		if (error)			pm_notifier_call_chain(PM_POST_HIBERNATION);	} else {		/*		 * Resuming.  We may need to wait for the image device to		 * appear.		 */		wait_for_device_probe();		data->swap = -1;		data->mode = O_WRONLY;		error = pm_notifier_call_chain(PM_RESTORE_PREPARE);		if (error)			pm_notifier_call_chain(PM_POST_RESTORE);	}	if (error) {		free_basic_memory_bitmaps();		atomic_inc(&snapshot_device_available);	}	data->frozen = 0;	data->ready = 0;	data->platform_support = 0; Unlock:	unlock_system_sleep();	return error;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:60,


示例7: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	suspend_state_t i;	lock_system_sleep();	suspend_ops = ops;	for (i = PM_SUSPEND_STANDBY; i <= PM_SUSPEND_MEM; i++)		pm_states[i].state = valid_state(i) ? i : 0;	unlock_system_sleep();}
开发者ID:sombree,项目名称:Hulk-Kernel-V2,代码行数:16,


示例8: disk_store

static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,			  const char *buf, size_t n){	int error = 0;	int i;	int len;	char *p;	int mode = HIBERNATION_INVALID;	if (!hibernation_available())		return -EPERM;	p = memchr(buf, '/n', n);	len = p ? p - buf : n;	lock_system_sleep();	for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {		if (len == strlen(hibernation_modes[i])		    && !strncmp(buf, hibernation_modes[i], len)) {			mode = i;			break;		}	}	if (mode != HIBERNATION_INVALID) {		switch (mode) {		case HIBERNATION_SHUTDOWN:		case HIBERNATION_REBOOT:#ifdef CONFIG_SUSPEND		case HIBERNATION_SUSPEND:#endif		case HIBERNATION_TEST_RESUME:			hibernation_mode = mode;			break;		case HIBERNATION_PLATFORM:			if (hibernation_ops)				hibernation_mode = mode;			else				error = -EINVAL;		}	} else		error = -EINVAL;	if (!error)		pr_debug("Hibernation mode set to '%s'/n",			 hibernation_modes[mode]);	unlock_system_sleep();	return error ? error : n;}
开发者ID:mdamt,项目名称:linux,代码行数:48,


示例9: hibernation_set_ops

/** * hibernation_set_ops - Set the global hibernate operations. * @ops: Hibernation operations to use in subsequent hibernation transitions. */void hibernation_set_ops(const struct platform_hibernation_ops *ops){	if (ops && !(ops->begin && ops->end &&  ops->pre_snapshot	    && ops->prepare && ops->finish && ops->enter && ops->pre_restore	    && ops->restore_cleanup && ops->leave)) {		WARN_ON(1);		return;	}	lock_system_sleep();	hibernation_ops = ops;	if (ops)		hibernation_mode = HIBERNATION_PLATFORM;	else if (hibernation_mode == HIBERNATION_PLATFORM)		hibernation_mode = HIBERNATION_SHUTDOWN;	unlock_system_sleep();}
开发者ID:mdamt,项目名称:linux,代码行数:21,


示例10: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	lock_system_sleep();	suspend_ops = ops;	if (valid_state(PM_SUSPEND_STANDBY)) {		mem_sleep_states[PM_SUSPEND_STANDBY] = mem_sleep_labels[PM_SUSPEND_STANDBY];		pm_states[PM_SUSPEND_STANDBY] = pm_labels[PM_SUSPEND_STANDBY];		if (mem_sleep_default == PM_SUSPEND_STANDBY)			mem_sleep_current = PM_SUSPEND_STANDBY;	}	if (valid_state(PM_SUSPEND_MEM)) {		mem_sleep_states[PM_SUSPEND_MEM] = mem_sleep_labels[PM_SUSPEND_MEM];		if (mem_sleep_default >= PM_SUSPEND_MEM)			mem_sleep_current = PM_SUSPEND_MEM;	}	unlock_system_sleep();}
开发者ID:guribe94,项目名称:linux,代码行数:24,


示例11: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	suspend_state_t i;	int j = 0;	lock_system_sleep();	suspend_ops = ops;	for (i = PM_SUSPEND_MEM; i >= PM_SUSPEND_STANDBY; i--)		if (valid_state(i)) {			pm_states[i] = pm_labels[j++];		} else if (!relative_states) {			pm_states[i] = NULL;			j++;		}	pm_states[PM_SUSPEND_FREEZE] = pm_labels[j];	unlock_system_sleep();}
开发者ID:19Dan01,项目名称:linux,代码行数:24,


示例12: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	suspend_state_t i;	int j = PM_SUSPEND_MAX - 1;	lock_system_sleep();	suspend_ops = ops;	for (i = PM_SUSPEND_MEM; i >= PM_SUSPEND_STANDBY; i--)		if (valid_state(i))			pm_states[j--].state = i;		else if (!relative_states)			pm_states[j--].state = 0;	pm_states[j--].state = PM_SUSPEND_FREEZE;	while (j >= PM_SUSPEND_MIN)		pm_states[j--].state = 0;	unlock_system_sleep();}
开发者ID:alisheikh,项目名称:ktsan,代码行数:24,


示例13: snapshot_release

static int snapshot_release(struct inode *inode, struct file *filp){	struct snapshot_data *data;	lock_system_sleep();	swsusp_free();	free_basic_memory_bitmaps();	data = filp->private_data;	free_all_swap_pages(data->swap);	if (data->frozen) {		pm_restore_gfp_mask();		thaw_processes();	}	pm_notifier_call_chain(data->mode == O_RDONLY ?			PM_POST_HIBERNATION : PM_POST_RESTORE);	atomic_inc(&snapshot_device_available);	unlock_system_sleep();	return 0;}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:22,


示例14: resume_store

static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,			    const char *buf, size_t n){	unsigned int maj, min;	dev_t res;	int ret = -EINVAL;	if (sscanf(buf, "%u:%u", &maj, &min) != 2)		goto out;	res = MKDEV(maj,min);	if (maj != MAJOR(res) || min != MINOR(res))		goto out;	lock_system_sleep();	swsusp_resume_device = res;	unlock_system_sleep();	printk(KERN_INFO "PM: Starting manual resume from disk/n");	noresume = 0;	software_resume();	ret = n; out:	return ret;}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:24,


示例15: hibernate

/** * hibernate - Carry out system hibernation, including saving the image. */int hibernate(void){	int error, nr_calls = 0;	bool snapshot_test = false;	if (!hibernation_available()) {		pr_debug("Hibernation not available./n");		return -EPERM;	}	lock_system_sleep();	/* The snapshot device should not be opened while we're running */	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {		error = -EBUSY;		goto Unlock;	}	pm_prepare_console();	error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls);	if (error) {		nr_calls--;		goto Exit;	}	pr_info("Syncing filesystems ... /n");	sys_sync();	pr_info("done./n");	error = freeze_processes();	if (error)		goto Exit;	lock_device_hotplug();	/* Allocate memory management structures */	error = create_basic_memory_bitmaps();	if (error)		goto Thaw;	error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);	if (error || freezer_test_done)		goto Free_bitmaps;	if (in_suspend) {		unsigned int flags = 0;		if (hibernation_mode == HIBERNATION_PLATFORM)			flags |= SF_PLATFORM_MODE;		if (nocompress)			flags |= SF_NOCOMPRESS_MODE;		else		        flags |= SF_CRC32_MODE;		pr_debug("Writing image./n");		error = swsusp_write(flags);		swsusp_free();		if (!error) {			if (hibernation_mode == HIBERNATION_TEST_RESUME)				snapshot_test = true;			else				power_down();		}		in_suspend = 0;		pm_restore_gfp_mask();	} else {		pr_debug("Image restored successfully./n");	} Free_bitmaps:	free_basic_memory_bitmaps(); Thaw:	unlock_device_hotplug();	if (snapshot_test) {		pr_debug("Checking hibernation image/n");		error = swsusp_check();		if (!error)			error = load_image_and_restore();	}	thaw_processes();	/* Don't bother checking whether freezer_test_done is true */	freezer_test_done = false; Exit:	__pm_notifier_call_chain(PM_POST_HIBERNATION, nr_calls, NULL);	pm_restore_console();	atomic_inc(&snapshot_device_available); Unlock:	unlock_system_sleep();	return error;}
开发者ID:mdamt,项目名称:linux,代码行数:92,


示例16: freeze_set_ops

void freeze_set_ops(const struct platform_freeze_ops *ops){	lock_system_sleep();	freeze_ops = ops;	unlock_system_sleep();}
开发者ID:sombree,项目名称:Hulk-Kernel-V2,代码行数:6,


示例17: hibernate

/** * hibernate - Carry out system hibernation, including saving the image. */int hibernate(void){	int error;	lock_system_sleep();	/* The snapshot device should not be opened while we're running */	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {		error = -EBUSY;		goto Unlock;	}	pm_prepare_console();	error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);	if (error)		goto Exit;	/* Allocate memory management structures */	error = create_basic_memory_bitmaps();	if (error)		goto Exit;	printk(KERN_INFO "PM: Syncing filesystems ... ");	sys_sync();	printk("done./n");	error = freeze_processes();	if (error)		goto Free_bitmaps;	error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);	if (error)		goto Thaw;	if (freezer_test_done) {		freezer_test_done = false;		goto Thaw;	}	if (in_suspend) {		unsigned int flags = 0;		if (hibernation_mode == HIBERNATION_PLATFORM)			flags |= SF_PLATFORM_MODE;		if (nocompress)			flags |= SF_NOCOMPRESS_MODE;		else		        flags |= SF_CRC32_MODE;		pr_debug("PM: writing image./n");		error = swsusp_write(flags);		swsusp_free();		if (!error)			power_down();		in_suspend = 0;		pm_restore_gfp_mask();	} else {		pr_debug("PM: Image restored successfully./n");	} Thaw:	thaw_processes(); Free_bitmaps:	free_basic_memory_bitmaps(); Exit:	pm_notifier_call_chain(PM_POST_HIBERNATION);	pm_restore_console();	atomic_inc(&snapshot_device_available); Unlock:	unlock_system_sleep();	return error;}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:73,


示例18: s2idle_set_ops

void s2idle_set_ops(const struct platform_s2idle_ops *ops){	lock_system_sleep();	s2idle_ops = ops;	unlock_system_sleep();}
开发者ID:guribe94,项目名称:linux,代码行数:6,



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


C++ unlock_task_sighand函数代码示例
C++ unlock_super函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。