/* * Careful here! We test whether the file pointer is NULL before * releasing the fd. This ensures that one clone task can't release * an fd while another clone is opening it. */ SYSCALL_DEFINE1(close, unsigned int, fd) { int retval = __close_fd(current->files, fd); /* can't restart close syscall because file table entry was cleared */ if (unlikely(retval == -ERESTARTSYS || retval == -ERESTARTNOINTR || retval == -ERESTARTNOHAND || retval == -ERESTART_RESTARTBLOCK)) retval = -EINTR; return retval; }
SYSCALL_DEFINE1(close, unsigned int, fd) { int retval; #ifdef CONFIG_HTC_FD_MONITOR if (in_fd_list(fd, 0) == 1) { printk("fd error: %s(%d) tries to close fd=%d illegally\n", current->comm, current->pid, fd); force_sig(SIGABRT, current); force_sig(SIGABRT, current); return 0xBADFD; } #endif retval = __close_fd(current->files, fd); if (unlikely(retval == -ERESTARTSYS || retval == -ERESTARTNOINTR || retval == -ERESTARTNOHAND || retval == -ERESTART_RESTARTBLOCK)) retval = -EINTR; return retval; }