Changeset 0ee4322 in mainline for uspace/lib/libc/generic/vfs.c


Ignore:
Timestamp:
2008-01-13T13:19:37Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d0dc74ae
Parents:
4fb6bf36
Message:

Add ftruncate() and support for VFS_TRUNCATE to VFS and TMPFS.

File:
1 edited

Legend:

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

    r4fb6bf36 r0ee4322  
    9595
    9696
    97 int open(const char *name, int oflag, ...)
     97int open(const char *path, int oflag, ...)
    9898{
    9999        int res;
     
    113113        }
    114114        req = async_send_2(vfs_phone, VFS_OPEN, oflag, 0, &answer);
    115         rc = ipc_data_write_start(vfs_phone, name, strlen(name));
     115        rc = ipc_data_write_start(vfs_phone, path, strlen(path));
    116116        if (rc != EOK) {
    117117                async_wait_for(req, NULL);
     
    215215}
    216216
     217int ftruncate(int fildes, off_t length)
     218{
     219        int res;
     220        ipcarg_t rc;
     221       
     222        futex_down(&vfs_phone_futex);
     223        async_serialize_start();
     224        if (vfs_phone < 0) {
     225                res = vfs_connect();
     226                if (res < 0) {
     227                        async_serialize_end();
     228                        futex_up(&vfs_phone_futex);
     229                        return res;
     230                }
     231        }
     232        rc = async_req_2_0(vfs_phone, VFS_TRUNCATE, fildes, length);
     233        async_serialize_end();
     234        futex_up(&vfs_phone_futex);
     235        return (int) rc;
     236}
     237
    217238/** @}
    218239 */
Note: See TracChangeset for help on using the changeset viewer.