Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need Help: Porting Linux program to OS9/PPC

19 views
Skip to first unread message

Andreas Priebe

unread,
Mar 9, 2005, 9:37:44 AM3/9/05
to
Hello!

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

Allan R. Batteiger

unread,
Mar 9, 2005, 11:00:39 AM3/9/05
to
Andreas Priebe <pri...@rs.uni-siegen.de> wrote in
news:398g13F...@individual.net:

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

Andreas Priebe

unread,
Mar 10, 2005, 5:27:31 AM3/10/05
to
Andreas Priebe wrote:
>
> Maybe I'll try the other method described.

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

Andreas Priebe

unread,
Mar 10, 2005, 3:52:10 AM3/10/05
to
Allan R. Batteiger wrote:

> 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

Ric Yeates

unread,
Mar 12, 2005, 6:42:55 PM3/12/05
to
I think the reason this didn't work is because you passed a value as
the third parameter instead of the address of a value.

int arg = 1; /* Non-blocking on */

if (ioctl(SocketId, FIONBIO, &arg) < 0)
{
etc.
etc.
etc.

Ric

Andreas Priebe

unread,
Mar 14, 2005, 2:44:54 AM3/14/05
to
Ric Yeates wrote:
> I think the reason this didn't work is because you passed a value as
> the third parameter instead of the address of a value.

Thanx for the hint!

Maybe I was a little bit too hasty.
:-D


Andreas

0 new messages