linux.cc (11907:48a3d32da9d8) linux.cc (12591:48dfacae20ba)
1/*
2 * Copyright (c) 2009 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

50 std::string data;
51
52 if (path.compare(0, 13, "/proc/meminfo") == 0) {
53 data = Linux::procMeminfo(process, tc);
54 matched = true;
55 } else if (path.compare(0, 11, "/etc/passwd") == 0) {
56 data = Linux::etcPasswd(process, tc);
57 matched = true;
1/*
2 * Copyright (c) 2009 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

50 std::string data;
51
52 if (path.compare(0, 13, "/proc/meminfo") == 0) {
53 data = Linux::procMeminfo(process, tc);
54 matched = true;
55 } else if (path.compare(0, 11, "/etc/passwd") == 0) {
56 data = Linux::etcPasswd(process, tc);
57 matched = true;
58 } else if (path.compare(0, 30, "/sys/devices/system/cpu/online") == 0) {
59 data = Linux::cpuOnline(process, tc);
60 matched = true;
58 }
59
60 if (matched) {
61 FILE *f = tmpfile();
62 int fd = fileno(f);
63 size_t ret M5_VAR_USED = fwrite(data.c_str(), 1, data.size(), f);
64 assert(ret == data.size());
65 rewind(f);

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

82}
83
84std::string
85Linux::etcPasswd(Process *process, ThreadContext *tc)
86{
87 return csprintf("gem5-user:x:1000:1000:gem5-user,,,:%s:/bin/bash\n",
88 process->getcwd());
89}
61 }
62
63 if (matched) {
64 FILE *f = tmpfile();
65 int fd = fileno(f);
66 size_t ret M5_VAR_USED = fwrite(data.c_str(), 1, data.size(), f);
67 assert(ret == data.size());
68 rewind(f);

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

85}
86
87std::string
88Linux::etcPasswd(Process *process, ThreadContext *tc)
89{
90 return csprintf("gem5-user:x:1000:1000:gem5-user,,,:%s:/bin/bash\n",
91 process->getcwd());
92}
93
94std::string
95Linux::cpuOnline(Process *process, ThreadContext *tc)
96{
97 return csprintf("0-%d\n",
98 tc->getSystemPtr()->numContexts() - 1);
99}