mconsole_user.c (0612ec48762bf8712db1925b2e67246d2237ebab) mconsole_user.c (91b165c0594ab78c64f26d26e3174e6dfd60ed9d)
1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com)
4 * Licensed under the GPL
5 */
6
7#include <stdio.h>
8#include <stdlib.h>
9#include <errno.h>
10#include <signal.h>
11#include <sys/socket.h>
12#include <sys/types.h>
13#include <sys/uio.h>
14#include <sys/un.h>
15#include <unistd.h>
16#include "user.h"
17#include "mconsole.h"
18#include "umid.h"
1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2003 Jeff Dike (jdike@addtoit.com)
4 * Licensed under the GPL
5 */
6
7#include <stdio.h>
8#include <stdlib.h>
9#include <errno.h>
10#include <signal.h>
11#include <sys/socket.h>
12#include <sys/types.h>
13#include <sys/uio.h>
14#include <sys/un.h>
15#include <unistd.h>
16#include "user.h"
17#include "mconsole.h"
18#include "umid.h"
19#include "user_util.h"
19
20static struct mconsole_command commands[] = {
21 /* With uts namespaces, uts information becomes process-specific, so
22 * we need a process context. If we try handling this in interrupt
23 * context, we may hit an exiting process without a valid uts
24 * namespace.
25 */
26 { "version", mconsole_version, MCONSOLE_PROC },

--- 33 unchanged lines hidden (view full) ---

60 return sendmsg(req->originating_fd, &msg, 0);
61}
62
63static struct mconsole_command *mconsole_parse(struct mc_request *req)
64{
65 struct mconsole_command *cmd;
66 int i;
67
20
21static struct mconsole_command commands[] = {
22 /* With uts namespaces, uts information becomes process-specific, so
23 * we need a process context. If we try handling this in interrupt
24 * context, we may hit an exiting process without a valid uts
25 * namespace.
26 */
27 { "version", mconsole_version, MCONSOLE_PROC },

--- 33 unchanged lines hidden (view full) ---

61 return sendmsg(req->originating_fd, &msg, 0);
62}
63
64static struct mconsole_command *mconsole_parse(struct mc_request *req)
65{
66 struct mconsole_command *cmd;
67 int i;
68
68 for(i=0;i<sizeof(commands)/sizeof(commands[0]);i++){
69 for(i = 0; i < ARRAY_SIZE(commands); i++){
69 cmd = &commands[i];
70 if(!strncmp(req->request.data, cmd->command,
71 strlen(cmd->command))){
70 cmd = &commands[i];
71 if(!strncmp(req->request.data, cmd->command,
72 strlen(cmd->command))){
72 return(cmd);
73 return cmd;
73 }
74 }
74 }
75 }
75 return(NULL);
76 return NULL;
76}
77
78#define MIN(a,b) ((a)<(b) ? (a):(b))
79
80#define STRINGX(x) #x
81#define STRING(x) STRINGX(x)
82
83int mconsole_get_request(int fd, struct mc_request *req)

--- 144 unchanged lines hidden ---
77}
78
79#define MIN(a,b) ((a)<(b) ? (a):(b))
80
81#define STRINGX(x) #x
82#define STRING(x) STRINGX(x)
83
84int mconsole_get_request(int fd, struct mc_request *req)

--- 144 unchanged lines hidden ---