Skip to content

Conversation

@casperisfine
Copy link
Contributor

Both for being closer to real IOs and also because it's a convenient API in multithreaded scenarios.

cc @kddnewton @nobu

long offset = NUM2LONG(rb_offset);

if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
Copy link
Member

Choose a reason for hiding this comment

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

Could you add rb_len to error message?

}

if (offset < 0) {
rb_exc_raise(rb_syserr_new(EINVAL, "pread: Invalid offset argument"));
Copy link
Member

Choose a reason for hiding this comment

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

Could you add rb_offset to error message?

@casperisfine
Copy link
Contributor Author

@kou I applied your suggestions.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

We need a review for JRuby part from @headius before we merge this.

Both for being closer to real IOs and also because it's a convenient
API in multithreaded scenarios.
@casperisfine
Copy link
Contributor Author

@kou done.

We need a review for JRuby part

No problem. Note that there are pre-existing failures on the JRuby suite, but the added test does pass on JRuby.

Copy link
Contributor

@headius headius left a comment

Choose a reason for hiding this comment

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

JRuby part looks fine. I can do a small optimization (split out separate arities) once this is merged.

@kou kou merged commit 2b5e2a5 into ruby:master Jun 8, 2023
@kou
Copy link
Member

kou commented Jun 8, 2023

OK.
I've merged this.

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.

4 participants