| 1 |
'\" t |
| 2 |
.\" Copyright 2001, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH setlogmask 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
setlogmask \- set log priority mask |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <syslog.h> |
| 16 |
.P |
| 17 |
.BI "int setlogmask(int " mask ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
A process has a log priority mask that determines which calls to |
| 21 |
.BR syslog (3) |
| 22 |
may be logged. |
| 23 |
All other calls will be ignored. |
| 24 |
Logging is enabled for the priorities that have the corresponding |
| 25 |
bit set in |
| 26 |
.IR mask . |
| 27 |
The initial mask is such that logging is enabled for all priorities. |
| 28 |
.P |
| 29 |
The |
| 30 |
.BR setlogmask () |
| 31 |
function sets this logmask for the calling process, |
| 32 |
and returns the previous mask. |
| 33 |
If the |
| 34 |
.I mask |
| 35 |
argument is |
| 36 |
.BR 0 , |
| 37 |
the current logmask is not modified. |
| 38 |
.P |
| 39 |
The eight priorities are |
| 40 |
.BR LOG_EMERG , |
| 41 |
.BR LOG_ALERT , |
| 42 |
.BR LOG_CRIT , |
| 43 |
.BR LOG_ERR , |
| 44 |
.BR LOG_WARNING , |
| 45 |
.BR LOG_NOTICE , |
| 46 |
.BR LOG_INFO , |
| 47 |
and |
| 48 |
.BR LOG_DEBUG . |
| 49 |
The bit corresponding to a priority |
| 50 |
.I p |
| 51 |
is |
| 52 |
.IR LOG_MASK(p) . |
| 53 |
Some systems also provide a macro |
| 54 |
.I LOG_UPTO(p) |
| 55 |
for the mask |
| 56 |
of all priorities in the above list up to and including |
| 57 |
.IR p . |
| 58 |
.SH RETURN VALUE |
| 59 |
This function returns the previous log priority mask. |
| 60 |
.SH ERRORS |
| 61 |
None. |
| 62 |
.\" .SH NOTES |
| 63 |
.\" The glibc logmask handling was broken before glibc 2.1.1. |
| 64 |
.SH ATTRIBUTES |
| 65 |
For an explanation of the terms used in this section, see |
| 66 |
.BR attributes (7). |
| 67 |
.TS |
| 68 |
allbox; |
| 69 |
lbx lb lb |
| 70 |
l l l. |
| 71 |
Interface Attribute Value |
| 72 |
T{ |
| 73 |
.na |
| 74 |
.nh |
| 75 |
.BR setlogmask () |
| 76 |
T} Thread safety MT-Unsafe race:LogMask |
| 77 |
.TE |
| 78 |
.SH STANDARDS |
| 79 |
POSIX.1-2008. |
| 80 |
.SH HISTORY |
| 81 |
POSIX.1-2001. |
| 82 |
.\" Note that the description in POSIX.1-2001 is flawed. |
| 83 |
.P |
| 84 |
.BR LOG_UPTO () |
| 85 |
will be included in the next release of the POSIX specification (Issue 8). |
| 86 |
.\" FIXME . https://www.austingroupbugs.net/view.php?id=1033 |
| 87 |
.SH SEE ALSO |
| 88 |
.BR closelog (3), |
| 89 |
.BR openlog (3), |
| 90 |
.BR syslog (3) |