示例#1
0
struct ibv_context *ibv_open_device(struct ibv_device *dev)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for begin of ibv_open_device\n");

  struct ibv_context * user_copy = _open_device(dev);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return user_copy;
}
示例#2
0
int serial_start(struct serialsosurce *ss)
{
	int ret;
	ret = _open_device(ss, "/dev/ttyUSB0");
	assert(ret == 0);
	
	ret = _set_device(ss, 9600, '7', 'E', '1');
	assert(ret == 0);
	
	pthread_t tid_serial;
	ret = pthread_create(&tid_serial, NULL, thread_serialcomm, (void *)ss);
	assert(ret == 0);

	ss->tid_serial = tid_serial;
	
	return 0;
}
示例#3
0
static void sound_daemon(int _pipe_read)
/* sound server main loop */
{
    int n;

    n = _open_device();

    if (n) {
        /* non-blocking mode */
        n = 1;
        ioctl(_pipe_read, FIONBIO, &n);
    }

    /* no sounds */
    memset(_sounds, '\0', sizeof(_sounds));

    for (;;) {
        if ((n =
             read(_pipe_read, msg + _msg_offset,
                  sizeof(msg) - _msg_offset)) <= 0) {
            if (errno != EWOULDBLOCK)
                break;
        }
        else {
            msg[n + _msg_offset] = '\0';

            if (!parse_sound_cmd(_pipe_read, msg))
                break;
        }

        if (_daemon_seq != -1)
            sound_mix();
    }

    if (_audio_fd != -1)
        close(_audio_fd);

    close(_pipe_read);

    exit(0);
}
示例#4
0
文件: audio_out.c 项目: Illius/libao
ao_device *ao_open_file (int driver_id, const char *filename, int overwrite,
             ao_sample_format *format, ao_option *options)
{
    FILE *file;
    ao_device *device;

    if (strcmp("-", filename) == 0)
        file = stdout;
    else {

        if (!overwrite) {
            /* Test for file existence */
            file = fopen(filename, "r");
            if (file != NULL) {
                fclose(file);
                errno = AO_EFILEEXISTS;
                return NULL;
            }
        }


        file = fopen(filename, "w");
    }


    if (file == NULL) {
        errno = AO_EOPENFILE;
        return NULL;
    }

    device = _open_device(driver_id, format, options, file);

    if (device == NULL) {
        fclose(file);
        /* errno already set by _open_device() */
        return NULL;
    }

    return device;
}
示例#5
0
文件: audio_out.c 项目: Illius/libao
ao_device *ao_open_live (int driver_id, ao_sample_format *format,
            ao_option *options)
{
    return _open_device(driver_id, format, options, NULL);
}