Changeset 415c7e0d in mainline for uspace/lib/libc/generic/vfs/vfs.c


Ignore:
Timestamp:
2009-06-28T21:41:13Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bfd247f
Parents:
75160a6
Message:

Implement stat() and VFS_IN_STAT.
Modify bdsh() to use stat() during ls.
In devfs, allow lookups that don't
specify one of L_FILE and L_DIRECTORY.

File:
1 edited

Legend:

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

    r75160a6 r415c7e0d  
    389389}
    390390
     391int stat(const char *path, struct stat *stat)
     392{
     393        ipcarg_t rc;
     394        aid_t req;
     395       
     396        size_t pa_size;
     397        char *pa = absolutize(path, &pa_size);
     398        if (!pa)
     399                return ENOMEM;
     400       
     401        futex_down(&vfs_phone_futex);
     402        async_serialize_start();
     403        vfs_connect();
     404       
     405        req = async_send_0(vfs_phone, VFS_IN_STAT, NULL);
     406        rc = ipc_data_write_start(vfs_phone, pa, pa_size);
     407        if (rc != EOK) {
     408                async_wait_for(req, NULL);
     409                async_serialize_end();
     410                futex_up(&vfs_phone_futex);
     411                free(pa);
     412                return (int) rc;
     413        }
     414        rc = ipc_data_read_start(vfs_phone, stat, sizeof(struct stat));
     415        if (rc != EOK) {
     416                async_wait_for(req, NULL);
     417                async_serialize_end();
     418                futex_up(&vfs_phone_futex);
     419                free(pa);
     420                return (int) rc;
     421        }
     422        async_wait_for(req, &rc);
     423        async_serialize_end();
     424        futex_up(&vfs_phone_futex);
     425        free(pa);
     426        return rc;
     427}
     428
    391429DIR *opendir(const char *dirname)
    392430{
Note: See TracChangeset for help on using the changeset viewer.