SmartFolder  1.0
SmartFolder is a way to search files on your system and group the results. The program will interpret search queries and create a folder with symbolic links to all the found matches.
Syscall.h File Reference

Header file that contains the definitions for system calls wrapper functions used in our program. More...

#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/types.h>
#include <stdlib.h>
#include <libgen.h>
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
#include "Logger.h"
Include dependency graph for Syscall.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int sfork ()
 
int ssymlink (char *target, char *linkPath)
 
char * sbasename (char *fullPath)
 
int smkdir (char *path)
 
FILE * stouch (char *file)
 
int saccess (char *path)
 
int sunlink (char *file)
 
int srmdir (char *path)
 
int sgetpwuid (const char *userName)
 
int sgetgrgid (const char *groupName)
 
int slstat (const char *name, struct stat *statbuf)
 
DIR * sopendir (const char *name)
 
int schdir (const char *name)
 
int sclosedir (DIR *dp)
 
struct dirent * sreaddir (DIR *dir)
 
int sS_ISLNK (mode_t m)
 
int sS_ISDIR (mode_t m)
 
int sS_ISREG (mode_t m)
 
char * srealpath (const char *p, char *buf)
 

Detailed Description

Header file that contains the definitions for system calls wrapper functions used in our program.

Authors
Maxime Lovino, Thomas Ibanez
Date
January 25, 2017
Version
1.0

Function Documentation

int saccess ( char *  path)
inline

access wrapper

Parameters
pathfile to check
Returns
1 if the file exists, 0 otherwise
char* sbasename ( char *  fullPath)
inline

basename wrapper

Parameters
fullPathfull path of the file
Returns
basename of the file
int schdir ( const char *  name)
inline

chdir wrapper

Parameters
namedirectory to go to
Returns
1 on success, 0 otherwise
int sclosedir ( DIR *  dp)
inline

closedir wrapper

Parameters
dpdirectory to close
Returns
1 on success, 0 otherwise
int sfork ( )
inline

fork wrapper

Returns
pid of the child or 0 if you are the child
int sgetgrgid ( const char *  groupName)
inline

getgrnam->gr_gid wrapper

Parameters
groupNamegroupname to get gid from
Returns
gid linked to this groupname
int sgetpwuid ( const char *  userName)
inline

getpwnam->pw_uid wrapper

Parameters
userNamethe username to get uid from
Returns
uid linked to the username
int slstat ( const char *  name,
struct stat *  statbuf 
)
inline

lstat wrapper

Parameters
namefile to check
statbufbuffer to write info to
Returns
1 on success, 0 otherwise
int smkdir ( char *  path)
inline

mkdir wrapper

Parameters
pathpath to create
Returns
1 on success, 0 otherwise
DIR* sopendir ( const char *  name)
inline

opendir wrapper

Parameters
namedirectory to open
Returns
DIR* to the directory
struct dirent* sreaddir ( DIR *  dir)

readdir wrapper

Parameters
dirdirectory to read
Returns
dirent entries
char* srealpath ( const char *  p,
char *  buf 
)
inline

realpath wrapper

Parameters
pfile to get realpath from
bufbuffer to write the realpath to (optional)
Returns
if the buffer is NULL, return the realpath
int srmdir ( char *  path)
inline

rmdir wrapper

Parameters
pathdirectory to remove
Returns
1 on success, 0 otherwise
int sS_ISDIR ( mode_t  m)
inline

S_ISDIR wrapper

Parameters
mfile to check
Returns
1 if the file is a directory, 0 otherwise
int sS_ISLNK ( mode_t  m)
inline

S_ISLNK wrapper

Parameters
mfile to check
Returns
1 if the file is a link, 0 otherwise
int sS_ISREG ( mode_t  m)
inline

S_ISREG wrapper

Parameters
mfile to check
Returns
1 if the file is a regular file, 0 otherwise
int ssymlink ( char *  target,
char *  linkPath 
)
inline

symlink wrapper

Parameters
targetreal file
linkPathlink path
Returns
1 on success, 0 otherwise
FILE* stouch ( char *  file)
inline

touch wrapper

Parameters
filefile to create
Returns
FILE* to the file created
int sunlink ( char *  file)
inline

unlink wrapper

Parameters
filefile to unlink
Returns
1 on success, 0 otherwise