Add exclusive mode ioctls
This commit is contained in:
@@ -46,7 +46,7 @@ static struct ttynvt_param {
|
|||||||
int foreground;
|
int foreground;
|
||||||
} ttynvt_param;
|
} ttynvt_param;
|
||||||
|
|
||||||
typedef struct ttynvt {
|
typedef struct {
|
||||||
int nonblock;
|
int nonblock;
|
||||||
pthread_mutex_t tty_lock;
|
pthread_mutex_t tty_lock;
|
||||||
pthread_mutex_t poll_lock;
|
pthread_mutex_t poll_lock;
|
||||||
@@ -60,6 +60,7 @@ typedef struct ttynvt {
|
|||||||
|
|
||||||
struct termios tio;
|
struct termios tio;
|
||||||
unsigned char mcr;
|
unsigned char mcr;
|
||||||
|
char excl;
|
||||||
|
|
||||||
char buf[RX_BUF_SIZE];
|
char buf[RX_BUF_SIZE];
|
||||||
size_t blen;
|
size_t blen;
|
||||||
@@ -556,6 +557,10 @@ static const char *_ioctl_name(int cmd)
|
|||||||
CASE(TIOCMSET);
|
CASE(TIOCMSET);
|
||||||
CASE(TCSBRK);
|
CASE(TCSBRK);
|
||||||
CASE(TIOCGWINSZ);
|
CASE(TIOCGWINSZ);
|
||||||
|
/* Exclusive mode */
|
||||||
|
CASE(TIOCEXCL);
|
||||||
|
CASE(TIOCGEXCL);
|
||||||
|
CASE(TIOCNXCL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,6 +763,27 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TIOCEXCL:
|
||||||
|
if (tty->excl)
|
||||||
|
{
|
||||||
|
fuse_reply_err(req, EBUSY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tty->excl = 1;
|
||||||
|
fuse_reply_ioctl(req, 0, 0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TIOCGEXCL:
|
||||||
|
CHECK_BUF_OUT(sizeof(int));
|
||||||
|
val = tty->excl;
|
||||||
|
fuse_reply_ioctl(req, 0, &val, sizeof(int));
|
||||||
|
break;
|
||||||
|
case TIOCNXCL:
|
||||||
|
tty->excl = 0;
|
||||||
|
fuse_reply_ioctl(req, 0, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fuse_reply_err(req, ENOSYS);
|
fuse_reply_err(req, ENOSYS);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user