This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] some manual additons/fixups


These are two changes I posted some time back, but fell through the
cracks. Just reposting to clear them from my queue.

2001-01-07  Ben Collins  <bcollins@debian.org>

	* manual/examples/longopt.c: Make the "struct option" a little
	more like it should be, adding usage of required_argument,
	noargument and such, and also setting the options string
	right.

	* manual/sysinfo.texi (Load Average): New section, documents
	getloadavg().

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'
Index: sysinfo.texi
===================================================================
RCS file: /cvs/glibc/libc/manual/sysinfo.texi,v
retrieving revision 1.34
diff -u -u -r1.34 sysinfo.texi
--- sysinfo.texi	2000/06/01 18:32:53	1.34
+++ sysinfo.texi	2001/01/07 03:03:59
@@ -15,6 +15,7 @@
                                   machine type
 * Filesystem Handling::         Controlling/querying mounts
 * System Parameters::           Getting and setting various system parameters
+* Load Average::                Getting the system load average
 @end menu
 
 To get information on parameters of the system that are built into the
@@ -1190,3 +1191,23 @@
 @item
 @code{bdflush}
 @end itemize
+
+@node Load Average
+@section Getting the system load average
+
+This section describes the @code{getloadavg} function, which gets the 1, 5
+and 15 minute load averages of the system. The load average is the number of
+processes in the system run queue, averaged over various periods of time
+(1, 5 and 15 minutes in this case).
+
+The symbols used in this section are declared in the file @file{stdlib.h}.
+
+@comment stdlib.h
+@comment BSD
+@deftypefun int getloadavg (double @var{loadavg}[], int @var{nelem})
+This function gets the 1, 5 and 15 minute load averages of the system. The
+values are placed in @var{loadavg}. The function will place at most
+@var{nelem} elements into the array, @var{loadavg}. Never are there more
+than three elements returned and possibly less than @var{nelem}. The return
+value is the number of elements written to @var{loadavg}, or -1 on error.
+@end deftypefun
Index: examples/longopt.c
===================================================================
RCS file: /cvs/glibc/libc/manual/examples/longopt.c,v
retrieving revision 1.4
diff -u -u -r1.4 longopt.c
--- longopt.c	1996/05/15 23:00:17	1.4
+++ longopt.c	2001/01/07 03:03:59
@@ -17,21 +17,21 @@
       static struct option long_options[] =
 	{
 	  /* These options set a flag.  */
-	  {"verbose", 0, &verbose_flag, 1},
-	  {"brief", 0, &verbose_flag, 0},
+	  {"verbose", no_argument,       &verbose_flag, 1},
+	  {"brief",   no_argument,       &verbose_flag, 0},
 	  /* These options don't set a flag.
 	     We distinguish them by their indices.  */
-	  {"add", 1, 0, 0},
-	  {"append", 0, 0, 0},
-	  {"delete", 1, 0, 0},
-	  {"create", 0, 0, 0},
-	  {"file", 1, 0, 0},
+	  {"add",     required_argument, 0, 'a'},
+	  {"append",  no_argument,       0, 'b'},
+	  {"delete",  required_argument, 0, 'd'},
+	  {"create",  no_argument,       0, 'c'},
+	  {"file",    required_argument, 0, 'f'},
 	  {0, 0, 0, 0}
 	};
       /* @code{getopt_long} stores the option index here.  */
       int option_index = 0;
 
-      c = getopt_long (argc, argv, "abc:d:",
+      c = getopt_long (argc, argv, "abc:d:f:",
 		       long_options, &option_index);
 
       /* Detect the end of the options.  */
@@ -64,6 +64,10 @@
 
 	case 'd':
 	  printf ("option -d with value `%s'\n", optarg);
+	  break;
+
+	case 'f':
+	  printf ("option -f with value `%s'\n", optarg);
 	  break;
 
 	case '?':

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]