public override void SetLength(long value) { AssertNotDisposed(); if (value < 0) { throw new ArgumentOutOfRangeException("value", "< 0"); } if (!CanSeek && !CanWrite) { throw new NotSupportedException("You can't truncating the current file descriptor"); } int r; do { r = Native.Syscall.ftruncate(fileDescriptor, value); } while (UnixMarshal.ShouldRetrySyscall(r)); UnixMarshal.ThrowExceptionForLastErrorIf(r); }
public override void Close() { int num; if (this.fileDescriptor == -1) { return; } this.Flush(); if (!this.owner) { return; } do { num = Syscall.close(this.fileDescriptor); }while (UnixMarshal.ShouldRetrySyscall(num)); UnixMarshal.ThrowExceptionForLastErrorIf(num); this.fileDescriptor = -1; GC.SuppressFinalize(this); }
public override void Close() { if (fileDescriptor == InvalidFileDescriptor) { return; } Flush(); if (!owner) { return; } int r; do { r = Native.Syscall.close(fileDescriptor); } while (UnixMarshal.ShouldRetrySyscall(r)); UnixMarshal.ThrowExceptionForLastErrorIf(r); fileDescriptor = InvalidFileDescriptor; GC.SuppressFinalize(this); }