0

I'm new at minix 3.2.1 and I'd like to change a certain system call and its output. For example when I type mkdir Newdirectory, I want to see in the screen New dir -> myNewDirectory 755 (755 stands for the access rights). How could I achieve this?

peterh
  • 11,875
  • 18
  • 85
  • 108
Georgia
  • 9
  • 1

1 Answers1

0

first of all you need to find the correct file to modify. For your example, you can modify the mkdir command by changing/adding code in the usr/src/servers/vfs/open.c file. If you look the open.c file you'll see that there is a do_mkdir function there. You can use :

printf("New dir -> %s",fullpath);

do_mkdir actually has the name of the new directory in the fullpath array so don't have to make a variable yourself. As for the acces rights you can use S_IRWXU/S_IRWXG/S_IRWXO to see the acces rights(for more information visit http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html). For example you can store the access rights in integer variables :

if(bits & S_IRUSR) x = x + 4;
if(bits & S_IWUSR) x = x + 2;
if(bits % S_IXUSR) x = x + 1;

Just do the same for the group and others rights and there you go

Keep in mind that you'll need to compile the file in order to aply the changes. Go to usr/src/realeasetools directory and use the make hdbootcommand in the terminal. Restart and you'll see the changes.

Dimitris Delis
  • 55
  • 1
  • 13