Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\open.c Create Date:2022-07-28 20:00:52
Last Modify:2020-03-18 10:16:03 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:do_sys_ftruncate

Proto:long do_sys_ftruncate(unsigned int fd, loff_t length, int small)

Type:long

Parameter:

TypeParameterName
unsigned intfd
loff_tlength
intsmall
162  error = -EINVAL
163  If length < 0 Then Go to out
165  error = -EBADF
166  f = fdget(fd)
167  If Not file Then Go to out
171  If f_flags & O_LARGEFILE Then small = 0
174  dentry = dentry
175  inode = Where the name belongs to - NULL is * negative
176  error = -EINVAL
177  If Not S_ISREG(i_mode) || Not (f_mode & le is open for writing ) Then Go to out_putf
180  error = -EINVAL
182  If small && length > MAX_NON_LFS Then Go to out_putf
185  error = -EPERM
187  If IS_APPEND(file_inode(file)) Then Go to out_putf
190  sb_start_write - get write access to a superblock*@sb: the super we write to* When a process wants to write data or metadata to a file system (i.e. dirty* a page or an inode), it should embed the operation in a sb_start_write() -
191  error = locks_verify_truncate(inode, file, length)
192  If Not error Then error = security_path_truncate( & f_path)
194  If Not error Then error = do_truncate(dentry, length, ATTR_MTIME | ATTR_CTIME, file)
196  sb_end_write - drop write access to a superblock*@sb: the super we wrote to* Decrement number of writers to the filesystem. Wake up possible waiters* wanting to freeze the filesystem.
197  out_putf :
198  fdput(f)
199  out :
200  Return error
Caller
NameDescribe
SYSCALL_DEFINE2
COMPAT_SYSCALL_DEFINE2
SYSCALL_DEFINE2
ksys_ftruncate