Mercurial > hg > toybox
comparison toys/mkswap.c @ 535:d51be130fda2
More stabs at getting #includes right, and moving off of deprecated functions.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 08 Mar 2012 20:14:55 -0600 |
parents | e1b9a8579ddb |
children |
comparison
equal
deleted
inserted
replaced
534:a864aa8c6331 | 535:d51be130fda2 |
---|---|
19 | 19 |
20 #include "toys.h" | 20 #include "toys.h" |
21 | 21 |
22 void mkswap_main(void) | 22 void mkswap_main(void) |
23 { | 23 { |
24 int fd = xopen(*toys.optargs, O_RDWR), pagesize = getpagesize(); | 24 int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE); |
25 off_t len = fdlength(fd); | 25 off_t len = fdlength(fd); |
26 unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf; | 26 unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf; |
27 | 27 |
28 // Write header. Note that older kernel versions checked signature | 28 // Write header. Note that older kernel versions checked signature |
29 // on disk (not in cache) during swapon, so sync after writing. | 29 // on disk (not in cache) during swapon, so sync after writing. |