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

Adds STATUS argument to LOGOUT for process exit status #1978

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

nbriggs
Copy link
Contributor

@nbriggs nbriggs commented Jan 19, 2025

Combined with Interlisp/maiko#525 allows passing an exit status (typically 0..255) as an optional second argument to LOGOUT.

The underlying Maiko implementation will accept any integer value (or NIL) and pass it to the system exit() procedure, however the behavior for numeric values outside the range 0..255 is typically OS dependent and often unspecified. The default exit code is 0 (EXIT_SUCCESS). Passing non-numeric values (other than NIL) will result in an exit with status EXIT_FAILURE, typically defined by the OS as 1.

While both the change in this branch and the corresponding maiko branch are required for full functionality, they can be deployed in either order -- old sysouts will not change behavior on the newer maiko emulator, and new sysouts will run on an older emulator but the exit status will be ignored.

fghalasz
fghalasz previously approved these changes Jan 20, 2025
Copy link
Member

@fghalasz fghalasz left a comment

Choose a reason for hiding this comment

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

I merged into this branch a change to \LOGOUT0 that ensures that the SUBRCALL LISPFINISH is called with only a single argument if STATUS is not a SMALLP (e.g., in the (LOGOUT) and (LOGOUT T) cases). If STATUS is a SMALLP, then the SUBRCALL LISPFINISH has 2 args. This matches the logic in the Maiko PR#525 lispfinish subr. Without this change, (LOGOUT) and (LOGOUT T) will cause lde to exit with status code 1 (and not 0).

With this change all seems to work OK. Tested only on WSL/Ubuntu22.04.

@nbriggs
Copy link
Contributor Author

nbriggs commented Jan 20, 2025

I'd rather not have this check because it prevents the case where you pass a FIXP with a small value.

I'm adding || (argnum == 2 && args[1] == NIL) to the successful exit case in the emulator. Passing anything not an integer (smallp or fixp) will exit(EXIT_FAILURE).

@nbriggs
Copy link
Contributor Author

nbriggs commented Jan 20, 2025

I've reverted the last change to ADIR and updated the Maiko code to have the correct check.

@nbriggs nbriggs force-pushed the nhb-logout-exit-status branch from 648ee37 to 83b36e2 Compare January 20, 2025 21:51
@nbriggs
Copy link
Contributor Author

nbriggs commented Jan 20, 2025

Git thinks that my ADIRs conflict - but they don't, since I incorporated Ron's changed ADIR.

@nbriggs nbriggs force-pushed the nhb-logout-exit-status branch from 83b36e2 to 8a49d07 Compare January 20, 2025 22:12
Copy link
Member

@fghalasz fghalasz left a comment

Choose a reason for hiding this comment

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

LGTM.

@nbriggs nbriggs merged commit 015868e into master Jan 27, 2025
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.

2 participants