Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15368691
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2009-11-19 11:19:09

// 在内核中发起系统调用,执行本应用户空间发起调用的fops函数集,完成参数设置任务[luther.gliethttp]
int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
             unsigned int cmd, void *arg)
{
    mm_segment_t fs;
    int result;
// get_fs()和set_fs()位于include/asm-generic/uaccess.h 《浅析get_fs()和set_fs()设置user用户空间所能访问的最大虚拟地址》
    fs = snd_enter_user(); // 设置fs的addr_limit最大可访问地址为0xffffffff,而非原来正常的0xc0000000, 应用程序所能访问的最大虚拟地址[luther.gliethttp]
    switch (substream->stream) {
    case SNDRV_PCM_STREAM_PLAYBACK:
        result = snd_pcm_playback_ioctl1(NULL, substream, cmd,
                         (void __user *)arg); // 执行用户空间的放音ioctl
        break;
    case SNDRV_PCM_STREAM_CAPTURE:
        result = snd_pcm_capture_ioctl1(NULL, substream, cmd,
                        (void __user *)arg);  // 执行用户空间的录音ioctl
        break;
    default:
        result = -EINVAL;
        break;
    }
    snd_leave_user(fs); // 恢复到user用户空间
    return result;
}
阅读(1641) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~