(If you go over 512 bytes the standard tmpbuf/brelse solution won't work, so
for bigger systems malloc may be preferred)
inoptr r;
char *tb;
- tb = (char*)tmpbuf(); /* temporary memory to hold kernel's copy of the filename */
+ tb = (char*)pathbuf(); /* temporary memory to hold kernel's copy of the filename */
if (ugets(uname, tb, 512) == -1) {
udata.u_error = EFAULT;
r = kn_open(tb, parent);
- brelse(tb);
+ pathfree(tb);
return r;
}
#define limit_exceeded(x,y) (0)
#define can_signal(p, sig) \
(udata.u_ptab->p_uid == (p)->p_uid || super())
-
+#define pathbuf() tmpbuf()
+#define pathfree(tb) brelse(tb)
#endif
#define CPM_EMULATOR_FILENAME "/usr/cpm/emulator"
extern void jobcontrol_out(struct tty *tty);
extern int tcsetpgrp(struct tty *tty, char *data);
+/* Platform must implement according to its PATH_MAX and allocators. If
+ you are using a 512 byte path limit then calling tmpbuf() and brelse()
+ is sufficient */
+extern char *pathhbuf(void);
+extern void pathfree(char *p);
+
/* The first half of this always gets used with a constant so using a macro
turns the whole thing into a constant 32bit comparison with a fixed
or global register memory address */