本文整理汇总了C++中do_nanosleep函数的典型用法代码示例。如果您正苦于以下问题:C++ do_nanosleep函数的具体用法?C++ do_nanosleep怎么用?C++ do_nanosleep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_nanosleep函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: hrtimer_nanosleep_restart
long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
{
struct hrtimer_sleeper t;
struct timespec __user *rmtp;
int ret = 0;
hrtimer_init_on_stack(&t.timer, restart->nanosleep.clockid,
HRTIMER_MODE_ABS);
hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires);
if (do_nanosleep(&t, HRTIMER_MODE_ABS))
goto out;
rmtp = restart->nanosleep.rmtp;
if (rmtp) {
ret = update_rmtp(&t.timer, rmtp);
if (ret <= 0)
goto out;
}
/* The other values in restart are already filled in */
ret = -ERESTART_RESTARTBLOCK;
out:
destroy_hrtimer_on_stack(&t.timer);
return ret;
}
开发者ID:RolanDroid,项目名称:lge_MonsterKernel-lproj,代码行数:26,代码来源:hrtimer.c
示例2: hrtimer_nanosleep
long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer_sleeper t;
int ret = 0;
hrtimer_init_on_stack(&t.timer, clockid, mode);
t.timer.expires = timespec_to_ktime(*rqtp);
if (do_nanosleep(&t, mode))
goto out;
/* Absolute timers do not update the rmtp value and restart: */
if (mode == HRTIMER_MODE_ABS) {
ret = -ERESTARTNOHAND;
goto out;
}
if (rmtp) {
ret = update_rmtp(&t.timer, rmtp);
if (ret <= 0)
goto out;
}
restart = ¤t_thread_info()->restart_block;
restart->fn = hrtimer_nanosleep_restart;
restart->nanosleep.index = t.timer.base->index;
restart->nanosleep.rmtp = rmtp;
restart->nanosleep.expires = t.timer.expires.tv64;
ret = -ERESTART_RESTARTBLOCK;
out:
destroy_hrtimer_on_stack(&t.timer);
return ret;
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:35,代码来源:hrtimer.c
示例3: hrtimer_nanosleep_restart
long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
{
struct hrtimer_sleeper t;
struct timespec *rmtp;
ktime_t time;
restart->fn = do_no_restart_syscall;
hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS);
t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;
if (do_nanosleep(&t, HRTIMER_MODE_ABS))
return 0;
rmtp = (struct timespec *)restart->arg1;
if (rmtp) {
time = ktime_sub(t.timer.expires, t.timer.base->get_time());
if (time.tv64 <= 0)
return 0;
*rmtp = ktime_to_timespec(time);
}
restart->fn = hrtimer_nanosleep_restart;
/* The other values in restart are already filled in */
return -ERESTART_RESTARTBLOCK;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:27,代码来源:hrtimer.c
示例4: hrtimer_nanosleep
long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer_sleeper t;
ktime_t rem;
hrtimer_init(&t.timer, clockid, mode);
t.timer.expires = timespec_to_ktime(*rqtp);
if (do_nanosleep(&t, mode))
return 0;
/* Absolute timers do not update the rmtp value and restart: */
if (mode == HRTIMER_MODE_ABS)
return -ERESTARTNOHAND;
if (rmtp) {
rem = ktime_sub(t.timer.expires, t.timer.base->get_time());
if (rem.tv64 <= 0)
return 0;
*rmtp = ktime_to_timespec(rem);
}
restart = ¤t_thread_info()->restart_block;
restart->fn = hrtimer_nanosleep_restart;
restart->arg0 = (unsigned long) t.timer.base->index;
restart->arg1 = (unsigned long) rmtp;
restart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF;
restart->arg3 = t.timer.expires.tv64 >> 32;
return -ERESTART_RESTARTBLOCK;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:32,代码来源:hrtimer.c
示例5: hrtimer_nanosleep
long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer_sleeper t;
struct timespec tu;
ktime_t rem;
hrtimer_init(&t.timer, clockid, mode);
hrtimer_set_expires(&t.timer, timespec_to_ktime(*rqtp));
if (do_nanosleep(&t, mode))
return 0;
/* Absolute timers do not update the rmtp value and restart: */
if (mode == HRTIMER_MODE_ABS)
return -ERESTARTNOHAND;
if (rmtp) {
rem = hrtimer_expires_remaining(&t.timer);
if (rem.tv64 <= 0)
return 0;
tu = ktime_to_timespec(rem);
if (copy_to_user(rmtp, &tu, sizeof(tu)))
return -EFAULT;
}
restart = ¤t_thread_info()->restart_block;
restart->fn = hrtimer_nanosleep_restart;
restart->nanosleep.index = t.timer.base->index;
restart->nanosleep.rmtp = rmtp;
restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
return -ERESTART_RESTARTBLOCK;
}
开发者ID:gizm0n,项目名称:wl500g,代码行数:34,代码来源:hrtimer.c
示例6: hrtimer_nanosleep_restart
long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
{
struct hrtimer_sleeper t;
struct timespec __user *rmtp;
struct timespec tu;
ktime_t time;
hrtimer_init(&t.timer, restart->nanosleep.index, HRTIMER_MODE_ABS);
hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires);
if (do_nanosleep(&t, HRTIMER_MODE_ABS))
return 0;
rmtp = restart->nanosleep.rmtp;
if (rmtp) {
time = hrtimer_expires_remaining(&t.timer);
if (time.tv64 <= 0)
return 0;
tu = ktime_to_timespec(time);
if (copy_to_user(rmtp, &tu, sizeof(tu)))
return -EFAULT;
}
/* The other values in restart are already filled in */
return -ERESTART_RESTARTBLOCK;
}
开发者ID:gizm0n,项目名称:wl500g,代码行数:26,代码来源:hrtimer.c
示例7: hrtimer_nanosleep
long hrtimer_nanosleep(const struct timespec64 *rqtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer_sleeper t;
int ret = 0;
u64 slack;
slack = current->timer_slack_ns;
if (dl_task(current) || rt_task(current))
slack = 0;
hrtimer_init_on_stack(&t.timer, clockid, mode);
hrtimer_set_expires_range_ns(&t.timer, timespec64_to_ktime(*rqtp), slack);
ret = do_nanosleep(&t, mode);
if (ret != -ERESTART_RESTARTBLOCK)
goto out;
/* Absolute timers do not update the rmtp value and restart: */
if (mode == HRTIMER_MODE_ABS) {
ret = -ERESTARTNOHAND;
goto out;
}
restart = ¤t->restart_block;
restart->fn = hrtimer_nanosleep_restart;
restart->nanosleep.clockid = t.timer.base->clockid;
restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
out:
destroy_hrtimer_on_stack(&t.timer);
return ret;
}
开发者ID:mdamt,项目名称:linux,代码行数:32,代码来源:hrtimer.c
示例8: sys_nanosleep
W64 sys_nanosleep(W64 nsec) {
timespec req;
timespec rem;
req.tv_sec = (W64)nsec / 1000000000ULL;
req.tv_nsec = (W64)nsec % 1000000000ULL;
do_nanosleep(&req, &rem);
return ((W64)rem.tv_sec * 1000000000ULL) + (W64)rem.tv_nsec;
}
开发者ID:DiZhai,项目名称:ptlsim-indir-dev,代码行数:11,代码来源:syscalls.cpp
示例9: hrtimer_nanosleep_restart
static long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
{
struct hrtimer_sleeper t;
int ret;
hrtimer_init_on_stack(&t.timer, restart->nanosleep.clockid,
HRTIMER_MODE_ABS);
hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires);
ret = do_nanosleep(&t, HRTIMER_MODE_ABS);
destroy_hrtimer_on_stack(&t.timer);
return ret;
}
开发者ID:mdamt,项目名称:linux,代码行数:13,代码来源:hrtimer.c
示例10: hrtimer_nanosleep_restart
long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
{
struct hrtimer_sleeper t;
struct timespec __user *rmtp;
hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS);
t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2;
if (do_nanosleep(&t, HRTIMER_MODE_ABS))
return 0;
rmtp = (struct timespec __user *)restart->arg1;
if (rmtp) {
int ret = update_rmtp(&t.timer, rmtp);
if (ret <= 0)
return ret;
}
/* The other values in restart are already filled in */
return -ERESTART_RESTARTBLOCK;
}
开发者ID:mobilipia,项目名称:iods,代码行数:21,代码来源:hrtimer.c
示例11: hrtimer_nanosleep
long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer_sleeper t;
int ret = 0;
unsigned long slack;
slack = current->timer_slack_ns;
if (rt_task(current))
slack = 0;
hrtimer_init_on_stack(&t.timer, clockid, mode);
hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack);
if (do_nanosleep(&t, mode))
goto out;
/* Absolute timers do not update the rmtp value and restart: */
if (mode == HRTIMER_MODE_ABS) {
ret = -ERESTARTNOHAND;
goto out;
}
if (rmtp) {
ret = update_rmtp(&t.timer, rmtp);
if (ret <= 0)
goto out;
}
restart = ¤t_thread_info()->restart_block;
restart->fn = hrtimer_nanosleep_restart;
restart->nanosleep.clockid = t.timer.base->clockid;
restart->nanosleep.rmtp = rmtp;
restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
ret = -ERESTART_RESTARTBLOCK;
out:
destroy_hrtimer_on_stack(&t.timer);
return ret;
}
开发者ID:RolanDroid,项目名称:lge_MonsterKernel-lproj,代码行数:40,代码来源:hrtimer.c
注:本文中的do_nanosleep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论