File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,16 @@ import System
1111#endif
1212
1313func uringEnabled( ) throws -> Bool {
14- let procPath = FilePath ( " /proc/sys/kernel/io_uring_disabled " )
15- let fd = try FileDescriptor . open ( procPath, . readOnly)
16- let buffer = UnsafeMutableRawBufferPointer . allocate ( byteCount: 1024 , alignment: 0 )
17- _ = try fd. read ( into: buffer)
18- if buffer. load ( fromByteOffset: 0 , as: Int . self) == 0 {
19- return true
14+ do {
15+ let procPath = FilePath ( " /proc/sys/kernel/io_uring_disabled " )
16+ let fd = try FileDescriptor . open ( procPath, . readOnly)
17+ let buffer = UnsafeMutableRawBufferPointer . allocate ( byteCount: 1024 , alignment: 0 )
18+ _ = try fd. read ( into: buffer)
19+ if buffer. load ( fromByteOffset: 0 , as: Int . self) == 0 {
20+ return true
21+ }
22+ } catch ( _) {
23+ return false
2024 }
2125 return false
2226}
You can’t perform that action at this time.
0 commit comments