tools/toollib: remove from main Makefile.in
[AROS.git] / compiler / posixc / umask.c
blob1516e3a289836b3ca6a0fd745c9828ae9e343ea3
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/symbolsets.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
10 #include LC_LIBDEFS_FILE
12 /*****************************************************************************
14 NAME */
16 mode_t umask(
18 /* SYNOPSIS */
19 mode_t numask)
21 /* FUNCTION
23 INPUTS
25 RESULT
27 NOTES
28 umask is currently remembered but not used in any function
30 EXAMPLE
32 BUGS
34 SEE ALSO
36 INTERNALS
38 ******************************************************************************/
40 struct PosixCIntBase *PosixCBase =
41 (struct PosixCIntBase *)__aros_getbase_PosixCBase();
42 mode_t oumask = PosixCBase->umask;
44 PosixCBase->umask = numask;
46 return oumask;
49 static int __umask_init(struct PosixCIntBase *PosixCBase)
51 struct PosixCIntBase *pPosixCBase;
53 pPosixCBase = __GM_GetBaseParent(PosixCBase);
55 /* TODO: Implement umask() properly
56 Currently information is not used in any of the related functions
59 /* Child of exec*()/vfork() functions inherit umask of parent */
60 if (pPosixCBase && (pPosixCBase->flags & (VFORK_PARENT | EXEC_PARENT)))
61 PosixCBase->umask = pPosixCBase->umask;
62 else
63 PosixCBase->umask = S_IWGRP|S_IWOTH;
65 return 1;
68 ADD2OPENLIB(__umask_init, 0);