//---------------------------------------------------------------- // channels.h // // This file defines some constants used by our 'channels.c' // module, and by any application that invokes its services. // Repetitive assembly-language statements have been removed // in this revision following a suggestion by Matt Ketterer. // // programmer: ALLAN CRUSE // written on: 08 NOV 2004 // revised on: 10 NOV 2004 -- as suggested by Matt Ketterer //---------------------------------------------------------------- #include // for __NR_break #define OBSOLETE_ID __NR_break #define INFO_LENGTH 1024 enum { CHAN_MAKE, CHAN_OPEN, CHAN_POST, CHAN_PEND, CHAN_SHUT, CHAN_KILL }; #ifndef __KERNEL__ //------------------- // service functions //------------------- int chan_common_entry( int cmd, int key, char *buf, int len ) { int retval; asm(" movl %0, %%eax " : : "i" (OBSOLETE_ID) ); asm(" movl %0, %%ebx " : : "m" (cmd) ); asm(" movl %0, %%ecx " : : "m" (key) ); asm(" movl %0, %%edx " : : "m" (buf) ); asm(" movl %0, %%esi " : : "m" (len) ); asm(" int $0x80 "); asm(" movl %%eax, %0 " : "=m" (retval) ); return retval; } int chan_make( void ) { return chan_common_entry( CHAN_MAKE, 0, NULL, 0 ); } int chan_open( int key ) { return chan_common_entry( CHAN_OPEN, key, NULL, 0 ); } int chan_shut( int key ) { return chan_common_entry( CHAN_SHUT, key, NULL, 0 ); } int chan_kill( int key ) { return chan_common_entry( CHAN_KILL, key, NULL, 0 ); } int chan_post( int key, char *buf, int len ) { return chan_common_entry( CHAN_POST, key, buf, len ); } int chan_pend( int key, char *buf, int len ) { return chan_common_entry( CHAN_PEND, key, buf, len ); } #endif