Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

proc.h

Go to the documentation of this file.
00001 
00011 #ifndef FISH_PROC_H
00012 #define FISH_PROC_H
00013 
00014 #include <wchar.h>
00015 #include <signal.h>
00016 #include <unistd.h>
00017 #include <sys/time.h>
00018 
00019 #include "util.h"
00020 #include "io.h"
00021 
00025 #define STATUS_UNKNOWN_COMMAND 127
00026 
00030 #define STATUS_NOT_EXECUTABLE 126
00031 
00035 #define STATUS_EXEC_FAIL 125
00036 
00040 #define STATUS_UNMATCHED_WILDCARD 124
00041 
00045 #define STATUS_BUILTIN_OK 0
00046 
00050 #define STATUS_BUILTIN_ERROR 1
00051 
00055 enum
00056 {
00060         EXTERNAL,
00064         INTERNAL_BUILTIN,
00068         INTERNAL_FUNCTION,
00072         INTERNAL_BLOCK,
00076         INTERNAL_EXEC,
00080         INTERNAL_BUFFER,
00081       
00082 }
00083         ;
00084 
00085 enum
00086 {
00087         JOB_CONTROL_ALL, 
00088         JOB_CONTROL_INTERACTIVE,
00089         JOB_CONTROL_NONE,
00090 }
00091         ;
00092 
00126 typedef struct process
00127 {
00133         int type;
00134 
00136         wchar_t **argv;
00137 
00139         wchar_t *actual_cmd;       
00140 
00142         pid_t pid;
00143 
00145         int pipe_write_fd;
00146 
00148         int pipe_read_fd;
00149 
00151         volatile int completed;
00152 
00154         volatile int stopped;
00155 
00157         volatile int status;
00158 
00160         int count_help_magic;
00161 
00163         struct process *next;           
00164 #ifdef HAVE__PROC_SELF_STAT
00165 
00166         struct timeval last_time;
00168         unsigned long last_jiffies;     
00169 #endif
00170 } 
00171         process_t;
00172 
00178 #define JOB_NOTIFIED 1
00179 
00184 #define JOB_FOREGROUND 2
00185 
00192 #define JOB_CONSTRUCTED 4
00193 
00198 #define JOB_SKIP_NOTIFICATION 8
00199 
00204 #define JOB_NEGATE 16
00205 
00210 #define JOB_WILDCARD_ERROR 32
00211 
00217 #define JOB_SKIP 64
00218 
00224 #define JOB_CONTROL 128
00225 
00230 #define JOB_TERMINAL 256
00231 
00236 typedef struct job
00237 {
00243         wchar_t *command;              
00244         
00248         process_t *first_process;  
00249         
00254         pid_t pgid;   
00255         
00262         struct termios tmodes;
00263     
00269         int job_id;
00270         
00274         io_data_t *io;
00275                         
00279         struct job *next;           
00280 
00284         int flags;
00285         
00286 } 
00287         job_t;
00288 
00292 extern int is_subshell;
00293 
00297 extern int is_block;
00298 
00302 extern int is_interactive;
00303 
00307 extern int is_interactive_session;
00308 
00312 extern int is_login;
00313 
00317 extern int is_event;
00318 
00322 extern job_t *first_job;   
00323 
00334 extern int proc_had_barrier;
00335 
00339 extern pid_t proc_last_bg_pid;
00340 
00346 extern int job_control_mode;
00347 
00353 extern int no_exec;
00354 
00358 void job_set_flag( job_t *j, int flag, int set );
00359 
00363 int job_get_flag( job_t *j, int flag );
00364 
00368 void proc_set_last_status( int s );
00369 
00373 int proc_get_last_status();
00374 
00378 void job_free( job_t* j );
00379 
00385 job_t *job_create();
00386 
00391 job_t *job_get(int id);
00392 
00396 job_t *job_get_from_pid(int pid);
00397 
00401 int job_is_stopped( const job_t *j );
00402 
00406 int job_is_completed( const job_t *j );
00407 
00416 void job_continue( job_t *j, int cont );
00417 
00424 int job_reap( int interactive );
00425 
00430 void job_handle_signal( int signal, siginfo_t *info, void *con );
00431 
00435 int job_signal( job_t *j, int signal );
00436 
00437 #ifdef HAVE__PROC_SELF_STAT
00438 
00443 unsigned long proc_get_jiffies( process_t *p );
00444 
00449 void proc_update_jiffies();
00450 
00451 #endif
00452 
00458 void proc_sanity_check();
00459 
00464 void proc_fire_event( const wchar_t *msg, int type, pid_t pid, int status );
00465 
00469 void proc_init();
00470 
00474 void proc_destroy();
00475 
00480 void proc_push_interactive( int value );
00481 
00486 void proc_pop_interactive();
00487 
00488 #endif

Generated on Sun Jan 13 02:52:29 2008 for fish by  doxygen 1.4.4