[PATCH] please review. file descriptor passing for libc_r.
Alfred Perlstein
bright at mu.org
Sat Nov 29 13:12:52 PST 2003
* 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
More information about the freebsd-current
mailing list