system call

close (user-space)-> syscall expcetion

    syscall ( linux2.6.29.4archmipskernelscall32-o32.S)  --------->  sys_exit(unsigned int fd)

         SYSCALL_DEFINE1(close, unsigned int, fd) (linux2.6.29.4fsopen.c)  ---------> int filp_close(struct file *filp, fl_owner_t id)

                 retval = filp_close(filp, files);  --------->  void fput(struct file *file)

                         fput(filp);  ---------> void __fput(struct file *file)

                                     __fput(file);  --------->  int (*release) (struct inode *, struct file *);

                                             if (file->f_op && file->f_op->release) file->f_op->release(inode, file); 

                                                  

That is said, when a device file is closed, the release function that it implements will be called insensibly.

            

原文地址:https://www.cnblogs.com/lake-of-embedded-system/p/3492916.html