@@ -17,7 +17,7 @@ use benchmark::{Benchmark, NamedTimer};
17
17
use cidr_utils:: cidr:: IpCidr ;
18
18
use colorful:: { Color , Colorful } ;
19
19
use futures:: executor:: block_on;
20
- use rlimit:: { getrlimit, setrlimit, Resource } ;
20
+ use rlimit:: { getrlimit, setrlimit, Resource , Rlim , RawRlim } ;
21
21
use std:: collections:: HashMap ;
22
22
use std:: fs:: File ;
23
23
use std:: io:: { prelude:: * , BufReader } ;
@@ -31,9 +31,9 @@ extern crate colorful;
31
31
extern crate dirs;
32
32
33
33
// Average value for Ubuntu
34
- const DEFAULT_FILE_DESCRIPTORS_LIMIT : rlimit :: rlim = 8000 ;
34
+ const DEFAULT_FILE_DESCRIPTORS_LIMIT : RawRlim = 8000 ;
35
35
// Safest batch size based on experimentation
36
- const AVERAGE_BATCH_SIZE : rlimit :: rlim = 3000 ;
36
+ const AVERAGE_BATCH_SIZE : RawRlim = 3000 ;
37
37
38
38
#[ macro_use]
39
39
extern crate log;
@@ -67,7 +67,7 @@ fn main() {
67
67
std:: process:: exit ( 1 ) ;
68
68
}
69
69
70
- let ulimit: rlimit :: rlim = adjust_ulimit_size ( & opts) ;
70
+ let ulimit: RawRlim = adjust_ulimit_size ( & opts) ;
71
71
let batch_size: u16 = infer_batch_size ( & opts, ulimit) ;
72
72
73
73
let scanner = Scanner :: new (
@@ -319,9 +319,9 @@ fn build_nmap_arguments<'a>(
319
319
arguments
320
320
}
321
321
322
- fn adjust_ulimit_size ( opts : & Opts ) -> rlimit :: rlim {
322
+ fn adjust_ulimit_size ( opts : & Opts ) -> RawRlim {
323
323
if opts. ulimit . is_some ( ) {
324
- let limit: rlimit :: rlim = opts. ulimit . unwrap ( ) ;
324
+ let limit: Rlim = Rlim :: from_raw ( opts. ulimit . unwrap ( ) ) ;
325
325
326
326
match setrlimit ( Resource :: NOFILE , limit, limit) {
327
327
Ok ( _) => {
@@ -343,11 +343,11 @@ fn adjust_ulimit_size(opts: &Opts) -> rlimit::rlim {
343
343
344
344
let ( rlim, _) = getrlimit ( Resource :: NOFILE ) . unwrap ( ) ;
345
345
346
- rlim
346
+ rlim. as_raw ( )
347
347
}
348
348
349
- fn infer_batch_size ( opts : & Opts , ulimit : rlimit :: rlim ) -> u16 {
350
- let mut batch_size: rlimit :: rlim = opts. batch_size . into ( ) ;
349
+ fn infer_batch_size ( opts : & Opts , ulimit : RawRlim ) -> u16 {
350
+ let mut batch_size: RawRlim = opts. batch_size . into ( ) ;
351
351
352
352
// Adjust the batch size when the ulimit value is lower than the desired batch size
353
353
if ulimit < batch_size {
0 commit comments