summaryrefslogtreecommitdiff
path: root/trans
diff options
context:
space:
mode:
Diffstat (limited to 'trans')
-rw-r--r--trans/fifo.c27
-rw-r--r--trans/firmlink.c9
-rw-r--r--trans/new-fifo.c27
-rw-r--r--trans/null.c9
-rw-r--r--trans/streamio.c36
5 files changed, 92 insertions, 16 deletions
diff --git a/trans/fifo.c b/trans/fifo.c
index b40a50d1..e6fbd0e9 100644
--- a/trans/fifo.c
+++ b/trans/fifo.c
@@ -405,10 +405,10 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
return the types that are then available. ID_TAG is returned as passed; it
is just for the convenience of the user in matching up reply messages with
specific requests sent. */
-error_t
-trivfs_S_io_select (struct trivfs_protid *cred,
- mach_port_t reply, mach_msg_type_name_t reply_type,
- int *select_type)
+static error_t
+io_select_common (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec *tsp, int *select_type)
{
struct pipe *pipe;
error_t err = 0;
@@ -466,11 +466,28 @@ trivfs_S_io_select (struct trivfs_protid *cred,
/* Wait for something to change. */
{
ports_interrupt_self_on_port_death (cred, reply);
- err = pipe_pair_select (pipe, pipe, select_type, 1);
+ err = pipe_pair_select (pipe, pipe, tsp, select_type, 1);
}
return err;
}
+
+error_t
+trivfs_S_io_select (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ int *select_type)
+{
+ return io_select_common (cred, reply, reply_type, NULL, select_type);
+}
+
+error_t
+trivfs_S_io_select_timeout (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec ts,
+ int *select_type)
+{
+ return io_select_common (cred, reply, reply_type, &ts, select_type);
+}
/* ---------------------------------------------------------------- */
diff --git a/trans/firmlink.c b/trans/firmlink.c
index 087e19d0..9c063c04 100644
--- a/trans/firmlink.c
+++ b/trans/firmlink.c
@@ -275,3 +275,12 @@ trivfs_S_io_select (struct trivfs_protid *cred,
{
return EOPNOTSUPP;
}
+
+error_t
+trivfs_S_io_select_timeout (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec ts,
+ int *type)
+{
+ return trivfs_S_io_select (cred, reply, reply_type, type);
+}
diff --git a/trans/new-fifo.c b/trans/new-fifo.c
index 5cc44b58..dc3cc79e 100644
--- a/trans/new-fifo.c
+++ b/trans/new-fifo.c
@@ -591,10 +591,10 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
return the types that are then available. ID_TAG is returned as passed; it
is just for the convenience of the user in matching up reply messages with
specific requests sent. */
-error_t
-trivfs_S_io_select (struct trivfs_protid *cred,
- mach_port_t reply, mach_msg_type_name_t reply_type,
- int *select_type)
+static error_t
+io_select_common (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec *tsp, int *select_type)
{
struct pipe *pipe;
error_t err = 0;
@@ -652,11 +652,28 @@ trivfs_S_io_select (struct trivfs_protid *cred,
/* Wait for something to change. */
{
ports_interrupt_self_on_port_death (cred, reply);
- err = pipe_pair_select (pipe, pipe, select_type, 1);
+ err = pipe_pair_select (pipe, pipe, tsp, select_type, 1);
}
return err;
}
+
+error_t
+trivfs_S_io_select (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ int *select_type)
+{
+ return io_select_common (cred, reply, reply_type, NULL, select_type);
+}
+
+error_t
+trivfs_S_io_select_timeout (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec ts,
+ int *select_type)
+{
+ return io_select_common (cred, reply, reply_type, &ts, select_type);
+}
/* ---------------------------------------------------------------- */
diff --git a/trans/null.c b/trans/null.c
index 9673a758..1f985b39 100644
--- a/trans/null.c
+++ b/trans/null.c
@@ -203,6 +203,15 @@ trivfs_S_io_select (struct trivfs_protid *cred,
*type &= ~SELECT_URG;
return 0;
}
+
+kern_return_t
+trivfs_S_io_select_timeout (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t replytype,
+ struct timespec ts,
+ int *type)
+{
+ return trivfs_S_io_select (cred, reply, replytype, type);
+}
/* Write data to an IO object. If offset is -1, write at the object
maintained file pointer. If the object is not seekable, offset is
diff --git a/trans/streamio.c b/trans/streamio.c
index 60b5d59c..8ff3dc63 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -538,12 +538,14 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
return ESPIPE;
}
-error_t
-trivfs_S_io_select (struct trivfs_protid *cred,
- mach_port_t reply, mach_msg_type_name_t reply_type,
- int *type)
+static error_t
+io_select_common (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec *tsp,
+ int *type)
{
int available;
+ error_t err;
if (!cred)
return EOPNOTSUPP;
@@ -583,16 +585,38 @@ trivfs_S_io_select (struct trivfs_protid *cred,
}
ports_interrupt_self_on_port_death (cred, reply);
- if (pthread_hurd_cond_wait_np (&select_alert, &global_lock))
+ err = pthread_hurd_cond_timedwait_np (&select_alert, &global_lock, tsp);
+ if (err)
{
*type = 0;
pthread_mutex_unlock (&global_lock);
- return EINTR;
+
+ if (err == ETIMEDOUT)
+ err = 0;
+
+ return err;
}
}
}
error_t
+trivfs_S_io_select (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ int *type)
+{
+ return io_select_common (cred, reply, reply_type, NULL, type);
+}
+
+error_t
+trivfs_S_io_select_timeout (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
+ struct timespec ts,
+ int *type)
+{
+ return io_select_common (cred, reply, reply_type, &ts, type);
+}
+
+error_t
trivfs_S_file_set_size (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
off_t size)