-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathndelay.c
46 lines (40 loc) · 870 Bytes
/
ndelay.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* $Log: ndelay.c,v $
* Revision 1.5 2023-01-02 20:33:25+05:30 Cprogrammer
* added ndelay() function to get status of DELAY flag for descriptor
*
* Revision 1.4 2022-10-18 20:00:50+05:30 Cprogrammer
* converted proto to ansic
*
* Revision 1.3 2004-10-22 20:27:39+05:30 Cprogrammer
* added RCS id
*
* Revision 1.2 2004-07-17 21:19:52+05:30 Cprogrammer
* added RCS log
*
*/
#include <sys/types.h>
#include <fcntl.h>
#include "ndelay.h"
#ifndef O_NONBLOCK
#define O_NONBLOCK O_NDELAY
#endif
int
ndelay_on(int fd)
{
return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
}
int
ndelay(int fd)
{
int i;
if ((i = fcntl(fd, F_GETFL, 0)) == -1)
return -1;
return i & O_NONBLOCK ? 1 : 0;
}
void
getversion_ndelay_c()
{
static char *x = "$Id: ndelay.c,v 1.5 2023-01-02 20:33:25+05:30 Cprogrammer Exp mbhangui $";
x++;
}