Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/util-linux/freeramdisk.c
- Timestamp:
- Nov 4, 2007, 3:16:40 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.5/mindi-busybox/util-linux/freeramdisk.c
r821 r1765 7 7 * Unified with fdflush by Tito Ragusa <farmatito@tiscali.it> 8 8 * 9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.9 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 10 */ 11 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" 12 #include "libbb.h" 20 13 21 14 /* From <linux/fd.h> */ 22 15 #define FDFLUSH _IO(2,0x4b) 23 16 17 int freeramdisk_main(int argc, char **argv); 24 18 int freeramdisk_main(int argc, char **argv) 25 19 { 26 int result;27 20 int fd; 28 21 29 22 if (argc != 2) bb_show_usage(); 30 23 31 fd = bb_xopen(argv[1], O_RDWR);24 fd = xopen(argv[1], O_RDWR); 32 25 33 26 // 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 );27 ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1]=='r') 28 || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]); 36 29 37 30 if (ENABLE_FEATURE_CLEAN_UP) close(fd); 38 31 39 if (result) bb_perror_msg_and_die("%s", argv[1]);40 32 return EXIT_SUCCESS; 41 33 }
Note:
See TracChangeset
for help on using the changeset viewer.