OS_type_def.thy
author chunhan
Tue, 19 Nov 2013 09:27:25 +0800
changeset 66 5f86fb3ddd44
parent 1 7d9c0ed02b56
permissions -rwxr-xr-x
enrich_proc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     1
theory OS_type_def
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     2
imports Main Flask_type
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     3
begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     4
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     5
(****************************** os files ***************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     6
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     7
datatype t_open_must_flag =
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     8
  OF_RDONLY
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     9
| OF_WRONLY
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    10
| OF_RDWR
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    11
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    12
datatype t_open_option_flag = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    13
  OF_APPEND
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    14
| OF_CREAT
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    15
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    16
| OF_TRUNC
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    17
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    18
| OF_EXCL
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    19
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    20
| OF_DIRECTORY
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    21
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    22
| OF_OTHER
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    23
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    24
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    25
type_synonym t_open_flags = "t_open_must_flag \<times> t_open_option_flag set"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    26
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    27
definition is_read_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    28
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    29
  "is_read_flag flag \<equiv> let (mflag, oflag) = flag in (mflag = OF_RDONLY \<or> mflag = OF_RDWR)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    30
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    31
definition is_write_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    32
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    33
  "is_write_flag flag \<equiv> let (mflag, oflag) = flag in (mflag = OF_WRONLY \<or> mflag = OF_RDWR)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    34
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    35
definition is_excl_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    36
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    37
  "is_excl_flag flag \<equiv> let (mflag, oflag) = flag in (OF_EXCL \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    38
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    39
definition is_creat_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    40
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    41
  "is_creat_flag flag \<equiv> let (mflag, oflag) = flag in (OF_CREAT \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    42
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    43
definition is_creat_excl_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    44
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    45
  "is_creat_excl_flag flag \<equiv> let (mflag, oflag) = flag in (OF_CREAT \<in> oflag \<and> OF_EXCL \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    46
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    47
definition is_trunc_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    48
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    49
  "is_trunc_flag flag \<equiv> let (mflag, oflag) = flag in (OF_TRUNC \<in> oflag \<and> is_write_flag flag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    50
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    51
definition is_cloexec_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    52
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    53
  "is_cloexec_flag flag \<equiv> let (mflag, oflag) = flag in (OF_CLOEXEC \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    54
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    55
definition is_append_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    56
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    57
  "is_append_flag flag \<equiv> let (mflag, oflag) = flag in (OF_APPEND \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    58
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    59
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    60
definition is_dir_flag :: "t_open_flags \<Rightarrow> bool"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    61
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    62
  "is_dir_flag flag \<equiv> let (mflag, oflag) = flag in (OF_DIRECTORY \<in> oflag)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    63
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    64
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    65
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    66
type_synonym t_fname = string
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    67
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    68
(* listing of file path:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    69
 *   a#b#c:: b is a's parent and c is b's parent; 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    70
 *   [] represents the root file 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    71
 *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    72
type_synonym t_file = "t_fname list" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    73
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    74
type_synonym t_fd = "nat" (* given a fd, must has funs to tell its corresponding: "t_file \<times> t_open_flags \<times> t_inode" *) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    75
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    76
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    77
(* need not consideration, for rdonly transfer virus too 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    78
datatype t_sharememo_flag = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    79
  SHM_RDONLY
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    80
| SHM_OTHER
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    81
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    82
type_synonym t_sharememo_flags = "t_sharememo_flag set"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    83
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    84
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    85
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    86
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    87
(****************************** os sockets ***************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    88
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    89
datatype t_shutdown_how =
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    90
  SHUT_RD
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    91
| SHUT_WR
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    92
| SHUT_RDWR
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    93
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    94
datatype t_zero_one = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    95
  Z
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    96
| O
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    97
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    98
type_synonym t_inet_addr = "t_zero_one list"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    99
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   100
type_synonym t_socket_port = nat 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   101
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   102
type_synonym t_netif = string
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   103
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   104
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   105
datatype t_socket_af = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   106
  AF_UNIX "t_file \<times> t_file"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   107
| AF_INET "t_inet_addr \<times> t_socket_port \<times> t_inet_addr \<times> t_socket_port \<times> t_netdev"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   108
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   109
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   110
datatype t_socket_af =
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   111
(*  AF_UNIX  
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   112
| *)AF_INET
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   113
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   114
datatype t_socket_type =
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   115
  STREAM
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   116
| DGRAM
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   117
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   118
datatype t_sock_addr = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   119
  INET_ADDR t_inet_addr t_socket_port(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   120
| UNIX_ADDR t_file*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   121
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   122
type_synonym t_node = t_inet_addr (* a endpoint in the netword *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   123
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   124
datatype t_sock_trans_state = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   125
  Trans_Recv
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   126
| Trans_Send
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   127
| Trans_RS
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   128
| Trans_No
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   129
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   130
datatype t_sock_state =
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   131
  SS_create
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   132
| SS_bind
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   133
| SS_connect
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   134
| SS_listen
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   135
| SS_accepted
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   136
| SS_trans   "t_sock_trans_state" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   137
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   138
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   139
(****************************** os other IPCs ***************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   140
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   141
datatype t_shm_attach_flag = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   142
  SHM_RDONLY
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   143
| SHM_RDWR
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   144
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   145
type_synonym t_shm = nat
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   146
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   147
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   148
(* message queue is indexed by a nat, in OS
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   149
 * but logically it is a list, created as [], updated as a queue
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   150
 * so, it type should not be nat, but a t_msg list
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   151
 *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   152
type_synonym t_msgq = nat
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   153
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   154
(* a message of ID nat, but it has meaning under "in what message queue" *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   155
type_synonym t_msg  = "nat"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   156
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   157
(****************************** os inodes ***************************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   158
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   159
type_synonym t_inode_num = nat
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   160
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   161
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   162
datatype t_sock_af = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   163
  Tag_AF_UNIX "(t_file option \<times> t_file option)"  "t_socket_type"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   164
| Tag_AF_INET "(t_inet_addr \<times> t_socket_port) option \<times> (t_inet_addr \<times> t_socket_port) option \<times> t_netdev option" "t_socket_type" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   165
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   166
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   167
datatype t_inode_tag = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   168
  Tag_FILE                    (* this inode is a file, and its file is: "t_file" :: no need to do that and another reason is link may add two or more files to the inode, so it should be a list, can the maintainment of this list is tough *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   169
| Tag_DIR  (* do not contain chs anymore, for more infomation see svn log 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   170
  "t_inode_num list"   *)   (* Tag_DIR inode number list: the inode number list of subchild files (direct son the file) , means: new created child file should add to this field. *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   171
| Tag_TCP_SOCK   (* information below is turn to seperative listener functions 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   172
"(t_inet_addr \<times> t_socket_port) option \<times> (t_inet_addr \<times> t_socket_port) option \<times> t_netdev option" "t_socket_type"  *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   173
| Tag_UDP_SOCK
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   174
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   175
(* type_synonym t_inode = "nat \<times> t_inode_tag" (* inode (id, tag) contains file internal id and directory tag attributes *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   176
  // not needed any more: for inode num and its tag now are seperated by two funcs.
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   177
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   178
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   179
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   180
type_synonym t_process = nat
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   181
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   182
type_synonym t_trunc_len = nat
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   183
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   184
type_synonym t_socket = "t_process \<times> t_fd"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   185
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   186
(* each constructor is defined according to each security-class *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   187
datatype t_object = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   188
  O_proc "t_process"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   189
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   190
| O_file "t_file"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   191
| O_fd   "t_process" "t_fd"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   192
| O_dir  "t_file" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   193
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   194
| O_node     "t_node"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   195
| O_tcp_sock "t_socket"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   196
| O_udp_sock "t_socket"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   197
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   198
| O_shm  "t_shm"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   199
| O_msgq "t_msgq"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   200
| O_msg  "t_msgq"   "t_msg"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   201
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   202
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   203
datatype t_tainted_obj = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   204
  TO_proc "t_process"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   205
| TO_file "t_file"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   206
| TO_msg  "t_msgq"   "t_msg"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   207
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   208
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   209
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   210
(* not needed anymore 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   211
datatype t_clone_share_flag = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   212
| CF_share_ipc
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   213
| CF_share_fd
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   214
| CF_share_both
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   215
| CF_no_share  *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   216
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   217
(* unformalised system calls:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   218
 * 1. process management
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   219
 * 1.1 wait: nothing to do with tainting relation
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   220
 * 1.2 getpriority/setpriority/getsched/setsched: nothing to do with security
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   221
 * 1.3 getcap/setcap: "at this time that will not be done"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   222
 * 1.4 getpgid/setpgid: ...
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   223
 *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   224
datatype t_event = 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   225
  (* process management *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   226
(* trace can be done trough tags of cloning and execving, but I ignore this. *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   227
  Execve     "t_process" "t_file"     "t_fd set"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   228
(* | Uselib     "t_process" "t_file"  *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   229
| Clone      "t_process" "t_process"  "t_fd set" "t_shm set" (* "t_clone_share_flag" is not needed, as event should record the fds and shms that passed to childprocess *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   230
| Kill       "t_process" "t_process"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   231
| Ptrace     "t_process" "t_process"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   232
| Exit       "t_process"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   233
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   234
| Open          "t_process" "t_file" "t_open_flags" "t_fd" "nat option"  (* the last nat option : if create file, the is Some inode_num else None *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   235
| ReadFile      "t_process" "t_fd"                          
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   236
| WriteFile     "t_process" "t_fd"                          
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   237
(* | Sendfile      "t_process" "t_fd"   "t_fd"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   238
 can be modeled as readfile then writefile *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   239
| CloseFd       "t_process" "t_fd"     
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   240
| UnLink        "t_process" "t_file"                        
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   241
| Rmdir         "t_process" "t_file"                        
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   242
| Mkdir         "t_process" "t_file" "nat"                             (* last nat: inode_num *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   243
| LinkHard      "t_process" "t_file" "t_file"               
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   244
| Truncate      "t_process" "t_file" "t_trunc_len"          
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   245
(* | FTruncate     "t_process" "t_fd"   "t_trunc_len"          *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   246
(*
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   247
| Rename        "t_process" "t_file" "t_file"               
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   248
*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   249
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   250
(* the message is in the msgq, so we must build a cache(list)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   251
 * to store the unreceived msg yet. And the os_grant should
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   252
 * check if a message queue is empty before RecvMsg. 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   253
 *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   254
| CreateMsgq    "t_process" "t_msgq"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   255
| SendMsg       "t_process" "t_msgq" "t_msg"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   256
| RecvMsg       "t_process" "t_msgq" "t_msg"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   257
| RemoveMsgq    "t_process" "t_msgq"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   258
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   259
| CreateShM     "t_process" "t_shm"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   260
| Attach        "t_process" "t_shm" "t_shm_attach_flag"                        
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   261
| Detach        "t_process" "t_shm"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   262
| DeleteShM     "t_process" "t_shm"                         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   263
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   264
| CreateSock    "t_process" "t_socket_af" "t_socket_type" "t_fd" "nat"  (* last nat: inode_num *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   265
| Bind          "t_process" "t_fd"        "t_sock_addr"                    
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   266
| Connect       "t_process" "t_fd"        "t_sock_addr"                     
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   267
| Listen        "t_process" "t_fd"                                    
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   268
| Accept        "t_process" "t_fd"        "t_sock_addr"   "nat"  "t_fd" "nat"  (* addr: remote socket address; nat: port num;  last nat: inode_num *)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   269
| SendSock      "t_process" "t_fd"                          
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   270
| RecvSock      "t_process" "t_fd"                          
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   271
| Shutdown      "t_process" "t_fd"        "t_shutdown_how"         
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   272
     
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   273
(* the state of the system is decided by the initial state and the event trace*)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   274
type_synonym t_state = "t_event list"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   275
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   276
end