Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\pipe.c Create Date:2022-07-28 20:04:28
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:pipe_read

Proto:static ssize_t pipe_read(struct kiocb *iocb, struct iov_iter *to)

Type:ssize_t

Parameter:

TypeParameterName
struct kiocb *iocb
struct iov_iter *to
286  total_len = iov_iter_count(to)
287  filp = ki_filp
288  pipe = needed for tty driver, and maybe others
293  If Value for the false possibility is greater at compile time(total_len == 0) Then Return 0
296  ret = 0
297  __pipe_lock(pipe)
307  was_full = pipe_full - Return true if the pipe is full*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer*@limit: The maximum amount of slots available.
308  cycle
309  head = head
310  tail = tail
311  mask = ring_size - 1
314  buf = bufs[tail & mask]
315  chars = len
319  If chars > total_len Then chars = total_len
323  If error Then
324  If Not ret Then ret = error
326  Break
331  If Not ret Then ret = -EFAULT
333  Break
335  ret += chars
336  offset += chars
337  len -= chars
340  If flags & ad() as a packet Then
341  total_len = chars
342  len = 0
345  If Not len Then
352  total_len -= chars
353  If Not total_len Then Break
359  If Not writers Then Break
361  If ret Then Break
363  If f_flags & O_NONBLOCK Then
364  ret = -EAGAIN
365  Break
367  __pipe_unlock(pipe)
397  If 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(wait, Done while waiting without holding the pipe lock - thus the READ_ONCE() ) < 0 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.
400  __pipe_lock(pipe)
401  was_full = pipe_full - Return true if the pipe is full*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer*@limit: The maximum amount of slots available.
403  __pipe_unlock(pipe)
405  If was_full Then
406  wake_up_interruptible_sync_poll( & wait, EPOLLOUT | EPOLLWRNORM)
407  an be called from interrupts
409  If ret > 0 Then file_accessed(filp)
411  Return ret