Skip to content

ibmi: Fix isatty EBADF handling and refactor#2753

Closed
kadler wants to merge 4 commits intolibuv:v1.xfrom
kadler:ibmi-isatty
Closed

ibmi: Fix isatty EBADF handling and refactor#2753
kadler wants to merge 4 commits intolibuv:v1.xfrom
kadler:ibmi-isatty

Conversation

@kadler
Copy link
Copy Markdown
Member

@kadler kadler commented Mar 24, 2020

In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.

Copy link
Copy Markdown
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM % stylistic issues.

In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.
@dmabupt
Copy link
Copy Markdown
Contributor

dmabupt commented Mar 25, 2020

@kadler , seems compiler error happened?

src/unix/tty.c:53:12: error: static declaration of 'isatty' follows non-static declaration
 static int isatty(int file) {
            ^~~~~~
In file included from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/fcntl.h:234:0,
                 from ./include/uv/unix.h:27,
                 from ./include/uv.h:66,
                 from src/unix/tty.c:22:
/QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/unistd.h:203:12: note: previous declaration of 'isatty' was here
 extern int isatty(int);
            ^~~~~~

@kadler
Copy link
Copy Markdown
Member Author

kadler commented Mar 25, 2020

Is that in Node? I did not get an error when building just libuv. Well, we could work around that by renaming the function and making isatty a macro

isatty was already declared as extern in the header files, since it is
provided by libc, but we want ours static so it is not exported. This
can cause errors when building, so instead rename the function and make
isatty a macro wrapper around it.
@dmabupt
Copy link
Copy Markdown
Contributor

dmabupt commented Mar 25, 2020

Is that in Node? I did not get an error when building just libuv. Well, we could work around that by renaming the function and making isatty a macro

I can build libuv with the second commit. I use below configuration for libuv build & test --

export OBJECT_MODE=64
./autogen.sh
./configure LDFLAGS="-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib" \
  --with-aix-soname=svr4 \
  --disable-static \
  --disable-silent-rules \
  --prefix=/QOpenSys/pkgs
make -j4 && make check

I will test node.js build now, which may take some more time.

@dmabupt
Copy link
Copy Markdown
Contributor

dmabupt commented Mar 26, 2020

Tested with Node.js, the 55555 test passed! LGTM.

@dmabupt
Copy link
Copy Markdown
Contributor

dmabupt commented Mar 26, 2020

Need to revert the commit of PR nodejs/node#32338 once this PR landed into Node.js

@richardlau
Copy link
Copy Markdown
Member

richardlau pushed a commit to richardlau/libuv that referenced this pull request Apr 6, 2020
In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.

PR-URL: libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
richardlau pushed a commit to richardlau/libuv that referenced this pull request Apr 6, 2020
PR-URL: libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@richardlau
Copy link
Copy Markdown
Member

Landed in 0ed9692...4878e82.

@richardlau richardlau closed this Apr 6, 2020
richardlau pushed a commit to nodejs/node that referenced this pull request Jun 1, 2020
Since the PR libuv/libuv#2753
has been landed, we need to revert the code change in
PR #32338.

PR-URL: #33629
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this pull request Jun 18, 2020
Since the PR libuv/libuv#2753
has been landed, we need to revert the code change in
PR #32338.

PR-URL: #33629
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this pull request Jun 30, 2020
Since the PR libuv/libuv#2753
has been landed, we need to revert the code change in
PR #32338.

PR-URL: #33629
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
codebytere pushed a commit to nodejs/node that referenced this pull request Jul 9, 2020
Since the PR libuv/libuv#2753
has been landed, we need to revert the code change in
PR #32338.

PR-URL: #33629
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
liujinye-sys pushed a commit to open-vela/apps_system_libuv that referenced this pull request Jul 23, 2025
In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.

PR-URL: libuv/libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
liujinye-sys pushed a commit to open-vela/apps_system_libuv that referenced this pull request Jul 23, 2025
PR-URL: libuv/libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
liujinye-sys pushed a commit to open-vela/apps_system_libuv that referenced this pull request Dec 16, 2025
In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.

PR-URL: libuv/libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
liujinye-sys pushed a commit to open-vela/apps_system_libuv that referenced this pull request Dec 16, 2025
PR-URL: libuv/libuv#2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
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