Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
init: Add support for SOCK_SEQPACKET socket type
Browse files Browse the repository at this point in the history
Change-Id: Ib264ecf9beb2685b070436d2bdec9655c7a31b47
Signed-off-by: Mike Lockwood <lockwood@android.com>
  • Loading branch information
mikeandroid committed Oct 1, 2010
1 parent 2f7b72f commit 912ff85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ void service_start(struct service *svc, const char *dynamic_args)
add_environment(ei->name, ei->value);

for (si = svc->sockets; si; si = si->next) {
int s = create_socket(si->name,
!strcmp(si->type, "dgram") ?
SOCK_DGRAM : SOCK_STREAM,
int socket_type = (
!strcmp(si->type, "stream") ? SOCK_STREAM :
(!strcmp(si->type, "dgram") ? SOCK_DGRAM : SOCK_SEQPACKET));
int s = create_socket(si->name, socket_type,
si->perm, si->uid, si->gid);
if (s >= 0) {
publish_socket(si->name, s);
Expand Down
5 changes: 3 additions & 2 deletions init/init_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,9 @@ static void parse_line_service(struct parse_state *state, int nargs, char **args
parse_error(state, "socket option requires name, type, perm arguments\n");
break;
}
if (strcmp(args[2],"dgram") && strcmp(args[2],"stream")) {
parse_error(state, "socket type must be 'dgram' or 'stream'\n");
if (strcmp(args[2],"dgram") && strcmp(args[2],"stream")
&& strcmp(args[2],"seqpacket")) {
parse_error(state, "socket type must be 'dgram', 'stream' or 'seqpacket'\n");
break;
}
si = calloc(1, sizeof(*si));
Expand Down
2 changes: 1 addition & 1 deletion init/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ setenv <name> <value>

socket <name> <type> <perm> [ <user> [ <group> ] ]
Create a unix domain socket named /dev/socket/<name> and pass
its fd to the launched process. <type> must be "dgram" or "stream".
its fd to the launched process. <type> must be "dgram", "stream" or "seqpacket".
User and group default to 0.

user <username>
Expand Down

0 comments on commit 912ff85

Please sign in to comment.