source: trunk/kernel/syscalls/syscalls.h @ 9

Last change on this file since 9 was 1, checked in by alain, 8 years ago

First import

File size: 6.1 KB
RevLine 
[1]1/*
2 * syscall.h - kernel services definition
3 *
4 * Author  Ghassan Almaless (2007,2008,2009,2010,2011,2012)
5 *         Alain Greiner    (2016)
6 *
7 * Copyright (c) UPMC Sorbonne Universites
8 *
9 * This file is part of ALMOS-MKH.
10 *
11 * ALMOS-MKH is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2.0 of the License.
14 *
15 * ALMOS-MKH is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef _SYSCALL_H_
26#define _SYSCALL_H_
27
28/******************************************************************************************
29 * This enum defines the system calls index.
30 * It must be kept consistant with the syscall vector defined in sys_vector.c file.
31 *****************************************************************************************/
32enum
33{
34        SYS_EXIT,          /* 0  */
35        SYS_MMAP,          /* 1  */
36        SYS_CREATE,        /* 2  */
37        SYS_JOIN,          /* 3  */
38        SYS_DETACH,        /* 4  */
39        SYS_YIELD,         /* 5  */
40        SYS_SEMAPHORE,     /* 6  */
41        SYS_COND_VAR,      /* 7  */
42        SYS_BARRIER,       /* 8  */
43        SYS_RWLOCK,        /* 9  */
44        SYS_SLEEP,         /* 10 */
45        SYS_WAKEUP,        /* 11 */
46        SYS_OPEN,          /* 12 */
47        SYS_CREAT,         /* 13 */
48        SYS_READ,          /* 14 */
49        SYS_WRITE,         /* 15 */
50        SYS_LSEEK,         /* 16 */
51        SYS_CLOSE,         /* 17 */
52        SYS_UNLINK,        /* 18 */   
53        SYS_PIPE,          /* 19 */
54        SYS_CHDIR,         /* 20 */
55        SYS_MKDIR,         /* 21 */
56        SYS_MKFIFO,        /* 22 */   
57        SYS_OPENDIR,       /* 23 */
58        SYS_READDIR,       /* 24 */
59        SYS_CLOSEDIR,      /* 25 */
60        SYS_GETCWD,        /* 26 */
61        SYS_CLOCK,         /* 27 */
62        SYS_ALARM,         /* 28 */   
63        SYS_DMA_MEMCPY,    /* 29 */
64        SYS_UTLS,          /* 30 */ 
65        SYS_SIGRETURN,     /* 31 */
66        SYS_SIGNAL,        /* 32 */
67        SYS_SET_SIGRETURN, /* 33 */
68        SYS_KILL,          /* 34 */
69        SYS_GETPID,        /* 35 */
70        SYS_FORK,          /* 36 */
71        SYS_EXEC,          /* 37 */
72        SYS_GETATTR,       /* 38 */     
73        SYS_PS,            /* 39 */
74        SYS_MADVISE,       /* 40 */   
75        SYS_PAGEINFO,      /* 41 */
76        SYS_STAT,          /* 42 */
77        SYS_MIGRATE,       /* 43 */
78        SYS_SBRK,          /* 44 */
79        SYS_RMDIR,         /* 45 */
80        SYS_FTIME,         /* 46 */
81        SYS_CHMOD,         /* 47 */
82        SYS_FSYNC,         /* 48 */
83        SYS_GET_TOD,       /* 49 */
84        SYS_TIMES,         /* 50 */
85        SYSCALLS_NR,
86};
87
88/********************************************************************************************/
89/********************   Process related system calls  ***************************************/ 
90/********************************************************************************************/
91
92/*********************************************************************************************
93 * This function TODO
94 ********************************************************************************************/
95int sys_getpid();
96
97/*********************************************************************************************
98 * This function implement the "fork" system call.
99 * The calling process descriptor (parent process), and the associated thread descriptor are
100 * replicated in the same cluster as the calling thread, but the new process (child process)
101 * is registered in another target cluster, that will become the process owner.
102 * The child process and the associated main thread will be migrated to the target cluster
103 * later, when the child process makes an "exec" or any other system call.
104 * The target cluster depends on the "fork_user" flag and "fork_cxy" variable that can be
105 * stored in the calling thread descriptor by the specific fork_place() system call.
106 * If not, the sys_fork() function makes a query to the DQDT to select the target cluster.
107 *********************************************************************************************
108 * @ returns child process PID if success / returns -1 if failure
109 ********************************************************************************************/
110int sys_fork();
111
112/*********************************************************************************************
113 * This function implement the exec system call.
114 * It is executed in the client cluster, but the new process descriptor and main thread
115 * must be created in a server cluster, that is generally another cluster, using a RPC.
116 * - If the server_cluster is the client cluster, call directly make_exec() in local
117 *   mode, to change the process image and launch a new thread in local cluster.
118 *   finally, the old thread is deleted.
119 * - If the target_cluster is remote, call rpc_process_exec_client() to execute the
120 *   make_exec() in remote mode on the remote cluster, to create a new process
121 *   descriptor and a new thread on remote cluster. Finally, both the local
122 *   process descriptor and the local thread descriptor are deleted.
123 * In both case this function build an exec_info_t structure containing all informations
124 * required to build the new process descriptor and the associated thread, including
125 * the mode (local/remote).
126 * @ filename : string pointer on .elf filename (virtual pointer in user space)
127 * @ argv     : array of strings on process arguments (virtual pointers in user space)
128 * @ envp     : array of strings on Renvironment variables (virtual pointers in user space)
129 * @ returns O if success / returns non-zero if error.
130 ********************************************************************************************/
131int sys_exec( char  * filename,
132              char ** argv,
133              char ** envp );
134
135
136/*********************************************************************************************
137 * This function TODO
138 ********************************************************************************************/
139int sys_ps( uint32_t cmd, 
140            pid_t    pid, 
141            uint32_t tid );
142
143
144
145#endif
Note: See TracBrowser for help on using the repository browser.