@@ -260,13 +260,13 @@ int _moni_read_link(int fd, const char* path, char* buffer, size_t *_bufferSize)
260
260
}
261
261
262
262
struct stat linuxStat;
263
- status = LINUX_SYSCALL2 (__NR_lstat, hostPath, &linuxStat);
263
+ status = LINUX_SYSCALL4 (__NR_newfstatat, AT_FDCWD, hostPath, &linuxStat, AT_SYMLINK_NOFOLLOW );
264
264
if (status < 0 )
265
265
{
266
266
return LinuxToB (-status);
267
267
}
268
268
269
- status = LINUX_SYSCALL3 (__NR_readlink , hostPath, buffer, *_bufferSize);
269
+ status = LINUX_SYSCALL4 (__NR_readlinkat, AT_FDCWD , hostPath, buffer, *_bufferSize);
270
270
271
271
if (status < 0 )
272
272
{
@@ -292,7 +292,7 @@ status_t _moni_create_symlink(int fd, const char* path, const char* toPath, int
292
292
return status;
293
293
}
294
294
295
- status = LINUX_SYSCALL2 (__NR_symlink , toPath, hostPath);
295
+ status = LINUX_SYSCALL3 (__NR_symlinkat , toPath, AT_FDCWD , hostPath);
296
296
297
297
if (status < 0 )
298
298
{
@@ -524,11 +524,11 @@ int _moni_open(int fd, const char* path, int openMode, int perms)
524
524
linuxFlags |= O_NOFOLLOW;
525
525
}
526
526
527
- int result = LINUX_SYSCALL3 (__NR_open , hostPath, linuxFlags, linuxMode);
527
+ int result = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD , hostPath, linuxFlags, linuxMode);
528
528
529
529
if (result == -ELOOP && !shouldFailWithEloop)
530
530
{
531
- result = LINUX_SYSCALL3 (__NR_open , hostPath, linuxFlags | O_PATH, linuxMode);
531
+ result = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD , hostPath, linuxFlags | O_PATH, linuxMode);
532
532
}
533
533
534
534
if (result < 0 )
@@ -694,7 +694,7 @@ int _moni_normalize_path(const char* userPath, bool traverseLink, char* buffer)
694
694
695
695
int _moni_create_pipe (int *fds)
696
696
{
697
- long result = LINUX_SYSCALL1 (__NR_pipe , fds);
697
+ long result = LINUX_SYSCALL2 (__NR_pipe2 , fds, 0 );
698
698
699
699
if (result < 0 )
700
700
{
@@ -728,7 +728,7 @@ status_t _moni_create_fifo(int fd, const char* path, mode_t perms)
728
728
return status;
729
729
}
730
730
731
- status = LINUX_SYSCALL3 (__NR_mknod , hostPath, perms | S_IFIFO, 0 );
731
+ status = LINUX_SYSCALL4 (__NR_mknodat, AT_FDCWD , hostPath, perms | S_IFIFO, 0 );
732
732
if (status < 0 )
733
733
{
734
734
return LinuxToB (-status);
@@ -759,7 +759,7 @@ int _moni_rename(int oldDir, const char* oldpath, int newDir, const char* newpat
759
759
return status;
760
760
}
761
761
762
- status = LINUX_SYSCALL2 (__NR_rename, oldHostPath, newHostPath);
762
+ status = LINUX_SYSCALL4 (__NR_renameat, AT_FDCWD, oldHostPath, AT_FDCWD , newHostPath);
763
763
764
764
if (status < 0 )
765
765
{
@@ -809,7 +809,7 @@ int _moni_open_dir(int fd, const char* path)
809
809
return expandStatus;
810
810
}
811
811
812
- int result = LINUX_SYSCALL2 (__NR_open, hostPath, O_DIRECTORY);
812
+ int result = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD, hostPath, O_DIRECTORY, 0 );
813
813
814
814
if (result < 0 )
815
815
{
@@ -828,7 +828,7 @@ int _moni_open_dir(int fd, const char* path)
828
828
829
829
status_t _moni_open_parent_dir (int fd, char * name, size_t nameLength)
830
830
{
831
- long result = LINUX_SYSCALL3 (__NR_openat, fd, " .." , O_DIRECTORY);
831
+ long result = LINUX_SYSCALL4 (__NR_openat, fd, " .." , O_DIRECTORY, 0 );
832
832
833
833
if (result < 0 )
834
834
{
@@ -906,7 +906,7 @@ int _moni_dup2(int ofd, int nfd)
906
906
return HAIKU_POSIX_EBADF;
907
907
}
908
908
909
- int result = LINUX_SYSCALL2 (__NR_dup2 , ofd, nfd);
909
+ int result = LINUX_SYSCALL3 (__NR_dup3 , ofd, nfd, 0 );
910
910
911
911
if (result < 0 )
912
912
{
@@ -1133,7 +1133,7 @@ status_t _moni_create_dir(int fd, const char* path, int perms)
1133
1133
return status;
1134
1134
}
1135
1135
1136
- status = LINUX_SYSCALL2 (__NR_mkdir , hostPath, ModeBToLinux (perms));
1136
+ status = LINUX_SYSCALL3 (__NR_mkdirat, AT_FDCWD , hostPath, ModeBToLinux (perms));
1137
1137
1138
1138
if (status < 0 )
1139
1139
{
@@ -1151,7 +1151,11 @@ status_t _moni_remove_dir(int fd, const char* path)
1151
1151
long status = GET_SERVERCALLS ()->vchroot_expandat (fd, path, strlen (path),
1152
1152
false , hostPath, sizeof (hostPath));
1153
1153
1154
+ #ifdef __NR_rmdir
1154
1155
status = LINUX_SYSCALL1 (__NR_rmdir, hostPath);
1156
+ #else
1157
+ status = LINUX_SYSCALL3 (__NR_unlinkat, AT_FDCWD, hostPath, AT_REMOVEDIR);
1158
+ #endif
1155
1159
1156
1160
if (status < 0 )
1157
1161
{
@@ -1216,7 +1220,7 @@ status_t _moni_open_dir_entry_ref(haiku_dev_t device, haiku_ino_t inode, const c
1216
1220
return status;
1217
1221
}
1218
1222
1219
- status = LINUX_SYSCALL2 (__NR_open, hostPath, O_DIRECTORY);
1223
+ status = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD, hostPath, O_DIRECTORY, 0 );
1220
1224
if (status < 0 )
1221
1225
{
1222
1226
return LinuxToB (-status);
@@ -1269,11 +1273,11 @@ status_t _moni_open_entry_ref(haiku_dev_t device, haiku_ino_t inode, const char*
1269
1273
linuxFlags |= O_NOFOLLOW;
1270
1274
}
1271
1275
1272
- status = LINUX_SYSCALL3 (__NR_open , hostPath, linuxFlags, linuxMode);
1276
+ status = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD , hostPath, linuxFlags, linuxMode);
1273
1277
1274
1278
if (status == -ELOOP && !shouldFailWithEloop)
1275
1279
{
1276
- status = LINUX_SYSCALL3 (__NR_open , hostPath, linuxFlags | O_PATH, linuxMode);
1280
+ status = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD , hostPath, linuxFlags | O_PATH, linuxMode);
1277
1281
}
1278
1282
1279
1283
if (status < 0 )
@@ -1346,7 +1350,7 @@ int _moni_open_attr(int fd, const char* path, const char *name,
1346
1350
int linuxMode = OFlagsBToLinux (openMode & ~HAIKU_O_NOTRAVERSE);
1347
1351
int linuxPerms = 0777 ;
1348
1352
1349
- status = LINUX_SYSCALL3 (__NR_open , hostPath, linuxMode, linuxPerms);
1353
+ status = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD , hostPath, linuxMode, linuxPerms);
1350
1354
1351
1355
if (status < 0 )
1352
1356
{
@@ -1375,7 +1379,7 @@ int _moni_open_attr_dir(int fd, const char* path, bool traverseLeafLink)
1375
1379
return status;
1376
1380
}
1377
1381
1378
- status = LINUX_SYSCALL2 (__NR_open, hostPath, O_DIRECTORY);
1382
+ status = LINUX_SYSCALL4 (__NR_openat, AT_FDCWD, hostPath, O_DIRECTORY, 0 );
1379
1383
1380
1384
if (status < 0 )
1381
1385
{
@@ -1490,4 +1494,4 @@ int FlockFlagsBToLinux(int flockFlags)
1490
1494
linuxFlags |= LOCK_UN;
1491
1495
}
1492
1496
return linuxFlags;
1493
- }
1497
+ }
0 commit comments