Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2706 → Rev 2707

/trunk/uspace/lib/libc/include/sys/stat.h
0,0 → 1,45
/*
* Copyright (c) 2008 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
* @{
*/
/** @file
*/
 
#ifndef LIBC_SYS_STAT_H_
#define LIBC_SYS_STAT_H_
 
#include <sys/types.h>
 
extern int mkdir(const char *, mode_t);
 
#endif
 
/** @}
*/
/trunk/uspace/lib/libc/include/sys/types.h
40,6 → 40,7
typedef unsigned long size_t;
typedef signed long ssize_t;
typedef long off_t;
typedef int mode_t;
 
#endif
 
/trunk/uspace/lib/libc/generic/vfs.c
37,6 → 37,8
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ipc/ipc.h>
#include <ipc/services.h>
#include <async.h>
131,6 → 133,11
return _open(path, L_FILE, oflag);
}
 
int close(int fildes)
{
return 0; /* TODO */
}
 
ssize_t read(int fildes, void *buf, size_t nbyte)
{
int res;
209,7 → 216,7
off_t newoffs;
rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
&newoffs);
(ipcarg_t)&newoffs);
 
async_serialize_end();
futex_up(&vfs_phone_futex);
274,9 → 281,35
return 0;
}
 
int close(int fildes)
int mkdir(const char *path, mode_t mode)
{
return 0; /* TODO */
int res;
ipcarg_t rc;
ipc_call_t answer;
aid_t req;
futex_down(&vfs_phone_futex);
async_serialize_start();
if (vfs_phone < 0) {
res = vfs_connect();
if (res < 0) {
async_serialize_end();
futex_up(&vfs_phone_futex);
return res;
}
}
req = async_send_1(vfs_phone, VFS_MKDIR, mode, &answer);
rc = ipc_data_write_start(vfs_phone, path, strlen(path));
if (rc != EOK) {
async_wait_for(req, NULL);
async_serialize_end();
futex_up(&vfs_phone_futex);
return (int) rc;
}
async_wait_for(req, &rc);
async_serialize_end();
futex_up(&vfs_phone_futex);
return EOK;
}
 
/** @}