Skip to content

Latest commit

 

History

History
229 lines (158 loc) · 6.46 KB

directories.asc

File metadata and controls

229 lines (158 loc) · 6.46 KB

directories

alphasort

int alphasort( const struct dirent de1, const struct dirent de2 )

Sort dirents by name.
 Deviating of the standard,
 the asciitables is used for the comparison
 (using strcmp)
basename

char basename(char *path)
*return the last component of a pathname
Size: ~151B ../src/directories/basename.c l.2 manpage: basename

chdir

int chdir(const char* path)
change working directory Size: ~47B ../include/syscall_stubs.h l.114 manpage: chdir

dirbuf

__

the switch for defining the dirbuf.
 used internally
dirbufsize

__

dirfd

int dirfd(DIR d)
*extract the file descriptor used by a DIR stream
../src/directories/dirfd.c l.2 manpage: dirfd

dirname

char dirname(char *s)
*Defines:
strlen
report the parent directory name of a file pathname Size: ~179B ../src/directories/dirname.c l.8 manpage: dirname

fstat

int fstat(int fd,struct stat* statbuf)
get file status Size: ~53B ../include/syscall_stubs.h l.111 manpage: fstat

getcwd

int getcwd( char buf, unsigned long size)
*get the pathname of the current working directory
Size: ~61B ../include/syscall_stubs.h l.123 manpage: getcwd

getdents

int getdents( unsigned int fd, struct dirent direntry, unsigned int count )
*get directory entries
Size: ~65B ../include/syscall_stubs.h l.106 manpage: getdents

inotify_add_watch

int inotify_add_watch( int fd, const char *pathname, u32 mask)
../include/syscall_stubs.h l.220

inotify_init

int DEF_syscall(inotify_init,0)
../include/syscall_stubs.h l.219

inotify_init1

int inotify_init1( int flags)
../include/syscall_stubs.h l.222

inotify_rm_watch

int inotify_rm_watch( int fd, __s32 wd)
../include/syscall_stubs.h l.221

mkdir

int mkdir( const char pathname, int mode)
*make a directory relative to directory file descriptor
Size: ~59B ../include/syscall_stubs.h l.174 manpage: mkdir

opendir

DIR opendir(const char *name )
*Defines:
getbrk sys_brk write open dirbuf 0 close
open directory associated with file descriptor Size: ~281B ../src/directories/opendir.c l.10 manpage: opendir

opendirp

DIR opendirp(const char *name, DIR *dir)
*Defines:
dirbuf 0 close getbrk sys_brk open
../src/directories/opendirp.c l.5

readdir

struct dirent readdir(DIR *dir)
*Defines:
dirbuf getdents
read a directory

read a directory.
 return the next dirent, or 0, if the end is reached.
 return 0 on error and set errno,
 if mini_errno is not defined, return -errno on error

Size: ~133B ../src/directories/readdir.c l.10 manpage: readdir

rewinddir

void rewinddir(DIR dir)
*reset the position of a directory stream to the beginning
Size: ~80B ../src/directories/rewinddir.c l.2 manpage: rewinddir

rmdir

int rmdir( const char pathname)
*remove a directory
Size: ~47B ../include/syscall_stubs.h l.175 manpage: rmdir

scandir

int scandir(const char path, struct dirent listing[], int (*fp_select)(const struct dirent *), int (*cmp)(const struct dirent , const struct dirent *))
Defines: kill strlen seterrno 0 getbrk open dirbuf swap memcpy getpid sys_brk errno write getdents
scan a directory

list files and dirs in a directory

 This implementation uses malloc_brk() for the dynamic allocation
 of the listing, and tries to do as less copies as possible.
 The dynamically allocated space for the result list (**listing[])
 is guaranteed to be at one continuous memory location.

 if the select callback is 0, meaning all entries should be returned,
 There are no copies done at all,
 besides the copying from kernelspace to userspace.

 To free the space, allocated for the listing,
 either call free_brk(),
 when no other allocations via malloc_brk took place.

 Or save the brk before you call scandir,
 and restore it after the call.
 (e.g.)
 long savebrk=getbrk();
 int ret=scandir(...);
 brk(savebrk);
 Freeing single list entries might give unexpected results.

 returns the number of the read entries,
 or the negative errno on error.
scandir_bufsize

__

the increment of the buffer of scandir in bytes for memory allocations
 (default:4096)
seekdir

void seekdir(DIR dir, long off)
*set the position of a directory stream
Size: ~100B ../src/directories/seekdir.c l.2 manpage: seekdir

telldir

long telldir(DIR dir)
*current location of a named directory stream
Size: ~32B ../src/directories/telldir.c l.2 manpage: telldir