don't use SEM_UNDO because of ridiculously small undo limits on some
[Samba.git] / source / wsmbstatus.c
blob2762b8610e7f1a5f5043be91847314c78a42639a
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 html status reporting
5 Copyright (C) Andrew Tridgell 1997
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifdef SYSLOG
23 #undef SYSLOG
24 #endif
26 #include "includes.h"
28 static void print_header(void)
30 printf("Content-type: text/html\n\n");
31 printf("<HTML>\n<HEAD>\n<TITLE>smbstatus</TITLE>\n</HEAD>\n<BODY>\n\n");
34 static void print_footer(void)
36 printf("\n</BODY>\n</HTML>\n");
39 static void show_connections(void)
41 static pstring servicesf = CONFIGFILE;
42 pstring fname;
43 FILE *f;
44 struct connect_record crec;
46 if (!lp_load(servicesf,False)) {
47 printf("Can't load %s - run testparm to debug it\n", servicesf);
48 return;
51 strcpy(fname,lp_lockdir());
52 standard_sub_basic(fname);
53 trim_string(fname,"","/");
54 strcat(fname,"/STATUS..LCK");
56 f = fopen(fname,"r");
57 if (!f) {
58 printf("Couldn't open status file %s\n",fname);
59 if (!lp_status(-1))
60 printf("You need to have status=yes in your smb config file\n");
61 return;
65 printf("\nSamba version %s\n<p>",VERSION);
67 while (!feof(f)) {
68 if (fread(&crec,sizeof(crec),1,f) != 1)
69 break;
70 if (crec.magic == 0x280267 && process_exists(crec.pid)) {
71 printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s<br>",
72 crec.name,uidtoname(crec.uid),
73 gidtoname(crec.gid),crec.pid,
74 crec.machine,crec.addr,
75 asctime(LocalTime(&crec.start)));
78 fclose(f);
81 int main(int argc, char *argv[])
83 print_header();
84 show_connections();
85 print_footer();
86 return 0;