File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ add_library(psl-native SHARED
2121 createhardlink.cpp
2222 createsymlink.cpp
2323 followsymlink.cpp
24- createprocess.cpp )
24+ createprocess.cpp
25+ nativesyslog.cpp )
2526
2627target_include_directories (psl-native PUBLIC ${CMAKE_CURRENT_SOURCE_DIR } )
Original file line number Diff line number Diff line change 1+ // ! @file nativesyslog.cpp
2+ // ! @brief Provides wrappers around the syslog apis to support exporting
3+ // ! for PInvoke calls by powershell.
4+ // ! These functions are intended only for PowerShell internal use.
5+ #include < syslog.h>
6+ #include < nativesyslog.h>
7+
8+ // ! @brief Native_SysLog is a wrapper around the syslog api.
9+ // ! It explicitly passes the message as a parameter to a %s format
10+ // ! string since the message may have arbitray characters that can
11+ // ! be misinterpreted as format specifiers.
12+ // !
13+ // ! @retval none.
14+ extern " C" void Native_SysLog (int32_t priority, const char * message)
15+ {
16+ syslog (priority, " %s" , message);
17+ }
18+
19+ // ! @brief Native_OpenLog is a wrapper around the openlog, syslog api.
20+ // ! it allows passing an ident and facility but uses an explicit
21+ // ! option value for consistent logging across powershell instances.
22+ // !
23+ // ! @retval none.
24+ extern " C" void Native_OpenLog (const char * ident, int facility)
25+ {
26+ openlog (ident, LOG_NDELAY | LOG_PID , facility);
27+ }
28+
29+ // ! @brief Native_OpenLog is a wrapper around the closelog, syslog api.
30+ // !
31+ // ! @retval none.
32+ extern " C" void Native_CloseLog ()
33+ {
34+ closelog ();
35+ }
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include "pal.h"
4+
5+ PAL_BEGIN_EXTERNC
6+
7+ void Native_OpenLog (const char * ident , int facility );
8+ void Native_SysLog (int32_t priority , const char * message );
9+ void Native_CloseLog ();
10+
11+ PAL_END_EXTERNC
You can’t perform that action at this time.
0 commit comments