Skip to content

Conversation

sunshowers
Copy link
Contributor

@sunshowers sunshowers commented Feb 12, 2025

Description

Add definitions from spawn.h as present in illumos-gate (blame view). I added definitions more than 15 years old to solarish/mod.rs, and others to solarish/illumos.rs.

Sources

There are a lot of definitions here -- it's easiest to look at them in the blame view linked above. But here are the corresponding man pages:

For solarish:

Newer functions added independently to Solaris and illumos:

The one function I skipped over was posix_spawn_pipe_np -- it seemed a bit niche and I wasn't quite sure how to model boolean_t.

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 Feb 12, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2025

Some changes occurred in solarish module

cc @jclulow, @pfmooney

@sunshowers
Copy link
Contributor Author

The freebsd build failures are unrelated I believe.

@tgross35
Copy link
Contributor

Cc @psumbera for the Solaris side

CI should be fixed with #4260

@@ -14,8 +14,13 @@ POSIX_FADV_NORMAL
POSIX_FADV_RANDOM
POSIX_FADV_SEQUENTIAL
POSIX_FADV_WILLNEED
POSIX_SPAWN_SETSID
Copy link
Contributor

Choose a reason for hiding this comment

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

Solaris 11.4 does have POSIX_SPAWN_SETSID too. But it's different number:

grep POSIX_SPAWN_SETSID /usr/include/sys/spawn.h
#define POSIX_SPAWN_SETSID              0x0400
#define POSIX_SPAWN_SETSID_NP           POSIX_SPAWN_SETSID /* pre-standard */

So I think it's ok to keep it separately as you have it.

Comment on lines +192 to +193
pub const POSIX_SPAWN_SETSID: c_short = 0x400;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't see a solaris.txt, and I wasn't sure whether a definition being in both solaris.rs and illumos.rs was enough to put it in solarish.txt.

Add definitions from `spawn.h` as present [in illumos-gate (blame
view)][spawn-h]. I added definitions more than 15 years old to
`solarish/mod.rs`, and others to `solarish/illumos.rs`.

There are a lot of definitions here -- it's easiest to look at them in the
blame view linked above. But here are the corresponding man pages:

For solarish:

* [`posix_spawn`, `posix_spawnp`](https://illumos.org/man/3C/posix_spawn)
* [`posix_spawn_file_actions_{init,destroy}`](https://illumos.org/man/3C/posix_spawn_file_actions_init)
* [`posix_spawn_file_actions_{addopen,addclose}`](https://illumos.org/man/3C/posix_spawn_file_actions_addopen)
* [`posix_spawn_file_actions_adddup2`](https://illumos.org/man/3C/posix_spawn_file_actions_adddup2)
* [`posix_spawn_file_actions_addclosefrom_np`](https://illumos.org/man/3C/posix_spawn_file_actions_addclosefrom_np)
* [`posix_spawnattr_{init,destroy}`](https://illumos.org/man/3C/posix_spawnattr_init)
* [`posix_spawnattr_{setflags,getflags}`](https://illumos.org/man/3C/posix_spawnattr_setflags)
* [`posix_spawnattr_{setpgroup,getpgroup}`](https://illumos.org/man/3C/posix_spawnattr_setpgroup)
* [`posix_spawnattr_{setschedparam,getschedparam}`](https://illumos.org/man/3C/posix_spawnattr_setschedparam)
* [`posix_spawnattr_{setschedpolicy,getschedpolicy}`](https://illumos.org/man/3C/posix_spawnattr_setschedpolicy)
* [`posix_spawnattr_{setsigdefault,getsigdefault}`](https://illumos.org/man/3C/posix_spawnattr_setsigdefault)
* [`posix_spawnattr_{setsigignore,getsigignore}_np`](https://illumos.org/man/3C/posix_spawnattr_setsigignore_np)
* [`posix_spawnattr_{setsigmask,getsigmask}`](https://illumos.org/man/3C/posix_spawnattr_setsigmask)

Newer functions added independently to Solaris and illumos:

* [`posix_spawn_file_actions_{addchdir,addchdir_np,addfchdir}` on Solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/posix-spawn-file-actions-addchdir-np-3c.html)

* The illumos-only functions are quite recent so the man pages haven't been
  uploaded to illumos.org yet. But [here's the one for `addchdir` and
  `addfchdir`](https://github.com/illumos/illumos-gate/blob/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/man/man3c/posix_spawn_file_actions_addchdir.3c).
  Note that the `_np` functions are not documented in the manual, but they are
  available for compatibility.

The one function I skipped over was
[`posix_spawn_pipe_np`](https://illumos.org/man/3C/posix_spawn_pipe_np) -- it
seemed a bit niche and I wasn't quite sure how to model `boolean_t`.

[spawn-h]: https://github.com/illumos/illumos-gate/blame/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/head/spawn.h#L1
Copy link
Contributor

@psumbera psumbera left a comment

Choose a reason for hiding this comment

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

I think it's ok to go. Thank you for the changes!

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Feb 14, 2025
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!

@tgross35 tgross35 added this pull request to the merge queue Feb 14, 2025
Merged via the queue into rust-lang:main with commit 090201c Feb 14, 2025
44 checks passed
@sunshowers sunshowers deleted the illumos-posix-spawn branch February 14, 2025 20:59
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Feb 18, 2025
Add definitions from `spawn.h` as present [in illumos-gate (blame
view)][spawn-h]. I added definitions more than 15 years old to
`solarish/mod.rs`, and others to `solarish/illumos.rs`.

There are a lot of definitions here -- it's easiest to look at them in the
blame view linked above. But here are the corresponding man pages:

For solarish:

* [`posix_spawn`, `posix_spawnp`](https://illumos.org/man/3C/posix_spawn)
* [`posix_spawn_file_actions_{init,destroy}`](https://illumos.org/man/3C/posix_spawn_file_actions_init)
* [`posix_spawn_file_actions_{addopen,addclose}`](https://illumos.org/man/3C/posix_spawn_file_actions_addopen)
* [`posix_spawn_file_actions_adddup2`](https://illumos.org/man/3C/posix_spawn_file_actions_adddup2)
* [`posix_spawn_file_actions_addclosefrom_np`](https://illumos.org/man/3C/posix_spawn_file_actions_addclosefrom_np)
* [`posix_spawnattr_{init,destroy}`](https://illumos.org/man/3C/posix_spawnattr_init)
* [`posix_spawnattr_{setflags,getflags}`](https://illumos.org/man/3C/posix_spawnattr_setflags)
* [`posix_spawnattr_{setpgroup,getpgroup}`](https://illumos.org/man/3C/posix_spawnattr_setpgroup)
* [`posix_spawnattr_{setschedparam,getschedparam}`](https://illumos.org/man/3C/posix_spawnattr_setschedparam)
* [`posix_spawnattr_{setschedpolicy,getschedpolicy}`](https://illumos.org/man/3C/posix_spawnattr_setschedpolicy)
* [`posix_spawnattr_{setsigdefault,getsigdefault}`](https://illumos.org/man/3C/posix_spawnattr_setsigdefault)
* [`posix_spawnattr_{setsigignore,getsigignore}_np`](https://illumos.org/man/3C/posix_spawnattr_setsigignore_np)
* [`posix_spawnattr_{setsigmask,getsigmask}`](https://illumos.org/man/3C/posix_spawnattr_setsigmask)

Newer functions added independently to Solaris and illumos:

* [`posix_spawn_file_actions_{addchdir,addchdir_np,addfchdir}` on Solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/posix-spawn-file-actions-addchdir-np-3c.html)

* The illumos-only functions are quite recent so the man pages haven't been
  uploaded to illumos.org yet. But [here's the one for `addchdir` and
  `addfchdir`](https://github.com/illumos/illumos-gate/blob/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/man/man3c/posix_spawn_file_actions_addchdir.3c).
  Note that the `_np` functions are not documented in the manual, but they are
  available for compatibility.

The one function I skipped over was
[`posix_spawn_pipe_np`](https://illumos.org/man/3C/posix_spawn_pipe_np) -- it
seemed a bit niche and I wasn't quite sure how to model `boolean_t`.

[spawn-h]: https://github.com/illumos/illumos-gate/blame/7633a05bff8c639f2df722d1fba7b889b2763d3d/usr/src/head/spawn.h#L1

(backport <rust-lang#4259>)
(cherry picked from commit 162e306)
@tgross35 tgross35 mentioned this pull request Feb 18, 2025
@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 Feb 18, 2025
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 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.

4 participants