err(3) Library Functions Manual err(3) err, verr, errx, verrx, warn, vwarn, warnx, vwarnx - (libc -lc) #include [[noreturn]] void err(int eval, const char *fmt, ...); [[noreturn]] void errx(int eval, const char *fmt, ...); void warn(const char *fmt, ...); void warnx(const char *fmt, ...); #include [[noreturn]] void verr(int eval, const char *fmt, va_list args); [[noreturn]] void verrx(int eval, const char *fmt, va_list args); void vwarn(const char *fmt, va_list args); void vwarnx(const char *fmt, va_list args); err() warn() . . fmt NULL printf(3). . err() verr() warn() vwarn() strerror(3) errno fmt NULL. errx() warnx() . err() verr() errx() verrx() eval. attributes(7). +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ | | | | +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ |err() errx() | | (locale) (MT-Safe) | |warn() warnx() | | | |verr() verrx() | | | |vwarn() vwarnx() | | | +----------------------+------------------------------------+---------------------------------------------------------------------------------------------+ BSD. err() warn() 4.4BSD. errno : p = malloc(size); if (p == NULL) err(EXIT_FAILURE, NULL); fd = open(file_name, O_RDONLY, 0); if (fd == -1) err(EXIT_FAILURE, "%s", file_name); : if (tm.tm_hour < START_TIME) errx(EXIT_FAILURE, "too early, wait until %s", start_time_string); : fd = open(raw_device, O_RDONLY, 0); if (fd == -1) warnx("%s: %s: trying the block device", raw_device, strerror(errno)); fd = open(block_device, O_RDONLY, 0); if (fd == -1) err(EXIT_FAILURE, "%s", block_device); error(3) exit(3) perror(3) printf(3) strerror(3) 3 . . : . 6.18 17 2025 err(3)