diff options
Diffstat (limited to 'vos')
-rw-r--r-- | vos/config.alpha.h | 84 | ||||
-rw-r--r-- | vos/config.ga.h | 84 | ||||
-rw-r--r-- | vos/vos.c | 22 | ||||
-rw-r--r-- | vos/vosish.h | 3 |
4 files changed, 107 insertions, 86 deletions
diff --git a/vos/config.alpha.h b/vos/config.alpha.h index 8d39fe467f..bce8eb5e9e 100644 --- a/vos/config.alpha.h +++ b/vos/config.alpha.h @@ -504,20 +504,6 @@ */ /*#define HAS_SETSID /**/ -/* Shmat_t: - * This symbol holds the return type of the shmat() system call. - * Usually set to 'void *' or 'char *'. - */ -/* HAS_SHMAT_PROTOTYPE: - * This symbol, if defined, indicates that the sys/shm.h includes - * a prototype for shmat(). Otherwise, it is up to the program to - * guess one. Shmat_t shmat _((int, Shmat_t, int)) is a good guess, - * but not always right so it should be emitted by the program only - * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. - */ -#define Shmat_t void * /**/ -#define HAS_SHMAT_PROTOTYPE /**/ - /* HAS_STRCHR: * This symbol is defined to indicate that the strchr()/strrchr() * functions are available for string searching. If not, try the @@ -733,12 +719,6 @@ */ /*#define I_MEMORY /**/ -/* I_NDBM: - * This symbol, if defined, indicates that <ndbm.h> exists and should - * be included. - */ -/*#define I_NDBM /**/ - /* I_NET_ERRNO: * This symbol, if defined, indicates that <net/errno.h> exists and * should be included. @@ -898,24 +878,6 @@ */ /*#define I_VFORK /**/ -/* CAN_PROTOTYPE: - * If defined, this macro indicates that the C compiler can handle - * function prototypes. - */ -/* _: - * This macro is used to declare function parameters for folks who want - * to make declarations with prototypes using a different style than - * the above macros. Use double parentheses. For example: - * - * int main _((int argc, char *argv[])); - */ -#define CAN_PROTOTYPE /**/ -#ifdef CAN_PROTOTYPE -#define _(args) args -#else -#define _(args) () -#endif - /* INTSIZE: * This symbol contains the value of sizeof(int) so that the C * preprocessor can make decisions based on it. @@ -1244,7 +1206,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the drand48() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern double drand48 _((void)); + * extern double drand48(void); */ /*#define HAS_DRAND48_PROTO /**/ @@ -1925,8 +1887,8 @@ * This symbol, if defined, indicates that the system provides * a prototype for the sbrk() function. Otherwise, it is up * to the program to supply one. Good guesses are - * extern void* sbrk _((int)); - * extern void* sbrk _((size_t)); + * extern void* sbrk(int); + * extern void* sbrk(size_t); */ /*#define HAS_SBRK_PROTO /**/ @@ -2284,7 +2246,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the telldir() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern long telldir _((DIR*)); + * extern long telldir(DIR*); */ /*#define HAS_TELLDIR_PROTO /**/ @@ -3420,6 +3382,26 @@ #define SETUID_SCRIPTS_ARE_SECURE_NOW /**/ /*#define DOSUID /**/ +/* Shmat_t: + * This symbol holds the return type of the shmat() system call. + * Usually set to 'void *' or 'char *'. + */ +/* HAS_SHMAT_PROTOTYPE: + * This symbol, if defined, indicates that the sys/shm.h includes + * a prototype for shmat(). Otherwise, it is up to the program to + * guess one. Shmat_t shmat(int, Shmat_t, int) is a good guess, + * but not always right so it should be emitted by the program only + * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. + */ +#define Shmat_t void * /**/ +#define HAS_SHMAT_PROTOTYPE /**/ + +/* I_NDBM: + * This symbol, if defined, indicates that <ndbm.h> exists and should + * be included. + */ +/*#define I_NDBM /**/ + /* I_STDARG: * This symbol, if defined, indicates that <stdarg.h> exists and should * be included. @@ -3431,6 +3413,22 @@ #define I_STDARG /**/ /*#define I_VARARGS /**/ +/* CAN_PROTOTYPE: + * If defined, this macro indicates that the C compiler can handle + * function prototypes. + */ +/* PERL_PROTO_: + * This macro is used to declare function parameters for folks who want + * to make declarations with prototypes using a different style than + * the above macros. Use double parentheses. For example: + * + * int main PERL_PROTO_((int argc, char *argv[])); + */ +#define CAN_PROTOTYPE /**/ +#ifdef CAN_PROTOTYPE +#else +#endif + /* SH_PATH: * This symbol contains the full pathname to the shell used on this * on this system to execute Bourne shell scripts. Usually, this will be @@ -3530,7 +3528,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the sockatmark() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern int sockatmark _((int)); + * extern int sockatmark(int); */ /*#define HAS_SOCKATMARK_PROTO /**/ diff --git a/vos/config.ga.h b/vos/config.ga.h index 974b6e1ac6..ef9cc07fe3 100644 --- a/vos/config.ga.h +++ b/vos/config.ga.h @@ -504,20 +504,6 @@ */ #define HAS_SETSID /**/ -/* Shmat_t: - * This symbol holds the return type of the shmat() system call. - * Usually set to 'void *' or 'char *'. - */ -/* HAS_SHMAT_PROTOTYPE: - * This symbol, if defined, indicates that the sys/shm.h includes - * a prototype for shmat(). Otherwise, it is up to the program to - * guess one. Shmat_t shmat _((int, Shmat_t, int)) is a good guess, - * but not always right so it should be emitted by the program only - * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. - */ -#define Shmat_t void * /**/ -#define HAS_SHMAT_PROTOTYPE /**/ - /* HAS_STRCHR: * This symbol is defined to indicate that the strchr()/strrchr() * functions are available for string searching. If not, try the @@ -733,12 +719,6 @@ */ /*#define I_MEMORY /**/ -/* I_NDBM: - * This symbol, if defined, indicates that <ndbm.h> exists and should - * be included. - */ -/*#define I_NDBM /**/ - /* I_NET_ERRNO: * This symbol, if defined, indicates that <net/errno.h> exists and * should be included. @@ -898,24 +878,6 @@ */ /*#define I_VFORK /**/ -/* CAN_PROTOTYPE: - * If defined, this macro indicates that the C compiler can handle - * function prototypes. - */ -/* _: - * This macro is used to declare function parameters for folks who want - * to make declarations with prototypes using a different style than - * the above macros. Use double parentheses. For example: - * - * int main _((int argc, char *argv[])); - */ -#define CAN_PROTOTYPE /**/ -#ifdef CAN_PROTOTYPE -#define _(args) args -#else -#define _(args) () -#endif - /* INTSIZE: * This symbol contains the value of sizeof(int) so that the C * preprocessor can make decisions based on it. @@ -1244,7 +1206,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the drand48() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern double drand48 _((void)); + * extern double drand48(void); */ /*#define HAS_DRAND48_PROTO /**/ @@ -1925,8 +1887,8 @@ * This symbol, if defined, indicates that the system provides * a prototype for the sbrk() function. Otherwise, it is up * to the program to supply one. Good guesses are - * extern void* sbrk _((int)); - * extern void* sbrk _((size_t)); + * extern void* sbrk(int); + * extern void* sbrk(size_t); */ /*#define HAS_SBRK_PROTO /**/ @@ -2284,7 +2246,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the telldir() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern long telldir _((DIR*)); + * extern long telldir(DIR*); */ /*#define HAS_TELLDIR_PROTO /**/ @@ -3420,6 +3382,26 @@ #define SETUID_SCRIPTS_ARE_SECURE_NOW /**/ /*#define DOSUID /**/ +/* Shmat_t: + * This symbol holds the return type of the shmat() system call. + * Usually set to 'void *' or 'char *'. + */ +/* HAS_SHMAT_PROTOTYPE: + * This symbol, if defined, indicates that the sys/shm.h includes + * a prototype for shmat(). Otherwise, it is up to the program to + * guess one. Shmat_t shmat(int, Shmat_t, int) is a good guess, + * but not always right so it should be emitted by the program only + * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. + */ +#define Shmat_t void * /**/ +#define HAS_SHMAT_PROTOTYPE /**/ + +/* I_NDBM: + * This symbol, if defined, indicates that <ndbm.h> exists and should + * be included. + */ +/*#define I_NDBM /**/ + /* I_STDARG: * This symbol, if defined, indicates that <stdarg.h> exists and should * be included. @@ -3431,6 +3413,22 @@ #define I_STDARG /**/ /*#define I_VARARGS /**/ +/* CAN_PROTOTYPE: + * If defined, this macro indicates that the C compiler can handle + * function prototypes. + */ +/* PERL_PROTO_: + * This macro is used to declare function parameters for folks who want + * to make declarations with prototypes using a different style than + * the above macros. Use double parentheses. For example: + * + * int main PERL_PROTO_((int argc, char *argv[])); + */ +#define CAN_PROTOTYPE /**/ +#ifdef CAN_PROTOTYPE +#else +#endif + /* SH_PATH: * This symbol contains the full pathname to the shell used on this * on this system to execute Bourne shell scripts. Usually, this will be @@ -3530,7 +3528,7 @@ * This symbol, if defined, indicates that the system provides * a prototype for the sockatmark() function. Otherwise, it is up * to the program to supply one. A good guess is - * extern int sockatmark _((int)); + * extern int sockatmark(int); */ /*#define HAS_SOCKATMARK_PROTO /**/ diff --git a/vos/vos.c b/vos/vos.c new file mode 100644 index 0000000000..c3566d4a8e --- /dev/null +++ b/vos/vos.c @@ -0,0 +1,22 @@ +/* Beginning of modification history */ +/* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */ +/* End of modification history */ + +/* VOS doesn't supply a truncate function, so we build one up + from the available POSIX functions. */ + +#include <fcntl.h> +#include <sys/types.h> +#include <unistd.h> + +int +truncate(const char *path, off_t len) +{ + int fd = open(path,O_WRONLY); + int code = -1; + if (fd >= 0) { + code = ftruncate(fd,len); + close(fd); + } + return code; +} diff --git a/vos/vosish.h b/vos/vosish.h index cc5e4642e3..5befc6586a 100644 --- a/vos/vosish.h +++ b/vos/vosish.h @@ -6,3 +6,6 @@ /* The following declaration is an avoidance for posix-950. */ extern int ioctl (int fd, int request, ...); + +/* Specify a prototype for truncate() since we are supplying one. */ +extern int truncate (const char *path, off_t len); |