OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [mkdir.c] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * l4/posix glue for mkdir()
3
 *
4
 * Copyright (C) 2008 Bahadir Balban
5
 */
6
#include <shpage.h>
7
#include <errno.h>
8
#include <stdio.h>
9
#include <stdarg.h>
10
#include <string.h>
11
#include <sys/shm.h>
12
#include <sys/types.h>
13
#include <sys/stat.h>
14
#include <l4lib/ipcdefs.h>
15
#include <l4lib/utcb.h>
16
#include <fcntl.h>
17
#include <l4/macros.h>
18
#include INC_GLUE(memory.h)
19
#include <libposix.h>
20
 
21
static inline int l4_mkdir(const char *pathname, mode_t mode)
22
{
23
        int fd;
24
 
25
        // write_mr(L4SYS_ARG0, (unsigned long)pathname);
26
        utcb_full_strcpy_from(pathname);
27
        write_mr(L4SYS_ARG0, (u32)mode);
28
 
29
        /* Call pager with shmget() request. Check ipc error. */
30
        if ((fd = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_MKDIR)) < 0) {
31
                print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd);
32
                return fd;
33
        }
34
        /* Check if syscall itself was successful */
35
        if ((fd = l4_get_retval()) < 0) {
36
                print_err("%s: MKDIR Error: %d.\n", __FUNCTION__, fd);
37
                return fd;
38
        }
39
        return fd;
40
}
41
 
42
int mkdir(const char *pathname, mode_t mode)
43
{
44
        int ret;
45
 
46
        /* If error, return positive error code */
47
        if ((ret = l4_mkdir(pathname, mode)) < 0) {
48
                errno = -ret;
49
                return -1;
50
        }
51
        /* else return value */
52
        return ret;
53
}
54
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.