xref: /haiku/src/servers/launch/InitSharedMemoryDirectoryJob.cpp (revision 909af08f4328301fbdef1ffb41f566c3b5bec0c7)
1 /*
2  * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 //! Empty main temporary directory
8 
9 
10 #include <fs_volume.h>
11 
12 #include "InitSharedMemoryDirectoryJob.h"
13 
14 
15 InitSharedMemoryDirectoryJob::InitSharedMemoryDirectoryJob()
16 	:
17 	AbstractEmptyDirectoryJob("init /var/shared_memory")
18 {
19 }
20 
21 
22 status_t
23 InitSharedMemoryDirectoryJob::Execute()
24 {
25 	status_t status = CreateAndEmpty("/var/shared_memory");
26 	if (status != B_OK)
27 		return status;
28 
29 	status = fs_mount_volume("/var/shared_memory", NULL, "ramfs", 0, NULL);
30 	if (status < B_OK)
31 		return status;
32 
33 	chmod("/var/shared_memory", 0777);
34 	return B_OK;
35 }
36