~ubuntu-branches/ubuntu/wily/trafficserver/wily

« back to all changes in this revision

Viewing changes to lib/ts/ink_cap.cc

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-17 22:28:16 UTC
  • mfrom: (5.1.8 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121217222816-7xwjsx5k76zkb63d
Tags: 3.2.0-1ubuntu1
* Revert FreeBSD strerror_r() fixes that give errors with glibc 2.16.
* Apply patch from Konstantinos Margaritis to define barriers on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
      char* caps_text = cap_to_text(caps, 0);
39
39
#   endif
40
40
 
41
 
    Debug(tag,
42
 
      "uid=%u, gid=%u, euid=%u, egid=%u"
43
 
#     if TS_USE_POSIX_CAP
44
 
        ", caps %s thread 0x%x"
45
 
#     endif
46
 
      ,static_cast<unsigned int>(getuid())
47
 
      ,static_cast<unsigned int>(getgid())
48
 
      ,static_cast<unsigned int>(geteuid())
49
 
      ,static_cast<unsigned int>(getegid())
50
 
#     if TS_USE_POSIX_CAP
51
 
        ,caps_text
52
 
        ,pthread_self()
53
 
#     endif
54
 
    );
55
 
 
56
 
#   if TS_USE_POSIX_CAP
57
 
      cap_free(caps_text);
58
 
      cap_free(caps);
59
 
#   endif
 
41
#     if TS_USE_POSIX_CAP
 
42
    Debug(tag, "uid=%u, gid=%u, euid=%u, egid=%u, caps %s core=%s thread=0x%llx",
 
43
          static_cast<unsigned int>(getuid()),
 
44
          static_cast<unsigned int>(getgid()),
 
45
          static_cast<unsigned int>(geteuid()),
 
46
          static_cast<unsigned int>(getegid()),
 
47
          caps_text,
 
48
          prctl(PR_GET_DUMPABLE) != 1 ? "disabled" : "enabled",
 
49
          (unsigned long long)pthread_self() );
 
50
    cap_free(caps_text);
 
51
    cap_free(caps);
 
52
#else
 
53
    Debug(tag, "uid=%u, gid=%u, euid=%u, egid=%u",
 
54
          static_cast<unsigned int>(getuid()),
 
55
          static_cast<unsigned int>(getgid()),
 
56
          static_cast<unsigned int>(geteuid()),
 
57
          static_cast<unsigned int>(getegid()) );
 
58
#endif
60
59
  }
61
60
}
62
61
 
86
85
#  endif
87
86
  return zret;
88
87
}
 
88
 
 
89
int
 
90
EnableCoreFile(bool flag) {
 
91
  int zret = 0;
 
92
# if defined(linux)
 
93
    int state = flag ? 1 : 0;
 
94
    if (0 > (zret = prctl(PR_SET_DUMPABLE, state, 0, 0, 0))) {
 
95
      Warning("Unable to set PR_DUMPABLE : %s", strerror(errno));
 
96
    } else if (state != prctl(PR_GET_DUMPABLE)) {
 
97
      zret = ENOSYS; // best guess
 
98
      Warning("Call to set PR_DUMPABLE was ineffective");
 
99
    }
 
100
# endif  // linux check
 
101
  return zret;
 
102
}