1 /* fallocate.c - Preallocate space to a file
3 * Copyright 2013 Felix Janda <felix.janda@posteo.de>
7 USE_FALLOCATE(NEWTOY(fallocate, ">1l#|", TOYFLAG_USR|TOYFLAG_BIN))
11 depends on TOYBOX_FALLOCATE
14 usage: fallocate [-l size] file
16 Tell the filesystem to allocate space for a file.
26 void fallocate_main(void)
28 int fd = xcreate(*toys.optargs, O_RDWR | O_CREAT, 0644);
29 if (posix_fallocate(fd, 0, TT.size)) error_exit("Not enough space");
30 if (CFG_TOYBOX_FREE) close(fd);