~ubuntu-branches/ubuntu/maverick/util-linux/maverick-proposed

« back to all changes in this revision

Viewing changes to schedutils/chrt.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2010-03-22 17:35:40 UTC
  • mfrom: (1.6.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100322173540-sm083tdtvne1wa5w
Tags: 2.17.2-0ubuntu1
* Merge from Debian experimental, remaining changes:
  - Since udev is required in Ubuntu, the hwclock.sh init script is
    not called on startup and the hwclockfirst.sh init script is
    removed.
  - Use wildcards for symbols file, since they use versioned symbols
    properly.
  - Remove /etc/adjtime on upgrade if it was not used.
  - Install custom blkid.conf to use /dev/.blkid.tab since we don't
    expect device names to survive a reboot
  - No lsb_release call in mount.preinst since we'd need Pre-Depends
    (LP: #383697).
  - Do not install initramfs hook, since our initramfs already handles
    including blkid.
  - Mention mountall(8) in fstab(5) manpages, along with its special
    options.

* For the case where mount is called with a directory to mount, look
  that directory up in mountall's /lib/init/fstab if we couldn't find
  it mentioned anywhere else.  This means "mount /proc", "mount /sys",
  etc. work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
# define SCHED_IDLE 5
48
48
#endif
49
49
 
50
 
#if defined(__linux__) && !defined(SCHED_RESET_ON_FORK)
51
 
#define SCHED_RESET_ON_FORK 0x40000000
52
 
#endif
53
 
 
54
 
 
55
50
static void show_usage(int rc)
56
51
{
57
52
        fprintf(stdout, _(
66
61
        "  -i | --idle          set policy to SCHED_IDLE\n"
67
62
        "  -o | --other         set policy to SCHED_OTHER\n"
68
63
        "  -r | --rr            set policy to SCHED_RR (default)\n"
69
 
        "\nScheduling flags:\n"
70
 
        "  -R | --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR\n"
71
64
        "\nOptions:\n"
72
65
        "  -h | --help          display this help\n"
73
66
        "  -p | --pid           operate on existing given pid\n"
99
92
        case SCHED_FIFO:
100
93
                printf("SCHED_FIFO\n");
101
94
                break;
102
 
        case SCHED_FIFO|SCHED_RESET_ON_FORK:
103
 
                printf("SCHED_FIFO|SCHED_RESET_ON_FORK\n");
104
 
                break;
105
95
#ifdef SCHED_IDLE
106
96
        case SCHED_IDLE:
107
97
                printf("SCHED_IDLE\n");
110
100
        case SCHED_RR:
111
101
                printf("SCHED_RR\n");
112
102
                break;
113
 
        case SCHED_RR|SCHED_RESET_ON_FORK:
114
 
                printf("SCHED_RR|SCHED_RESET_ON_FORK\n");
115
 
                break;
116
103
#ifdef SCHED_BATCH
117
104
        case SCHED_BATCH:
118
105
                printf("SCHED_BATCH\n");
163
150
 
164
151
int main(int argc, char *argv[])
165
152
{
166
 
        int i, policy = SCHED_RR, priority = 0, verbose = 0, policy_flag = 0;
 
153
        int i, policy = SCHED_RR, priority = 0, verbose = 0;
167
154
        struct sched_param sp;
168
155
        pid_t pid = -1;
169
156
 
176
163
                { "max",        0, NULL, 'm' },
177
164
                { "other",      0, NULL, 'o' },
178
165
                { "rr",         0, NULL, 'r' },
179
 
                { "reset-on-fork", 0, NULL, 'R' },
180
166
                { "verbose",    0, NULL, 'v' },
181
167
                { "version",    0, NULL, 'V' },
182
168
                { NULL,         0, NULL, 0 }
186
172
        bindtextdomain(PACKAGE, LOCALEDIR);
187
173
        textdomain(PACKAGE);
188
174
 
189
 
        while((i = getopt_long(argc, argv, "+bfiphmoRrvV", longopts, NULL)) != -1)
 
175
        while((i = getopt_long(argc, argv, "+bfiphmorvV", longopts, NULL)) != -1)
190
176
        {
191
177
                int ret = EXIT_FAILURE;
192
178
 
199
185
                case 'f':
200
186
                        policy = SCHED_FIFO;
201
187
                        break;
202
 
                case 'R':
203
 
                        policy_flag |= SCHED_RESET_ON_FORK;
204
 
                        break;
205
188
                case 'i':
206
189
#ifdef SCHED_IDLE
207
190
                        policy = SCHED_IDLE;
249
232
        if (errno)
250
233
                err(EXIT_FAILURE, _("failed to parse priority"));
251
234
 
252
 
        /* sanity check */
253
 
        if ((policy_flag & SCHED_RESET_ON_FORK) &&
254
 
            !(policy == SCHED_FIFO || policy == SCHED_RR))
255
 
                errx(EXIT_FAILURE, _("SCHED_RESET_ON_FORK flag is suppoted for "
256
 
                                "SCHED_FIFO and SCHED_RR policies only"));
257
 
 
258
 
        policy |= policy_flag;
259
 
 
260
235
        if (pid == -1)
261
236
                pid = 0;
262
237
        sp.sched_priority = priority;