Files
textmate/Shared/include/oak/compat.h
Allan Odgaard b489687403 Disable AuthorizationExecuteWithPrivileges deprecation warning
The “proper” replacement for this API is to use the ServiceManagement framework’s SMJobBless() to bless our helper tool. In two of the three use-cases our helper tool is however regular shell commands, so it seems redundant to wrap these shell tools as helper tools we can install as launchd jobs.
2013-05-06 14:51:31 +07:00

33 lines
1004 B
C++

#ifndef COMPAT_H_RD1Z6YZA
#define COMPAT_H_RD1Z6YZA
namespace oak
{
inline void set_thread_name (char const* threadName)
{
pthread_setname_np(threadName);
}
inline size_t get_gestalt (OSType selector)
{
SInt32 res;
Gestalt(selector, &res);
return res;
}
inline size_t os_major () { return get_gestalt(gestaltSystemVersionMajor); }
inline size_t os_minor () { return get_gestalt(gestaltSystemVersionMinor); }
inline size_t os_patch () { return get_gestalt(gestaltSystemVersionBugFix); }
inline OSStatus execute_with_privileges (AuthorizationRef authorization, std::string const& pathToTool, AuthorizationFlags options, char* const* arguments, FILE** communicationsPipe)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return AuthorizationExecuteWithPrivileges(authorization, pathToTool.c_str(), options, arguments, communicationsPipe);
#pragma clang diagnostic pop
}
} /* oak */
#endif /* end of include guard: COMPAT_H_RD1Z6YZA */