]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Implement all nacl_irt_dev_fdio calls except getdents.
authorRoland McGrath <roland@hack.frob.com>
Mon, 2 Mar 2015 21:28:55 +0000 (13:28 -0800)
committerRoland McGrath <roland@hack.frob.com>
Mon, 2 Mar 2015 21:28:55 +0000 (13:28 -0800)
sysdeps/nacl/fchdir.c [new file with mode: 0644]
sysdeps/nacl/fchmod.c [new file with mode: 0644]
sysdeps/nacl/fdatasync.c [new file with mode: 0644]
sysdeps/nacl/fsync.c [new file with mode: 0644]
sysdeps/nacl/ftruncate.c [new file with mode: 0644]
sysdeps/nacl/ftruncate64.c [new file with mode: 0644]
sysdeps/nacl/isatty.c [new file with mode: 0644]
sysdeps/nacl/nacl-interface-list.h

diff --git a/sysdeps/nacl/fchdir.c b/sysdeps/nacl/fchdir.c
new file mode 100644 (file)
index 0000000..4295bc2
--- /dev/null
@@ -0,0 +1,28 @@
+/* Change working directory given a file descriptor.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Change the current directory to FD.  */
+int
+__fchdir (int fd)
+{
+  return NACL_CALL (__nacl_irt_dev_fdio.fchdir (fd), 0);
+}
+weak_alias (__fchdir, fchdir)
diff --git a/sysdeps/nacl/fchmod.c b/sysdeps/nacl/fchmod.c
new file mode 100644 (file)
index 0000000..a51094d
--- /dev/null
@@ -0,0 +1,28 @@
+/* Change a file's permissions given a file descriptor.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Change the current directory to FD.  */
+int
+__fchmod (int fd, mode_t mode)
+{
+  return NACL_CALL (__nacl_irt_dev_fdio.fchmod (fd, mode), 0);
+}
+weak_alias (__fchmod, fchmod)
diff --git a/sysdeps/nacl/fdatasync.c b/sysdeps/nacl/fdatasync.c
new file mode 100644 (file)
index 0000000..cd7a55f
--- /dev/null
@@ -0,0 +1,28 @@
+/* Make all changes done to file data actually appear on disk.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Synchronize at least the data part of a file with the underlying
+   media.  */
+int
+fdatasync (int fd)
+{
+  return NACL_CALL (__nacl_irt_dev_fdio.fdatasync (fd), 0);
+}
diff --git a/sysdeps/nacl/fsync.c b/sysdeps/nacl/fsync.c
new file mode 100644 (file)
index 0000000..6f6622b
--- /dev/null
@@ -0,0 +1,27 @@
+/* Make all changes done to FD actually appear on disk.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Make all changes done to FD actually appear on disk.  */
+int
+fsync (int fd)
+{
+  return NACL_CALL (__nacl_irt_dev_fdio.fsync (fd), 0);
+}
diff --git a/sysdeps/nacl/ftruncate.c b/sysdeps/nacl/ftruncate.c
new file mode 100644 (file)
index 0000000..1235f0d
--- /dev/null
@@ -0,0 +1,32 @@
+/* Truncate a file.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Truncate the file referenced by FD to LENGTH bytes.  */
+int
+__ftruncate (int fd, off_t length)
+{
+  return NACL_CALL (__nacl_irt_dev_fdio.ftruncate (fd, length), 0);
+}
+weak_alias (__ftruncate, ftruncate)
+
+/* ftruncate64 is the same as ftruncate.  */
+strong_alias (__ftruncate, __ftruncate64)
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/nacl/ftruncate64.c b/sysdeps/nacl/ftruncate64.c
new file mode 100644 (file)
index 0000000..e40129a
--- /dev/null
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate.  */
diff --git a/sysdeps/nacl/isatty.c b/sysdeps/nacl/isatty.c
new file mode 100644 (file)
index 0000000..6e2b01a
--- /dev/null
@@ -0,0 +1,29 @@
+/* Determine if a file descriptor refers to a terminal.  NaCl version.
+   Copyright (C) 2015 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <nacl-interfaces.h>
+
+/* Return 1 if FD is a terminal, 0 if not.  */
+int
+__isatty (int fd)
+{
+  int result;
+  return NACL_CALL (__nacl_irt_dev_fdio.isatty (fd, &result), result);
+}
+weak_alias (__isatty, isatty)
index 2ead2a67250c55953caa6dd35062160b2526431a..11ad69ac16d42954b05ae909f808bdc7a562dbe6 100644 (file)
@@ -25,3 +25,5 @@ NACL_OPTIONAL_INTERFACE (rtld,
                          NACL_IRT_DEV_GETPID_v0_1, nacl_irt_dev_getpid)
 NACL_OPTIONAL_INTERFACE (rtld,
                          NACL_IRT_DEV_FILENAME_v0_3, nacl_irt_dev_filename)
+NACL_OPTIONAL_INTERFACE (libc,
+                         NACL_IRT_DEV_FDIO_v0_3, nacl_irt_dev_fdio)