HEV OS2_create_event_semaphore (PSZ name, int sharedp) { HEV result; STD_API_CALL (dos_create_event_sem, (name, (&result), (sharedp ? DC_SEM_SHARED : 0), 0)); return (result); }
static Tchannel open_file (const char * filename, ULONG attr, ULONG flags, unsigned int mode) { HFILE handle; ULONG action; STD_API_CALL (dos_open, (((char *) filename), (&handle), (&action), 0, attr, flags, (OS2_OPEN_MODE (mode)), 0)); return (OS2_make_channel (handle, mode)); }
static ULONG set_file_pointer (Tchannel channel, ULONG type, LONG distance) { ULONG fp; if ((CHANNEL_TYPE (channel)) != channel_type_file) OS2_error_system_call (ERROR_INVALID_HANDLE, syscall_dos_set_file_ptr); STD_API_CALL (dos_set_file_ptr, ((CHANNEL_HANDLE (channel)), distance, type, (&fp))); return (fp); }
off_t OS_file_length (Tchannel channel) { FILESTATUS3 buffer; if ((CHANNEL_TYPE (channel)) != channel_type_file) OS2_error_system_call (ERROR_INVALID_HANDLE, syscall_dos_query_file_info); STD_API_CALL (dos_query_file_info, ((CHANNEL_HANDLE (channel)), FIL_STANDARD, (&buffer), (sizeof (buffer)))); return (buffer.cbFile); }
void OS_make_pipe (Tchannel * readerp, Tchannel * writerp) { HFILE hread; HFILE hwrite; STD_API_CALL (dos_create_pipe, ((&hread), (&hwrite), 4096)); transaction_begin (); OS2_handle_close_on_abort (hwrite); (*readerp) = (OS2_make_channel (hread, CHANNEL_READ)); transaction_commit (); transaction_begin (); OS_channel_close_on_abort (*readerp); (*writerp) = (OS2_make_channel (hwrite, CHANNEL_WRITE)); transaction_commit (); }
static void input_pipe_operator (Tchannel channel, chop_t operation, choparg_t arg1, choparg_t arg2, choparg_t arg3) { switch (operation) { case chop_read: OS2_channel_thread_read_op (channel, arg1, arg2, arg3); break; case chop_close: OS2_channel_thread_close (channel); STD_API_CALL (dos_close, (CHANNEL_HANDLE (channel))); break; default: OS2_logic_error ("Unknown operation for input pipe."); break; } }
void OS2_close_event_semaphore (HEV s) { STD_API_CALL (dos_close_event_sem, (s)); }
void OS2_release_mutex_semaphore (HMTX s) { STD_API_CALL (dos_release_mutex_sem, (s)); }
void OS2_close_mutex_semaphore (HMTX s) { STD_API_CALL (dos_close_mutex_sem, (s)); }