usched: Allow process to change self cpu affinity
[dragonfly.git] / contrib / nvi2 / ex / ex_stop.c
blob4bc1bb2a5e2d04e53a54f0ca67640c2ab0af13ef
1 /*-
2 * Copyright (c) 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
8 */
10 #include "config.h"
12 #ifndef lint
13 static const char sccsid[] = "$Id: ex_stop.c,v 10.11 2001/06/25 15:19:20 skimo Exp $";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/queue.h>
18 #include <sys/time.h>
20 #include <bitstring.h>
21 #include <errno.h>
22 #include <limits.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <unistd.h>
27 #include "../common/common.h"
30 * ex_stop -- :stop[!]
31 * :suspend[!]
32 * Suspend execution.
34 * PUBLIC: int ex_stop(SCR *, EXCMD *);
36 int
37 ex_stop(SCR *sp, EXCMD *cmdp)
39 int allowed;
41 /* For some strange reason, the force flag turns off autowrite. */
42 if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && file_aw(sp, FS_ALL))
43 return (1);
45 if (sp->gp->scr_suspend(sp, &allowed))
46 return (1);
47 if (!allowed)
48 ex_emsg(sp, NULL, EXM_NOSUSPEND);
49 return (0);