void * worker(void *args) { int id = (long) args; int l1n, l2n, l3n; char dirname[1024]; affinity_set(id); sprintf(dirname, "%s%d", PATH_PREFIX, id); create_dir(dirname); for (l1n = 0; l1n < NR_SUBDIRS; l1n++) { sprintf(dirname, "%s%d/%d", PATH_PREFIX, id, l1n); create_dir(dirname); for (l2n = 0; l2n < NR_SUBDIRS; l2n++) { sprintf(dirname, "%s%d/%d/%d", PATH_PREFIX, id, l1n, l2n); create_dir(dirname); for (l3n = 0; l3n < NR_SUBDIRS; l3n++) { sprintf(dirname, "%s%d/%d/%d/%d", PATH_PREFIX, id, l1n, l2n, l3n); create_dir(dirname); } } } return NULL; }
static char * _get_log_filename(const char * const other, const char * const login, GDateTime *dt, gboolean create) { gchar *chatlogs_dir = files_get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); g_free(chatlogs_dir); gchar *login_dir = str_replace(login, "@", "_at_"); g_string_append_printf(log_file, "/%s", login_dir); if (create) { create_dir(log_file->str); } free(login_dir); gchar *other_file = str_replace(other, "@", "_at_"); g_string_append_printf(log_file, "/%s", other_file); if (create) { create_dir(log_file->str); } free(other_file); gchar *date = g_date_time_format(dt, "/%Y_%m_%d.log"); g_string_append(log_file, date); char *result = strdup(log_file->str); g_string_free(log_file, TRUE); return result; }
/* create the server directory and chdir to it */ static void create_server_dir( const char *dir ) { char *p, *server_dir; struct stat st, st2; if (!(server_dir = strdup( dir ))) fatal_error( "out of memory\n" ); /* first create the base directory if needed */ p = strrchr( server_dir, '/' ); *p = 0; create_dir( server_dir, &st ); /* now create the server directory */ *p = '/'; create_dir( server_dir, &st ); if (chdir( server_dir ) == -1) fatal_perror( "chdir %s", server_dir ); if ((server_dir_fd = open( ".", O_RDONLY )) == -1) fatal_perror( "open %s", server_dir ); if (fstat( server_dir_fd, &st2 ) == -1) fatal_perror( "stat %s", server_dir ); if (st.st_dev != st2.st_dev || st.st_ino != st2.st_ino) fatal_error( "chdir did not end up in %s\n", server_dir ); free( server_dir ); }
static void test_getNextInTree_UriList_RootWithOnlyThreeDirs() { // No before! create_dir(testdir_path, ""); create_dir(testdir_path, "/apa"); create_dir(testdir_path, "/bepa"); create_dir(testdir_path, "/cepa"); GSList *uri_list = NULL; uri_list = add_path_to_list(uri_list, testdir_path, "/bepa.png"); uri_list = add_path_to_list(uri_list, testdir_path, "/cepa.jpg"); GError *error = NULL; GNode *tree = create_tree_from_uri_list(uri_list, TRUE, TRUE, NULL, NULL, &error); assert_error_is_null(error); free(error); g_slist_free_full(uri_list, free); assert_trees_equal("Get Next ─ Uri List ─ Input is Root with only three dirs", tree, get_next_in_tree(tree)); assert_trees_equal("Get First ─ Uri List ─ Input is Root with only three dirs", tree, get_first_in_tree(tree)); assert_trees_equal("Get Last ─ Uri List ─ Input is Root with only three dirs", tree, get_last_in_tree(tree)); free_whole_tree(tree); after(); }
void System::init_directories() { if (userdir.empty()) userdir = find_userdir(); std::string statdir = get_userdir(); create_dir(statdir); // FIXME: We need a better seperation between user created levels, // FIXME: third party levels and levels from the base distri create_dir(statdir + "levels/"); create_dir(statdir + "levels/dist"); create_dir(statdir + "themes/"); // Savegames (FIXME: rename to savegames/?) create_dir(statdir + "savegames/"); // User created images create_dir(statdir + "images/"); // Thumbnail cache create_dir(statdir + "cache/"); // Recorded demos will per default be writen in this directory create_dir(statdir + "demos/"); // User created images create_dir(statdir + "backup/"); // Screenshots will be dumped to that directory: create_dir(statdir + "screenshots/"); }
/* Walk along a path, making sure that all directories in that path exist, * creating them if necessary. */ static int create_path(pool *p, const char *path, const char *user, uid_t dir_uid, gid_t dir_gid, mode_t dir_mode, uid_t dst_uid, gid_t dst_gid, mode_t dst_mode) { char *currpath = NULL, *tmppath = NULL; struct stat st; pr_fs_clear_cache(); if (pr_fsio_stat(path, &st) == 0) { /* Path already exists, nothing to be done. */ errno = EEXIST; return -1; } pr_event_generate("core.create-home", user); /* The special-case values of -1 for dir UID/GID mean that the destination * UID/GID should be used for the parent directories. */ if (dir_uid == (uid_t) -1) { dir_uid = dst_uid; } if (dir_gid == (gid_t) -1) { dir_gid = dst_gid; } pr_trace_msg(trace_channel, 5, "creating home directory '%s' for user '%s'", path, user); pr_log_debug(DEBUG3, "creating home directory '%s' for user '%s'", path, user); tmppath = pstrdup(p, path); currpath = "/"; while (tmppath && *tmppath) { char *currdir = strsep(&tmppath, "/"); currpath = pdircat(p, currpath, currdir, NULL); /* If tmppath is NULL, we are creating the last part of the path, so we * use the configured mode, and chown it to the given UID and GID. */ if (tmppath == NULL || (*tmppath == '\0')) { create_dir(currpath, dst_uid, dst_gid, dst_mode); } else { create_dir(currpath, dir_uid, dir_gid, dir_mode); } pr_signals_handle(); } pr_trace_msg(trace_channel, 5, "home directory '%s' created", path); pr_log_debug(DEBUG3, "home directory '%s' created", path); return 0; }
int main(void) { int cmd, ret; vfs_init(&vfs); // Set up filesystem create_dir(&vfs, "/etc"); crond = create_dir(&vfs, "/etc/crond"); create_dir(&vfs, "/home"); pwd = create_dir(&vfs, "/home/user"); pwd->owner = USER_UID; while (1) { // Simulate a period cron job do_cron(); if (read_all(STDIN, &cmd, sizeof(cmd)) != sizeof(cmd)) continue; if (cmd == -1) break; switch (cmd) { case CD: ret = do_cd(); break; case READ: ret = do_read(); break; case WRITE: ret = do_write(); break; case LN: ret = do_ln(); break; case RM: ret = do_rm(); break; default: continue; } write_all(STDOUT, &ret, sizeof(ret)); } vfs_destroy(&vfs); return 0; }
int main(int argc, char *argv[]) { int i; if (argc <= 0 || !argv[0]) { fprintf(stderr, "invalid program name\n"); return 1; } program_name = os_GetLastname(argv[0]); get_program_dir(argv[0]); for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--version")) { print_version(); } else if (!strcmp(argv[i], "--help")) { print_help(); } else { die("invalid option: %s", argv[i]); } } get_config_file(); parse_config(); create_dir(); do_loop(); return 0; }
int64_t copy_file_to_file(const char *input, const char *output) { int in = open(input, O_RDONLY); if (in == -1) return -1; struct stat info; if (fstat(in, &info) == -1) { close(in); return -1; } int out = open(output, O_WRONLY|O_CREAT|O_TRUNC, info.st_mode); if (out == -1 && errno == ENOTDIR) { char dir[PATH_MAX]; path_dirname(output, dir); if (create_dir(dir, S_IRWXU)) { out = open(output, O_WRONLY|O_CREAT|O_TRUNC, info.st_mode); } } if (out == -1) { close(in); return -1; } int64_t total = copy_fd_to_fd(in, out); close(in); close(out); return total; }
int main(int argc, char **argv) { pid_t pid[32], p; int i; uint64_t start, end, usec; printf("Create directories...\n"); start = read_tsc(); create_dir(PATH_PREFIX); for (i = 0; i < nr_threads; i++) { p = fork(); if (p == 0) { worker((void *) (long) i); exit(0); } pid[i] = p; } for (i = 0; i < nr_threads; i++) { waitpid(pid[i], NULL, 0); } end = read_tsc(); usec = (end - start) * 1000000 / get_cpu_freq(); printf("usec: %ld\t\n", usec); printf("Cleanup directories...\n"); /* system("rm -rf /tmp/_dirs"); */ return 0; }
/* Create a directory, including parent directories as necessary. */ void create_dir(char *pathname, int mode) { if (pathname != NULL) { char *p; int r; /* Strip trailing '/' */ if (pathname[strlen(pathname) - 1] == '/') pathname[strlen(pathname) - 1] = '\0'; /* Try creating the directory. */ r = mkdir(pathname, mode); if (r != 0 && errno != EEXIST) { /* On failure, try creating parent directory. */ p = strrchr(pathname, '/'); if (p != NULL) { *p = '\0'; create_dir(pathname, 0755); *p = '/'; r = mkdir(pathname, mode); } } if (r != 0 && errno != EEXIST) fprintf(stderr, "ERROR CREATING DIRECTORY %s\n", pathname); } }
int main (int argc, char **argv) { char * out_dir; char out_file[128]; int i; seek_table_type table; fas_error_type video_error; fas_context_ref_type context, seek_context; cmdname = argv[0]; if (argc < 3) { show_help(); fail("arguments\n"); } table = read_table_file(argv[2]); if (table.num_entries == 0) fail("bad table\n"); fas_initialize (FAS_FALSE, FAS_RGB24); video_error = fas_open_video (&context, argv[1]); if (video_error != FAS_SUCCESS) fail("fail on open\n"); video_error = fas_put_seek_table(context, table); if (video_error != FAS_SUCCESS) fail("fail on put_seek_table\n"); video_error = fas_open_video (&seek_context, argv[1]); if (video_error != FAS_SUCCESS) fail("fail on open\n"); if (argc >= 4) { out_dir = argv[3]; create_dir(out_dir); } else { out_dir = "."; } for(i=0;i<table.num_entries;i++) { fas_raw_image_type image_buffer; // int frame_index = table.array[table.num_entries - i - 1].display_index; int frame_index = table.array[i].display_index; if (FAS_SUCCESS != fas_seek_to_frame(context, frame_index)) fail("failed on seek"); if (FAS_SUCCESS != fas_get_frame (context, &image_buffer)) fail("failed on rgb image\n"); sprintf(out_file, "%s/frame_%04d.ppm", out_dir, frame_index); fprintf(stderr, "Writing %s (seek_table_value=%d frame_index=%d)\n", out_file, frame_index, fas_get_frame_index(context)); ppm_save(&image_buffer, out_file); fas_free_frame (image_buffer); } success(); }
int readFileList(char *basePath, int dir_id) { DIR *dir; struct dirent *ptr; char base[1000]; if ((dir=opendir(basePath)) == NULL) { return 0; } while ((ptr=readdir(dir)) != NULL) { if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) //current dir OR parrent dir continue; memset(base,'\0',sizeof(base)); strcpy(base,basePath); strcat(base,"/"); strcat(base,ptr->d_name); if(ptr->d_type == 8) { //file create_file(base, dir_id); // printf("%s/%s : %lld %ld\n",basePath, ptr->d_name, size, ptr->d_ino); } else if(ptr->d_type == 4) { //dir dir_tot ++; int tmp = readFileList(base, dir_tot); strcpy(d[dir_id].entry[c[dir_id]].filename, ptr->d_name); d[dir_id].entry[c[dir_id]].inode_off = tot; c[dir_id] ++; create_dir(tmp); } } closedir(dir); return dir_id; }
static int init() { struct stat fstatus; struct group *group; cp_string logfile; _set_defaults(); umask(0077); group=getgrnam(conf.grp); if (group) { setgid(group->gr_gid); log_event(CPDEBUG, "switching to new gid", conf.grp); } else { log_event(CPERROR, "Grp not found", conf.grp); return 1; } /* we always use a log file */ if (stat(conf.log, &fstatus) || !S_ISDIR(fstatus.st_mode)) { if (create_dir(conf.log, 1)) return 1; if (chmod(conf.log, 0700)) return 1; } snprintf(logfile,BUFSIZE,"%s%s",conf.log,"/pdfwriter_log"); logfp=fopen(logfile, "a"); return 0; }
static int batch_submit( void * instance_struct, struct batch_task *t){ struct archive_instance *a = (struct archive_instance*)instance_struct; int rc = MAKEFLOW_HOOK_SUCCESS; // Generates a hash id for the task char *id = batch_task_generate_id(t); char *task_path = string_format("%s/tasks/%.2s/%s",a->dir, id, id); create_dir(task_path,0777); debug(D_MAKEFLOW_HOOK, "Checking archive for task %d at %.5s\n", t->taskid, id); if(a->s3){ int result = 1; result = makeflow_s3_archive_copy_task_files(a, id, task_path, t); if(!result){ debug(D_MAKEFLOW_HOOK, "unable to copy task files for task %s from S3 bucket",id); } } // If a is in read mode and the archive is preserved (all the output files exist) if(a->read && makeflow_archive_is_preserved(a, t, task_path)){ debug(D_MAKEFLOW_HOOK, "Task %d already exists in archive, replicating output files\n", t->taskid); /* copy archived files to working directory and update state for node and dag_files */ makeflow_archive_copy_preserved_files(a, t, task_path); t->info->exited_normally = 1; a->found_archived_job = 1; printf("task %d was pulled from archive\n", t->taskid); rc = MAKEFLOW_HOOK_SKIP; } free(id); free(task_path); return rc; }
/* Create a directory, including parent directories as necessary. */ static void create_dir(char *pathname, int mode) { char *p; int r; /* Strip trailing '/' */ if (pathname[strlen(pathname) - 1] == '/') pathname[strlen(pathname) - 1] = '\0'; /* Try creating the directory. */ r = mkdir(pathname, mode); if (r != 0) { /* On failure, try creating parent directory. */ p = strrchr(pathname, '/'); if (p != NULL) { *p = '\0'; create_dir(pathname, 0755); *p = '/'; r = mkdir(pathname, mode); } } if (r != 0) fprintf(stderr, "Could not create directory %s\n", pathname); }
static int create_dir(char *dirname, int nolog) { struct stat fstatus; char buffer[BUFSIZE],*delim; int i; while ((i=strlen(dirname))>1 && dirname[i-1]=='/') dirname[i-1]='\0'; if (stat(dirname, &fstatus) || !S_ISDIR(fstatus.st_mode)) { strncpy(buffer,dirname,BUFSIZE); delim=strrchr(buffer,'/'); if (delim!=buffer) delim[0]='\0'; else delim[1]='\0'; if (create_dir(buffer,nolog)!=0) return 1; stat(buffer, &fstatus); if (mkdir(dirname,fstatus.st_mode)!=0) { if (!nolog) log_event(CPERROR, "failed to create directory", dirname); return 1; } else if (!nolog) log_event(CPSTATUS, "directory created", dirname); if (chown(dirname,fstatus.st_uid,fstatus.st_gid)!=0) if (!nolog) log_event(CPDEBUG, "failed to set owner on directory (non fatal)", dirname); } return 0; }
int main(void) { int x; while(TRUE) { x=menu(x); switch(x) { case 0: return 0; case 1: create_dir();break; case 2: find_dir();break; case 3: del_dir();break; case 4: modify_dir();break; case 5: insert_dir();break; case 6: num();break; case 7: all();break; default: exit(-1); } } return 0; }
bool scrolltext_extract (void) { Uint32 i; const char *model = EXPORT_DIR "/scrolltext/char-xx.png"; char *filename = memory_allocation (strlen (model) + 1); if (filename == NULL) { LOG_ERR ("not enough memory to allocate %i bytes\n", (Uint32) (strlen (model) + 1)); return FALSE; } if (!create_dir (EXPORT_DIR "/scrolltext")) { free_memory (filename); return FALSE; } for (i = 0; i < FONT_SCROLLTEXT_MAXOF_GLYPHS; i++) { sprintf (filename, EXPORT_DIR "/scrolltext/char-%02d.png", i); if (!bitmap_to_png (&fnt_scroll[i], filename, 20, 21, offscreen_pitch)) { free_memory (filename); return FALSE; } } free_memory (filename); return TRUE; }
int create_dir (char *path) { char *parent; char *tmp; int rc; tmp = strdup (path); /* preserve our string */ parent = dirname (tmp); rc = check_dir (parent); if (strcmp (parent, "/") == 0) { return -1; /* stop endless loop */ } if (rc == MISC_NOT_DIR || rc == MISC_NOT_WRITABLE) { return -1; } else if (rc == MISC_DOES_NOT_EXISTS) { /* recursively create */ if (create_dir (parent) != 0) { fprintf (stderr, "failed to create %s\n", parent); return -1; } } rc = mkdir (path, 0755); free (tmp); return rc; }
// return 0 on error, 1 otherwise static int create_task_directories(struct work_queue_process *p) { char tmpdir_template[1024]; p->sandbox = string_format("t.%d", p->task->taskid); if(!create_dir(p->sandbox, 0777)) { return 0; } char absolute[1024]; path_absolute(p->sandbox, absolute, 1); free(p->sandbox); p->sandbox = xxstrdup(absolute); sprintf(tmpdir_template, "%s/cctools-temp-t.%d.XXXXXX", p->sandbox, p->task->taskid); if(mkdtemp(tmpdir_template) == NULL) { return 0; } p->tmpdir = xxstrdup(tmpdir_template); if(chmod(p->tmpdir, 0777) != 0) { return 0; } return 1; }
static void download(void * conf) { ngx_image_conf_t *info = conf; get_request_source(conf);//取得请求的URL的原始文件 if (get_header(info->request_source) == 0) { CURL *curl; curl = curl_easy_init(); create_dir(info->local_dir);//创建目录 if((curl_handle = fopen(info->source_file, "wb")) == NULL) { curl_easy_cleanup (curl); fclose(curl_handle); curl_handle = NULL; return; } if(curl) { curl_easy_setopt(curl, CURLOPT_URL,info->request_source); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_get_data); curl_easy_perform(curl); curl_easy_cleanup(curl); fclose(curl_handle); curl_handle = NULL; } } free(info->request_source); }
/* set the per directory limits */ int stats_set_limits(long maxfiles, long maxsize) { int dir; unsigned counters[STATS_END]; if (maxfiles != -1) { maxfiles /= 16; } if (maxsize != -1) { maxsize /= 16; } if (create_dir(cache_dir) != 0) { return 1; } /* set the limits in each directory */ for (dir=0;dir<=0xF;dir++) { char *fname, *cdir; int fd; x_asprintf(&cdir, "%s/%1x", cache_dir, dir); if (create_dir(cdir) != 0) { return 1; } x_asprintf(&fname, "%s/stats", cdir); free(cdir); memset(counters, 0, sizeof(counters)); fd = safe_open(fname); if (fd != -1) { lock_fd(fd); stats_read_fd(fd, counters); if (maxfiles != -1) { counters[STATS_MAXFILES] = maxfiles; } if (maxsize != -1) { counters[STATS_MAXSIZE] = maxsize; } write_stats(fd, counters); close(fd); } free(fname); } return 0; }
static void test_getNextInTree_SingleFolder_RootWithOnlyThreeDirs() { // No before! create_dir(testdir_path, ""); create_dir(testdir_path, "/apa"); create_dir(testdir_path, "/bepa"); create_dir(testdir_path, "/cepa"); GNode *tree = single_folder(TRUE, TRUE); assert_trees_equal("Get Next ─ Single folder ─ Input is Root with only three dirs", tree, get_next_in_tree(tree)); assert_trees_equal("Get First ─ Single folder ─ Input is Root with only three dirs", tree, get_first_in_tree(tree)); assert_trees_equal("Get Last ─ Single folder ─ Input is Root with only three dirs", tree, get_last_in_tree(tree)); free_whole_tree(tree); after(); }
static void create_output_directory(struct ts *ts) { if (!ts->create_dirs) return; if (!file_exists(ts->output_dirname)) { p_info(" = Create directory %s", ts->output_dirname); create_dir(ts->output_dirname, dir_perm); } }
/* set the per directory limits */ int stats_set_limits(long maxfiles, long maxsize) { int dir; if (maxfiles != -1) { maxfiles /= 16; } if (maxsize != -1) { maxsize /= 16; } if (create_dir(cache_dir) != 0) { return 1; } /* set the limits in each directory */ for (dir = 0; dir <= 0xF; dir++) { char *fname, *cdir; cdir = format("%s/%1x", cache_dir, dir); if (create_dir(cdir) != 0) { free(cdir); return 1; } fname = format("%s/stats", cdir); free(cdir); if (lockfile_acquire(fname, lock_staleness_limit)) { struct counters *counters = counters_init(STATS_END); stats_read(fname, counters); if (maxfiles != -1) { counters->data[STATS_MAXFILES] = maxfiles; } if (maxsize != -1) { counters->data[STATS_MAXSIZE] = maxsize; } stats_write(fname, counters); lockfile_release(fname); counters_free(counters); } free(fname); } return 0; }
void generate_ymp(config_t config, const char *pkgname, char *ympname) { char dirname[FILEPATH_MAX]; char filename[FILEPATH_MAX]; FILE *ymp; int r; snprintf(dirname, FILEPATH_MAX, "%s/%s", config.dir, YMP_DIR); create_dir(dirname); snprintf(ympname, FILEPATH_MAX, "%s/%s.ymp", YMP_DIR, pkgname); snprintf(filename, FILEPATH_MAX, "%s/%s", config.dir, ympname); if (exists(filename)) return; ymp = open_write(filename, "generate_ymp"); fprintf(ymp, "<metapackage" " xmlns:os=\"http://opensuse.org/Standards/One_Click_Install\"" " xmlns=\"http://opensuse.org/Standards/One_Click_Install\">\n"); for (r = 0; r < config.nrepositories; r++) { fprintf(ymp, " <group distversion=\"%s\">\n", config.repositories[r][0]); fprintf(ymp, " <repositories>\n"); fprintf(ymp, " <repository recomended=\"true\" format=\"yast\">\n"); fprintf(ymp, " <name>M17N:fonts (%s)</name>\n", config.repositories[r][0]); fprintf(ymp, " <summary>\n"); fprintf(ymp, " %s repository for %s\n", config.location, config.repositories[r][0]); fprintf(ymp, " </summary>\n"); fprintf(ymp, " <description>\n"); fprintf(ymp, " This repository contains fonts located in\n"); fprintf(ymp, " %s installable on %s system.\n", config.location, config.repositories[r][0]); fprintf(ymp, " </description>\n"); fprintf(ymp, " <url>%s</url>\n", config.repositories[r][1]); fprintf(ymp, " </repository>\n"); fprintf(ymp, " </repositories>\n"); fprintf(ymp, " <software>\n"); fprintf(ymp, " <item>\n"); fprintf(ymp, " <name>%s</name>\n", pkgname); fprintf(ymp, " <summary>\n"); fprintf(ymp, " Font package from %s\n", config.location); fprintf(ymp, " </summary>\n"); fprintf(ymp, " <description>\n"); fprintf(ymp, " Latest version of package %s in %s.\n", pkgname, config.location); fprintf(ymp, " </description>\n"); fprintf(ymp, " </item>\n"); fprintf(ymp, " </software>\n"); fprintf(ymp, " </group>\n"); } fprintf(ymp, "</metapackage>\n"); fclose(ymp); return; }
int init_workdir(void) { char dirbuf[1024]; if (!create_dir(settings.workdir)) return FALSE; snprintf(dirbuf, sizeof(dirbuf), "%s/completed/", settings.workdir); if (!create_dir(dirbuf)) return FALSE; snprintf(dirbuf, sizeof(dirbuf), "%s/save/", settings.workdir); if (!create_dir(dirbuf)) return FALSE; return TRUE; }
void Viewer::key_parse(char key){ if (key == 27 || key == 'q' || key == 'Q'){ exitFlag = true; } // save the pcl in to memory else if (key==' ') { saveMemory = !saveMemory; if (saveMemory){ std::cout << "START saving in MEMORY" << std::endl; rgb_images.clear(); rgbd_images.clear(); point_clouds.clear(); raw_depth.clear(); depth_show.clear(); //initialize the recorder if (!no_oni){ if(recorder.isValid()){ recorder.stop(); recorder.destroy(); } recorder.create("recording.oni"); recorder.attach(depth); if(!only_depth){ recorder.attach(color); } recorder.start(); } } else { if(!no_oni){ recorder.stop(); recorder.destroy(); } std::cout << "STOPP saving in MEMORY - " << FRAME_COUNTER << " frames" << std::endl; } FRAME_COUNTER = 0; } // save the pcl into the disk else if (key=='s'||key=='S') { create_dir(); saveMemory = false; std::cout << "START saving in DISK" << std::endl; saveToDisk(); std::cout << "STOPP saving in DISK" << std::endl; rgb_images.clear(); rgbd_images.clear(); point_clouds.clear(); raw_depth.clear(); depth_show.clear(); if(recorder.isValid()){ recorder.stop(); recorder.destroy(); } } }
static void rcreate(Req *r) { Xfile *f; int inr, perm; chat("create(fid=%d,name=\"%s\",perm=%uo,mode=%d)...", thdr.fid, thdr.name, thdr.perm, thdr.mode); errno = 0; if(strcmp(thdr.name, ".") == 0 || strcmp(thdr.name, "..") == 0){ errno = Eperm; goto error; } f = xfile(r->fid, Asis); if( !f ){ errno = Eio; goto error; } if( strlen(thdr.name) > EXT2_NAME_LEN ){ chat("name too long ..."); errno = Elongname; goto error; } /* create */ errno = 0; if( thdr.perm & DMDIR ){ perm = (thdr.perm & ~0777) | (getmode(f) & thdr.perm & 0777); perm |= S_IFDIR; inr = create_dir(f, thdr.name, perm); }else{ perm = (thdr.perm & (~0777|0111)) | (getmode(f) & thdr.perm & 0666); perm |= S_IFREG; inr = create_file(f, thdr.name, perm); } if( inr < 0 ) goto error; /* fill with new inode */ f->pinbr = f->inbr; if( get_inode(f, inr) < 0 ){ errno = Eio; goto error; } r->fid->qid = (Qid){inr, 0, 0}; if( S_ISDIR(getmode(f)) ) r->fid->qid.type |= QTDIR; chat("f->qid=0x%8.8lux...", r->fid->qid.path); rhdr.qid = r->fid->qid; error: response(r); }