user/lib/libc/src/file/fd/close.c
/**
 * Closes the given file descriptor.
 *
 * This thunks through directly to `fclose` instead of directly invoking the close function, as
 * the internal structures relating to the file need to be deallocated as well. That will handle
 * deallocating the fd mapping as well.
 */
Closes the given file descriptor.
This thunks through directly to `fclose` instead of directly invoking the close function, as
the internal structures relating to the file need to be deallocated as well. That will handle
deallocating the fd mapping as well.
Closes the given file descriptor . This thunks through directly to ` fclose ` instead of directly invoking the close function as the internal structures relating to the file need to be deallocated as well . That will handle deallocating the fd mapping as well .
int close(int filedes) {
    stream_t *fp = ConvertFdToStream(filedes);
    if(!fp) {
        errno = EBADF;
        return -1;
    }
    return fclose(fp);
}
int close ( int filedes ) { stream_t * fp = ConvertFdToStream ( filedes ) ; if ( ! fp ) { errno = EBADF ; return -1 ; } return fclose ( fp ) ; }
Closes the given file descriptor.
Closes the given file descriptor .
// get the file descriptor