poll unable to access stdin on VMS

Post Reply

Topic author
greg@tssolutions.com.au
Contributor
Posts: 19
Joined: Wed May 29, 2024 10:29 am
Reputation: 0
Location: Australia
Status: Offline
Contact:

poll unable to access stdin on VMS

Post by greg@tssolutions.com.au » Sun Aug 04, 2024 11:40 pm

The following works fine on Linux but not VMS
VSI C x86-64 V7.5-009 (GEM 50XBR) on OpenVMS x86_64 V9.2-2

Code: Select all

#include <unistd.h>
#include <stdio.h>
#include <poll.h>
#include <string.h>
#include <errno.h>

int main(int argc, char **argv)
{
  int i,inlen, sts;
  struct pollfd poll_fds[4];
  nfds_t poll_nfds;
  char buff[4096]={0};

  poll_fds[0].fd=fileno(stdin);
  poll_fds[0].events=POLLIN;
  poll_nfds=1;

  sts=poll(poll_fds,poll_nfds,10000);
  if(sts<0)
  {
     printf("ppoll: %.100s, errno=%d\n", strerror(errno), errno);
  }
  for(i=0; i<poll_nfds;i++)
  {
     if((poll_fds[i].revents & POLLIN) !=0 )
     {
       inlen=read(poll_fds[i].fd,buff,sizeof(buff));
       printf("read[%d]: %.60s\n",inlen, buff);
     }
  }
  printf("sts=%d revents=%08x\n",sts, poll_fds[0].revents);

}
linux>
$ ./t.exe
en
read[3]: en

sts=1 revents=00000001

vms>
$ run test_poll
ppoll: i/o error, errno=5
sts=-1 revents=00000000
Last edited by greg@tssolutions.com.au on Mon Aug 05, 2024 12:25 am, edited 1 time in total.
gt
VMS Ambassador
Downunder


pustovetov
VSI Expert
Active Contributor
Posts: 40
Joined: Thu Sep 14, 2023 1:26 am
Reputation: 0
Status: Offline

Re: poll unable to access stdin on VMS

Post by pustovetov » Mon Aug 05, 2024 1:31 am

greg@tssolutions.com.au wrote:
Sun Aug 04, 2024 11:40 pm
The following works fine on Linux but not VMS
VSI C x86-64 V7.5-009 (GEM 50XBR) on OpenVMS x86_64 V9.2-2
Oops... I've fixed it. Thank you for the bug report.

Code: Select all

$ r poll
ppoll: i/o error, errno=5
sts=-1 revents=00000000
$define DECC$SHR WORK:[xxxxx.ACRTL.BIN]DECC$SHR.EXE
$ r poll
en
read[3]: en

sts=1 revents=00000001


Topic author
greg@tssolutions.com.au
Contributor
Posts: 19
Joined: Wed May 29, 2024 10:29 am
Reputation: 0
Location: Australia
Status: Offline
Contact:

Re: poll unable to access stdin on VMS

Post by greg@tssolutions.com.au » Mon Sep 23, 2024 11:32 pm

Still a problem with
VSI C x86-64 X7.6-028 (GEM 50Y92) on OpenVMS x86_64 V9.2-2
gt
VMS Ambassador
Downunder


pustovetov
VSI Expert
Active Contributor
Posts: 40
Joined: Thu Sep 14, 2023 1:26 am
Reputation: 0
Status: Offline

Re: poll unable to access stdin on VMS

Post by pustovetov » Tue Sep 24, 2024 1:34 am

greg@tssolutions.com.au wrote:
Mon Sep 23, 2024 11:32 pm
Still a problem with
VSI C x86-64 X7.6-028 (GEM 50Y92) on OpenVMS x86_64 V9.2-2
The problem was in CRTL (DECC$SHR), not VSI C. So you need to wait for a CRTL update (V9.2-3).


Topic author
greg@tssolutions.com.au
Contributor
Posts: 19
Joined: Wed May 29, 2024 10:29 am
Reputation: 0
Location: Australia
Status: Offline
Contact:

Re: poll unable to access stdin on VMS

Post by greg@tssolutions.com.au » Tue Oct 01, 2024 8:27 am

A related issue, when I create a fd based on a MPA device, poll() does not work.
Same code with MBA works.
gt
VMS Ambassador
Downunder


pustovetov
VSI Expert
Active Contributor
Posts: 40
Joined: Thu Sep 14, 2023 1:26 am
Reputation: 0
Status: Offline

Re: poll unable to access stdin on VMS

Post by pustovetov » Wed Oct 02, 2024 3:45 am

greg@tssolutions.com.au wrote:
Tue Oct 01, 2024 8:27 am
A related issue, when I create a fd based on a MPA device, poll() does not work.
Same code with MBA works.
Can you give me an example? I tried to get the error with a MPA device and was unsuccessful, but I guess I did something wrong.


Topic author
greg@tssolutions.com.au
Contributor
Posts: 19
Joined: Wed May 29, 2024 10:29 am
Reputation: 0
Location: Australia
Status: Offline
Contact:

Re: poll unable to access stdin on VMS

Post by greg@tssolutions.com.au » Wed Oct 02, 2024 9:34 am

Maybe fixed in CRTL update (V9.2-3)?
gt
VMS Ambassador
Downunder

Post Reply