Exemplo n.º 1
0
uint32_t kssysctl_uint32(const int major_cmd, const int minor_cmd)
{
    int cmd[2] = {major_cmd, minor_cmd};
    uint32_t value = 0;
    size_t size = sizeof(value);

    CHECK_SYSCTL_CMD(uint32, sysctl(cmd,
                                    sizeof(cmd)/sizeof(*cmd),
                                    &value,
                                    &size,
                                    NULL,
                                    0));

    return value;
}
int64_t bugsnag_kssysctl_int64(const int major_cmd, const int minor_cmd)
{
    int cmd[2] = {major_cmd, minor_cmd};
    int64_t value = 0;
    size_t size = sizeof(value);

    CHECK_SYSCTL_CMD(int64, sysctl(cmd,
                                   sizeof(cmd)/sizeof(*cmd),
                                   &value,
                                   &size,
                                   NULL,
                                   0));

    return value;
}
Exemplo n.º 3
0
int kssysctl_string(const int major_cmd,
                       const int minor_cmd,
                       char*const value,
                       const int maxSize)
{
    int cmd[2] = {major_cmd, minor_cmd};
    size_t size = value == NULL ? 0 : (size_t)maxSize;

    CHECK_SYSCTL_CMD(string, sysctl(cmd,
                                    sizeof(cmd)/sizeof(*cmd),
                                    value,
                                    &size,
                                    NULL,
                                    0));

    return (int)size;
}