diff options
| author | 2006-04-09 02:13:44 +0000 | |
|---|---|---|
| committer | 2006-04-09 02:13:44 +0000 | |
| commit | 0b0ad6b10e1667571f97bd8f2e73b35359f4b5ef (patch) | |
| tree | 18ddeac4eca78981927254785d4df1c8645b27a2 /src | |
| parent | remove memory allocations for isochronous operations from the libraw1394 even... (diff) | |
lock allocated isochronous packet tracking memory
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@163 53a565d1-3bb7-0310-b661-cf11e63c67ab
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -105,6 +105,7 @@ static int do_iso_init(raw1394handle_t handle, int cmd) { unsigned int stride; + int result; /* already initialized? */ if(handle->iso_mode != ISO_INACTIVE) @@ -159,7 +160,16 @@ static int do_iso_init(raw1394handle_t handle, ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0); return -1; } - +#if _POSIX_MEMLOCK > 0 + result = mlock(handle->iso_packet_infos, buf_packets * sizeof(struct raw1394_iso_packet_info)); + /* Ignore a permission error - app is responsible for that, */ + if (result < 0 && result != -EPERM) { + munmap(handle->iso_buffer, handle->iso_status.config.data_buf_size); + handle->iso_buffer = NULL; + ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0); + return -1; + } +#endif return 0; } @@ -464,6 +474,11 @@ void raw1394_iso_shutdown(raw1394handle_t handle) } if(handle->iso_packet_infos) { +#if _POSIX_MEMLOCK > 0 + munlock(handle->iso_packet_infos, + handle->iso_status.config.buf_packets * + sizeof(struct raw1394_iso_packet_info)); +#endif free(handle->iso_packet_infos); handle->iso_packet_infos = NULL; } |
