From e4cf522929cc33ea951756509b0e4f166f0da59a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 11 Feb 2001 19:15:00 +0000 Subject: Update. * sysdeps/generic/getsysstat.c: Change return value of get_phys_pages and get_avphys_page to long int. * sysdeps/unix/sysv/linux/getsysstat.c: Likewise. * include/sys/sysinfo.h: Likewise. * sysdeps/generic/sys/sysinfo.h: Likewise. * sysdeps/unix/sysv/linux/sys/sysinfo.h: Likewise. --- manual/filesys.texi | 70 ++++++++++++++++++++++++++++++++++++++++++++++------ manual/resource.texi | 19 ++++++++++++++ manual/sysinfo.texi | 21 ---------------- manual/syslog.texi | 50 +++++++++++++++++-------------------- 4 files changed, 105 insertions(+), 55 deletions(-) (limited to 'manual') diff --git a/manual/filesys.texi b/manual/filesys.texi index c550d72..84c9f6b 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -140,6 +140,34 @@ syntax errors (@pxref{File Name Errors}), plus @code{ENOTDIR} if the file @var{filename} is not a directory. @end deftypefun +@comment unistd.h +@comment XPG +@deftypefun int fchdir (int @var{filedes}) +This function is used to set the process's working directory to +directory associated with the file descriptor @var{filedes}. + +The normal, successful return value from @code{fchdir} is @code{0}. A +value of @code{-1} is returned to indicate an error. The following +@code{errno} error conditions are defined for this function: + +@table @code +@item EACCES +Read permission is denied for the directory named by @code{dirname}. + +@item EBADF +The @var{filedes} argument is not a valid file descriptor. + +@item ENOTDIR +The file descriptor @var{filedes} is not associated with a directory. + +@item EINTR +The function call was interrupt by a signal. + +@item EIO +An I/O error occurred. +@end table +@end deftypefun + @node Accessing Directories @section Accessing Directories @@ -206,7 +234,7 @@ type of the appropriate size This is the type of the file, possibly unknown. The following constants are defined for its value: -@table @code +@vtable @code @item DT_UNKNOWN The type is unknown. On some systems this is the only value returned. @@ -227,24 +255,34 @@ A character device. @item DT_BLK A block device. -@end table +@end vtable -This member is a BSD extension. On systems where it is used, it +This member is a BSD extension. The symbol @code{_DIRENT_HAVE_D_TYPE} +is defined if this member is available. On systems where it is used, it corresponds to the file type bits in the @code{st_mode} member of -@code{struct statbuf}. On other systems it will always be DT_UNKNOWN. -These two macros convert between @code{d_type} values and @code{st_mode} -values: +@code{struct statbuf}. If the value cannot be determine the member +value is DT_UNKNOWN. These two macros convert between @code{d_type} +values and @code{st_mode} values: +@comment dirent.h +@comment BSD @deftypefun int IFTODT (mode_t @var{mode}) This returns the @code{d_type} value corresponding to @var{mode}. @end deftypefun +@comment dirent.h +@comment BSD @deftypefun mode_t DTTOIF (int @var{dtype}) This returns the @code{st_mode} value corresponding to @var{dtype}. @end deftypefun @end table -This structure may contain additional members in the future. +This structure may contain additional members in the future. Their +availability is always announced in the compilation environment by a +macro names @code{_DIRENT_HAVE_D_xxx} where @code{xxx} is replaced by +the name of the new member. For instance, the member @code{d_reclen} +available on some systems is announced through the macro +@code{_DIRENT_HAVE_D_RECLEN}. When a file has multiple names, each name has its own directory entry. The only way you can tell that the directory entries belong to a @@ -304,6 +342,24 @@ and the @code{opendir} function in terms of the @code{open} function. file descriptors are closed on @code{exec} (@pxref{Executing a File}). @end deftypefun +In some situations it can be desirable to get hold of the file +descriptor which is created by the @code{opendir} call. For instance, +to switch the current working directory to the directory just read the +@code{fchdir} function could be used. Historically the @code{DIR} type +was exposed and programs could access the fields. This does not happen +in the GNU C library. Instead a separate function is provided to allow +access. + +@comment dirent.h +@comment GNU +@deftypefun int dirfd (DIR *@var{dirstream}) +The function @code{dirfd} returns the file descriptor associated with +the directory stream @var{dirstream}. This descriptor can be used until +the directory is closed with @code{closedir}. If the directory stream +implementation is not using file descriptors the return value is +@code{-1}. +@end deftypefun + @node Reading/Closing Directory @subsection Reading and Closing a Directory Stream diff --git a/manual/resource.texi b/manual/resource.texi index 48e0ac0..9fc8b64 100644 --- a/manual/resource.texi +++ b/manual/resource.texi @@ -1401,3 +1401,22 @@ processors and so the call @noindent returns the number of processors which are currently inline (i.e., available). + +@cindex load average +Before starting more threads it should be checked whether the processors +are not already overused. Unix systems calculate something called the +@dfn{load average}. This is a number indicating how many processes were +running. This number is average over different periods of times +(normally 1, 5, and 15 minutes). + +@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}. @code{getloadavg} will +place at most @var{nelem} elements into the array but never more than +three elements. The return value is the number of elements written to +@var{loadavg}, or -1 on error. + +This function is declared in @file{stdlib.h}. +@end deftypefun diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi index 346a28c..7f82bb8 100644 --- a/manual/sysinfo.texi +++ b/manual/sysinfo.texi @@ -15,7 +15,6 @@ can make changes. 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 @@ -1193,23 +1192,3 @@ parameters are: @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 diff --git a/manual/syslog.texi b/manual/syslog.texi index 4c190d3..49f599d 100644 --- a/manual/syslog.texi +++ b/manual/syslog.texi @@ -59,7 +59,7 @@ Pass to another daemon Discard @end itemize -Syslogd can also handle messages from other systems. It listens on the +Syslogd can also handle messages from other systems. It listens on the @code{syslog} UDP port as well as the local socket for messages. Syslog can handle messages from the kernel itself. But the kernel @@ -158,7 +158,7 @@ to identify the source of the message, and people conventionally set it to the name of the program that will submit the messages. @code{openlog} may or may not open the @file{/dev/log} socket, depending -on @var{option}. If it does, it tries to open it and connect it as a +on @var{option}. If it does, it tries to open it and connect it as a stream socket. If that doesn't work, it tries to open it and connect it as a datagram socket. The socket has the ``Close on Exec'' attribute, so the kernel will close it if the process performs an exec. @@ -166,7 +166,7 @@ so the kernel will close it if the process performs an exec. You don't have to use @code{openlog}. If you call @code{syslog} without having called @code{openlog}, @code{syslog} just opens the connection implicitly and uses defaults for the information in @var{ident} and -@var{options}. +@var{options}. @var{options} is a bit string, with the bits as defined by the following single bit masks: @@ -243,7 +243,7 @@ writing to the Unix domain socket @code{/dev/log}. @code{syslog} submits the message with the facility and priority indicated by @var{facility_priority}. The macro @code{LOG_MAKEPRI} generates a -facility/priority from a facility and a priority, as in the following +facility/priority from a facility and a priority, as in the following example: @smallexample @@ -255,7 +255,7 @@ The possible values for the facility code are (macros): @c Internally, there is also LOG_KERN, but LOG_KERN == 0, which means @c if you try to use it here, just selects default. -@table @code +@vtable @code @item LOG_USER A miscellaneous user process @item LOG_MAIL @@ -294,15 +294,15 @@ Locally defined Locally defined @item LOG_LOCAL7 Locally defined -@end table +@end vtable Results are undefined if the facility code is anything else. -@strong{note:} Syslog recognizes one other facility code: that of the -kernel. But you can't specify that facility code with these functions. -If you try, it looks the same to @code{syslog} as if you are requesting -the default facility. But you wouldn't want to anyway, because any -program that uses the GNU C library is not the kernel. +@strong{note:} @code{syslog} recognizes one other facility code: that of +the kernel. But you can't specify that facility code with these +functions. If you try, it looks the same to @code{syslog} as if you are +requesting the default facility. But you wouldn't want to anyway, +because any program that uses the GNU C library is not the kernel. You can use just a priority code as @var{facility_priority}. In that case, @code{syslog} assumes the default facility established when the @@ -310,7 +310,7 @@ Syslog connection was opened. @xref{Syslog Example}. The possible values for the priority code are (macros): -@table @code +@vtable @code @item LOG_EMERG The message says the system is unusable. @item LOG_ALERT @@ -327,7 +327,7 @@ The message describes a normal but important event. The message is purely informational. @item LOG_DEBUG The message is only for debugging purposes. -@end table +@end vtable Results are undefined if the priority code is anything else. @@ -354,8 +354,8 @@ Example: @smallexample #include -syslog(LOG_MAKEPRI(LOG_LOCAL1, LOG_ERROR), - "Unable to make network connection to %s. Error=%m", host); +syslog (LOG_MAKEPRI(LOG_LOCAL1, LOG_ERROR), + "Unable to make network connection to %s. Error=%m", host); @end smallexample @@ -364,8 +364,7 @@ syslog(LOG_MAKEPRI(LOG_LOCAL1, LOG_ERROR), @comment syslog.h @comment BSD -@deftypefun void vsyslog (int @var{facility_priority}, char *@var{format}, - __gnuc_va_list arglist) +@deftypefun void vsyslog (int @var{facility_priority}, char *@var{format}, va_list arglist) This is functionally identical to @code{syslog}, with the BSD style variable length argument. @@ -381,7 +380,7 @@ The symbols referred to in this section are declared in the file @comment syslog.h @comment BSD -@deftypefun void closelog () +@deftypefun void closelog (void) @code{closelog} closes the current Syslog connection, if there is one. This include closing the @file{dev/log} socket, if it is open. @@ -444,7 +443,7 @@ on for a certain priority and all priorities above it: LOG_UPTO(LOG_ERROR) @end smallexample -The unfortunate naming of the macro is due to the fact that internally, +The unfortunate naming of the macro is due to the fact that internally, higher numbers are used for lower message priorities. @end deftypefun @@ -462,16 +461,13 @@ in the example does nothing. @smallexample #include -setlogmask(LOG_UPTO(LOG_NOTICE)); +setlogmask (LOG_UPTO (LOG_NOTICE)); -openlog("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); +openlog ("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); -syslog(LOG_NOTICE, "Program started by User %d", getuid()); -syslog(LOG_INFO, "A tree falls in a forest"); +syslog (LOG_NOTICE, "Program started by User %d", getuid ()); +syslog (LOG_INFO, "A tree falls in a forest"); -closelog(); +closelog (); @end smallexample - - - -- cgit v1.1