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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [chdir.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 <libposix.h>
8
#include <errno.h>
9
#include <stdio.h>
10
#include <stdarg.h>
11
#include <string.h>
12
#include <sys/types.h>
13
#include <unistd.h>
14
#include <libposix.h>
15
#include <l4lib/ipcdefs.h>
16
#include <l4lib/utcb.h>
17
#include <l4/macros.h>
18
#include INC_GLUE(memory.h)
19
 
20
static inline int l4_chdir(const char *pathname)
21
{
22
        int fd;
23
 
24
        utcb_full_strcpy_from(pathname);
25
 
26
        /* Call pager with shmget() request. Check ipc error. */
27
        if ((fd = l4_sendrecv_full(pagerid, pagerid, L4_IPC_TAG_CHDIR)) < 0) {
28
                print_err("%s: L4 IPC Error: %d.\n", __FUNCTION__, fd);
29
                return fd;
30
        }
31
        /* Check if syscall itself was successful */
32
        if ((fd = l4_get_retval()) < 0) {
33
                print_err("%s: MKDIR Error: %d.\n", __FUNCTION__, fd);
34
                return fd;
35
        }
36
        return fd;
37
}
38
 
39
int chdir(const char *pathname)
40
{
41
        int ret;
42
 
43
        /* If error, return positive error code */
44
        if ((ret = l4_chdir(pathname)) < 0) {
45
                errno = -ret;
46
                return -1;
47
        }
48
        /* else return value */
49
        return ret;
50
}
51
 

powered by: WebSVN 2.1.0

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