Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!umd5!uvaarpa!mcnc!decvax!ucbvax!cbosgd!cbdkc1!pmd From: pmd@cbdkc1.ATT.COM (Paul Dubuc) Newsgroups: comp.lang.c Subject: Re: system Message-ID: <2824@cbdkc1.ATT.COM> Date: 2 Feb 88 15:39:16 GMT References: <127@dcrbg1.UUCP> <1670009@otter.HP.COM> <7@obie.UUCP> Reply-To: pmd@cbdkc1.UUCP (Paul Dubuc) Organization: AT&T Bell Laboratories; Columbus, Ohio Lines: 26 In article <7@obie.UUCP> wes@obie.UUCP (Barnacle Wes) writes: }On System V, directories are made with the system call mknod(2). }To make the directory '/usr/fool' with rwxrwxr-x permissions, }you would use: } } mknod("/usr/fool", 040775, 0); } }The mode bits are: 040000: make directory, 0775: permission bits. It's already been mentioned that System Vr3 has a mkdir() call, but in the older systems, this still won't do the whole job of making a directory. After the mknod(), you need two calls to link() to make it properly: link("/usr/fool", "/usr/fool/."); link("/usr", "/usr/fool/.."); This *still* requires the calling program to have super-user permission, so I think the solution of using a routine that exec's the mkdir comand is better. I never understood why making directories was a super user priviledge. Can someone enlighten me? Since they changed it in r3 of sys V, there must not have been a good reason. -- Paul Dubuc {ihnp4,cbosgd}!cbdkc1!pmd