path: root/src/pies.h
diff options
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-24 00:44:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-24 00:44:28 +0200
commit68796f86fe6abae13debf253c0e16b4bac9c1bca (patch)
tree5ab80057618ae33c10f44c9be1ee307e367747ff /src/pies.h
parent2d3d121453b19003c6454e7c6b4ed98164e7d531 (diff)
Handle non-stream sockets. Pies can now replace inetd (- inetd.conf and built-in services).
* src/pies.c (component_keywords): New keywords: wait, socket-type. (component_verify): Add more checks. * src/pies.h (CF_WAIT): New define. (struct component): New member: socket_type. (struct pies_url): Rename proto to scheme. New members: proto, proto_s, port_s (register_listener): Remove proto. (register_socket): New proto. (create_socket): Change signature. (disable_socket, enable_socket): New protos. * src/progman.c (close_fds): New function. (open_redirector): Use close_fds. (prog_start): Use close_fds. Update call to create_socket. Disable socket if wait is set. (progman_accept): Support non-stream (and stream+wait) sockets. (component_fixup_depend): Update call to create_socket. Call register_socket. (run_command): Use close_fds. Re-enable socket if wait is set. * src/socket.c (create_socket): Take additional argument: socket_type. (register_socket): New function. (disable_socket, enable_socket): New functions. (pies_pause): Add missing break. * src/url.c (url_parse_host): Accept service name and numberic port number. (url_parse_proto): Rename to url_parse_scheme. All callers updated. (url_parse_scheme): Allow for optional protocol specification in scheme field (after a '+' sign). (pies_url_destroy): Free new fields.
Diffstat (limited to 'src/pies.h')
1 files changed, 13 insertions, 4 deletions
diff --git a/src/pies.h b/src/pies.h
index 02211a2..68a2ff5 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -137,7 +137,9 @@ enum pies_comp_mode
#define CF_DISABLED 0x01 /* The componenet is disabled */
-#define CF_PRECIOUS 0x02 /* The component is precious (cannot be disabled) */
+#define CF_PRECIOUS 0x02 /* The component is precious (should not
+ be disabled) */
+#define CF_WAIT 0x04
struct component
@@ -152,6 +154,7 @@ struct component
gl_list_t depend; /* Dependency targets */
int flags; /* CF_ bitmask */
size_t max_instances; /* Maximum number of running instances */
+ int socket_type; /* Socket type */
char *rmfile; /* Try to remove this file before starting */
struct pies_privs privs; /* UID/GIDS+groups to run under */
mode_t umask; /* Umask to install before starting */
@@ -229,9 +232,12 @@ struct grecs_keyword *find_component_keyword (const char *ident);
struct pies_url
char *string;
- char *proto;
+ char *scheme;
char *host;
+ char *port_s;
int port;
+ char *proto_s;
+ int proto;
char *path;
char *user;
char *passwd;
@@ -244,9 +250,12 @@ void pies_url_destroy (struct pies_url **purl);
const char * pies_url_get_arg (struct pies_url *url, const char *argname);
void pies_pause (void);
-int register_listener (int fd);
+int register_socket (int socktype, int fd);
int pass_fd (const char *socket, int fd, unsigned time_out);
-int create_socket (struct pies_url *url, const char *user, mode_t umask);
+int create_socket (struct pies_url *url, int socket_type,
+ const char *user, mode_t umask);
+int disable_socket (int fd);
+int enable_socket (int fd);
int parse_limits (limits_record_t *plrec, char *str, char **endp);

Return to:

Send suggestions and report system problems to the System administrator.