Git Product home page Git Product logo

linux-programming-interface-exercises's People

Contributors

csukuangfj avatar dalleng avatar posborne avatar sangeren avatar stevelauc avatar vtronko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux-programming-interface-exercises's Issues

Difference between the cp and copy file

Hi there,
I'm learning from TLPI at the moment and in chapter 4. I was doing the cp exercise and I'm somewhat stuck. I saw your solution and implement it. However, the output isn't any different from the actual copy.c fiile. In both cases, the files are copying the holes. Also, in your code, you have the following line as well: while ((numRead = read(inputFd, buf, BUF_SIZE)) > 0), which says that the loop will continue unless there is an EOF - similar to the actual copy.c file as well. Can you tell me how your version of cp.c is any different from copy.c given that it is giving me identical output? The file I'm referring to is this one.
Thanks.

chattr +i or +a command not working on boot with rc.local

Hi!

I want before login with "rc.local" the command /bin/chattr +i or /bin/chattr +a /path/to/file

"rc.local"
#!/bin/sh
mount -t ramfs -o rw,size=1024M ramfs /path/to/folder
/bin/sleep 4

/bin/tar xvzf /path/to/file.tar.gz -C /path/to/folder
/bin/sleep 4

/bin/chattr +a /path/to/file
/bin/sleep 2

exit 0

chattr +a don't set the +a attribute. chattr can't set the attribute of the file, because
error message says the file is not there, but the file is there.

When I set it manually, then it works.

What's wrong?

exercise 5-4

'dup2' should not check the validation of 'newfd'.
close it directly and sliently.

Exercise 9-5

Hello, your ideas have impressed and helped me a lot. Thanks!
Exercise 9-5 answer may have a mistake.

// setuid()
/* suspend not possible */
/* resume not possible */
setuid(getuid());  /* Permanently drop privileges*/

Exercise 6-3

Hi, I have a few quick questions about your implementation for this exercise.

For your implementation of setenv:

I think that the function as written currently could potentially cause a memory leak and/or shrink the existing environment list. If an environment variable is already defined in the list, and it's found as you iterate through the list, the new value for the environment variable is set appropriately (assuming overwrite != 0). When this happens, isn't there a memory leak that occurs? The memory allocated to store the old value of the environment variable isn't freed, but the pointed to C-string changes. And if this occurs in the middle of the list, the list seems to be truncated (the next element in the list is set to NULL, which denotes the end of the list). Is this intentional?

For your implementation of unsetenv:

I think that the same memory leak concern applies here as well.

Also, in my copy of the book, this exercise includes the following:

Your version of unsetenv() should check to see
whether there are multiple definitions of an environment variable, and remove
them all (which is what the glibc version of unsetenv() does).

But I think the current implementation will only remove one (the first) instance of the environment variable.

Exercise 10-1

The original question is wrong, cite errata, page 210

In the second sentence of exercise 1, change:

Assuming that the clock_t value returned by times() is an unsigned 32-bit integer
to:

Assuming that the clock_t value returned by times() is a signed 32-bit integer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.