brintos

brintos / llvm-project-archived public Read only

0
0
Text · 781 B · d81c156 Raw
37 lines · cpp
1// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s2 3#include <sys/param.h>4#include <sys/types.h>5 6#include <sys/sysctl.h>7 8#include <assert.h>9#include <stdio.h>10#include <stdlib.h>11 12void test_sysctlgetmibinfo() {13  int mib[CTL_MAXNAME];14  unsigned int mib_len = __arraycount(mib);15  int rv = sysctlgetmibinfo("kern.ostype", &mib[0], &mib_len, NULL, NULL, NULL,16                       SYSCTL_VERSION);17  assert(!rv);18 19  char buf[100];20  size_t len = sizeof(buf);21  rv = sysctl(mib, mib_len, buf, &len, NULL, 0);22  assert(!rv);23 24  printf("sysctlgetmibinfo: '%s' size: '%zu'\n", buf, len);25}26 27int main(void) {28  printf("sysctlgetmibinfo\n");29 30  test_sysctlgetmibinfo();31 32  return 0;33 34  // CHECK: sysctlgetmibinfo35  // CHECK: sysctlgetmibinfo: '{{.*}}' size: '{{.*}}'36}37