Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
141 user(s) are online (128 user(s) are browsing Forums)

Members: 0
Guests: 141

more...

Support us!

Headlines

 
  Register To Post  

(1) 2 »
Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
Hello everyone,

trying to compile some sources i'm encountering certain problems related to the unistd.h and other unix process.

warning: implicit declaration of function 'pipe' [-Wimplicit-function-declaration]

warning: implicit declaration of function 'sigprocmask' [-Wimplicit-function-declaration]
if(sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0)

error: 'SIG_BLOCK' undeclared (first use in this function)
if(sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0)

error: 'SIG_SETMASK' undeclared (first use in this function)
sigprocmask(SIG_SETMASK, &old_mask, 0);

error: 'SA_NOCLDSTOP' undeclared (first use in this function)
newSigAction.sa_flags = SA_NOCLDSTOP;


Could someone, please, give me any hint on this?

Thank you in advance

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Home away from home
Home away from home


See User information
@AmigaBlitter

If you search your SDK you will find unistd.h in newlib/include

implicit declaration of "Whatever" means you need to add a header with the missing function, in your case probably "unistd.h"


I also advise you to check out Spot's Porting for Dummies guide.

A great source of information and helped me a lot for those little things

In any other way don't hesitate to ask

btw...i can't code neither

Go to top
Re: Is unistd supported in AmigaOS?
Amigans Defender
Amigans Defender


See User information
ISTR this stuff is available to varying degrees in clib2 and newlib, so switching the runtime library might be the easiest solution (assuming stdlib.h has been included, as noted above).

Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@Raziel

Thank you for the reply.

The compiler does not complain about the unistd.h, but about the pipe() function that isn't there.
The same is for the other things related to unix process

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Amigans Defender
Amigans Defender


See User information
@AmigaBlitter

You can emulate pipe() quite easily.

https://github.com/chris-y/git2/blob/m ... src/common/compat/amiga.c

Probably not 100% compatible but may be enough for what you need.

Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@Chris

Thank you.

I will try.

By the way,this is not the only function missing.

I put only few errors and warning. I can expect that many other files will create problem.

Already patched some files including using if defined (__amigaos__)...

moreover this other declarations are missing:

SIG_BLOCK
SIG_GETMASK
SIG_SETMASK
SA_NOCLDSTOP
SIG_UNBLOCK





Retired
Go to top
Re: Is unistd supported in AmigaOS?
Just popping in
Just popping in


See User information
In the Jamiga project, I've sort of ported some of the stuff you mention.

I've implemted some missing pthreads stuff to bzsilis pthreads implementation, but it's not officially added yet.
Also I have some signal stuff implemented in a few unpublished files.

I'll try and look into this in the next few days -- if you want anything, I can point to where I'll put it. It'd be great if we could collaborate and get a generic solution working!


Maintainer and developer for Jamiga2 - Java for Amiga
Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@jaokim

Thank you very much.

you can PM me for the files.


Retired
Go to top
Re: Is unistd supported in AmigaOS?
Amigans Defender
Amigans Defender


See User information
@AmigaBlitter

Quote:
SIG_BLOCK
SIG_GETMASK
SIG_SETMASK
SA_NOCLDSTOP
SIG_UNBLOCK


Make sure you have included <signal.h>.
Some of them are definitely in clib2, and the only reference to SIG_GETMASK I can find is siggetmask(), which has been obsoleted by sigprocmask() (which is in clib2). The final one is SA_NOCLDSTOP which relates to child processes and probably isn't relevant.

I don't have the newlib includes in front of me to check those, but I suggest again to try linking against clib2. It might throw up other errors, but it's worth trying unless you have a particular reason not to.

edit newlib appears to have the same defines, so you may just be missing the #include

Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@Chris

Yesterday i tried the pipe function you've linked. Seem to works, but further tests are needed. Of course i copied both (amiga.h and amiga.c) from your source.

I already had a look at the signal files, that i have included. This doesn't worked. Perhaps the compiler picked the wrong file, so i have to include those directly with the correct path.

Thank you, anyway

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Home away from home
Home away from home


See User information
@AmigaBlitter

There is some support for unistd and other posixy things, but Amiga is not Posix so you should expect to do some work when porting posix code.


newlib doesn't have a pipe()

here is my replacement from perl (inherited from abc-shell)

unsigned int pipenum 0;

int pipe(int filedes[2])
{
    
char pipe_name[1024];

//   adebug("%s %ld \n",__FUNCTION__,__LINE__);
#ifdef USE_TEMPFILES
    
sprintf(pipe_name"/T/%x.%08lx"pipenum++, IUtility->GetUniqueID());
#else
    
sprintf(pipe_name"/PIPE/%x%08lx/4096/0"pipenum++,
            
IUtility->GetUniqueID());
#endif

    /*      printf("pipe: %s \n", pipe_name);*/

    
filedes[1] = open(pipe_nameO_WRONLY O_CREAT);
    
filedes[0] = open(pipe_nameO_RDONLY);
    if (
filedes[0] == -|| filedes[1] == -1)
    {
        if (
filedes[0] != -1)
            
close(filedes[0]);
        if (
filedes[1] != -1)
            
close(filedes[1]);
        return -
1;
    }
    
/*      printf("filedes %d %d\n", filedes[0],
     * filedes[1]);fflush(stdout);*/

    
return 0;
}


If you are lnking without -lunix then you will need to chnage the pipe paths to to amigaos versions.

newlib does not support sigprocmask()

sigprocmask() isn't guaranteed to be portable so there might well be a config.h entry for it, try editing that file by hand if it exists, ie if

#define HAVE_SIGPROCMASK 1

or similar exists comment it out.

Even with the supported set of functions signal handling is relatively limited whilst raise() can send almost any signal to it's own process kill() can only send SIG_TERM and SIG_QUIT IIRC to another process and they will both be emulated by SIGBREAKF_CTRL_C


Go to top
Re: Is unistd supported in AmigaOS?
Home away from home
Home away from home


See User information
@Chris

erm your pipe function is using fopen() which returns a FILE * then returning is as if it was an filedescriptor (int) that won't work to well....


Go to top
Re: Is unistd supported in AmigaOS?
Amigans Defender
Amigans Defender


See User information
@broadblues

Oops. I wrote that a long time ago (for something else) and just copied it to this project. Weird that it never caused any problems, pretty sure the earlier code I copied it from worked properly, as I vaguely remember having trouble getting it to work initially. I can only assume newlib treats them the same internally.

Go to top
Re: Is unistd supported in AmigaOS?
Just can't stay away
Just can't stay away


See User information
@Chris

Quote:

I can only assume newlib treats them the same internally.


No, it doesn't.

What it does do is it performs bounds checking on file descriptor numbers and fails with an error (EBADF) if an out of range fd is passed to a function.

Go to top
Re: Is unistd supported in AmigaOS?
Just popping in
Just popping in


See User information
@AmigaBlitter

I added my files on my sourceforge:

https://sourceforge.net/p/jaokims-amig ... ff/code/HEAD/tree/signal/

There's also a small test program.

Hopefully it is of use. If anyone finds any errors -- there most certainly are some -- please let me know!

Maintainer and developer for Jamiga2 - Java for Amiga
Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@Chris

How can i use clib2/include/signal.h?

All the other files are pointing to newlib/include/signal.h

I forced to check for clib2/include/signal.h, but i receive an error: previous declaration of include.h was newlib/include/signal.h

@broadblues
thank you for the info
I will check

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@jaokim

thank you very much.

Have to test now

I suppose i can wipe all the JA_TRACE

Retired
Go to top
Re: Is unistd supported in AmigaOS?
Just popping in
Just popping in


See User information
@AmigaBlitter

Yes, you can, or just do a NOP out of it in util.h. Could be useful if something doesn't work. And it outputs stuff with DebugPrint, so it shouldn't be too bothersome. :)

I should probably have added some documentation. But basically the "signal.h" needs to override the SDK's signal.h. You can see in the makefile for the test program, that I simply set the standard includes directory to "-I .". Guess you could set it to "-I Wherever:you/put/my/stuff" in your project.

Maintainer and developer for Jamiga2 - Java for Amiga
Go to top
Re: Is unistd supported in AmigaOS?
Quite a regular
Quite a regular


See User information
@jaokim

Thank you
I will try asap

Retired
Go to top

  Register To Post
(1) 2 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project