A commit which is almost all trivial change.

- m_main: if --log-file-qualifier applies, do not add ".pid"
  at the end of the name

- Fix the logic which detected whether the just-devised name
  already existed.  This was broken (by me) because it could not
  distinguish the reasons for failing to open the logfile.

  Doing this required changing the return type of VG_(open)
  from Int to SysRes (to make failure reasons visible) and 
  that's the cause of most of the changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4228 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h
index 2f80ec9..aad9fa0 100644
--- a/include/pub_tool_libcfile.h
+++ b/include/pub_tool_libcfile.h
@@ -35,18 +35,18 @@
    File-related functions.
    ------------------------------------------------------------------ */
 
-extern Int  VG_(open)   ( const Char* pathname, Int flags, Int mode );
-extern void VG_(close)  ( Int fd );
-extern Int  VG_(read)   ( Int fd, void* buf, Int count);
-extern Int  VG_(write)  ( Int fd, const void* buf, Int count);
-extern Int  VG_(pipe)   ( Int fd[2] );
-extern OffT VG_(lseek)  ( Int fd, OffT offset, Int whence);
+extern SysRes VG_(open)   ( const Char* pathname, Int flags, Int mode );
+extern void   VG_(close)  ( Int fd );
+extern Int    VG_(read)   ( Int fd, void* buf, Int count);
+extern Int    VG_(write)  ( Int fd, const void* buf, Int count);
+extern Int    VG_(pipe)   ( Int fd[2] );
+extern OffT   VG_(lseek)  ( Int fd, OffT offset, Int whence);
 
-extern Int  VG_(stat)   ( Char* file_name, struct vki_stat* buf );
-extern Int  VG_(fstat)  ( Int   fd,        struct vki_stat* buf );
-extern Int  VG_(dup2)   ( Int oldfd, Int newfd );
-extern Int  VG_(rename) ( Char* old_name, Char* new_name );
-extern Int  VG_(unlink) ( Char* file_name );
+extern Int    VG_(stat)   ( Char* file_name, struct vki_stat* buf );
+extern Int    VG_(fstat)  ( Int   fd,        struct vki_stat* buf );
+extern Int    VG_(dup2)   ( Int oldfd, Int newfd );
+extern Int    VG_(rename) ( Char* old_name, Char* new_name );
+extern Int    VG_(unlink) ( Char* file_name );
 
 // Returns False on failure (eg. if the buffer isn't big enough).
 extern Bool VG_(getcwd) ( Char* buf, SizeT size );