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

feat: add aio for solarish #4033

Merged
merged 1 commit into from
Nov 16, 2024
Merged

feat: add aio for solarish #4033

merged 1 commit into from
Nov 16, 2024

Conversation

Berrysoft
Copy link
Contributor

@Berrysoft Berrysoft commented Nov 13, 2024

Description

AIO series method for solarish. The values and signatures are from illumos headers and solaris manual.

Closes #4031

Sources

https://www.illumos.org/man/3HEAD/aio.h
https://docs.oracle.com/cd/E88353_01/html/E37842/aio.h-3head.html
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/sys/aiocb.h
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/sys/aio.h
https://github.com/illumos/illumos-gate/blob/master/usr/src/head/aio.h

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2024

Some changes occurred in solarish module

cc @jclulow, @pfmooney

src/unix/solarish/mod.rs Outdated Show resolved Hide resolved
src/unix/solarish/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @jclulow mentioned, it is probably better to just make all fields public.

Cc @psumbera for the Solaris side

libc-test/build.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jclulow jclulow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Nov 13, 2024
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jclulow for taking a look.

Changes look fine to me, I'll give psumbera a day or so to ack. @Berrysoft please squash & rebase to drop the merge commits.

@bors
Copy link
Contributor

bors commented Nov 14, 2024

☔ The latest upstream changes (presumably #3962) made this pull request unmergeable. Please resolve the merge conflicts.

@psumbera
Copy link
Contributor

When I try to build it on Solaris it fails with following errors:

warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_field_type_aiocb_aio_state':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14289:28: error: returning 'char *' from a function with incompatible return type 'int *' [-Werror=incompatible-pointer-types]
warning: libc-test@0.2.151: 14289 |                     return &b->aio_state;
warning: libc-test@0.2.151:       |                            ^~~~~~~~~~~~~
warning: libc-test@0.2.151: In file included from /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:3:
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_offset_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14294:51: error: 'struct aiocb' has no member named 'aio__pad'; did you mean 'aio__pad1'?
warning: libc-test@0.2.151: 14294 |                     return offsetof(struct aiocb, aio__pad);
warning: libc-test@0.2.151:       |                                                   ^~~~~~~~
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_fsize_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14298:40: error: 'struct aiocb' has no member named 'aio__pad'; did you mean 'aio__pad1'?
warning: libc-test@0.2.151: 14298 |                     return sizeof(foo->aio__pad);
warning: libc-test@0.2.151:       |                                        ^~~~~~~~
warning: libc-test@0.2.151:       |                                        aio__pad1
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_field_type_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14303:32: error: 'struct aiocb' has no member named 'aio__pad'; did you mean 'aio__pad1'?
warning: libc-test@0.2.151: 14303 |                     return &b->aio__pad;
warning: libc-test@0.2.151:       |                                ^~~~~~~~
warning: libc-test@0.2.151:       |                                aio__pad1
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_offset_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14295:17: error: control reaches end of non-void function [-Werror=return-type]
warning: libc-test@0.2.151: 14295 |                 }
warning: libc-test@0.2.151:       |                 ^
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_fsize_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14299:17: error: control reaches end of non-void function [-Werror=return-type]
warning: libc-test@0.2.151: 14299 |                 }
warning: libc-test@0.2.151:       |                 ^
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: In function '__test_field_type_aiocb_aio__pad':
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c:14304:17: error: control reaches end of non-void function [-Werror=return-type]
warning: libc-test@0.2.151: 14304 |                 }
warning: libc-test@0.2.151:       |                 ^
warning: libc-test@0.2.151: /export/home/test/libc-test/target/debug/build/libc-test-92ec05da49c87b20/out/main.c: At top level:
warning: libc-test@0.2.151: cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
warning: libc-test@0.2.151: cc1: all warnings being treated as errors

Seems that Solaris /usr/include/sys/aiocb.h was modified since the Illumos fork:

---aiocb.h.illumos
+++ /usr/include/sys/aiocb.h
@@ -47,8 +23,10 @@
        struct sigevent aio_sigevent;           /* notification type */
        int             aio_lio_opcode;         /* listio operation */
        aio_result_t    aio_resultp;            /* results */
-       int             aio_state;              /* state flag for List I/O */
-       int             aio__pad[1];            /* extension padding */
+       char            aio_state;              /* state flag for List I/O */
+       char            aio_returned;           /* aio_return() was called */
+       char            aio__pad1[2];           /* extension padding */
+       int             aio_flags;
 } aiocb_t;

 #ifdef _LARGEFILE64_SOURCE
@@ -62,8 +40,10 @@
        struct sigevent aio_sigevent;           /* notification type */
        int             aio_lio_opcode;         /* listio operation */
        aio_result_t    aio_resultp;            /* results */
-       int             aio_state;              /* state flag for List I/O */
-       int             aio__pad[1];            /* extension padding */
+       char            aio_state;              /* state flag for List I/O */
+       char            aio_returned;           /* aio_return() was called */
+       char            aio__pad1[2];           /* extension padding */
+       int             aio_flags;
 } aiocb64_t;
 #else

@@ -80,8 +60,10 @@
        struct sigevent32 aio_sigevent;         /* notification type */
        int             aio_lio_opcode;         /* listio operation */
        aio_result32_t  aio_resultp;            /* results */
-       int             aio_state;              /* state flag for List I/O */
-       int             aio__pad[1];            /* extension padding */
+       char            aio_state;              /* state flag for List I/O */
+       char            aio_returned;           /* aio_return() was called */
+       char            aio__pad1[2];           /* extension padding */
+       int             aio_flags;
 } aiocb64_32_t;

 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
@@ -101,8 +83,10 @@
        struct sigevent32 aio_sigevent;         /* notification type */
        int             aio_lio_opcode;         /* listio operation */
        aio_result32_t  aio_resultp;            /* results */
-       int             aio_state;              /* state flag for List I/O */
-       int             aio__pad[1];            /* extension padding */
+       char            aio_state;              /* state flag for List I/O */
+       char            aio_returned;           /* aio_return() was called */
+       char            aio__pad1[2];           /* extension padding */
+       int             aio_flags;
 } aiocb32_t;

 #endif /* _SYSCALL32 */

Hopefully proposed CI for Solaris (#4035) will help here soon.

BTW You can also inspect latest Solaris system at https://portal.cfarm.net/machines/list/ (cfarm215 and cfarm216).

@Berrysoft
Copy link
Contributor Author

Thank you, @psumbera ! I have changed the definition of aiocb according to your diff.

@psumbera
Copy link
Contributor

Thank you, @psumbera ! I have changed the definition of aiocb according to your diff.

Thank you! The tests now pass on Solaris.

@Berrysoft
Copy link
Contributor Author

I think the failed check is not related to this PR:)

@tgross35
Copy link
Contributor

I think the failed check is not related to this PR:)

Indeed, they should be fixed by rust-lang/rust#133050 (hopefully tomorrow's nightly)

@tgross35 tgross35 enabled auto-merge November 16, 2024 04:59
@tgross35 tgross35 added this pull request to the merge queue Nov 16, 2024
@tgross35 tgross35 removed this pull request from the merge queue due to a manual request Nov 16, 2024
@tgross35 tgross35 added this pull request to the merge queue Nov 16, 2024
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 16, 2024
(backport <rust-lang#4033>)
(cherry picked from commit ccc0b07)
@tgross35 tgross35 mentioned this pull request Nov 16, 2024
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 16, 2024
(backport <rust-lang#4033>)
(cherry picked from commit ccc0b07)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 16, 2024
(backport <rust-lang#4033>)
(cherry picked from commit ccc0b07)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Nov 16, 2024
(backport <rust-lang#4033>)
(cherry picked from commit ccc0b07)
Merged via the queue into rust-lang:main with commit 936a356 Nov 16, 2024
43 checks passed
@Berrysoft Berrysoft deleted the illumos-aio branch November 16, 2024 06:30
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-illumos O-solarish O-unix O-wasm S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API request: AIO methods for illumos & solaris
7 participants