Project

General

Profile

Bug #13202

reconcile const-ness in port_get and port_getn

Added by Patrick Mooney 24 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The man page for port_get and port_getn specifies that the timeout parameter is const:

SYNOPSIS
       #include <port.h>

       int port_get(int port, port_event_t *pe,
            const timespec_t *timeout);

       int port_getn(int port, port_event_t list[], uint_t max,
            uint_t *nget, const timespec_t *timeout);

When looking at the actual definitions in the header, that const-ness is lacking:

int     port_get(int, port_event_t *, struct timespec *);
int     port_getn(int, port_event_t [], uint_t, uint_t *, struct timespec *);

This isn't just an oversight in the header. The implementations in libc are defined as non-const as well:

int
port_get(int port, port_event_t *pe, struct timespec *to)
...
int
port_getn(int port, port_event_t list[], uint_t max, uint_t *nget,
    struct timespec *timeout)

When walking through the syscall logic behind those functions, the timeout is indeed treated as const. We should either fix the headers and libc, or change the man page back to skip the const decree.

No data to display

Also available in: Atom PDF