Ninja
Classes | Static Public Member Functions | List of all members
Jobserver Struct Reference

Jobserver provides types related to managing a pool of "job slots" using the GNU Make jobserver ptocol described at: More...

#include <jobserver.h>

Classes

class  Client
 A Jobserver::Client instance models a client of an external GNU jobserver pool, which can be implemented as a Unix FIFO, or a Windows named semaphore. More...
 
struct  Config
 A Jobserver::Config models how to access or implement a GNU jobserver implementation. More...
 
struct  Slot
 A Jobserver::Slot models a single job slot that can be acquired from. More...
 

Static Public Member Functions

static bool ParseMakeFlagsValue (const char *makeflags_env, Config *config, std::string *error)
 Parse the value of a MAKEFLAGS environment variable. More...
 
static bool ParseNativeMakeFlagsValue (const char *makeflags_env, Config *config, std::string *error)
 A variant of ParseMakeFlagsValue() that will return an error if the parsed result is not compatible with the native system. More...
 

Detailed Description

Jobserver provides types related to managing a pool of "job slots" using the GNU Make jobserver ptocol described at:

https://www.gnu.org/software/make/manual/html_node/Job-Slots.html

Definition at line 28 of file jobserver.h.

Member Function Documentation

◆ ParseMakeFlagsValue()

bool Jobserver::ParseMakeFlagsValue ( const char *  makeflags_env,
Jobserver::Config config,
std::string *  error 
)
static

Parse the value of a MAKEFLAGS environment variable.

On success return true and set |*config|. On failure, return false and set |*error| to explain what's wrong. If |makeflags_env| is nullptr or an empty string, this returns success and sets |config->mode| to Config::kModeNone.

Return default Config instance with kModeNone if input is null or empty.

Definition at line 69 of file jobserver.cc.

References StringPiece::AsString(), Jobserver::Config::kModePipe, Jobserver::Config::kModePosixFifo, Jobserver::Config::kModeWin32Semaphore, Jobserver::Config::mode, and Jobserver::Config::path.

Referenced by ParseNativeMakeFlagsValue(), and TEST().

◆ ParseNativeMakeFlagsValue()

bool Jobserver::ParseNativeMakeFlagsValue ( const char *  makeflags_env,
Jobserver::Config config,
std::string *  error 
)
static

A variant of ParseMakeFlagsValue() that will return an error if the parsed result is not compatible with the native system.

I.e.:

–jobserver-auth=R,W is not supported on any system (but recognized to provide a relevant error message to the user).

–jobserver-auth=NAME onlw works on Windows.

–jobserver-auth=fifo:PATH only works on Posix.

Definition at line 186 of file jobserver.cc.

References Jobserver::Config::kModePipe, Jobserver::Config::kModePosixFifo, Jobserver::Config::kModeWin32Semaphore, Jobserver::Config::mode, and ParseMakeFlagsValue().

Referenced by TEST().


The documentation for this struct was generated from the following files: