mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 03:41:04 +00:00
Close file descriptors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17602 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
20a61890e5
commit
e45bf12265
6 changed files with 333 additions and 1 deletions
46
ANNOUNCE
Normal file
46
ANNOUNCE
Normal file
|
@ -0,0 +1,46 @@
|
|||
ANNOUNCE
|
||||
********
|
||||
|
||||
This is version 0.8.9 of the GNUstep GUI Backend (`gnustep-back').
|
||||
|
||||
What is the GNUstep GUI Backend?
|
||||
================================
|
||||
|
||||
It is a back-end component for the GNUstep GUI Library. The
|
||||
implementation of the GNUstep GUI Library is designed in two parts. The
|
||||
first part is the front-end component which is independent of platform
|
||||
and display system. This front-end is combined with a back-end
|
||||
component which handles all of the display system dependent such as
|
||||
specific calls to the X Window System. This design allows the GNUstep
|
||||
applications to have the "look and feel" of the underlying display
|
||||
system without any changes to the application, and the library can be
|
||||
easily ported to other display systems.
|
||||
|
||||
The GNUstep GUI Backend is for platforms using the X-Window System or
|
||||
Window's Systems. It works via a DPS emulation engine to emulate the
|
||||
DPS functions required by the front-end system.
|
||||
|
||||
Noteworthy changes in version `0.8.9'
|
||||
=====================================
|
||||
|
||||
* Much improved pasting support between X apps and GNUstep apps.
|
||||
|
||||
* Backend headers are no longer installed (now private).
|
||||
|
||||
Where can you get it? How can you compile it?
|
||||
==============================================
|
||||
|
||||
The gstep-back-0.8.9.tar.gz distribution file has been placed on
|
||||
`ftp.gnustep.org' in `pub/gnustep/core'.
|
||||
|
||||
Where do I send bug reports?
|
||||
============================
|
||||
|
||||
Bug reports can be sent to the GNUstep bug list <bug-gnustep@gnu.org>
|
||||
|
||||
Obtaining GNU Software
|
||||
======================
|
||||
|
||||
Check out the GNUstep web site. (<http://www.gnustep.org/>) and the
|
||||
GNU web site. (<http://www.gnu.org/>)
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
2003-08-31 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Tools/gpbs.m (init): Close file descriptors so gpbs can be a proper
|
||||
daemon.
|
||||
|
||||
2003-08-26 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 0.8.9
|
||||
|
|
65
INSTALL
Normal file
65
INSTALL
Normal file
|
@ -0,0 +1,65 @@
|
|||
Installation
|
||||
************
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This file documents the installation of the GNUstep Backend Library,
|
||||
`gnustep-back'. If you are installing this package as part of the
|
||||
GNUstep core package, read the file GNUstep-HOWTO for more complete
|
||||
instructions on how to install the entire GNUstep package (including
|
||||
this library). GNUstep-HOWTO is located at <http://www.gnustep.org>
|
||||
|
||||
You must have installed gnustep-gui before installing this library.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Configuration is performed by running the `configure' program at a
|
||||
shell prompt. You may want to use some of the optional arguments to the
|
||||
`configure' program. Type `configure --help' for a list. GNUstep
|
||||
specific options are at the end of this list (if any).
|
||||
|
||||
The backend comes with several different window server and graphics
|
||||
drawing implementations. If you do nothing, the default ones will be
|
||||
chosen. You can can change this using configure. For instance, to
|
||||
choose the art graphical drawing implementation, run
|
||||
|
||||
configure --enable-graphics=art
|
||||
|
||||
Type `configure --help' for a list of graphical drawing
|
||||
implementations.
|
||||
|
||||
You can also change the name of the backend when configuring it.
|
||||
This is convienient if you want to have a different backend with
|
||||
different configurations. For instance, to create an xlib and and art
|
||||
backend, you could do this:
|
||||
|
||||
configure --enable-graphics=xlib --with-name=xlib
|
||||
make install
|
||||
|
||||
make distclean
|
||||
configure --enable-graphics=art --with-name=art
|
||||
make install
|
||||
|
||||
Before running an application, choose one backend using the defaults
|
||||
program:
|
||||
|
||||
defaults write NSGlobalDomain GSBackend libgnustep-xlib
|
||||
|
||||
Compilation
|
||||
===========
|
||||
|
||||
To compile this library, type make. After this is complete, type make
|
||||
install (make sure you are the root user). Some additional options you
|
||||
can use with make are `debug=yes' to make a debugging version of the
|
||||
library and `shared=no' to make a static version of the library. See
|
||||
the gstep-make package for more information on these options.
|
||||
|
||||
Installing
|
||||
==========
|
||||
|
||||
To install, type
|
||||
|
||||
make install
|
||||
|
83
NEWS
Normal file
83
NEWS
Normal file
|
@ -0,0 +1,83 @@
|
|||
NEWS
|
||||
****
|
||||
|
||||
Noteworthy changes in version `0.8.9'
|
||||
=====================================
|
||||
|
||||
* Much improved pasting support between X apps and GNUstep apps.
|
||||
|
||||
* Backend headers are no longer installed (now private).
|
||||
|
||||
Noteworthy changes in version `0.8.8'
|
||||
=====================================
|
||||
|
||||
Full multi-byte/unicode support for East Asian languages was added to
|
||||
the xlib backend. The X11 server now supports use of the XIM input
|
||||
method for entering non-keyboard characters. Both contributions thanks
|
||||
to Kazunobu Kuriyama.
|
||||
|
||||
* Also added slightly better EWMH support.
|
||||
|
||||
* Art backend works with more versions of freetype.
|
||||
|
||||
Noteworthy changes in version `0.8.7'
|
||||
=====================================
|
||||
|
||||
Handle NSBezierPath glyph drawing in art backend. art backend
|
||||
compiles with all freetype except 2.1.3 via ifdefs.
|
||||
|
||||
Noteworthy changes in version `0.8.6'
|
||||
=====================================
|
||||
|
||||
Bug fixes. See the gnustep-gui NEWS for changes.
|
||||
|
||||
Noteworthy changes in version `0.8.5'
|
||||
=====================================
|
||||
|
||||
Text system improvements. See the gnustep-gui NEWS for changes.
|
||||
|
||||
Noteworthy changes in version `0.8.3'
|
||||
=====================================
|
||||
|
||||
See the gnustep-gui NEWS for changes.
|
||||
|
||||
Noteworthy changes in version `0.8.2'
|
||||
=====================================
|
||||
|
||||
Improved font handling in art backend. Improved compositing with
|
||||
transformations and clipping in art backend.
|
||||
|
||||
Noteworthy changes in version `0.8.1'
|
||||
=====================================
|
||||
|
||||
art (libart-based) backend added. Use ./configure
|
||||
-enable-graphics=art to choose this backend.
|
||||
|
||||
Noteworthy changes in version `0.8.0'
|
||||
=====================================
|
||||
|
||||
Bug fixes.
|
||||
|
||||
Noteworthy changes in version `0.7.9'
|
||||
=====================================
|
||||
|
||||
Bug fixes.
|
||||
|
||||
Noteworthy changes in version `0.7.8'
|
||||
=====================================
|
||||
|
||||
Simplified backend selection using -enable-server and
|
||||
-enable-graphics. Add -with-library-flags and -with-include-flags for
|
||||
adding additonal flags. Set name with -with-name
|
||||
|
||||
Noteworthy changes in version `0.7.7'
|
||||
=====================================
|
||||
|
||||
First release. Most components extracted from xgps. The old backends,
|
||||
xgps and xdps were depreciated in favor of this new backend, simply
|
||||
named back, which can be configured for a variety of window server and
|
||||
graphics implementations, and also allow for improved code sharing.
|
||||
|
||||
In addition there is now a window server backend for Windows
|
||||
computers, although it is in a very alpha state.
|
||||
|
24
README
Normal file
24
README
Normal file
|
@ -0,0 +1,24 @@
|
|||
README
|
||||
******
|
||||
|
||||
This is version 0.8.9 of the GNUstep GUI Backend (`gnustep-back').
|
||||
|
||||
Here is some introductory info to get you started:
|
||||
|
||||
Initial reading
|
||||
===============
|
||||
|
||||
* The file `ANNOUNCE' contains a very brief overview of the library.
|
||||
It also tells you where to get the most recent version.
|
||||
|
||||
* The file `NEWS' has the library's feature history.
|
||||
|
||||
* The file `INSTALL' gives instructions for installing the library.
|
||||
|
||||
How can you help?
|
||||
=================
|
||||
|
||||
* Give us feedback! Tell us what you like; tell us what you think
|
||||
could be better. Send us bug reports at <bug-gnustep@gnu.org>.
|
||||
|
||||
|
111
Tools/gpbs.m
111
Tools/gpbs.m
|
@ -26,6 +26,11 @@
|
|||
#include <AppKit/NSPasteboard.h>
|
||||
#include <GNUstepGUI/GSPasteboardServer.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -37,6 +42,66 @@
|
|||
#define NSIG 32
|
||||
#endif
|
||||
|
||||
static int is_daemon = 0; /* Currently running as daemon. */
|
||||
static char ebuf[2048];
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
|
||||
static int log_priority;
|
||||
|
||||
static void
|
||||
gpbs_log (int prio)
|
||||
{
|
||||
if (is_daemon)
|
||||
{
|
||||
syslog (log_priority | prio, ebuf);
|
||||
}
|
||||
else if (prio == LOG_INFO)
|
||||
{
|
||||
write (1, ebuf, strlen (ebuf));
|
||||
write (1, "\n", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
write (2, ebuf, strlen (ebuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
if (prio == LOG_CRIT)
|
||||
{
|
||||
if (is_daemon)
|
||||
{
|
||||
syslog (LOG_CRIT, "exiting.");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
#define LOG_CRIT 2
|
||||
#define LOG_DEBUG 0
|
||||
#define LOG_ERR 1
|
||||
#define LOG_INFO 0
|
||||
#define LOG_WARNING 0
|
||||
void
|
||||
gpbs_log (int prio)
|
||||
{
|
||||
write (2, ebuf, strlen (ebuf));
|
||||
write (2, "\n", 1);
|
||||
if (prio == LOG_CRIT)
|
||||
{
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@class PasteboardServer;
|
||||
@class PasteboardObject;
|
||||
|
||||
|
@ -1047,8 +1112,9 @@ ihandler(int sig)
|
|||
static void
|
||||
init(int argc, char** argv)
|
||||
{
|
||||
NSUserDefaults *defs;
|
||||
NSArray *args = [[NSProcessInfo processInfo] arguments];
|
||||
unsigned count;
|
||||
unsigned count, c;
|
||||
|
||||
for (count = 1; count < [args count]; count++)
|
||||
{
|
||||
|
@ -1122,6 +1188,7 @@ init(int argc, char** argv)
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
#else
|
||||
is_daemon = 1;
|
||||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
|
@ -1148,6 +1215,48 @@ init(int argc, char** argv)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure we don't have any open file descriptors which may refer
|
||||
* to sockets bound to ports we may try to use.
|
||||
*
|
||||
* Use '/dev/null' for stdin and stdout.
|
||||
*/
|
||||
for (c = 0; c < FD_SETSIZE; c++)
|
||||
{
|
||||
if (is_daemon || (c != 2))
|
||||
{
|
||||
(void)close(c);
|
||||
}
|
||||
}
|
||||
if (open("/dev/null", O_RDONLY) != 0)
|
||||
{
|
||||
sprintf(ebuf, "failed to open stdin from /dev/null (%s)\n",
|
||||
strerror(errno));
|
||||
gpbs_log(LOG_CRIT);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (open("/dev/null", O_WRONLY) != 1)
|
||||
{
|
||||
sprintf(ebuf, "failed to open stdout from /dev/null (%s)\n",
|
||||
strerror(errno));
|
||||
gpbs_log(LOG_CRIT);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (is_daemon && open("/dev/null", O_WRONLY) != 2)
|
||||
{
|
||||
sprintf(ebuf, "failed to open stderr from /dev/null (%s)\n",
|
||||
strerror(errno));
|
||||
gpbs_log(LOG_CRIT);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make gpbs logging go to syslog unless overridden by user.
|
||||
*/
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"YES", @"GSLogSyslog", nil]];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue