Operating System - OpenVMS
1753849 Members
7586 Online
108807 Solutions
New Discussion юеВ

socket_fd routine in DEC C 1.3

 
Malleka Ramachandran
Frequent Advisor

socket_fd routine in DEC C 1.3

Hello,

I have another of these strange behavior on this AXP 1.5 system with version 1.3 of DEC C compiler. I am unable to locate socket_fd routine. I tried using the following in addition to the UCX$IPC while linking.
CMA$OPEN_LIB_SHR/SHARE
SYS$SHARE:CMA$OPEN_RTL/SHARE
SYS$SHARE:CMA$LIB_SHR.EXE/share
SYS$SHARE:CMA$RTL.EXE/SHARE
SYS$SHARE:DECC$SHR.EXE/SHARE

I don't see socket_fd in the online help for CC Socket routines. Does it mean that this routine is not available for the version I am using? The OpenSSL toolkit code that I am trying to back port has this call. If this routine is not supported, is there a way of rewriting my code to replace this call?

Thanks,
Malleka
3 REPLIES 3
Craig A Berry
Honored Contributor

Re: socket_fd routine in DEC C 1.3

The following search:

$ search/format=nonulls sys$library:decc$shr.exe decc$socket_fd

should turn up something. If it doesn't, you don't have the function.

If it's in the library, it's possible this very old compiler doesn't know it needs to be prefixed, so you could experiment with /PREFIX qualifier on the compiler or stick a

#define socket_fd decc$socket_fd

somewhere in the code.

This function, as I understand it, is a VMS extension that translates a channel number into a socket descriptor. I think the only way to code around it would be to use standard socket routines from the outset so there are never any VMS channel numbers to be dealt with.
Willem Grooters
Honored Contributor

Re: socket_fd routine in DEC C 1.3

VERY OLD compiler (and VERY OLD VMS version)!

I have run into the opposite, where older versions oc the C-compiler (before 6.0) defined these themselves. The data is not included in the libraries on older VMS / Compiler versions - that is: prior to C 6.0

So you may need to define (to make it C-version dependent):

Macro's:
#if __DECC_VER < 60000000
typedef int fd_set;
#define FD_SET(n,p) (*p|= (1<#define FD_CLR(n,p) (*p&= ~(1<#define FD_ISSET(n,p) (*p & (1<#define FD_ZERO(p) (*p= 0L)
#endif

Static data:
#if __DECC_VER < 60000000
static int socket_fd;
#else
static int i_socket_fd;
#endif

and code-contructs as:
#if __DECC_VER < 60000000
if (ReturnCode == FAIL) send(socket_fd,"-999",4,0);
shutdown(socket_fd,2);
close(socket_fd);
#else
if (ReturnCode == FAIL) send(i_socket_fd,"-999",4,0);
shutdown(i_socket_fd,2);
close(i_socket_fd);
#endif

...
#if __DECC_VER < 60000000
socket_fd = socket(UCX$C_AUXS,0,0);
if (socket_fd == -1) {
#else
i_socket_fd = socket(UCX$C_AUXS,0,0);
if (i_socket_fd == -1) {
#endif
...
#if __DECC_VER < 60000000
status = setsockopt(socket_fd, SOL_SOCKET, SO_SNDBUF,
(char *)&socketBufferSize, sizeof(socketBufferSize));
#else
status = setsockopt(i_socket_fd, SOL_SOCKET, SO_SNDBUF,
(char *)&socketBufferSize, sizeof(socketBufferSize));
#endif

(code sniplets are from different routines in the code. But you'll understand the meaning, I guess)

Willem
Willem Grooters
OpenVMS Developer & System Manager
Willem Grooters
Honored Contributor

Re: socket_fd routine in DEC C 1.3

attached file may be helpfull as well, to be included where needed (rename socket.h)
Willem Grooters
OpenVMS Developer & System Manager