console: portability fixes
PATCH 1/1 console: portability fixes
Hi!
Attached patch adds portability fixes:
- Use openpty(), which does the same as the sequence
of open(), grantpt(), unlockpt(), ptsname(), tcgetattr()
=> simplifies code
- Check return code from tcsetattr()
- sprintf() -> snprintf()
- OpenBSD lacks POSIX grantpt() and unlockpt()
=> requires use of openpty()
- Solaris lacks POSIX openpty() via feedback from SUN (John Levon) => implement openpty() for Solaris, tested and ok'd by SUN (John Levon)
Signed-off-by Christoph Egger <[email protected]>
Signature · 12 lines
AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
config/StdGNU.mk +1 -0
@@ -21,6 +21,7 @@ LIB64DIR = lib64 SOCKET_LIBS = CURSES_LIBS = -lncurses +UTIL_LIBS = -lutil SONAME_LDFLAG = -soname SHLIB_CFLAGS = -shared
config/SunOS.mk +1 -0
@@ -22,6 +22,7 @@ LIB64DIR = lib/amd64 SOCKET_LIBS = -lsocket CURSES_LIBS = -lcurses +UTIL_LIBS = SONAME_LDFLAG = -h SHLIB_CFLAGS = -R /usr/sfw/$(LIBDIR) -shared
tools/console/Makefile +2 -2
@@ -22,11 +22,11 @@ clean: xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \ - $(SOCKET_LIBS) -lxenctrl -lxenstore + $(UTIL_LIBS) $(SOCKET_LIBS) -lxenctrl -lxenstore xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c)) $(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \ - $(SOCKET_LIBS) -lxenctrl -lxenstore + $(UTIL_LIBS) $(SOCKET_LIBS) -lxenctrl -lxenstore .PHONY: install install: $(BIN)
tools/console/daemon/io.c +101 -51
194 lines not on this page · raw message
tools/console/daemon/utils.c +1 -1
@@ -96,7 +96,7 @@ void daemonize(const char *pidfile)exit (1 ); } - len =sprintf (buf,"%ld\n" , (long )getpid ()); + len =snprintf (buf,sizeof (buf),"%ld\n" , (long )getpid ());if (write (fd, buf, len) <0 )exit (1 );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel