Page MenuHomeFreeBSD

flua: add posix.unistd.dup2()
ClosedPublic

Authored by ifreund_freebsdfoundation.org on May 5 2025, 8:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 5, 2:07 PM
Unknown Object (File)
Mon, Jun 2, 2:48 PM
Unknown Object (File)
Mon, Jun 2, 10:22 AM
Unknown Object (File)
Sun, Jun 1, 2:13 PM
Unknown Object (File)
Wed, May 28, 7:27 AM
Unknown Object (File)
Tue, May 27, 10:36 AM
Unknown Object (File)
Sat, May 24, 6:16 PM
Unknown Object (File)
Sat, May 24, 12:06 AM
Subscribers

Details

Summary

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

libexec/flua/modules/lposix.c
175

why doesn't this require a goto err too?

libexec/flua/modules/lposix.c
175

This function raises a lua error on failure and does not return.

Internally it longjmps away to somewhere else in the lua VM and either invokes an error handler if in a pcall() context or prints a stack trace and exits.

The luaL_checkinteger calls below behave the same.

emaste added inline comments.
libexec/flua/modules/lposix.c
174

We seem to have a number of different styles for the arg and extramsg args of luaL_argcheck

  • _exit narg == 1, 1
  • basename narg > 0, 1
  • chmod n == 2, n > 2 ? 3 : n
  • chown n > 1, n

some include the function (close takes exactly one argument (fd)) while some do not (at least one argument required).

Independent of this change we could do a pass to rationalize these

This revision is now accepted and ready to land.May 6 2025, 3:06 PM
libexec/flua/modules/lposix.c
174

I opened D50273 to clean this up.

This revision now requires review to proceed.Sun, May 11, 3:27 PM
This revision is now accepted and ready to land.Sun, May 11, 3:30 PM

As an aside while MFCing some flua work I (re)discovered 1f31e00e19f9e24d4c891a24973e08a027c4f71c

As an aside while MFCing some flua work I (re)discovered 1f31e00e19f9e24d4c891a24973e08a027c4f71c

Interesting, I wasn't aware of fbsd.exec. Unfortunately it doesn't look flexible enough to support the bsddialog use-case as it lacks a way to capture stderr output.

This revision was automatically updated to reflect the committed changes.