source: MondoRescue/branches/2.2.9/mindi-busybox/util-linux/freeramdisk.c@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 900 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * freeramdisk and fdflush implementations for busybox
4 *
5 * Copyright (C) 2000 and written by Emanuele Caratti <wiz@iol.it>
6 * Adjusted a bit by Erik Andersen <andersen@codepoet.org>
7 * Unified with fdflush by Tito Ragusa <farmatito@tiscali.it>
8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */
11#include <sys/mount.h>
12#include "libbb.h"
13
14/* From <linux/fd.h> */
15#define FDFLUSH _IO(2,0x4b)
16
17int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int freeramdisk_main(int argc UNUSED_PARAM, char **argv)
19{
20 int fd;
21
22 fd = xopen(single_argv(argv), O_RDWR);
23
24 // Act like freeramdisk, fdflush, or both depending on configuration.
25 ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1] == 'r')
26 || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]);
27
28 if (ENABLE_FEATURE_CLEAN_UP) close(fd);
29
30 return EXIT_SUCCESS;
31}
Note: See TracBrowser for help on using the repository browser.