1/* See LICENSE file for copyright and license details. */
2#include <unistd.h>
3
4#include "arg.h"
5#include "util.h"
6
7// ?man sync: flush disk cache
8// ?man synopsis:
9// ?man The sync utility invokes sync(2) to flush all unwritten changes to disk.
10// This is usually done before shutting down, rebooting or halting. ?man ## SEE
11// ALSO ?man fsync(2), sync(2)
12
13static void
14usage(void)
15{
16 eprintf("usage: %s\n", argv0);
17}
18
19int
20main(int argc, char *argv[])
21{
22 ARGBEGIN
23 {
24 default:
25 usage();
26 }
27 ARGEND
28
29 if (argc)
30 usage();
31 sync();
32
33 return 0;
34}