I am facing one problem only with mv command not with cp command. I have a test program
Here i am opening a tmp file for writing. Then i am copying/moving for original file. Then i do a fflush, fsync(), ioctl() to the original file. Then i run this binary in linux machine(ext2 file system, 2.6.23.5 kernel) after that immediately power off the machine. Then power on machine, the file is disappeared or written data lost or file gets corrupted if i move the tmp file to the original file. And there is a no problem if i copy the tmp file to original file. So i want to know the difference between the cp and mv command. Can you please give me suggestion on it?
Thanks,
Indira
Moderator's Comments:
Moved post to its own thread - please no "threadjacking"; removed colour formatting; added code tags
/*
* one-way-pipe.c - example of using a pipe to communicate data between a
* process and its child process. The parent reads input
* from the user, and sends it to the child via a pipe.
* The child prints the received data to the... (1 Reply)
OK, I've used various versions of UNIX(Solaris, HPUX, etc..) over the years. Now the organization I work for is leaning towards more Linux based systems(Redhat, Suse, etc..)
I do see differences in in comands and how to accomplish basic adminstration, but nothing mind blowing.
So, what is it... (5 Replies)
Hello all
the su with -l option is running normal with linux but when i try to run it on unix AIX 5.2.7 it's not working with -l option
any help (6 Replies)
Moving from AIX 6.1 to RHEL 6.6, I have noticed a few command differences.
One that has been causing issue is a simple echo command when I have to use it this way -> "echo -e"
On the AIX it outputs to "-e" but since RHEL has "-e" as an option for echo and hence it outputs to blank here.
All... (3 Replies)
Discussion started by: aster007
3 Replies
LEARN ABOUT PLAN9
fflush
FFLUSH(3) Linux Programmer's Manual FFLUSH(3)NAME
fflush - flush a stream
SYNOPSIS
#include <stdio.h>
int fflush(FILE *stream);
DESCRIPTION
For output streams, fflush() forces a write of all user-space buffered data for the given output or update stream via the stream's underly-
ing write function.
For input streams associated with seekable files (e.g., disk files, but not pipes or terminals), fflush() discards any buffered data that
has been fetched from the underlying file, but has not been consumed by the application.
The open status of the stream is unaffected.
If the stream argument is NULL, fflush() flushes all open output streams.
For a nonlocking counterpart, see unlocked_stdio(3).
RETURN VALUE
Upon successful completion 0 is returned. Otherwise, EOF is returned and errno is set to indicate the error.
ERRORS
EBADF stream is not an open stream, or is not open for writing.
The function fflush() may also fail and set errno for any of the errors specified for write(2).
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+----------+---------------+---------+
|Interface | Attribute | Value |
+----------+---------------+---------+
|fflush() | Thread safety | MT-Safe |
+----------+---------------+---------+
CONFORMING TO
C89, C99, POSIX.1-2001, POSIX.1-2008.
POSIX.1-2001 did not specify the behavior for flushing of input streams, but the behavior is specified in POSIX.1-2008.
NOTES
Note that fflush() flushes only the user-space buffers provided by the C library. To ensure that the data is physically stored on disk the
kernel buffers must be flushed too, for example, with sync(2) or fsync(2).
SEE ALSO fsync(2), sync(2), write(2), fclose(3), fileno(3), fopen(3), setbuf(3), unlocked_stdio(3)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU 2017-09-15 FFLUSH(3)