Index: lib/libc/gen/Makefile.inc =================================================================== --- lib/libc/gen/Makefile.inc (wersja 217978) +++ lib/libc/gen/Makefile.inc (kopia robocza) @@ -176,8 +176,8 @@ stringlist.3 sl_free.3 stringlist.3 sl_init.3 MLINKS+=strtofflags.3 fflagstostr.3 MLINKS+=sysctl.3 sysctlbyname.3 sysctl.3 sysctlnametomib.3 -MLINKS+=syslog.3 closelog.3 syslog.3 openlog.3 syslog.3 setlogmask.3 \ - syslog.3 vsyslog.3 +MLINKS+=syslog.3 closelog.3 syslog.3 logfileno.3 syslog.3 openlog.3 \ + syslog.3 setlogmask.3 syslog.3 vsyslog.3 MLINKS+=tcsendbreak.3 tcdrain.3 tcsendbreak.3 tcflow.3 tcsendbreak.3 tcflush.3 MLINKS+=tcsetattr.3 cfgetispeed.3 tcsetattr.3 cfgetospeed.3 \ tcsetattr.3 cfmakeraw.3 tcsetattr.3 cfmakesane.3 \ Index: lib/libc/gen/Symbol.map =================================================================== --- lib/libc/gen/Symbol.map (wersja 217978) +++ lib/libc/gen/Symbol.map (kopia robocza) @@ -365,6 +365,7 @@ getutxid; getutxline; getutxuser; + logfileno; pututxline; sem_close; sem_destroy; Index: lib/libc/gen/syslog.3 =================================================================== --- lib/libc/gen/syslog.3 (wersja 217978) +++ lib/libc/gen/syslog.3 (kopia robocza) @@ -28,7 +28,7 @@ .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 30, 2004 +.Dd January 27, 2011 .Dt SYSLOG 3 .Os .Sh NAME @@ -36,7 +36,8 @@ .Nm vsyslog , .Nm openlog , .Nm closelog , -.Nm setlogmask +.Nm setlogmask , +.Nm logfileno .Nd control system log .Sh LIBRARY .Lb libc @@ -53,6 +54,8 @@ .Fn closelog void .Ft int .Fn setlogmask "int maskpri" +.Ft int +.Fn logfileno "void" .Sh DESCRIPTION The .Fn syslog @@ -248,6 +251,11 @@ is given by the macro .Fn LOG_UPTO toppri ; . The default allows all priorities to be logged. +.Pp +The +.Fn logfileno +function returns file descriptor number associated with the log file if it is +already open. .Sh RETURN VALUES The routines .Fn closelog , @@ -260,6 +268,11 @@ The routine .Fn setlogmask always returns the previous log mask level. +.Pp +The routine +.Fn logfileno +returns file descriptor number associated with the log file or \-1 if the log +file is no yet open. .Sh EXAMPLES .Bd -literal -offset indent -compact syslog(LOG_ALERT, "who: internal error 23"); Index: lib/libc/gen/syslog.c =================================================================== --- lib/libc/gen/syslog.c (wersja 217978) +++ lib/libc/gen/syslog.c (kopia robocza) @@ -433,3 +433,10 @@ THREAD_UNLOCK(); return (omask); } + +int +logfileno(void) +{ + + return (LogFile); +} Index: sys/sys/syslog.h =================================================================== --- sys/sys/syslog.h (wersja 217978) +++ sys/sys/syslog.h (kopia robocza) @@ -195,6 +195,7 @@ void syslog(int, const char *, ...) __printflike(2, 3); #if __BSD_VISIBLE void vsyslog(int, const char *, __va_list) __printflike(2, 0); +int logfileno(void); #endif __END_DECLS