Changeset 72bde81 in mainline for uspace/lib


Ignore:
Timestamp:
2008-01-27T14:59:32Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2db4ac8
Parents:
1fe186f
Message:

Support for mkdir().

Location:
uspace/lib/libc
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/vfs.c

    r1fe186f r72bde81  
    3838#include <dirent.h>
    3939#include <fcntl.h>
     40#include <sys/stat.h>
     41#include <sys/types.h>
    4042#include <ipc/ipc.h>
    4143#include <ipc/services.h>
     
    132134}
    133135
     136int close(int fildes)
     137{
     138        return 0;       /* TODO */
     139}
     140
    134141ssize_t read(int fildes, void *buf, size_t nbyte)
    135142{
     
    210217        off_t newoffs;
    211218        rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
    212             &newoffs);
     219            (ipcarg_t)&newoffs);
    213220
    214221        async_serialize_end();
     
    275282}
    276283
    277 int close(int fildes)
    278 {
    279         return 0;       /* TODO */
     284int mkdir(const char *path, mode_t mode)
     285{
     286        int res;
     287        ipcarg_t rc;
     288        ipc_call_t answer;
     289        aid_t req;
     290       
     291        futex_down(&vfs_phone_futex);
     292        async_serialize_start();
     293        if (vfs_phone < 0) {
     294                res = vfs_connect();
     295                if (res < 0) {
     296                        async_serialize_end();
     297                        futex_up(&vfs_phone_futex);
     298                        return res;
     299                }
     300        }
     301        req = async_send_1(vfs_phone, VFS_MKDIR, mode, &answer);
     302        rc = ipc_data_write_start(vfs_phone, path, strlen(path));
     303        if (rc != EOK) {
     304                async_wait_for(req, NULL);
     305                async_serialize_end();
     306                futex_up(&vfs_phone_futex);
     307                return (int) rc;
     308        }
     309        async_wait_for(req, &rc);
     310        async_serialize_end();
     311        futex_up(&vfs_phone_futex);
     312        return EOK;
    280313}
    281314
  • uspace/lib/libc/include/sys/types.h

    r1fe186f r72bde81  
    4141typedef signed long ssize_t;
    4242typedef long off_t;
     43typedef int mode_t;
    4344
    4445#endif
Note: See TracChangeset for help on using the changeset viewer.