Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:do_fcntl

Proto:static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, struct file *filp)

Type:long

Parameter:

TypeParameterName
intfd
unsigned intcmd
unsigned longarg
struct file *filp
325  __user * argp = arg
327  err = -EINVAL
330  Case cmd == F_DUPFD
331  err = f_dupfd(arg, filp, 0)
332  Break
333  Case cmd == Create a file descriptor with FD_CLOEXEC set.
334  err = f_dupfd(arg, filp, O_CLOEXEC)
335  Break
336  Case cmd == F_GETFD
337  err = If get_close_on_exec(fd) Then FD_CLOEXEC Else 0
338  Break
339  Case cmd == F_SETFD
340  err = 0
341  set_close_on_exec(fd, arg & FD_CLOEXEC)
342  Break
343  Case cmd == F_GETFL
344  err = f_flags
345  Break
346  Case cmd == F_SETFL
347  err = setfl(fd, filp, arg)
348  Break
353  Case cmd == F_GETLK
354  If copy_from_user( & flock, argp, size of flock ) Then Return -EFAULT
356  err = fcntl_getlk(filp, cmd, & flock)
357  If Not err && copy_to_user(argp, & flock, size of flock ) Then Return -EFAULT
359  Break
366  Case cmd == F_SETLK
367  Case cmd == F_SETLKW
368  If copy_from_user( & flock, argp, size of flock ) Then Return -EFAULT
370  err = fcntl_setlk(fd, filp, cmd, & flock)
371  Break
372  Case cmd == F_GETOWN
380  err = f_getown(filp)
381  System call handlers that, upon successful completion, need to return a* negative value should call force_successful_syscall_return() right before* returning. On architectures where the syscall convention provides for a* separate error flag (e()
382  Break
383  Case cmd == F_SETOWN
384  err = f_setown(filp, arg, 1)
385  Break
386  Case cmd == F_GETOWN_EX
387  err = f_getown_ex(filp, arg)
388  Break
389  Case cmd == F_SETOWN_EX
390  err = f_setown_ex(filp, arg)
391  Break
392  Case cmd == F_GETOWNER_UIDS
393  err = f_getowner_uids(filp, arg)
394  Break
395  Case cmd == F_GETSIG
396  err = posix.1b rt signal to be delivered on IO
397  Break
398  Case cmd == F_SETSIG
401  Break
403  err = 0
404  posix.1b rt signal to be delivered on IO = arg
405  Break
406  Case cmd == F_GETLEASE
407  err = Enquire what lease is currently active
408  Break
409  Case cmd == F_SETLEASE
410  err = sets a lease on an open file
411  Break
412  Case cmd == Request nofications on a directory.* See below for events that may be notified.
413  err = When a process calls fcntl to attach a dnotify watch to a directory it ends* up here. Allocate both a mark for fsnotify to add and a dnotify_struct to be* attached to the fsnotify_mark.
414  Break
415  Case cmd == Set and get of pipe page size array
416  Case cmd == F_GETPIPE_SZ
417  err = pipe_fcntl(filp, cmd, arg)
418  Break
419  Case cmd == Set/Get seals
420  Case cmd == F_GET_SEALS
421  err = memfd_fcntl(filp, cmd, arg)
422  Break
423  Case cmd == Set/Get write life time hints. {GET,SET}_RW_HINT operate on the* underlying inode, while {GET,SET}_FILE_RW_HINT operate only on* the specific file.
424  Case cmd == F_SET_RW_HINT
425  Case cmd == F_GET_FILE_RW_HINT
426  Case cmd == F_SET_FILE_RW_HINT
427  err = fcntl_rw_hint(filp, cmd, arg)
428  Break
429  Default
430  Break
432  Return err
Caller
NameDescribe
SYSCALL_DEFINE3
SYSCALL_DEFINE3
do_compat_fcntl64