VirtualBox

Ignore:
Timestamp:
Mar 23, 2011 5:48:42 PM (14 years ago)
Author:
vboxsync
Message:

thread2-r0drv-linux.c: Missing break in the RTTHREADTYPE_TIMER case. Style cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c

    r36244 r36378  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4343}
    4444
     45
    4546int rtThreadNativeInit(void)
    4647{
     
    4849}
    4950
    50 /*
    51  * Following is verbatim comment from Linux's sched.h.
    52  *
    53  * Priority of a process goes from 0..MAX_PRIO-1, valid RT
    54  * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
    55  * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
    56  * values are inverted: lower p->prio value means higher priority.
    57  *
    58  * The MAX_USER_RT_PRIO value allows the actual maximum
    59  * RT priority to be separate from the value exported to
    60  * user-space.  This allows kernel threads to set their
    61  * priority to a value higher than any user task. Note:
    62  * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
    63  */
    6451
    6552int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
    6653{
    67     int    sched_class = SCHED_NORMAL;
    68     struct sched_param param = { .sched_priority = MAX_PRIO-1 };
     54    /* See comment near MAX_RT_PRIO in linux/sched.h for details on
     55       sched_priority. */
     56    int                 iSchedClass = SCHED_NORMAL;
     57    struct sched_param  Param       = { .sched_priority = MAX_PRIO - 1 };
    6958    switch (enmType)
    7059    {
    7160        case RTTHREADTYPE_INFREQUENT_POLLER:
    72         {
    73             param.sched_priority = MAX_RT_PRIO + 5;
     61            Param.sched_priority = MAX_RT_PRIO + 5;
    7462            break;
    75         }
     63
    7664        case RTTHREADTYPE_EMULATION:
    77         {
    78             param.sched_priority = MAX_RT_PRIO + 4;
     65            Param.sched_priority = MAX_RT_PRIO + 4;
    7966            break;
    80         }
     67
    8168        case RTTHREADTYPE_DEFAULT:
    82         {
    83             param.sched_priority = MAX_RT_PRIO + 3;
     69            Param.sched_priority = MAX_RT_PRIO + 3;
    8470            break;
    85         }
     71
    8672        case RTTHREADTYPE_MSG_PUMP:
    87         {
    88             param.sched_priority = MAX_RT_PRIO + 2;
     73            Param.sched_priority = MAX_RT_PRIO + 2;
    8974            break;
    90         }
     75
    9176        case RTTHREADTYPE_IO:
    92         {
    93             sched_class = SCHED_FIFO;
    94             param.sched_priority = MAX_RT_PRIO - 1;
     77            iSchedClass = SCHED_FIFO;
     78            Param.sched_priority = MAX_RT_PRIO - 1;
    9579            break;
    96         }
     80
    9781        case RTTHREADTYPE_TIMER:
    98         {
    99             sched_class = SCHED_FIFO;
    100             param.sched_priority = 1; /* not 0 just in case */
    101         }
     82            iSchedClass = SCHED_FIFO;
     83            Param.sched_priority = 1; /* not 0 just in case */
     84            break;
     85
    10286        default:
    10387            AssertMsgFailed(("enmType=%d\n", enmType));
     
    10690
    10791#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
    108     sched_setscheduler(current, sched_class, &param);
     92    sched_setscheduler(current, iSchedClass, &Param);
    10993#endif
    11094
    11195    return VINF_SUCCESS;
    11296}
     97
    11398
    11499int rtThreadNativeAdopt(PRTTHREADINT pThread)
     
    123108}
    124109
     110
     111#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4)
    125112/**
    126113 * Native kernel thread wrapper function.
     
    137124    return 0;
    138125}
     126#endif
    139127
    140128
     
    157145#endif
    158146}
     147
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette