Beispiel #1
0
Datei: main.c Projekt: taysom/tau
void create_db(const char *dir)
{
    emkdir(dir);
    create_log(path(dir, "log"));
    //create_bag(dir, "bag");
    create_mtree(path(dir, "mtree"));
}
Beispiel #2
0
int
main(int argc, char **argv)
{
    struct stat sb;
    int ret;
    int fd;
    char buf[1];
    int status;


    emkdir("one", 0777);
    emkdir("two", 0777);
    emkdir("one/a", 0777);

    fd = child_chdir("one/a");
    atexit(kill_child);
    ret = read(fd, buf, 1);
    if (ret < 0)
	err(1, "read");
    if (ret == 0)
	errx(1, "EOF on read");

    ret = rename("one/a", "two/a");
    if (ret < 0)
	err(1, "rename one/a two");
    ret = lstat("two/a", &sb);
    if (ret < 0)
	err(1, "lstat two/a");
    ret = lstat("one/a", &sb);
    if (ret != -1 || errno != ENOENT)
	errx(1, "one/a still exists");
    kill_child();
    waitpid(child_pid, &status, 0);
    ret = lstat("one/a", &sb);
    if (ret != -1 || errno != ENOENT)
	errx(1, "one/a still exists after child");
    if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
	rmdir("one/a");
	rmdir("two/a");
	rmdir("one");
	rmdir("two");
	return 0;
    } else
	return 1;
}
Beispiel #3
0
Datei: pfs.c Projekt: berkus/moto
void
pfs_createDirectory(PosixFileSystem* pfs, char* path){emkdir(path,64*7+32*7+7);}