From: Rich Felker Date: Sun, 6 May 2012 13:03:19 +0000 (-0400) Subject: add isastream (obsolete STREAMS junk) X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=106e75f7121b009c069733dcb8a70fe5e4380ab0;hp=98c9af500125df41fdb46d7e384b00982d72493a add isastream (obsolete STREAMS junk) apparently some packages see stropts.h and want to be able to use this. the implementation checks that the file descriptor is valid by using fcntl/F_GETFD so it can report an error if not (as specified). --- diff --git a/include/stropts.h b/include/stropts.h index 36d84bbb..c99c922e 100644 --- a/include/stropts.h +++ b/include/stropts.h @@ -129,7 +129,8 @@ struct str_list { struct str_mlist *sl_modlist; }; -int ioctl (int, int, ...); +int isastream(int); +int ioctl(int, int, ...); #ifdef __cplusplus } diff --git a/src/misc/isastream.c b/src/misc/isastream.c new file mode 100644 index 00000000..4dafdb08 --- /dev/null +++ b/src/misc/isastream.c @@ -0,0 +1,7 @@ +#include +#include + +int isastream(int fd) +{ + return fcntl(fd, F_GETFD) < 0 ? -1 : 0; +}