From: Jeffrey Walton <noloader@gmail.com>
To: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: undefined reference to `ioctl_tty'
Date: Wed, 6 Mar 2019 01:58:41 -0500 [thread overview]
Message-ID: <CAH8yC8k5nG4A0OVTwY9rhyQP=mJ1CS2rYBnUrUBm2BBAw4aOsw@mail.gmail.com> (raw)
Hi Everyone,
I'm working from http://man7.org/linux/man-pages/man4/tty_ioctl.4.html
. According to the man page:
TIOCEXCL void
Put the terminal into exclusive mode. No further open(2)
operations on the terminal are permitted. (They fail with
EBUSY, except for a process with the CAP_SYS_ADMIN
capability.)
The page goes on to say in the colophon it is part of the 4.16 kernel.
I am running on the 4.20 kernel:
$ uname -a
Linux silo 4.20.13-200.fc29.x86_64 #1 ... GNU/Linux
However:
gcc -D_GNU_SOURCE -g2 -std=gnu99 test.c -o tttt -lrt
test.c: In function ‘main’:
test.c:11:7: warning: implicit declaration of function ‘ioctl_tty’;
did you mean ‘ioctl’? [-Wimplicit-function-declaration]
if (ioctl_tty(1 /*STDOUT_FILENO*/, TIOCEXCL, NULL) == -1) {
^~~~~~~~~
ioctl
/usr/bin/ld: /tmp/ccCNNyG3.o: in function `main':
/home/test/test.c:11: undefined reference to `ioctl_tty'
collect2: error: ld returned 1 exit status
Search is producing a lot of non-relevant hits.
Any ideas why I can't find ioctl_tty during link when using a 4.20 kernel?
Thanks in advance.
----------
$ cat test.c
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>
int main(int argc, char* argv[])
{
if (ioctl_tty(1 /*STDOUT_FILENO*/, TIOCEXCL, NULL) == -1) {
fprintf(stderr, "%s\n", strerror(errno));
return 1;
}
return 0;
}
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2019-03-06 7:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 6:58 Jeffrey Walton [this message]
[not found] ` <CAJ1xhMXLdhsj4R8MmbR1WkbO7wBV+gJdeJW+XH+7ONV3WkNHNw@mail.gmail.com>
2019-03-06 7:31 ` Fwd: undefined reference to `ioctl_tty' Alexander Kapshuk
2019-03-06 7:41 ` Jeffrey Walton
2019-03-06 8:36 ` valdis.kletnieks
2019-03-06 8:50 ` Jeffrey Walton
2019-03-07 8:59 ` valdis.kletnieks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH8yC8k5nG4A0OVTwY9rhyQP=mJ1CS2rYBnUrUBm2BBAw4aOsw@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).