271776 - s390x: Support STFLE instruction
+267020 - Make directory for temporary files configurable at run-time.
+
Release 3.6.1 (16 February 2011)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Int n, tries, fd;
UInt seed;
SysRes sres;
+ const HChar *tmpdir;
vg_assert(part_of_name);
n = VG_(strlen)(part_of_name);
seed = (VG_(getpid)() << 9) ^ VG_(getppid)();
+ /* Determine sensible location for temporary files */
+ tmpdir = VG_(getenv)("TMPDIR");
+ if (tmpdir == NULL || *tmpdir == '\0') tmpdir = VG_TMPDIR;
+ if (tmpdir == NULL || *tmpdir == '\0') tmpdir = "/tmp"; /* fallback */
+
tries = 0;
while (True) {
if (tries++ > 10)
return -1;
- VG_(sprintf)( buf, "%s/valgrind_%s_%08x",
- VG_TMPDIR, part_of_name, VG_(random)( &seed ));
+ VG_(sprintf)( buf, "%s/valgrind_%s_%08x",
+ tmpdir, part_of_name, VG_(random)( &seed ));
if (0)
VG_(printf)("VG_(mkstemp): trying: %s\n", buf);
}
__attribute__((noreturn))
-void VG_(err_config_error) ( Char* msg )
+void VG_(err_config_error) ( Char* format, ... )
{
+ va_list vargs;
+ va_start(vargs,format);
revert_to_stderr();
- VG_(fmsg)("Startup or configuration error:\n %s\n", msg);
- VG_(fmsg)("Unable to start up properly. Giving up.\n");
+ VG_(message) (Vg_FailMsg, "Startup or configuration error:\n ");
+ VG_(vmessage)(Vg_FailMsg, format, vargs );
+ VG_(message) (Vg_FailMsg, "Unable to start up properly. Giving up.\n");
VG_(exit)(1);
+ va_end(vargs);
}
/* Check for sane path in ./configure --prefix=... */
if (VG_LIBDIR[0] != '/')
VG_(err_config_error)("Please use absolute paths in "
- "./configure --prefix=... or --libdir=...");
+ "./configure --prefix=... or --libdir=...\n");
vg_assert( VG_(args_for_valgrind) );
{ Bool ok = VG_(record_startup_wd)();
if (!ok)
VG_(err_config_error)( "Can't establish current working "
- "directory at startup");
+ "directory at startup\n");
}
{ Char buf[VKI_PATH_MAX+1];
Bool ok = VG_(get_startup_wd)( buf, sizeof(buf) );
VG_(sprintf)(buf, "proc_%d_cmdline", VG_(getpid)());
fd = VG_(mkstemp)( buf, buf2 );
if (fd == -1)
- VG_(err_config_error)("Can't create client cmdline file in " VG_TMPDIR);
+ VG_(err_config_error)("Can't create client cmdline file in %s\n", buf2);
nul[0] = 0;
exename = VG_(args_the_exename) ? VG_(args_the_exename)
/* Now delete it, but hang on to the fd. */
r = VG_(unlink)( buf2 );
if (r)
- VG_(err_config_error)("Can't delete client cmdline file in " VG_TMPDIR);
+ VG_(err_config_error)("Can't delete client cmdline file in %s\n", buf2);
VG_(cl_cmdline_fd) = fd;
}
/* Similarly - complain and stop if there is some kind of config
error. */
__attribute__((noreturn))
-extern void VG_(err_config_error) ( Char* msg );
+extern void VG_(err_config_error) ( Char* format, ... );
#endif // __PUB_CORE_LIBCPRINT_H