aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddennedy <ddennedy@53a565d1-3bb7-0310-b661-cf11e63c67ab>2006-04-09 02:13:44 +0000
committerddennedy <ddennedy@53a565d1-3bb7-0310-b661-cf11e63c67ab>2006-04-09 02:13:44 +0000
commit0b0ad6b10e1667571f97bd8f2e73b35359f4b5ef (patch)
tree18ddeac4eca78981927254785d4df1c8645b27a2
parent9c74e4a2956e38045b825e43e1a4b7ba1620dfc2 (diff)
downloadlibraw1394-0b0ad6b10e1667571f97bd8f2e73b35359f4b5ef.tar.gz
lock allocated isochronous packet tracking memory
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@163 53a565d1-3bb7-0310-b661-cf11e63c67ab
-rw-r--r--src/iso.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/iso.c b/src/iso.c
index 35fecb7..fc45063 100644
--- a/src/iso.c
+++ b/src/iso.c
@@ -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;
}