Skip to content

Commit

Permalink
Path: Move constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
tindzk committed Aug 20, 2011
1 parent 29293e8 commit b1a69dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/Kernel.h
Expand Up @@ -204,6 +204,12 @@ record(EpollEvent) {
};
} __epollPacked;

/* Constants to be used with *at() system calls. */
enum {
At_Id_CurrentWorkingFolder = -100, /* Use the CWF for relative paths. */
At_Flag_NoFollow = 0x100 /* Don't follow symbolic links. */
};

#define self Kernel

sdef(int, open, RdString path, int flags, int mode);
Expand Down
4 changes: 2 additions & 2 deletions src/Path.c
Expand Up @@ -682,9 +682,9 @@ overload sdef(void, setTime, RdString path, Time_UnixEpoch time, bool follow) {
assert(scall(isFolderPath, path) || scall(isFilePath, path));
assert(scall(exists, path, follow));

int flags = !follow ? AT_SYMLINK_NOFOLLOW : 0;
int flags = !follow ? At_Flag_NoFollow : 0;

if (!Kernel_utimensat(AT_FDCWD, path, time, flags)) {
if (!Kernel_utimensat(At_Id_CurrentWorkingFolder, path, time, flags)) {
if (errno == ENAMETOOLONG) {
throw(NameTooLong);
} else if (errno == ENOENT) {
Expand Down
8 changes: 0 additions & 8 deletions src/Path.h
Expand Up @@ -19,14 +19,6 @@ exc(NotFolder)
exc(PermissionDenied)
exc(UnknownError)

#ifndef AT_FDCWD
#define AT_FDCWD -100
#endif

#ifndef AT_SYMLINK_NOFOLLOW
#define AT_SYMLINK_NOFOLLOW 0x100
#endif

sdef(bool, isFileName, RdString name);
sdef(bool, isFolderName, RdString name);
sdef(bool, isPath, RdString path);
Expand Down

0 comments on commit b1a69dc

Please sign in to comment.