函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:pipe_write

函数原型:static ssize_t pipe_write(struct kiocb *iocb, struct iov_iter *from)

返回类型:ssize_t

参数:

类型参数名称
struct kiocb *iocb
struct iov_iter *from
433  filp等于文件指针
434  pipe等于 needed for tty driver, and maybe others
436  ret等于0
437  total_len等于iov_iter_count(from)
439  bool was_empty = false
442  如果此条件成立可能性小(为编译器优化)(total_len == 0)则返回:0
445  __pipe_lock(pipe)
447  如果非readers
448  send_sig(SIGPIPE, 当前进程, 0)
449  ret等于负EPIPE
450  转到:out
464  head等于head
465  was_empty等于pipe_empty - Return true if the pipe is empty*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer
466  chars等于total_len按位与PAGE_SIZE减1
467  如果chars且非was_empty
468  mask等于ring_size减1
469  buf等于bufs[(head - 1) & mask]
470  offset等于offsetlen
472  如果pipe_buf_can_merge(buf)且offsetchars小于等于PAGE_SIZE
474  如果ret则转到:out
479  ret等于负EFAULT
480  转到:out
483  len加等于ret
484  如果非iov_iter_count(from)则转到:out
489  循环
490  如果非readers
492  如果非retret等于负EPIPE
494  退出
497  head等于head
499  mask等于ring_size减1
500  buf等于bufs[head & mask]
501  page等于tmp_page
504  如果非page
507  ret等于如果ret否则负ENOMEM
508  退出
510  tmp_page等于page
518  spin_lock_irq( & lock)
520  head等于head
522  spin_unlock_irq( & lock)
523  继续下一循环
526  head等于head加1
527  spin_unlock_irq( & lock)
530  buf等于bufs[head & mask]
531  page等于page
533  offset等于0
534  len等于0
535  flags等于0
536  如果is_packetized(filp)则
540  tmp_page = NULL
544  如果非retret等于负EFAULT
546  退出
548  ret加等于copied
549  offset等于0
550  len等于copied
552  如果非iov_iter_count(from)则退出
556  如果非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.则继续下一循环
560  如果f_flags按位与O_NONBLOCK
561  如果非retret等于负EAGAIN
563  退出
565  如果signal_pending(当前进程)则
568  退出
577  __pipe_unlock(pipe)
578  如果was_empty
582  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() )
583  __pipe_lock(pipe)
584  was_empty等于pipe_empty - Return true if the pipe is empty*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer
586  out :
587  __pipe_unlock(pipe)
598  如果was_empty
599  wake_up_interruptible_sync_poll( & wait, Epoll event masks | EPOLLRDNORM)
600  an be called from interrupts
602  如果ret大于0且sb_start_write_trylock(i_sb)则
603  err等于file_update_time(filp)
604  如果errret等于err
606  超级块解除写访问
608  返回:ret