Deleted Added
full compact
pdb.c (169857) pdb.c (201227)
1/*
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/usr.sbin/sa/pdb.c 169857 2007-05-22 06:51:38Z dds $");
32__FBSDID("$FreeBSD: head/usr.sbin/sa/pdb.c 201227 2009-12-29 22:53:27Z ed $");
33
34#include <sys/types.h>
35#include <sys/acct.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>
39#include <stdbool.h>
40#include <stdint.h>

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

89 civ2.ci_flags = civ1.ci_flags;
90 data->size = sizeof(civ2);
91 data->data = &civ2;
92 return (0);
93}
94
95/* Copy pdb_file to in-memory pacct_db. */
96int
33
34#include <sys/types.h>
35#include <sys/acct.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>
39#include <stdbool.h>
40#include <stdint.h>

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

89 civ2.ci_flags = civ1.ci_flags;
90 data->size = sizeof(civ2);
91 data->data = &civ2;
92 return (0);
93}
94
95/* Copy pdb_file to in-memory pacct_db. */
96int
97pacct_init()
97pacct_init(void)
98{
99 return (db_copy_in(&pacct_db, pdb_file, "process accounting",
100 NULL, v1_to_v2));
101}
102
103void
98{
99 return (db_copy_in(&pacct_db, pdb_file, "process accounting",
100 NULL, v1_to_v2));
101}
102
103void
104pacct_destroy()
104pacct_destroy(void)
105{
106 db_destroy(pacct_db, "process accounting");
107}
108
109int
110pacct_add(const struct cmdinfo *ci)
111{
112 DBT key, data;

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

145 return (-1);
146 }
147
148 return (0);
149}
150
151/* Copy in-memory pacct_db to pdb_file. */
152int
105{
106 db_destroy(pacct_db, "process accounting");
107}
108
109int
110pacct_add(const struct cmdinfo *ci)
111{
112 DBT key, data;

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

145 return (-1);
146 }
147
148 return (0);
149}
150
151/* Copy in-memory pacct_db to pdb_file. */
152int
153pacct_update()
153pacct_update(void)
154{
155 return (db_copy_out(pacct_db, pdb_file, "process accounting",
156 NULL));
157}
158
159void
154{
155 return (db_copy_out(pacct_db, pdb_file, "process accounting",
156 NULL));
157}
158
159void
160pacct_print()
160pacct_print(void)
161{
162 BTREEINFO bti;
163 DBT key, data, ndata;
164 DB *output_pacct_db;
165 struct cmdinfo *cip, ci, ci_total, ci_other, ci_junk;
166 int rv;
167
168 bzero(&ci_total, sizeof ci_total);

--- 206 unchanged lines hidden ---
161{
162 BTREEINFO bti;
163 DBT key, data, ndata;
164 DB *output_pacct_db;
165 struct cmdinfo *cip, ci, ci_total, ci_other, ci_junk;
166 int rv;
167
168 bzero(&ci_total, sizeof ci_total);

--- 206 unchanged lines hidden ---