![]() |
|
|||
0001 /* 0002 * Copyright © 2018 Alexey Dobriyan <adobriyan@gmail.com> 0003 * 0004 * Permission to use, copy, modify, and distribute this software for any 0005 * purpose with or without fee is hereby granted, provided that the above 0006 * copyright notice and this permission notice appear in all copies. 0007 * 0008 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 0009 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 0010 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 0011 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 0012 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 0013 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 0014 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 0015 */ 0016 #include <sys/types.h> 0017 #include <sys/stat.h> 0018 #include <fcntl.h> 0019 #include <errno.h> 0020 #include <unistd.h> 0021 0022 int main(void) 0023 { 0024 char buf[64]; 0025 int fd; 0026 0027 fd = open("/proc/self/wchan", O_RDONLY); 0028 if (fd == -1) { 0029 if (errno == ENOENT) 0030 return 4; 0031 return 1; 0032 } 0033 0034 buf[0] = '\0'; 0035 if (read(fd, buf, sizeof(buf)) != 1) 0036 return 1; 0037 if (buf[0] != '0') 0038 return 1; 0039 return 0; 0040 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |