mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Remove vfs.FileDescriptionOptions.InvalidWrite.
Compare: https://elixir.bootlin.com/linux/v5.6/source/fs/timerfd.c#L431 PiperOrigin-RevId: 310246908
This commit is contained in:
@@ -46,7 +46,10 @@ func TimerfdCreate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel
|
||||
default:
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
file, err := t.Kernel().VFS().NewTimerFD(clock, fileFlags)
|
||||
// Timerfds aren't writable per se (their implementation of Write just
|
||||
// returns EINVAL), but they are "opened for writing", which is necessary
|
||||
// to actually reach said implementation of Write.
|
||||
file, err := t.Kernel().VFS().NewTimerFD(clock, linux.O_RDWR|fileFlags)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
|
||||
@@ -91,10 +91,6 @@ type FileDescriptionOptions struct {
|
||||
// ESPIPE.
|
||||
DenyPWrite bool
|
||||
|
||||
// if InvalidWrite is true, calls to FileDescription.Write() return
|
||||
// EINVAL.
|
||||
InvalidWrite bool
|
||||
|
||||
// If UseDentryMetadata is true, calls to FileDescription methods that
|
||||
// interact with file and filesystem metadata (Stat, SetStat, StatFS,
|
||||
// Listxattr, Getxattr, Setxattr, Removexattr) are implemented by calling
|
||||
@@ -570,9 +566,6 @@ func (fd *FileDescription) PWrite(ctx context.Context, src usermem.IOSequence, o
|
||||
|
||||
// Write is similar to PWrite, but does not specify an offset.
|
||||
func (fd *FileDescription) Write(ctx context.Context, src usermem.IOSequence, opts WriteOptions) (int64, error) {
|
||||
if fd.opts.InvalidWrite {
|
||||
return 0, syserror.EINVAL
|
||||
}
|
||||
if !fd.writable {
|
||||
return 0, syserror.EBADF
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ func (vfs *VirtualFilesystem) NewTimerFD(clock ktime.Clock, flags uint32) (*File
|
||||
UseDentryMetadata: true,
|
||||
DenyPRead: true,
|
||||
DenyPWrite: true,
|
||||
InvalidWrite: true,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user