225 julong os::available_memory() { |
225 julong os::available_memory() { |
226 return Aix::available_memory(); |
226 return Aix::available_memory(); |
227 } |
227 } |
228 |
228 |
229 julong os::Aix::available_memory() { |
229 julong os::Aix::available_memory() { |
230 Unimplemented(); |
230 os::Aix::meminfo_t mi; |
231 return 0; |
231 if (os::Aix::get_meminfo(&mi)) { |
|
232 return mi.real_free; |
|
233 } else { |
|
234 return 0xFFFFFFFFFFFFFFFFLL; |
|
235 } |
232 } |
236 } |
233 |
237 |
234 julong os::physical_memory() { |
238 julong os::physical_memory() { |
235 return Aix::physical_memory(); |
239 return Aix::physical_memory(); |
236 } |
240 } |
5058 // Run the specified command in a separate process. Return its exit value, |
5062 // Run the specified command in a separate process. Return its exit value, |
5059 // or -1 on failure (e.g. can't fork a new process). |
5063 // or -1 on failure (e.g. can't fork a new process). |
5060 // Unlike system(), this function can be called from signal handler. It |
5064 // Unlike system(), this function can be called from signal handler. It |
5061 // doesn't block SIGINT et al. |
5065 // doesn't block SIGINT et al. |
5062 int os::fork_and_exec(char* cmd) { |
5066 int os::fork_and_exec(char* cmd) { |
5063 Unimplemented(); |
5067 char * argv[4] = {"sh", "-c", cmd, NULL}; |
5064 return 0; |
5068 |
|
5069 pid_t pid = fork(); |
|
5070 |
|
5071 if (pid < 0) { |
|
5072 // fork failed |
|
5073 return -1; |
|
5074 |
|
5075 } else if (pid == 0) { |
|
5076 // child process |
|
5077 |
|
5078 // try to be consistent with system(), which uses "/usr/bin/sh" on AIX |
|
5079 execve("/usr/bin/sh", argv, environ); |
|
5080 |
|
5081 // execve failed |
|
5082 _exit(-1); |
|
5083 |
|
5084 } else { |
|
5085 // copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't |
|
5086 // care about the actual exit code, for now. |
|
5087 |
|
5088 int status; |
|
5089 |
|
5090 // Wait for the child process to exit. This returns immediately if |
|
5091 // the child has already exited. */ |
|
5092 while (waitpid(pid, &status, 0) < 0) { |
|
5093 switch (errno) { |
|
5094 case ECHILD: return 0; |
|
5095 case EINTR: break; |
|
5096 default: return -1; |
|
5097 } |
|
5098 } |
|
5099 |
|
5100 if (WIFEXITED(status)) { |
|
5101 // The child exited normally; get its exit code. |
|
5102 return WEXITSTATUS(status); |
|
5103 } else if (WIFSIGNALED(status)) { |
|
5104 // The child exited because of a signal |
|
5105 // The best value to return is 0x80 + signal number, |
|
5106 // because that is what all Unix shells do, and because |
|
5107 // it allows callers to distinguish between process exit and |
|
5108 // process death by signal. |
|
5109 return 0x80 + WTERMSIG(status); |
|
5110 } else { |
|
5111 // Unknown exit code; pass it through |
|
5112 return status; |
|
5113 } |
|
5114 } |
|
5115 // Remove warning. |
|
5116 return -1; |
5065 } |
5117 } |
5066 |
5118 |
5067 // is_headless_jre() |
5119 // is_headless_jre() |
5068 // |
5120 // |
5069 // Test for the existence of xawt/libmawt.so or libawt_xawt.so |
5121 // Test for the existence of xawt/libmawt.so or libawt_xawt.so |