函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Allocate a new array of pipe buffers and copy the info over. Returns the* pipe size if successful, or return -ERROR on error.

函数原型:static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)

返回类型:long

参数:

类型参数名称
struct pipe_inode_info *pipe
unsigned longarg
1174  ret等于0
1176  size等于Currently we rely on the pipe array holding a power-of-2 number* of pages. Returns 0 on error.
1177  nr_slots等于size右移PAGE_SHIFT determines the page size
1179  如果非nr_slots则返回:负EINVAL
1189  如果nr_slots大于ring_sizesize大于The max size that a non-root user is allowed to grow the pipe. Can* be set by root in /proc/sys/fs/pipe-max-size且非操作权限检查则返回:负EPERM
1193  user_bufs等于account_pipe_buffers(user, ring_size, nr_slots)
1195  如果nr_slots大于ring_sizetoo_many_pipe_buffers_hard(user_bufs)或too_many_pipe_buffers_soft(user_bufs)的值且is_unprivileged_user()则
1199  ret等于负EPERM
1200  转到:out_revert_acct
1209  mask等于ring_size减1
1210  head等于head
1211  tail等于tail
1212  n等于pipe_occupancy - Return number of slots used in the pipe*@head: The pipe ring head pointer*@tail: The pipe ring tail pointer
1213  如果nr_slots小于n
1214  ret等于负EBUSY
1215  转到:out_revert_acct
1218  bufs等于分配数组内存并置零
1220  如果此条件成立可能性小(为编译器优化)(!bufs)则
1221  ret等于负ENOMEM
1222  转到:out_revert_acct
1229  如果n大于0则
1230  h等于head按位与mask
1231  t等于tail按位与mask
1232  如果h大于t
1233  memcpy(bufs, bufs + t, n * sizeof(structpipe_buffer))
1235  否则
1236  tsize等于ring_sizet
1237  如果h大于0则memcpy(bufs + tsize, bufs, h * sizeof(structpipe_buffer))
1240  memcpy(bufs, bufs + t, tsize * sizeof(structpipe_buffer))
1245  head等于n
1246  tail等于0
1248  释放内存
1249  bufs等于bufs
1250  ring_size等于nr_slots
1251  max_usage等于nr_slots
1252  tail等于tail
1253  head等于head
1254  wake_up_interruptible_all( & wait)
1255  返回:max_usagePAGE_SIZE
1257  out_revert_acct :
1258  account_pipe_buffers(user, nr_slots, ring_size)
1259  返回:ret
调用者
名称描述
pipe_fcntl