Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: fusl/src/misc/pty.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/misc/ptsname.c ('k') | fusl/src/misc/realpath.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <stdlib.h>
2 #include <sys/ioctl.h>
3 #include <stdio.h>
4 #include <fcntl.h>
5 #include <errno.h>
6 #include "libc.h"
7 #include "syscall.h"
8
9 int posix_openpt(int flags)
10 {
11 return open("/dev/ptmx", flags);
12 }
13
14 int grantpt(int fd)
15 {
16 return 0;
17 }
18
19 int unlockpt(int fd)
20 {
21 int unlock = 0;
22 return ioctl(fd, TIOCSPTLCK, &unlock);
23 }
24
25 int __ptsname_r(int fd, char *buf, size_t len)
26 {
27 int pty, err;
28 if (!buf) len = 0;
29 if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return -err;
30 if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE;
31 return 0;
32 }
33
34 weak_alias(__ptsname_r, ptsname_r);
OLDNEW
« no previous file with comments | « fusl/src/misc/ptsname.c ('k') | fusl/src/misc/realpath.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698