server: Store valid file options in pseudo file descriptors.

This commit is contained in:
Alexandre Julliard 2007-05-03 16:07:30 +02:00
parent 451616ee45
commit 017480d4e2
4 changed files with 7 additions and 5 deletions

View File

@ -1409,7 +1409,7 @@ static struct fd *alloc_fd_object(void)
} }
/* allocate a pseudo fd object, for objects that need to behave like files but don't have a unix fd */ /* allocate a pseudo fd object, for objects that need to behave like files but don't have a unix fd */
struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user ) struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user, unsigned int options )
{ {
struct fd *fd = alloc_object( &fd_ops ); struct fd *fd = alloc_object( &fd_ops );
@ -1420,6 +1420,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->inode = NULL; fd->inode = NULL;
fd->closed = NULL; fd->closed = NULL;
fd->access = 0; fd->access = 0;
fd->options = options;
fd->sharing = 0; fd->sharing = 0;
fd->unix_fd = -1; fd->unix_fd = -1;
fd->signaled = 0; fd->signaled = 0;

View File

@ -52,7 +52,8 @@ struct fd_ops
/* file descriptor functions */ /* file descriptor functions */
extern struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user ); extern struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user,
unsigned int options );
extern void set_no_fd_status( struct fd *fd, unsigned int status ); extern void set_no_fd_status( struct fd *fd, unsigned int status );
extern struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int access, extern struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int access,
unsigned int sharing, unsigned int options ); unsigned int sharing, unsigned int options );

View File

@ -359,7 +359,7 @@ void create_mailslot_device( struct directory *root, const struct unicode_str *n
get_error() != STATUS_OBJECT_NAME_EXISTS) get_error() != STATUS_OBJECT_NAME_EXISTS)
{ {
dev->mailslots = NULL; dev->mailslots = NULL;
if (!(dev->fd = alloc_pseudo_fd( &mailslot_device_fd_ops, &dev->obj )) || if (!(dev->fd = alloc_pseudo_fd( &mailslot_device_fd_ops, &dev->obj, 0 )) ||
!(dev->mailslots = create_namespace( 7 ))) !(dev->mailslots = create_namespace( 7 )))
{ {
release_object( dev ); release_object( dev );

View File

@ -480,7 +480,7 @@ void create_named_pipe_device( struct directory *root, const struct unicode_str
get_error() != STATUS_OBJECT_NAME_EXISTS) get_error() != STATUS_OBJECT_NAME_EXISTS)
{ {
dev->pipes = NULL; dev->pipes = NULL;
if (!(dev->fd = alloc_pseudo_fd( &named_pipe_device_fd_ops, &dev->obj )) || if (!(dev->fd = alloc_pseudo_fd( &named_pipe_device_fd_ops, &dev->obj, 0 )) ||
!(dev->pipes = create_namespace( 7 ))) !(dev->pipes = create_namespace( 7 )))
{ {
release_object( dev ); release_object( dev );
@ -709,7 +709,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
list_add_head( &pipe->servers, &server->entry ); list_add_head( &pipe->servers, &server->entry );
grab_object( pipe ); grab_object( pipe );
if (!(server->ioctl_fd = alloc_pseudo_fd( &pipe_server_fd_ops, &server->obj ))) if (!(server->ioctl_fd = alloc_pseudo_fd( &pipe_server_fd_ops, &server->obj, options )))
{ {
release_object( server ); release_object( server );
server = NULL; server = NULL;