#Possibly a bug in `sendmmsg` in `linux.zig`

1 messages · Page 1 of 1 (latest)

compact zinc
#

I'm trying to use sendmmsg in Zig, my code looks roughly like so:

    const message: [1460]u8 = undefined;
    while (true) {
        var messages: [1024]os.linux.mmsghdr_const = undefined;
        var io_vects: [1024]os.iovec_const = undefined;

        var i: usize = 0;
        while (i < messages.len) : (i += 1) {
            io_vects[i].iov_base = &message;
            io_vects[i].iov_len = message.len;
            messages[i].msg_hdr.iov = @ptrCast([*]os.iovec_const, &io_vects[i]);
            messages[i].msg_hdr.iovlen = 1;
        }

        _ = os.linux.sendmmsg(socket, &messages, messages.len, 0);
    }

When compiling this I get this:

0.10.1/lib/zig/std/os/linux.zig:1243:55: error: type 'type' not a function
    if (@typeInfo(usize).Int.bits > @typeInfo(@TypeOf(mmsghdr(undefined).msg_len)).Int.bits) {
                                                      ^~~~~~~

I took a look at the line that's erroring1 and the type2 but I don't know enough Zig yet to understand what (undefined) means here, it looks like the type may have used to be generic but no longer is?

spring oracle
#

most likely a bug in the standard library, and i see its still there on master lol

compact zinc
#

Yeah that's what made me doubt hahaha, so I'm the first person to call this in 2+ years I guess

#

I'll open an issue then, thanks for double checking my zig noobiness

spring oracle
#

np