Changeset 2546 for trunk/src/kmk/main.c


Ignore:
Timestamp:
Oct 1, 2011, 9:49:54 PM (14 years ago)
Author:
bird
Message:

Applied modified patches for Haiku support from Mike Smith.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/main.c

    r2243 r2546  
    5555#  define INCL_BASE
    5656#  include <os2.h>
     57# endif
     58# ifdef __HAIKU__
     59#  include <OS.h>
    5760# endif
    5861#endif /* KMK*/
     
    840843    if (!SetProcessAffinityMask (GetCurrentProcess (), process_affinity))
    841844      fprintf (stderr, "warning: SetPriorityClass (,%#x) failed with last error %d\n",
    842                process_affinity, GetLastError());
     845               process_affinity, GetLastError ());
    843846
    844847  switch (process_priority)
     
    850853      case 4:     dwPriority = HIGH_PRIORITY_CLASS; break;
    851854      case 5:     dwPriority = REALTIME_PRIORITY_CLASS; break;
    852       default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     855      default:    fatal (NILF, _("invalid priority %d\n"), process_priority);
    853856    }
    854857  if (!SetPriorityClass (GetCurrentProcess (), dwPriority))
    855858    fprintf (stderr, "warning: SetPriorityClass (,%#x) failed with last error %d\n",
    856859             dwPriority, GetLastError ());
     860
     861#elif defined(__HAIKU__)
     862  int32 iNewPriority;
     863  status_t error;
     864
     865  switch (process_priority)
     866    {
     867      case 0:     return;
     868      case 1:     iNewPriority = B_LOWEST_ACTIVE_PRIORITY; break;
     869      case 2:     iNewPriority = B_LOW_PRIORITY; break;
     870      case 3:     iNewPriority = B_NORMAL_PRIORITY; break;
     871      case 4:     iNewPriority = B_URGENT_DISPLAY_PRIORITY; break;
     872      case 5:     iNewPriority = B_REAL_TIME_DISPLAY_PRIORITY; break;
     873      default:    fatal (NILF, _("invalid priority %d\n"), process_priority);
     874    }
     875  error = set_thread_priority (find_thread (NULL), iNewPriority);
     876  if (error != B_OK)
     877    fprintf (stderr, "warning: set_thread_priority (,%d) failed: %s\n",
     878             newPriority, strerror (error));
    857879
    858880# else /*#elif HAVE_NICE */
     
    866888      case 4:     nice_level = -10; break;
    867889      case 5:     nice_level = -19; break;
    868       default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     890      default:    fatal (NILF, _("invalid priority %d\n"), process_priority);
    869891    }
    870892  errno = 0;
Note: See TracChangeset for help on using the changeset viewer.