forked from omniti-labs/omnios-build
-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
158 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
diff -wpruN --no-dereference '--exclude=*.orig' a~/misc.c a/misc.c | ||
--- a~/misc.c 1970-01-01 00:00:00 | ||
+++ a/misc.c 1970-01-01 00:00:00 | ||
@@ -37,6 +37,9 @@ | ||
#include <stdint.h> | ||
#include <string.h> | ||
#include <stdbool.h> | ||
+#ifdef __sun | ||
+#include <stdlib.h> /* fdwalk() declaration */ | ||
+#endif | ||
|
||
#include "screen.h" | ||
|
||
@@ -150,6 +153,26 @@ void Kill(pid_t pid, int sig) | ||
(void)kill(pid, sig); | ||
} | ||
|
||
+#ifdef __sun | ||
+ | ||
+static int closeallfiles_cb(void *arg, int fd) | ||
+{ | ||
+ const int except = (int)(uintptr_t)arg; | ||
+ | ||
+ if (fd >= 3 && fd != except) | ||
+ return (close(fd)); | ||
+ | ||
+ return (0); | ||
+} | ||
+ | ||
+void closeallfiles(int except) | ||
+{ | ||
+ if (fdwalk(closeallfiles_cb, (void *)(uintptr_t)except) != 0) | ||
+ Panic(errno, "fdwalk"); | ||
+} | ||
+ | ||
+#else | ||
+ | ||
void closeallfiles(int except) | ||
{ | ||
struct pollfd pfd[1024]; | ||
@@ -178,6 +201,8 @@ void closeallfiles(int except) | ||
} | ||
} | ||
|
||
+#endif /* __sun */ | ||
+ | ||
/* | ||
* Security - switch to real uid | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff -wpruN --no-dereference '--exclude=*.orig' a~/tty.c a/tty.c | ||
--- a~/tty.c 1970-01-01 00:00:00 | ||
+++ a/tty.c 1970-01-01 00:00:00 | ||
@@ -802,6 +802,7 @@ static void consredir_readev_fn(Event * | ||
|
||
int TtyGrabConsole(int fd, bool on, char *rc_name) | ||
{ | ||
+#if defined(SRIOCSREDIR) || defined(TIOCCONS) | ||
Display *d; | ||
#ifdef SRIOCSREDIR | ||
int cfd; | ||
@@ -881,6 +882,10 @@ int TtyGrabConsole(int fd, bool on, char | ||
consredir_ev.handler = consredir_readev_fn; | ||
evenq(&consredir_ev); | ||
return 0; | ||
+#else | ||
+ Msg(0, "Grabbing console not supported"); | ||
+ return -1; | ||
+#endif | ||
} | ||
|
||
/* |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Pending https://www.illumos.org/issues/5386 | ||
|
||
diff -wpruN --no-dereference '--exclude=*.orig' a~/pty.c a/pty.c | ||
--- a~/pty.c 1970-01-01 00:00:00 | ||
+++ a/pty.c 1970-01-01 00:00:00 | ||
@@ -46,6 +46,56 @@ | ||
|
||
int pty_preopen = 0; | ||
|
||
+#ifdef __illumos__ | ||
+#include <sys/stropts.h> | ||
+ | ||
+static int | ||
+openpty_failure(int c, int s, int e) | ||
+{ | ||
+ if (s >= 0) | ||
+ (void) close(s); | ||
+ if (c >= 0) | ||
+ (void) close(c); | ||
+ errno = e; | ||
+ return (-1); | ||
+} | ||
+ | ||
+static int | ||
+openpty(int *controlp, int *subordp, char *name, const struct termios *termp, | ||
+ const struct winsize *winp) | ||
+{ | ||
+ int c = -1; | ||
+ int s = -1; | ||
+ char *sname; | ||
+ | ||
+ if ((c = posix_openpt(O_RDWR | O_NOCTTY)) < 0) | ||
+ return (-1); | ||
+ if (grantpt(c) < 0 || unlockpt(c) < 0) | ||
+ return (openpty_failure(c, s, errno)); | ||
+ if ((sname = ptsname(c)) == NULL || | ||
+ (s = open(sname, O_RDWR | O_NOCTTY)) < 0) { | ||
+ return (openpty_failure(c, s, errno)); | ||
+ } | ||
+ | ||
+ if (ioctl(s, __I_PUSH_NOCTTY, "ptem") < 0 || | ||
+ ioctl(s, __I_PUSH_NOCTTY, "ldterm") < 0) { | ||
+ return (openpty_failure(c, s, errno)); | ||
+ } | ||
+ | ||
+ if (termp != NULL && tcsetattr(s, TCSAFLUSH, termp) != 0) | ||
+ return (openpty_failure(c, s, errno)); | ||
+ if (winp != NULL && ioctl(s, TIOCSWINSZ, winp) != 0) | ||
+ return (openpty_failure(c, s, errno)); | ||
+ | ||
+ if (name != NULL) | ||
+ strcpy(name, sname); | ||
+ | ||
+ *controlp = c; | ||
+ *subordp = s; | ||
+ return (0); | ||
+} | ||
+#endif | ||
+ | ||
/***************************************************************/ | ||
|
||
int OpenPTY(char **ttyn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Makefile.in.patch | ||
ncurses.patch | ||
unneededlibs.patch | ||
openpty.patch | ||
grabconsole.patch | ||
closefiles.patch | ||
gcc14.patch |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters