File: SysLib.md

package info (click to toggle)
mocka 9905-2
  • links: PTS
  • area: non-free
  • in suites: potato, sarge, woody
  • size: 5,436 kB
  • ctags: 160
  • sloc: asm: 23,203; makefile: 124; sh: 102; ansic: 23
file content (131 lines) | stat: -rw-r--r-- 3,929 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
(******************************************************************************)
(* Copyright (c) 1988 by GMD Karlruhe, Germany				      *)
(* Gesellschaft fuer Mathematik und Datenverarbeitung			      *)
(* (German National Research Center for Computer Science)		      *)
(* Forschungsstelle fuer Programmstrukturen an Universitaet Karlsruhe	      *)
(* All rights reserved.							      *)
(******************************************************************************)

(* for UNIX only *)
FOREIGN MODULE SysLib;

   FROM SYSTEM IMPORT ADDRESS;

   TYPE
      SIGNED    = INTEGER;
      UNSIGNED  = CARDINAL;

      inoT      = LONGCARD;
      offT      = LONGINT;
      devT      = SHORTCARD;
      timeT     = LONGINT;
      modeT	= SHORTCARD;
      uidT	= SHORTCARD;
      gidT	= SHORTCARD;
      nlinkT	= SHORTCARD;
      clockT	= LONGINT;

      umodeT	= SHORTCARD;

      Stat =
         RECORD
            stDev    : devT;
            pad1     : SHORTCARD;
	    stIno    : inoT;
            stMode   : umodeT;
            stNlink  : nlinkT;
            stUid    : uidT;
            stGid    : gidT;
            stRdev   : devT;
            pad2     : SHORTCARD;
	    stSize   : offT;
            stBlksize: LONGCARD;
            stBlocks : LONGCARD;
            stAtime  : timeT;
            unused1  : LONGCARD;
            stMtime  : timeT;
            unused2  : LONGCARD;
            stCtime  : timeT;
            unused3  : LONGCARD;
            unused4  : LONGCARD;
            unused5 :  LONGCARD;
         END;

      tms =
	 RECORD
	    utime  : clockT;  
	    stime  : clockT;
	    cutime : clockT;
	    cstime : clockT;
	 END;


   CONST

      (* flags for open *)

      oTRUNC   = 01000B;    (* open with truncation *)
      oAPPEND  = 02000B;    (* append, i.e writes at the end *)
      oRDWR    =    02B;    (* open for reading and writing *)
      oWRONLY  =    01B;    (* open for writing only *)
      oRDONLY  =     0B;    (* open for reading only *)

      (* file access permisson flags (for create and umask) *)

      pXUSID   = 04000B;    (* set user ID on execution *)
      pXGRID   = 02000B;    (* set group ID on execution *)
      pSTEXT   = 01000B;    (* save text image after execution *)
      pROWNER  =  0400B;    (* read by owner *)
      pWOWNER  =  0200B;    (* write by owner *)
      pXOWNER  =  0100B;    (* execute by owner *)
      pRGROUP  =   040B;    (* read by group *)
      pWGROUP  =   020B;    (* write by group *)
      pXGROUP  =   010B;    (* execute by group *)
      pROTHERS =    04B;    (* read by others *)
      pWOTHERS =    02B;    (* write by others *)
      pXOTHERS =    01B;    (* execute by others *)
      pEMPTY   =     0B;    (* no flag set *)
    
      (* file access check flags (for access) *)
 
      cREAD    = 04H;       (* check if readable *)
      cWRITE   = 02H;       (* check if writable *)
      cEXEC    = 01H;       (* check if executable *)
      cEXISTS  =  0H;       (* check existance *)
 

   PROCEDURE umask (cmask : modeT) : modeT;

   PROCEDURE access (path  : ADDRESS; amode : SIGNED) : SIGNED;

   PROCEDURE creat (path  : ADDRESS; cmode : SIGNED) : SIGNED;

   PROCEDURE open (path : ADDRESS; oflag : SIGNED) : SIGNED;

   PROCEDURE close (fildes : SIGNED) : SIGNED;

   PROCEDURE unlink (path : ADDRESS) : SIGNED;

   PROCEDURE read (fildes : SIGNED; buf : ADDRESS; nbyte : UNSIGNED) : SIGNED;

   PROCEDURE write (fildes : SIGNED; buf : ADDRESS; nbyte : UNSIGNED) : SIGNED;

   PROCEDURE sbrk (incr : SIGNED): ADDRESS;

   PROCEDURE malloc (size : UNSIGNED) : ADDRESS;

   PROCEDURE free (ptr : ADDRESS);
   PROCEDURE stat (path: ADDRESS; VAR buf: Stat) : SIGNED;

   PROCEDURE fstat (fd: SIGNED  ; VAR buf: Stat) : SIGNED;
   PROCEDURE time (VAR t : INTEGER);

   PROCEDURE times (VAR buffer: tms);

   PROCEDURE system (string : ADDRESS) : SIGNED;

   PROCEDURE exit (n: SIGNED);

   PROCEDURE abort ();

END SysLib.