资源简介
QNX6源码不再开源,系统的资料相当少,要弄清系统结构,必须分析源代码,本代码是低版本的,但不影响原理的分析学习。
代码片段和文件信息
/*
* $QNXLicenseC:
* Copyright 2007 QNX Software Systems. All Rights Reserved.
*
* You must obtain a written license from and pay applicable license fees to QNX
* Software Systems before you may reproduce modify or distribute this software
* or any work that includes all or part of this software. Free development
* licenses are available for evaluation and non-commercial purposes. For more
* information visit http://licensing.qnx.com or email licensing@qnx.com.
*
* This file may contain contributions from others. Please review this entire
* file for other proprietary rights or license notices as well as the QNX
* Development Suite License Guide at http://licensing.qnx.com/license-guide/
* for other information.
* $
*/
#include
#include
#include “asyncmsg_priv.h“
/* This is painful. We have to prepare receive buf and associate
* it with the chid so we will know where to receive
*/
int asyncmsg_channel_create(unsigned flags mode_t mode size_t buffer_size unsigned max_num_buffer const struct sigevent *ev int (*recvbuf_callback)(size_t bufsize unsigned num_bufs void*bufs[] int flags))
{
struct _asyncmsg_channel_context *acc;
int chid;
if ((acc = (struct _asyncmsg_channel_context *)malloc(sizeof(*acc))) == NULL) {
return -1;
}
memset(acc 0 sizeof(*acc));
if ((errno = pthread_mutex_init(&acc->mutex 0)) != EOK) {
free(acc);
return -1;
}
acc->recvbuf_cb = recvbuf_callback;
acc->max_num_buffer = max_num_buffer;
acc->buffer_size = buffer_size;
if ((acc->iovs = malloc(sizeof(iov_t) * max_num_buffer)) == NULL) {
free(acc);
return -1;
}
if ((chid = ChannelCreateExt(flags | _NTO_CHF_ASYNC mode buffer_size max_num_buffer ev NULL)) == -1) {
pthread_mutex_destroy(&acc->mutex);
free(acc->iovs);
free(acc);
return -1;
}
if (_asyncmsg_handle(chid _ASYNCMSG_HANDLE_ADD | _ASYNCMSG_HANDLE_CHANNEL acc) == NULL) {
asyncmsg_channel_destroy(chid);
free(acc->iovs);
free(acc);
return -1;
}
return chid;
}
__SRCVERSION(“asyncmsg_channel_create.c $Rev: 153052 $“);
相关资源
- 网上花店管理系统 有数据库
- 饿了么源码 百度外卖源码 美团外卖
- DevComponents.DotNetBar2源码 VS2013全工程
- 木地板成品网站源码,自带论坛,产
- 在线考试系统源码完整版
- kinect控制ppt播放完整源码
- 企业网站源码企业网站源码企业网站
- NetCDF源码
- 中国象棋源码UCCI协议
- .net博客系统源码
- 一个SIP协议栈的实现源码
- 很好的幼儿园网站源码
- FreeRTOS V7.4.2(官方原版)
- SpringMvc自动任务调度之task实现项目源
- 网上商城项目源码
- vue 饿了吗vue源码
- 鲜花销售系统源码
- PCIE FPGA工程源码
- 一个美食网站的源码 包括前后台
- w5100打包整理原理图源码全套解决方案
- 合同管理系统源码+设计文档
- 15款Flash AS3.0游戏源码文件
- 房屋租赁管理系统源码 房屋租赁管理
- QT实现日志文件备份功能(源码
- 仿新浪抢工长装修招标网站源码老工
- 一个很好的WCF 架构ERP 项目源码
- .Net药店管理系统源码
- 一种有效的稀疏编码源码
- 2018年吉林省电子设计竞赛智能物流车
- 《x86汇编语言:从实模式到保护模式
评论
共有 条评论