[openbeos] non-present-posix-functions

  • From: janvanhoye@xxxxxxxxxx
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 14 Jan 2004 14:25:02 +0000

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: