Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\apm_32.c Create Date:2022-07-28 08:22:28
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:do_read

Proto:static ssize_t do_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *fp
char __user *buf
size_tcount
loff_t *ppos
1468  as = needed for tty driver, and maybe others
1469  If check_apm_user(as, "read") Then Return -EIO
1471  If count < sizeof(apm_event_t) Then Return -EINVAL
1473  If queue_empty(as) && f_flags & O_NONBLOCK Then Return -EAGAIN
1475  wait_event_interruptible - sleep until a condition gets true*@wq_head: the waitqueue to wait on*@condition: a C expression for the event to wait for* The process is put to sleep (TASK_INTERRUPTIBLE) until the(apm_waitqueue, !queue_empty(as))
1476  i = count
1477  When i >= size of event && Not queue_empty(as) cycle
1478  event = get_queued_event(as)
1479  If copy_to_user(buf, & event, size of event ) Then
1480  If i < count Then Break
1482  Return -EFAULT
1485  Case event == APM_SYS_SUSPEND
1486  Case event == APM_USER_SUSPEND
1487  suspends_read++
1488  Break
1491  Case event == APM_USER_STANDBY
1492  standbys_read++
1493  Break
1495  buf += size of event
1496  i -= size of event
1498  If i < count Then Return count - i
1500  If signal_pending(current process) Then Return -These should never be seen by user programs. To return one of ERESTART** codes, signal_pending() MUST be set. Note that ptrace can observe these* at syscall exit tracing, but they will never be left for the debugged user* process to see.
1502  Return 0