"Fossies" - the Fresh Open Source Software Archive 
Member "xosview-1.23/gnu/get_def_pager.c" (11 Jul 2020, 1016 Bytes) of package /linux/misc/xosview-1.23.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "get_def_pager.c" see the
Fossies "Dox" file reference documentation.
1 //
2 // Copyright (c) 2007 by Samuel Thibault ( samuel.thibault@ens-lyon.org )
3 //
4 // This file may be distributed under terms of the GPL
5 //
6
7 #define _GNU_SOURCE
8 #include <fcntl.h>
9 #include <error.h>
10
11 #include <mach.h>
12 #include <mach/mach_traps.h>
13 #include <mach/default_pager.h>
14 #include <hurd.h>
15 #include <hurd/paths.h>
16
17 mach_port_t get_def_pager(void) {
18 mach_port_t def_pager = MACH_PORT_NULL;
19 kern_return_t err;
20 mach_port_t host;
21
22 err = get_privileged_ports (&host, 0);
23 if (err == EPERM) {
24 def_pager = file_name_lookup (_SERVERS_DEFPAGER, O_READ, 0);
25 if (def_pager == MACH_PORT_NULL)
26 error (0, errno, _SERVERS_DEFPAGER);
27 return def_pager;
28 } else if (err) {
29 error (0, err, "get_privileged_ports");
30 return MACH_PORT_NULL;
31 } else {
32 err = vm_set_default_memory_manager (host, &def_pager);
33 mach_port_deallocate (mach_task_self(), host);
34 if (err) {
35 error (0, err, "vm_set_default_memory_manager");
36 return MACH_PORT_NULL;
37 }
38 return def_pager;
39 }
40 }