Changeset d0dc74ae in mainline


Ignore:
Timestamp:
2008-01-13T20:35:52Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d85411a
Parents:
0ee4322
Message:

Add opendir(), rewinddir(), closedir() and some prototypes and stubs. Add dirent.h.

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

Legend:

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

    r0ee4322 rd0dc74ae  
    3434 
    3535#include <vfs.h>
     36#include <stdlib.h>
    3637#include <unistd.h>
     38#include <dirent.h>
    3739#include <fcntl.h>
    3840#include <ipc/ipc.h>
     
    236238}
    237239
     240DIR *opendir(const char *dirname)
     241{
     242        DIR *dirp = malloc(sizeof(DIR));
     243        if (!dirp)
     244                return NULL;
     245        dirp->fd = open(dirname, 0);    /* TODO: must be a directory */
     246        if (!dirp->fd) {
     247                free(dirp);
     248                return NULL;
     249        }
     250        dirp->pos = 0;
     251        return dirp;
     252}
     253
     254struct dirent *readdir(DIR *dirp)
     255{
     256        return NULL;    /* TODO */     
     257}
     258
     259void rewinddir(DIR *dirp)
     260{
     261        dirp->pos = 0;
     262}
     263
     264int closedir(DIR *dirp)
     265{
     266        (void) close(dirp->fd);
     267        free(dirp);
     268        return 0;
     269}
     270
     271int close(int fildes)
     272{
     273        return 0;       /* TODO */
     274}
     275
    238276/** @}
    239277 */
  • uspace/lib/libc/include/unistd.h

    r0ee4322 rd0dc74ae  
    5050extern off_t lseek(int, off_t, int);
    5151extern int ftruncate(int, off_t);
     52extern int close(int);
    5253
    5354extern void _exit(int status);
Note: See TracChangeset for help on using the changeset viewer.