Date: Tue, 01 Apr 2014 09:45:22 -0500 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Mateusz Guzik <mjg@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r263981 - in head: lib/libc/gen sys/kern sys/sys Message-ID: <8fec12199b9480cbf1abaea126fa264e@shatow.net> In-Reply-To: <20140401012455.GA26117@dft-labs.eu> References: <20140401012455.GA26117@dft-labs.eu>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2014-03-31 20:24, Mateusz Guzik wrote: > Author: mjg > Date: Tue Apr 1 03:20:35 2014 > > New Revision: 263981 > URL: http://svnweb.freebsd.org/changeset/base/263981 > > Log: > Add a new errno: EMACS - Editor too big. > > Make a best-effort to detect that Emacs is about to executed and > return > the error. > > MFC after: 1 week > > Modified: > head/lib/libc/gen/errlst.c > head/sys/kern/kern_exec.c > head/sys/sys/errno.h > > Modified: lib/libc/gen/errlst.c > =================================================================== > --- head/lib/libc/gen/errlst.c (263980) > +++ head/lib/libc/gen/errlst.c (263981) > @@ -155,6 +155,7 @@ > "Not permitted in capability mode", /* 94 - ECAPMODE */ > "State not recoverable", /* 95 - ENOTRECOVERABLE */ > "Previous owner died", /* 96 - EOWNERDEAD */ > + "Editor too big", /* 97 - EMACS */ > }; > const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); > > Modified: sys/kern/kern_exec.c > =================================================================== > --- head/sys/kern/kern_exec.c (263980) > +++ head/sys/kern/kern_exec.c (263981) > @@ -337,6 +337,7 @@ > int (*img_first)(struct image_params *); > struct pargs *oldargs = NULL, *newargs = NULL; > struct sigacts *oldsigacts, *newsigacts; > + char *e; > #ifdef KTRACE > struct vnode *tracevp = NULL; > struct ucred *tracecred = NULL; > @@ -418,6 +419,19 @@ > > SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); > > + /* > + * A best-effort to check whether the file to be run is EMACS > + */ > + if (args->fname != NULL) { > + e = args->fname + strlen(args->fname); > + while (e > args->fname && *e != '/') > + e--; > + if (strcasecmp(e, "/emacs") == 0) { > + error = EMACS; > + goto exec_fail; > + } > + } > + > interpret: > if (args->fname != NULL) { > #ifdef CAPABILITY_MODE > Modified: sys/sys/errno.h > =================================================================== > --- head/sys/sys/errno.h (263980) > +++ head/sys/sys/errno.h (263981) > @@ -178,10 +178,11 @@ > #define ECAPMODE 94 /* Not permitted in capability mode */ > #define ENOTRECOVERABLE 95 /* State not recoverable */ > #define EOWNERDEAD 96 /* Previous owner died */ > +#define EMACS 97 /* Editor too big */ > #endif /* _POSIX_SOURCE */ > > #ifndef _POSIX_SOURCE > -#define ELAST 96 /* Must be equal largest errno */ > +#define ELAST 97 /* Must be equal largest errno */ > #endif /* _POSIX_SOURCE */ > > #ifdef _KERNEL Don't forget errno(2): Index: lib/libc/sys/intro.2 =================================================================== --- lib/libc/sys/intro.2 (revision 263940) +++ lib/libc/sys/intro.2 (working copy) @@ -28,7 +28,7 @@ .\" @(#)intro.2 8.5 (Berkeley) 2/27/95 .\" $FreeBSD$ .\" -.Dd May 4, 2013 +.Dd April 1, 2014 .Dt INTRO 2 .Os .Sh NAME @@ -474,6 +474,8 @@ The state protected by a robust mutex is not recoverable. .It Er 96 EOWNERDEAD Em "Previous owner died" . The owner of a robust mutex terminated while holding the mutex lock. +.It Er 97 EMACS Em "Editor too big" . +Attempted to run EMACS. .El .Sh DEFINITIONS .Bl -tag -width Ds -- Regards, Bryan Drewery
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8fec12199b9480cbf1abaea126fa264e>