Deleted Added
sdiff udiff text old ( 11793:ef606668d247 ) new ( 12076:d6fa15da87cd )
full compact
1/*
2 * Copyright (c) 2014-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

39
40#include "dev/virtio/fs9p.hh"
41
42#include <fcntl.h>
43#include <netdb.h>
44#include <netinet/in.h>
45#include <sys/socket.h>
46#include <sys/types.h>
47#include <unistd.h>
48
49#include "debug/VIO9P.hh"
50#include "debug/VIO9PData.hh"
51#include "params/VirtIO9PBase.hh"
52#include "params/VirtIO9PDiod.hh"
53#include "params/VirtIO9PProxy.hh"
54#include "params/VirtIO9PSocket.hh"
55#include "sim/system.hh"
56

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

329 const Params *p(dynamic_cast<const Params *>(params()));
330 int pipe_rfd[2];
331 int pipe_wfd[2];
332 const int DIOD_RFD = 3;
333 const int DIOD_WFD = 4;
334
335 const char *diod(p->diod.c_str());
336
337 if (pipe(pipe_rfd) == -1 || pipe(pipe_wfd) == -1)
338 panic("Failed to create DIOD pipes: %i\n", errno);
339
340 fd_to_diod = pipe_rfd[1];
341 fd_from_diod = pipe_wfd[0];
342
343 diod_pid = fork();
344 if (diod_pid == -1) {
345 panic("Fork failed: %i\n", errno);
346 } else if (diod_pid == 0) {
347 close(STDIN_FILENO);
348
349 if (dup2(pipe_rfd[0], DIOD_RFD) == -1 ||
350 dup2(pipe_wfd[1], DIOD_WFD) == -1) {
351
352 panic("Failed to setup read/write pipes: %i\n",
353 errno);
354 }
355
356 execlp(diod, diod,
357 "-f", // start in foreground
358 "-r", "3", // setup read FD
359 "-w", "4", // setup write FD
360 "-e", p->root.c_str(), // path to export
361 "-n", // disable security
362 "-S", // squash all users
363 (char *)NULL);
364 panic("Failed to execute diod: %i\n", errno);
365 } else {
366 close(pipe_rfd[0]);
367 close(pipe_wfd[1]);
368 }
369
370#undef DIOD_RFD
371#undef DIOD_WFD
372}

--- 125 unchanged lines hidden ---