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

[stdlib] Hristo/foundations for os process module #4017

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

izo0x90
Copy link

@izo0x90 izo0x90 commented Feb 25, 2025

Sets up the foundation for implementing the os/process module PR with process module changes

  • Add read_bytes capability to FileDecscriptor
  • Add file descriptor controls function to Libc. bindings
  • Adds vfork, execvp, kill system call utils. to Mojos cLib binds

  - Add `read_bytes` capability to `FileDecscriptor`
  - Add file descriptor controls function to Libc. bindings
  - Adds vfork, execvp, kill system call utils. to Mojos cLib binds

Signed-off-by: Hristo I. Gueorguiev <53634432+izo0x90@users.noreply.github.com>
Update `read_bytes` from Span[Byte] to List[Byte] for better memory
safety and "user ergonomics"

Signed-off-by: Hristo I. Gueorguiev <53634432+izo0x90@users.noreply.github.com>
@izo0x90 izo0x90 changed the title Hristo/foundations for os process module [stdlib] Hristo/foundations for os process module Feb 25, 2025
@izo0x90
Copy link
Author

izo0x90 commented Feb 25, 2025

@ConnorGray @JoeLoser @owenhilyard Foundational changes broken off into their own branch/ PR. 😃

Copy link
Contributor

@martinvuyk martinvuyk left a comment

Choose a reason for hiding this comment

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

Hi, just 2 comments :)

Update the list creation to conform to upcoming List API changes that
make the list size a `private attribute`

Signed-off-by: Hristo I. Gueorguiev <53634432+izo0x90@users.noreply.github.com>
@izo0x90
Copy link
Author

izo0x90 commented Feb 25, 2025

Hi, just 2 comments :)

Awesome 😃, all set.

@JoeLoser JoeLoser self-assigned this Feb 25, 2025
Copy link
Collaborator

@ConnorGray ConnorGray left a comment

Choose a reason for hiding this comment

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

Hi @izo0x90, thanks for splitting this off, this is great! 🙂

I've left a few minor comments, mostly suggestions that we include links to the POSIX docs where appropriate. Once those are addressed, I'll proceed with merging this in.

In the meantime, I'll !sync this preemptively, just to ensure it passes internal CI.

Thanks again for contributing to Mojo 🔥

@ConnorGray
Copy link
Collaborator

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Feb 25, 2025
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
@izo0x90 izo0x90 requested a review from a team as a code owner February 26, 2025 16:14
izo0x90 and others added 7 commits February 26, 2025 11:14
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
- `read_bytes` takes in Span[Byte] buffer as opposed to allocating
  to avoid n+1 alloc. issues etc.

- Remove c_str_ptr type from ffi module since it is not a convention set
  by C lang., it will potentially get added back in at a later date
  after discussions and under its own PR

- Doc string updates to libC funcs.

Co-authored-by: Connor Gray <accounts@connorgray.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Copy link
Contributor

@martinvuyk martinvuyk left a comment

Choose a reason for hiding this comment

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

LGTM

izo0x90 and others added 3 commits February 26, 2025 19:32
Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
Co-authored-by: martinvuyk <110240700+martinvuyk@users.noreply.github.com>
Signed-off-by: Hristo (Izo) G. <53634432+izo0x90@users.noreply.github.com>
@izo0x90 izo0x90 force-pushed the Hristo/Foundations-for-os-process-module branch from 8dd69a0 to f2800a9 Compare February 27, 2025 00:37
@ConnorGray
Copy link
Collaborator

Awesome, thanks for incorporating the feedback @izo0x90 🙂 I'll go ahead and sync this in.

@ConnorGray
Copy link
Collaborator

!sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants