Changeset 6235 in vbox
- Timestamp:
- Jan 3, 2008 5:41:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r6231 r6235 33 33 #include <iprt/mem.h> 34 34 #include <VBox/VBoxGuest.h> 35 35 36 36 37 /******************************************************************************* … … 97 98 g_File = hf; 98 99 99 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) 100 /* PORTME */ 101 #else 102 /* the default implemenation. (linux, solaris) */ 100 103 RTFILE File; 101 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE); 102 if (RT_FAILURE(rc)) 103 return rc; 104 g_File = File; 105 106 #else 107 # error port me /** @note isn't it nicer to put a todo error here than to 108 put in a flag which will assert where no-one sees it? */ 109 /* the default implemenation. */ 110 RTFILE File; 111 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_DENY_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 104 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 112 105 if (RT_FAILURE(rc)) 113 106 return rc; … … 163 156 return RTErrConvertFromOS2(rc); 164 157 165 #elif defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) 158 /* PORTME */ 159 #else 160 /* Defalut implementation (linux, solaris). */ 166 161 int rc2 = VERR_INTERNAL_ERROR; 167 162 int rc = RTFileIoCtl(g_File, (int)iFunction, pvData, cbData, &rc2); … … 169 164 rc = rc2; 170 165 return rc; 171 #else172 # error "PORTME"173 # if 0 /* if this works for anyone I'd be amazed. */174 int rc2 = VERR_INTERNAL_ERROR;175 int rc = RTFileIoCtl(g_File, (int)iFunction, pvData, cbData, &rc2);176 if (RT_SUCCESS(rc))177 rc = rc2;178 return rc;179 # endif180 166 #endif 181 167 } … … 245 231 } 246 232 233 247 234 /** 248 235 * Write to the backdoor logger from ring 3 guest code. 249 * @note this currently does not accept more than 255 bytes of data at 250 * one time. It should probably be rewritten to use pass a pointer 251 * in the IOCtl. 252 * 236 * 253 237 * @returns IPRT status code 238 * 239 * @remakes This currently does not accept more than 255 bytes of data at 240 * one time. It should probably be rewritten to use pass a pointer 241 * in the IOCtl. 254 242 */ 255 243 VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cb) 256 244 { 245 /* 246 * Solaris does not accept more than 255 bytes of data per ioctl request, 247 * so split large string into 128 byte chunks to prevent truncation. 248 */ 249 #define STEP 128 257 250 int rc = VINF_SUCCESS; 258 259 /* Solaris does not accept more than 255 bytes of data. */ 260 #define STEP 128 261 for (size_t iOffs = 0; (iOffs < cb) && (RT_SUCCESS(rc)); iOffs += STEP) 251 for (size_t off = 0; off < cb && RT_SUCCESS(rc); off += STEP) 262 252 { 263 rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_LOG(cb), (void *) (pch + iOffs),264 iOffs + STEP < cb ? STEP : cb - iOffs);253 size_t cbStep = RT_MIN(cb - off, STEP); 254 rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_LOG(cbStep), pch + off, cbStep); 265 255 } 266 256 #undef STEP 267 257 return rc; 268 258 } 259
Note:
See TracChangeset
for help on using the changeset viewer.