Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perror(2) [plan9 man page]

PERROR(2)							System Calls Manual							 PERROR(2)

NAME
perror, syslog - system error messages SYNOPSIS
#include <u.h> #include <libc.h> void perror(char *s) void syslog(int cons, char *logname, char *fmt, ...) DESCRIPTION
Perror produces a short error message on the standard error file describing the last error encountered during a call to the system. First the argument string s is printed, then a colon, then the message and a newline. If s is 0, only the error message and newline are printed. Syslog logs messages in the file named by logname in the directory /sys/log; the file must already exist and should be append-only. Log- name must contain no slashes. The message is a line with several fields: the name of the machine writing the message; the date and time; the message specified by the print(2) format fmt and any following arguments; and a final newline. If cons is set or the log file cannot be opened, the message is also printed on the system console. Syslog can be used safely in multi-threaded programs. SOURCE
/sys/src/libc/port/perror.c /sys/src/libc/9sys/syslog.c SEE ALSO
intro(2), errstr(2), the %r format in print(2) BUGS
Perror is a holdover; the %r format in print(2) is preferred. PERROR(2)

Check Out this Related Man Page

PERROR(3)							 Library functions							 PERROR(3)

NAME
perror - print a system error message SYNOPSIS
#include <stdio.h> void perror(const char *s); #include <errno.h> const char *sys_errlist[]; int sys_nerr; DESCRIPTION
The routine perror() produces a message on the standard error output, describing the last error encountered during a call to a system or library function. First (if s is not NULL and *s is not NUL) the argument string s is printed, followed by a colon and a blank. Then the message and a new-line. To be of most use, the argument string should include the name of the function that incurred the error. The error number is taken from the external variable errno, which is set when errors occur but not cleared when non-erroneous calls are made. The global error list sys_errlist[] indexed by errno can be used to obtain the error message without the newline. The largest message num- ber provided in the table is sys_nerr -1. Be careful when directly accessing this list because new error values may not have been added to sys_errlist[]. When a system call fails, it usually returns -1 and sets the variable errno to a value describing what went wrong. (These values can be found in <errno.h>.) Many library functions do likewise. The function perror() serves to translate this error code into human-readable form. Note that errno is undefined after a successful library call: this call may well change this variable, even though it succeeds, for example because it internally used some other library function that failed. Thus, if a failing call is not immediately followed by a call to perror, the value of errno should be saved. CONFORMING TO
ANSI C, BSD 4.3, POSIX, X/OPEN SEE ALSO
strerror(3) 2001-12-14 PERROR(3)
Man Page

11 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

What does this error mean

What does this error mean: We only support non-print format, sorry. (5 Replies)
Discussion started by: jsalz638
5 Replies

2. Linux

Syslog in Fedora 7

I have a next problem. After settings remote logs in my DSL-Router DLink 500T i be recive messages in /var/log/message. Nov 4 12:42:15 gw pppd: Jan 1 12:03:30> Connection terminated. Nov 4 12:42:43 gw cfgmgr(sar): Jan 1 12:00:20> DSL Carrier is down Nov 4 12:42:53 gw cfgmgr(sar): Jan ... (1 Reply)
Discussion started by: jess_t03
1 Replies

3. Shell Programming and Scripting

awk how to print if the search pattern contains speace

the data file is as below: > cat master.cnf /usr| location for usr|5 /src/ver1| version 1 |10 /src/ver2/log| ver 2 log |25 /src/sys/apps/log| Application log for sys|36 /src/sys/apps/conf| configuration location for app|45 /src/sys/apps/bin| binary location app|55my script is as below: ... (1 Reply)
Discussion started by: McLan
1 Replies

4. Shell Programming and Scripting

Error while trying to print message

Hi all Geting this error while trying to print message as : ./logfunc: print: bad file unit number heres what i m trying to do : log_date="$(date '+%d/%m/%Y %H:%M:%S')" log_type="Message" print "${log_date}: ${log_type}" print -u3 "${log_date}: ${log_type}" this error is due to... (3 Replies)
Discussion started by: Navatha
3 Replies

5. UNIX for Dummies Questions & Answers

What does this error message mean?

I was reviewing logs and I got this error message in /var/log/messages: Did not receive identification string from (IP ADDRESS) What does it mean? (6 Replies)
Discussion started by: mojoman
6 Replies

6. Shell Programming and Scripting

Splitting a variable based on newline char

Heeloo all, A weird problem perhaps. May god save others from this problem. I want to print each line from a variable.. the example below should make it clear. smvar="Hello World1 Hello world 2 forgot there I guess" for eachline in $smvar echo $eachline end Whats for... (3 Replies)
Discussion started by: pavanlimo
3 Replies

7. Programming

A question about printing error message with perror

Dear all, I use perror in order to print an error message to the standar error. For example if a C program is called without its two necessary command line parameters then : if (argc != 3) { perror("use: ./myProgram <source file> <target file>\n"); return 1; } Now the... (2 Replies)
Discussion started by: dariyoosh
2 Replies

8. Shell Programming and Scripting

Retrieving Information From A Syslog File

Hi, I have a number of firewalls that send there traffic logs to a syslog server. Each log entry takes up about 3 lines and the text within the log entry is delimited by a space. There are parts of the three lines that I need from every traffic log entry. I have been using a combination of sed,... (2 Replies)
Discussion started by: andyblaylock
2 Replies

9. UNIX for Advanced & Expert Users

Pros and cons of a Journaled file System

Hello, Could anyone please enumerate some of the pros and cons to using a Journaled FileSystem? ---------- Post updated at 02:46 PM ---------- Previous update was at 02:45 PM ---------- I know clearly not losing data during a failed move or copy is a big pro, correct? Let's build off of... (8 Replies)
Discussion started by: glev2005
8 Replies

10. Solaris

Syslog duplicate messages

I've heard that syslog in Solaris10 doesn't repeat duplicate messages and displays "last message repeated n times." Is there a way to increase the time interval, so that more messages are recognized as duplicates? thanks. (0 Replies)
Discussion started by: orange47
0 Replies

11. UNIX for Advanced & Expert Users

Syslog-ng not working not collecting logs on rhel

Hi, I need help on syslog-ng on RHEL 7.2. It is working as expected. As per configuration, it is supposed to create authlog, messages and xymessages daily in respective folder of date. But I can see only messages file and that is also not updating well. # ps -ef | grep -i syslog root 22954... (1 Reply)
Discussion started by: solaris_1977
1 Replies