186 |
case 'K': |
case 'K': |
187 |
size <<= 10; |
size <<= 10; |
188 |
break; |
break; |
189 |
|
case '%': |
190 |
|
{ |
191 |
|
/* Set as a percentage of the machine's physical memory. */ |
192 |
|
struct vm_statistics vmstats; |
193 |
|
error_t err = vm_statistics (mach_task_self (), &vmstats); |
194 |
|
if (err) |
195 |
|
{ |
196 |
|
argp_error (state, "cannot find total physical memory: %s", |
197 |
|
strerror (err)); |
198 |
|
return err; |
199 |
|
} |
200 |
|
size = round_page ((((vmstats.free_count |
201 |
|
+ vmstats.active_count |
202 |
|
+ vmstats.inactive_count |
203 |
|
+ vmstats.wire_count) |
204 |
|
* vm_page_size) |
205 |
|
* size + 99) / 100); |
206 |
|
break; |
207 |
|
} |
208 |
} |
} |
209 |
size = (off_t) size; |
size = (off_t) size; |
210 |
if (size < 0) |
if (size < 0) |