Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posixlib errno.scala is incomplete #2716

Closed
LeeTibbert opened this issue Jul 10, 2022 · 2 comments
Closed

posixlib errno.scala is incomplete #2716

LeeTibbert opened this issue Jul 10, 2022 · 2 comments
Labels
has pr There is a pending PR that addresses this issue

Comments

@LeeTibbert
Copy link
Contributor

LeeTibbert commented Jul 10, 2022

  1. According to the POSIX 2018 specification for errno.h, the following ought to
    provide access to the errno variable:

    import scala.scalanative.posix.{errno => posixErrno, posixErrno.errno}
    

    [I will note and skip in passing the long standing flaw of the object having been named (lower case) errno,
    causing conflict with the enclosed variable. Fi!]

    Currently, in order to work in POSIX land, and use both errno and POSIX defined
    values for errno, one must import the variable errno from clib and then the
    values from posixib. The latter is comprehensible, the former is a case where
    we can and should do better.

     // Taken directly from unit-tests TimeTest.scala
     // Declare as:
     import scalanative.libc.{errno => libcErrno}
     import scala.scalanative.posix.errno.{EINVAL, EINTR}
    
    // Use as:
    assertEquals(
        s"clock_nanosleep failed with errno: ${libcErrno.errno}",
        EINTR,
        libcErrno.errno
      )
    
  2. The list of possible values for errno should be checked against the specification.
    I know of no missing value but believe that validation would be worthwhile,
    if only bringing (my) peace of mind.

    Later: posixlib errno.scala was compared to the 2018 POSIX specification
    and the symbol EADDRNOTAVAIL was found to be missing in
    the former. See Issue posixlib errno.scala is missing symbol EADDRNOTAVAIL #2717.

@LeeTibbert
Copy link
Contributor Author

LeeTibbert commented Jul 10, 2022

I have posixlib errno variable working in my private area and hope to submit it after
PR #2718 is merged. That will keep the changes associated with the two different
concepts separated and ease PR submission & review.

The steps of the dance each take time...

@LeeTibbert LeeTibbert added the has pr There is a pending PR that addresses this issue label Jul 12, 2022
@LeeTibbert
Copy link
Contributor Author

resolved by merged PR #2721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has pr There is a pending PR that addresses this issue
Projects
None yet
Development

No branches or pull requests

1 participant