Browse Source

* Remove local redefinition of types and clarify TIPC_Perm record

git-svn-id: trunk@20354 -
pierre 13 years ago
parent
commit
ea9f152d64
1 changed files with 20 additions and 21 deletions
  1. 20 21
      rtl/unix/ipc.pp

+ 20 - 21
rtl/unix/ipc.pp

@@ -38,22 +38,11 @@ Type
 
 
    {$IFDEF FreeBSD}
    {$IFDEF FreeBSD}
    TKey   = clong;
    TKey   = clong;
-   {$ELSE}
+{$ELSE}
    TKey   = cint;
    TKey   = cint;
-   {$ENDIF}
+{$ENDIF}
    key_t  = TKey;
    key_t  = TKey;
 
 
-{$if defined(FreeBSD) or defined(Darwin) or defined(OpenBSD)}
-   uid_t = cushort;
-   gid_t = cushort;
-   mode_t = cushort;
-{$endif}
-{$ifdef netbsd}
-   uid_t = cuint32;
-   gid_t = cuint32;
-   mode_t = cuint32;
-{$endif}
-
 Const
 Const
   { IPC flags for get calls }
   { IPC flags for get calls }
 
 
@@ -88,10 +77,22 @@ Const
 
 
 type
 type
   PIPC_Perm = ^TIPC_Perm;
   PIPC_Perm = ^TIPC_Perm;
-{$ifdef darwin}
+{$ifdef darwin }
 {$packrecords 4}
 {$packrecords 4}
-{$endif}
-{$if defined(FreeBSD) or defined(Darwin) or defined(OpenBSD) or defined(NetBSD) }
+{ This is also the strcut for FreeBSD up to version 7
+  renamed ipc_perm_old in /usr/include/sys/ipc.h in version 8 and after }
+  TIPC_Perm = record
+        cuid  : cushort;  { creator user id }
+        cgid  : cushort;  { creator group id }
+        uid   : cushort;  { user id }
+        gid   : cushort;  { group id }
+        mode  : cushort;  { r/w permission }
+        seq   : cushort;  { sequence # (to generate unique msg/sem/shm id) }
+        key   : key_t;    { user specified msg/sem/shm key }
+  End;
+{$packrecords c}
+{$else }
+{$if defined(NetBSD) or defined(OpenBSD) or defined(FreeBSD) }
   TIPC_Perm = record
   TIPC_Perm = record
         cuid  : uid_t;  { creator user id }
         cuid  : uid_t;  { creator user id }
         cgid  : gid_t;  { creator group id }
         cgid  : gid_t;  { creator group id }
@@ -101,10 +102,7 @@ type
         seq   : cushort;  { sequence # (to generate unique msg/sem/shm id) }
         seq   : cushort;  { sequence # (to generate unique msg/sem/shm id) }
         key   : key_t;    { user specified msg/sem/shm key }
         key   : key_t;    { user specified msg/sem/shm key }
   End;
   End;
-{$ifdef darwin}
-{$packrecords c}
-{$endif}
-{$else} // linux
+{$else } // linux
 
 
 {$ifdef cpu32}
 {$ifdef cpu32}
   {$ifndef linux_ipc64}
   {$ifndef linux_ipc64}
@@ -143,7 +141,8 @@ type
         seq   : cushort;
         seq   : cushort;
   End;
   End;
 {$endif not(linux_ipc32) and not(FPC_USE_LIBC)}
 {$endif not(linux_ipc32) and not(FPC_USE_LIBC)}
-{$endif}
+{$endif not netbsd}
+{$endif not others}
 
 
 
 
 { Function to generate a IPC key. }
 { Function to generate a IPC key. }