current directory and openat() et al Lassi Kortela 23 Apr 2020 11:27 UTC

>> I suspect that if the current working directory is specified in terms
>> of parameter-like semantics then it should be possible to make use of
>> openat() etc behind the scenes
>
> Gambit does some of this; I suggest grepping the source code

All of the calls are in os_files.c:

$ grep -nF 'at (' lib/os_files.c
542:          new_dir = openat (dir, start, O_DIRECTORY);
587:      fd = openat (dir, path2, flags, mode);
621:      result = mkfifoat (dir, path2, mode);
655:      result = mkdirat (dir, path2, mode);
686:      result = unlinkat (dir, path2, 0);
724:          result = linkat (olddir, oldpath2, newdir, newpath2, 0);
760:      result = symlinkat (target, dir, path2);
797:      result = readlinkat (dir, path2, buf, bufsize);
893:                result = linkat (olddir, oldpath2, newdir, newpath2, 0);
900:                    result = unlinkat (olddir, oldpath2, 0);
911:                result = renameat (olddir, oldpath2, newdir, newpath2);
962:      int fd = openat (dir, path2, O_DIRECTORY);
1001:      result = fstatat (dir, path2, statbuf, follow ? 0 :
AT_SYMLINK_NOFOLLOW);
1010:    return ___stat (path, statbuf);
1012:    return ___lstat (path, statbuf);