< prev index next >

src/hotspot/os/aix/os_aix.cpp

Print this page
rev 55756 : 8228482: fix xlc16/xlclang comparison of distinct pointer types and string literal conversion warnings


4216   AixMisc::stackbounds_t bounds;
4217   bool rc = AixMisc::query_stack_bounds_for_current_thread(&bounds);
4218   guarantee(rc, "Unable to retrieve stack bounds.");
4219   // Align the returned stack size such that the stack low address
4220   // is aligned to page size (Note: base is usually not and we do not care).
4221   // We need to do this because caller code will assume stack low address is
4222   // page aligned and will place guard pages without checking.
4223   address low = bounds.base - bounds.size;
4224   address low_aligned = (address)align_up(low, os::vm_page_size());
4225   size_t s = bounds.base - low_aligned;
4226   return s;
4227 }
4228 
4229 extern char** environ;
4230 
4231 // Run the specified command in a separate process. Return its exit value,
4232 // or -1 on failure (e.g. can't fork a new process).
4233 // Unlike system(), this function can be called from signal handler. It
4234 // doesn't block SIGINT et al.
4235 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
4236   char * argv[4] = {"sh", "-c", cmd, NULL};
4237 
4238   pid_t pid = fork();
4239 
4240   if (pid < 0) {
4241     // fork failed
4242     return -1;
4243 
4244   } else if (pid == 0) {
4245     // child process
4246 
4247     // Try to be consistent with system(), which uses "/usr/bin/sh" on AIX.
4248     execve("/usr/bin/sh", argv, environ);
4249 
4250     // execve failed
4251     _exit(-1);
4252 
4253   } else {
4254     // copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
4255     // care about the actual exit code, for now.
4256 




4216   AixMisc::stackbounds_t bounds;
4217   bool rc = AixMisc::query_stack_bounds_for_current_thread(&bounds);
4218   guarantee(rc, "Unable to retrieve stack bounds.");
4219   // Align the returned stack size such that the stack low address
4220   // is aligned to page size (Note: base is usually not and we do not care).
4221   // We need to do this because caller code will assume stack low address is
4222   // page aligned and will place guard pages without checking.
4223   address low = bounds.base - bounds.size;
4224   address low_aligned = (address)align_up(low, os::vm_page_size());
4225   size_t s = bounds.base - low_aligned;
4226   return s;
4227 }
4228 
4229 extern char** environ;
4230 
4231 // Run the specified command in a separate process. Return its exit value,
4232 // or -1 on failure (e.g. can't fork a new process).
4233 // Unlike system(), this function can be called from signal handler. It
4234 // doesn't block SIGINT et al.
4235 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
4236   char* argv[4] = { (char*)"sh", (char*)"-c", cmd, NULL};
4237 
4238   pid_t pid = fork();
4239 
4240   if (pid < 0) {
4241     // fork failed
4242     return -1;
4243 
4244   } else if (pid == 0) {
4245     // child process
4246 
4247     // Try to be consistent with system(), which uses "/usr/bin/sh" on AIX.
4248     execve("/usr/bin/sh", argv, environ);
4249 
4250     // execve failed
4251     _exit(-1);
4252 
4253   } else {
4254     // copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
4255     // care about the actual exit code, for now.
4256 


< prev index next >