1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

lang/zig: backport syslog functions from master

These will eventually land in zig 0.8.0

Sponsored by:	SkunkWerks, GmbH
This commit is contained in:
Dave Cottlehuber 2021-03-29 09:23:43 +00:00
parent b53465e825
commit 8b21b00848
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=569453
4 changed files with 73 additions and 0 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= zig
DISTVERSION= 0.7.1
PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= https://ziglang.org/download/${DISTVERSION}/ \
https://ziglang.org/builds/

View File

@ -0,0 +1,23 @@
--- lib/std/c.zig.orig 2020-12-13 19:14:58 UTC
+++ lib/std/c.zig
@@ -346,3 +346,20 @@ pub extern "c" fn prctl(option: c_int, ...) c_int;
pub extern "c" fn getrlimit(resource: rlimit_resource, rlim: *rlimit) c_int;
pub extern "c" fn setrlimit(resource: rlimit_resource, rlim: *const rlimit) c_int;
+
+pub extern "c" fn fmemopen(noalias buf: ?*c_void, size: usize, noalias mode: [*:0]const u8) ?*FILE;
+
+pub extern "c" fn syslog(priority: c_int, message: [*:0]const u8, ...) void;
+pub extern "c" fn openlog(ident: [*:0]const u8, logopt: c_int, facility: c_int) void;
+pub extern "c" fn closelog() void;
+pub extern "c" fn setlogmask(maskpri: c_int) c_int;
+
+pub const max_align_t = if (std.Target.current.abi == .msvc)
+ f64
+else if (std.Target.current.isDarwin())
+ c_longdouble
+else
+ extern struct {
+ a: c_longlong,
+ b: c_longdouble,
+ };

View File

@ -0,0 +1,25 @@
--- lib/std/os/bits.zig.orig 2020-12-13 19:14:58 UTC
+++ lib/std/os/bits.zig
@@ -34,3 +34,22 @@ pub const iovec_const = extern struct {
iov_base: [*]const u8,
iov_len: usize,
};
+
+// syslog
+
+/// system is unusable
+pub const LOG_EMERG = 0;
+/// action must be taken immediately
+pub const LOG_ALERT = 1;
+/// critical conditions
+pub const LOG_CRIT = 2;
+/// error conditions
+pub const LOG_ERR = 3;
+/// warning conditions
+pub const LOG_WARNING = 4;
+/// normal but significant condition
+pub const LOG_NOTICE = 5;
+/// informational
+pub const LOG_INFO = 6;
+/// debug-level messages
+pub const LOG_DEBUG = 7;

View File

@ -0,0 +1,24 @@
--- lib/std/os/bits/freebsd.zig.orig 2020-12-13 19:14:58 UTC
+++ lib/std/os/bits/freebsd.zig
@@ -15,6 +15,7 @@ pub const gid_t = u32;
pub const mode_t = c_uint;
pub const socklen_t = u32;
+pub const suseconds_t = c_long;
/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
pub const Kevent = extern struct {
@@ -159,6 +160,13 @@ pub const libc_stat = extern struct {
pub const timespec = extern struct {
tv_sec: isize,
tv_nsec: isize,
+};
+
+pub const timeval = extern struct {
+ /// seconds
+ tv_sec: time_t,
+ /// microseconds
+ tv_usec: suseconds_t,
};
pub const dirent = extern struct {