[openbeos] Re: non-present-posix-functions

  • From: François Revol <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 14 Jan 2004 15:49:44 +0100

First, why not just use the GNU utils since it has been that way for ages ?
(as long as they are self-contained binaries the GPL is not a problem there)
Then, when porting things there are 2 cases:
- small things like date. for that one I'd recomment just including a 
compatibility function inline or in a separate "beos_compat.c" or 
something.
Usually the configure scripts checks for everything needed and tells the 
code to emulate them anyway if not. So:
#ifndef HAVE_SETTIMEOFDAY
int settimeofday(...)
{...}
#endif
or #ifdef __BEOS__ if you don't have a configure script.

- for bigger apps there is libmoreposix, which is still worked on.

François.

Selon janvanhoye@xxxxxxxxxx:

> Hi!
> 
> I am busy with a command line application for the preferences team. To create
> certain applications, I use code from (Open/Net)BSD. The problem i sometimes
> have, is that some posix functions are not present in some (Open)BeOs header
> files.
> 
> Example:
> 
> I port 'date' from NetBSD to OBOS. And I see that 'settimeofday' could not be
> found. When I look into 'sys/time.h' I see the function 'gettimeofday' and
> not 'settimeofday'. This is a problem. What I could do is import
> 'os/kernel/Os.h' and use the function 'set_real_time_clock'. But this makes
> it non posix compliant.
> 
> My questions are: What do I have to do if some posix functions are not
> present in the posix headerfiles of OBOS? Are we going to make OBOS more
> posix compliant then BeOs and implement those posix functions that are not
> present. Is there someone that can give me an good explanation of what has to
> be done when a posix function is not present in a posix header-file?
> 
> If there is no clear way of programming those non-present-posix-functions, I
> would suggest the following:
> 
> We could create a c-file and a header-file that contain wrapper functions
> that replace the non-present-posix-functions but with the same name.
> Example:
> 
> nonpresposfunc.h
> #include <os/kernel/OS.h>
> 
> --> static int settimeofday(param1,param2);
> 
> nonpresposfunc.c
> 
> --> settimeofdate(param1,param2){ set_real_time_clock (param1,param2);}
> 
> 
> All non-present-posix-functions could be implemented as wrapper functions in
> that extra file(nonprespsfunc.c). When a developer want to port an
> application he can import the header-file(nonprespsfunc.h). If there is still
> a posix function that is not present, the developer can implement that
> function in the extra file(nonprespsfunc.c).
> This way of working could create less redundance, and bug-fixing should only
> be done at 1 place and the system would be more posix compliant. In time it
> should then be easier to port a certain (commandline) application. I hope you
> understand what I mean. So, please give me feedback ;)
> 
> thx
>    Jixt
> 
> --------------------------------------
> Telenet Webmail opent je wereld
> 
> 
> 
> 
> 


-- 



Other related posts: