Skip to content

Commit

Permalink
[GH #804] NetBSD needs Parrot_get_cpu_type added to its misc.c
Browse files Browse the repository at this point in the history
Add Parrot_get_cpu_type to src/platform/netbsd/misc.c
copied from src/platform/generic/misc.c. Thanks to user he32.
  • Loading branch information
Reini Urban committed Jul 31, 2012
1 parent 2513492 commit c58b5b9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/platform/netbsd/misc.c
Expand Up @@ -22,6 +22,10 @@ Miscellaneous helper functions that are specific to NetBSD.

#include "parrot/parrot.h"

#ifdef PARROT_HAS_HEADER_SYSUTSNAME
# include <sys/utsname.h>
#endif

/* HEADERIZER HFILE: none */

/*
Expand Down Expand Up @@ -53,6 +57,30 @@ Parrot_platform_init_code(void)

/*
=item C<STRING *Parrot_get_cpu_type(Parrot_Interp)>
Fetch CPU type.
=cut
*/

STRING *
Parrot_get_cpu_type(Parrot_Interp interp) {
struct utsname uname_info;
char *proc_arch = "";

#ifdef PARROT_HAS_HEADER_SYSUTSNAME
uname(&uname_info);
proc_arch = uname_info.machine;
#endif
return Parrot_str_new_init(interp, proc_arch, strlen(proc_arch),
Parrot_ascii_encoding_ptr, 0);

}

/*
=back
=cut
Expand Down

0 comments on commit c58b5b9

Please sign in to comment.