File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -92,5 +92,24 @@ void devfsWrite(SyscallHeader *req, SyscallHeader *res) {
92
92
*/
93
93
94
94
void devfsMmap (SyscallHeader * req , SyscallHeader * res ) {
95
- /* todo */
95
+ MmapCommand * cmd = (MmapCommand * ) req ;
96
+ memcpy (res , req , sizeof (MmapCommand ));
97
+
98
+ res -> header .response = 1 ;
99
+ res -> header .length = sizeof (MmapCommand );
100
+
101
+ luxLogf (KPRINT_LEVEL_DEBUG , "mmap for %s\n" , cmd -> path );
102
+
103
+ DeviceFile * dev = findDevice (cmd -> path );
104
+ if (!dev ) {
105
+ res -> header .status = - ENOENT ;
106
+ luxSendKernel (res );
107
+ } else if (dev -> external ) {
108
+ luxSend (dev -> socket , cmd );
109
+ } else {
110
+ // mmap() is only supported for external drivers and not by the default
111
+ // devices (null, random, etc) provided by this server
112
+ res -> header .status = - ENODEV ;
113
+ luxSendKernel (res );
114
+ }
96
115
}
You can’t perform that action at this time.
0 commit comments