PfAttachServerDll()

Load a font server

Synopsis:

#include <font_api.h>

int PfAttachServerDll( fontdll_t dll,
                       int prio,
                       char const *device  );

Arguments:

dll
A font server context, returned by PfAttachLocalDll().
prio
The suggested priority at which to run the font processing thread. If this value is set to -1, the function uses the current process priority.
device
The /dev device path of the font server to attach to (e.g. /dev/bob).

Library:

font

Description:

This function loads a local font server thread for the provided dll context. The function attempts to attach a resource manager server thread, which attaches all relevant device names. This is useful only if no external server is running, and you want this application to function as the default font server. The application must have an effective user ID of root in order for this approach to succeed.

Since this behaviour encorporates handling of dynamic font loading, this routine will return an error if a sleuth thread is already in service. That is, if the application has already successfully called PfAttachSleuthMonitorDll(), PfAttachServerDll() will fail, and vice versa.


Note: This routine overwrites the local PHFONT environment variable if the device parameter is not NULL.

If the resource manager registers the default font server device (which is the same as the global PHFONT environment variable) successfully, the application should register a SIGUSR2 signal handler. In some instances of dynamic font loading, the application is signalled by SIGUSR2 to request a restart of the server thread. The application should handle the request, then at the next available time, invoke the function PfRestartServerDll(). Otherwise, the application should block the SIGUSR2 signal if you do not wish it to honor such requests.

If the server thread attaches a device name other than the default specified by the global PHFONT environment variable, then it is not notified of dynamic font changes unless directly messaged.

Returns:

0
Success
-1
An error occurred (errno is set).

Examples:

See the example in PfAttachLocalDll().

Classification:

Photon

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

PfAttachLocalDll(), PfAttachSleuthMonitorDll(), PfRestartServerDll().

Fonts chapter of the Photon Programmer's Guide