"why is the close function is called release in `struct file_operations` in the linux kernel?" Code Answer

5

because the file may be opened multiple times, when you close a descriptor, only on the last close call for the last reference to the file invokes release. so there is a difference between close and release.

release: called at the last close(2) of this file, i.e. when file->f_count reaches 0. although defined as returning int, the return value is ignored by vfs (see fs/file_table.c:__fput()). more

By MBillau on March 16 2022

Answers related to “why is the close function is called release in `struct file_operations` in the linux kernel?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.