• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining how the app is run (intel/ppc/rosetta/os version)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining how the app is run (intel/ppc/rosetta/os version)?


  • Subject: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • From: Gerben Wierda <email@hidden>
  • Date: Fri, 26 May 2006 14:42:22 +0200

I still want to keep my app from running on some versions of the OS or some situations because there are known OS bugs there. E.g. my app on 10.4.6 under Rosetta is one of the apps (like MatLab) triggering the OS bug. So I started looking for ways to determine the way the app is run.

I tried doing some stuff through sysctl, but failed. Below is an example. The CTL_KERN/KERN_VERSION works, but CTL_HW/HW_MACHINE_ARG does not.

Is OS X broken here or am I doing something boneheaded?

Thanks,

Gerben

#include <stdio.h>
#include <sys/sysctl.h>
#include <stdlib.h>

main()
{
    char *hw_machine_arg;
    int mib[2];
    size_t len;

    /*
    mib[0] = CTL_HW;
    mib[1] = HW_MACHINE_ARCH;
    */
    mib[0] = CTL_KERN;
    mib[1] = KERN_VERSION;

    if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) {
        perror("sysctl");
    }
    else {
        if (len > 0) {
            hw_machine_arg = malloc( len);
            if (sysctl(mib, 2, hw_machine_arg, &len, NULL, 0) == -1) {
                perror("sysctl");
            }
            printf( "HW_MACHINE_ARG: %s\n", hw_machine_arg);
        }
    }
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Determining how the app is run (intel/ppc/rosetta/os version)?
      • From: "Finlay Dobbie" <email@hidden>
    • Re: Determining how the app is run (intel/ppc/rosetta/os version)?
      • From: Dirk Stegemann <email@hidden>
    • Re: Determining how the app is run (intel/ppc/rosetta/os version)?
      • From: Uli Kusterer <email@hidden>
References: 
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Greg Hurrell <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Greg Hurrell <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)

  • Prev by Date: Re: awakeFromNib not called immediatly after initWithWindowNibName
  • Next by Date: Re: ssl.h linking error
  • Previous by thread: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Next by thread: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Index(es):
    • Date
    • Thread