comparison src/hotspot/os/posix/os_posix.cpp @ 53553:f7f90fddce02

8211326: add OS user related information to hs_err file Reviewed-by: dholmes, stuefe
author mbaesken
date Thu, 15 Nov 2018 17:08:59 +0100
parents 7ac0ac1e57b6
children 33b8f6f4cdf5
comparison
equal deleted inserted replaced
17:cb8a15206529 18:56201bb7bee4
35 #include "utilities/macros.hpp" 35 #include "utilities/macros.hpp"
36 #include "utilities/vmError.hpp" 36 #include "utilities/vmError.hpp"
37 37
38 #include <dirent.h> 38 #include <dirent.h>
39 #include <dlfcn.h> 39 #include <dlfcn.h>
40 #include <grp.h>
41 #include <pwd.h>
40 #include <pthread.h> 42 #include <pthread.h>
41 #include <signal.h> 43 #include <signal.h>
42 #include <sys/mman.h> 44 #include <sys/mman.h>
43 #include <sys/resource.h> 45 #include <sys/resource.h>
44 #include <sys/utsname.h> 46 #include <sys/utsname.h>
438 st->print("%s ", name.release); 440 st->print("%s ", name.release);
439 st->print("%s ", name.version); 441 st->print("%s ", name.version);
440 st->print("%s", name.machine); 442 st->print("%s", name.machine);
441 st->cr(); 443 st->cr();
442 } 444 }
445
446 void os::Posix::print_umask(outputStream* st, mode_t umsk) {
447 st->print((umsk & S_IRUSR) ? "r" : "-");
448 st->print((umsk & S_IWUSR) ? "w" : "-");
449 st->print((umsk & S_IXUSR) ? "x" : "-");
450 st->print((umsk & S_IRGRP) ? "r" : "-");
451 st->print((umsk & S_IWGRP) ? "w" : "-");
452 st->print((umsk & S_IXGRP) ? "x" : "-");
453 st->print((umsk & S_IROTH) ? "r" : "-");
454 st->print((umsk & S_IWOTH) ? "w" : "-");
455 st->print((umsk & S_IXOTH) ? "x" : "-");
456 }
457
458 void os::Posix::print_user_info(outputStream* st) {
459 unsigned id = (unsigned) ::getuid();
460 st->print("uid : %u ", id);
461 id = (unsigned) ::geteuid();
462 st->print("euid : %u ", id);
463 id = (unsigned) ::getgid();
464 st->print("gid : %u ", id);
465 id = (unsigned) ::getegid();
466 st->print_cr("egid : %u", id);
467 st->cr();
468
469 mode_t umsk = ::umask(0);
470 ::umask(umsk);
471 st->print("umask: %04o (", (unsigned) umsk);
472 print_umask(st, umsk);
473 st->print_cr(")");
474 st->cr();
475 }
476
443 477
444 bool os::get_host_name(char* buf, size_t buflen) { 478 bool os::get_host_name(char* buf, size_t buflen) {
445 struct utsname name; 479 struct utsname name;
446 uname(&name); 480 uname(&name);
447 jio_snprintf(buf, buflen, "%s", name.nodename); 481 jio_snprintf(buf, buflen, "%s", name.nodename);