File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,6 +238,11 @@ pub enum ErrorKind {
238238 #[ unstable( feature = "io_error_inprogress" , issue = "130840" ) ]
239239 InProgress ,
240240
241+ /// The process or the whole system has reached its limit on the number of
242+ /// open files or sockets.
243+ #[ unstable( feature = "io_error_too_many_open_files" , issue = "158319" ) ]
244+ TooManyOpenFiles ,
245+
241246 // "Unusual" error kinds which do not correspond simply to (sets
242247 // of) OS error codes, should be added just above this comment.
243248 // `Other` and `Uncategorized` should remain at the end:
@@ -309,6 +314,7 @@ impl ErrorKind {
309314 StorageFull => "no storage space" ,
310315 TimedOut => "timed out" ,
311316 TooManyLinks => "too many links" ,
317+ TooManyOpenFiles => "too many open files" ,
312318 Uncategorized => "uncategorized error" ,
313319 UnexpectedEof => "unexpected end of file" ,
314320 Unsupported => "unsupported" ,
@@ -379,6 +385,7 @@ impl ErrorKind {
379385 Unsupported ,
380386 OutOfMemory ,
381387 InProgress ,
388+ TooManyOpenFiles ,
382389 Uncategorized ,
383390 } )
384391 }
Original file line number Diff line number Diff line change 355355#![ feature( int_from_ascii) ]
356356#![ feature( io_error_inprogress) ]
357357#![ feature( io_error_more) ]
358+ #![ feature( io_error_too_many_open_files) ]
358359#![ feature( io_error_uncategorized) ]
359360#![ feature( io_slice_as_bytes) ]
360361#![ feature( ip) ]
Original file line number Diff line number Diff line change @@ -612,7 +612,7 @@ fn map_fresult(fresult: vex_sdk::FRESULT) -> io::Result<()> {
612612 Err ( io:: const_error!( io:: ErrorKind :: OutOfMemory , "not enough memory for the operation" ) )
613613 }
614614 vex_sdk:: FRESULT :: FR_TOO_MANY_OPEN_FILES => Err ( io:: const_error!(
615- io:: ErrorKind :: Uncategorized ,
615+ io:: ErrorKind :: TooManyOpenFiles ,
616616 "maximum number of open files has been reached" ,
617617 ) ) ,
618618 vex_sdk:: FRESULT :: FR_INVALID_PARAMETER => {
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind {
137137 libc:: ETXTBSY => ExecutableFileBusy ,
138138 libc:: EXDEV => CrossesDevices ,
139139 libc:: EINPROGRESS => InProgress ,
140+ libc:: EMFILE | libc:: ENFILE => TooManyOpenFiles ,
140141 libc:: EOPNOTSUPP => Unsupported ,
141142
142143 libc:: EACCES | libc:: EPERM => PermissionDenied ,
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
5959 libc:: ETXTBSY => ExecutableFileBusy ,
6060 libc:: EXDEV => CrossesDevices ,
6161 libc:: EINPROGRESS => InProgress ,
62+ libc:: EMFILE | libc:: ENFILE => TooManyOpenFiles ,
6263 libc:: EOPNOTSUPP => Unsupported ,
6364 libc:: EACCES | libc:: EPERM => PermissionDenied ,
6465 libc:: EWOULDBLOCK => WouldBlock ,
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind {
6161 c:: ERROR_POSSIBLE_DEADLOCK => return Deadlock ,
6262 c:: ERROR_NOT_SAME_DEVICE => return CrossesDevices ,
6363 c:: ERROR_TOO_MANY_LINKS => return TooManyLinks ,
64+ c:: ERROR_TOO_MANY_OPEN_FILES => return TooManyOpenFiles ,
6465 c:: ERROR_FILENAME_EXCED_RANGE => return InvalidFilename ,
6566 c:: ERROR_CANT_RESOLVE_FILENAME => return FilesystemLoop ,
6667 _ => { }
@@ -81,6 +82,7 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind {
8182 c:: WSAENETDOWN => NetworkDown ,
8283 c:: WSAENETUNREACH => NetworkUnreachable ,
8384 c:: WSAEDQUOT => QuotaExceeded ,
85+ c:: WSAEMFILE => TooManyOpenFiles ,
8486 // Not a perfect mapping but this error is only returned when writing to
8587 // a socket after shutting down the write-end. On Unix targets, EPIPE is
8688 // returned in those cases.
You can’t perform that action at this time.
0 commit comments