Re: [PATCH] please review. file descriptor passing for libc_r.

From: Alfred Perlstein <bright_at_mu.org>
Date: Sat, 29 Nov 2003 13:12:51 -0800
* Alfred Perlstein <bright_at_mu.org> [031129 12:21] wrote:
> 
> Descriptor's passed can't be closed because the uthread kernel does this:

The weird part is that i'm doing a sendfile(2) using the descriptors
and it appears that sendfile does the FD_LOCK thing on the descriptors
so... ?


> 
> int
> _close(int fd)
> {
>         int             flags;
>         int             ret;
>         struct stat     sb;
>         struct fd_table_entry   *entry;
> 
>         if ((fd < 0) || (fd >= _thread_dtablesize) ||
>             (fd == _thread_kern_pipe[0]) || (fd == _thread_kern_pipe[1]) ||
>             (_thread_fd_table[fd] == NULL)) {
>                 /*
>                  * Don't allow silly programs to close the kernel pipe
>                  * and non-active descriptors.
>                  */
>                 errno = EBADF;
>                 ret = -1;
>         }
> ...
> 
> So basically, if the entry is not initialized we can't close descriptors.
> 
> What do you suggest we do?
> 
> -- 
> - Alfred Perlstein
> - Research Engineering Development Inc.
> - email: bright_at_mu.org cell: 408-480-4684

-- 
- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright_at_mu.org cell: 408-480-4684
Received on Sat Nov 29 2003 - 12:12:52 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:31 UTC