Skip to content

Commit

Permalink
Mark O_GLOBAL as obsolete and disable the slip driver which used the …
Browse files Browse the repository at this point in the history
…functionality.

This patch paves the way for increasing the file limit.

If people need slip functionality, then the driver will need fixing to remove the
O_GLOBAL requirement in a cleaner way.
  • Loading branch information
atic-atac committed Dec 24, 2013
1 parent 3b27d6e commit 25294f6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 100 deletions.
54 changes: 6 additions & 48 deletions sys/console.c
Expand Up @@ -306,29 +306,17 @@ sys_c_auxos (void)
return -(!!file_outstat (get_curproc()->p_fd->ofiles[2]));
}


/* Extended GEMDOS routines
*/

long _cdecl
sys_f_instat (int h)
sys_f_instat (int fh)
{
PROC *proc;
int fh = h;

# if O_GLOBAL
if (fh >= 100)
{
proc = rootproc;
fh -= 100;
}
else
# endif
proc = get_curproc();
PROC *proc = get_curproc();

if (fh < MIN_HANDLE || fh >= proc->p_fd->nfiles)
{
DEBUG (("Finstat: bad handle %d", h));
DEBUG (("Finstat: bad handle %d", fh));
return EBADF;
}

Expand All @@ -338,19 +326,9 @@ sys_f_instat (int h)
long _cdecl
sys_f_outstat (int h)
{
PROC *proc;
PROC *proc = get_curproc();
int fh = h;

# if O_GLOBAL
if (fh >= 100)
{
proc = rootproc;
fh -= 100;
}
else
# endif
proc = get_curproc();

if (fh < MIN_HANDLE || fh >= proc->p_fd->nfiles)
{
DEBUG (("Foutstat: bad handle %d", h));
Expand All @@ -363,19 +341,9 @@ sys_f_outstat (int h)
long _cdecl
sys_f_getchar (int h, int mode)
{
PROC *proc;
PROC *proc = get_curproc();
int fh = h;

# if O_GLOBAL
if (fh >= 100)
{
proc = rootproc;
fh -= 100;
}
else
# endif
proc = get_curproc();

if (fh < MIN_HANDLE || fh >= proc->p_fd->nfiles)
{
DEBUG (("Fgetchar: bad handle %d", h));
Expand All @@ -388,19 +356,9 @@ sys_f_getchar (int h, int mode)
long _cdecl
sys_f_putchar (int h, long c, int mode)
{
PROC *proc;
PROC *proc = get_curproc();
int fh = h;

# if O_GLOBAL
if (fh >= 100)
{
proc = rootproc;
fh -= 100;
}
else
# endif
proc = get_curproc();

if (fh < MIN_HANDLE || fh >= proc->p_fd->nfiles)
{
DEBUG (("Fputchar: bad handle %d", h));
Expand Down
41 changes: 4 additions & 37 deletions sys/dosfile.c
Expand Up @@ -50,33 +50,14 @@ sys_f_open (const char *name, short mode)
struct proc *p = get_curproc();
FILEPTR *fp = NULL;
short fd = MIN_OPEN - 1;
int globl = 0;
long ret;

TRACE (("Fopen(%s, %x)", name, mode));

# if O_GLOBAL
if (mode & O_GLOBAL)
{
if (p->p_cred->ucr->euid)
{
DEBUG (("Fopen(%s): O_GLOBAL denied for non root"));
return EPERM;
}

/* from now the sockets are clean */
if (!stricmp (name, "u:\\dev\\socket"))
{
ALERT (MSG_oglobal_denied);
return EINVAL;
}

ALERT (MSG_global_handle, name);

p = rootproc;
globl = 1;
}
# endif
if (mode & O_GLOBAL) {
ALERT("O_GLOBAL is obsolete, please update your driver (%s)",name);
return EINVAL;
}

/* make sure the mode is legal */
mode &= O_USER;
Expand All @@ -101,12 +82,6 @@ sys_f_open (const char *name, short mode)
/* activate the fp, default is to close non-standard files on exec */
FP_DONE (p, fp, fd, FD_CLOEXEC);

# if O_GLOBAL
if (globl)
/* we just opened a global handle */
fd += 100;
# endif

TRACE (("Fopen: returning %d", fd));
return fd;

Expand All @@ -127,14 +102,6 @@ sys_f_create (const char *name, short attrib)

TRACE (("Fcreate(%s, %x)", name, attrib));

# if O_GLOBAL
if (attrib & O_GLOBAL)
{
DEBUG (("Fcreate(%s): O_GLOBAL denied"));
return EPERM;
}
# endif

assert (p->p_fd && p->p_cwd);

ret = FD_ALLOC (p, &fd, MIN_OPEN);
Expand Down
5 changes: 0 additions & 5 deletions sys/info.c
Expand Up @@ -329,11 +329,6 @@ const char *ERR_dma_addroottimeout = "dma_block: addroottimeout failed!";

/* --------- dosfile.c --------- */

# if O_GLOBAL
const char *MSG_oglobal_denied = "O_GLOBAL for sockets denied; update your network tools";
const char *MSG_global_handle = "Opening global handle (%s)";
# endif

/* -------- filesys.c --------- */

const char *ERR_fsys_inv_fdcwd = "In changedrv() called from %s, invalid fd/cwd";
Expand Down
8 changes: 0 additions & 8 deletions sys/k_fds.c
Expand Up @@ -151,14 +151,6 @@ fp_free (FILEPTR *fp, const char *func)
long
fp_get (struct proc **p, short *fd, FILEPTR **fp, const char *func)
{
# if O_GLOBAL
if (*fd >= 100)
{
*fd -= 100;
*p = rootproc;
}
# endif

assert ((*p));
if( !(*p)->p_fd )
FORCE("fp_get:ERROR:p_fd=0");
Expand Down
2 changes: 1 addition & 1 deletion sys/mint/fcntl.h
Expand Up @@ -79,7 +79,7 @@

# ifdef __KERNEL__
# define O_USER 0x00000fff /* isolates user-settable flag bits */
# define O_GLOBAL 0x00001000 /* for opening a global file */
# define O_GLOBAL 0x00001000 /* OBSOLETE, DONT USE! */
# define O_TTY 0x00002000
# define O_HEAD 0x00004000
# define O_LOCK 0x00008000
Expand Down
2 changes: 1 addition & 1 deletion sys/sockets/xif/Makefile
Expand Up @@ -2,7 +2,7 @@
# Makefile for
#
TARGET =
DRIVERS = rtl8012 rtl8012st dial slip plip dummy de600 lance pamsdma biodma \
DRIVERS = rtl8012 rtl8012st dial plip dummy de600 lance pamsdma biodma \
rieblspc rieblspc_fast rieblmst rieblmst_fast rieblste riebltt

SHELL = /bin/sh
Expand Down

0 comments on commit 25294f6

Please sign in to comment.