From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 13 17:00:33 2014 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B5DA553 for ; Wed, 13 Aug 2014 17:00:33 +0000 (UTC) Received: from mail-vc0-x236.google.com (mail-vc0-x236.google.com [IPv6:2607:f8b0:400c:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EBD82193 for ; Wed, 13 Aug 2014 17:00:33 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id hy4so31281vcb.13 for ; Wed, 13 Aug 2014 10:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=LhwtF7o3b9lqD+jpwrnt/8tL4WRqV13E95MoRkpKB2k=; b=OX0pf+GujvCbUt0D7SKHSY2KrvD8b+LlHcXvrUC56Khjwi62aU9beEXjyEwVCwf7xU A4BzMklKHdkzHeyS57AQoSj7OoX6qf6I1s++c9DDHe+PapCt6h2Zb/hfT0drpBIsg2ZX ZvF0pci47SGxhkt6AEoxPh0FDYNL3CAxIJCQPq1vvc09KcjiBbDCrrNMejND5LbQuWcv crMIaqEGK8PuVTjBnvqw8Fm3jB1Hwwbn567j1QWuNyd4q2dgvRfUEP0RpQkU/dkJxWM4 U/vb8zahEP0pkVOo1jocjNu8qtStvPAzEVSR0WqGZnGVzVjzJsZwtFTSpso6/YDqTGQ8 MYyw== MIME-Version: 1.0 X-Received: by 10.220.190.134 with SMTP id di6mr2480193vcb.43.1407949232285; Wed, 13 Aug 2014 10:00:32 -0700 (PDT) Received: by 10.221.18.133 with HTTP; Wed, 13 Aug 2014 10:00:32 -0700 (PDT) Date: Wed, 13 Aug 2014 12:00:32 -0500 Message-ID: Subject: sysctl(3) question From: "Sam Fourman Jr." To: hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 17:00:33 -0000 Hello Hackers, the following command gives me the disks in a system sysctl kern.disks kern.disks: cd0 ada0 my question is, what paramaters and values do I have to pass sysctl(3) to give me those disks? I have tried and I cant get HW_DISKNAMES from to work #include #include #include #include #include int main(void) { int mib[2]; size_t len; char *p; mib[0] = CTL_HW; mib[1] = HW_DISKNAMES; /* Determine how much space to allocate. */ if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) err(1, "sysctl"); if ((p = (char *)malloc(len)) == NULL) err(1, NULL); /* Populate the allocated area with the string returned * * by sysctl. * */ if (sysctl(mib, 2, p, &len, NULL, 0) == -1) err(1, "sysctl"); printf("%s\n", p); return 0; } Sam Fourman Jr.