diff --git a/include/errno.h b/include/errno.h index 7ac1ebe9..f73b5d2d 100644 --- a/include/errno.h +++ b/include/errno.h @@ -30,8 +30,11 @@ #ifndef __MES_ERRNO_T #define __MES_ERRNO_T 1 +#ifndef __error_t_defined +#define __error_t_defined 1 typedef int error_t; int errno; +#endif // ! __error_t_defined #endif // !__MES_ERRNO_T int errno; diff --git a/include/gnu/hurd-types.h b/include/gnu/hurd-types.h index a156b64e..1ed24916 100644 --- a/include/gnu/hurd-types.h +++ b/include/gnu/hurd-types.h @@ -26,8 +26,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif #include /* For struct timespec. */ +#if __MESC__ +#else #include /* For mach_port_t et al. */ #include /* For mach_msg_id_t et al. */ +#endif #include /* For pid_t and uid_t. */ /* A string identifying this release of the GNU Hurd. Our @@ -40,6 +43,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Simple type declarations */ +#if 0 /* These types identify certain kinds of ports used by the Hurd. */ typedef mach_port_t file_t; typedef mach_port_t fsys_t; @@ -55,6 +59,22 @@ typedef mach_port_t exec_startup_t; typedef mach_port_t interrupt_t; typedef mach_port_t proccoll_t; typedef mach_port_t ctty_t; +#else +typedef unsigned int file_t; +typedef unsigned int fsys_t; +typedef unsigned int io_t; +typedef unsigned int process_t; +typedef unsigned int auth_t; +typedef unsigned int socket_t; +typedef unsigned int pf_t; /* Protocol family */ +typedef unsigned int addr_port_t; +typedef unsigned int startup_t; +typedef unsigned int fs_notify_t; +typedef unsigned int exec_startup_t; +typedef unsigned int interrupt_t; +typedef unsigned int proccoll_t; +typedef unsigned int ctty_t; +#endif #include /* Defines `error_t'. */ @@ -135,6 +155,8 @@ enum retry_type }; typedef enum retry_type retry_type; +#if __GNUC__ + /* Types for fs_notify.defs:dir_changed call: */ enum dir_changed_type { @@ -271,11 +293,14 @@ enum file_storage_class /* Data types */ +#if __MESC__ +#else #include #include #ifndef THREAD_SCHED_INFO #include #endif +#endif /* Flags sent in proc_getprocinfo request. */ #define PI_FETCH_TASKINFO 0x0001 @@ -390,4 +415,6 @@ enum INIT_INT_MAX, }; +#endif // __GNUC__ + #endif // _HURD_TYPES_H diff --git a/include/gnu/hurd.h b/include/gnu/hurd.h index 0d6a23f4..159a7cc2 100644 --- a/include/gnu/hurd.h +++ b/include/gnu/hurd.h @@ -24,6 +24,7 @@ #define _GNU_SOURCE 1 #define __USE_GNU 1 +#include #include #include @@ -34,9 +35,45 @@ typedef off64_t loff_t; #endif #endif +#if __MESC__ + +typedef unsigned int mach_msg_type_number_t; + +typedef int kern_error_t; +typedef int kern_return_t; + +typedef int boolean_t; + +// vm +typedef int integer_t; +typedef unsigned int natural_t; +typedef natural_t vm_size_t; + +#if 0 // broken +typedef unsigned long vm_offset_t; +typedef vm_offset_t mach_port_t; +//typedef mach_port_t io_t; +//typedef mach_port_t task_t; +typedef natural_t mach_port_seqno_t; +typedef vm_offset_t pointer_t; +typedef vm_offset_t vm_address_t; + +#else +typedef unsigned long vm_offset_t; +typedef unsigned long mach_port_t; +//typedef unsigned long io_t; +//typedef unsigned long task_t; + +typedef unsigned int mach_port_seqno_t; +typedef unsigned long pointer_t; +typedef unsigned long vm_address_t; +#endif + +#else #include #include #include +#endif struct hurd_startup_data { diff --git a/include/gnu/syscall.h b/include/gnu/syscall.h index 8d20f9da..81242e36 100644 --- a/include/gnu/syscall.h +++ b/include/gnu/syscall.h @@ -21,6 +21,93 @@ #ifndef __MES_GNU_SYSCALL_H #define __MES_GNU_SYSCALL_H +#if __MESC__ + +// stripped mach/message.h -- possibly just copy message.h and edit +// that... +typedef unsigned int mach_msg_bits_t; +typedef unsigned int mach_msg_size_t; + +#if 0 +typedef natural_t mach_msg_seqno_t; +typedef integer_t mach_msg_id_t; +#else +typedef unsigned int mach_msg_seqno_t; +typedef int mach_msg_id_t; +#endif + +typedef struct { + mach_msg_bits_t msgh_bits; + mach_msg_size_t msgh_size; + mach_port_t msgh_remote_port; + union { + mach_port_t msgh_local_port; + unsigned long msgh_protected_payload; + }; + mach_port_seqno_t msgh_seqno; + mach_msg_id_t msgh_id; +} mach_msg_header_t; + + +typedef unsigned int mach_msg_type_name_t; +typedef unsigned int mach_msg_type_size_t; +// #if 0 +// typedef natural_t mach_msg_type_number_t; +// #else +// typedef unsigned int mach_msg_type_number_t; +// #endif + +typedef struct { + unsigned int msgt_name : 8, + msgt_size : 8, + msgt_number : 12, + msgt_inline : 1, + msgt_longform : 1, + msgt_deallocate : 1, + msgt_unused : 1; +} mach_msg_type_t; + +typedef struct { + mach_msg_type_t msgtl_header; + unsigned short msgtl_name; + unsigned short msgtl_size; + natural_t msgtl_number; +} mach_msg_type_long_t; + +#if 0 +typedef kern_return_t mach_msg_return_t; +typedef natural_t mach_msg_timeout_t; +typedef integer_t mach_msg_option_t; +#else +typedef int mach_msg_return_t; +typedef unsigned int mach_msg_timeout_t; +typedef int mach_msg_option_t; +#endif + +#define MACH_MSG_OPTION_NONE 0x00000000 + +#define MACH_SEND_MSG 0x00000001 +#define MACH_RCV_MSG 0x00000002 + +#define MACH_SEND_TIMEOUT 0x00000010 +#define MACH_SEND_NOTIFY 0x00000020 +#define MACH_SEND_CANCEL 0x00000080 +#define MACH_RCV_TIMEOUT 0x00000100 +#define MACH_RCV_NOTIFY 0x00000200 +#define MACH_RCV_LARGE 0x00000800 + +extern mach_msg_return_t +mach_msg + (mach_msg_header_t *msg, + mach_msg_option_t option, + mach_msg_size_t send_size, + mach_msg_size_t rcv_size, + mach_port_t rcv_name, + mach_msg_timeout_t timeout, + mach_port_t notify); + +#else + #define _GNU_SOURCE 1 #define __USE_GNU 1 @@ -30,8 +117,10 @@ #include #include +#endif + // mach/mach.defs -enum +enum __mach_defs { SYS__task_terminate = 2008, SYS__vm_allocate = 2021, @@ -40,26 +129,26 @@ enum }; // hurd/fsys.defs -enum +enum __fsys_defs { SYS__dir_lookup = 20018, }; // hurd/io.defs -enum +enum __io_defs { SYS__io_write = 21000, SYS__io_read, }; // hurd/process.defs -enum +enum __process_defs { SYS__proc_mark_exit = 24025, }; // hurd/startup.defs -enum +enum __startup_defs { SYS__exec_startup_get_info = 30500, }; @@ -122,6 +211,29 @@ struct mach_msg_startup_info int *intarray; }; +//#include // natural_t, integer_t, vm_size_t +////#include + +///// vm_statistics +struct vm_statistics { + integer_t pagesize; /* page size in bytes */ + integer_t free_count; /* # of pages free */ + integer_t active_count; /* # of pages active */ + integer_t inactive_count; /* # of pages inactive */ + integer_t wire_count; /* # of pages wired down */ + integer_t zero_fill_count; /* # of zero fill pages */ + integer_t reactivations; /* # of pages reactivated */ + integer_t pageins; /* # of pageins */ + integer_t pageouts; /* # of pageouts */ + integer_t faults; /* # of faults */ + integer_t cow_faults; /* # of copy-on-writes */ + integer_t lookups; /* object cache lookups */ + integer_t hits; /* object cache hits */ +}; +typedef struct vm_statistics *vm_statistics_t; +typedef struct vm_statistics vm_statistics_data_t; +////// end vm_statistics + kern_return_t __syscall (mach_port_t port, int sys_call); kern_return_t __syscall2 (mach_port_t port, int sys_call, int one, int two); kern_return_t __syscall_get (mach_port_t port, int sys_call, mach_msg_header_t *message, size_t size); @@ -138,7 +250,7 @@ kern_return_t __proc_mark_exit (mach_port_t process, int one, int two); kern_return_t __exec_startup_get_data (mach_port_t bootstrap, struct hurd_startup_data *data); // io.c -kern_return_t __io_write (io_t io_object, data_t data, mach_msg_type_number_t size, loff_t offset, vm_size_t *wrote); +kern_return_t __io_write (io_t io, data_t data, mach_msg_type_number_t size, loff_t offset, vm_size_t *wrote); kern_return_t __io_read (io_t io, data_t *data, mach_msg_type_number_t *read, loff_t offset, vm_size_t size); #endif // __MES_GNU_SYSCALL_H diff --git a/lib/gnu/_exit.c b/lib/gnu/_exit.c index 39268f8f..a05bef24 100644 --- a/lib/gnu/_exit.c +++ b/lib/gnu/_exit.c @@ -27,7 +27,9 @@ #include #include #include -#include +//#include + +#warn "DUN" void _exit (int status)