int main(void) { /***READ SCALE FACTOR DATA AND PREPARE OBJECTS FOR INTERPOLATION ***/ int i; //For array manipulation /*Pointer to scale_factor.data file*/ FILE *frw; frw = fopen("scale_factor.dat","r"); /*Variables and arrays to read the data*/ double cosmictime[NLINESFRW], conftime, scale_factor[NLINESFRW], der_scale_factor[NLINESFRW]; /*Reading the data*/ for(i=0; i<NLINESFRW; i++) { fscanf(frw,"%lf %lf %lf %lf", &cosmictime[i], &conftime, &scale_factor[i], &der_scale_factor[i]); } /*Free space in memory*/ fclose(frw); /*** Initializes objects for interpolation. 1 is for interpolation of scale factor, 2 is for interpolation of derivative of scale factor ***/ /*Allocate space in memory*/ gsl_interp_accel *acc1 = gsl_interp_accel_alloc(); //Acceleration type object (for index lookup) gsl_interp_accel *acc2 = gsl_interp_accel_alloc(); gsl_spline *spline1 = gsl_spline_alloc(gsl_interp_cspline, NLINESFRW); //Spline type object (define interpolation type and space in memory, works for both) gsl_spline *spline2 = gsl_spline_alloc(gsl_interp_cspline, NLINESFRW); /*Initializes objects for interpolation*/ gsl_spline_init(spline1, cosmictime, scale_factor, NLINESFRW); //Initializes spline object for data cosmictime, scale_factor of size NLINES gsl_spline_init(spline2, cosmictime, der_scale_factor, NLINESFRW); //Initializes spline object for data cosmictime, der_scale_factor of size NLINES /************************************************************************************/ /***SOLVES GEODESIC EQUATIONS FOR PERTURBED FRW UNIVERSE WITH STATIC PLUMMER POTENTIAL ***/ /*Initial conditions*/ mydbl ti = 7.0 ,x0, r = -500.0, p0 = 1.0e-3, pr, lambda = 0.0, energy1, energy, v, difft, difference; double difftfrw, aem, aobs; x0 = C*ti; aem = interpolator(spline1, (double)(1.0*ti), acc1); pr = condition_factor(r, aem)*p0; energy1 = C*energy_factor(r)*p0; v = violation(r, p0, pr, aem); difft = (energy1 - energy1)/energy1; difftfrw = (aem/aem) - 1.0; difference = difft - (mydbl)(1.0*difftfrw); /*Pointer to file where solution of differential equation will be saved.*/ FILE *geodesic; geodesic = fopen("geodesic_solution.dat","w"); /*Write line of initial values in file*/ fprintf(geodesic, "%16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8e %16.8Le\n", lambda, x0, r, p0, pr, energy1, v, difft, difftfrw, difference); long long int ii; /*Solution of the differential equation*/ for(ii=0; ii< NSTEPS; ii++) { runge_kutta_4(spline1, acc1, spline2, acc2, &x0, &r, &p0, &pr, &lambda); if((ii%(NSTEPS/NLINES)) == 0) { energy = C*energy_factor(r)*p0; difft = (energy - energy1)/energy1; ti = x0/C; aobs = interpolator(spline1, (double)(1.0*ti), acc1); v = violation(r, p0, pr, aobs); difftfrw = (aem/aobs) - 1.0; difference = difft - (mydbl)(1.0*difftfrw); fprintf(geodesic, "%16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8Le %16.8e %16.8Le\n", lambda, x0, r, p0, pr, energy, v, difft, difftfrw, difference); } } /************************************************************************************/ /*** Releasing all used space in memory ***/ fclose(geodesic); //Close file storing the results gsl_spline_free(spline1); //Free memory of spline object gsl_spline_free(spline2); gsl_interp_accel_free(acc1); //Free memory of accel object gsl_interp_accel_free(acc2); }
int sys_execve(pink_easy_process_t *current, const char *name) { int r; char *path, *abspath; pid_t pid = pink_easy_process_get_pid(current); pink_bitness_t bit = pink_easy_process_get_bitness(current); proc_data_t *data = pink_easy_process_get_userdata(current); path = abspath = NULL; r = path_decode(current, 0, &path); if (r < 0) return deny(current); else if (r /* > 0 */) return r; if ((r = box_resolve_path(path, data->cwd, pid, 0, 1, &abspath)) < 0) { info("resolving path:\"%s\" [%s() index:0] failed for process:%lu [%s name:\"%s\" cwd:\"%s\"] (errno:%d %s)", path, name, (unsigned long)pid, pink_bitness_name(bit), data->comm, data->cwd, -r, strerror(-r)); errno = -r; r = deny(current); if (pandora->config.violation_raise_fail) violation(current, "%s(\"%s\")", name, path); free(path); return r; } free(path); /* Handling exec.kill_if_match and exec.resume_if_match: * * Resolve and save the path argument in data->abspath. * When we receive a PINK_EVENT_EXEC which means execve() was * successful, we'll check for kill_if_match and resume_if_match lists * and kill or resume the process as necessary. */ data->abspath = abspath; switch (data->config.sandbox_exec) { case SANDBOX_OFF: return 0; case SANDBOX_DENY: if (box_match_path(abspath, &data->config.whitelist_exec, NULL)) return 0; break; case SANDBOX_ALLOW: if (!box_match_path(abspath, &data->config.blacklist_exec, NULL)) return 0; break; default: abort(); } errno = EACCES; r = deny(current); if (!box_match_path(abspath, &pandora->config.filter_exec, NULL)) violation(current, "%s(\"%s\")", name, abspath); free(abspath); data->abspath = NULL; return r; }