Unfortunately I've got the task to port a linux-software to OS9 without
deeper knowledge of both of them. :-)
The software is now compiling, starting, reading it's
configuration-files and then stopping with an error.
The error results when using ioctl(). The original linux-program used
fcntl() at this place, I found the hint to use ioctl() instead:
http://www.xs4all.nl/~borkhuis/vxworks/oldvxfaq.html
It seems that this won't work.
Here the code:
_______________________________________________________
static SCK_Status_E SetNonBlocking(SCK_Socket_T SocketId)
{
SCK_Status_E rv;
int OptsFlags;
OptsFlags = ioctl(SocketId,F_GETFL);
printf ("OptsFlags in SetNonBlocking : %i\n", OptsFlags);
if (0 > OptsFlags)
{
rv = eSCK_Error;
} else {
OptsFlags = (OptsFlags | O_NONBLOCK);
if (ioctl(SocketId,F_SETFL,OptsFlags) < 0)
{
rv = eSCK_Error;
} else {
rv = eSCK_Ok;
}
}
return rv;
}
____________________________________________________
The job of this code is to set an already created connection to
non-blocking mode, as experienced socket-programmers might immediately see.
Another hint was to use os_getstat instead, but I couldn't find proper
documentation how to use this.
Any help welcome :-)
Thanx in advance!
Andreas
Andreas
Unfortunatly I cannot cut and paste from the Lan_use.pdf manual page
184. There is example code in the lan manuals from Radisys.
Allan R. Batteiger
Done:
_______________________
static SCK_Status_E SetNonBlocking(SCK_Socket_T SocketId)
{
SCK_Status_E rv;
struct spf_popts sopts;
u_int32 soptsz=sizeof(sopts);
if((errno=_os_gs_popt(SocketId, &soptsz, &sopts)) != 0)
{
rv = errno;
}
else
{
sopts.pd_ioasync = IO_ASYNC;
rv = (_os_ss_popt(SocketId, soptsz, &sopts));
}
return rv;
}
________________________
This seems to work. :-)
Andreas
> Unfortunatly I cannot cut and paste from the Lan_use.pdf manual page
> 184. There is example code in the lan manuals from Radisys.
Thanx Allan!
I really struggle with this documentation. :-))
Now I tried the following:
_________________________
printf("Before ioctl\n");
if (ioctl(SocketId, FIONBIO, IO_ASYNC) < 0)
{
rv = eSCK_Error;
printf("Error\n");
}
else
{
rv = eSCK_Ok;
printf("OK\n");
}
_____________________________
But this code crashes with
100:003 (EOS_PPC_DATAACC Data access exception)
Before ioctl is shown, then the error occurs.
Maybe I'll try the other method described.
Andreas
int arg = 1; /* Non-blocking on */
if (ioctl(SocketId, FIONBIO, &arg) < 0)
{
etc.
etc.
etc.
Ric
Thanx for the hint!
Maybe I was a little bit too hasty.
:-D
Andreas