Skip to content

Conversation

@tommie
Copy link

@tommie tommie commented Dec 18, 2025

Fixes stoprocent/noble#46 by adding back the property that was dropped in 59744ec.

Fixes stoprocent/noble#46 by adding back
the property that was dropped in 59744ec.
@stoprocent
Copy link
Owner

Sorry but build is failing

@Apollon77
Copy link
Collaborator

Apollon77 commented Jan 9, 2026

it seems that "strerrorname_np" was introdiced in glibc 3.32, but we run a lower version here?

Alternative is (according to CLaude code I asked for advice) something like

// Add this helper function (e.g., at the top of the file or in a header)
const char* GetErrnoName(int err) {
    switch (err) {
        case EPERM: return "EPERM";
        case ENOENT: return "ENOENT";
        case ESRCH: return "ESRCH";
        case EINTR: return "EINTR";
        case EIO: return "EIO";
        case ENXIO: return "ENXIO";
        case E2BIG: return "E2BIG";
        case ENOEXEC: return "ENOEXEC";
        case EBADF: return "EBADF";
        case ECHILD: return "ECHILD";
        case EAGAIN: return "EAGAIN";
        case ENOMEM: return "ENOMEM";
        case EACCES: return "EACCES";
        case EFAULT: return "EFAULT";
        case ENOTBLK: return "ENOTBLK";
        case EBUSY: return "EBUSY";
        case EEXIST: return "EEXIST";
        case EXDEV: return "EXDEV";
        case ENODEV: return "ENODEV";
        case ENOTDIR: return "ENOTDIR";
        case EISDIR: return "EISDIR";
        case EINVAL: return "EINVAL";
        case ENFILE: return "ENFILE";
        case EMFILE: return "EMFILE";
        case ENOTTY: return "ENOTTY";
        case ETXTBSY: return "ETXTBSY";
        case EFBIG: return "EFBIG";
        case ENOSPC: return "ENOSPC";
        case ESPIPE: return "ESPIPE";
        case EROFS: return "EROFS";
        case EMLINK: return "EMLINK";
        case EPIPE: return "EPIPE";
        case EDOM: return "EDOM";
        case ERANGE: return "ERANGE";
        // Add more as needed for your use case
        default: return "UNKNOWN";
    }
}

...
    
    const char* errno_name = GetErrnoName(errno);
    

@tommie
Copy link
Author

tommie commented Jan 9, 2026

Oh, sorry, missed the progress here.

From Linux man, it seems strerrorname_np is a GNU extension, so perhaps that's a bad idea. BSD has sys_errlist, but it seems there's no POSIX function for it. And actually, Node has such a custom switch: https://github.com/nodejs/node/blob/a327288cc6747cf5e07656a1c45fe2f19e0926ae/src/node_errors.cc#L690

Doesn't seem to be exposed except through the ErrnoException constructor. I got the impression that dropping the use of NAN was a goal with the refactoring, but if that's not the case, we could go back to using nan::ErrnoException.

We could use errno --list from moreutils to generate a source file, if that's acceptable:

errno -l | awk 'BEGIN { print "const char *errno_string(void) {"; print "  switch (err) {" } { print "  case " $1 ": return \"" $1 "\";" } END { print "  default: return \"ERROR\";"; print "  }"; print "}" }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent failure: EPERM in exception from bluetooth-hci-socket not parsed correctly

3 participants