blob: 7d98a1e301fa1dfe19da08793476a16369e5778c [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersenc4996011999-10-20 22:08:37 +00002/*
3 * Mini sync implementation for busybox
4 *
Eric Andersenc4996011999-10-20 22:08:37 +00005 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02007 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Eric Andersenc4996011999-10-20 22:08:37 +00008 */
9
Manuel Novoa III cad53642003-03-19 09:13:01 +000010/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11
Pere Orga34425382011-03-31 14:43:25 +020012//usage:#define sync_trivial_usage
13//usage: ""
14//usage:#define sync_full_usage "\n\n"
15//usage: "Write all buffered blocks to disk"
16
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000017#include "libbb.h"
Eric Andersencc8ed391999-10-05 16:24:54 +000018
Denis Vlasenko99912ca2007-04-10 15:43:37 +000019/* This is a NOFORK applet. Be very careful! */
20
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000021int sync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denys Vlasenkobb16f572010-01-13 22:43:13 +010022int sync_main(int argc UNUSED_PARAM, char **argv IF_NOT_DESKTOP(UNUSED_PARAM))
Eric Andersencc8ed391999-10-05 16:24:54 +000023{
Denis Vlasenko68404f12008-03-17 09:00:54 +000024 /* coreutils-6.9 compat */
Denys Vlasenkoa355da02010-01-04 13:16:08 +010025 bb_warn_ignoring_args(argv[1]);
Manuel Novoa III cad53642003-03-19 09:13:01 +000026
Glenn L McGratha9c69762001-02-16 10:21:35 +000027 sync();
Manuel Novoa III cad53642003-03-19 09:13:01 +000028
Denis Vlasenko079f8af2006-11-27 16:49:31 +000029 return EXIT_SUCCESS;
Eric Andersencc8ed391999-10-05 16:24:54 +000030}