Last change
on this file since 1087 was 821, checked in by Bruno Cornec, 18 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
1021 bytes
|
Rev | Line | |
---|
[821] | 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 or later, see file LICENSE in this tarball for details.
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #include <stdio.h>
|
---|
| 13 | #include <string.h>
|
---|
| 14 | #include <sys/types.h>
|
---|
| 15 | #include <fcntl.h>
|
---|
| 16 | #include <sys/ioctl.h>
|
---|
| 17 | #include <stdlib.h>
|
---|
| 18 | #include <unistd.h>
|
---|
| 19 | #include "busybox.h"
|
---|
| 20 |
|
---|
| 21 | /* From <linux/fd.h> */
|
---|
| 22 | #define FDFLUSH _IO(2,0x4b)
|
---|
| 23 |
|
---|
| 24 | int freeramdisk_main(int argc, char **argv)
|
---|
| 25 | {
|
---|
| 26 | int result;
|
---|
| 27 | int fd;
|
---|
| 28 |
|
---|
| 29 | if (argc != 2) bb_show_usage();
|
---|
| 30 |
|
---|
| 31 | fd = bb_xopen(argv[1], O_RDWR);
|
---|
| 32 |
|
---|
| 33 | // Act like freeramdisk, fdflush, or both depending on configuration.
|
---|
| 34 | result = ioctl(fd, (ENABLE_FREERAMDISK && bb_applet_name[1]=='r')
|
---|
| 35 | || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH);
|
---|
| 36 |
|
---|
| 37 | if (ENABLE_FEATURE_CLEAN_UP) close(fd);
|
---|
| 38 |
|
---|
| 39 | if (result) bb_perror_msg_and_die("%s", argv[1]);
|
---|
| 40 | return EXIT_SUCCESS;
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.