NetBSD-Docs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: filedesc(9) rewrite, please review
Date: Mon, 15 Oct 2018 16:05:34 +0000
From: coypu%sdf.org@localhost
Message-ID: <20181015160534.GA15839%SDF.ORG@localhost>
| attached is the generated output of a filedesc(9) rewrite.
Did I miss something sometime, is there a real need for this?
| FUNCTIONS
| The following functions are high-level interface routines to access the
| file descriptor table for a process and its file entries.
|
| fd_alloc(p, want, *result)
| Create a new open file entry and allocate a file descriptor for
| the process p. This operation is performed by invoking
| fd_alloc() to allocate the new file descriptor.
fd_alloc() uses fd_alloc() ?
In the existing version, falloc() used fdalloc() - have two functions been
merged into one? If so, that sentence should be deleted. Otherwise
something needs a new name.
| The caller to
| the fd_alloc() function is responsible for expanding the file
| descriptor table when necessary.
That's ugly. Why? Cannot it be passed a pointer to the tabe,
and realloc for itself when needed?
| The index of the file entry is returned in *result. The
| fd_alloc() function returns zero on success, otherwise an
| appropriate error is returned.
And what is "want" ?
| fd_alloc(p, want, *result)
| Allocate a file descriptor want for process p. The resultant
| file descriptor is returned in *result. The fd_alloc() function
| returns zero on success, otherwise an appropriate error is
| returned.
fd_alloc() again, same params, but now want is explained.
| fd_closeexec(void)
| Close any files for the current process that are marked close
| on exec. This operation is performed by invoking fd_close() on
| the appropriate file descriptor.
descriptors
| fd_tryexpand(p)
| Expand the file descriptor table for process p by allocating
| memory for additional file descriptors.
Why "try" ?
| fd_free(void)
| Decrement the reference count on the file descriptor table for
| the current lwp and release the file descriptor table if the
| reference count drops to zero.
Impact upon any open files in the table ?
| fd_init(fdp)
| Create a file descriptor table using the same current and root
| directories of the current process. The returned file
| descriptor table is guaranteed to have a reference count of one.
What is fdp?
And I think something needs to explain why directories are there.
kre
Home |
Main Index |
Thread Index |
Old Index