mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-17 06:31:14 +00:00
Portability fixes: declare Set_pthread_attr() only if HAVE_PTHREADS. Merge
add_{serial,ether}_names() from B2 prefs editor for FreeBSD/IRIX.
This commit is contained in:
parent
47348e8120
commit
9dc6cdc70e
@ -815,7 +815,17 @@ static GList *add_serial_names(void)
|
|||||||
if (d) {
|
if (d) {
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
while ((de = readdir(d)) != NULL) {
|
while ((de = readdir(d)) != NULL) {
|
||||||
|
#if defined(__linux__)
|
||||||
if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) {
|
if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) {
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) {
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) {
|
||||||
|
#elif defined(sgi)
|
||||||
|
if (strncmp(de->d_name, "ttyf", 4) == 0 || strncmp(de->d_name, "plp", 3) == 0) {
|
||||||
|
#else
|
||||||
|
if (false) {
|
||||||
|
#endif
|
||||||
char *str = new char[64];
|
char *str = new char[64];
|
||||||
sprintf(str, "/dev/%s", de->d_name);
|
sprintf(str, "/dev/%s", de->d_name);
|
||||||
glist = g_list_append(glist, str);
|
glist = g_list_append(glist, str);
|
||||||
@ -846,7 +856,13 @@ static GList *add_ether_names(void)
|
|||||||
struct ifreq req, *ifr = ifc.ifc_req;
|
struct ifreq req, *ifr = ifc.ifc_req;
|
||||||
for (int i=0; i<ifc.ifc_len; i+=sizeof(ifreq), ifr++) {
|
for (int i=0; i<ifc.ifc_len; i+=sizeof(ifreq), ifr++) {
|
||||||
req = *ifr;
|
req = *ifr;
|
||||||
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sgi)
|
||||||
|
if (ioctl(s, SIOCGIFADDR, &req) == 0 && (req.ifr_addr.sa_family == ARPHRD_ETHER || req.ifr_addr.sa_family == ARPHRD_ETHER+1)) {
|
||||||
|
#elif defined(__linux__)
|
||||||
if (ioctl(s, SIOCGIFHWADDR, &req) == 0 && req.ifr_hwaddr.sa_family == ARPHRD_ETHER) {
|
if (ioctl(s, SIOCGIFHWADDR, &req) == 0 && req.ifr_hwaddr.sa_family == ARPHRD_ETHER) {
|
||||||
|
#else
|
||||||
|
if (false) {
|
||||||
|
#endif
|
||||||
char *str = new char[64];
|
char *str = new char[64];
|
||||||
strncpy(str, ifr->ifr_name, 63);
|
strncpy(str, ifr->ifr_name, 63);
|
||||||
glist = g_list_append(glist, str);
|
glist = g_list_append(glist, str);
|
||||||
|
@ -44,6 +44,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREADS
|
||||||
|
# include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
@ -356,8 +360,10 @@ typedef struct timeval tm_time_t;
|
|||||||
extern uint64 GetTicks_usec(void);
|
extern uint64 GetTicks_usec(void);
|
||||||
extern void Delay_usec(uint32 usec);
|
extern void Delay_usec(uint32 usec);
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREADS
|
||||||
// Setup pthread attributes
|
// Setup pthread attributes
|
||||||
extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
|
extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Various definitions
|
// Various definitions
|
||||||
typedef struct rgb_color {
|
typedef struct rgb_color {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user