⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errno.texi

📁 一个C源代码分析器
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
@comment errno 62 @c DO NOT REMOVEToo many levels of symbolic links were encountered in looking up a file name.This often indicates a cycle of symbolic links.@end deftypevr@comment errno.h@comment POSIX.1: File name too long@deftypevr Macro int ENAMETOOLONG@comment errno 63 @c DO NOT REMOVEFilename too long (longer than @code{PATH_MAX}; @pxref{Limits forFiles}) or host name too long (in @code{gethostname} or@code{sethostname}; @pxref{Host Identification}).@end deftypevr@comment errno.h@comment BSD: Host is down@deftypevr Macro int EHOSTDOWN@comment errno 64 @c DO NOT REMOVEThe remote host for a requested network connection is down.@end deftypevr@comment errno.h@comment BSD: No route to host@deftypevr Macro int EHOSTUNREACH@comment errno 65 @c DO NOT REMOVEThe remote host for a requested network connection is not reachable.@end deftypevr@comment errno.h@comment POSIX.1: Directory not empty@deftypevr Macro int ENOTEMPTY@comment errno 66 @c DO NOT REMOVEDirectory not empty, where an empty directory was expected.  Typically,this error occurs when you are trying to delete a directory.@end deftypevr@comment errno.h@comment BSD: Too many processes@deftypevr Macro int EPROCLIM@comment errno 67 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: Too many users@deftypevr Macro int EUSERS@comment errno 68 @c DO NOT REMOVEThe file quota system is confused because there are too many users.@c This can probably happen in a GNU system when using NFS.@end deftypevr@comment errno.h@comment BSD: Disc quota exceeded@deftypevr Macro int EDQUOT@comment errno 69 @c DO NOT REMOVEThe user's disk quota was exceeded.@end deftypevr@comment errno.h@comment BSD: Stale NFS file handle@deftypevr Macro int ESTALE@comment errno 70 @c DO NOT REMOVEStale NFS file handle.  This indicates an internal confusion in the NFSsystem which is due to file system rearrangements on the server host.Repairing this condition usually requires unmounting and remountingthe NFS file system on the local host.@end deftypevr@comment errno.h@comment BSD: Too many levels of remote in path@deftypevr Macro int EREMOTE@comment errno 71 @c DO NOT REMOVEAn attempt was made to NFS-mount a remote file system with a file name thatalready specifies an NFS-mounted file.(This is an error on some operating systems, but we expect it to workproperly on the GNU system, making this error code impossible.)@end deftypevr@comment errno.h@comment BSD: RPC struct is bad@deftypevr Macro int EBADRPC@comment errno 72 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: RPC version wrong@deftypevr Macro int ERPCMISMATCH@comment errno 73 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: RPC program not available@deftypevr Macro int EPROGUNAVAIL@comment errno 74 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: RPC program version wrong@deftypevr Macro int EPROGMISMATCH@comment errno 75 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: RPC bad procedure for program@deftypevr Macro int EPROCUNAVAIL@comment errno 76 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment POSIX.1: No locks available@deftypevr Macro int ENOLCK@comment errno 77 @c DO NOT REMOVENo locks available.  This is used by the file locking facilities;see @ref{File Locks}.This error never occurs in the GNU system.@end deftypevr@comment errno.h@comment BSD: Inappropriate file type or format@deftypevr Macro int EFTYPE@comment errno 79 @c DO NOT REMOVEInappropriate file type or format.  The file was the wrong type for theoperation, or a data file had the wrong format.On some systems @code{chmod} returns this error if you try to set thesticky bit on a non-directory file; @pxref{Setting Permissions}.@end deftypevr@comment errno.h@comment BSD: Authentication error@deftypevr Macro int EAUTH@comment errno 80 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment BSD: Need authenticator@deftypevr Macro int ENEEDAUTH@comment errno 81 @c DO NOT REMOVE???@end deftypevr@comment errno.h@comment POSIX.1: Function not implemented@deftypevr Macro int ENOSYS@comment errno 78 @c DO NOT REMOVEFunction not implemented.  Some functions have commands or options definedthat might not be supported in all implementations, and this is the kindof error you get if you request them and they are not supported.@end deftypevr@comment errno.h@comment GNU: Inappropriate operation for background process@deftypevr Macro int EBACKGROUND@comment errno 100 @c DO NOT REMOVEIn the GNU system, servers supporting the @code{term} protocol returnthis error for certain operations when the caller is not in theforeground process group of the terminal.  Users do not usually see thiserror because functions such as @code{read} and @code{write} translateit into a @code{SIGTTIN} or @code{SIGTTOU} signal.  @xref{Job Control},for information on process groups and these signals.@end deftypevr@comment errno.h@comment GNU: Translator died@deftypevr Macro int EDIED@comment errno 101 @c DO NOT REMOVEIn the GNU system, opening a file returns this error when the file istranslated by a program and the translator program dies while startingup, before it has connected to the file.@end deftypevr@comment errno.h@comment GNU: ?@deftypevr Macro int ED@comment errno 102 @c DO NOT REMOVEThe experienced user will know what is wrong.@end deftypevr@comment errno.h@comment GNU: You really blew it this time@deftypevr Macro int EGREGIOUS@comment errno 103 @c DO NOT REMOVEYou did @strong{what}?@end deftypevr@comment errno.h@comment GNU: Computer bought the farm@deftypevr Macro int EIEIO@comment errno 104 @c DO NOT REMOVEGo home and have a glass of warm, dairy-fresh milk.@end deftypevr@comment errno.h@comment GNU: Gratuitous error@deftypevr Macro int EGRATUITOUS@comment errno 105 @c DO NOT REMOVEThis error code has no purpose.@end deftypevr@node Error Messages,  , Error Codes, Error Reporting@section Error MessagesThe library has functions and variables designed to make it easy foryour program to report informative error messages in the customaryformat about the failure of a library call.  The functions@code{strerror} and @code{perror} give you the standard error messagefor a given error code; the variable@code{program_invocation_short_name} gives you convenient access to thename of the program that encountered the error.@comment string.h@comment ANSI@deftypefun {char *} strerror (int @var{errnum})The @code{strerror} function maps the error code (@pxref{Checking forErrors}) specified by the @var{errnum} argument to a descriptive errormessage string.  The return value is a pointer to this string.The value @var{errnum} normally comes from the variable @code{errno}.You should not modify the string returned by @code{strerror}.  Also, ifyou make subsequent calls to @code{strerror}, the string might beoverwritten.  (But it's guaranteed that no library function ever calls@code{strerror} behind your back.)The function @code{strerror} is declared in @file{string.h}.@end deftypefun@comment stdio.h@comment ANSI@deftypefun void perror (const char *@var{message})This function prints an error message to the stream @code{stderr};see @ref{Standard Streams}.If you call @code{perror} with a @var{message} that is either a nullpointer or an empty string, @code{perror} just prints the error message corresponding to @code{errno}, adding a trailing newline.If you supply a non-null @var{message} argument, then @code{perror}prefixes its output with this string.  It adds a colon and a space character to separate the @var{message} from the error string correspondingto @code{errno}.The function @code{perror} is declared in @file{stdio.h}.@end deftypefun@code{strerror} and @code{perror} produce the exact same message for anygiven error code; the precise text varies from system to system.  On theGNU system, the messages are fairly short; there are no multi-linemessages or embedded newlines.  Each error message begins with a capitalletter and does not include any terminating punctuation.@strong{Compatibility Note:}  The @code{strerror} function is a newfeature of ANSI C.  Many older C systems do not support this functionyet.@cindex program name@cindex name of running programMany programs that don't read input from the terminal are designed toexit if any system call fails.  By convention, the error message fromsuch a program should start with the program's name, sans directories.You can find that name in the variable@code{program_invocation_short_name}; the full file name is stored thevariable @code{program_invocation_name}:@comment errno.h@comment GNU@deftypevar {char *} program_invocation_name This variable's value is the name that was used to invoke the programrunning in the current process.  It is the same as @code{argv[0]}.  Notethat this is not necessarily a useful file name; often it contains nodirectory names.  @xref{Program Arguments}.@end deftypevar@comment errno.h@comment GNU@deftypevar {char *} program_invocation_short_name This variable's value is the name that was used to invoke the programrunning in the current process, with directory names removed.  (That isto say, it is the same as @code{program_invocation_name} minuseverything up to the last slash, if any.)@end deftypevarThe library initialization code sets up both of these variables beforecalling @code{main}.@strong{Portability Note:} These two variables are GNU extensions.  Ifyou want your program to work with non-GNU libraries, you must save thevalue of @code{argv[0]} in @code{main}, and then strip off the directorynames yourself.  We added these extensions to make it possible to writeself-contained error-reporting subroutines that require no explicitcooperation from @code{main}.Here is an example showing how to handle failure to open a filecorrectly.  The function @code{open_sesame} tries to open the named filefor reading and returns a stream if successful.  The @code{fopen}library function returns a null pointer if it couldn't open the file forsome reason.  In that situation, @code{open_sesame} constructs anappropriate error message using the @code{strerror} function, andterminates the program.  If we were going to make some other librarycalls before passing the error code to @code{strerror}, we'd have tosave it in a local variable instead, because those other libraryfunctions might overwrite @code{errno} in the meantime.@smallexample#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>FILE *open_sesame (char *name)@{   FILE *stream;  errno = 0;                       stream = fopen (name, "r");  if (stream == NULL)    @{      fprintf (stderr, "%s: Couldn't open file %s; %s\n",               program_invocation_short_name, name, strerror (errno));      exit (EXIT_FAILURE);    @}  else    return stream;@}@end smallexample

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -