file: make sys_open() allocate the file structure
Currently sys_open() receives an uninitialized file structure from its
callers, which is awkward as the callers must handle opening a file in
two steps. It also doesn't fit well with C++'s notion of an object being
always fully initialized and valid.
Fix by making sys_open() allocate and return the file structure. This also
fixes a window in open() where an fd would point to an uninitialized file
(between fdalloc() and sys_open()).
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
Showing
- bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c 1 addition, 7 deletions...ys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
- fs/vfs/main.cc 7 additions, 14 deletionsfs/vfs/main.cc
- fs/vfs/vfs.h 1 addition, 1 deletionfs/vfs/vfs.h
- fs/vfs/vfs_syscalls.cc 12 additions, 9 deletionsfs/vfs/vfs_syscalls.cc
Loading
Please register or sign in to comment