coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-06-26 11:32:39
Commit8f5291e336bf0d8c3a246d6102353ae025351496
Parente0fc3a5da1394796d0d96e6fb9ec1e589d68c46a

sync: Add sync utility

Diffstat

M CMakeLists.txt | 1 +
M README.md | 1 +
A man/sync.1 | 13 +++++++++++++
A src/sync.c | 22 ++++++++++++++++++++++

4 files changed, 37 insertions, 0 deletions

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d63b5c1..74f1971 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,7 @@ ADD_EXECUTABLE(mkdir    ${CMAKE_SOURCE_DIR}/src/mkdir.c)
 ADD_EXECUTABLE(pwd      ${CMAKE_SOURCE_DIR}/src/pwd.c)
 ADD_EXECUTABLE(rmdir    ${CMAKE_SOURCE_DIR}/src/rmdir.c)
 ADD_EXECUTABLE(sleep    ${CMAKE_SOURCE_DIR}/src/sleep.c)
+ADD_EXECUTABLE(sync     ${CMAKE_SOURCE_DIR}/src/sync.c)
 ADD_EXECUTABLE(tee      ${CMAKE_SOURCE_DIR}/src/tee.c)
 ADD_EXECUTABLE(true     ${CMAKE_SOURCE_DIR}/src/true.c)
 ADD_EXECUTABLE(unlink   ${CMAKE_SOURCE_DIR}/src/unlink.c)
diff --git a/README.md b/README.md
index 6c21bfd..c4779f2 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ UNIX-like systems.
 | pwd              | Print working directory                  | POSIX    |
 | rmdir            | Remove directories                       | POSIX    |
 | sleep            | Suspend execution for an interval        | POSIX    |
+| sync             | Synchronise file system caches to disk   |          |
 | tee              | Duplicate standard input                 | POSIX    |
 | true             | Return true value                        | POSIX    |
 | unlink           | Remove a file using the unlink function  | POSIX    |
diff --git a/man/sync.1 b/man/sync.1
new file mode 100644
index 0000000..a98265d
--- /dev/null
+++ b/man/sync.1
@@ -0,0 +1,13 @@
+.TH SYNC 1 2020-06-26 "OMKOV coreutils" "General Commands Manual"
+.SH NAME
+sync \(em synchronise file system caches to disk
+.SH SYNOPSYS
+.B sync
+.SH DESCRIPTION
+Schedule all cached writes to be written to disk.
+.SH COPYRIGHT
+.nf
+Copyright (C) 2020, Jakob Wakeling
+All rights reserved.
+OMKOV Public Domain Licence (https://www.omkov.net/OLPD)
+.fi
diff --git a/src/sync.c b/src/sync.c
new file mode 100644
index 0000000..10cee52
--- /dev/null
+++ b/src/sync.c
@@ -0,0 +1,22 @@
+// sync.c, version 1.0.0
+// OMKOV coreutils implementation of sync
+// Copyright (C) 2020, Jakob Wakeling
+// All rights reserved.
+
+/*
+OMKOV Public Domain Licence, version 1.0
+
+Permission is hereby granted to deal with this software and its associated
+documentation files without restriction.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
+HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+*/
+
+#include <unistd.h>
+
+int main(void) { sync(); return 0; }