compiler/clib: Don't hide access to aroscbase behind a #define.
[AROS.git] / compiler / clib / umask.c
blobb84f38302afc71bdb72452190574859a2a08803d
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "__arosc_privdata.h"
8 #include <aros/symbolsets.h>
9 #include <sys/types.h>
10 #include <sys/stat.h>
12 #include LC_LIBDEFS_FILE
14 /*****************************************************************************
16 NAME */
18 mode_t umask(
20 /* SYNOPSIS */
21 mode_t numask)
23 /* FUNCTION
25 INPUTS
27 RESULT
29 NOTES
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
39 ******************************************************************************/
41 struct aroscbase *aroscbase = __GM_GetBase();
42 mode_t oumask = aroscbase->acb_umask;
44 aroscbase->acb_umask = numask;
46 return oumask;
49 static int __umask_init(struct aroscbase *aroscbase)
51 struct aroscbase *paroscbase;
53 paroscbase = __GM_GetBaseParent(aroscbase);
55 /* FIXME: Implement umask() properly */
57 if (paroscbase && (paroscbase->acb_flags & (VFORK_PARENT | EXEC_PARENT)))
58 aroscbase->acb_umask = paroscbase->acb_umask;
59 else
60 aroscbase->acb_umask = S_IWGRP|S_IWOTH;
62 return 1;
65 ADD2OPENLIB(__umask_init, 0);