Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-02

Typo in unistdh.inc

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Den Jean

Hi,

1) sysconf:
could someone please fix sysconf in unistdh.inc.
The library name is not correct

packages/base/libc/unistdh.inc:function sysconf (__name : longint) : longint; cdecl; external clib name 'syconf';

The compile error is typically :

In function `START_SESSION':
SYS_UTIL.pas:329: undefined reference to `syconf'

The rest is nice to have...........

2) PUserContext:

   It would be nice to add the the following type definion for more Kylix compatibility
   type PUserContext = ^TUserContext;
  grep -> ./packages/base/libc/sucontexth.inc:  TUserContext = ucontext_t;

3) sigaction:
It would be nice to fix the definition of sigaction. If a libc function is defined to take pointers as an argument, it only looks cleaner to define the parameter as a var, but mostly it is better to define it with a pointer, this way it remains possible to pass nil as parameter. If passing nil does not make sense, using var is ok. All this only to avoid too many IFDEFS in code that is to be Kylix and FPC compatible.

So I prefer (Kylix extract)

function sigaction(SigNum: Integer; Action: PSigAction; OldAction: PSigAction): Integer;
   instead of
./packages/base/libc/signalh.inc:function sigaction(__sig:longint; Const act: _sigaction; Var oldact: _sigaction):longint;cdecl;external clib name 'sigaction';

4) setrlimit:

Here again Kylix has another definition and more logical (you cannot omit the rlimit) It would be nice (Kylix compatibility) to have the Kylix type of definition.

fpc:
function setrlimit(__resource:__rlimit_resource_t; __rlimits:Prlimit):longint;cdecl;external clib name 'setrlimit';
Kylix:
function setrlimit (__resource: __rlimit_resource_t; const __rlimits: TRLimit): Integer; cdecl;

5) I need many more ifdefs, but I notice sometimes that it is better in FPC, then I just add an IFDEF and shut up.

kind regards,

Den Jean

Reply by email

Unknown author
to Den Jean
Den Jean wrote 15 lines
Hi, 1) sysconf: could someone please fix sysconf in unistdh.inc. The library name is not correct packages/base/libc/unistdh.inc:function sysconf (__name : longint) : longint; cdecl; external clib name 'syconf'; The compile error is typically : In function `START_SESSION': SYS_UTIL.pas:329: undefined reference to `syconf' The rest is nice to have...........

All done, thanks for pointing them out.

In general, FPC has the exact C header definition. Where needed, I added the Kylix definition as an overloaded version. If there are some missing definitions, (entirely possible) please let me know, I'll add them.

Michael.

Reply by email