/* MiG type declarations for Hurd interfaces		-*- C -*-
   Copyright (C) 1993,94,95,96,98,2001,02 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.  */


#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <device/device_types.defs>

type file_t = mach_port_copy_send_t
#ifdef FILE_INTRAN
intran: FILE_INTRAN
#endif
#ifdef FILE_OUTTRAN
outtran: FILE_OUTTRAN
#endif
#ifdef FILE_DESTRUCTOR
destructor: FILE_DESTRUCTOR
#endif
;

type fsys_t = mach_port_copy_send_t
#ifdef FSYS_INTRAN
intran: FSYS_INTRAN
#endif
#ifdef FSYS_OUTTRAN
outtran: FSYS_OUTTRAN
#endif
#ifdef FSYS_DESTRUCTOR
destructor: FSYS_DESTRUCTOR
#endif
;


type io_t = mach_port_copy_send_t
#ifdef IO_INTRAN
intran: IO_INTRAN
#endif
#ifdef IO_OUTTRAN
outtran: IO_OUTTRAN
#endif
#ifdef IO_DESTRUCTOR
destructor: IO_DESTRUCTOR
#endif
;

type process_t = mach_port_copy_send_t
#ifdef PROCESS_INTRAN
intran: PROCESS_INTRAN
#endif
#ifdef PROCESS_OUTTRAN
outtran: PROCESS_OUTTRAN
#endif
#ifdef PROCESS_DESTRUCTOR
destructor: PROCESS_DESTRUCTOR
#endif
;

type auth_t = mach_port_copy_send_t
#ifdef AUTH_INTRAN
intran: AUTH_INTRAN
#endif
#ifdef AUTH_OUTTRAN
outtran: AUTH_OUTTRAN
#endif
#ifdef AUTH_DESTRUCTOR
destructor: AUTH_DESTRUCTOR
#endif
;

type socket_t = mach_port_copy_send_t
#ifdef SOCKET_INTRAN
intran: SOCKET_INTRAN
#endif
#ifdef SOCKET_OUTTRAN
outtran: SOCKET_OUTTRAN
#endif
#ifdef SOCKET_DESTRUCTOR
destructor: SOCKET_DESTRUCTOR
#endif
;

/* Protocol family */
type pf_t = mach_port_copy_send_t
#ifdef PF_INTRAN
intran: PF_INTRAN
#endif
#ifdef PF_OUTTRAN
outtran: PF_OUTTRAN
#endif
#ifdef PF_DESTRUCTOR
destructor: PF_DESTRUCTOR
#endif
;

type addr_port_t = mach_port_copy_send_t
#ifdef ADDRPORT_INTRAN
intran: ADDRPORT_INTRAN
#endif
#ifdef ADDRPORT_OUTTRAN
outtran: ADDRPORT_OUTTRAN
#endif
#ifdef ADDRPORT_DESTRUCTOR
destructor: ADDRPORT_DESTRUCTOR
#endif
;

type term_t = mach_port_copy_send_t
#ifdef TERM_INTRAN
intran: TERM_INTRAN
#endif
#ifdef TERM_OUTTRAN
outtran: TERM_OUTTRAN
#endif
#ifdef TERM_DESTRUCTOR
destructor: TERM_DESTRUCTOR
#endif
;

type startup_t = mach_port_copy_send_t
#ifdef STARTUP_INTRAN
intran: STARTUP_INTRAN
#endif
#ifdef STARTUP_OUTTRAN
outtran: STARTUP_OUTTRAN
#endif
#ifdef STARTUP_DESTRUCTOR
destructor: STARTUP_DESTRUCTOR
#endif
;

type fs_notify_t = mach_port_copy_send_t
#ifdef FS_NOTIFY_INTRAN
intran: FS_NOTIFY_INTRAN
#endif
#ifdef FS_NOTIFY_OUTTRAN
outtran: FS_NOTIFY_OUTTRAN
#endif
#ifdef FS_NOTIFY_DESTRUCTOR
destructor: FS_NOTIFY_DESTRUCTOR
#endif
;

type exec_startup_t = mach_port_copy_send_t
#ifdef EXEC_STARTUP_INTRAN
intran: EXEC_STARTUP_INTRAN
#endif
#ifdef EXEC_STARTUP_OUTTRAN
outtran: EXEC_STARTUP_OUTTRAN
#endif
#ifdef EXEC_STARTUP_DESTRUCTOR
destructor: EXEC_STARTUP_DESTRUCTOR
#endif
;

type interrupt_t = mach_port_copy_send_t
#ifdef INTERRUPT_INTRAN
intran: INTERRUPT_INTRAN
#endif
#ifdef INTERRUPT_OUTTRAN
outtran: INTERRUPT_OUTTRAN
#endif
#ifdef INTERRUPT_DESTRUCTOR
destructor: INTERRUPT_DESTRUCTOR
#endif
;


type proccoll_t = mach_port_copy_send_t;

type sreply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
	ctype: mach_port_t;

/* These macros are used in some .defs files so that every routine has a
   server reply port argument #ifdef REPLY_PORTS.  */
#ifdef REPLY_PORTS
#define RPTDECL	sreplyport reply: sreply_port_t
#define RPT	RPTDECL;
#define RPTLAST	; RPTDECL
#else
#define RPTLAST
#define RPT
#endif

/* This macros are used in some .defs files so that every out data_t
   (or equivalent) has a servercopy keyword #ifdef SERVERCOPY. */
#ifdef SERVERCOPY
#define SCP , servercopy
#else
#define SCP
#endif

#ifdef HAVE_MIG_RETCODE
#define RETURN_CODE_ARG in return_code: kern_return_t, retcode
#else
#define RETURN_CODE_ARG in return_code: kern_return_t
#endif


#ifdef USERPREFIX
userprefix USERPREFIX;
#endif

#ifdef SERVERPREFIX
serverprefix SERVERPREFIX;
#endif

/* RPC interfaces which are interrupt compliant (see interrupt.defs)
   should put ``INTR_INTERFACE'' at the beginning of their .defs file.  */
#ifndef INTR_INTERFACE
#define INTR_INTERFACE		/* Nothing special.  */
#endif

type data_t = array[] of char;
type string_t = c_string[1024]; /* XXX */
type io_statbuf_t = struct[32] of int;
type uid_t = unsigned32;
type gid_t = unsigned32;
type mode_t = unsigned32;
type retry_type = unsigned32;
type pid_t = int32;
type wait_status_t = int32;
type loff_t = int64;
type ino64_t = int64;
type file_changed_type_t = unsigned32;
type dir_changed_type_t = unsigned32;

type portarray_t = array[] of mach_port_send_t;
type intarray_t = array[] of int;
type off_array_t = array[] of loff_t;

type pidarray_t = array[] of pid_t;
type procinfo_t = array[] of int;
type fsys_statfsbuf_t=struct[22] of int;

type idarray_t = array[] of uid_t;

type rusage_t = struct[18] of int; /* XXX */

type flock_t = struct[5] of int;

type timespec_t = struct[2] of int;

#define _SYS_UTSNAME_H		/* Inhibit warning from <bits/utsname.h>.  */
#include <bits/utsname.h>
type utsname_t = struct[5 * _UTSNAME_LENGTH] of char;

import <sys/types.h>;
import <sys/stat.h>;
import <sys/statfs.h>;
import <sys/resource.h>;
import <sys/utsname.h>;
import <hurd/hurd_types.h>;
