bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] System V Shared memory interface


From: Neal H Walfield
Subject: [PATCH] System V Shared memory interface
Date: Tue, 1 May 2001 16:00:31 +0200
User-agent: Mutt/1.3.15i

This patch adds a shared memory interface to the hurd.

2001-04-22  Neal H Walfield  <neal@cs.uml.edu>

        * sysvshm.defs: New file.  Support for System V shared memory.
        * hurd_types.defs: Import <sys/shm.h>.
        (sysvshm_t): New type.  System V shm server port.
        (key_t): New type. System V shm key.
        (shmid_ds_t): New type. Shared memory per region statistics.
        * hurd_types.h (key_t): New type.
        (sysvshm_t): New type.
        (shmid_ds_t): New type.
        * paths.h (_SERVERS_SYSVSHM): New macro.
        * subsystems: Add sysvshm subsystem.

Index: hurd/hurd_types.defs
===================================================================
RCS file: /home/neal/shared/CVS/hurd/hurd/hurd_types.defs,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hurd_types.defs
--- hurd/hurd_types.defs        2001/04/19 12:40:42     1.1.1.1
+++ hurd/hurd_types.defs        2001/05/01 13:56:01
@@ -1,5 +1,5 @@
 /* MiG type declarations for Hurd interfaces           -*- C -*-
-   Copyright (C) 1993, 94, 95, 96, 98 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 98, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -144,6 +144,19 @@
 #endif
 ;
 
+/* System V shared memory  */
+type sysvshm_t = mach_port_copy_send_t
+#ifdef SYSVSHM_INTRAN
+intran: SYSVSHM_INTRAN
+#endif
+#ifdef SYSVSHM_OUTTRAN
+outtran: SYSVSHM_OUTTRAN
+#endif
+#ifdef SYSVSHM_DESTRUCTOR
+destructor: SYSVSHM_DESTRUCTOR
+#endif
+;
+
 type proccoll_t = mach_port_copy_send_t;
 
 type sreply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
@@ -199,6 +212,10 @@
 type file_changed_type_t = int;
 type dir_changed_type_t = int;
 
+type key_t = int;
+type shmid_t = int;
+type shmid_array_t = array[] of int;
+
 type portarray_t = array[] of mach_port_send_t;
 type intarray_t = array[] of int;
 type off_array_t = array[] of off_t;
@@ -213,6 +230,9 @@
 
 type flock_t = struct[5] of int;
 
+type shmid_ds_t = struct[12] of int; /* XXX: sizeof (struct shmds_id) == 48.  
*/
+type shmid_ds_array_t = array[] of shmid_ds_t;
+
 #define _SYS_UTSNAME_H         /* Inhibit warning from <bits/utsname.h>.  */
 #include <bits/utsname.h>
 type utsname_t = struct[5 * _UTSNAME_LENGTH] of char;
@@ -222,4 +242,5 @@
 import <sys/statfs.h>;
 import <sys/resource.h>;
 import <sys/utsname.h>;
+import <sys/shm.h>;
 import <hurd/hurd_types.h>;
Index: hurd/hurd_types.h
===================================================================
RCS file: /home/neal/shared/CVS/hurd/hurd/hurd_types.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1 -r1.1.1.1.2.2
--- hurd/hurd_types.h   2001/04/19 12:40:42     1.1.1.1
+++ hurd/hurd_types.h   2001/04/30 21:18:35     1.1.1.1.2.2
@@ -1,5 +1,5 @@
 /* C declarations for Hurd server interfaces
-   Copyright (C) 1993, 94, 95, 96, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 98, 99, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -44,6 +44,7 @@
 typedef mach_port_t addr_port_t;
 typedef mach_port_t startup_t;
 typedef mach_port_t proccoll_t;
+typedef mach_port_t sysvshm_t;
 
 #include <errno.h>             /* Defines `error_t'.  */
 
@@ -62,6 +63,10 @@
 typedef struct utsname utsname_t;
 typedef struct stat io_statbuf_t;
 typedef struct statfs fsys_statfsbuf_t;
+typedef int shmid_t;
+typedef int *shmid_array_t;
+typedef struct shmid_ds shmid_ds_t;
+typedef struct shmid_ds *shmid_ds_array_t;
 
 
 /*   Parameters and flags in RPC calls   */
Index: hurd/paths.h
===================================================================
RCS file: /home/neal/shared/CVS/hurd/hurd/paths.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- hurd/paths.h        2001/04/19 12:40:43     1.1.1.1
+++ hurd/paths.h        2001/04/23 12:52:48     1.1.1.1.2.1
@@ -1,5 +1,5 @@
 /* Standard Hurd pathnames.
-   Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1995, 1997, 2001 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -29,6 +29,7 @@
 #define _SERVERS_STARTUP       _SERVERS "startup"
 #define _SERVERS_PROC          _SERVERS "proc"
 #define _SERVERS_PASSWORD      _SERVERS "password"
+#define _SERVERS_SYSVSHM       "/var/run/sysvshm"
 
 /* Directory containing naming points for socket servers.
    Entries are named by the string representing the domain number
Index: hurd/subsystems
===================================================================
RCS file: /home/neal/shared/CVS/hurd/hurd/subsystems,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- hurd/subsystems     2001/04/19 12:40:44     1.1.1.1
+++ hurd/subsystems     2001/04/30 21:18:35     1.1.1.1.2.1
@@ -36,6 +36,7 @@
 login          36000   Database of logged-in users
 pfinet         37000   Internet configuration calls
 password       38000   Password checker
+sysvshm                39000   System V shared memory
 <ioctl space>  100000- First subsystem of ioctl class 'f' (lowest class)
 tioctl        156000   Ioctl class 't' (terminals)
 tioctl        156200     (continued)
Index: hurd/sysvshm.defs
===================================================================
RCS file: sysvshm.defs
diff -N sysvshm.defs
--- /dev/null   Fri Apr 13 19:52:55 2001
+++ /tmp/cvsGm2XyP      Tue May  1 15:56:03 2001
@@ -0,0 +1,57 @@
+/* Definitions for the support of the System V shared memory interface.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   This file is part of the GNU Hurd.
+
+   The GNU Hurd is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   The GNU Hurd 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with the GNU Hurd; see the file COPYING.  If not, write to
+   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+subsystem sysvshm 39000;
+
+#include <hurd/hurd_types.defs>
+
+#ifdef SYSVSHM_IMPORTS
+SYSVSHM_IMPORTS
+#endif
+
+/* Get the shared memory identifier, SHMID, associated with KEY.  If it
+   does not exist, create one based on the data found in KEY, SIZE and
+   MODE.  */
+routine shm_getid (
+       server: sysvshm_t;
+       RPT
+       key: key_t;
+       size: size_t;
+       mode: mode_t;
+       out shmid: shmid_t);
+
+/* Retrieve the shared memory segment statistic associated with SHMID.  */
+routine shm_stat (
+       server: sysvshm_t;
+       RPT
+       shmid: shmid_t;
+       out stat: shmid_ds_t);
+
+/* Return a pair of parallel arrayes.  The first, SHMIDS, is an array of
+   shmids.  The second, STATS, is an array of shared memory statistics.
+   LACKPERM is set to the number of nodes that the user could not stat
+   due to lack of permission.  If any other error occurs, it is returned
+   directly.  */
+routine shm_statall (
+       server: sysvshm_t;
+       RPT
+       out shmids: shmid_array_t;
+       out stats: shmid_ds_array_t;
+       out lackperm: int);
+

Attachment: pgpVheSPT6p8s.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]