Mercurial > hg > toybox
comparison lib/portability.c @ 1564:685a0da6ca59 draft
probe for getspnam(), forkpty(), utmpx, replace sethostname()
Android is missing all of these; we need to probe for some so we have
a config symbol to depend on.
sethostname() is easily replaced.
We got termios.h via pty.h; now it's not included in configure-step tools,
so we need termios.h to generate globals.
author | Isaac Dunham <ibid.ag@gmail.com> |
---|---|
date | Wed, 19 Nov 2014 16:38:46 -0600 |
parents | 786841fdb1e0 |
children | 272bd62cb194 |
comparison
equal
deleted
inserted
replaced
1563:3d32f9523584 | 1564:685a0da6ca59 |
---|---|
3 * Copyright 2012 Rob Landley <rob@landley.net> | 3 * Copyright 2012 Rob Landley <rob@landley.net> |
4 * Copyright 2012 Georgi Chorbadzhiyski <gf@unixsol.org> | 4 * Copyright 2012 Georgi Chorbadzhiyski <gf@unixsol.org> |
5 */ | 5 */ |
6 | 6 |
7 #include "toys.h" | 7 #include "toys.h" |
8 #if defined(__ANDROID__) | |
9 #include <asm/unistd.h> | |
10 #endif | |
8 | 11 |
9 #if defined(__APPLE__) || defined(__ANDROID__) | 12 #if defined(__APPLE__) || defined(__ANDROID__) |
10 ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream) | 13 ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream) |
11 { | 14 { |
12 int ch; | 15 int ch; |
59 { | 62 { |
60 return getdelim(linep, np, '\n', stream); | 63 return getdelim(linep, np, '\n', stream); |
61 } | 64 } |
62 #endif | 65 #endif |
63 | 66 |
67 #if defined(__ANDROID__) | |
68 int sethostname(const char *name, size_t len) | |
69 { | |
70 return syscall(__NR_sethostname, name, len); | |
71 } | |
72 #endif | |
73 | |
64 #if defined(__APPLE__) | 74 #if defined(__APPLE__) |
65 extern char **environ; | 75 extern char **environ; |
66 | 76 |
67 int clearenv(void) | 77 int clearenv(void) |
68 { | 78 { |