summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h10
-rw-r--r--sysdeps/mach/hurd/fork.c2
-rw-r--r--sysdeps/mach/hurd/pread.c8
-rw-r--r--sysdeps/mach/hurd/pread64.c43
-rw-r--r--sysdeps/mach/hurd/pwrite.c8
-rw-r--r--sysdeps/mach/hurd/pwrite64.c43
6 files changed, 109 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 02280002a2..6231248bc2 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -31,6 +31,13 @@
 /* Processes have a saved set-user-ID and a saved set-group-ID.  */
 #define	_POSIX_SAVED_IDS	1
 
+#if 0				/* XXX implement aio_* */
+/* Asynchronous I/O is supported.  */
+#define _POSIX_ASYNCHRONOUS_IO	1
+/* Alternative name for Unix98.  */
+#define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+#endif
+
 /* Synchronizing file data is supported, but msync is missing.  */
 #undef _POSIX_SYNCHRONIZED_IO
 
@@ -46,6 +53,9 @@
 /* Setting of memory protections is supported.  */
 #define	_POSIX_MEMORY_PROTECTION	1
 
+/* POSIX.4 shared memory objects are supported (using regular files).  */
+#define _POSIX_SHARED_MEMORY_OBJECTS	_POSIX_MAPPED_FILES
+
 /* Implementation supports `poll' function.  */
 #define	_POSIX_POLL	1
 
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index afc427045b..aa3a040aac 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -64,7 +64,7 @@ __fork (void)
   __spin_lock (&ss->critical_section_lock);
 
 #undef	LOSE
-#define LOSE assert_perror (err) /* XXX */
+#define LOSE do { assert_perror (err); goto lose; } while (0) /* XXX */
 
   if (! setjmp (env))
     {
diff --git a/sysdeps/mach/hurd/pread.c b/sysdeps/mach/hurd/pread.c
index dd69b10ac5..91b008f9f8 100644
--- a/sysdeps/mach/hurd/pread.c
+++ b/sysdeps/mach/hurd/pread.c
@@ -23,7 +23,7 @@
 #include <hurd/fd.h>
 
 ssize_t
-__pread (int fd, void *buf, size_t nbytes, off_t offset)
+__libc_pread (int fd, void *buf, size_t nbytes, off_t offset)
 {
   error_t err;
   if (offset < 0)
@@ -32,4 +32,8 @@ __pread (int fd, void *buf, size_t nbytes, off_t offset)
     err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, offset));
   return err ? __hurd_dfail (fd, err) : nbytes;
 }
-weak_alias (__pread, pread)
+
+#ifndef __libc_pread
+strong_alias (__libc_pread, __pread)
+weak_alias (__libc_pread, pread)
+#endif
diff --git a/sysdeps/mach/hurd/pread64.c b/sysdeps/mach/hurd/pread64.c
new file mode 100644
index 0000000000..43841eeb49
--- /dev/null
+++ b/sysdeps/mach/hurd/pread64.c
@@ -0,0 +1,43 @@
+/* Read block from given position in file without changing file pointer.
+   Hurd version.
+   Copyright (C) 2001 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+ssize_t
+__libc_pread64 (int fd, void *buf, size_t nbyte, off64_t offset)
+{
+  /* XXX We don't really support large files on the Hurd.  So if
+     OFFSET doesn't fit in an `off_t', we'll return `-1' and set
+     errno.  EOVERFLOW probably isn't the right error value, but seems
+     appropriate here.  */
+  if ((off_t) offset != offset)
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+
+  return __libc_pread (fd, buf, nbyte, offset);
+}
+
+#ifndef __libc_pread64
+weak_alias (__libc_pread64, __pread64)
+weak_alias (__libc_pread64, pread64)
+#endif
diff --git a/sysdeps/mach/hurd/pwrite.c b/sysdeps/mach/hurd/pwrite.c
index 42de3eb9f9..f734c4f5f2 100644
--- a/sysdeps/mach/hurd/pwrite.c
+++ b/sysdeps/mach/hurd/pwrite.c
@@ -25,7 +25,7 @@
 /* Write NBYTES of BUF to FD at given position OFFSET without changing
    the file position.  Return the number written, or -1.  */
 ssize_t
-__pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
+__libc_pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
 {
   error_t err;
   if (offset < 0)
@@ -34,4 +34,8 @@ __pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
     err = HURD_FD_USE (fd, _hurd_fd_write (descriptor, buf, &nbytes, offset));
   return err ? __hurd_dfail (fd, err) : nbytes;
 }
-weak_alias (__pwrite, pwrite)
+
+#ifndef __libc_pwrite
+strong_alias (__libc_pwrite, __pwrite)
+weak_alias (__libc_pwrite, pwrite)
+#endif
diff --git a/sysdeps/mach/hurd/pwrite64.c b/sysdeps/mach/hurd/pwrite64.c
new file mode 100644
index 0000000000..7cca3d8172
--- /dev/null
+++ b/sysdeps/mach/hurd/pwrite64.c
@@ -0,0 +1,43 @@
+/* Write block to given position in file without changing file pointer.
+   Hurd version.
+   Copyright (C) 2001 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+ssize_t
+__libc_pwrite64 (int fd, const void *buf, size_t nbyte, off64_t offset)
+{
+  /* XXX We don't really support large files on the Hurd.  So if
+     OFFSET doesn't fit in an `off_t', we'll return `-1' and set
+     errno.  EOVERFLOW probably isn't the right error value, but seems
+     appropriate here.  */
+  if ((off_t) offset != offset)
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+
+  return __libc_pwrite (fd, buf, nbyte, offset);
+}
+
+#ifndef __libc_pwrite64
+weak_alias (__libc_pwrite64, __pwrite64)
+weak_alias (__libc_pwrite64, pwrite64)
+#endif