/* MiG type declarations for Hurd interfaces -*- C -*-
Copyright (C) 1993-1996, 1998, 2001, 2002, 2014-2019
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. If not, see . */
#ifdef HURD_SERVER
/* The Hurd uses protected payloads to quickly look up the object
receiving a message. Looking up objects is optimized at the cost
of having to translate payloads back to port names if the server
function expect a port name rather than an object.
Support for this is implemented in libports. Almost all of Hurd's
servers use libports. For servers using libports, the optimized
lookup is completely transparent.
Servers not using libports are not using protected payloads
automatically. Define HURD_DEFAULT_PAYLOAD_TO_PORT to 1 (1 like
the identity function) for programs not using libports to avoid
injecting the default payload-to-port translation function which is
in libports. If you want to use protected payloads without
libports, you can use HURD_DEFAULT_PAYLOAD_TO_PORT to inject a
custom translation function. */
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
#if HURD_DEFAULT_PAYLOAD_TO_PORT
/* Any non-numeric value will fail this test. If 1 (or any number) is
given, do not inject the default translator function. */
#undef HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#else
import ;
#define HURD_DEFAULT_PAYLOAD_TO_PORT ports_payload_get_name
#endif
/* Override the mach_port_t. Use the default payload to port
translation function to convert payloads back to port names for
this type. */
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
#define MACH_PAYLOAD_TO_PORT HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#endif /* HURD_SERVER */
#include
#include
#include
/* The Hurd types. You can inject translation functions for type X
using the X_INTRAN, X_INTRAN_PAYLOAD, X_OUTTRAN, and X_DESTRUCTOR.
If you define X_INTRAN and your server is using libports, you also
have to define X_INTRAN_PAYLOAD.
If you do not use libports, and do not want to use the protected
payload mechanism, but you do want to use X_INTRAN, you must
provide a X_INTRAN_PAYLOAD that either ignores the message by
returning NULL, or indicates an error condition in some appropriate
way. If you do want to use the protected payload mechanism, make
sure you also define an appropriate HURD_DEFAULT_PAYLOAD_TO_PORT
translation function. */
type file_t = mach_port_copy_send_t
#ifdef FILE_INTRAN
intran: FILE_INTRAN
intranpayload: FILE_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: file_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: FSYS_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: fsys_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: IO_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: io_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: PROCESS_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: process_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: AUTH_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: auth_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: SOCKET_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: socket_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: PF_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: pf_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: ADDRPORT_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: addr_port_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: TERM_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: term_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: STARTUP_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: startup_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: FS_NOTIFY_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: fs_notify_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: EXEC_STARTUP_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: exec_startup_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#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
intranpayload: INTERRUPT_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: interrupt_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#endif
#ifdef INTERRUPT_OUTTRAN
outtran: INTERRUPT_OUTTRAN
#endif
#ifdef INTERRUPT_DESTRUCTOR
destructor: INTERRUPT_DESTRUCTOR
#endif
;
/* PCI arbiter */
type pci_t = mach_port_copy_send_t
#ifdef PCI_INTRAN
intran: PCI_INTRAN
intranpayload: PCI_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: pci_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#endif
#ifdef PCI_OUTTRAN
outtran: PCI_OUTTRAN
#endif
#ifdef PCI_DESTRUCTOR
destructor: PCI_DESTRUCTOR
#endif
;
/* Shutdown */
type shutdown_t = mach_port_copy_send_t
#ifdef SHUTDOWN_INTRAN
intran: SHUTDOWN_INTRAN
intranpayload: SHUTDOWN_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: shutdown_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#endif
#ifdef SHUTDOWN_OUTTRAN
outtran: SHUTDOWN_OUTTRAN
#endif
#ifdef SHUTDOWN_DESTRUCTOR
destructor: SHUTDOWN_DESTRUCTOR
#endif
;
/* ACPI */
type acpi_t = mach_port_copy_send_t
#ifdef ACPI_INTRAN
intran: ACPI_INTRAN
intranpayload: ACPI_INTRAN_PAYLOAD
#else
#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
intranpayload: acpi_t HURD_DEFAULT_PAYLOAD_TO_PORT
#endif
#endif
#ifdef ACPI_OUTTRAN
outtran: ACPI_OUTTRAN
#endif
#ifdef ACPI_DESTRUCTOR
destructor: ACPI_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
#ifdef MACH_PAYLOAD_TO_PORT
intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT
#endif /* MACH_PAYLOAD_TO_PORT */
;
/* 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
#define RETURN_CODE_ARG in return_code: kern_return_t, retcode
#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 uid_t = uint32_t;
type gid_t = uint32_t;
type mode_t = uint32_t;
type retry_type = uint32_t;
type pid_t = int32_t;
type wait_status_t = int32_t;
type loff_t = int64_t;
type ino64_t = int64_t;
type file_changed_type_t = uint32_t;
type dir_changed_type_t = uint32_t;
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 idarray_t = array[] of uid_t;
type flock_t = struct {
int l_type;
int l_whence;
loff_t l_start;
loff_t l_len;
pid_t l_pid;
};
type unsigned_int = uint32_t;
#if defined(__x86_64__)
type long = int64_t;
type unsigned_long = uint64_t;
/* Type names are in sync with glibc/posix/bits/types.h. */
type uword = unsigned_long;
type uquad = unsigned_long;
type squad = long;
#else
type long = int32_t;
type unsigned_long = uint32_t;
type uword = unsigned_int;
type uquad = uint64_t;
type squad = int64_t;
#endif /* defined(__x86_64__) */
type blksize_t = long;
type blkcnt64_t = squad;
type dev_t = uword;
type fsblkcnt64_t = uquad;
type fsfilcnt64_t = uquad;
type fsid_t = uquad;
type nlink_t = uword;
type time_t = long;
type timespec_t = struct {
time_t tv_sec;
long tv_nsec;
};
type timeval = timespec_t;
/* Dummy structure just to add padding to io_statbuf_t. */
type io_statbuf_spare_int = struct[8] of int;
/* Needs to be kept in sync with glibc/mach/hurd/bits/stat.h. */
type io_statbuf_t = struct {
int st_fstype;
fsid_t st_fsid;
ino64_t st_ino;
unsigned_int st_gen;
dev_t st_rdev;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
loff_t st_size;
timespec_t st_atim;
timespec_t st_mtim;
timespec_t st_ctim;
blksize_t st_blksize;
blkcnt64_t st_blocks;
uid_t st_author;
unsigned_int st_flags;
io_statbuf_spare_int st_spare;
};
/* Needs to be kept in sync with glibc/mach/hurd/bits/statfs.h. */
type fsys_statfsbuf_t = struct {
unsigned_int f_type;
unsigned_long f_bsize;
fsblkcnt64_t f_blocks;
fsblkcnt64_t f_bfree;
fsblkcnt64_t f_bavail;
fsblkcnt64_t f_files;
fsblkcnt64_t f_ffree;
fsid_t f_fsid;
unsigned_long f_namelen;
fsfilcnt64_t f_favail;
unsigned_long f_frsize;
unsigned_long f_flag;
unsigned_int f_spare1;
unsigned_int f_spare2;
unsigned_int f_spare3;
};
/* Needs to be kept in sync with glibc/resource/bits/types/struct_rusage.h. */
type rusage_t = struct {
timeval ru_utime;
timeval ru_stime;
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
};
#define _SYS_UTSNAME_H /* Inhibit warning from . */
#include
type utsname_t = struct[5 * _UTSNAME_LENGTH] of char;
import ;
import ;
import ;
import ;
import ;
import ;
import ;