aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/fchownat.c51
-rw-r--r--sysdeps/generic/futimesat.c52
-rw-r--r--sysdeps/generic/fxstatat.c49
-rw-r--r--sysdeps/generic/fxstatat64.c50
-rw-r--r--sysdeps/generic/openat.c2
-rw-r--r--sysdeps/generic/openat64.c2
-rw-r--r--sysdeps/generic/renameat.c50
-rw-r--r--sysdeps/generic/unlinkat.c49
8 files changed, 303 insertions, 2 deletions
diff --git a/sysdeps/generic/fchownat.c b/sysdeps/generic/fchownat.c
new file mode 100644
index 0000000000..f6921c9012
--- /dev/null
+++ b/sysdeps/generic/fchownat.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Change the owner and group of FILE. */
+int
+fchownat (fd, file, owner, group, flag)
+ int fd;
+ const char *file;
+ uid_t owner;
+ gid_t group;
+ int flag;
+{
+ if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fchownat)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/futimesat.c b/sysdeps/generic/futimesat.c
new file mode 100644
index 0000000000..33d170862a
--- /dev/null
+++ b/sysdeps/generic/futimesat.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/time.h>
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+futimesat (fd, file, tvp)
+ int fd;
+ const char *file;
+ const struct timeval tvp[2];
+{
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__utimes, utimes)
+
+stub_warning (utimes)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstatat.c b/sysdeps/generic/fxstatat.c
new file mode 100644
index 0000000000..62f7fe3efb
--- /dev/null
+++ b/sysdeps/generic/fxstatat.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fstatat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstatat64.c b/sysdeps/generic/fxstatat64.c
new file mode 100644
index 0000000000..ba95b73e81
--- /dev/null
+++ b/sysdeps/generic/fxstatat64.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
+ int flag)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fstatat64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/openat.c b/sysdeps/generic/openat.c
index b058bcbe9f..f3f699ca23 100644
--- a/sysdeps/generic/openat.c
+++ b/sysdeps/generic/openat.c
@@ -39,7 +39,7 @@ openat (fd, file, oflag)
return -1;
}
- if (file[0] != '/')
+ if (fd != AT_FDCWD && file[0] != '/')
{
/* Check FD is associated with a directory. */
struct stat64 st;
diff --git a/sysdeps/generic/openat64.c b/sysdeps/generic/openat64.c
index 82575df399..87952d38d6 100644
--- a/sysdeps/generic/openat64.c
+++ b/sysdeps/generic/openat64.c
@@ -39,7 +39,7 @@ openat64 (fd, file, oflag)
return -1;
}
- if (file[0] != '/')
+ if (fd != AT_FDCWD && file[0] != '/')
{
/* Check FD is associated with a directory. */
struct stat64 st;
diff --git a/sysdeps/generic/renameat.c b/sysdeps/generic/renameat.c
new file mode 100644
index 0000000000..e8629098df
--- /dev/null
+++ b/sysdeps/generic/renameat.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+
+/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
+int
+renameat (oldfd, old, newfd, new)
+ int oldfd;
+ const char *old;
+ int newfd;
+ const char *new;
+{
+ if ((oldfd < 0 & oldfd !_ AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD))
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (old == NULL || new == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (renameat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/unlinkat.c b/sysdeps/generic/unlinkat.c
new file mode 100644
index 0000000000..f9a08b9903
--- /dev/null
+++ b/sysdeps/generic/unlinkat.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Remove the link named NAME. */
+int
+unlinkat (fd, name, flag)
+ int fd;
+ const char *name;
+ int flag;
+{
+ if (name == NULL || (flag & AT_REMOVEDIR) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (unlinkat)
+
+#include <stub-tag.h>