函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\eventfd.c Create Date:2022-07-29 10:52:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:eventfd_write

函数原型:static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
269  ctx等于 needed for tty driver, and maybe others
272  DECLARE_WAITQUEUE(wait, 当前进程)
274  如果count小于ucnt的长度则返回:负EINVAL
276  如果copy_from_user( & ucnt, buf, ucnt的长度)则返回:负EFAULT
278  如果ucnt恒等于ULLONG_MAX则返回:负EINVAL
280  spin_lock_irq( & lock)
281  res等于负EAGAIN
282  如果ULLONG_MAX* Every time that a write(2) is performed on an eventfd, the * value of the __u64 being written is added to "count" and a * wakeup is performed on "wqh". A read(2) will return the "count" * value to userspace, and will reset "count" to zero. The kernel * s大于ucntres等于ucnt的长度
284  否则如果非f_flags按位与O_NONBLOCK的值则
285  __add_wait_queue( & wqh, & wait)
286  循环
289  res等于ucnt的长度
290  退出
292  如果signal_pending(当前进程)则
296  spin_unlock_irq( & lock)
297  进程调度
298  spin_lock_irq( & lock)
300  __remove_wait_queue( & wqh, & wait)
301  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (就绪态)
303  如果此条件成立可能性大(为编译器优化)(res > 0)则
304  * Every time that a write(2) is performed on an eventfd, the * value of the __u64 being written is added to "count" and a * wakeup is performed on "wqh". A read(2) will return the "count" * value to userspace, and will reset "count" to zero. The kernel * s加等于ucnt
305  如果waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_wake_up_locked_poll( & wqh, Epoll event masks )
308  spin_unlock_irq( & lock)
310  返回:res