Changeset 434 for trunk/libs
- Timestamp:
- Feb 14, 2018, 3:41:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/stdio.h
r426 r434 264 264 265 265 /***************************************************************************************** 266 * This function implements the POSIX "kill" system call.266 * This function implements the "kill" system call on the user side. 267 267 * It register the signal defined by the <sig_id> argument in all thread descriptors 268 268 * of a target process identified by the <pid> argument. This is done in all clusters 269 269 * containing threads for the target process. 270 * It can be executed by any thread running in any cluster, as this function uses 271 * remote access to traverse the list of process copies stored in the owner cluster, 272 * and the RPC_SIGNAL_RISE to signal the remote threads. 273 * This function does nothing for (sig_id == 0). This can be used to check process pid. 274 * TODO : This first implementation supports only SIGKILL / SIGSTOP / SIGCONT values. 270 275 ***************************************************************************************** 271 276 * @ pid : target process identifier. 272 * @ sig_id : index defining the signal type (from 1 to 31).277 * @ sig_id : index defining the signal type. 273 278 * @ return 0 if success / returns -1 if failure. 274 279 ****************************************************************************************/ … … 277 282 278 283 /***************************************************************************************** 279 * This function implements the POSIX "getpid" system call.284 * This function implements the "getpid" system call on the user side. 280 285 ***************************************************************************************** 281 286 * @ returns the process PID for the calling thread process. … … 284 289 285 290 /***************************************************************************************** 286 * This function implement the POSIX "fork" system call.291 * This function implement the "fork" system call on the user side. 287 292 * The calling process descriptor (parent process), and the associated thread descriptor 288 * are replicated in the same cluster as the calling thread, but the new process (child289 * process) is registered in another target cluster, that is the new process owner.290 * The child process and the associated main thread will be migrated to the target cluster291 * later, when the child process makes an "exec" or any other system call.293 * are replicated in a - likely - remote cluster, that becomes the new process owner. 294 * The child process get a new PID is linked to the parent PID. The child process inherit 295 * from the parent process the memory image, and all open files (including the TXT). 296 * The child process becomes the TXT terminal owner. 292 297 * The target cluster depends on the "fork_user" flag and "fork_cxy" variable that can be 293 298 * stored in the calling thread descriptor by the specific fork_place() system call. 294 299 * If not, the kernel function makes a query to the DQDT to select the target cluster. 295 300 ***************************************************************************************** 296 * @ returns child process PID if success / returns -1 if failure 301 * @ if success, returns child process PID to parent, and return O to child. 302 * @ if failure, returns -1 to parent / no child process is created. 297 303 ****************************************************************************************/ 298 304 int fork(); 299 305 300 306 /***************************************************************************************** 301 * This function implement the "exec" system call. 302 * It is executed in the client cluster, but the new process descriptor and main thread 303 * must be created in a server cluster, that is generally another cluster. 304 * - if the server_cluster is the client cluster, call directly the process_make_exec() 305 * function to create a new process, and launch a new thread in local cluster. 306 * - if the target_cluster is remote, call rpc_process_exec_client() to execute the 307 * process_make_exec() on the remote cluster. 308 * In both case this function build an exec_info_t structure containing all informations 309 * required to build the new process descriptor and the associated thread. 310 * Finally, the calling process and thread are deleted. 307 * This function implement the "exec" system call on the user side. 308 * It creates, in the same cluster as the calling thread, a new process descriptor, 309 * and a new associated main thread descriptor, executing a new memory image defined 310 * by the <filename> argument. This new process inherit from the old process the PID 311 * and the PPID, as well as all open files (including the TXT). 312 * The old process descriptor, and all its threads are blocked, and marked for deletion. 313 * Therefore the exec syscall does not return to the calling thread in case of success. 314 * This function build an exec_info_t structure containing the new process arguments, 315 * as defined by the <arv> argument, and the new process environment variables, 316 * as defined by the <envp> argument. 317 * TODO : the <argv> and <envp> arguments are not supported yet (both must be NULL). 311 318 ***************************************************************************************** 312 319 * @ filename : string pointer on .elf filename (virtual pointer in user space) 313 320 * @ argv : array of strings on process arguments (virtual pointers in user space) 314 321 * @ envp : array of strings on environment variables (virtual pointers in user space) 315 * @ returns Oif success / returns -1 if failure.322 * @ does not return if success / returns -1 if failure. 316 323 ****************************************************************************************/ 317 324 int exec( char * filename,
Note: See TracChangeset
for help on using the changeset viewer.