process.cc (11723:0596db108c53) process.cc (11785:6dc9ab9b2294)
1/*
2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
3 * Copyright (c) 2012 ARM Limited
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 322 unchanged lines hidden (view full) ---

331 fatal("Unable to see to location in %s", fde->filename);
332 };
333
334 std::map<string,int>::iterator it;
335
336 // Search through the input options and set fd if match is found;
337 // otherwise, open an input file and seek to location.
338 FDEntry *fde_stdin = getFDEntry(STDIN_FILENO);
1/*
2 * Copyright (c) 2014 Advanced Micro Devices, Inc.
3 * Copyright (c) 2012 ARM Limited
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 322 unchanged lines hidden (view full) ---

331 fatal("Unable to see to location in %s", fde->filename);
332 };
333
334 std::map<string,int>::iterator it;
335
336 // Search through the input options and set fd if match is found;
337 // otherwise, open an input file and seek to location.
338 FDEntry *fde_stdin = getFDEntry(STDIN_FILENO);
339
340 // Check if user has specified a different input file, and if so, use it
341 // instead of the file specified in the checkpoint. This also resets the
342 // file offset from the checkpointed value
343 string new_in = ((ProcessParams*)params())->input;
344 if (new_in != fde_stdin->filename) {
345 warn("Using new input file (%s) rather than checkpointed (%s)\n",
346 new_in, fde_stdin->filename);
347 fde_stdin->filename = new_in;
348 fde_stdin->fileOffset = 0;
349 }
350
339 if ((it = imap.find(fde_stdin->filename)) != imap.end()) {
340 fde_stdin->fd = it->second;
341 } else {
342 fde_stdin->fd = openInputFile(fde_stdin->filename);
343 seek(fde_stdin);
344 }
345
346 // Search through the output/error options and set fd if match is found;
347 // otherwise, open an output file and seek to location.
348 FDEntry *fde_stdout = getFDEntry(STDOUT_FILENO);
351 if ((it = imap.find(fde_stdin->filename)) != imap.end()) {
352 fde_stdin->fd = it->second;
353 } else {
354 fde_stdin->fd = openInputFile(fde_stdin->filename);
355 seek(fde_stdin);
356 }
357
358 // Search through the output/error options and set fd if match is found;
359 // otherwise, open an output file and seek to location.
360 FDEntry *fde_stdout = getFDEntry(STDOUT_FILENO);
361
362 // Check if user has specified a different output file, and if so, use it
363 // instead of the file specified in the checkpoint. This also resets the
364 // file offset from the checkpointed value
365 string new_out = ((ProcessParams*)params())->output;
366 if (new_out != fde_stdout->filename) {
367 warn("Using new output file (%s) rather than checkpointed (%s)\n",
368 new_out, fde_stdout->filename);
369 fde_stdout->filename = new_out;
370 fde_stdout->fileOffset = 0;
371 }
372
349 if ((it = oemap.find(fde_stdout->filename)) != oemap.end()) {
350 fde_stdout->fd = it->second;
351 } else {
352 fde_stdout->fd = openOutputFile(fde_stdout->filename);
353 seek(fde_stdout);
354 }
355
356 FDEntry *fde_stderr = getFDEntry(STDERR_FILENO);
373 if ((it = oemap.find(fde_stdout->filename)) != oemap.end()) {
374 fde_stdout->fd = it->second;
375 } else {
376 fde_stdout->fd = openOutputFile(fde_stdout->filename);
377 seek(fde_stdout);
378 }
379
380 FDEntry *fde_stderr = getFDEntry(STDERR_FILENO);
381
382 // Check if user has specified a different error file, and if so, use it
383 // instead of the file specified in the checkpoint. This also resets the
384 // file offset from the checkpointed value
385 string new_err = ((ProcessParams*)params())->errout;
386 if (new_err != fde_stderr->filename) {
387 warn("Using new error file (%s) rather than checkpointed (%s)\n",
388 new_err, fde_stderr->filename);
389 fde_stderr->filename = new_err;
390 fde_stderr->fileOffset = 0;
391 }
392
357 if (fde_stdout->filename == fde_stderr->filename) {
358 // Reuse the same file descriptor if these match.
359 fde_stderr->fd = fde_stdout->fd;
360 } else if ((it = oemap.find(fde_stderr->filename)) != oemap.end()) {
361 fde_stderr->fd = it->second;
362 } else {
363 fde_stderr->fd = openOutputFile(fde_stderr->filename);
364 seek(fde_stderr);

--- 371 unchanged lines hidden ---
393 if (fde_stdout->filename == fde_stderr->filename) {
394 // Reuse the same file descriptor if these match.
395 fde_stderr->fd = fde_stdout->fd;
396 } else if ((it = oemap.find(fde_stderr->filename)) != oemap.end()) {
397 fde_stderr->fd = it->second;
398 } else {
399 fde_stderr->fd = openOutputFile(fde_stderr->filename);
400 seek(fde_stderr);

--- 371 unchanged lines hidden ---