mschorm / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
894b42f
--- util-linux-2.13-pre6/schedutils/chrt.1.batch	2006-11-10 13:23:37.000000000 -0500
894b42f
+++ util-linux-2.13-pre6/schedutils/chrt.1	2006-11-10 13:27:23.000000000 -0500
894b42f
@@ -36,10 +36,11 @@
894b42f
 .BR chrt (1)
894b42f
 sets or retrieves the real-time scheduling attributes of an existing PID or
894b42f
 runs COMMAND with the given attributes.  Both policy (one of
894b42f
+.BR SCHED_OTHER ,
894b42f
 .BR SCHED_FIFO ,
894b42f
 .BR SCHED_RR ,
894b42f
 or
894b42f
-.BR SCHED_OTHER )
894b42f
+.BR SCHED_BATCH )
894b42f
 and priority can be set and retrieved.
894b42f
 .SH OPTIONS
894b42f
 .TP
894b42f
@@ -48,6 +49,10 @@
894b42f
 .TP
894b42f
 
894b42f
 .TP
894b42f
+.B -b, --batch
894b42f
+set scheduling policy to
894b42f
+.BR SCHED_BATCH
894b42f
+.TP
894b42f
 .B -f, --fifo
894b42f
 set scheduling policy to
894b42f
 .BR SCHED_FIFO
894b42f
--- util-linux-2.13-pre6/schedutils/chrt.c.batch	2005-08-14 11:18:54.000000000 -0400
894b42f
+++ util-linux-2.13-pre6/schedutils/chrt.c	2006-11-10 13:27:52.000000000 -0500
894b42f
@@ -36,6 +36,8 @@
894b42f
 	fprintf(stderr, "usage: %s [options] [prio] [pid | cmd [args...]]\n",
894b42f
 			cmd);
894b42f
 	fprintf(stderr, "manipulate real-time attributes of a process\n");
894b42f
+	fprintf(stderr, "  -b, --batch                        "
894b42f
+			"set policy to SCHED_BATCH\n");
894b42f
 	fprintf(stderr, "  -f, --fifo                         "
894b42f
 			"set policy to SCHED_FF\n");
894b42f
 	fprintf(stderr, "  -p, --pid                          "
894b42f
@@ -83,6 +85,9 @@
894b42f
 	case SCHED_RR:
894b42f
 		printf("SCHED_RR\n");
894b42f
 		break;
894b42f
+	case SCHED_BATCH:
894b42f
+		printf("SCHED_BATCH\n");
894b42f
+		break;
894b42f
 	default:
894b42f
 		printf("unknown\n");
894b42f
 	}
894b42f
@@ -101,6 +106,13 @@
894b42f
 {
894b42f
 	int max, min;
894b42f
 
894b42f
+	max = sched_get_priority_max(SCHED_OTHER);
894b42f
+	min = sched_get_priority_min(SCHED_OTHER);
894b42f
+	if (max >= 0 && min >= 0)
894b42f
+		printf("SCHED_OTHER min/max priority\t: %d/%d\n", min, max);
894b42f
+	else
894b42f
+		printf("SCHED_OTHER not supported?\n");
894b42f
+
894b42f
 	max = sched_get_priority_max(SCHED_FIFO);
894b42f
 	min = sched_get_priority_min(SCHED_FIFO);
894b42f
 	if (max >= 0 && min >= 0)
894b42f
@@ -115,12 +127,12 @@
894b42f
 	else
894b42f
 		printf("SCHED_RR not supported?\n");
894b42f
 
894b42f
-	max = sched_get_priority_max(SCHED_OTHER);
894b42f
-	min = sched_get_priority_min(SCHED_OTHER);
894b42f
+	max = sched_get_priority_max(SCHED_BATCH);
894b42f
+	min = sched_get_priority_min(SCHED_BATCH);
894b42f
 	if (max >= 0 && min >= 0)
894b42f
-		printf("SCHED_OTHER min/max priority\t: %d/%d\n", min, max);
894b42f
+		printf("SCHED_BATCH min/max priority\t: %d/%d\n", min, max);
894b42f
 	else
894b42f
-		printf("SCHED_OTHER not supported?\n");
894b42f
+		printf("SCHED_BATCH not supported?\n");
894b42f
 }
894b42f
 
894b42f
 int main(int argc, char *argv[])
894b42f
@@ -130,6 +142,7 @@
894b42f
 	pid_t pid = 0;
894b42f
 
894b42f
 	struct option longopts[] = {
894b42f
+		{ "batch",	0, NULL, 'b' },
894b42f
 		{ "fifo",	0, NULL, 'f' },
894b42f
 		{ "pid",	0, NULL, 'p' },
894b42f
 		{ "help",	0, NULL, 'h' },
894b42f
@@ -141,11 +154,14 @@
894b42f
 		{ NULL,		0, NULL, 0 }
894b42f
 	};
894b42f
 
894b42f
-	while((i = getopt_long(argc, argv, "+fphmorvV", longopts, NULL)) != -1)
894b42f
+	while((i = getopt_long(argc, argv, "+bfphmorvV", longopts, NULL)) != -1)
894b42f
 	{
894b42f
 		int ret = 1;
894b42f
 
894b42f
 		switch (i) {
894b42f
+		case 'b':
894b42f
+			policy = SCHED_BATCH;
894b42f
+			break;
894b42f
 		case 'f':
894b42f
 			policy = SCHED_FIFO;
894b42f
 			break;