mpool.3 (2efeeba554cbd7bdee9cfe17641c8bd335c7972f) mpool.3 (d64982518242686ea2827535231707ad7fc7c0ac)
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

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

56.Fn mpool_get "MPOOL *mp" "pgno_t pgno" "u_int flags"
57.Ft int
58.Fn mpool_put "MPOOL *mp" "void *pgaddr" "u_int flags"
59.Ft int
60.Fn mpool_sync "MPOOL *mp"
61.Ft int
62.Fn mpool_close "MPOOL *mp"
63.Sh DESCRIPTION
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

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

56.Fn mpool_get "MPOOL *mp" "pgno_t pgno" "u_int flags"
57.Ft int
58.Fn mpool_put "MPOOL *mp" "void *pgaddr" "u_int flags"
59.Ft int
60.Fn mpool_sync "MPOOL *mp"
61.Ft int
62.Fn mpool_close "MPOOL *mp"
63.Sh DESCRIPTION
64.Nm Mpool
65is the library interface intended to provide page oriented buffer management
64The
65.Nm mpool
66library interface is intended to provide page oriented buffer management
66of files.
67The buffers may be shared between processes.
68.Pp
67of files.
68The buffers may be shared between processes.
69.Pp
69The function
70The
70.Fn mpool_open
71.Fn mpool_open
71initializes a memory pool.
72function initializes a memory pool.
72The
73.Fa key
74argument is the byte string used to negotiate between multiple
75processes wishing to share buffers.
76If the file buffers are mapped in shared memory, all processes using
77the same key will share the buffers.
78If
79.Fa key

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

113If the
114.Fa pgout
115function is specified, it is called each time a buffer is written into the
116backing file.
117Both functions are called with the
118.Fa pgcookie
119pointer, the page number and a pointer to the page to being read or written.
120.Pp
73The
74.Fa key
75argument is the byte string used to negotiate between multiple
76processes wishing to share buffers.
77If the file buffers are mapped in shared memory, all processes using
78the same key will share the buffers.
79If
80.Fa key

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

114If the
115.Fa pgout
116function is specified, it is called each time a buffer is written into the
117backing file.
118Both functions are called with the
119.Fa pgcookie
120pointer, the page number and a pointer to the page to being read or written.
121.Pp
121The function
122The
122.Fn mpool_new
123.Fn mpool_new
123takes an
124function takes an
124.Ft MPOOL
125pointer and an address as arguments.
126If a new page can be allocated, a pointer to the page is returned and
127the page number is stored into the
128.Fa pgnoaddr
129address.
130Otherwise,
131.Dv NULL
132is returned and
133.Va errno
134is set.
135.Pp
125.Ft MPOOL
126pointer and an address as arguments.
127If a new page can be allocated, a pointer to the page is returned and
128the page number is stored into the
129.Fa pgnoaddr
130address.
131Otherwise,
132.Dv NULL
133is returned and
134.Va errno
135is set.
136.Pp
136The function
137The
137.Fn mpool_get
138.Fn mpool_get
138takes a
139function takes a
139.Ft MPOOL
140pointer and a page number as arguments.
141If the page exists, a pointer to the page is returned.
142Otherwise,
143.Dv NULL
144is returned and
145.Va errno
146is set.
147The
148.Fa flags
149argument is not currently used.
150.Pp
140.Ft MPOOL
141pointer and a page number as arguments.
142If the page exists, a pointer to the page is returned.
143Otherwise,
144.Dv NULL
145is returned and
146.Va errno
147is set.
148The
149.Fa flags
150argument is not currently used.
151.Pp
151The function
152The
152.Fn mpool_put
153.Fn mpool_put
153unpins the page referenced by
154function unpins the page referenced by
154.Fa pgaddr .
155The
156.Fa pgaddr
157argument
158must be an address previously returned by
159.Fn mpool_get
160or
161.Fn mpool_new .

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

169The page has been modified and needs to be written to the backing file.
170.El
171.Pp
172The
173.Fn mpool_put
174function
175returns 0 on success and -1 if an error occurs.
176.Pp
155.Fa pgaddr .
156The
157.Fa pgaddr
158argument
159must be an address previously returned by
160.Fn mpool_get
161or
162.Fn mpool_new .

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

170The page has been modified and needs to be written to the backing file.
171.El
172.Pp
173The
174.Fn mpool_put
175function
176returns 0 on success and -1 if an error occurs.
177.Pp
177The function
178The
178.Fn mpool_sync
179.Fn mpool_sync
179writes all modified pages associated with the
180function writes all modified pages associated with the
180.Ft MPOOL
181pointer to the
182backing file.
183The
184.Fn mpool_sync
185function
186returns 0 on success and -1 if an error occurs.
187.Pp

--- 59 unchanged lines hidden ---
181.Ft MPOOL
182pointer to the
183backing file.
184The
185.Fn mpool_sync
186function
187returns 0 on success and -1 if an error occurs.
188.Pp

--- 59 unchanged lines hidden ---