From 1a26c381f91d76072311cb17052c2f0876b0e671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Mon, 7 Jan 2019 13:01:08 +0000 Subject: [PATCH] haiku: cleanup of some interface definitions, verify structures against the actual haiku code, so it should work both on 32bit and 64bit git-svn-id: trunk@40792 - --- rtl/haiku/ostypes.inc | 165 ++++++++++++++++-------------------------- rtl/haiku/ptypes.inc | 34 ++++----- 2 files changed, 79 insertions(+), 120 deletions(-) diff --git a/rtl/haiku/ostypes.inc b/rtl/haiku/ostypes.inc index c204d51ab0..8ccb195fe2 100644 --- a/rtl/haiku/ostypes.inc +++ b/rtl/haiku/ostypes.inc @@ -29,32 +29,16 @@ {$ENDIF} Type - timezone = packed record + timezone = record tz_minuteswest,tz_dsttime:cint; end; ptimezone =^timezone; TTimeZone = timezone; - - rusage = packed record - ru_utime : timeval; { user time used } - ru_stime : timeval; { system time used } - ru_maxrss : clong; { max resident set size } - ru_ixrss : clong; { integral shared memory size } - ru_idrss : clong; { integral unshared data " } - ru_isrss : clong; { integral unshared stack " } - ru_minflt : clong; { page reclaims } - ru_majflt : clong; { page faults } - ru_nswap : clong; { swaps } - ru_inblock : clong; { block input operations } - ru_oublock : clong; { block output operations } - ru_msgsnd : clong; { messages sent } - ru_msgrcv : clong; { messages received } - ru_nsignals : clong; { signals received } - ru_nvcsw : clong; { voluntary context switches } - ru_nivcsw : clong; { involuntary " } - end; -// #define ru_last ru_nivcsw -// #define ru_first ru_ixrss + + rusage = record + ru_utime : timeval; { user time used } + ru_stime : timeval; { system time used } + end; { auto generated by a c prog, statmacr.c} @@ -78,15 +62,15 @@ Const // _UTSNAME_LENGTH = ; // _UTSNAME_NODENAME_LENGTH = ; -CONST // OS specific parameters for generalset behaviour +CONST // OS specific parameters for generalset behaviour BITSINWORD = 8*sizeof(longint); // SIG_MAXSIG = 32; //128; // highest signal version - FD_MAXFDSET = 1024; -// wordsinsigset = 4; // words in sigset_t + FD_MAXFDSET = 1024; +// wordsinsigset = 4; // words in sigset_t ln2bitsinword = 5; { 32bit : ln(32)/ln(2)=5 } ln2bitmask = 2 shl ln2bitsinword - 1; - wordsinfdset = FD_MAXFDSET DIV BITSINWORD; // words in fdset_t - wordsinsigset = SIG_MAXSIG DIV BITSINWORD; + wordsinfdset = FD_MAXFDSET DIV BITSINWORD; // words in fdset_t + wordsinsigset = SIG_MAXSIG DIV BITSINWORD; TYPE { system information services } @@ -124,83 +108,63 @@ TYPE st_type : cint; // attribute/index type st_blocks : fsblkcnt_t; // blocks allocated for file end; - + TStat = stat; pStat = ^stat; - { directory services } + { directory services } dirent = record d_dev : dev_t; d_pdev : dev_t; d_ino : ino_t; d_pino : ino_t; d_reclen : cushort; - d_name:array[0..255] of char; + d_name : array[0..255] of char; end; -(* dirent = record - d_dev : dev_t; - d_pdev : dev_t; - d_ino : ino_t; - d_pino : ino_t; - d_reclen : word; - d_name : Char; -// d_fileno : cuint32; // file number of entry -// d_reclen : cuint16; // length of this record -// d_type : cuint8; // file type, see below -// d_namlen : cuint8; // length of string in d_name -// d_name : array[0..(255 + 1)-1] of char; // name must be no longer than this - end;*) TDirent = dirent; pDirent = ^dirent; - dir = packed record - fd : cint; // file descriptor associated with directory - ent : dirent; -// dd_loc : clong; // offset in current buffer -// dd_size : clong; // amount of data returned by getdirentries -// dd_buf : pchar; // data buffer -// dd_len : cint; // size of data buffer -{$ifdef netbsdpowerpc} -// dd_pad1 : cint; -// dd_seek : cint64; // magic cookie returned by getdirentries -{$else} -// dd_seek : clong; // magic cookie returned by getdirentries -{$endif} -// dd_rewind : clong; // magic cookie for rewinding -// dd_flags : cint; // flags for readdir + dir = record + fd : cint; // file descriptor associated with directory + next_entry : cshort; + entries_left : cushort; + seek_position : clong; + current_position : clong; + first_entry : dirent; end; TDir = dir; pDir = ^dir; - utimbuf = record - actime : time_t; - modtime : time_t; - end; + utimbuf = record + actime : time_t; + modtime : time_t; + end; TUtimBuf = utimbuf; putimbuf = ^utimbuf; - flock = record - l_start : off_t; { starting offset } - l_len : off_t; { len = 0 means until end of file } - l_pid : pid_t; { lock owner } - l_type : cshort; { lock type: read/write, etc. } - l_whence: cshort; { type of l_start } - end; + flock = record + l_type : cshort; { lock type: read/write, etc. } + l_whence : cshort; { type of l_start } + l_start : off_t; { starting offset } + l_len : off_t; { len = 0 means until end of file } + l_pid : pid_t; { lock owner } + end; TFlock = flock; pFlock = ^flock; - tms = packed record - tms_utime : clock_t; { User CPU time } - tms_stime : clock_t; { System CPU time } - tms_cutime : clock_t; { User CPU time of terminated child procs } - tms_cstime : clock_t; { System CPU time of terminated child procs } - end; - TTms= tms; - pTms= ^tms; + tms = record + tms_utime : clock_t; { User CPU time } + tms_stime : clock_t; { System CPU time } + tms_cutime : clock_t; { User CPU time of terminated child procs } + tms_cstime : clock_t; { System CPU time of terminated child procs } + end; + TTms= tms; + pTms= ^tms; - TFDSetEl = Cardinal; - TFDSet = ARRAY[0..(FD_MAXFDSET div 32)-1] of TFDSetEl; - pFDSet = ^TFDSet; +type + TFDSetEl = Cardinal; + TFDSet = ARRAY[0..(FD_MAXFDSET div 32)-1] of TFDSetEl; + pFDSet = ^TFDSet; {***********************************************************************} { POSIX CONSTANT ROUTINE DEFINITIONS } @@ -244,19 +208,19 @@ CONST WNOHANG = 1; { don't block waiting } WUNTRACED = 2; { report status of stopped children } -Type - TRLimit = record - rlim_cur, { current (soft) limit } - rlim_max : TRLim; { maximum value for rlim_cur } - end; - PRLimit = ^TRLimit; +type + TRLimit = record + rlim_cur, { current (soft) limit } + rlim_max : TRLim; { maximum value for rlim_cur } + end; + PRLimit = ^TRLimit; - iovec = record - iov_base : pointer; - iov_len : size_t; - end; - tiovec=iovec; - piovec=^tiovec; + iovec = record + iov_base : pointer; + iov_len : size_t; + end; + tiovec=iovec; + piovec=^tiovec; {*************************************************************************} @@ -312,10 +276,11 @@ const B_LIBRARY_IMAGE = 2; B_ADD_ON_IMAGE = 3; B_SYSTEM_IMAGE = 4; + type - image_info = packed record - id : image_id; - _type : longint; + image_info = record + id: image_id; + _type: longint; sequence: longint; init_order: longint; init_routine: pointer; @@ -323,18 +288,12 @@ type device: dev_t; node: ino_t; name: array[0..1024{MAXPATHLEN}-1] of char; -{ name: string[255]; - name2: string[255]; - name3: string[255]; - name4: string[255]; - name5: string[5]; -} text: pointer; data: pointer; text_size: longint; data_size: longint; - end; - + end; + (*----- symbol types and functions ------------------------*) const B_SYMBOL_TYPE_DATA = $1; diff --git a/rtl/haiku/ptypes.inc b/rtl/haiku/ptypes.inc index 793b3b0ac9..b6185b4612 100644 --- a/rtl/haiku/ptypes.inc +++ b/rtl/haiku/ptypes.inc @@ -25,18 +25,18 @@ type fsblkcnt_t = clonglong; - TStatfs = packed record - bsize : Cardinal; - frsize : Cardinal; - blocks : fsblkcnt_t; - bfree : fsblkcnt_t; - bavail : fsblkcnt_t; - files : fsblkcnt_t; - ffree : fsblkcnt_t; - favail : fsblkcnt_t; - fsid : Cardinal; - flag : Cardinal; - namemax : Cardinal; + TStatfs = record + bsize : culong; + frsize : culong; + blocks : fsblkcnt_t; + bfree : fsblkcnt_t; + bavail : fsblkcnt_t; + files : fsblkcnt_t; + ffree : fsblkcnt_t; + favail : fsblkcnt_t; + fsid : culong; + flag : culong; + namemax : culong; end; PStatFS=^TStatFS; @@ -44,7 +44,7 @@ type converter : pointer; charset : array[0..63] of char; count : cuint; - data : array[0..1023+8] of char; { 1024 bytes for data, 8 for alignment space } + data : array[0..1023+8] of char; { 1024 bytes for data, 8 for alignment space } end; pmbstate_t = ^mbstate_t; @@ -173,7 +173,7 @@ type __padding: array[0..48-1-sizeof(_pthread_fastlock)-sizeof(pointer)-sizeof(clonglong)] of byte; __align: clonglong; end; - + pthread_condattr_t = record __dummy: cint; end; @@ -200,8 +200,8 @@ type __sem_waiting: pointer; end; - rlim_t = int64; - TRlim = rlim_t; + rlim_t = int64; + TRlim = rlim_t; CONST @@ -226,7 +226,7 @@ CONST PATH_MAX = 1024; {255} { Maximum number of bytes in pathname } SYS_NMLN = 32; {BSD utsname struct limit} - + SIG_MAXSIG = 32; //128; // highest signal version // BeOS const