summaryrefslogtreecommitdiffstats
path: root/auto-virtserial-guest.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-09-28 16:51:53 +0530
committerAmit Shah <amit.shah@redhat.com>2010-09-28 16:51:53 +0530
commitda4085786b76598d279996c8e6ee87d3fa6a8da1 (patch)
tree84fe02e95349d217efc797553ed188c49ae638c9 /auto-virtserial-guest.c
parentf3963acf119801118d585df35e8d51c0cd384f54 (diff)
downloadtest-virtserial-da4085786b76598d279996c8e6ee87d3fa6a8da1.tar.gz
test-virtserial-da4085786b76598d279996c8e6ee87d3fa6a8da1.tar.xz
test-virtserial-da4085786b76598d279996c8e6ee87d3fa6a8da1.zip
auto-test: Add test for lseek()
lseek() on console ports should fail with -ESPIPE. (This behaviour will be seen from kernel 2.6.37 onwards. Older kernels just returned success without seeking.) Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'auto-virtserial-guest.c')
-rw-r--r--auto-virtserial-guest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/auto-virtserial-guest.c b/auto-virtserial-guest.c
index 85d5758..9ceda19 100644
--- a/auto-virtserial-guest.c
+++ b/auto-virtserial-guest.c
@@ -252,6 +252,17 @@ static int close_port(int nr)
return ret;
}
+static int seek_port(int nr)
+{
+ int ret;
+
+ ret = lseek(g_open_fds[nr], 20, SEEK_SET);
+ if (ret < 0)
+ ret = -errno;
+
+ return ret;
+}
+
static int set_port_nonblocking(int val)
{
int ret, flags;
@@ -716,6 +727,9 @@ back_to_open:
case KEY_SHUTDOWN:
system("shutdown -h now");
break;
+ case KEY_LSEEK:
+ ret = seek_port(gpkt.value);
+ send_report(cfd, ret);
default:
send_report(cfd, -ERANGE);
break;